@uvalib/web-components 0.0.0-stage → 1.0.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.
Files changed (254) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/README.md +1164 -2
  3. package/bin/install-skill.mjs +139 -0
  4. package/dist/base/UvalibElement.d.ts +21 -0
  5. package/dist/base/UvalibElement.js +68 -0
  6. package/dist/base/UvalibElement.js.map +1 -0
  7. package/dist/base/analytics.d.ts +44 -0
  8. package/dist/base/analytics.js +59 -0
  9. package/dist/base/analytics.js.map +1 -0
  10. package/dist/base/color-scheme.d.ts +93 -0
  11. package/dist/base/color-scheme.js +267 -0
  12. package/dist/base/color-scheme.js.map +1 -0
  13. package/dist/base/define.d.ts +2 -0
  14. package/dist/base/define.js +6 -0
  15. package/dist/base/define.js.map +1 -0
  16. package/dist/base/heading-level.d.ts +12 -0
  17. package/dist/base/heading-level.js +52 -0
  18. package/dist/base/heading-level.js.map +1 -0
  19. package/dist/base/light-dom-styles.d.ts +18 -0
  20. package/dist/base/light-dom-styles.js +134 -0
  21. package/dist/base/light-dom-styles.js.map +1 -0
  22. package/dist/base.css +30 -0
  23. package/dist/base.d.ts +5 -0
  24. package/dist/base.js +5 -0
  25. package/dist/base.js.map +1 -0
  26. package/dist/components/bento-box/ArticlesSection.d.ts +19 -0
  27. package/dist/components/bento-box/ArticlesSection.js +22 -0
  28. package/dist/components/bento-box/ArticlesSection.js.map +1 -0
  29. package/dist/components/bento-box/BentoBox.d.ts +85 -0
  30. package/dist/components/bento-box/BentoBox.js +366 -0
  31. package/dist/components/bento-box/BentoBox.js.map +1 -0
  32. package/dist/components/bento-box/BentoSection.d.ts +115 -0
  33. package/dist/components/bento-box/BentoSection.js +468 -0
  34. package/dist/components/bento-box/BentoSection.js.map +1 -0
  35. package/dist/components/bento-box/CatalogSection.d.ts +18 -0
  36. package/dist/components/bento-box/CatalogSection.js +19 -0
  37. package/dist/components/bento-box/CatalogSection.js.map +1 -0
  38. package/dist/components/bento-box/LibGuidesSection.d.ts +24 -0
  39. package/dist/components/bento-box/LibGuidesSection.js +73 -0
  40. package/dist/components/bento-box/LibGuidesSection.js.map +1 -0
  41. package/dist/components/bento-box/VirgoSection.d.ts +19 -0
  42. package/dist/components/bento-box/VirgoSection.js +58 -0
  43. package/dist/components/bento-box/VirgoSection.js.map +1 -0
  44. package/dist/components/bento-box/WebsiteSection.d.ts +25 -0
  45. package/dist/components/bento-box/WebsiteSection.js +40 -0
  46. package/dist/components/bento-box/WebsiteSection.js.map +1 -0
  47. package/dist/components/bento-box/bento-box.d.ts +1 -0
  48. package/dist/components/bento-box/bento-box.js +13 -0
  49. package/dist/components/bento-box/bento-box.js.map +1 -0
  50. package/dist/components/bento-box/bento-data.d.ts +147 -0
  51. package/dist/components/bento-box/bento-data.js +422 -0
  52. package/dist/components/bento-box/bento-data.js.map +1 -0
  53. package/dist/components/events-section/EventsSection.d.ts +91 -0
  54. package/dist/components/events-section/EventsSection.js +435 -0
  55. package/dist/components/events-section/EventsSection.js.map +1 -0
  56. package/dist/components/events-section/events-data.d.ts +90 -0
  57. package/dist/components/events-section/events-data.js +174 -0
  58. package/dist/components/events-section/events-data.js.map +1 -0
  59. package/dist/components/events-section/events-section.d.ts +1 -0
  60. package/dist/components/events-section/events-section.js +4 -0
  61. package/dist/components/events-section/events-section.js.map +1 -0
  62. package/dist/components/library-hours/hours-data.d.ts +104 -0
  63. package/dist/components/library-hours/hours-data.js +267 -0
  64. package/dist/components/library-hours/hours-data.js.map +1 -0
  65. package/dist/components/library-hours-setup/LibraryHoursSetup.d.ts +21 -0
  66. package/dist/components/library-hours-setup/LibraryHoursSetup.js +59 -0
  67. package/dist/components/library-hours-setup/LibraryHoursSetup.js.map +1 -0
  68. package/dist/components/library-hours-setup/library-hours-setup.d.ts +1 -0
  69. package/dist/components/library-hours-setup/library-hours-setup.js +5 -0
  70. package/dist/components/library-hours-setup/library-hours-setup.js.map +1 -0
  71. package/dist/components/library-weekly-hours/LibraryWeeklyHours.d.ts +107 -0
  72. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +502 -0
  73. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -0
  74. package/dist/components/library-weekly-hours/library-weekly-hours.d.ts +1 -0
  75. package/dist/components/library-weekly-hours/library-weekly-hours.js +4 -0
  76. package/dist/components/library-weekly-hours/library-weekly-hours.js.map +1 -0
  77. package/dist/components/link.d.ts +2 -0
  78. package/dist/components/link.js +7 -0
  79. package/dist/components/link.js.map +1 -0
  80. package/dist/components/site-analytics/SiteAnalytics.d.ts +44 -0
  81. package/dist/components/site-analytics/SiteAnalytics.js +161 -0
  82. package/dist/components/site-analytics/SiteAnalytics.js.map +1 -0
  83. package/dist/components/site-analytics/SiteAnalyticsMixin.d.ts +8 -0
  84. package/dist/components/site-analytics/SiteAnalyticsMixin.js +22 -0
  85. package/dist/components/site-analytics/SiteAnalyticsMixin.js.map +1 -0
  86. package/dist/components/site-analytics/site-analytics.d.ts +1 -0
  87. package/dist/components/site-analytics/site-analytics.js +4 -0
  88. package/dist/components/site-analytics/site-analytics.js.map +1 -0
  89. package/dist/components/site-footer/SiteFooter.d.ts +34 -0
  90. package/dist/components/site-footer/SiteFooter.js +275 -0
  91. package/dist/components/site-footer/SiteFooter.js.map +1 -0
  92. package/dist/components/site-footer/icons.d.ts +4 -0
  93. package/dist/components/site-footer/icons.js +7 -0
  94. package/dist/components/site-footer/icons.js.map +1 -0
  95. package/dist/components/site-footer/site-footer.d.ts +1 -0
  96. package/dist/components/site-footer/site-footer.js +4 -0
  97. package/dist/components/site-footer/site-footer.js.map +1 -0
  98. package/dist/components/site-header/SiteHeader.d.ts +154 -0
  99. package/dist/components/site-header/SiteHeader.js +845 -0
  100. package/dist/components/site-header/SiteHeader.js.map +1 -0
  101. package/dist/components/site-header/site-header.d.ts +1 -0
  102. package/dist/components/site-header/site-header.js +12 -0
  103. package/dist/components/site-header/site-header.js.map +1 -0
  104. package/dist/components/site-hours-section/SiteHoursSection.d.ts +63 -0
  105. package/dist/components/site-hours-section/SiteHoursSection.js +243 -0
  106. package/dist/components/site-hours-section/SiteHoursSection.js.map +1 -0
  107. package/dist/components/site-hours-section/site-hours-section.d.ts +1 -0
  108. package/dist/components/site-hours-section/site-hours-section.js +4 -0
  109. package/dist/components/site-hours-section/site-hours-section.js.map +1 -0
  110. package/dist/components/site-main-nav/SiteMainNav.d.ts +136 -0
  111. package/dist/components/site-main-nav/SiteMainNav.js +678 -0
  112. package/dist/components/site-main-nav/SiteMainNav.js.map +1 -0
  113. package/dist/components/site-main-nav/main-nav-data.d.ts +5 -0
  114. package/dist/components/site-main-nav/main-nav-data.js +90 -0
  115. package/dist/components/site-main-nav/main-nav-data.js.map +1 -0
  116. package/dist/components/site-main-nav/main-nav-items.d.ts +49 -0
  117. package/dist/components/site-main-nav/main-nav-items.js +138 -0
  118. package/dist/components/site-main-nav/main-nav-items.js.map +1 -0
  119. package/dist/components/site-main-nav/site-main-nav.d.ts +1 -0
  120. package/dist/components/site-main-nav/site-main-nav.js +4 -0
  121. package/dist/components/site-main-nav/site-main-nav.js.map +1 -0
  122. package/dist/components/site-page/SitePage.d.ts +145 -0
  123. package/dist/components/site-page/SitePage.js +480 -0
  124. package/dist/components/site-page/SitePage.js.map +1 -0
  125. package/dist/components/site-page/alerts.d.ts +24 -0
  126. package/dist/components/site-page/alerts.js +78 -0
  127. package/dist/components/site-page/alerts.js.map +1 -0
  128. package/dist/components/site-page/site-page.d.ts +1 -0
  129. package/dist/components/site-page/site-page.js +7 -0
  130. package/dist/components/site-page/site-page.js.map +1 -0
  131. package/dist/components/site-style/SiteStyle.d.ts +37 -0
  132. package/dist/components/site-style/SiteStyle.js +76 -0
  133. package/dist/components/site-style/SiteStyle.js.map +1 -0
  134. package/dist/components/site-style/site-style.d.ts +1 -0
  135. package/dist/components/site-style/site-style.js +4 -0
  136. package/dist/components/site-style/site-style.js.map +1 -0
  137. package/dist/components/uvalib-analytics/UvalibAnalytics.d.ts +10 -0
  138. package/dist/components/uvalib-analytics/UvalibAnalytics.js +11 -0
  139. package/dist/components/uvalib-analytics/UvalibAnalytics.js.map +1 -0
  140. package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.d.ts +13 -0
  141. package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js +25 -0
  142. package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js.map +1 -0
  143. package/dist/components/uvalib-analytics/uvalib-analytics.d.ts +1 -0
  144. package/dist/components/uvalib-analytics/uvalib-analytics.js +4 -0
  145. package/dist/components/uvalib-analytics/uvalib-analytics.js.map +1 -0
  146. package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +46 -0
  147. package/dist/components/uvalib-date-range/UvalibDateRange.js +339 -0
  148. package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -0
  149. package/dist/components/uvalib-date-range/uvalib-date-range.d.ts +1 -0
  150. package/dist/components/uvalib-date-range/uvalib-date-range.js +4 -0
  151. package/dist/components/uvalib-date-range/uvalib-date-range.js.map +1 -0
  152. package/dist/components/uvalib-filter/UvalibFilter.d.ts +73 -0
  153. package/dist/components/uvalib-filter/UvalibFilter.js +279 -0
  154. package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -0
  155. package/dist/components/uvalib-filter/uvalib-filter.d.ts +1 -0
  156. package/dist/components/uvalib-filter/uvalib-filter.js +4 -0
  157. package/dist/components/uvalib-filter/uvalib-filter.js.map +1 -0
  158. package/dist/custom-elements.json +15178 -0
  159. package/dist/data/fetch-json.d.ts +28 -0
  160. package/dist/data/fetch-json.js +43 -0
  161. package/dist/data/fetch-json.js.map +1 -0
  162. package/dist/data/new-york.d.ts +5 -0
  163. package/dist/data/new-york.js +23 -0
  164. package/dist/data/new-york.js.map +1 -0
  165. package/dist/data/sites.d.ts +12 -0
  166. package/dist/data/sites.js +89 -0
  167. package/dist/data/sites.js.map +1 -0
  168. package/dist/index.d.ts +33 -0
  169. package/dist/index.js +22 -0
  170. package/dist/index.js.map +1 -0
  171. package/dist/styles/accessible.d.ts +1 -0
  172. package/dist/styles/accessible.js +37 -0
  173. package/dist/styles/accessible.js.map +1 -0
  174. package/dist/styles/base.d.ts +2 -0
  175. package/dist/styles/base.js +41 -0
  176. package/dist/styles/base.js.map +1 -0
  177. package/dist/styles/color-scheme.d.ts +1 -0
  178. package/dist/styles/color-scheme.js +81 -0
  179. package/dist/styles/color-scheme.js.map +1 -0
  180. package/dist/styles/tokens.d.ts +1 -0
  181. package/dist/styles/tokens.js +85 -0
  182. package/dist/styles/tokens.js.map +1 -0
  183. package/dist/styles/w3-subset.d.ts +1 -0
  184. package/dist/styles/w3-subset.js +33 -0
  185. package/dist/styles/w3-subset.js.map +1 -0
  186. package/dist/tokens.css +152 -0
  187. package/dist-cdn/base.css +30 -0
  188. package/dist-cdn/bento-box.js +1023 -0
  189. package/dist-cdn/bento-box.js.map +1 -0
  190. package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js +174 -0
  191. package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js.map +1 -0
  192. package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js +695 -0
  193. package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +1 -0
  194. package/dist-cdn/chunks/accessible-GqhVn5_H.js +40 -0
  195. package/dist-cdn/chunks/accessible-GqhVn5_H.js.map +1 -0
  196. package/dist-cdn/chunks/analytics-C8D8n_wt.js +55 -0
  197. package/dist-cdn/chunks/analytics-C8D8n_wt.js.map +1 -0
  198. package/dist-cdn/chunks/base-DCGd2Oii.js +117 -0
  199. package/dist-cdn/chunks/base-DCGd2Oii.js.map +1 -0
  200. package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js +25 -0
  201. package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js.map +1 -0
  202. package/dist-cdn/chunks/heading-level-DIuNS44-.js +31 -0
  203. package/dist-cdn/chunks/heading-level-DIuNS44-.js.map +1 -0
  204. package/dist-cdn/chunks/hours-data-Bw6vkIw7.js +181 -0
  205. package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +1 -0
  206. package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js +346 -0
  207. package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js.map +1 -0
  208. package/dist-cdn/chunks/link-DbJSwj16.js +7 -0
  209. package/dist-cdn/chunks/link-DbJSwj16.js.map +1 -0
  210. package/dist-cdn/chunks/new-york-DkcnqvJ4.js +18 -0
  211. package/dist-cdn/chunks/new-york-DkcnqvJ4.js.map +1 -0
  212. package/dist-cdn/chunks/repeat-CIFUYkyh.js +101 -0
  213. package/dist-cdn/chunks/repeat-CIFUYkyh.js.map +1 -0
  214. package/dist-cdn/chunks/site-header-BwDkZ2LL.js +802 -0
  215. package/dist-cdn/chunks/site-header-BwDkZ2LL.js.map +1 -0
  216. package/dist-cdn/chunks/site-main-nav-BLAAunnr.js +605 -0
  217. package/dist-cdn/chunks/site-main-nav-BLAAunnr.js.map +1 -0
  218. package/dist-cdn/chunks/static-html-1mTAG6nS.js +22 -0
  219. package/dist-cdn/chunks/static-html-1mTAG6nS.js.map +1 -0
  220. package/dist-cdn/custom-elements.json +15178 -0
  221. package/dist-cdn/events-section.js +401 -0
  222. package/dist-cdn/events-section.js.map +1 -0
  223. package/dist-cdn/library-hours-setup.js +28 -0
  224. package/dist-cdn/library-hours-setup.js.map +1 -0
  225. package/dist-cdn/library-weekly-hours.js +1 -0
  226. package/dist-cdn/manifest.json +23 -0
  227. package/dist-cdn/site-analytics.js +6 -0
  228. package/dist-cdn/site-analytics.js.map +1 -0
  229. package/dist-cdn/site-footer.js +267 -0
  230. package/dist-cdn/site-footer.js.map +1 -0
  231. package/dist-cdn/site-header.js +1 -0
  232. package/dist-cdn/site-hours-section.js +145 -0
  233. package/dist-cdn/site-hours-section.js.map +1 -0
  234. package/dist-cdn/site-main-nav.js +1 -0
  235. package/dist-cdn/site-page.js +317 -0
  236. package/dist-cdn/site-page.js.map +1 -0
  237. package/dist-cdn/site-style.js +42 -0
  238. package/dist-cdn/site-style.js.map +1 -0
  239. package/dist-cdn/skills/uvalib-web-components/SKILL.md +276 -0
  240. package/dist-cdn/skills/uvalib-web-components/reference/components.md +631 -0
  241. package/dist-cdn/skills/uvalib-web-components/reference/migration.md +52 -0
  242. package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +147 -0
  243. package/dist-cdn/tokens.css +152 -0
  244. package/dist-cdn/uvalib-analytics.js +6 -0
  245. package/dist-cdn/uvalib-analytics.js.map +1 -0
  246. package/dist-cdn/uvalib-date-range.js +262 -0
  247. package/dist-cdn/uvalib-date-range.js.map +1 -0
  248. package/dist-cdn/uvalib-filter.js +184 -0
  249. package/dist-cdn/uvalib-filter.js.map +1 -0
  250. package/package.json +152 -4
  251. package/skills/uvalib-web-components/SKILL.md +276 -0
  252. package/skills/uvalib-web-components/reference/components.md +631 -0
  253. package/skills/uvalib-web-components/reference/migration.md +52 -0
  254. package/skills/uvalib-web-components/reference/snippets.md +147 -0
@@ -0,0 +1,1023 @@
1
+ import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./chunks/UvalibElement-BnI-eRRR.js";
2
+ import { n as u, t as d } from "./chunks/static-html-1mTAG6nS.js";
3
+ import { a as f, i as p } from "./chunks/analytics-C8D8n_wt.js";
4
+ import { t as m } from "./chunks/heading-level-DIuNS44-.js";
5
+ import { t as h } from "./chunks/accessible-GqhVn5_H.js";
6
+ import { n as ee, t as g } from "./chunks/fetch-json-Cyqv-gLU.js";
7
+ // src/components/bento-box/BentoSection.ts
8
+ var te = 5, _ = 3, v = 50, y = (e) => `
9
+ ${e} { display: block; }
10
+ ${e} .bs-results--placeholder { visibility: hidden; }
11
+ ${e} .bs-results--stack { display: grid; }
12
+ ${e} .bs-results--stack > * { grid-area: 1 / 1; min-width: 0; }
13
+ ${e} .bs-results--message { align-self: start; z-index: 1; }
14
+ ${e} .bs-results--see-all { display: inline; }
15
+ ${e} .bs-results--guide { font-weight: normal; }
16
+ ${e} .bs-results--title,
17
+ ${e} .bento-section-title,
18
+ ${e} .bs-results--highlights {
19
+ display: -webkit-box;
20
+ -webkit-box-orient: vertical;
21
+ -webkit-line-clamp: 2;
22
+ line-clamp: 2;
23
+ overflow: hidden;
24
+ min-height: 3em;
25
+ min-height: 2lh;
26
+ }
27
+ ${e} .bento-section-desc {
28
+ display: -webkit-box;
29
+ -webkit-box-orient: vertical;
30
+ -webkit-line-clamp: 3;
31
+ line-clamp: 3;
32
+ overflow: hidden;
33
+ min-height: 4.5em;
34
+ min-height: 3lh;
35
+ }
36
+ ${e} .bs-results--author,
37
+ ${e} .bs-results--date,
38
+ ${e} .bs-results--format,
39
+ ${e} .bs-results--byline {
40
+ overflow: hidden;
41
+ white-space: nowrap;
42
+ text-overflow: ellipsis;
43
+ }
44
+ /* A guide with no author or subjects keeps its placeholder's line. */
45
+ ${e} .bs-results--byline { min-height: 1.5em; min-height: 1lh; }
46
+ ${e}[hidden], ${e} [hidden] { display: none !important; }
47
+ ${e} .visually-hidden {
48
+ position: absolute;
49
+ width: 1px;
50
+ height: 1px;
51
+ margin: -1px;
52
+ padding: 0;
53
+ overflow: hidden;
54
+ clip: rect(0, 0, 0, 0);
55
+ white-space: nowrap;
56
+ border: 0;
57
+ }
58
+ `, b = s(y(":host")), x = (e) => e.map((e) => e.mark ? u`<mark>${e.text}</mark>` : e.text), S = class extends l {
59
+ static {
60
+ this.styles = [
61
+ h,
62
+ b,
63
+ t`
64
+ :host {
65
+ color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
66
+ background: var(--uva-color-surface-raised, #fff);
67
+ border: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));
68
+ border-top: none;
69
+ line-height: 1.5;
70
+ min-width: 0;
71
+ }
72
+ a {
73
+ color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
74
+ }
75
+ /* One line whatever the count's length, so the header keeps its height. */
76
+ .bs-results--header {
77
+ display: flex;
78
+ justify-content: space-between;
79
+ align-items: center;
80
+ gap: 0.5rem 1rem;
81
+ padding: 0.5rem 1rem;
82
+ background: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));
83
+ }
84
+ .bs-results--header > :is(h1, h2, h3, h4, h5, h6) {
85
+ min-width: 0;
86
+ overflow: hidden;
87
+ text-overflow: ellipsis;
88
+ white-space: nowrap;
89
+ margin: 0;
90
+ font-size: 1.0625rem;
91
+ line-height: 1.5;
92
+ text-transform: uppercase;
93
+ }
94
+ .bs-results--body {
95
+ padding: 1rem;
96
+ }
97
+ .bs-results--body > p {
98
+ margin: 0 0 1rem;
99
+ }
100
+ .bs-results--list {
101
+ margin: 0 0 1rem;
102
+ padding-inline-start: 1.5rem;
103
+ }
104
+ .bs-results--list--entry,
105
+ .bs-results--list > li {
106
+ border-bottom: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));
107
+ margin-bottom: 1rem;
108
+ padding-bottom: 1rem;
109
+ }
110
+ .bs-results--list > li:last-child {
111
+ border-bottom: none;
112
+ margin-bottom: 0;
113
+ }
114
+ .bs-results--title,
115
+ .bento-section-title {
116
+ font-weight: 700;
117
+ }
118
+ .ul-0,
119
+ .ul-1 {
120
+ list-style: none;
121
+ margin: 0;
122
+ padding: 0;
123
+ }
124
+ .ul-1 {
125
+ display: flex;
126
+ justify-content: space-between;
127
+ gap: 1rem;
128
+ }
129
+ .ul-1 > li {
130
+ min-width: 0;
131
+ }
132
+ .bs-results--teaser {
133
+ padding: 0.5rem 0;
134
+ }
135
+ .bs-results--message {
136
+ margin: 0;
137
+ }
138
+ .uvalib-button {
139
+ display: inline-block;
140
+ white-space: nowrap;
141
+ font: inherit;
142
+ line-height: 1.5;
143
+ padding: 0.1rem 0.75rem;
144
+ border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));
145
+ border-radius: 0.3rem;
146
+ background: var(--uva-color-surface-raised, #fff);
147
+ color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
148
+ text-decoration: none;
149
+ cursor: pointer;
150
+ }
151
+ .bs-results--message .uvalib-button {
152
+ margin-inline-start: 0.5rem;
153
+ }
154
+ .uvalib-button[aria-disabled='true'] {
155
+ cursor: progress;
156
+ }
157
+ `
158
+ ];
159
+ }
160
+ get seeAllIn() {
161
+ return this.sourceName;
162
+ }
163
+ get state() {
164
+ return this._state;
165
+ }
166
+ createRenderRoot() {
167
+ let e = super.createRenderRoot();
168
+ if (e instanceof ShadowRoot && this.noStyle) {
169
+ let t = b.styleSheet;
170
+ t && (e.adoptedStyleSheets = [t]);
171
+ }
172
+ return e;
173
+ }
174
+ constructor() {
175
+ super(), this.query = "", this.limit = 5, this.noResultDescribe = "No results found.", this.entryClass = "bs-results--list--entry", this._state = "loading", this.retrying = !1, this.inferredLevel = _, this.loadId = 0, this.onClick = (e) => {
176
+ let t = e.composedPath(), n = this.renderRoot.querySelector(".bs-results--list");
177
+ for (let e of t) {
178
+ if (e === this) return;
179
+ if (e instanceof Element) {
180
+ if (e.matches(".bs-results--see-all button")) {
181
+ p(this, [
182
+ "bento-box",
183
+ "see-all-click",
184
+ this.analyticsName
185
+ ]);
186
+ return;
187
+ }
188
+ if (e.matches("a[href]")) {
189
+ let e = t.find((e) => e instanceof HTMLLIElement && e.parentNode === n);
190
+ if (!e || e.classList.contains("bs-results--placeholder")) return;
191
+ let r = [...n.children].indexOf(e) + 1;
192
+ p(this, [
193
+ "bento-box",
194
+ "result-click",
195
+ this.analyticsName,
196
+ r
197
+ ]);
198
+ return;
199
+ }
200
+ }
201
+ }
202
+ }, this.addEventListener("click", this.onClick);
203
+ }
204
+ connectedCallback() {
205
+ super.connectedCallback();
206
+ let e = m(this);
207
+ if (this.inferredLevel = e === null ? _ : Math.min(e + 1, 6), this.lightDom && this.noStyle) {
208
+ let e = this.getRootNode(), t = e instanceof ShadowRoot || e instanceof Document ? e : void 0;
209
+ c(`${this.localName}::structure`, s(y(this.localName)), {
210
+ root: t,
211
+ scope: !1
212
+ });
213
+ }
214
+ this.hasUpdated && this._state === "loading" && this.load();
215
+ }
216
+ disconnectedCallback() {
217
+ super.disconnectedCallback(), this.controller && (this.loadId++, this.controller.abort(), this.controller = void 0, this._state = "loading");
218
+ }
219
+ get count() {
220
+ let e = Math.trunc(this.limit);
221
+ return Number.isFinite(e) && e > 0 ? Math.min(e, v) : te;
222
+ }
223
+ get level() {
224
+ let e = Math.trunc(this.headingLevel ?? NaN);
225
+ return e >= 1 && e <= 6 ? e : this.inferredLevel;
226
+ }
227
+ get q() {
228
+ return (this.query ?? "").trim();
229
+ }
230
+ willUpdate(e) {
231
+ this.isConnected && (!this.hasUpdated || e.has("query") || e.has("limit")) && this.load();
232
+ }
233
+ updated(e) {
234
+ e.has("_state") && this.dispatchEvent(new Event("bento-state", {
235
+ bubbles: !0,
236
+ composed: !0
237
+ }));
238
+ }
239
+ async load() {
240
+ let e = ++this.loadId;
241
+ this.controller?.abort();
242
+ let t = this.q;
243
+ if (!t) {
244
+ this.controller = void 0, this.results = void 0, this._state = "empty", this.reportedQuery = void 0;
245
+ return;
246
+ }
247
+ let n = this.controller = new AbortController();
248
+ this._state = "loading", this.results = void 0;
249
+ try {
250
+ let r = await this.fetchResults(t, this.count, n.signal);
251
+ if (e !== this.loadId) return;
252
+ this.results = {
253
+ ...r,
254
+ items: r.items.slice(0, this.count)
255
+ }, this._state = this.results.items.length ? "ready" : "empty", t !== this.reportedQuery && (this.reportedQuery = t, f(this, t, this.analyticsName, r.total ?? (this._state === "empty" ? 0 : void 0)));
256
+ } catch {
257
+ if (e !== this.loadId) return;
258
+ this.results = void 0, this._state = "error", this.reportedQuery = void 0;
259
+ } finally {
260
+ this.controller === n && (this.controller = void 0);
261
+ }
262
+ }
263
+ async retry() {
264
+ if (this.retrying) return;
265
+ let e = this.focusedInside();
266
+ this.retrying = !0;
267
+ try {
268
+ await this.load();
269
+ } finally {
270
+ this.retrying = !1;
271
+ }
272
+ if (await this.updateComplete, !e) return;
273
+ let t = this.renderRoot;
274
+ this._state === "ready" ? t.querySelector(".bs-results--list a[href]")?.focus() : this._state === "error" ? t.querySelector(".bs-results--message button")?.focus() : t.querySelector(".bs-results--message")?.focus();
275
+ }
276
+ focusedInside() {
277
+ let e = this.renderRoot instanceof ShadowRoot ? this.renderRoot.activeElement : document.activeElement;
278
+ return !!e && this.renderRoot.contains(e) && e !== this;
279
+ }
280
+ renderSeeAll() {
281
+ let e = new URL(this.results?.seeAll ?? this.seeAllUrl(this.q)), t = [...e.searchParams];
282
+ e.search = "";
283
+ let n = this._state === "ready" ? this.results?.total : void 0;
284
+ return u`<form class="bs-results--see-all" action=${e.href} method="get">
285
+ ${t.map(([e, t]) => u`<input type="hidden" name=${e} .value=${t} />`)}
286
+ <button type="submit" class="uvalib-button">
287
+ See all
288
+ ${n === void 0 ? o : u`<span class="bs-results--qty">${n.toLocaleString("en-US")}</span>`}
289
+ results<span class="visually-hidden"> in ${this.seeAllIn}</span>
290
+ </button>
291
+ </form>`;
292
+ }
293
+ renderMessage() {
294
+ return this.retrying || this._state === "error" ? u`${this.sourceName[0].toUpperCase()}${this.sourceName.slice(1)} results are
295
+ unavailable right now.
296
+ <button
297
+ type="button"
298
+ class="uvalib-button"
299
+ aria-disabled=${this.retrying ? "true" : o}
300
+ @click=${this.retry}
301
+ >
302
+ ${this.retrying ? "Retrying…" : "Retry"}<span class="visually-hidden">
303
+ ${this.sourceName}</span
304
+ >
305
+ </button>` : this._state === "empty" ? this.noResultDescribe : o;
306
+ }
307
+ renderPlaceholder() {
308
+ return u`<li class="${this.entryClass} bs-results--placeholder" aria-hidden="true">
309
+ ${this.renderPlaceholderBody()}
310
+ </li>`;
311
+ }
312
+ entry(e) {
313
+ return u`<li class=${this.entryClass || o}>${e}</li>`;
314
+ }
315
+ render() {
316
+ let e = d(`h${this.level}`), t = this._state === "loading", n = this._state === "ready" ? this.results?.items ?? [] : [], r = n.length ? 0 : t && !this.retrying ? this.count : 1, i = this.renderMessage(), a = t || this._state === "ready";
317
+ return u`<div class="bs-results--header">
318
+ <${e}>${this.heading}</${e}>
319
+ ${a && this.q ? this.renderSeeAll() : u`<div><a href=${this.home.url} class="uvalib-button">${this.home.text}</a></div>`}
320
+ </div>
321
+ <div class="bs-results--body">
322
+ <p>${this.describe}</p>
323
+ <div class="bs-results--stack">
324
+ <ol class="bs-results--list" aria-busy=${t ? "true" : "false"}>
325
+ ${n.map((e) => this.renderItem(e))}
326
+ ${Array.from({ length: r }, () => this.renderPlaceholder())}
327
+ </ol>
328
+ ${i === o ? o : u`<p class="bs-results--message" tabindex="-1">${i}</p>`}
329
+ </div>
330
+ </div>`;
331
+ }
332
+ };
333
+ a([e({ type: String })], S.prototype, "query", void 0), a([e({ type: Number })], S.prototype, "limit", void 0), a([e({
334
+ type: String,
335
+ attribute: "no-result-describe"
336
+ })], S.prototype, "noResultDescribe", void 0), a([e({
337
+ type: Number,
338
+ attribute: "heading-level"
339
+ })], S.prototype, "headingLevel", void 0), a([n()], S.prototype, "_state", void 0), a([n()], S.prototype, "results", void 0), a([n()], S.prototype, "retrying", void 0), a([n()], S.prototype, "inferredLevel", void 0);
340
+ // src/components/bento-box/bento-data.ts
341
+ var C = {
342
+ authorize: "https://search.lib.virginia.edu/authorize",
343
+ catalog: "https://pool-solr-ws-uva-library.internal.lib.virginia.edu/api/search",
344
+ articles: "https://pool-eds-ws.internal.lib.virginia.edu/api/search",
345
+ guides: "https://qmo3jwybkg.execute-api.us-east-1.amazonaws.com/production/library/libguides-proxy",
346
+ website: "/jsonapi/index/default_index"
347
+ }, w = {
348
+ retries: 2,
349
+ retryDelay: 1e3,
350
+ timeout: 1e4
351
+ }, ne = [
352
+ "authorize",
353
+ "catalog",
354
+ "articles",
355
+ "guides",
356
+ "website"
357
+ ];
358
+ function T(e) {
359
+ for (let t of ne) {
360
+ let n = e?.[t];
361
+ typeof n == "string" && n && (C[t] = n);
362
+ }
363
+ }
364
+ var E = !1;
365
+ function D() {
366
+ return E || (E = !0, T(globalThis.window?.uvalibBentoEndpoints)), C;
367
+ }
368
+ var O = (e) => e >= 500 || e === 408 || e === 429, k = /* @__PURE__ */ new Map();
369
+ function A(e, t, n) {
370
+ if (n?.aborted) return Promise.reject(n.reason);
371
+ let r = k.get(e);
372
+ if (!r) {
373
+ let n = new AbortController(), i = {
374
+ controller: n,
375
+ waiting: 0,
376
+ settled: !1,
377
+ promise: t(n.signal)
378
+ };
379
+ i.promise.then(() => i.settled = !0, () => {
380
+ i.settled = !0, k.get(e) === i && k.delete(e);
381
+ }), k.set(e, r = i);
382
+ }
383
+ let i = r;
384
+ return n ? (i.waiting++, new Promise((t, r) => {
385
+ let a = !1, o = () => {
386
+ a || (a = !0, n.removeEventListener("abort", s), i.waiting--);
387
+ }, s = () => {
388
+ o(), !i.settled && i.waiting === 0 && (i.controller.abort(n.reason), k.get(e) === i && k.delete(e)), r(n.reason);
389
+ };
390
+ n.addEventListener("abort", s, { once: !0 }), i.promise.then((e) => {
391
+ o(), t(e);
392
+ }, (e) => {
393
+ o(), r(e);
394
+ });
395
+ })) : i.promise;
396
+ }
397
+ var j, M;
398
+ function N() {
399
+ if (!j) {
400
+ M = void 0;
401
+ let e = ee(D().authorize, w, {
402
+ method: "POST",
403
+ retryStatus: O
404
+ }).then((t) => {
405
+ let n = t.trim();
406
+ if (!n) throw Error("empty Virgo guest token");
407
+ return j === e && (M = n), n;
408
+ });
409
+ j = e, e.catch(() => {
410
+ j === e && (j = void 0);
411
+ });
412
+ }
413
+ return j;
414
+ }
415
+ function re(e) {
416
+ M === e && (j = M = void 0);
417
+ }
418
+ var ie = {
419
+ catalog: "https://search.lib.virginia.edu/sources/uva_library/items/",
420
+ articles: "https://search.lib.virginia.edu/sources/articles/items/"
421
+ }, ae = /^please sign in to see more/i, oe = "Article details available after signing in to Virgo", P = 5, F = (e) => typeof e == "string" ? e.replace(/\s+/g, " ").trim() : "";
422
+ function se(e, t) {
423
+ let n = e, r = Array.isArray(n?.group_list) ? n.group_list : [], i = [];
424
+ for (let e of r) {
425
+ let n = Array.isArray(e?.record_list) ? e.record_list[0] : void 0, r = Array.isArray(n?.fields) ? n.fields : [], a = (e) => r.filter(e).map((e) => F(e.value)), o = (e) => a(e).find(Boolean) ?? "", s = o((e) => e.type === "title"), c = o((e) => e.type === "identifier");
426
+ if (!s || !c) continue;
427
+ let l = t === "articles" && ae.test(s), u = a((e) => e.type === "author").filter(Boolean);
428
+ u.length > P && (u = [...u.slice(0, P), `and ${u.length - P} more`]);
429
+ let d = Math.trunc(Number(e.count));
430
+ i.push({
431
+ title: l ? oe : s,
432
+ url: ie[t] + encodeURIComponent(c),
433
+ authors: u,
434
+ published: o((e) => e.name === "published_date") || void 0,
435
+ formats: a((e) => e.name === (t === "articles" ? "pub_type" : "format")).filter(Boolean),
436
+ editions: d > 1 ? d : 1,
437
+ signIn: l
438
+ });
439
+ }
440
+ let a = Number(n?.pagination?.total);
441
+ return {
442
+ items: i,
443
+ total: Number.isFinite(a) && a >= 0 ? a : void 0
444
+ };
445
+ }
446
+ function I(e) {
447
+ return `keyword: {${e.replace(/[{}]/g, " ")}}`;
448
+ }
449
+ function ce(e, t) {
450
+ return JSON.stringify({
451
+ query: I(e),
452
+ pagination: {
453
+ start: 0,
454
+ rows: t
455
+ },
456
+ sort: {
457
+ sort_id: "SortRelevance",
458
+ order: "desc"
459
+ },
460
+ filters: [{
461
+ pool_id: "uva_library",
462
+ facets: []
463
+ }]
464
+ });
465
+ }
466
+ function le(e, t, n, r) {
467
+ let i = D()[e], a = ce(t, n);
468
+ return A(`POST ${i}\n${a}`, async (t) => {
469
+ for (let n = 0;; n++) {
470
+ let r = await N();
471
+ if (t.aborted) throw t.reason;
472
+ let o = {
473
+ method: "POST",
474
+ headers: {
475
+ Accept: "application/json",
476
+ "Content-Type": "application/json",
477
+ Authorization: `Bearer ${r}`
478
+ },
479
+ body: a,
480
+ signal: t,
481
+ retryStatus: O
482
+ };
483
+ try {
484
+ return se(await g(i, w, o), e);
485
+ } catch (e) {
486
+ if (n === 0 && e.status === 401) {
487
+ re(r);
488
+ continue;
489
+ }
490
+ throw e;
491
+ }
492
+ }
493
+ }, r);
494
+ }
495
+ function ue(e, t) {
496
+ return `https://search.lib.virginia.edu/?${new URLSearchParams(e === "catalog" ? {
497
+ q: t,
498
+ pool: "uva_library"
499
+ } : {
500
+ q: I(t),
501
+ pool: "articles"
502
+ })}`;
503
+ }
504
+ var de = [
505
+ "Jan",
506
+ "Feb",
507
+ "Mar",
508
+ "Apr",
509
+ "May",
510
+ "Jun",
511
+ "Jul",
512
+ "Aug",
513
+ "Sep",
514
+ "Oct",
515
+ "Nov",
516
+ "Dec"
517
+ ];
518
+ function fe(e) {
519
+ let t = /^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/.exec(e);
520
+ if (!t) return e;
521
+ let [, n, r, i] = t, a = r ? de[Number(r) - 1] : void 0;
522
+ if (!r) return n;
523
+ if (!a) return e;
524
+ if (!i) return `${a} ${n}`;
525
+ let o = Number(i), s = new Date(Date.UTC(Number(n), Number(r) - 1, o));
526
+ return s.getUTCDate() === o ? new Intl.DateTimeFormat("en-US", {
527
+ timeZone: "UTC",
528
+ year: "numeric",
529
+ month: "short",
530
+ day: "numeric"
531
+ }).format(s) : e;
532
+ }
533
+ var L = /* @__PURE__ */ new Set(["http:", "https:"]);
534
+ function R(e, t) {
535
+ if (typeof e == "string" && e.trim()) try {
536
+ let n = new URL(e.trim(), t);
537
+ return L.has(n.protocol) ? n.href : void 0;
538
+ } catch {
539
+ return;
540
+ }
541
+ }
542
+ var z = "https://guides.lib.virginia.edu/", B = (e) => {
543
+ let t = R(e?.getAttribute("href"), z), n = F(e?.textContent);
544
+ return t && n ? {
545
+ text: n,
546
+ url: t
547
+ } : void 0;
548
+ };
549
+ function V(e, t) {
550
+ let n = [], r = (e, t) => {
551
+ if (!e) return;
552
+ let r = n[n.length - 1];
553
+ r && !!r.mark === t ? r.text += e : n.push(t ? {
554
+ text: e,
555
+ mark: t
556
+ } : { text: e });
557
+ }, i = (e, n) => {
558
+ if (e.nodeType === Node.TEXT_NODE) r(e.data, n);
559
+ else if (e.nodeType === Node.ELEMENT_NODE) {
560
+ let r = e;
561
+ if (r.localName === "script" || r.localName === "style" || r.localName === "template") return;
562
+ let a = n || r.localName === t;
563
+ r.childNodes.forEach((e) => i(e, a));
564
+ }
565
+ };
566
+ e.childNodes.forEach((e) => i(e, !1));
567
+ for (let e of n) e.text = e.text.replace(/\s+/g, " ");
568
+ return n.length && (n[0].text = n[0].text.trimStart(), n[n.length - 1].text = n[n.length - 1].text.trimEnd()), n.filter((e) => e.text);
569
+ }
570
+ var H = (e) => new DOMParser().parseFromString(e, "text/html");
571
+ function pe(e) {
572
+ let t = e?.data, n = typeof t?.results == "string" ? t.results : "", r = [];
573
+ for (let e of H(n).querySelectorAll(".s-srch-result")) {
574
+ let t = e.querySelector(".s-srch-result-title"), n = B(t?.querySelector(":scope > a"));
575
+ if (!n) continue;
576
+ let i = e.querySelectorAll(".s-srch-result-meta")[1], a = i?.querySelector(".s-srch-result-highlights");
577
+ r.push({
578
+ title: n.text,
579
+ url: n.url,
580
+ guide: B(t?.querySelector(".s-srch-result-guide a")),
581
+ author: B(i?.querySelector(".s-srch-result-author a")),
582
+ subjects: [...i?.querySelectorAll(".s-srch-result-subjects a") ?? []].map(B).filter((e) => !!e),
583
+ highlights: a ? V(a, "mark") : []
584
+ });
585
+ }
586
+ return {
587
+ items: r,
588
+ seeAll: R(t?.fulllink)
589
+ };
590
+ }
591
+ function me(e) {
592
+ return `${z}srch.php?${new URLSearchParams({
593
+ default_lg: "1",
594
+ q: e
595
+ })}`;
596
+ }
597
+ function U(e, t) {
598
+ return `${e}${e.includes("?") ? "&" : "?"}${t}`;
599
+ }
600
+ function he(e, t, n) {
601
+ let r = U(D().guides, new URLSearchParams({ q: e }));
602
+ return A(`GET ${r}`, async (e) => pe(await g(r, w, {
603
+ signal: e,
604
+ retryStatus: O
605
+ })), n).then((e) => ({
606
+ ...e,
607
+ items: e.items.slice(0, t)
608
+ }));
609
+ }
610
+ var ge = [
611
+ "page",
612
+ "person",
613
+ "library",
614
+ "article"
615
+ ], W = "https://library.virginia.edu";
616
+ function _e(e, t) {
617
+ let n = new URLSearchParams();
618
+ n.set("filter[fulltext]", e), n.set("page[limit]", String(t)), n.set("filter[types-group][group][conjunction]", "OR");
619
+ for (let e of ge) n.set(`filter[${e}-filter][condition][path]`, "type"), n.set(`filter[${e}-filter][condition][value]`, e), n.set(`filter[${e}-filter][condition][memberOf]`, "types-group");
620
+ return n;
621
+ }
622
+ function ve(e) {
623
+ let t = e, n = Array.isArray(t?.data) ? t.data : [], r = [];
624
+ for (let e of n) {
625
+ let n = e?.attributes ?? {}, i = F(n.title), a = F(n.path?.alias), o = n.drupal_internal__nid, s = a.startsWith("/") ? a : o == null ? "" : `/node/${encodeURI(String(o))}`, c = s ? R(s, W) : void 0;
626
+ if (!i || !c || !c.startsWith("https://library.virginia.edu/")) continue;
627
+ let l = t?.meta?.extra_data?.[String(o)]?.excerpt, u = typeof l == "string" && l ? V(H(l).body, "strong") : [];
628
+ if (!u.length && e.type === "node--person") {
629
+ let e = n.field_uva_ldap_title, t = (Array.isArray(e) ? e : [e]).map(F).filter(Boolean).join("; ");
630
+ t && (u = [{ text: t }]);
631
+ }
632
+ r.push({
633
+ title: i,
634
+ url: c,
635
+ excerpt: u
636
+ });
637
+ }
638
+ let i = Number(t?.meta?.count);
639
+ return {
640
+ items: r,
641
+ total: Number.isFinite(i) && i >= 0 ? i : void 0
642
+ };
643
+ }
644
+ function ye(e, t, n) {
645
+ let r = U(D().website, _e(e, t));
646
+ return A(`GET ${r}`, async (e) => ve(await g(r, w, {
647
+ signal: e,
648
+ retryStatus: O
649
+ })), n);
650
+ }
651
+ function be(e) {
652
+ return `${W}/search/content?${new URLSearchParams({ search_api_fulltext: e })}`;
653
+ }
654
+ // src/components/bento-box/VirgoSection.ts
655
+ var G = class extends S {
656
+ fetchResults(e, t, n) {
657
+ return le(this.pool, e, t, n);
658
+ }
659
+ seeAllUrl(e) {
660
+ return ue(this.pool, e);
661
+ }
662
+ line(e, t) {
663
+ return t ? r`<li class="${e} li-1">${t}</li>` : r`<li class="${e} li-1" aria-hidden="true"> </li>`;
664
+ }
665
+ renderItem(e) {
666
+ let t = e.editions > 1 ? r`<span class="bs-results--editions"
667
+ >${e.formats.length ? ", " : ""}${e.editions} editions</span
668
+ >` : "", n = e.formats.length || t ? r`${e.formats.join("/")}${t}` : "";
669
+ return this.entry(r`<a href=${e.url} class="bs-results--title">${e.title}</a>
670
+ <ul class="ul-0">
671
+ ${this.line("bs-results--author", e.authors.join("; "))}
672
+ <li>
673
+ <ul class="ul-1">
674
+ ${this.line("bs-results--date", e.published ? r`<time datetime=${e.published}>${fe(e.published)}</time>` : "")}
675
+ ${this.line("bs-results--format", n)}
676
+ </ul>
677
+ </li>
678
+ </ul>`);
679
+ }
680
+ renderPlaceholderBody() {
681
+ return r`<a class="bs-results--title">Library search result</a>
682
+ <ul class="ul-0">
683
+ <li class="bs-results--author li-1">Author, Example</li>
684
+ <li>
685
+ <ul class="ul-1">
686
+ <li class="bs-results--date li-1">2024</li>
687
+ <li class="bs-results--format li-1">Book</li>
688
+ </ul>
689
+ </li>
690
+ </ul>`;
691
+ }
692
+ }, xe = class extends G {
693
+ constructor(...e) {
694
+ super(...e), this.pool = "articles", this.analyticsName = "Virgo articles", this.heading = "Article", this.sourceName = "Virgo article", this.describe = "An aggregation of tens of millions of articles made available through Library subscriptions.", this.home = {
695
+ text: "Search articles",
696
+ url: "https://search.lib.virginia.edu/"
697
+ };
698
+ }
699
+ get seeAllIn() {
700
+ return "Virgo articles";
701
+ }
702
+ }, K = [
703
+ "catalog",
704
+ "articles",
705
+ "libguides",
706
+ "website"
707
+ ], q = 2;
708
+ function J(e) {
709
+ let t = e;
710
+ if (typeof e == "string") {
711
+ let n = e.trim();
712
+ try {
713
+ t = n.startsWith("[") ? JSON.parse(n) : n.split(/[\s,]+/);
714
+ } catch {
715
+ t = [];
716
+ }
717
+ }
718
+ let n = new Set(K), r = [...new Set((Array.isArray(t) ? t : []).map((e) => typeof e == "string" ? e.trim().toLowerCase() : "").filter((e) => n.has(e)))];
719
+ return r.length ? r : [...K];
720
+ }
721
+ function Y(e = location.search) {
722
+ let t = new URLSearchParams(e);
723
+ return t.get("q") ?? t.get("query");
724
+ }
725
+ var X = (e) => `
726
+ ${e} { display: block; }
727
+ ${e} .bs-results-container > * { min-width: 0; }
728
+ ${e}[hidden], ${e} [hidden] { display: none !important; }
729
+ ${e} .visually-hidden {
730
+ position: absolute;
731
+ width: 1px;
732
+ height: 1px;
733
+ margin: -1px;
734
+ padding: 0;
735
+ overflow: hidden;
736
+ clip: rect(0, 0, 0, 0);
737
+ white-space: nowrap;
738
+ border: 0;
739
+ }
740
+ `, Z = s(X(":host")), Se = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2a8 8 0 0 1 6.32 12.9l5.39 5.4-1.41 1.41-5.4-5.39A8 8 0 1 1 10 2zm0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12z'/%3E%3C/svg%3E\")", Ce = 0, Q = class extends l {
741
+ constructor(...e) {
742
+ super(...e), this.query = "", this.limit = 5, this.searchDescribe = "This page searches Virgo, Virgo articles, subject guides, and the Library website.", this.noResultDescribe = "No results found.", this.placeholder = "Search anything...", this.boxes = [
743
+ "catalog",
744
+ "articles",
745
+ "libguides",
746
+ "website"
747
+ ], this.inferredLevel = q, this.status = "", this.uid = `bento-box-${++Ce}`, this.announcePending = !1, this.onPopState = () => {
748
+ this.query = Y() ?? this.fallbackQuery ?? "";
749
+ }, this.onSectionState = () => {
750
+ let e = this.sections();
751
+ e.some((e) => e.state === "loading") ? (this.announcePending = !0, this.status = "") : this.announcePending && (this.announcePending = !1, this.status = e.some((e) => e.state === "error") ? "Results updated. Some results are unavailable." : "Results updated.");
752
+ };
753
+ }
754
+ static {
755
+ this.styles = [
756
+ h,
757
+ Z,
758
+ t`
759
+ :host {
760
+ container-type: inline-size;
761
+ color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
762
+ line-height: 1.5;
763
+ }
764
+ .bento-search-bar {
765
+ display: block;
766
+ margin: 2rem 0;
767
+ }
768
+ .bento-search-bar form {
769
+ display: flex;
770
+ max-width: 40rem;
771
+ margin: 0 auto;
772
+ }
773
+ .bento-search-bar input {
774
+ flex: 1;
775
+ min-width: 0;
776
+ min-height: 3rem;
777
+ box-sizing: border-box;
778
+ padding: 0.5rem 1rem;
779
+ font: inherit;
780
+ font-size: max(1rem, 1em);
781
+ color: var(--uva-color-input-text, #1f2937);
782
+ background: var(--uva-color-surface-raised, #fff);
783
+ border: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));
784
+ border-inline-end: 0;
785
+ border-radius: 0.3rem 0 0 0.3rem;
786
+ }
787
+ .bento-search-bar button {
788
+ padding: 0 0.75rem;
789
+ border: 1px solid var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
790
+ border-radius: 0 0.3rem 0.3rem 0;
791
+ background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
792
+ color: var(--uva-color-on-accent, #fff);
793
+ cursor: pointer;
794
+ }
795
+ .bento-search-bar button::before {
796
+ content: '';
797
+ display: block;
798
+ width: 1.5rem;
799
+ height: 1.5rem;
800
+ background: currentColor;
801
+ mask: ${s(Se)} center / contain no-repeat;
802
+ }
803
+ .bento-search-bar p {
804
+ margin: 1rem 0 0;
805
+ text-align: center;
806
+ }
807
+ .bs-header > :is(h1, h2, h3, h4, h5, h6) {
808
+ margin: 2rem 0 0;
809
+ font-size: 1.5rem;
810
+ font-weight: 500;
811
+ line-height: 1.3;
812
+ }
813
+ .bs-search-term {
814
+ font-style: italic;
815
+ }
816
+ .bs-header p {
817
+ margin: 1rem 0;
818
+ font-size: 1.25rem;
819
+ }
820
+ .bs-results-container {
821
+ display: grid;
822
+ grid-template-columns: repeat(2, minmax(0, 1fr));
823
+ gap: 2rem;
824
+ }
825
+ @container (width < 48rem) {
826
+ .bs-results-container {
827
+ grid-template-columns: minmax(0, 1fr);
828
+ }
829
+ }
830
+ `
831
+ ];
832
+ }
833
+ static get endpoints() {
834
+ return C;
835
+ }
836
+ static set endpoints(e) {
837
+ T(e);
838
+ }
839
+ createRenderRoot() {
840
+ let e = super.createRenderRoot();
841
+ if (e instanceof ShadowRoot && this.noStyle) {
842
+ let t = Z.styleSheet;
843
+ t && (e.adoptedStyleSheets = [t]);
844
+ }
845
+ return e;
846
+ }
847
+ connectedCallback() {
848
+ super.connectedCallback();
849
+ let e = m(this);
850
+ if (this.inferredLevel = e === null ? q : Math.min(e + 1, 6), this.lightDom && this.noStyle) {
851
+ let e = this.getRootNode(), t = e instanceof ShadowRoot || e instanceof Document ? e : void 0;
852
+ c(`${this.localName}::structure`, s(X(this.localName)), {
853
+ root: t,
854
+ scope: !1
855
+ });
856
+ }
857
+ this.fallbackQuery ??= this.query;
858
+ let t = Y();
859
+ t !== null && (this.query = t), window.addEventListener("popstate", this.onPopState), this.addEventListener("bento-state", this.onSectionState);
860
+ }
861
+ disconnectedCallback() {
862
+ super.disconnectedCallback(), window.removeEventListener("popstate", this.onPopState), this.removeEventListener("bento-state", this.onSectionState);
863
+ }
864
+ get level() {
865
+ let e = Math.trunc(this.headingLevel ?? NaN);
866
+ return e >= 1 && e <= 6 ? e : this.inferredLevel;
867
+ }
868
+ get q() {
869
+ return (this.query ?? "").trim();
870
+ }
871
+ sections() {
872
+ return [...this.renderRoot.querySelectorAll(".bs-results-container > .bs-results--block")];
873
+ }
874
+ willUpdate(e) {
875
+ e.has("query") && (this.status = "", this.announcePending = !!this.q);
876
+ }
877
+ search(e) {
878
+ e.preventDefault();
879
+ let t = e.currentTarget.elements.namedItem("q").value.trim();
880
+ if (t === this.q) return;
881
+ let n = new URL(location.href);
882
+ n.searchParams.delete("query"), t ? n.searchParams.set("q", t) : n.searchParams.delete("q"), history.pushState({ query: t }, "", n), this.query = t;
883
+ }
884
+ renderSection(e, t) {
885
+ let n = d(`${e}-section`);
886
+ return u`<${n}
887
+ class="bs-results--block"
888
+ ?no-shadow-dom=${this.lightDom}
889
+ ?no-style=${this.noStyle}
890
+ .query=${this.q}
891
+ .limit=${this.limit}
892
+ .noResultDescribe=${this.noResultDescribe}
893
+ .headingLevel=${t}
894
+ ></${n}>`;
895
+ }
896
+ render() {
897
+ let e = this.level, t = d(`h${e}`), n = this.q, r = J(this.boxes), i = `${this.uid}-q`, a = `${this.uid}-describe`;
898
+ return u`<bento-search class="bento-search-bar">
899
+ <search>
900
+ <form action="https://search.lib.virginia.edu/search" method="get" @submit=${this.search}>
901
+ <span class="icon-search" aria-hidden="true"></span>
902
+ <label class="visually-hidden" for=${i}>Search</label>
903
+ <input
904
+ id=${i}
905
+ name="q"
906
+ type="search"
907
+ placeholder=${this.placeholder}
908
+ .value=${n}
909
+ aria-describedby=${a}
910
+ enterkeyhint="search"
911
+ autocapitalize="none"
912
+ autocorrect="off"
913
+ spellcheck="false"
914
+ />
915
+ <button type="submit" class="uvalib-button-home-search">
916
+ <span class="visually-hidden">Search</span>
917
+ </button>
918
+ </form>
919
+ </search>
920
+ <p id=${a}>${this.searchDescribe}</p>
921
+ </bento-search>
922
+ ${n ? u`<div class="bs-header">
923
+ <${t}>You searched for <span class="bs-search-term">${n}</span></${t}>
924
+ <p>Here are the results:</p>
925
+ </div>
926
+ <div class="bs-results-container">
927
+ ${r.map((t) => this.renderSection(t, Math.min(e + 1, 6)))}
928
+ </div>` : o}
929
+ <div class="visually-hidden" role="status">${this.status}</div>`;
930
+ }
931
+ };
932
+ a([e({ type: String })], Q.prototype, "query", void 0), a([e({ type: Number })], Q.prototype, "limit", void 0), a([e({
933
+ type: String,
934
+ attribute: "search-describe"
935
+ })], Q.prototype, "searchDescribe", void 0), a([e({
936
+ type: String,
937
+ attribute: "no-result-describe"
938
+ })], Q.prototype, "noResultDescribe", void 0), a([e({ type: String })], Q.prototype, "placeholder", void 0), a([e({ converter: { fromAttribute: J } })], Q.prototype, "boxes", void 0), a([e({
939
+ type: Number,
940
+ attribute: "heading-level"
941
+ })], Q.prototype, "headingLevel", void 0), a([n()], Q.prototype, "inferredLevel", void 0), a([n()], Q.prototype, "status", void 0);
942
+ // src/components/bento-box/CatalogSection.ts
943
+ var $ = class extends G {
944
+ constructor(...e) {
945
+ super(...e), this.pool = "catalog", this.analyticsName = "Virgo catalog", this.heading = "Virgo Catalog", this.sourceName = "Virgo catalog", this.describe = "Books, journals, manuscripts & archival material, maps, music and sound recordings, theses and dissertations, and videos.", this.home = {
946
+ text: "Search Virgo",
947
+ url: "https://search.lib.virginia.edu/"
948
+ };
949
+ }
950
+ }, we = class extends S {
951
+ constructor(...e) {
952
+ super(...e), this.analyticsName = "Subject guides", this.heading = "Subject Guides", this.sourceName = "subject guide", this.describe = "Subject guides contain topic-specific information to help with research and coursework.", this.home = {
953
+ text: "Search Guides",
954
+ url: "https://guides.lib.virginia.edu/srch.php"
955
+ };
956
+ }
957
+ get seeAllIn() {
958
+ return "subject guides";
959
+ }
960
+ fetchResults(e, t, n) {
961
+ return he(e, t, n);
962
+ }
963
+ seeAllUrl(e) {
964
+ return me(e);
965
+ }
966
+ renderItem(e) {
967
+ let t = e.author ? r`<span class="bs-results--guide-author"
968
+ >by <a href=${e.author.url}>${e.author.text}</a></span
969
+ >` : o, n = e.subjects.length ? r`<span class="bs-results--subjects"
970
+ >Subjects:
971
+ ${e.subjects.map((e, t) => r`${t ? ", " : ""}<a href=${e.url}>${e.text}</a>`)}</span
972
+ >` : o;
973
+ return this.entry(r`<span class="bs-results--title"
974
+ ><a href=${e.url}>${e.title}</a>${e.guide ? r` <span class="bs-results--guide"
975
+ >on <a href=${e.guide.url}>${e.guide.text}</a></span
976
+ >` : o}</span
977
+ >
978
+ <ul class="ul-0">
979
+ <li class="bs-results--teaser li-1">
980
+ <div class="bs-results--byline">
981
+ ${t}${e.author && e.subjects.length ? r` <span aria-hidden="true">|</span> ` : o}${n}
982
+ </div>
983
+ <div class="bs-results--highlights">${x(e.highlights)}</div>
984
+ </li>
985
+ </ul>`);
986
+ }
987
+ renderPlaceholderBody() {
988
+ return r`<span class="bs-results--title"
989
+ ><a>Library subject guide</a>
990
+ <span class="bs-results--guide">on <a>Research</a></span></span
991
+ >
992
+ <ul class="ul-0">
993
+ <li class="bs-results--teaser li-1">
994
+ <div class="bs-results--byline">by <a>Librarian</a></div>
995
+ <div class="bs-results--highlights">Research help</div>
996
+ </li>
997
+ </ul>`;
998
+ }
999
+ }, Te = class extends S {
1000
+ constructor(...e) {
1001
+ super(...e), this.analyticsName = "Library website", this.heading = "Website", this.sourceName = "Library website", this.describe = "Results from the main Library website.", this.home = {
1002
+ text: "Search Library website",
1003
+ url: "https://library.virginia.edu/search/content"
1004
+ }, this.entryClass = "";
1005
+ }
1006
+ fetchResults(e, t, n) {
1007
+ return ye(e, t, n);
1008
+ }
1009
+ seeAllUrl(e) {
1010
+ return be(e);
1011
+ }
1012
+ renderItem(e) {
1013
+ return this.entry(r`<div class="bento-section-title"><a href=${e.url}>${e.title}</a></div>
1014
+ <div class="bento-section-desc">${x(e.excerpt)}</div>`);
1015
+ }
1016
+ renderPlaceholderBody() {
1017
+ return r`<div class="bento-section-title"><a>Library page</a></div>
1018
+ <div class="bento-section-desc">Library website page</div>`;
1019
+ }
1020
+ };
1021
+ i("catalog-section", $), i("articles-section", xe), i("libguides-section", we), i("website-section", Te), i("bento-box", Q);
1022
+
1023
+ //# sourceMappingURL=bento-box.js.map