@uvalib/web-components 1.7.0 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +60 -15
- package/dist/base/states.d.ts +12 -0
- package/dist/base/states.js +33 -0
- package/dist/base/states.js.map +1 -0
- package/dist/base.css +69 -6
- package/dist/components/bento-box/BentoBox.js +1 -0
- package/dist/components/bento-box/BentoBox.js.map +1 -1
- package/dist/components/events-section/EventsSection.js +1 -0
- package/dist/components/events-section/EventsSection.js.map +1 -1
- package/dist/components/library-hours/hours-data.js +1 -1
- package/dist/components/library-hours/hours-data.js.map +1 -1
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +1 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -1
- package/dist/components/site-main-nav/SiteMainNav.d.ts +1 -1
- package/dist/components/site-main-nav/SiteMainNav.js +9 -2
- package/dist/components/site-main-nav/SiteMainNav.js.map +1 -1
- package/dist/components/site-page/SitePage.d.ts +1 -1
- package/dist/components/site-page/SitePage.js +3 -2
- package/dist/components/site-page/SitePage.js.map +1 -1
- package/dist/components/site-style/SiteStyle.d.ts +1 -1
- package/dist/components/site-style/SiteStyle.js +3 -2
- package/dist/components/site-style/SiteStyle.js.map +1 -1
- package/dist/components/uvalib-card/UvalibCard.js +6 -0
- package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
- package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +27 -0
- package/dist/components/uvalib-combobox/UvalibCombobox.js +85 -1
- package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -1
- package/dist/components/uvalib-contents/UvalibContents.js +5 -0
- package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +6 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +10 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -1
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js +2 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -1
- package/dist/components/uvalib-image-regions/regions.d.ts +6 -2
- package/dist/components/uvalib-image-regions/regions.js +6 -3
- package/dist/components/uvalib-image-regions/regions.js.map +1 -1
- package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +9 -2
- package/dist/components/uvalib-lightbox/UvalibLightbox.js +23 -3
- package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
- package/dist/components/uvalib-lightbox/compare.d.ts +30 -3
- package/dist/components/uvalib-lightbox/compare.js +98 -29
- package/dist/components/uvalib-lightbox/compare.js.map +1 -1
- package/dist/components/uvalib-map/UvalibMap.js +2 -2
- package/dist/components/uvalib-map/UvalibMap.js.map +1 -1
- package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -0
- package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +3 -1
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -1
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +3 -3
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +16 -8
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
- package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +4 -1
- package/dist/components/uvalib-tag-list/UvalibTagList.js +9 -2
- package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -1
- package/dist/custom-elements.json +1992 -1681
- package/dist/pagefind.css +8 -1
- package/dist/styles/base.js +8 -1
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/font-fallback.d.ts +17 -0
- package/dist/styles/font-fallback.js +64 -0
- package/dist/styles/font-fallback.js.map +1 -0
- package/dist/styles/message.js +4 -0
- package/dist/styles/message.js.map +1 -1
- package/dist/styles/pagefind.js +8 -1
- package/dist/styles/pagefind.js.map +1 -1
- package/dist/styles/result-list.js +25 -4
- package/dist/styles/result-list.js.map +1 -1
- package/dist/styles/results.js +17 -2
- package/dist/styles/results.js.map +1 -1
- package/dist/styles/tokens.js +1 -1
- package/dist/tokens.css +47 -1
- package/dist-cdn/base.css +69 -6
- package/dist-cdn/bento-box.js +1 -0
- package/dist-cdn/bento-box.js.map +1 -1
- package/dist-cdn/chunks/{base-BI8h0Gf3.js → base-CIX_-Rmo.js} +58 -6
- package/dist-cdn/chunks/base-CIX_-Rmo.js.map +1 -0
- package/dist-cdn/chunks/{compare-DV6ltvsJ.js → compare-C0nhByn7.js} +66 -29
- package/dist-cdn/chunks/compare-C0nhByn7.js.map +1 -0
- package/dist-cdn/chunks/{hours-data-Bw6vkIw7.js → hours-data-gMu5uT7H.js} +2 -2
- package/dist-cdn/chunks/hours-data-gMu5uT7H.js.map +1 -0
- package/dist-cdn/chunks/{library-weekly-hours-CrV3TlP5.js → library-weekly-hours-BJgxAyah.js} +3 -2
- package/dist-cdn/chunks/library-weekly-hours-BJgxAyah.js.map +1 -0
- package/dist-cdn/chunks/{regions-B8ExwUGP.js → regions-B-rOwa-v.js} +15 -15
- package/dist-cdn/chunks/regions-B-rOwa-v.js.map +1 -0
- package/dist-cdn/chunks/{site-header-DYRMpdBj.js → site-header-CEmNtmk5.js} +2 -2
- package/dist-cdn/chunks/{site-header-DYRMpdBj.js.map → site-header-CEmNtmk5.js.map} +1 -1
- package/dist-cdn/chunks/{site-main-nav-DURrQMal.js → site-main-nav-CAwKq_x5.js} +9 -2
- package/dist-cdn/chunks/site-main-nav-CAwKq_x5.js.map +1 -0
- package/dist-cdn/chunks/states-DGXGzcte.js +17 -0
- package/dist-cdn/chunks/states-DGXGzcte.js.map +1 -0
- package/dist-cdn/custom-elements.json +1992 -1681
- package/dist-cdn/events-section.js +1 -0
- package/dist-cdn/events-section.js.map +1 -1
- package/dist-cdn/library-hours-setup.js +1 -1
- package/dist-cdn/library-weekly-hours.js +1 -1
- package/dist-cdn/manifest.json +1 -1
- package/dist-cdn/pagefind.css +8 -1
- package/dist-cdn/site-header.js +1 -1
- package/dist-cdn/site-hours-section.js +1 -1
- package/dist-cdn/site-main-nav.js +1 -1
- package/dist-cdn/site-page.js +50 -46
- package/dist-cdn/site-page.js.map +1 -1
- package/dist-cdn/site-style.js +6 -6
- package/dist-cdn/site-style.js.map +1 -1
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +6 -5
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +36 -9
- package/dist-cdn/tokens.css +47 -1
- package/dist-cdn/uvalib-card.js +6 -0
- package/dist-cdn/uvalib-card.js.map +1 -1
- package/dist-cdn/uvalib-combobox.js +107 -68
- package/dist-cdn/uvalib-combobox.js.map +1 -1
- package/dist-cdn/uvalib-contents.js +5 -0
- package/dist-cdn/uvalib-contents.js.map +1 -1
- package/dist-cdn/uvalib-filter-drawer.js +27 -25
- package/dist-cdn/uvalib-filter-drawer.js.map +1 -1
- package/dist-cdn/uvalib-image-regions.js +3 -1
- package/dist-cdn/uvalib-image-regions.js.map +1 -1
- package/dist-cdn/uvalib-lightbox.js +80 -69
- package/dist-cdn/uvalib-lightbox.js.map +1 -1
- package/dist-cdn/uvalib-map.js +2 -2
- package/dist-cdn/uvalib-map.js.map +1 -1
- package/dist-cdn/uvalib-metadata.js +3 -0
- package/dist-cdn/uvalib-metadata.js.map +1 -1
- package/dist-cdn/uvalib-pagefind-search.js +2 -1
- package/dist-cdn/uvalib-pagefind-search.js.map +1 -1
- package/dist-cdn/uvalib-photo-grid.js +4 -5
- package/dist-cdn/uvalib-photo-grid.js.map +1 -1
- package/dist-cdn/uvalib-tag-list.js +21 -16
- package/dist-cdn/uvalib-tag-list.js.map +1 -1
- package/package.json +1 -1
- package/skills/uvalib-web-components/SKILL.md +6 -5
- package/skills/uvalib-web-components/reference/components.md +36 -9
- package/dist-cdn/chunks/base-BI8h0Gf3.js.map +0 -1
- package/dist-cdn/chunks/compare-DV6ltvsJ.js.map +0 -1
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +0 -1
- package/dist-cdn/chunks/library-weekly-hours-CrV3TlP5.js.map +0 -1
- package/dist-cdn/chunks/regions-B8ExwUGP.js.map +0 -1
- package/dist-cdn/chunks/site-main-nav-DURrQMal.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bento-box.js","names":["DEFAULT_LEVEL","structuralRules","shadowStructure","unsafeCSS","nothing","unsafeStatic","_decorate","property","state","unsafeCSS","unsafeStatic","nothing","_decorate","property","state","nothing","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","s","trackEvent","trackError","trackSearch","precedingHeadingLevel","accessible","fetchText","fetchJson","DEFAULT_LIMIT","DEFAULT_LEVEL$1","MAX_LIMIT","structuralRules$1","host","shadowStructure$1","renderRuns","runs","BentoSection","root","sheet","path","list","node","li","position","above","changed","id","query","controller","results","hadFocus","active","url","params","total","name","value","A","body","h","loading","items","placeholders","message","found","bentoEndpoints","bentoTiming","KEYS","setBentoEndpoints","key","from","globalApplied","endpoints","retryStatus","cache","shared","signal","entry","e","run","left","leave","abort","reject","resolve","v","err","token","tokenValue","guestToken","p","dropToken","stale","ITEM_BASE","SIGN_IN","SIGN_IN_TITLE","MAX_AUTHORS","str","parseVirgo","j","json","groups","g","record","fields","all","test","f","first","raw","signIn","pool","authors","count","virgoKeyword","virgoBody","limit","searchVirgo","attempt","t","sig","options","virgoSearchUrl","MONTHS","formatPublished","m","year","month","day","d","date","SAFE","safeUrl","u","base","GUIDES_BASE","linkOf","a","text","textRuns","add","last","mark","walk","el","markTag","c","inert","html","parseGuides","data","titleBox","titleLink","meta","highlights","l","guidesSearchUrl","withParams","searchGuides","TYPES","WEBSITE_BASE","websiteParams","parseWebsite","nodes","title","alias","nid","excerpt","job","searchWebsite","websiteSearchUrl","VirgoSection","cls","editions","formats","ArticlesSection","_args","BENTO_BOXES","DEFAULT_LEVEL","parseBoxes","known","out","urlQuery","search","structuralRules","shadowStructure","SEARCH_ICON","instances","BentoBox","sections","fromUrl","q","tag","box","level","boxes","input","describe","CatalogSection","LibGuidesSection","by","subjects","WebsiteSection","w"],"sources":["../src/components/bento-box/BentoSection.ts","../src/components/bento-box/bento-data.ts","../src/components/bento-box/VirgoSection.ts","../src/components/bento-box/ArticlesSection.ts","../src/components/bento-box/BentoBox.ts","../src/components/bento-box/CatalogSection.ts","../src/components/bento-box/LibGuidesSection.ts","../src/components/bento-box/WebsiteSection.ts","../src/components/bento-box/bento-box.ts"],"sourcesContent":["import { css, nothing, unsafeCSS, type CSSResult, type PropertyValues } from 'lit';\nimport { html, unsafeStatic, type StaticValue } from 'lit/static-html.js';\nimport { property, state } from 'lit/decorators.js';\nimport { trackError, trackEvent, trackSearch } from '../../base/analytics.js';\nimport { precedingHeadingLevel } from '../../base/heading-level.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport type { TextRun } from './bento-data.js';\n\n/**\n * `loading` until the first answer, then `ready` (results shown), `empty` (none found, or no\n * query) or `error` (they could not be loaded).\n */\nexport type BentoState = 'loading' | 'ready' | 'empty' | 'error';\n\n/** What a section's source answers. */\nexport interface SectionResults<T> {\n items: T[];\n total?: number;\n /** The source's own \"see all\" URL, when it sends one. */\n seeAll?: string;\n}\n\nconst DEFAULT_LIMIT = 5;\nconst DEFAULT_LEVEL = 3;\nconst MAX_LIMIT = 50;\n\n/**\n * Rules every section needs even with `no-style`, where the Drupal theme styles it: the host\n * is a block, placeholder entries are invisible, the message sits over the list's first entry\n * (both in one grid cell, so it never moves anything), titles and teasers clamp to a fixed\n * number of lines (the whole text stays in the DOM) while a hidden reserve list of placeholders\n * in the same cell keeps the loading height, and `[hidden]` hides. `host` is `:host`\n * (shadow) or the tag name (light DOM, so they stay scoped).\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} .bs-results--placeholder { visibility: hidden; }\n ${host} .bs-results--stack { display: grid; }\n ${host} .bs-results--stack > * { grid-area: 1 / 1; min-width: 0; }\n ${host} .bs-results--message { align-self: start; z-index: 1; }\n ${host} .bs-results--see-all { display: inline; }\n ${host} .bs-results--guide { font-weight: normal; }\n ${host} .bs-results--title,\n ${host} .bento-section-title,\n ${host} .bs-results--highlights {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n overflow: hidden;\n }\n ${host} .bento-section-desc {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n line-clamp: 3;\n overflow: hidden;\n }\n /* Placeholders take every clamped block's full height. Results don't (a one-line title sits\n right above its author); the reserve list behind them holds the placeholders' height. */\n ${host} .bs-results--placeholder .bs-results--title,\n ${host} .bs-results--placeholder .bento-section-title,\n ${host} .bs-results--placeholder .bs-results--highlights {\n min-height: 3em;\n min-height: 2lh;\n }\n ${host} .bs-results--placeholder .bento-section-desc {\n min-height: 4.5em;\n min-height: 3lh;\n }\n ${host} .bs-results--reserve { visibility: hidden; pointer-events: none; }\n ${host} .bs-results--author,\n ${host} .bs-results--date,\n ${host} .bs-results--format,\n ${host} .bs-results--byline {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n /* A guide with no author or subjects keeps its placeholder's line. */\n ${host} .bs-results--byline { min-height: 1.5em; min-height: 1lh; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/** Render text runs, the matched words in `<mark>` (all as text, never as HTML). */\nexport const renderRuns = (runs: readonly TextRun[]) =>\n runs.map((r) => (r.mark ? html`<mark>${r.text}</mark>` : r.text));\n\n/**\n * The shared behaviour of the four `<bento-box>` sections: a header (heading and \"see all\"),\n * a description, and an `ol.bs-results--list` of results, with loading, empty and error\n * states, in the DOM and classes the Drupal theme styles. Not registered itself.\n *\n * @fires bento-state - Whenever `state` changes (bubbles, composed); `<bento-box>` listens to announce \"Results updated\" once every section has settled.\n * @fires uvalib-analytics-search - For `<site-analytics>`: once per settled search (results or none, not an error): the query, the section's `analyticsName` as category and its total when known. Bubbles and is composed.\n * @fires uvalib-analytics-event - For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; `['bento-box', 'retry', <section>]` for its Retry button; `['bento-box', 'error', 'section-load: <section>']` once when its results cannot be loaded; never titles or URLs. Bubbles and is composed.\n * @cssprop --uva-color-text - Dark-mode role token: text (else #2b2b2b).\n * @cssprop --uva-color-link - Dark-mode role token: titles, links and buttons (else `--uva-brand-blue`).\n * @cssprop --uva-color-border - Dark-mode role token: the block's border and entry rules (else #dadada).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: background (else #fff).\n * @cssprop --uva-color-surface-hover - Dark-mode role token: the header band (else #dadada).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport abstract class BentoSection<T> extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n background: var(--uva-color-surface-raised, #fff);\n border: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));\n border-top: none;\n line-height: 1.5;\n min-width: 0;\n }\n a {\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n /* One line whatever the count's length, so the header keeps its height. */\n .bs-results--header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 0.5rem 1rem;\n padding: 0.5rem 1rem;\n background: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));\n }\n .bs-results--header > :is(h1, h2, h3, h4, h5, h6) {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: 0;\n font-size: 1.0625rem;\n line-height: 1.5;\n text-transform: uppercase;\n }\n .bs-results--body {\n padding: 1rem;\n }\n .bs-results--body > p {\n margin: 0 0 1rem;\n }\n .bs-results--list {\n margin: 0 0 1rem;\n padding-inline-start: 1.5rem;\n }\n .bs-results--list--entry,\n .bs-results--list > li {\n border-bottom: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));\n margin-bottom: 1rem;\n padding-bottom: 1rem;\n }\n .bs-results--list > li:last-child {\n border-bottom: none;\n margin-bottom: 0;\n }\n .bs-results--title,\n .bento-section-title {\n font-weight: 700;\n }\n .ul-0,\n .ul-1 {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n .ul-1 {\n display: flex;\n justify-content: space-between;\n gap: 1rem;\n }\n .ul-1 > li {\n min-width: 0;\n }\n .bs-results--teaser {\n padding: 0.5rem 0;\n }\n .bs-results--message {\n margin: 0;\n }\n .uvalib-button {\n display: inline-block;\n white-space: nowrap;\n font: inherit;\n line-height: 1.5;\n padding: 0.1rem 0.75rem;\n border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n text-decoration: none;\n cursor: pointer;\n }\n .bs-results--message .uvalib-button {\n margin-inline-start: 0.5rem;\n }\n .uvalib-button[aria-disabled='true'] {\n cursor: progress;\n }\n `,\n ];\n\n /** The search text. Empty: nothing is fetched and the section is `empty`. */\n @property({ type: String })\n query = '';\n\n /** How many results to show (at most). */\n @property({ type: Number })\n limit = 5;\n\n /** The message shown when nothing is found. */\n @property({ type: String, attribute: 'no-result-describe' })\n noResultDescribe = 'No results found.';\n\n /**\n * The level of the section's heading, 1 to 6. Unset (the default), it is one below the\n * nearest heading before the element in the page, or 3 when there is none. `<bento-box>`\n * sets it one below its own heading.\n */\n @property({ type: Number, attribute: 'heading-level' })\n headingLevel?: number;\n\n /** The section's heading (\"Virgo Catalog\"). */\n protected abstract readonly heading: string;\n /** What the source holds, shown under the header. */\n protected abstract readonly describe: string;\n /** The source's name inside a sentence (\"Virgo catalog\"), for \"See all\" and errors. */\n protected abstract readonly sourceName: string;\n /**\n * The section's name in analytics (\"Virgo catalog\"): the site-search category and the\n * click events' name.\n */\n abstract readonly analyticsName: string;\n /** Where \"See all … results in ___\" searches; the source name unless a section says otherwise. */\n protected get seeAllIn(): string {\n return this.sourceName;\n }\n /** The link shown instead of \"See all\" when nothing was found: its text and URL. */\n protected abstract readonly home: { text: string; url: string };\n\n /** Fetch the results for `query`. */\n protected abstract fetchResults(\n query: string,\n limit: number,\n signal: AbortSignal,\n ): Promise<SectionResults<T>>;\n /** The source's own search for `query`. */\n protected abstract seeAllUrl(query: string): string;\n /** One result: an `li` of the list. */\n protected abstract renderItem(item: T): unknown;\n /** An entry with the real classes and typical text, for placeholders. */\n protected abstract renderPlaceholderBody(): unknown;\n /** The class of each result's `li` (the website's carry none, as before). */\n protected entryClass = 'bs-results--list--entry';\n\n /** `loading` (the default, until the first answer), `ready`, `empty` or `error`. Read-only. */\n get state(): BentoState {\n return this._state;\n }\n\n @state() private _state: BentoState = 'loading';\n @state() private results?: SectionResults<T>;\n /** A Retry click's load is running: the button stays, disabled, so focus stays on it. */\n @state() private retrying = false;\n @state() private inferredLevel = DEFAULT_LEVEL;\n\n private loadId = 0;\n private controller?: AbortController;\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n constructor() {\n super();\n this.addEventListener('click', this.onClick);\n }\n\n /**\n * One delegated listener reports clicks on results (`result-click`, with the result's\n * 1-based position) and on \"See all\" (`see-all-click`), never the titles or URLs.\n */\n private readonly onClick = (e: Event) => {\n const path = e.composedPath();\n const list = this.renderRoot.querySelector('.bs-results--list');\n for (const node of path) {\n if (node === this) return;\n if (!(node instanceof Element)) continue;\n if (node.matches('.bs-results--message button:not([aria-disabled])')) {\n trackEvent(this, ['bento-box', 'retry', this.analyticsName]);\n return;\n }\n if (node.matches('.bs-results--see-all button')) {\n trackEvent(this, ['bento-box', 'see-all-click', this.analyticsName]);\n return;\n }\n if (node.matches('a[href]')) {\n const li = path.find((n) => n instanceof HTMLLIElement && n.parentNode === list) as\n HTMLLIElement | undefined;\n if (!li || li.classList.contains('bs-results--placeholder')) return;\n const position = [...list!.children].indexOf(li) + 1;\n trackEvent(this, ['bento-box', 'result-click', this.analyticsName, position]);\n return;\n }\n }\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n const above = precedingHeadingLevel(this);\n this.inferredLevel = above === null ? DEFAULT_LEVEL : Math.min(above + 1, 6);\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n const root = node instanceof ShadowRoot || node instanceof Document ? node : undefined;\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)) as CSSResult,\n { root, scope: false },\n );\n }\n // Reconnected after a disconnect (which aborts the load): catch up.\n if (this.hasUpdated && this._state === 'loading') void this.load();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.controller) {\n // Abandon the load: its abort must not land as an error, and reconnecting reloads.\n this.loadId++;\n this.controller.abort();\n this.controller = undefined;\n this._state = 'loading';\n }\n }\n\n protected get count(): number {\n const n = Math.trunc(this.limit);\n return Number.isFinite(n) && n > 0 ? Math.min(n, MAX_LIMIT) : DEFAULT_LIMIT;\n }\n\n private get level(): number {\n const n = Math.trunc(this.headingLevel ?? Number.NaN);\n return n >= 1 && n <= 6 ? n : this.inferredLevel;\n }\n\n private get q(): string {\n return (this.query ?? '').trim();\n }\n\n protected override willUpdate(changed: PropertyValues<this>) {\n if (!this.isConnected) return;\n if (!this.hasUpdated || changed.has('query') || changed.has('limit')) void this.load();\n }\n\n protected override updated(changed: PropertyValues<this>) {\n if ((changed as Map<PropertyKey, unknown>).has('_state'))\n this.dispatchEvent(new Event('bento-state', { bubbles: true, composed: true }));\n }\n /** The query last reported as a site search, so a reload for it is not counted again. */\n private reportedQuery?: string;\n\n /**\n * Load the results. An older load still running is aborted, and its answer, should it land\n * anyway, is ignored: the newest query always wins.\n */\n private async load() {\n const id = ++this.loadId;\n this.controller?.abort();\n const query = this.q;\n if (!query) {\n this.controller = undefined;\n this.results = undefined;\n this._state = 'empty';\n this.reportedQuery = undefined;\n return;\n }\n const controller = (this.controller = new AbortController());\n this._state = 'loading';\n this.results = undefined;\n try {\n const results = await this.fetchResults(query, this.count, controller.signal);\n if (id !== this.loadId) return; // a newer load owns the element\n this.results = { ...results, items: results.items.slice(0, this.count) };\n this._state = this.results.items.length ? 'ready' : 'empty';\n // One site search per query shown (never on error): a new query, a Back or Forward to\n // another, or a retry that succeeds; a reload for the same query (a `limit` change, a\n // reconnect) is not a new search. Nothing found counts 0 even without a total.\n if (query !== this.reportedQuery) {\n this.reportedQuery = query;\n trackSearch(\n this,\n query,\n this.analyticsName,\n results.total ?? (this._state === 'empty' ? 0 : undefined),\n );\n }\n } catch {\n if (id !== this.loadId) return;\n this.results = undefined;\n this._state = 'error';\n this.reportedQuery = undefined;\n trackError(this, 'bento-box', `section-load: ${this.analyticsName}`);\n } finally {\n if (this.controller === controller) this.controller = undefined;\n }\n }\n\n /** Load again (after an error), keeping keyboard focus in the section. */\n async retry(): Promise<void> {\n if (this.retrying) return;\n const hadFocus = this.focusedInside();\n this.retrying = true;\n try {\n await this.load();\n } finally {\n this.retrying = false;\n }\n await this.updateComplete;\n if (!hadFocus) return;\n const r = this.renderRoot;\n if (this._state === 'ready')\n r.querySelector<HTMLAnchorElement>('.bs-results--list a[href]')?.focus();\n else if (this._state === 'error')\n r.querySelector<HTMLButtonElement>('.bs-results--message button')?.focus();\n else r.querySelector<HTMLElement>('.bs-results--message')?.focus();\n }\n\n private focusedInside(): boolean {\n const active =\n this.renderRoot instanceof ShadowRoot\n ? this.renderRoot.activeElement\n : document.activeElement;\n return !!active && (this.renderRoot as Node).contains(active) && active !== this;\n }\n\n /** \"See all 138,420 results\", naming the source for assistive technology. */\n private renderSeeAll() {\n const url = new URL(this.results?.seeAll ?? this.seeAllUrl(this.q));\n const params = [...url.searchParams];\n url.search = '';\n const total = this._state === 'ready' ? this.results?.total : undefined;\n return html`<form class=\"bs-results--see-all\" action=${url.href} method=\"get\">\n ${params.map(([name, value]) => html`<input type=\"hidden\" name=${name} .value=${value} />`)}\n <button type=\"submit\" class=\"uvalib-button\">\n See all\n ${\n total === undefined\n ? nothing\n : html`<span class=\"bs-results--qty\">${total.toLocaleString('en-US')}</span>`\n }\n results<span class=\"visually-hidden\"> in ${this.seeAllIn}</span>\n </button>\n </form>`;\n }\n\n private renderMessage() {\n if (this.retrying || this._state === 'error')\n return html`${this.sourceName[0]!.toUpperCase()}${this.sourceName.slice(1)} results are\n unavailable right now.\n <button\n type=\"button\"\n class=\"uvalib-button\"\n aria-disabled=${this.retrying ? 'true' : nothing}\n @click=${this.retry}\n >\n ${this.retrying ? 'Retrying…' : 'Retry'}<span class=\"visually-hidden\">\n ${this.sourceName}</span\n >\n </button>`;\n if (this._state === 'empty') return this.noResultDescribe;\n return nothing;\n }\n\n private renderPlaceholder() {\n return html`<li class=\"${this.entryClass} bs-results--placeholder\" aria-hidden=\"true\">\n ${this.renderPlaceholderBody()}\n </li>`;\n }\n\n /** The `li` for one result, with the entry class. */\n protected entry(body: unknown) {\n return html`<li class=${this.entryClass || nothing}>${body}</li>`;\n }\n\n render() {\n const h: StaticValue = unsafeStatic(`h${this.level}`);\n const loading = this._state === 'loading';\n const items = this._state === 'ready' ? (this.results?.items ?? []) : [];\n // Before the answer: the limit's worth of placeholders, so the section has its final\n // height. Empty, failed or retrying: one entry's height, under the message.\n const placeholders = items.length ? 0 : loading && !this.retrying ? this.count : 1;\n const message = this.renderMessage();\n const found = loading || this._state === 'ready';\n return html`<div class=\"bs-results--header\">\n <${h}>${this.heading}</${h}>\n ${\n found && this.q\n ? this.renderSeeAll()\n : html`<div><a href=${this.home.url} class=\"uvalib-button\">${this.home.text}</a></div>`\n }\n </div>\n <div class=\"bs-results--body\">\n <p>${this.describe}</p>\n <div class=\"bs-results--stack\">\n <ol class=\"bs-results--list\" aria-busy=${loading ? 'true' : 'false'}>\n ${items.map((i) => this.renderItem(i))}\n ${Array.from({ length: placeholders }, () => this.renderPlaceholder())}\n </ol>\n ${\n // Behind the results, as many placeholders as results: the cell keeps the height\n // the placeholders had while loading, so short titles never move what follows.\n items.length\n ? html`<ol class=\"bs-results--list bs-results--reserve\" aria-hidden=\"true\">\n ${items.map(() => this.renderPlaceholder())}\n </ol>`\n : nothing\n }\n ${\n message === nothing\n ? nothing\n : html`<p class=\"bs-results--message\" tabindex=\"-1\">${message}</p>`\n }\n </div>\n </div>`;\n }\n}\n","// Data for <bento-box> and its four sections: the Virgo catalog and articles pools, the\n// LibGuides search proxy and the library website's Drupal search index. Internal: not\n// exported from the package entry (only the types are). No side effects on import.\n//\n// Everything read from these services is reduced to plain text and http(s) URLs here; the\n// sections render it with Lit, never as HTML.\n\nimport { fetchJson, fetchText, type FetchOptions, type HttpError } from '../../data/fetch-json.js';\n\n/** The URLs the sections fetch, shared by every element on the page. */\nexport interface BentoEndpoints {\n /** Virgo's guest token: POST, answers a JWT as text. */\n authorize: string;\n /** The Virgo catalog pool's search (POST, Bearer token). */\n catalog: string;\n /** The Virgo articles pool's search (POST, Bearer token). */\n articles: string;\n /** The LibGuides search proxy (GET, `?q=`). */\n guides: string;\n /** The library website's Drupal search index (GET, JSON:API). Same origin only: no CORS. */\n website: string;\n}\n\n/**\n * Where the results come from (exposed to pages as `BentoBox.endpoints`). A page can also set\n * `window.uvalibBentoEndpoints` (any of the keys) before the script runs; it is merged in at\n * the first fetch. Requests are cached, so a change applies to the next search.\n *\n * The guides proxy is the us-east-1 one: the us-east-2 proxy ignores `q` and answers cached\n * results. The website index is relative, as Drupal serves it on its own origin only.\n */\nexport const bentoEndpoints: BentoEndpoints = {\n authorize: 'https://search.lib.virginia.edu/authorize',\n catalog: 'https://pool-solr-ws-uva-library.internal.lib.virginia.edu/api/search',\n articles: 'https://pool-eds-ws.internal.lib.virginia.edu/api/search',\n guides:\n 'https://qmo3jwybkg.execute-api.us-east-1.amazonaws.com/production/library/libguides-proxy',\n website: '/jsonapi/index/default_index',\n};\n\n/** Fetch attempts, the delay between them (ms) and each attempt's timeout (ms). */\nexport const bentoTiming = { retries: 2, retryDelay: 1000, timeout: 10_000 };\n\ndeclare global {\n interface Window {\n /** Optional endpoint overrides for <bento-box>, read at its first fetch. */\n uvalibBentoEndpoints?: Partial<BentoEndpoints>;\n }\n}\n\nconst KEYS = ['authorize', 'catalog', 'articles', 'guides', 'website'] as const;\n\n/** Copy the known endpoint keys (non-empty strings only) from `from` into the shared endpoints. */\nexport function setBentoEndpoints(from: Partial<BentoEndpoints> | null | undefined): void {\n for (const key of KEYS) {\n const value = from?.[key];\n if (typeof value === 'string' && value) bentoEndpoints[key] = value;\n }\n}\n\nlet globalApplied = false;\nfunction endpoints(): BentoEndpoints {\n if (!globalApplied) {\n globalApplied = true;\n setBentoEndpoints(globalThis.window?.uvalibBentoEndpoints);\n }\n return bentoEndpoints;\n}\n\n/** Only server errors, timeouts and rate limits are worth trying again. */\nconst retryStatus = (s: number) => s >= 500 || s === 408 || s === 429;\n\n// --- shared, abortable requests ----------------------------------------------------------\n\ninterface Shared {\n promise: Promise<unknown>;\n controller: AbortController;\n /** Callers still waiting for it. */\n waiting: number;\n settled: boolean;\n}\nconst cache = new Map<string, Shared>();\n\n/**\n * `run` once per `key`: identical requests share one fetch and its answer stays cached; a\n * failure is not cached. A caller's `signal` only stops that caller waiting; the fetch itself\n * is aborted (and forgotten) once every caller still waiting has aborted.\n */\nfunction shared<T>(\n key: string,\n run: (signal: AbortSignal) => Promise<T>,\n signal?: AbortSignal,\n): Promise<T> {\n if (signal?.aborted) return Promise.reject(signal.reason);\n let entry = cache.get(key);\n if (!entry) {\n const controller = new AbortController();\n const e: Shared = { controller, waiting: 0, settled: false, promise: run(controller.signal) };\n e.promise.then(\n () => (e.settled = true),\n () => {\n e.settled = true;\n if (cache.get(key) === e) cache.delete(key);\n },\n );\n cache.set(key, (entry = e));\n }\n const e = entry;\n if (!signal) return e.promise as Promise<T>;\n e.waiting++;\n return new Promise<T>((resolve, reject) => {\n let left = false;\n const leave = () => {\n if (left) return;\n left = true;\n signal.removeEventListener('abort', abort);\n e.waiting--;\n };\n const abort = () => {\n leave();\n if (!e.settled && e.waiting === 0) {\n e.controller.abort(signal.reason);\n if (cache.get(key) === e) cache.delete(key);\n }\n reject(signal.reason);\n };\n signal.addEventListener('abort', abort, { once: true });\n (e.promise as Promise<T>).then(\n (v) => {\n leave();\n resolve(v);\n },\n (err) => {\n leave();\n reject(err);\n },\n );\n });\n}\n\n// --- the Virgo guest token -----------------------------------------------------------------\n\nlet token: Promise<string> | undefined;\n/** The token `token` resolved to, once it has. */\nlet tokenValue: string | undefined;\n\n/**\n * Virgo's guest token, fetched once per page and shared by every section; a failure is not\n * kept, so the next search asks again.\n */\nexport function guestToken(): Promise<string> {\n if (!token) {\n tokenValue = undefined;\n const p = fetchText(endpoints().authorize, bentoTiming, { method: 'POST', retryStatus }).then(\n (t) => {\n const value = t.trim();\n if (!value) throw new Error('empty Virgo guest token');\n if (token === p) tokenValue = value;\n return value;\n },\n );\n token = p;\n p.catch(() => {\n if (token === p) token = undefined;\n });\n }\n return token;\n}\n\n/** Forget `stale` (a token a pool refused) so the next guestToken() fetches a new one. */\nfunction dropToken(stale: string) {\n if (tokenValue === stale) token = tokenValue = undefined;\n}\n\n// --- Virgo: catalog and articles ----------------------------------------------------------\n\n/** One Virgo result, reduced to what a section shows. */\nexport interface VirgoItem {\n title: string;\n /** The item's Virgo page. */\n url: string;\n /** At most five, then \"and N more\". */\n authors: string[];\n /** As Virgo sends it: `YYYY`, `YYYY-MM` or `YYYY-MM-DD` (see `formatPublished`). */\n published?: string;\n /** The catalog's formats, or the articles' publication types. */\n formats: string[];\n /** How many records (editions) the result groups; 1 for most. */\n editions: number;\n /** An articles record shown to guests without its details (Virgo's sign-in placeholder). */\n signIn: boolean;\n}\n\nexport interface Results<T> {\n items: T[];\n /** The total number of results, when the source says. */\n total?: number;\n}\n\nexport type VirgoPool = 'catalog' | 'articles';\n\nconst ITEM_BASE: Record<VirgoPool, string> = {\n catalog: 'https://search.lib.virginia.edu/sources/uva_library/items/',\n articles: 'https://search.lib.virginia.edu/sources/articles/items/',\n};\n\n/** The title Virgo gives guests for an article it hides. */\nconst SIGN_IN = /^please sign in to see more/i;\n/** The neutral title shown instead. */\nexport const SIGN_IN_TITLE = 'Article details available after signing in to Virgo';\n\nconst MAX_AUTHORS = 5;\n\ninterface Field {\n name?: unknown;\n type?: unknown;\n value?: unknown;\n}\n\nconst str = (v: unknown) => (typeof v === 'string' ? v.replace(/\\s+/g, ' ').trim() : '');\n\n/**\n * Virgo's `{ pagination, group_list }` reduced to VirgoItem: the first record of each group\n * (a multi-edition work shows once, with its edition count). Records without a title or an\n * identifier are skipped.\n */\nexport function parseVirgo(json: unknown, pool: VirgoPool): Results<VirgoItem> {\n const j = json as { pagination?: { total?: unknown }; group_list?: unknown } | null;\n const groups = Array.isArray(j?.group_list) ? (j.group_list as Record<string, unknown>[]) : [];\n const items: VirgoItem[] = [];\n for (const g of groups) {\n const record = (Array.isArray(g?.record_list) ? g.record_list[0] : undefined) as\n { fields?: unknown } | undefined;\n const fields = (Array.isArray(record?.fields) ? record.fields : []) as Field[];\n const all = (test: (f: Field) => boolean) => fields.filter(test).map((f) => str(f.value));\n const first = (test: (f: Field) => boolean) => all(test).find(Boolean) ?? '';\n const raw = first((f) => f.type === 'title');\n const id = first((f) => f.type === 'identifier');\n if (!raw || !id) continue;\n const signIn = pool === 'articles' && SIGN_IN.test(raw);\n let authors = all((f) => f.type === 'author').filter(Boolean);\n if (authors.length > MAX_AUTHORS)\n authors = [...authors.slice(0, MAX_AUTHORS), `and ${authors.length - MAX_AUTHORS} more`];\n const count = Math.trunc(Number(g.count));\n items.push({\n title: signIn ? SIGN_IN_TITLE : raw,\n url: ITEM_BASE[pool] + encodeURIComponent(id),\n authors,\n published: first((f) => f.name === 'published_date') || undefined,\n formats: all((f) => f.name === (pool === 'articles' ? 'pub_type' : 'format')).filter(Boolean),\n editions: count > 1 ? count : 1,\n signIn,\n });\n }\n const total = Number(j?.pagination?.total);\n return { items, total: Number.isFinite(total) && total >= 0 ? total : undefined };\n}\n\n/**\n * `query` as a Virgo `keyword: {…}` clause. Braces delimit the clause, so any in the query\n * become spaces rather than closing it early or opening another.\n */\nexport function virgoKeyword(query: string): string {\n return `keyword: {${query.replace(/[{}]/g, ' ')}}`;\n}\n\n/** The search body both Virgo pools take. */\nexport function virgoBody(query: string, limit: number): string {\n return JSON.stringify({\n query: virgoKeyword(query),\n pagination: { start: 0, rows: limit },\n sort: { sort_id: 'SortRelevance', order: 'desc' },\n filters: [{ pool_id: 'uva_library', facets: [] }],\n });\n}\n\n/**\n * The first `limit` results for `query` in `pool`. A 401 (an expired guest token) fetches a\n * new token and tries once more.\n */\nexport function searchVirgo(\n pool: VirgoPool,\n query: string,\n limit: number,\n signal?: AbortSignal,\n): Promise<Results<VirgoItem>> {\n const url = endpoints()[pool];\n const body = virgoBody(query, limit);\n return shared(\n `POST ${url}\\n${body}`,\n async (sig) => {\n for (let attempt = 0; ; attempt++) {\n const t = await guestToken();\n if (sig.aborted) throw sig.reason;\n const options: FetchOptions = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${t}`,\n },\n body,\n signal: sig,\n retryStatus,\n };\n try {\n return parseVirgo(await fetchJson(url, bentoTiming, options), pool);\n } catch (e) {\n if (attempt === 0 && (e as HttpError).status === 401) {\n dropToken(t);\n continue;\n }\n throw e;\n }\n }\n },\n signal,\n );\n}\n\n/** Virgo's \"see all\" search for `query` in the catalog or the articles. */\nexport function virgoSearchUrl(pool: VirgoPool, query: string): string {\n const p = new URLSearchParams(\n pool === 'catalog'\n ? { q: query, pool: 'uva_library' }\n : { q: virgoKeyword(query), pool: 'articles' },\n );\n return `https://search.lib.virginia.edu/?${p}`;\n}\n\nconst MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\n/**\n * Virgo's published date for display, read as a calendar date (no time zone can shift it):\n * a bare year as is, `YYYY-MM` as \"Jul 2026\", `YYYY-MM-DD` as \"Jul 28, 2026\"; anything else\n * as sent.\n */\nexport function formatPublished(value: string): string {\n const m = /^(\\d{4})(?:-(\\d{2})(?:-(\\d{2}))?)?$/.exec(value);\n if (!m) return value;\n const [, year, month, day] = m;\n const name = month ? MONTHS[Number(month) - 1] : undefined;\n if (!month) return year!;\n if (!name) return value;\n if (!day) return `${name} ${year}`;\n const d = Number(day);\n // Checked as a UTC date, so 2026-02-30 is not shown.\n const date = new Date(Date.UTC(Number(year), Number(month) - 1, d));\n if (date.getUTCDate() !== d) return value;\n return new Intl.DateTimeFormat('en-US', {\n timeZone: 'UTC',\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n }).format(date);\n}\n\n// --- LibGuides -----------------------------------------------------------------------------\n\nexport interface Link {\n text: string;\n url: string;\n}\n\n/** A run of text; `mark` runs are the words the search matched. */\nexport interface TextRun {\n text: string;\n mark?: boolean;\n}\n\n/** One subject guide page, as plain text and URLs. */\nexport interface GuideItem {\n title: string;\n url: string;\n /** The guide the page belongs to. */\n guide?: Link;\n author?: Link;\n subjects: Link[];\n /** The matching text, with the matched words marked. */\n highlights: TextRun[];\n}\n\nconst SAFE = new Set(['http:', 'https:']);\n\n/** `value` as an absolute http(s) URL, or undefined. */\nexport function safeUrl(value: unknown, base?: string): string | undefined {\n if (typeof value !== 'string' || !value.trim()) return undefined;\n try {\n const u = new URL(value.trim(), base);\n return SAFE.has(u.protocol) ? u.href : undefined;\n } catch {\n return undefined;\n }\n}\n\nconst GUIDES_BASE = 'https://guides.lib.virginia.edu/';\n\nconst linkOf = (a: Element | null | undefined): Link | undefined => {\n const url = safeUrl(a?.getAttribute('href'), GUIDES_BASE);\n const text = str(a?.textContent);\n return url && text ? { text, url } : undefined;\n};\n\n/**\n * Text runs of `node`: `<mark>` / `<strong>` (as `markTag` says) become marked runs, every\n * other element only gives its text. Whitespace is collapsed and the ends trimmed.\n */\nexport function textRuns(node: Node, markTag: string): TextRun[] {\n const runs: TextRun[] = [];\n const add = (text: string, mark: boolean) => {\n if (!text) return;\n const last = runs[runs.length - 1];\n if (last && !!last.mark === mark) last.text += text;\n else runs.push(mark ? { text, mark } : { text });\n };\n const walk = (n: Node, mark: boolean) => {\n if (n.nodeType === Node.TEXT_NODE) add((n as Text).data, mark);\n else if (n.nodeType === Node.ELEMENT_NODE) {\n const el = n as Element;\n if (el.localName === 'script' || el.localName === 'style' || el.localName === 'template')\n return;\n const m = mark || el.localName === markTag;\n el.childNodes.forEach((c) => walk(c, m));\n }\n };\n node.childNodes.forEach((c) => walk(c, false));\n for (const r of runs) r.text = r.text.replace(/\\s+/g, ' ');\n if (runs.length) {\n runs[0]!.text = runs[0]!.text.trimStart();\n runs[runs.length - 1]!.text = runs[runs.length - 1]!.text.trimEnd();\n }\n return runs.filter((r) => r.text);\n}\n\n/**\n * Parse `html` into an inert document: DOMParser runs no scripts, loads nothing and fires no\n * event handlers, and nothing from it is ever put in the page.\n */\nconst inert = (html: string) => new DOMParser().parseFromString(html, 'text/html');\n\n/** The proxy's `{ data: { results, fulllink } }` reduced to GuideItem and the \"see all\" URL. */\nexport function parseGuides(json: unknown): Results<GuideItem> & { seeAll?: string } {\n const data = (json as { data?: { results?: unknown; fulllink?: unknown } } | null)?.data;\n const html = typeof data?.results === 'string' ? data.results : '';\n const items: GuideItem[] = [];\n for (const node of inert(html).querySelectorAll('.s-srch-result')) {\n const titleBox = node.querySelector('.s-srch-result-title');\n const titleLink = linkOf(titleBox?.querySelector(':scope > a'));\n if (!titleLink) continue;\n const meta = node.querySelectorAll('.s-srch-result-meta')[1];\n const highlights = meta?.querySelector('.s-srch-result-highlights');\n items.push({\n title: titleLink.text,\n url: titleLink.url,\n guide: linkOf(titleBox?.querySelector('.s-srch-result-guide a')),\n author: linkOf(meta?.querySelector('.s-srch-result-author a')),\n subjects: [...(meta?.querySelectorAll('.s-srch-result-subjects a') ?? [])]\n .map(linkOf)\n .filter((l): l is Link => !!l),\n highlights: highlights ? textRuns(highlights, 'mark') : [],\n });\n }\n return { items, seeAll: safeUrl(data?.fulllink) };\n}\n\n/** The LibGuides site search for `query` (when the proxy does not send its own link). */\nexport function guidesSearchUrl(query: string): string {\n return `${GUIDES_BASE}srch.php?${new URLSearchParams({ default_lg: '1', q: query })}`;\n}\n\n/** Add `params` to `base` (which may already have a query string). */\nfunction withParams(base: string, params: URLSearchParams): string {\n return `${base}${base.includes('?') ? '&' : '?'}${params}`;\n}\n\n/** The first `limit` subject guide pages for `query`. */\nexport function searchGuides(\n query: string,\n limit: number,\n signal?: AbortSignal,\n): Promise<Results<GuideItem> & { seeAll?: string }> {\n const url = withParams(endpoints().guides, new URLSearchParams({ q: query }));\n return shared(\n `GET ${url}`,\n async (sig) => parseGuides(await fetchJson(url, bentoTiming, { signal: sig, retryStatus })),\n signal,\n ).then((r) => ({ ...r, items: r.items.slice(0, limit) }));\n}\n\n// --- the library website (Drupal) ----------------------------------------------------------\n\n/** One page of the library website. */\nexport interface WebsiteItem {\n /** Plain text: Drupal titles are never HTML. */\n title: string;\n url: string;\n /** Drupal's excerpt, with the matched words marked; for a person without one, their job title. */\n excerpt: TextRun[];\n}\n\n/** The content types searched, as Drupal's search page does (DrupalData / WebsiteData). */\nconst TYPES = ['page', 'person', 'library', 'article'];\nexport const WEBSITE_BASE = 'https://library.virginia.edu';\n\n/** The JSON:API query: `filter[fulltext]`, `page[limit]` and an OR group over TYPES. */\nexport function websiteParams(query: string, limit: number): URLSearchParams {\n const p = new URLSearchParams();\n p.set('filter[fulltext]', query);\n p.set('page[limit]', String(limit));\n p.set('filter[types-group][group][conjunction]', 'OR');\n for (const t of TYPES) {\n p.set(`filter[${t}-filter][condition][path]`, 'type');\n p.set(`filter[${t}-filter][condition][value]`, t);\n p.set(`filter[${t}-filter][condition][memberOf]`, 'types-group');\n }\n return p;\n}\n\n/** Drupal's JSON:API answer reduced to WebsiteItem (links on https://library.virginia.edu). */\nexport function parseWebsite(json: unknown): Results<WebsiteItem> {\n const j = json as {\n data?: unknown;\n meta?: { count?: unknown; extra_data?: Record<string, { excerpt?: unknown }> };\n } | null;\n const nodes = Array.isArray(j?.data) ? (j.data as Record<string, unknown>[]) : [];\n const items: WebsiteItem[] = [];\n for (const n of nodes) {\n const a = (n?.attributes ?? {}) as Record<string, unknown>;\n const title = str(a.title);\n const alias = str((a.path as { alias?: unknown } | undefined)?.alias);\n const nid = a.drupal_internal__nid;\n const path = alias.startsWith('/')\n ? alias\n : nid != null\n ? `/node/${encodeURI(String(nid))}`\n : '';\n const url = path ? safeUrl(path, WEBSITE_BASE) : undefined;\n if (!title || !url || !url.startsWith(`${WEBSITE_BASE}/`)) continue;\n const raw = j?.meta?.extra_data?.[String(nid)]?.excerpt;\n let excerpt = typeof raw === 'string' && raw ? textRuns(inert(raw).body, 'strong') : [];\n if (!excerpt.length && n.type === 'node--person') {\n const job = a.field_uva_ldap_title;\n const text = (Array.isArray(job) ? job : [job]).map(str).filter(Boolean).join('; ');\n if (text) excerpt = [{ text }];\n }\n items.push({ title, url, excerpt });\n }\n const total = Number(j?.meta?.count);\n return { items, total: Number.isFinite(total) && total >= 0 ? total : undefined };\n}\n\n/** The first `limit` website pages for `query`. */\nexport function searchWebsite(\n query: string,\n limit: number,\n signal?: AbortSignal,\n): Promise<Results<WebsiteItem>> {\n const url = withParams(endpoints().website, websiteParams(query, limit));\n return shared(\n `GET ${url}`,\n async (sig) => parseWebsite(await fetchJson(url, bentoTiming, { signal: sig, retryStatus })),\n signal,\n );\n}\n\n/** The website's own search page for `query`. */\nexport function websiteSearchUrl(query: string): string {\n return `${WEBSITE_BASE}/search/content?${new URLSearchParams({ search_api_fulltext: query })}`;\n}\n\n/** Forget cached results and the token, and re-read `window.uvalibBentoEndpoints` (for tests). */\nexport function resetBentoCache(): void {\n cache.clear();\n token = tokenValue = undefined;\n globalApplied = false;\n}\n","import { html } from 'lit';\nimport { BentoSection, type SectionResults } from './BentoSection.js';\nimport {\n formatPublished,\n searchVirgo,\n virgoSearchUrl,\n type VirgoItem,\n type VirgoPool,\n} from './bento-data.js';\n\n/**\n * A Virgo pool's results (the catalog or the articles): each entry is its title linking to\n * Virgo, then its authors, and a row with the published date and the formats (with, for a\n * work with several editions, how many: on the same line, so every entry keeps one shape). Not registered itself.\n */\nexport abstract class VirgoSection extends BentoSection<VirgoItem> {\n protected abstract readonly pool: VirgoPool;\n\n protected fetchResults(\n query: string,\n limit: number,\n signal: AbortSignal,\n ): Promise<SectionResults<VirgoItem>> {\n return searchVirgo(this.pool, query, limit, signal);\n }\n\n protected seeAllUrl(query: string): string {\n return virgoSearchUrl(this.pool, query);\n }\n\n /**\n * An `li` with `body`, or, when there is none, an empty one hidden from assistive\n * technology, so every entry has the same lines (and height) as its placeholder.\n */\n private line(cls: string, body: unknown) {\n return body\n ? html`<li class=\"${cls} li-1\">${body}</li>`\n : html`<li class=\"${cls} li-1\" aria-hidden=\"true\"> </li>`;\n }\n\n protected renderItem(r: VirgoItem) {\n const editions =\n r.editions > 1\n ? html`<span class=\"bs-results--editions\"\n >${r.formats.length ? ', ' : ''}${r.editions} editions</span\n >`\n : '';\n const formats = r.formats.length || editions ? html`${r.formats.join('/')}${editions}` : '';\n return this.entry(\n html`<a href=${r.url} class=\"bs-results--title\">${r.title}</a>\n <ul class=\"ul-0\">\n ${this.line('bs-results--author', r.authors.join('; '))}\n <li>\n <ul class=\"ul-1\">\n ${this.line(\n 'bs-results--date',\n r.published\n ? html`<time datetime=${r.published}>${formatPublished(r.published)}</time>`\n : '',\n )}\n ${this.line('bs-results--format', formats)}\n </ul>\n </li>\n </ul>`,\n );\n }\n\n protected renderPlaceholderBody() {\n return html`<a class=\"bs-results--title\">Library search result</a>\n <ul class=\"ul-0\">\n <li class=\"bs-results--author li-1\">Author, Example</li>\n <li>\n <ul class=\"ul-1\">\n <li class=\"bs-results--date li-1\">2024</li>\n <li class=\"bs-results--format li-1\">Book</li>\n </ul>\n </li>\n </ul>`;\n }\n}\n","import { VirgoSection } from './VirgoSection.js';\n\n/**\n * Virgo's first article results for `query`. Articles Virgo hides from guests keep their\n * link, under a neutral title (\"Article details available after signing in to Virgo\").\n *\n * @tagname articles-section\n */\nexport class ArticlesSection extends VirgoSection {\n protected readonly pool = 'articles';\n readonly analyticsName = 'Virgo articles';\n protected readonly heading = 'Article';\n protected readonly sourceName = 'Virgo article';\n protected override get seeAllIn(): string {\n return 'Virgo articles';\n }\n protected readonly describe =\n 'An aggregation of tens of millions of articles made available through Library subscriptions.';\n protected readonly home = { text: 'Search articles', url: 'https://search.lib.virginia.edu/' };\n}\n","import { css, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { html, unsafeStatic } from 'lit/static-html.js';\nimport { property, state } from 'lit/decorators.js';\nimport { precedingHeadingLevel } from '../../base/heading-level.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport type { BentoSection } from './BentoSection.js';\nimport { bentoEndpoints, setBentoEndpoints, type BentoEndpoints } from './bento-data.js';\n\n/** The sections a `<bento-box>` can show, in the default order. */\nexport const BENTO_BOXES = ['catalog', 'articles', 'libguides', 'website'] as const;\nexport type BentoBoxName = (typeof BENTO_BOXES)[number];\n\nconst DEFAULT_LEVEL = 2;\n\n/**\n * `boxes` from an attribute: a comma (or space) separated list, or a JSON array. Unknown and\n * repeated names are dropped; nothing usable gives the default.\n */\nexport function parseBoxes(value: unknown): BentoBoxName[] {\n let list: unknown = value;\n if (typeof value === 'string') {\n const text = value.trim();\n try {\n list = text.startsWith('[') ? JSON.parse(text) : text.split(/[\\s,]+/);\n } catch {\n list = [];\n }\n }\n const known = new Set<string>(BENTO_BOXES);\n const out = [\n ...new Set(\n (Array.isArray(list) ? list : [])\n .map((b) => (typeof b === 'string' ? b.trim().toLowerCase() : ''))\n .filter((b) => known.has(b)),\n ),\n ] as BentoBoxName[];\n return out.length ? out : [...BENTO_BOXES];\n}\n\n/** The query in the page URL: `?q=` (preferred) or the old `?query=`; null when neither. */\nexport function urlQuery(search = location.search): string | null {\n const p = new URLSearchParams(search);\n return p.get('q') ?? p.get('query');\n}\n\n/**\n * Rules the box needs even with `no-style`: the host is a block, the status line is visually\n * hidden (it only speaks), and `[hidden]` hides.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} .bs-results-container > * { min-width: 0; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\nconst SEARCH_ICON = `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\")`;\n\nlet instances = 0;\n\n/**\n * The library's search results page (library.virginia.edu/search): a search bar and, for the\n * query, a grid of result sections from Virgo's catalog and articles, the subject guides and\n * the library website. The query comes from the page URL (`?q=`, or the old `?query=`), else\n * the `query` attribute; searching pushes `?q=` to the history, and Back and Forward restore\n * the query. With no query only the search bar shows and nothing is fetched. Light DOM output\n * keeps the classes the Drupal theme styles under `.uvalib-bento-search`.\n *\n * Registers `catalog-section`, `articles-section`, `libguides-section` and `website-section`.\n *\n * @tagname bento-box\n * @cssprop --uva-color-text - Dark-mode role token: text (else #2b2b2b).\n * @cssprop --uva-color-control-border - Dark-mode role token: the search input's border (else #808080).\n * @cssprop --uva-color-input-text - Dark-mode role token: the search input's text (else #1f2937).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: the search input's background (else #fff).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: the search button (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Dark-mode role token: the search button's icon (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class BentoBox extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n container-type: inline-size;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n line-height: 1.5;\n }\n .bento-search-bar {\n display: block;\n margin: 2rem 0;\n }\n .bento-search-bar form {\n display: flex;\n max-width: 40rem;\n margin: 0 auto;\n }\n .bento-search-bar input {\n flex: 1;\n min-width: 0;\n min-height: 3rem;\n box-sizing: border-box;\n padding: 0.5rem 1rem;\n font: inherit;\n font-size: max(1rem, 1em);\n color: var(--uva-color-input-text, #1f2937);\n background: var(--uva-color-surface-raised, #fff);\n border: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));\n border-inline-end: 0;\n border-radius: 0.3rem 0 0 0.3rem;\n }\n .bento-search-bar button {\n padding: 0 0.75rem;\n border: 1px solid var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n border-radius: 0 0.3rem 0.3rem 0;\n background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n color: var(--uva-color-on-accent, #fff);\n cursor: pointer;\n }\n .bento-search-bar button::before {\n content: '';\n display: block;\n width: 1.5rem;\n height: 1.5rem;\n background: currentColor;\n mask: ${unsafeCSS(SEARCH_ICON)} center / contain no-repeat;\n }\n .bento-search-bar p {\n margin: 1rem 0 0;\n text-align: center;\n }\n .bs-header > :is(h1, h2, h3, h4, h5, h6) {\n margin: 2rem 0 0;\n font-size: 1.5rem;\n font-weight: 500;\n line-height: 1.3;\n }\n .bs-search-term {\n font-style: italic;\n }\n .bs-header p {\n margin: 1rem 0;\n font-size: 1.25rem;\n }\n .bs-results-container {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 2rem;\n }\n @container (width < 48rem) {\n .bs-results-container {\n grid-template-columns: minmax(0, 1fr);\n }\n }\n `,\n ];\n\n /**\n * The URLs shared by every `<bento-box>` and section: `authorize`, `catalog`, `articles`,\n * `guides` and `website`. Assigning an object (or setting a key) changes them from the next\n * search on. To repoint before elements already in the HTML fetch, set\n * `window.uvalibBentoEndpoints` before the define script runs.\n */\n static get endpoints(): BentoEndpoints {\n return bentoEndpoints;\n }\n static set endpoints(value: Partial<BentoEndpoints>) {\n setBentoEndpoints(value);\n }\n\n /** The search text when the page URL has none (`?q=` or `?query=` win). */\n @property({ type: String })\n query = '';\n\n /** How many results each section shows (at most). */\n @property({ type: Number })\n limit = 5;\n\n /** The line under the search bar. */\n @property({ type: String, attribute: 'search-describe' })\n searchDescribe =\n 'This page searches Virgo, Virgo articles, subject guides, and the Library website.';\n\n /** What a section says when it finds nothing. */\n @property({ type: String, attribute: 'no-result-describe' })\n noResultDescribe = 'No results found.';\n\n /** The search input's placeholder. */\n @property({ type: String })\n placeholder = 'Search anything...';\n\n /**\n * The sections, in order: `catalog`, `articles`, `libguides`, `website`, as a comma list\n * (`boxes=\"catalog,articles\"`) or a JSON array. Default: all four.\n */\n @property({ converter: { fromAttribute: parseBoxes } })\n boxes: BentoBoxName[] = ['catalog', 'articles', 'libguides', 'website'];\n\n /**\n * The level of the \"You searched for\" heading, 1 to 6; the sections' headings are one\n * below. Unset (the default), it is one below the nearest heading before the element in the\n * page (the page's `<h1>` gives `<h2>`, then `<h3>` sections), or 2 when there is none.\n */\n @property({ type: Number, attribute: 'heading-level' })\n headingLevel?: number;\n\n @state() private inferredLevel = DEFAULT_LEVEL;\n /** The polite status line's text. */\n @state() private status = '';\n\n private readonly uid = `bento-box-${++instances}`;\n /** The `query` attribute's value when connected, restored when the URL has no query. */\n private fallbackQuery?: string;\n /** A search is waiting for its sections to settle, to say so once. */\n private announcePending = false;\n\n private readonly onPopState = () => {\n this.query = urlQuery() ?? this.fallbackQuery ?? '';\n };\n\n private readonly onSectionState = () => {\n const sections = this.sections();\n if (sections.some((s) => s.state === 'loading')) {\n this.announcePending = true;\n this.status = '';\n return;\n }\n if (!this.announcePending) return;\n this.announcePending = false;\n this.status = sections.some((s) => s.state === 'error')\n ? 'Results updated. Some results are unavailable.'\n : 'Results updated.';\n };\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n const above = precedingHeadingLevel(this);\n this.inferredLevel = above === null ? DEFAULT_LEVEL : Math.min(above + 1, 6);\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n const root = node instanceof ShadowRoot || node instanceof Document ? node : undefined;\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n { root, scope: false },\n );\n }\n // The URL wins over the attribute.\n this.fallbackQuery ??= this.query;\n const fromUrl = urlQuery();\n if (fromUrl !== null) this.query = fromUrl;\n window.addEventListener('popstate', this.onPopState);\n this.addEventListener('bento-state', this.onSectionState);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('popstate', this.onPopState);\n this.removeEventListener('bento-state', this.onSectionState);\n }\n\n private get level(): number {\n const n = Math.trunc(this.headingLevel ?? Number.NaN);\n return n >= 1 && n <= 6 ? n : this.inferredLevel;\n }\n\n private get q(): string {\n return (this.query ?? '').trim();\n }\n\n /** The section elements now rendered. */\n private sections(): BentoSection<unknown>[] {\n return [\n ...this.renderRoot.querySelectorAll<BentoSection<unknown>>(\n '.bs-results-container > .bs-results--block',\n ),\n ];\n }\n\n protected override willUpdate(changed: PropertyValues<this>) {\n if (changed.has('query')) {\n this.status = '';\n this.announcePending = !!this.q;\n }\n }\n\n private search(e: SubmitEvent) {\n e.preventDefault();\n const input = (e.currentTarget as HTMLFormElement).elements.namedItem('q') as HTMLInputElement;\n const q = input.value.trim();\n if (q === this.q) return;\n const url = new URL(location.href);\n url.searchParams.delete('query');\n if (q) url.searchParams.set('q', q);\n else url.searchParams.delete('q');\n history.pushState({ query: q }, '', url);\n this.query = q;\n }\n\n private renderSection(box: BentoBoxName, level: number) {\n const tag = unsafeStatic(`${box}-section`);\n return html`<${tag}\n class=\"bs-results--block\"\n ?no-shadow-dom=${this.lightDom}\n ?no-style=${this.noStyle}\n .query=${this.q}\n .limit=${this.limit}\n .noResultDescribe=${this.noResultDescribe}\n .headingLevel=${level}\n ></${tag}>`;\n }\n\n render() {\n const level = this.level;\n const h = unsafeStatic(`h${level}`);\n const q = this.q;\n const boxes = parseBoxes(this.boxes);\n const input = `${this.uid}-q`;\n const describe = `${this.uid}-describe`;\n return html`<bento-search class=\"bento-search-bar\">\n <search>\n <form action=\"https://search.lib.virginia.edu/search\" method=\"get\" @submit=${this.search}>\n <span class=\"icon-search\" aria-hidden=\"true\"></span>\n <label class=\"visually-hidden\" for=${input}>Search</label>\n <input\n id=${input}\n name=\"q\"\n type=\"search\"\n placeholder=${this.placeholder}\n .value=${q}\n aria-describedby=${describe}\n enterkeyhint=\"search\"\n autocapitalize=\"none\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n />\n <button type=\"submit\" class=\"uvalib-button-home-search\">\n <span class=\"visually-hidden\">Search</span>\n </button>\n </form>\n </search>\n <p id=${describe}>${this.searchDescribe}</p>\n </bento-search>\n ${\n q\n ? html`<div class=\"bs-header\">\n <${h}>You searched for <span class=\"bs-search-term\">${q}</span></${h}>\n <p>Here are the results:</p>\n </div>\n <div class=\"bs-results-container\">\n ${boxes.map((b) => this.renderSection(b, Math.min(level + 1, 6)))}\n </div>`\n : nothing\n }\n <div class=\"visually-hidden\" role=\"status\">${this.status}</div>`;\n }\n}\n","import { VirgoSection } from './VirgoSection.js';\n\n/**\n * The Virgo catalog's first results for `query` (books, journals, archives, maps, music,\n * theses, videos…). A work with several editions shows once, noting how many.\n *\n * @tagname catalog-section\n */\nexport class CatalogSection extends VirgoSection {\n protected readonly pool = 'catalog';\n readonly analyticsName = 'Virgo catalog';\n protected readonly heading = 'Virgo Catalog';\n protected readonly sourceName = 'Virgo catalog';\n protected readonly describe =\n 'Books, journals, manuscripts & archival material, maps, music and sound recordings, theses and dissertations, and videos.';\n protected readonly home = { text: 'Search Virgo', url: 'https://search.lib.virginia.edu/' };\n}\n","import { html, nothing } from 'lit';\nimport { BentoSection, renderRuns, type SectionResults } from './BentoSection.js';\nimport { guidesSearchUrl, searchGuides, type GuideItem } from './bento-data.js';\n\n/**\n * The first subject guide pages (LibGuides) matching `query`: the page and its guide, then\n * its author and subjects and the matching text. Only text and links are taken from\n * Springshare's HTML.\n *\n * @tagname libguides-section\n */\nexport class LibGuidesSection extends BentoSection<GuideItem> {\n readonly analyticsName = 'Subject guides';\n protected readonly heading = 'Subject Guides';\n protected readonly sourceName = 'subject guide';\n protected override get seeAllIn(): string {\n return 'subject guides';\n }\n protected readonly describe =\n 'Subject guides contain topic-specific information to help with research and coursework.';\n protected readonly home = {\n text: 'Search Guides',\n url: 'https://guides.lib.virginia.edu/srch.php',\n };\n\n protected fetchResults(\n query: string,\n limit: number,\n signal: AbortSignal,\n ): Promise<SectionResults<GuideItem>> {\n return searchGuides(query, limit, signal);\n }\n\n protected seeAllUrl(query: string): string {\n return guidesSearchUrl(query);\n }\n\n protected renderItem(g: GuideItem) {\n const by = g.author\n ? html`<span class=\"bs-results--guide-author\"\n >by <a href=${g.author.url}>${g.author.text}</a></span\n >`\n : nothing;\n const subjects = g.subjects.length\n ? html`<span class=\"bs-results--subjects\"\n >Subjects:\n ${g.subjects.map((s, i) => html`${i ? ', ' : ''}<a href=${s.url}>${s.text}</a>`)}</span\n >`\n : nothing;\n return this.entry(\n html`<span class=\"bs-results--title\"\n ><a href=${g.url}>${g.title}</a>${\n g.guide\n ? html` <span class=\"bs-results--guide\"\n >on <a href=${g.guide.url}>${g.guide.text}</a></span\n >`\n : nothing\n }</span\n >\n <ul class=\"ul-0\">\n <li class=\"bs-results--teaser li-1\">\n <div class=\"bs-results--byline\">\n ${by}${g.author && g.subjects.length ? html` <span aria-hidden=\"true\">|</span> ` : nothing}${subjects}\n </div>\n <div class=\"bs-results--highlights\">${renderRuns(g.highlights)}</div>\n </li>\n </ul>`,\n );\n }\n\n protected renderPlaceholderBody() {\n return html`<span class=\"bs-results--title\"\n ><a>Library subject guide</a>\n <span class=\"bs-results--guide\">on <a>Research</a></span></span\n >\n <ul class=\"ul-0\">\n <li class=\"bs-results--teaser li-1\">\n <div class=\"bs-results--byline\">by <a>Librarian</a></div>\n <div class=\"bs-results--highlights\">Research help</div>\n </li>\n </ul>`;\n }\n}\n","import { html } from 'lit';\nimport { BentoSection, renderRuns, type SectionResults } from './BentoSection.js';\nimport { searchWebsite, websiteSearchUrl, type WebsiteItem } from './bento-data.js';\n\n/**\n * The library website's first pages (pages, people, libraries, news) matching `query`, from\n * Drupal's search index, with its excerpt (the matched words marked). The index sends no\n * CORS headers, so this section works on library.virginia.edu (or wherever\n * `BentoBox.endpoints.website` points to a same-origin copy) only.\n *\n * @tagname website-section\n */\nexport class WebsiteSection extends BentoSection<WebsiteItem> {\n readonly analyticsName = 'Library website';\n protected readonly heading = 'Website';\n protected readonly sourceName = 'Library website';\n protected readonly describe = 'Results from the main Library website.';\n protected readonly home = {\n text: 'Search Library website',\n url: 'https://library.virginia.edu/search/content',\n };\n protected override entryClass = '';\n\n protected fetchResults(\n query: string,\n limit: number,\n signal: AbortSignal,\n ): Promise<SectionResults<WebsiteItem>> {\n return searchWebsite(query, limit, signal);\n }\n\n protected seeAllUrl(query: string): string {\n return websiteSearchUrl(query);\n }\n\n protected renderItem(w: WebsiteItem) {\n return this.entry(\n html`<div class=\"bento-section-title\"><a href=${w.url}>${w.title}</a></div>\n <div class=\"bento-section-desc\">${renderRuns(w.excerpt)}</div>`,\n );\n }\n\n protected renderPlaceholderBody() {\n return html`<div class=\"bento-section-title\"><a>Library page</a></div>\n <div class=\"bento-section-desc\">Library website page</div>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { ArticlesSection } from './ArticlesSection.js';\nimport { BentoBox } from './BentoBox.js';\nimport { CatalogSection } from './CatalogSection.js';\nimport { LibGuidesSection } from './LibGuidesSection.js';\nimport { WebsiteSection } from './WebsiteSection.js';\n\n// The sections first, so the box's first render upgrades them at once.\ndefine('catalog-section', CatalogSection);\ndefine('articles-section', ArticlesSection);\ndefine('libguides-section', LibGuidesSection);\ndefine('website-section', WebsiteSection);\ndefine('bento-box', BentoBox);\n"],"mappings":";;;;;;;AAwBA,IAAMiC,KAAgB,GAChBjC,IAAgB,GAChBmC,KAAY,IAUZlC,KAAmB,MAAiB;IACtCoC,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;;;;;;;IAOLA,EAAK;;;;;;;;;IASLA,EAAK;IACLA,EAAK;IACLA,EAAK;;;;IAILA,EAAK;;;;IAILA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;;;;;;IAMLA,EAAK;IACLA,EAAK,YAAYA,EAAK;IACtBA,EAAK;;;;;;;;;;;GAYHnC,IAAkBC,EAAUF,EAAgB,OAAO,CAAC,GAG7CsC,KAAc,MACzBC,EAAK,KAAK,MAAOlB,EAAE,OAAO,CAAI,SAASA,EAAE,KAAK,WAAWA,EAAE,IAAK,GAiB5CmB,IAAtB,cAA8CjB,EAAc;;EAC1C,KAAA,SAAA;GACdM;GACA5B;GACA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AS5B,A,aARP,KAAA,gBAAA,mBACI,KAAA,UAAA,WACG,KAAA,aAAA,mBACF,KAAA,WAAA,0CACJ,KAAA,OAAA;GACxB,MAAM;GACN,KAAK;EACP,GACgC,KAAA,aAAA;;CAEhC,aACE,GACA,GACA,GACsC;EACtC,OAAOqI,GAAc1H,GAAOqE,GAAOxC,CAAM;CAC3C;CAEA,UAAoB,GAAuB;EACzC,OAAO8F,GAAiB3H,CAAK;CAC/B;CAEA,WAAqB,GAAgB;EACnC,OAAO,KAAK,MACV,CAAI,4CAA4C4J,EAAE,IAAI,GAAGA,EAAE,MAAM;0CAC7BzK,EAAWyK,EAAE,OAAO,EAAE,OAC5D;CACF;CAEA,wBAAkC;EAChC,OAAO,CAAI;;CAEb;AACF;ACtCA5L,EAAO,mBAAmBuL,EAAc,GACxCvL,EAAO,oBAAoBgK,EAAe,GAC1ChK,EAAO,qBAAqBwL,EAAgB,GAC5CxL,EAAO,mBAAmB2L,EAAc,GACxC3L,EAAO,aAAa6K,CAAQ"}
|
|
1
|
+
{"version":3,"file":"bento-box.js","names":["DEFAULT_LEVEL","structuralRules","shadowStructure","unsafeCSS","nothing","unsafeStatic","_decorate","property","state","unsafeCSS","unsafeStatic","nothing","_decorate","property","state","nothing","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","s","trackEvent","trackError","trackSearch","precedingHeadingLevel","accessible","fetchText","fetchJson","DEFAULT_LIMIT","DEFAULT_LEVEL$1","MAX_LIMIT","structuralRules$1","host","shadowStructure$1","renderRuns","runs","BentoSection","root","sheet","path","list","node","li","position","above","changed","id","query","controller","results","hadFocus","active","url","params","total","name","value","A","body","h","loading","items","placeholders","message","found","bentoEndpoints","bentoTiming","KEYS","setBentoEndpoints","key","from","globalApplied","endpoints","retryStatus","cache","shared","signal","entry","e","run","left","leave","abort","reject","resolve","v","err","token","tokenValue","guestToken","p","dropToken","stale","ITEM_BASE","SIGN_IN","SIGN_IN_TITLE","MAX_AUTHORS","str","parseVirgo","j","json","groups","g","record","fields","all","test","f","first","raw","signIn","pool","authors","count","virgoKeyword","virgoBody","limit","searchVirgo","attempt","t","sig","options","virgoSearchUrl","MONTHS","formatPublished","m","year","month","day","d","date","SAFE","safeUrl","u","base","GUIDES_BASE","linkOf","a","text","textRuns","add","last","mark","walk","el","markTag","c","inert","html","parseGuides","data","titleBox","titleLink","meta","highlights","l","guidesSearchUrl","withParams","searchGuides","TYPES","WEBSITE_BASE","websiteParams","parseWebsite","nodes","title","alias","nid","excerpt","job","searchWebsite","websiteSearchUrl","VirgoSection","cls","editions","formats","ArticlesSection","_args","BENTO_BOXES","DEFAULT_LEVEL","parseBoxes","known","out","urlQuery","search","structuralRules","shadowStructure","SEARCH_ICON","instances","BentoBox","sections","fromUrl","q","tag","box","level","boxes","input","describe","CatalogSection","LibGuidesSection","by","subjects","WebsiteSection","w"],"sources":["../src/components/bento-box/BentoSection.ts","../src/components/bento-box/bento-data.ts","../src/components/bento-box/VirgoSection.ts","../src/components/bento-box/ArticlesSection.ts","../src/components/bento-box/BentoBox.ts","../src/components/bento-box/CatalogSection.ts","../src/components/bento-box/LibGuidesSection.ts","../src/components/bento-box/WebsiteSection.ts","../src/components/bento-box/bento-box.ts"],"sourcesContent":["import { css, nothing, unsafeCSS, type CSSResult, type PropertyValues } from 'lit';\nimport { html, unsafeStatic, type StaticValue } from 'lit/static-html.js';\nimport { property, state } from 'lit/decorators.js';\nimport { trackError, trackEvent, trackSearch } from '../../base/analytics.js';\nimport { precedingHeadingLevel } from '../../base/heading-level.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport type { TextRun } from './bento-data.js';\n\n/**\n * `loading` until the first answer, then `ready` (results shown), `empty` (none found, or no\n * query) or `error` (they could not be loaded).\n */\nexport type BentoState = 'loading' | 'ready' | 'empty' | 'error';\n\n/** What a section's source answers. */\nexport interface SectionResults<T> {\n items: T[];\n total?: number;\n /** The source's own \"see all\" URL, when it sends one. */\n seeAll?: string;\n}\n\nconst DEFAULT_LIMIT = 5;\nconst DEFAULT_LEVEL = 3;\nconst MAX_LIMIT = 50;\n\n/**\n * Rules every section needs even with `no-style`, where the Drupal theme styles it: the host\n * is a block, placeholder entries are invisible, the message sits over the list's first entry\n * (both in one grid cell, so it never moves anything), titles and teasers clamp to a fixed\n * number of lines (the whole text stays in the DOM) while a hidden reserve list of placeholders\n * in the same cell keeps the loading height, and `[hidden]` hides. `host` is `:host`\n * (shadow) or the tag name (light DOM, so they stay scoped).\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} .bs-results--placeholder { visibility: hidden; }\n ${host} .bs-results--stack { display: grid; }\n ${host} .bs-results--stack > * { grid-area: 1 / 1; min-width: 0; }\n ${host} .bs-results--message { align-self: start; z-index: 1; }\n ${host} .bs-results--see-all { display: inline; }\n ${host} .bs-results--guide { font-weight: normal; }\n ${host} .bs-results--title,\n ${host} .bento-section-title,\n ${host} .bs-results--highlights {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n line-clamp: 2;\n overflow: hidden;\n }\n ${host} .bento-section-desc {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n line-clamp: 3;\n overflow: hidden;\n }\n /* Placeholders take every clamped block's full height. Results don't (a one-line title sits\n right above its author); the reserve list behind them holds the placeholders' height. */\n ${host} .bs-results--placeholder .bs-results--title,\n ${host} .bs-results--placeholder .bento-section-title,\n ${host} .bs-results--placeholder .bs-results--highlights {\n min-height: 3em;\n min-height: 2lh;\n }\n ${host} .bs-results--placeholder .bento-section-desc {\n min-height: 4.5em;\n min-height: 3lh;\n }\n ${host} .bs-results--reserve { visibility: hidden; pointer-events: none; }\n ${host} .bs-results--author,\n ${host} .bs-results--date,\n ${host} .bs-results--format,\n ${host} .bs-results--byline {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n /* A guide with no author or subjects keeps its placeholder's line. */\n ${host} .bs-results--byline { min-height: 1.5em; min-height: 1lh; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/** Render text runs, the matched words in `<mark>` (all as text, never as HTML). */\nexport const renderRuns = (runs: readonly TextRun[]) =>\n runs.map((r) => (r.mark ? html`<mark>${r.text}</mark>` : r.text));\n\n/**\n * The shared behaviour of the four `<bento-box>` sections: a header (heading and \"see all\"),\n * a description, and an `ol.bs-results--list` of results, with loading, empty and error\n * states, in the DOM and classes the Drupal theme styles. Not registered itself.\n *\n * @fires bento-state - Whenever `state` changes (bubbles, composed); `<bento-box>` listens to announce \"Results updated\" once every section has settled.\n * @fires uvalib-analytics-search - For `<site-analytics>`: once per settled search (results or none, not an error): the query, the section's `analyticsName` as category and its total when known. Bubbles and is composed.\n * @fires uvalib-analytics-event - For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; `['bento-box', 'retry', <section>]` for its Retry button; `['bento-box', 'error', 'section-load: <section>']` once when its results cannot be loaded; never titles or URLs. Bubbles and is composed.\n * @cssprop --uva-color-text - Dark-mode role token: text (else #2b2b2b).\n * @cssprop --uva-color-link - Dark-mode role token: titles, links and buttons (else `--uva-brand-blue`).\n * @cssprop --uva-color-border - Dark-mode role token: the block's border and entry rules (else #dadada).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: background (else #fff).\n * @cssprop --uva-color-surface-hover - Dark-mode role token: the header band (else #dadada).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport abstract class BentoSection<T> extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n background: var(--uva-color-surface-raised, #fff);\n border: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));\n border-top: none;\n line-height: 1.5;\n min-width: 0;\n }\n a {\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n /* One line whatever the count's length, so the header keeps its height. */\n .bs-results--header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 0.5rem 1rem;\n padding: 0.5rem 1rem;\n background: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));\n }\n .bs-results--header > :is(h1, h2, h3, h4, h5, h6) {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin: 0;\n font-size: 1.0625rem;\n line-height: 1.5;\n text-transform: uppercase;\n }\n .bs-results--body {\n padding: 1rem;\n }\n .bs-results--body > p {\n margin: 0 0 1rem;\n }\n .bs-results--list {\n margin: 0 0 1rem;\n padding-inline-start: 1.5rem;\n }\n .bs-results--list--entry,\n .bs-results--list > li {\n border-bottom: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));\n margin-bottom: 1rem;\n padding-bottom: 1rem;\n }\n .bs-results--list > li:last-child {\n border-bottom: none;\n margin-bottom: 0;\n }\n .bs-results--title,\n .bento-section-title {\n font-weight: 700;\n }\n .ul-0,\n .ul-1 {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n .ul-1 {\n display: flex;\n justify-content: space-between;\n gap: 1rem;\n }\n .ul-1 > li {\n min-width: 0;\n }\n .bs-results--teaser {\n padding: 0.5rem 0;\n }\n .bs-results--message {\n margin: 0;\n }\n .uvalib-button {\n display: inline-block;\n white-space: nowrap;\n font: inherit;\n line-height: 1.5;\n padding: 0.1rem 0.75rem;\n border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n text-decoration: none;\n cursor: pointer;\n }\n .bs-results--message .uvalib-button {\n margin-inline-start: 0.5rem;\n }\n .uvalib-button[aria-disabled='true'] {\n cursor: progress;\n }\n `,\n ];\n\n /** The search text. Empty: nothing is fetched and the section is `empty`. */\n @property({ type: String })\n query = '';\n\n /** How many results to show (at most). */\n @property({ type: Number })\n limit = 5;\n\n /** The message shown when nothing is found. */\n @property({ type: String, attribute: 'no-result-describe' })\n noResultDescribe = 'No results found.';\n\n /**\n * The level of the section's heading, 1 to 6. Unset (the default), it is one below the\n * nearest heading before the element in the page, or 3 when there is none. `<bento-box>`\n * sets it one below its own heading.\n */\n @property({ type: Number, attribute: 'heading-level' })\n headingLevel?: number;\n\n /** The section's heading (\"Virgo Catalog\"). */\n protected abstract readonly heading: string;\n /** What the source holds, shown under the header. */\n protected abstract readonly describe: string;\n /** The source's name inside a sentence (\"Virgo catalog\"), for \"See all\" and errors. */\n protected abstract readonly sourceName: string;\n /**\n * The section's name in analytics (\"Virgo catalog\"): the site-search category and the\n * click events' name.\n */\n abstract readonly analyticsName: string;\n /** Where \"See all … results in ___\" searches; the source name unless a section says otherwise. */\n protected get seeAllIn(): string {\n return this.sourceName;\n }\n /** The link shown instead of \"See all\" when nothing was found: its text and URL. */\n protected abstract readonly home: { text: string; url: string };\n\n /** Fetch the results for `query`. */\n protected abstract fetchResults(\n query: string,\n limit: number,\n signal: AbortSignal,\n ): Promise<SectionResults<T>>;\n /** The source's own search for `query`. */\n protected abstract seeAllUrl(query: string): string;\n /** One result: an `li` of the list. */\n protected abstract renderItem(item: T): unknown;\n /** An entry with the real classes and typical text, for placeholders. */\n protected abstract renderPlaceholderBody(): unknown;\n /** The class of each result's `li` (the website's carry none, as before). */\n protected entryClass = 'bs-results--list--entry';\n\n /** `loading` (the default, until the first answer), `ready`, `empty` or `error`. Read-only. */\n get state(): BentoState {\n return this._state;\n }\n\n @state() private _state: BentoState = 'loading';\n @state() private results?: SectionResults<T>;\n /** A Retry click's load is running: the button stays, disabled, so focus stays on it. */\n @state() private retrying = false;\n @state() private inferredLevel = DEFAULT_LEVEL;\n\n private loadId = 0;\n private controller?: AbortController;\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n constructor() {\n super();\n this.addEventListener('click', this.onClick);\n }\n\n /**\n * One delegated listener reports clicks on results (`result-click`, with the result's\n * 1-based position) and on \"See all\" (`see-all-click`), never the titles or URLs.\n */\n private readonly onClick = (e: Event) => {\n const path = e.composedPath();\n const list = this.renderRoot.querySelector('.bs-results--list');\n for (const node of path) {\n if (node === this) return;\n if (!(node instanceof Element)) continue;\n if (node.matches('.bs-results--message button:not([aria-disabled])')) {\n trackEvent(this, ['bento-box', 'retry', this.analyticsName]);\n return;\n }\n if (node.matches('.bs-results--see-all button')) {\n trackEvent(this, ['bento-box', 'see-all-click', this.analyticsName]);\n return;\n }\n if (node.matches('a[href]')) {\n const li = path.find((n) => n instanceof HTMLLIElement && n.parentNode === list) as\n HTMLLIElement | undefined;\n if (!li || li.classList.contains('bs-results--placeholder')) return;\n const position = [...list!.children].indexOf(li) + 1;\n trackEvent(this, ['bento-box', 'result-click', this.analyticsName, position]);\n return;\n }\n }\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n const above = precedingHeadingLevel(this);\n this.inferredLevel = above === null ? DEFAULT_LEVEL : Math.min(above + 1, 6);\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n const root = node instanceof ShadowRoot || node instanceof Document ? node : undefined;\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)) as CSSResult,\n { root, scope: false },\n );\n }\n // Reconnected after a disconnect (which aborts the load): catch up.\n if (this.hasUpdated && this._state === 'loading') void this.load();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.controller) {\n // Abandon the load: its abort must not land as an error, and reconnecting reloads.\n this.loadId++;\n this.controller.abort();\n this.controller = undefined;\n this._state = 'loading';\n }\n }\n\n protected get count(): number {\n const n = Math.trunc(this.limit);\n return Number.isFinite(n) && n > 0 ? Math.min(n, MAX_LIMIT) : DEFAULT_LIMIT;\n }\n\n private get level(): number {\n const n = Math.trunc(this.headingLevel ?? Number.NaN);\n return n >= 1 && n <= 6 ? n : this.inferredLevel;\n }\n\n private get q(): string {\n return (this.query ?? '').trim();\n }\n\n protected override willUpdate(changed: PropertyValues<this>) {\n if (!this.isConnected) return;\n if (!this.hasUpdated || changed.has('query') || changed.has('limit')) void this.load();\n }\n\n protected override updated(changed: PropertyValues<this>) {\n if ((changed as Map<PropertyKey, unknown>).has('_state'))\n this.dispatchEvent(new Event('bento-state', { bubbles: true, composed: true }));\n }\n /** The query last reported as a site search, so a reload for it is not counted again. */\n private reportedQuery?: string;\n\n /**\n * Load the results. An older load still running is aborted, and its answer, should it land\n * anyway, is ignored: the newest query always wins.\n */\n private async load() {\n const id = ++this.loadId;\n this.controller?.abort();\n const query = this.q;\n if (!query) {\n this.controller = undefined;\n this.results = undefined;\n this._state = 'empty';\n this.reportedQuery = undefined;\n return;\n }\n const controller = (this.controller = new AbortController());\n this._state = 'loading';\n this.results = undefined;\n try {\n const results = await this.fetchResults(query, this.count, controller.signal);\n if (id !== this.loadId) return; // a newer load owns the element\n this.results = { ...results, items: results.items.slice(0, this.count) };\n this._state = this.results.items.length ? 'ready' : 'empty';\n // One site search per query shown (never on error): a new query, a Back or Forward to\n // another, or a retry that succeeds; a reload for the same query (a `limit` change, a\n // reconnect) is not a new search. Nothing found counts 0 even without a total.\n if (query !== this.reportedQuery) {\n this.reportedQuery = query;\n trackSearch(\n this,\n query,\n this.analyticsName,\n results.total ?? (this._state === 'empty' ? 0 : undefined),\n );\n }\n } catch {\n if (id !== this.loadId) return;\n this.results = undefined;\n this._state = 'error';\n this.reportedQuery = undefined;\n trackError(this, 'bento-box', `section-load: ${this.analyticsName}`);\n } finally {\n if (this.controller === controller) this.controller = undefined;\n }\n }\n\n /** Load again (after an error), keeping keyboard focus in the section. */\n async retry(): Promise<void> {\n if (this.retrying) return;\n const hadFocus = this.focusedInside();\n this.retrying = true;\n try {\n await this.load();\n } finally {\n this.retrying = false;\n }\n await this.updateComplete;\n if (!hadFocus) return;\n const r = this.renderRoot;\n if (this._state === 'ready')\n r.querySelector<HTMLAnchorElement>('.bs-results--list a[href]')?.focus();\n else if (this._state === 'error')\n r.querySelector<HTMLButtonElement>('.bs-results--message button')?.focus();\n else r.querySelector<HTMLElement>('.bs-results--message')?.focus();\n }\n\n private focusedInside(): boolean {\n const active =\n this.renderRoot instanceof ShadowRoot\n ? this.renderRoot.activeElement\n : document.activeElement;\n return !!active && (this.renderRoot as Node).contains(active) && active !== this;\n }\n\n /** \"See all 138,420 results\", naming the source for assistive technology. */\n private renderSeeAll() {\n const url = new URL(this.results?.seeAll ?? this.seeAllUrl(this.q));\n const params = [...url.searchParams];\n url.search = '';\n const total = this._state === 'ready' ? this.results?.total : undefined;\n return html`<form class=\"bs-results--see-all\" action=${url.href} method=\"get\">\n ${params.map(([name, value]) => html`<input type=\"hidden\" name=${name} .value=${value} />`)}\n <button type=\"submit\" class=\"uvalib-button\">\n See all\n ${\n total === undefined\n ? nothing\n : html`<span class=\"bs-results--qty\">${total.toLocaleString('en-US')}</span>`\n }\n results<span class=\"visually-hidden\"> in ${this.seeAllIn}</span>\n </button>\n </form>`;\n }\n\n private renderMessage() {\n if (this.retrying || this._state === 'error')\n return html`${this.sourceName[0]!.toUpperCase()}${this.sourceName.slice(1)} results are\n unavailable right now.\n <button\n type=\"button\"\n class=\"uvalib-button\"\n aria-disabled=${this.retrying ? 'true' : nothing}\n @click=${this.retry}\n >\n ${this.retrying ? 'Retrying…' : 'Retry'}<span class=\"visually-hidden\">\n ${this.sourceName}</span\n >\n </button>`;\n if (this._state === 'empty') return this.noResultDescribe;\n return nothing;\n }\n\n private renderPlaceholder() {\n return html`<li class=\"${this.entryClass} bs-results--placeholder\" aria-hidden=\"true\">\n ${this.renderPlaceholderBody()}\n </li>`;\n }\n\n /** The `li` for one result, with the entry class. */\n protected entry(body: unknown) {\n return html`<li class=${this.entryClass || nothing}>${body}</li>`;\n }\n\n render() {\n const h: StaticValue = unsafeStatic(`h${this.level}`);\n const loading = this._state === 'loading';\n const items = this._state === 'ready' ? (this.results?.items ?? []) : [];\n // Before the answer: the limit's worth of placeholders, so the section has its final\n // height. Empty, failed or retrying: one entry's height, under the message.\n const placeholders = items.length ? 0 : loading && !this.retrying ? this.count : 1;\n const message = this.renderMessage();\n const found = loading || this._state === 'ready';\n return html`<div class=\"bs-results--header\">\n <${h}>${this.heading}</${h}>\n ${\n found && this.q\n ? this.renderSeeAll()\n : html`<div><a href=${this.home.url} class=\"uvalib-button\">${this.home.text}</a></div>`\n }\n </div>\n <div class=\"bs-results--body\">\n <p>${this.describe}</p>\n <div class=\"bs-results--stack\">\n <ol class=\"bs-results--list\" aria-busy=${loading ? 'true' : 'false'}>\n ${items.map((i) => this.renderItem(i))}\n ${Array.from({ length: placeholders }, () => this.renderPlaceholder())}\n </ol>\n ${\n // Behind the results, as many placeholders as results: the cell keeps the height\n // the placeholders had while loading, so short titles never move what follows.\n items.length\n ? html`<ol class=\"bs-results--list bs-results--reserve\" aria-hidden=\"true\">\n ${items.map(() => this.renderPlaceholder())}\n </ol>`\n : nothing\n }\n ${\n message === nothing\n ? nothing\n : html`<p class=\"bs-results--message\" tabindex=\"-1\">${message}</p>`\n }\n </div>\n </div>`;\n }\n}\n","// Data for <bento-box> and its four sections: the Virgo catalog and articles pools, the\n// LibGuides search proxy and the library website's Drupal search index. Internal: not\n// exported from the package entry (only the types are). No side effects on import.\n//\n// Everything read from these services is reduced to plain text and http(s) URLs here; the\n// sections render it with Lit, never as HTML.\n\nimport { fetchJson, fetchText, type FetchOptions, type HttpError } from '../../data/fetch-json.js';\n\n/** The URLs the sections fetch, shared by every element on the page. */\nexport interface BentoEndpoints {\n /** Virgo's guest token: POST, answers a JWT as text. */\n authorize: string;\n /** The Virgo catalog pool's search (POST, Bearer token). */\n catalog: string;\n /** The Virgo articles pool's search (POST, Bearer token). */\n articles: string;\n /** The LibGuides search proxy (GET, `?q=`). */\n guides: string;\n /** The library website's Drupal search index (GET, JSON:API). Same origin only: no CORS. */\n website: string;\n}\n\n/**\n * Where the results come from (exposed to pages as `BentoBox.endpoints`). A page can also set\n * `window.uvalibBentoEndpoints` (any of the keys) before the script runs; it is merged in at\n * the first fetch. Requests are cached, so a change applies to the next search.\n *\n * The guides proxy is the us-east-1 one: the us-east-2 proxy ignores `q` and answers cached\n * results. The website index is relative, as Drupal serves it on its own origin only.\n */\nexport const bentoEndpoints: BentoEndpoints = {\n authorize: 'https://search.lib.virginia.edu/authorize',\n catalog: 'https://pool-solr-ws-uva-library.internal.lib.virginia.edu/api/search',\n articles: 'https://pool-eds-ws.internal.lib.virginia.edu/api/search',\n guides:\n 'https://qmo3jwybkg.execute-api.us-east-1.amazonaws.com/production/library/libguides-proxy',\n website: '/jsonapi/index/default_index',\n};\n\n/** Fetch attempts, the delay between them (ms) and each attempt's timeout (ms). */\nexport const bentoTiming = { retries: 2, retryDelay: 1000, timeout: 10_000 };\n\ndeclare global {\n interface Window {\n /** Optional endpoint overrides for <bento-box>, read at its first fetch. */\n uvalibBentoEndpoints?: Partial<BentoEndpoints>;\n }\n}\n\nconst KEYS = ['authorize', 'catalog', 'articles', 'guides', 'website'] as const;\n\n/** Copy the known endpoint keys (non-empty strings only) from `from` into the shared endpoints. */\nexport function setBentoEndpoints(from: Partial<BentoEndpoints> | null | undefined): void {\n for (const key of KEYS) {\n const value = from?.[key];\n if (typeof value === 'string' && value) bentoEndpoints[key] = value;\n }\n}\n\nlet globalApplied = false;\nfunction endpoints(): BentoEndpoints {\n if (!globalApplied) {\n globalApplied = true;\n setBentoEndpoints(globalThis.window?.uvalibBentoEndpoints);\n }\n return bentoEndpoints;\n}\n\n/** Only server errors, timeouts and rate limits are worth trying again. */\nconst retryStatus = (s: number) => s >= 500 || s === 408 || s === 429;\n\n// --- shared, abortable requests ----------------------------------------------------------\n\ninterface Shared {\n promise: Promise<unknown>;\n controller: AbortController;\n /** Callers still waiting for it. */\n waiting: number;\n settled: boolean;\n}\nconst cache = new Map<string, Shared>();\n\n/**\n * `run` once per `key`: identical requests share one fetch and its answer stays cached; a\n * failure is not cached. A caller's `signal` only stops that caller waiting; the fetch itself\n * is aborted (and forgotten) once every caller still waiting has aborted.\n */\nfunction shared<T>(\n key: string,\n run: (signal: AbortSignal) => Promise<T>,\n signal?: AbortSignal,\n): Promise<T> {\n if (signal?.aborted) return Promise.reject(signal.reason);\n let entry = cache.get(key);\n if (!entry) {\n const controller = new AbortController();\n const e: Shared = { controller, waiting: 0, settled: false, promise: run(controller.signal) };\n e.promise.then(\n () => (e.settled = true),\n () => {\n e.settled = true;\n if (cache.get(key) === e) cache.delete(key);\n },\n );\n cache.set(key, (entry = e));\n }\n const e = entry;\n if (!signal) return e.promise as Promise<T>;\n e.waiting++;\n return new Promise<T>((resolve, reject) => {\n let left = false;\n const leave = () => {\n if (left) return;\n left = true;\n signal.removeEventListener('abort', abort);\n e.waiting--;\n };\n const abort = () => {\n leave();\n if (!e.settled && e.waiting === 0) {\n e.controller.abort(signal.reason);\n if (cache.get(key) === e) cache.delete(key);\n }\n reject(signal.reason);\n };\n signal.addEventListener('abort', abort, { once: true });\n (e.promise as Promise<T>).then(\n (v) => {\n leave();\n resolve(v);\n },\n (err) => {\n leave();\n reject(err);\n },\n );\n });\n}\n\n// --- the Virgo guest token -----------------------------------------------------------------\n\nlet token: Promise<string> | undefined;\n/** The token `token` resolved to, once it has. */\nlet tokenValue: string | undefined;\n\n/**\n * Virgo's guest token, fetched once per page and shared by every section; a failure is not\n * kept, so the next search asks again.\n */\nexport function guestToken(): Promise<string> {\n if (!token) {\n tokenValue = undefined;\n const p = fetchText(endpoints().authorize, bentoTiming, { method: 'POST', retryStatus }).then(\n (t) => {\n const value = t.trim();\n if (!value) throw new Error('empty Virgo guest token');\n if (token === p) tokenValue = value;\n return value;\n },\n );\n token = p;\n p.catch(() => {\n if (token === p) token = undefined;\n });\n }\n return token;\n}\n\n/** Forget `stale` (a token a pool refused) so the next guestToken() fetches a new one. */\nfunction dropToken(stale: string) {\n if (tokenValue === stale) token = tokenValue = undefined;\n}\n\n// --- Virgo: catalog and articles ----------------------------------------------------------\n\n/** One Virgo result, reduced to what a section shows. */\nexport interface VirgoItem {\n title: string;\n /** The item's Virgo page. */\n url: string;\n /** At most five, then \"and N more\". */\n authors: string[];\n /** As Virgo sends it: `YYYY`, `YYYY-MM` or `YYYY-MM-DD` (see `formatPublished`). */\n published?: string;\n /** The catalog's formats, or the articles' publication types. */\n formats: string[];\n /** How many records (editions) the result groups; 1 for most. */\n editions: number;\n /** An articles record shown to guests without its details (Virgo's sign-in placeholder). */\n signIn: boolean;\n}\n\nexport interface Results<T> {\n items: T[];\n /** The total number of results, when the source says. */\n total?: number;\n}\n\nexport type VirgoPool = 'catalog' | 'articles';\n\nconst ITEM_BASE: Record<VirgoPool, string> = {\n catalog: 'https://search.lib.virginia.edu/sources/uva_library/items/',\n articles: 'https://search.lib.virginia.edu/sources/articles/items/',\n};\n\n/** The title Virgo gives guests for an article it hides. */\nconst SIGN_IN = /^please sign in to see more/i;\n/** The neutral title shown instead. */\nexport const SIGN_IN_TITLE = 'Article details available after signing in to Virgo';\n\nconst MAX_AUTHORS = 5;\n\ninterface Field {\n name?: unknown;\n type?: unknown;\n value?: unknown;\n}\n\nconst str = (v: unknown) => (typeof v === 'string' ? v.replace(/\\s+/g, ' ').trim() : '');\n\n/**\n * Virgo's `{ pagination, group_list }` reduced to VirgoItem: the first record of each group\n * (a multi-edition work shows once, with its edition count). Records without a title or an\n * identifier are skipped.\n */\nexport function parseVirgo(json: unknown, pool: VirgoPool): Results<VirgoItem> {\n const j = json as { pagination?: { total?: unknown }; group_list?: unknown } | null;\n const groups = Array.isArray(j?.group_list) ? (j.group_list as Record<string, unknown>[]) : [];\n const items: VirgoItem[] = [];\n for (const g of groups) {\n const record = (Array.isArray(g?.record_list) ? g.record_list[0] : undefined) as\n { fields?: unknown } | undefined;\n const fields = (Array.isArray(record?.fields) ? record.fields : []) as Field[];\n const all = (test: (f: Field) => boolean) => fields.filter(test).map((f) => str(f.value));\n const first = (test: (f: Field) => boolean) => all(test).find(Boolean) ?? '';\n const raw = first((f) => f.type === 'title');\n const id = first((f) => f.type === 'identifier');\n if (!raw || !id) continue;\n const signIn = pool === 'articles' && SIGN_IN.test(raw);\n let authors = all((f) => f.type === 'author').filter(Boolean);\n if (authors.length > MAX_AUTHORS)\n authors = [...authors.slice(0, MAX_AUTHORS), `and ${authors.length - MAX_AUTHORS} more`];\n const count = Math.trunc(Number(g.count));\n items.push({\n title: signIn ? SIGN_IN_TITLE : raw,\n url: ITEM_BASE[pool] + encodeURIComponent(id),\n authors,\n published: first((f) => f.name === 'published_date') || undefined,\n formats: all((f) => f.name === (pool === 'articles' ? 'pub_type' : 'format')).filter(Boolean),\n editions: count > 1 ? count : 1,\n signIn,\n });\n }\n const total = Number(j?.pagination?.total);\n return { items, total: Number.isFinite(total) && total >= 0 ? total : undefined };\n}\n\n/**\n * `query` as a Virgo `keyword: {…}` clause. Braces delimit the clause, so any in the query\n * become spaces rather than closing it early or opening another.\n */\nexport function virgoKeyword(query: string): string {\n return `keyword: {${query.replace(/[{}]/g, ' ')}}`;\n}\n\n/** The search body both Virgo pools take. */\nexport function virgoBody(query: string, limit: number): string {\n return JSON.stringify({\n query: virgoKeyword(query),\n pagination: { start: 0, rows: limit },\n sort: { sort_id: 'SortRelevance', order: 'desc' },\n filters: [{ pool_id: 'uva_library', facets: [] }],\n });\n}\n\n/**\n * The first `limit` results for `query` in `pool`. A 401 (an expired guest token) fetches a\n * new token and tries once more.\n */\nexport function searchVirgo(\n pool: VirgoPool,\n query: string,\n limit: number,\n signal?: AbortSignal,\n): Promise<Results<VirgoItem>> {\n const url = endpoints()[pool];\n const body = virgoBody(query, limit);\n return shared(\n `POST ${url}\\n${body}`,\n async (sig) => {\n for (let attempt = 0; ; attempt++) {\n const t = await guestToken();\n if (sig.aborted) throw sig.reason;\n const options: FetchOptions = {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${t}`,\n },\n body,\n signal: sig,\n retryStatus,\n };\n try {\n return parseVirgo(await fetchJson(url, bentoTiming, options), pool);\n } catch (e) {\n if (attempt === 0 && (e as HttpError).status === 401) {\n dropToken(t);\n continue;\n }\n throw e;\n }\n }\n },\n signal,\n );\n}\n\n/** Virgo's \"see all\" search for `query` in the catalog or the articles. */\nexport function virgoSearchUrl(pool: VirgoPool, query: string): string {\n const p = new URLSearchParams(\n pool === 'catalog'\n ? { q: query, pool: 'uva_library' }\n : { q: virgoKeyword(query), pool: 'articles' },\n );\n return `https://search.lib.virginia.edu/?${p}`;\n}\n\nconst MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\n/**\n * Virgo's published date for display, read as a calendar date (no time zone can shift it):\n * a bare year as is, `YYYY-MM` as \"Jul 2026\", `YYYY-MM-DD` as \"Jul 28, 2026\"; anything else\n * as sent.\n */\nexport function formatPublished(value: string): string {\n const m = /^(\\d{4})(?:-(\\d{2})(?:-(\\d{2}))?)?$/.exec(value);\n if (!m) return value;\n const [, year, month, day] = m;\n const name = month ? MONTHS[Number(month) - 1] : undefined;\n if (!month) return year!;\n if (!name) return value;\n if (!day) return `${name} ${year}`;\n const d = Number(day);\n // Checked as a UTC date, so 2026-02-30 is not shown.\n const date = new Date(Date.UTC(Number(year), Number(month) - 1, d));\n if (date.getUTCDate() !== d) return value;\n return new Intl.DateTimeFormat('en-US', {\n timeZone: 'UTC',\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n }).format(date);\n}\n\n// --- LibGuides -----------------------------------------------------------------------------\n\nexport interface Link {\n text: string;\n url: string;\n}\n\n/** A run of text; `mark` runs are the words the search matched. */\nexport interface TextRun {\n text: string;\n mark?: boolean;\n}\n\n/** One subject guide page, as plain text and URLs. */\nexport interface GuideItem {\n title: string;\n url: string;\n /** The guide the page belongs to. */\n guide?: Link;\n author?: Link;\n subjects: Link[];\n /** The matching text, with the matched words marked. */\n highlights: TextRun[];\n}\n\nconst SAFE = new Set(['http:', 'https:']);\n\n/** `value` as an absolute http(s) URL, or undefined. */\nexport function safeUrl(value: unknown, base?: string): string | undefined {\n if (typeof value !== 'string' || !value.trim()) return undefined;\n try {\n const u = new URL(value.trim(), base);\n return SAFE.has(u.protocol) ? u.href : undefined;\n } catch {\n return undefined;\n }\n}\n\nconst GUIDES_BASE = 'https://guides.lib.virginia.edu/';\n\nconst linkOf = (a: Element | null | undefined): Link | undefined => {\n const url = safeUrl(a?.getAttribute('href'), GUIDES_BASE);\n const text = str(a?.textContent);\n return url && text ? { text, url } : undefined;\n};\n\n/**\n * Text runs of `node`: `<mark>` / `<strong>` (as `markTag` says) become marked runs, every\n * other element only gives its text. Whitespace is collapsed and the ends trimmed.\n */\nexport function textRuns(node: Node, markTag: string): TextRun[] {\n const runs: TextRun[] = [];\n const add = (text: string, mark: boolean) => {\n if (!text) return;\n const last = runs[runs.length - 1];\n if (last && !!last.mark === mark) last.text += text;\n else runs.push(mark ? { text, mark } : { text });\n };\n const walk = (n: Node, mark: boolean) => {\n if (n.nodeType === Node.TEXT_NODE) add((n as Text).data, mark);\n else if (n.nodeType === Node.ELEMENT_NODE) {\n const el = n as Element;\n if (el.localName === 'script' || el.localName === 'style' || el.localName === 'template')\n return;\n const m = mark || el.localName === markTag;\n el.childNodes.forEach((c) => walk(c, m));\n }\n };\n node.childNodes.forEach((c) => walk(c, false));\n for (const r of runs) r.text = r.text.replace(/\\s+/g, ' ');\n if (runs.length) {\n runs[0]!.text = runs[0]!.text.trimStart();\n runs[runs.length - 1]!.text = runs[runs.length - 1]!.text.trimEnd();\n }\n return runs.filter((r) => r.text);\n}\n\n/**\n * Parse `html` into an inert document: DOMParser runs no scripts, loads nothing and fires no\n * event handlers, and nothing from it is ever put in the page.\n */\nconst inert = (html: string) => new DOMParser().parseFromString(html, 'text/html');\n\n/** The proxy's `{ data: { results, fulllink } }` reduced to GuideItem and the \"see all\" URL. */\nexport function parseGuides(json: unknown): Results<GuideItem> & { seeAll?: string } {\n const data = (json as { data?: { results?: unknown; fulllink?: unknown } } | null)?.data;\n const html = typeof data?.results === 'string' ? data.results : '';\n const items: GuideItem[] = [];\n for (const node of inert(html).querySelectorAll('.s-srch-result')) {\n const titleBox = node.querySelector('.s-srch-result-title');\n const titleLink = linkOf(titleBox?.querySelector(':scope > a'));\n if (!titleLink) continue;\n const meta = node.querySelectorAll('.s-srch-result-meta')[1];\n const highlights = meta?.querySelector('.s-srch-result-highlights');\n items.push({\n title: titleLink.text,\n url: titleLink.url,\n guide: linkOf(titleBox?.querySelector('.s-srch-result-guide a')),\n author: linkOf(meta?.querySelector('.s-srch-result-author a')),\n subjects: [...(meta?.querySelectorAll('.s-srch-result-subjects a') ?? [])]\n .map(linkOf)\n .filter((l): l is Link => !!l),\n highlights: highlights ? textRuns(highlights, 'mark') : [],\n });\n }\n return { items, seeAll: safeUrl(data?.fulllink) };\n}\n\n/** The LibGuides site search for `query` (when the proxy does not send its own link). */\nexport function guidesSearchUrl(query: string): string {\n return `${GUIDES_BASE}srch.php?${new URLSearchParams({ default_lg: '1', q: query })}`;\n}\n\n/** Add `params` to `base` (which may already have a query string). */\nfunction withParams(base: string, params: URLSearchParams): string {\n return `${base}${base.includes('?') ? '&' : '?'}${params}`;\n}\n\n/** The first `limit` subject guide pages for `query`. */\nexport function searchGuides(\n query: string,\n limit: number,\n signal?: AbortSignal,\n): Promise<Results<GuideItem> & { seeAll?: string }> {\n const url = withParams(endpoints().guides, new URLSearchParams({ q: query }));\n return shared(\n `GET ${url}`,\n async (sig) => parseGuides(await fetchJson(url, bentoTiming, { signal: sig, retryStatus })),\n signal,\n ).then((r) => ({ ...r, items: r.items.slice(0, limit) }));\n}\n\n// --- the library website (Drupal) ----------------------------------------------------------\n\n/** One page of the library website. */\nexport interface WebsiteItem {\n /** Plain text: Drupal titles are never HTML. */\n title: string;\n url: string;\n /** Drupal's excerpt, with the matched words marked; for a person without one, their job title. */\n excerpt: TextRun[];\n}\n\n/** The content types searched, as Drupal's search page does (DrupalData / WebsiteData). */\nconst TYPES = ['page', 'person', 'library', 'article'];\nexport const WEBSITE_BASE = 'https://library.virginia.edu';\n\n/** The JSON:API query: `filter[fulltext]`, `page[limit]` and an OR group over TYPES. */\nexport function websiteParams(query: string, limit: number): URLSearchParams {\n const p = new URLSearchParams();\n p.set('filter[fulltext]', query);\n p.set('page[limit]', String(limit));\n p.set('filter[types-group][group][conjunction]', 'OR');\n for (const t of TYPES) {\n p.set(`filter[${t}-filter][condition][path]`, 'type');\n p.set(`filter[${t}-filter][condition][value]`, t);\n p.set(`filter[${t}-filter][condition][memberOf]`, 'types-group');\n }\n return p;\n}\n\n/** Drupal's JSON:API answer reduced to WebsiteItem (links on https://library.virginia.edu). */\nexport function parseWebsite(json: unknown): Results<WebsiteItem> {\n const j = json as {\n data?: unknown;\n meta?: { count?: unknown; extra_data?: Record<string, { excerpt?: unknown }> };\n } | null;\n const nodes = Array.isArray(j?.data) ? (j.data as Record<string, unknown>[]) : [];\n const items: WebsiteItem[] = [];\n for (const n of nodes) {\n const a = (n?.attributes ?? {}) as Record<string, unknown>;\n const title = str(a.title);\n const alias = str((a.path as { alias?: unknown } | undefined)?.alias);\n const nid = a.drupal_internal__nid;\n const path = alias.startsWith('/')\n ? alias\n : nid != null\n ? `/node/${encodeURI(String(nid))}`\n : '';\n const url = path ? safeUrl(path, WEBSITE_BASE) : undefined;\n if (!title || !url || !url.startsWith(`${WEBSITE_BASE}/`)) continue;\n const raw = j?.meta?.extra_data?.[String(nid)]?.excerpt;\n let excerpt = typeof raw === 'string' && raw ? textRuns(inert(raw).body, 'strong') : [];\n if (!excerpt.length && n.type === 'node--person') {\n const job = a.field_uva_ldap_title;\n const text = (Array.isArray(job) ? job : [job]).map(str).filter(Boolean).join('; ');\n if (text) excerpt = [{ text }];\n }\n items.push({ title, url, excerpt });\n }\n const total = Number(j?.meta?.count);\n return { items, total: Number.isFinite(total) && total >= 0 ? total : undefined };\n}\n\n/** The first `limit` website pages for `query`. */\nexport function searchWebsite(\n query: string,\n limit: number,\n signal?: AbortSignal,\n): Promise<Results<WebsiteItem>> {\n const url = withParams(endpoints().website, websiteParams(query, limit));\n return shared(\n `GET ${url}`,\n async (sig) => parseWebsite(await fetchJson(url, bentoTiming, { signal: sig, retryStatus })),\n signal,\n );\n}\n\n/** The website's own search page for `query`. */\nexport function websiteSearchUrl(query: string): string {\n return `${WEBSITE_BASE}/search/content?${new URLSearchParams({ search_api_fulltext: query })}`;\n}\n\n/** Forget cached results and the token, and re-read `window.uvalibBentoEndpoints` (for tests). */\nexport function resetBentoCache(): void {\n cache.clear();\n token = tokenValue = undefined;\n globalApplied = false;\n}\n","import { html } from 'lit';\nimport { BentoSection, type SectionResults } from './BentoSection.js';\nimport {\n formatPublished,\n searchVirgo,\n virgoSearchUrl,\n type VirgoItem,\n type VirgoPool,\n} from './bento-data.js';\n\n/**\n * A Virgo pool's results (the catalog or the articles): each entry is its title linking to\n * Virgo, then its authors, and a row with the published date and the formats (with, for a\n * work with several editions, how many: on the same line, so every entry keeps one shape). Not registered itself.\n */\nexport abstract class VirgoSection extends BentoSection<VirgoItem> {\n protected abstract readonly pool: VirgoPool;\n\n protected fetchResults(\n query: string,\n limit: number,\n signal: AbortSignal,\n ): Promise<SectionResults<VirgoItem>> {\n return searchVirgo(this.pool, query, limit, signal);\n }\n\n protected seeAllUrl(query: string): string {\n return virgoSearchUrl(this.pool, query);\n }\n\n /**\n * An `li` with `body`, or, when there is none, an empty one hidden from assistive\n * technology, so every entry has the same lines (and height) as its placeholder.\n */\n private line(cls: string, body: unknown) {\n return body\n ? html`<li class=\"${cls} li-1\">${body}</li>`\n : html`<li class=\"${cls} li-1\" aria-hidden=\"true\"> </li>`;\n }\n\n protected renderItem(r: VirgoItem) {\n const editions =\n r.editions > 1\n ? html`<span class=\"bs-results--editions\"\n >${r.formats.length ? ', ' : ''}${r.editions} editions</span\n >`\n : '';\n const formats = r.formats.length || editions ? html`${r.formats.join('/')}${editions}` : '';\n return this.entry(\n html`<a href=${r.url} class=\"bs-results--title\">${r.title}</a>\n <ul class=\"ul-0\">\n ${this.line('bs-results--author', r.authors.join('; '))}\n <li>\n <ul class=\"ul-1\">\n ${this.line(\n 'bs-results--date',\n r.published\n ? html`<time datetime=${r.published}>${formatPublished(r.published)}</time>`\n : '',\n )}\n ${this.line('bs-results--format', formats)}\n </ul>\n </li>\n </ul>`,\n );\n }\n\n protected renderPlaceholderBody() {\n return html`<a class=\"bs-results--title\">Library search result</a>\n <ul class=\"ul-0\">\n <li class=\"bs-results--author li-1\">Author, Example</li>\n <li>\n <ul class=\"ul-1\">\n <li class=\"bs-results--date li-1\">2024</li>\n <li class=\"bs-results--format li-1\">Book</li>\n </ul>\n </li>\n </ul>`;\n }\n}\n","import { VirgoSection } from './VirgoSection.js';\n\n/**\n * Virgo's first article results for `query`. Articles Virgo hides from guests keep their\n * link, under a neutral title (\"Article details available after signing in to Virgo\").\n *\n * @tagname articles-section\n */\nexport class ArticlesSection extends VirgoSection {\n protected readonly pool = 'articles';\n readonly analyticsName = 'Virgo articles';\n protected readonly heading = 'Article';\n protected readonly sourceName = 'Virgo article';\n protected override get seeAllIn(): string {\n return 'Virgo articles';\n }\n protected readonly describe =\n 'An aggregation of tens of millions of articles made available through Library subscriptions.';\n protected readonly home = { text: 'Search articles', url: 'https://search.lib.virginia.edu/' };\n}\n","import { css, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { html, unsafeStatic } from 'lit/static-html.js';\nimport { property, state } from 'lit/decorators.js';\nimport { precedingHeadingLevel } from '../../base/heading-level.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport type { BentoSection } from './BentoSection.js';\nimport { bentoEndpoints, setBentoEndpoints, type BentoEndpoints } from './bento-data.js';\n\n/** The sections a `<bento-box>` can show, in the default order. */\nexport const BENTO_BOXES = ['catalog', 'articles', 'libguides', 'website'] as const;\nexport type BentoBoxName = (typeof BENTO_BOXES)[number];\n\nconst DEFAULT_LEVEL = 2;\n\n/**\n * `boxes` from an attribute: a comma (or space) separated list, or a JSON array. Unknown and\n * repeated names are dropped; nothing usable gives the default.\n */\nexport function parseBoxes(value: unknown): BentoBoxName[] {\n let list: unknown = value;\n if (typeof value === 'string') {\n const text = value.trim();\n try {\n list = text.startsWith('[') ? JSON.parse(text) : text.split(/[\\s,]+/);\n } catch {\n list = [];\n }\n }\n const known = new Set<string>(BENTO_BOXES);\n const out = [\n ...new Set(\n (Array.isArray(list) ? list : [])\n .map((b) => (typeof b === 'string' ? b.trim().toLowerCase() : ''))\n .filter((b) => known.has(b)),\n ),\n ] as BentoBoxName[];\n return out.length ? out : [...BENTO_BOXES];\n}\n\n/** The query in the page URL: `?q=` (preferred) or the old `?query=`; null when neither. */\nexport function urlQuery(search = location.search): string | null {\n const p = new URLSearchParams(search);\n return p.get('q') ?? p.get('query');\n}\n\n/**\n * Rules the box needs even with `no-style`: the host is a block, the status line is visually\n * hidden (it only speaks), and `[hidden]` hides.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} .bs-results-container > * { min-width: 0; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\nconst SEARCH_ICON = `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\")`;\n\nlet instances = 0;\n\n/**\n * The library's search results page (library.virginia.edu/search): a search bar and, for the\n * query, a grid of result sections from Virgo's catalog and articles, the subject guides and\n * the library website. The query comes from the page URL (`?q=`, or the old `?query=`), else\n * the `query` attribute; searching pushes `?q=` to the history, and Back and Forward restore\n * the query. With no query only the search bar shows and nothing is fetched. Light DOM output\n * keeps the classes the Drupal theme styles under `.uvalib-bento-search`.\n *\n * Registers `catalog-section`, `articles-section`, `libguides-section` and `website-section`.\n *\n * @tagname bento-box\n * @cssprop --uva-color-text - Dark-mode role token: text (else #2b2b2b).\n * @cssprop --uva-color-control-border - Dark-mode role token: the search input's border (else #808080).\n * @cssprop --uva-color-input-text - Dark-mode role token: the search input's text (else #1f2937).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: the search input's background (else #fff).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: the search button (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Dark-mode role token: the search button's icon (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class BentoBox extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n container-type: inline-size;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n line-height: 1.5;\n }\n .bento-search-bar {\n display: block;\n margin: 2rem 0;\n }\n .bento-search-bar form {\n display: flex;\n max-width: 40rem;\n margin: 0 auto;\n }\n .bento-search-bar input {\n flex: 1;\n min-width: 0;\n min-height: 3rem;\n box-sizing: border-box;\n padding: 0.5rem 1rem;\n font: inherit;\n font-size: max(1rem, 1em);\n color: var(--uva-color-input-text, #1f2937);\n background: var(--uva-color-surface-raised, #fff);\n border: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));\n border-inline-end: 0;\n border-radius: 0.3rem 0 0 0.3rem;\n }\n .bento-search-bar button {\n padding: 0 0.75rem;\n border: 1px solid var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n border-radius: 0 0.3rem 0.3rem 0;\n background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n color: var(--uva-color-on-accent, #fff);\n cursor: pointer;\n }\n .bento-search-bar button::before {\n content: '';\n display: block;\n width: 1.5rem;\n height: 1.5rem;\n background: currentColor;\n mask: ${unsafeCSS(SEARCH_ICON)} center / contain no-repeat;\n }\n .bento-search-bar p {\n margin: 1rem 0 0;\n text-align: center;\n }\n .bs-header > :is(h1, h2, h3, h4, h5, h6) {\n margin: 2rem 0 0;\n font-size: 1.5rem;\n font-weight: 500;\n line-height: 1.3;\n text-wrap: balance;\n }\n .bs-search-term {\n font-style: italic;\n }\n .bs-header p {\n margin: 1rem 0;\n font-size: 1.25rem;\n }\n .bs-results-container {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 2rem;\n }\n @container (width < 48rem) {\n .bs-results-container {\n grid-template-columns: minmax(0, 1fr);\n }\n }\n `,\n ];\n\n /**\n * The URLs shared by every `<bento-box>` and section: `authorize`, `catalog`, `articles`,\n * `guides` and `website`. Assigning an object (or setting a key) changes them from the next\n * search on. To repoint before elements already in the HTML fetch, set\n * `window.uvalibBentoEndpoints` before the define script runs.\n */\n static get endpoints(): BentoEndpoints {\n return bentoEndpoints;\n }\n static set endpoints(value: Partial<BentoEndpoints>) {\n setBentoEndpoints(value);\n }\n\n /** The search text when the page URL has none (`?q=` or `?query=` win). */\n @property({ type: String })\n query = '';\n\n /** How many results each section shows (at most). */\n @property({ type: Number })\n limit = 5;\n\n /** The line under the search bar. */\n @property({ type: String, attribute: 'search-describe' })\n searchDescribe =\n 'This page searches Virgo, Virgo articles, subject guides, and the Library website.';\n\n /** What a section says when it finds nothing. */\n @property({ type: String, attribute: 'no-result-describe' })\n noResultDescribe = 'No results found.';\n\n /** The search input's placeholder. */\n @property({ type: String })\n placeholder = 'Search anything...';\n\n /**\n * The sections, in order: `catalog`, `articles`, `libguides`, `website`, as a comma list\n * (`boxes=\"catalog,articles\"`) or a JSON array. Default: all four.\n */\n @property({ converter: { fromAttribute: parseBoxes } })\n boxes: BentoBoxName[] = ['catalog', 'articles', 'libguides', 'website'];\n\n /**\n * The level of the \"You searched for\" heading, 1 to 6; the sections' headings are one\n * below. Unset (the default), it is one below the nearest heading before the element in the\n * page (the page's `<h1>` gives `<h2>`, then `<h3>` sections), or 2 when there is none.\n */\n @property({ type: Number, attribute: 'heading-level' })\n headingLevel?: number;\n\n @state() private inferredLevel = DEFAULT_LEVEL;\n /** The polite status line's text. */\n @state() private status = '';\n\n private readonly uid = `bento-box-${++instances}`;\n /** The `query` attribute's value when connected, restored when the URL has no query. */\n private fallbackQuery?: string;\n /** A search is waiting for its sections to settle, to say so once. */\n private announcePending = false;\n\n private readonly onPopState = () => {\n this.query = urlQuery() ?? this.fallbackQuery ?? '';\n };\n\n private readonly onSectionState = () => {\n const sections = this.sections();\n if (sections.some((s) => s.state === 'loading')) {\n this.announcePending = true;\n this.status = '';\n return;\n }\n if (!this.announcePending) return;\n this.announcePending = false;\n this.status = sections.some((s) => s.state === 'error')\n ? 'Results updated. Some results are unavailable.'\n : 'Results updated.';\n };\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n const above = precedingHeadingLevel(this);\n this.inferredLevel = above === null ? DEFAULT_LEVEL : Math.min(above + 1, 6);\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n const root = node instanceof ShadowRoot || node instanceof Document ? node : undefined;\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n { root, scope: false },\n );\n }\n // The URL wins over the attribute.\n this.fallbackQuery ??= this.query;\n const fromUrl = urlQuery();\n if (fromUrl !== null) this.query = fromUrl;\n window.addEventListener('popstate', this.onPopState);\n this.addEventListener('bento-state', this.onSectionState);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('popstate', this.onPopState);\n this.removeEventListener('bento-state', this.onSectionState);\n }\n\n private get level(): number {\n const n = Math.trunc(this.headingLevel ?? Number.NaN);\n return n >= 1 && n <= 6 ? n : this.inferredLevel;\n }\n\n private get q(): string {\n return (this.query ?? '').trim();\n }\n\n /** The section elements now rendered. */\n private sections(): BentoSection<unknown>[] {\n return [\n ...this.renderRoot.querySelectorAll<BentoSection<unknown>>(\n '.bs-results-container > .bs-results--block',\n ),\n ];\n }\n\n protected override willUpdate(changed: PropertyValues<this>) {\n if (changed.has('query')) {\n this.status = '';\n this.announcePending = !!this.q;\n }\n }\n\n private search(e: SubmitEvent) {\n e.preventDefault();\n const input = (e.currentTarget as HTMLFormElement).elements.namedItem('q') as HTMLInputElement;\n const q = input.value.trim();\n if (q === this.q) return;\n const url = new URL(location.href);\n url.searchParams.delete('query');\n if (q) url.searchParams.set('q', q);\n else url.searchParams.delete('q');\n history.pushState({ query: q }, '', url);\n this.query = q;\n }\n\n private renderSection(box: BentoBoxName, level: number) {\n const tag = unsafeStatic(`${box}-section`);\n return html`<${tag}\n class=\"bs-results--block\"\n ?no-shadow-dom=${this.lightDom}\n ?no-style=${this.noStyle}\n .query=${this.q}\n .limit=${this.limit}\n .noResultDescribe=${this.noResultDescribe}\n .headingLevel=${level}\n ></${tag}>`;\n }\n\n render() {\n const level = this.level;\n const h = unsafeStatic(`h${level}`);\n const q = this.q;\n const boxes = parseBoxes(this.boxes);\n const input = `${this.uid}-q`;\n const describe = `${this.uid}-describe`;\n return html`<bento-search class=\"bento-search-bar\">\n <search>\n <form action=\"https://search.lib.virginia.edu/search\" method=\"get\" @submit=${this.search}>\n <span class=\"icon-search\" aria-hidden=\"true\"></span>\n <label class=\"visually-hidden\" for=${input}>Search</label>\n <input\n id=${input}\n name=\"q\"\n type=\"search\"\n placeholder=${this.placeholder}\n .value=${q}\n aria-describedby=${describe}\n enterkeyhint=\"search\"\n autocapitalize=\"none\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n />\n <button type=\"submit\" class=\"uvalib-button-home-search\">\n <span class=\"visually-hidden\">Search</span>\n </button>\n </form>\n </search>\n <p id=${describe}>${this.searchDescribe}</p>\n </bento-search>\n ${\n q\n ? html`<div class=\"bs-header\">\n <${h}>You searched for <span class=\"bs-search-term\">${q}</span></${h}>\n <p>Here are the results:</p>\n </div>\n <div class=\"bs-results-container\">\n ${boxes.map((b) => this.renderSection(b, Math.min(level + 1, 6)))}\n </div>`\n : nothing\n }\n <div class=\"visually-hidden\" role=\"status\">${this.status}</div>`;\n }\n}\n","import { VirgoSection } from './VirgoSection.js';\n\n/**\n * The Virgo catalog's first results for `query` (books, journals, archives, maps, music,\n * theses, videos…). A work with several editions shows once, noting how many.\n *\n * @tagname catalog-section\n */\nexport class CatalogSection extends VirgoSection {\n protected readonly pool = 'catalog';\n readonly analyticsName = 'Virgo catalog';\n protected readonly heading = 'Virgo Catalog';\n protected readonly sourceName = 'Virgo catalog';\n protected readonly describe =\n 'Books, journals, manuscripts & archival material, maps, music and sound recordings, theses and dissertations, and videos.';\n protected readonly home = { text: 'Search Virgo', url: 'https://search.lib.virginia.edu/' };\n}\n","import { html, nothing } from 'lit';\nimport { BentoSection, renderRuns, type SectionResults } from './BentoSection.js';\nimport { guidesSearchUrl, searchGuides, type GuideItem } from './bento-data.js';\n\n/**\n * The first subject guide pages (LibGuides) matching `query`: the page and its guide, then\n * its author and subjects and the matching text. Only text and links are taken from\n * Springshare's HTML.\n *\n * @tagname libguides-section\n */\nexport class LibGuidesSection extends BentoSection<GuideItem> {\n readonly analyticsName = 'Subject guides';\n protected readonly heading = 'Subject Guides';\n protected readonly sourceName = 'subject guide';\n protected override get seeAllIn(): string {\n return 'subject guides';\n }\n protected readonly describe =\n 'Subject guides contain topic-specific information to help with research and coursework.';\n protected readonly home = {\n text: 'Search Guides',\n url: 'https://guides.lib.virginia.edu/srch.php',\n };\n\n protected fetchResults(\n query: string,\n limit: number,\n signal: AbortSignal,\n ): Promise<SectionResults<GuideItem>> {\n return searchGuides(query, limit, signal);\n }\n\n protected seeAllUrl(query: string): string {\n return guidesSearchUrl(query);\n }\n\n protected renderItem(g: GuideItem) {\n const by = g.author\n ? html`<span class=\"bs-results--guide-author\"\n >by <a href=${g.author.url}>${g.author.text}</a></span\n >`\n : nothing;\n const subjects = g.subjects.length\n ? html`<span class=\"bs-results--subjects\"\n >Subjects:\n ${g.subjects.map((s, i) => html`${i ? ', ' : ''}<a href=${s.url}>${s.text}</a>`)}</span\n >`\n : nothing;\n return this.entry(\n html`<span class=\"bs-results--title\"\n ><a href=${g.url}>${g.title}</a>${\n g.guide\n ? html` <span class=\"bs-results--guide\"\n >on <a href=${g.guide.url}>${g.guide.text}</a></span\n >`\n : nothing\n }</span\n >\n <ul class=\"ul-0\">\n <li class=\"bs-results--teaser li-1\">\n <div class=\"bs-results--byline\">\n ${by}${g.author && g.subjects.length ? html` <span aria-hidden=\"true\">|</span> ` : nothing}${subjects}\n </div>\n <div class=\"bs-results--highlights\">${renderRuns(g.highlights)}</div>\n </li>\n </ul>`,\n );\n }\n\n protected renderPlaceholderBody() {\n return html`<span class=\"bs-results--title\"\n ><a>Library subject guide</a>\n <span class=\"bs-results--guide\">on <a>Research</a></span></span\n >\n <ul class=\"ul-0\">\n <li class=\"bs-results--teaser li-1\">\n <div class=\"bs-results--byline\">by <a>Librarian</a></div>\n <div class=\"bs-results--highlights\">Research help</div>\n </li>\n </ul>`;\n }\n}\n","import { html } from 'lit';\nimport { BentoSection, renderRuns, type SectionResults } from './BentoSection.js';\nimport { searchWebsite, websiteSearchUrl, type WebsiteItem } from './bento-data.js';\n\n/**\n * The library website's first pages (pages, people, libraries, news) matching `query`, from\n * Drupal's search index, with its excerpt (the matched words marked). The index sends no\n * CORS headers, so this section works on library.virginia.edu (or wherever\n * `BentoBox.endpoints.website` points to a same-origin copy) only.\n *\n * @tagname website-section\n */\nexport class WebsiteSection extends BentoSection<WebsiteItem> {\n readonly analyticsName = 'Library website';\n protected readonly heading = 'Website';\n protected readonly sourceName = 'Library website';\n protected readonly describe = 'Results from the main Library website.';\n protected readonly home = {\n text: 'Search Library website',\n url: 'https://library.virginia.edu/search/content',\n };\n protected override entryClass = '';\n\n protected fetchResults(\n query: string,\n limit: number,\n signal: AbortSignal,\n ): Promise<SectionResults<WebsiteItem>> {\n return searchWebsite(query, limit, signal);\n }\n\n protected seeAllUrl(query: string): string {\n return websiteSearchUrl(query);\n }\n\n protected renderItem(w: WebsiteItem) {\n return this.entry(\n html`<div class=\"bento-section-title\"><a href=${w.url}>${w.title}</a></div>\n <div class=\"bento-section-desc\">${renderRuns(w.excerpt)}</div>`,\n );\n }\n\n protected renderPlaceholderBody() {\n return html`<div class=\"bento-section-title\"><a>Library page</a></div>\n <div class=\"bento-section-desc\">Library website page</div>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { ArticlesSection } from './ArticlesSection.js';\nimport { BentoBox } from './BentoBox.js';\nimport { CatalogSection } from './CatalogSection.js';\nimport { LibGuidesSection } from './LibGuidesSection.js';\nimport { WebsiteSection } from './WebsiteSection.js';\n\n// The sections first, so the box's first render upgrades them at once.\ndefine('catalog-section', CatalogSection);\ndefine('articles-section', ArticlesSection);\ndefine('libguides-section', LibGuidesSection);\ndefine('website-section', WebsiteSection);\ndefine('bento-box', BentoBox);\n"],"mappings":";;;;;;;AAwBA,IAAMiC,KAAgB,GAChBjC,IAAgB,GAChBmC,KAAY,IAUZlC,KAAmB,MAAiB;IACtCoC,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;;;;;;;IAOLA,EAAK;;;;;;;;;IASLA,EAAK;IACLA,EAAK;IACLA,EA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
4
|
+
@font-face {
|
|
5
|
+
font-family: 'UVA Franklin Fallback';
|
|
6
|
+
src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans');
|
|
7
|
+
font-weight: 100 450;
|
|
8
|
+
font-style: normal;
|
|
9
|
+
size-adjust: 94.52%;
|
|
10
|
+
ascent-override: 100.93%;
|
|
11
|
+
descent-override: 26.56%;
|
|
12
|
+
line-gap-override: 0%;
|
|
13
|
+
}
|
|
14
|
+
@font-face {
|
|
15
|
+
font-family: 'UVA Franklin Fallback';
|
|
16
|
+
src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans');
|
|
17
|
+
font-weight: 451 599;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
size-adjust: 95.99%;
|
|
20
|
+
ascent-override: 99.18%;
|
|
21
|
+
descent-override: 26.04%;
|
|
22
|
+
line-gap-override: 0%;
|
|
23
|
+
}
|
|
24
|
+
@font-face {
|
|
25
|
+
font-family: 'UVA Franklin Fallback';
|
|
26
|
+
src:
|
|
27
|
+
local('Arial Bold'), local('Arial-BoldMT'), local('Liberation Sans Bold'),
|
|
28
|
+
local('LiberationSans-Bold');
|
|
29
|
+
font-weight: 600 1000;
|
|
30
|
+
font-style: normal;
|
|
31
|
+
size-adjust: 91.32%;
|
|
32
|
+
ascent-override: 104.03%;
|
|
33
|
+
descent-override: 27.38%;
|
|
34
|
+
line-gap-override: 0%;
|
|
35
|
+
}
|
|
36
|
+
@font-face {
|
|
37
|
+
font-family: 'UVA Franklin Fallback';
|
|
38
|
+
src:
|
|
39
|
+
local('Arial Italic'), local('Arial-ItalicMT'), local('Liberation Sans Italic'),
|
|
40
|
+
local('LiberationSans-Italic');
|
|
41
|
+
font-weight: 100 599;
|
|
42
|
+
font-style: italic;
|
|
43
|
+
size-adjust: 95.06%;
|
|
44
|
+
ascent-override: 101.09%;
|
|
45
|
+
descent-override: 26.4%;
|
|
46
|
+
line-gap-override: 0%;
|
|
47
|
+
}
|
|
48
|
+
`, n = e`
|
|
4
49
|
:root {
|
|
5
50
|
--uva-brand-blue-lightest: #87B9D9;
|
|
6
51
|
--uva-brand-blue-lighter: #3395D4;
|
|
@@ -78,10 +123,10 @@ var t = e`
|
|
|
78
123
|
--uva-grey: #808080;
|
|
79
124
|
--uva-grey-A: #4F4F4F;
|
|
80
125
|
--uva-grey-B: #2B2B2B;
|
|
81
|
-
--uva-font-family: franklin-gothic-urw, Arial, Helvetica, sans-serif;
|
|
126
|
+
--uva-font-family: franklin-gothic-urw, "UVA Franklin Fallback", Arial, Helvetica, sans-serif;
|
|
82
127
|
--uva-font-size-base: 17px;
|
|
83
128
|
}
|
|
84
|
-
`,
|
|
129
|
+
`, r = "https://use.typekit.net/oym8nvz.css", i = e`
|
|
85
130
|
*,
|
|
86
131
|
*::before,
|
|
87
132
|
*::after {
|
|
@@ -89,7 +134,14 @@ var t = e`
|
|
|
89
134
|
}
|
|
90
135
|
html,
|
|
91
136
|
body {
|
|
92
|
-
font-family: var(
|
|
137
|
+
font-family: var(
|
|
138
|
+
--uva-font-family,
|
|
139
|
+
franklin-gothic-urw,
|
|
140
|
+
'UVA Franklin Fallback',
|
|
141
|
+
Arial,
|
|
142
|
+
Helvetica,
|
|
143
|
+
sans-serif
|
|
144
|
+
);
|
|
93
145
|
}
|
|
94
146
|
html {
|
|
95
147
|
font-size: var(--uva-font-size-base, 17px);
|
|
@@ -276,6 +328,6 @@ var t = e`
|
|
|
276
328
|
}
|
|
277
329
|
}
|
|
278
330
|
`;
|
|
279
|
-
export {
|
|
331
|
+
export { t as i, i as n, n as r, r as t };
|
|
280
332
|
|
|
281
|
-
//# sourceMappingURL=base-
|
|
333
|
+
//# sourceMappingURL=base-CIX_-Rmo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-CIX_-Rmo.js","names":["i","fontFallback","tokens","TYPEKIT_URL","base"],"sources":["../../src/styles/font-fallback.ts","../../src/styles/tokens.ts","../../src/styles/base.ts"],"sourcesContent":["import { css } from 'lit';\n\n/**\n * A metric-matched fallback for Franklin Gothic URW (issue #32). The Adobe Fonts kit uses\n * `font-display: auto`, so on a slow connection text is drawn in the next font of\n * `--uva-font-family` and redrawn when the kit's files arrive. Plain Arial is wider than\n * Franklin Gothic (by 6% regular, 9% bold), so paragraphs rewrapped and the page moved\n * (layout shift). \"UVA Franklin Fallback\" is the system's Arial scaled to Franklin Gothic's\n * average widths, with its ascent and descent, for each face the kit serves (400, 500, 700 and\n * 400 italic; a 600 rule gets the 700 face, as the kit's own matching does). Measured against\n * the kit in Chromium: the fallback wraps a paragraph like Franklin Gothic in about 99% of\n * widths from 260 to 700px at 16 to 20px, against 55 to 82% for plain Arial.\n *\n * `size-adjust` scales Arial's glyphs; the overrides are Franklin Gothic's ascent (0.95 em) and\n * descent (0.25 em) divided by that scale, with no line gap, so a line is as tall in both.\n * Liberation Sans (Linux) has Arial's metrics. Where neither is installed (Android has Roboto),\n * the face is skipped and the next font in the stack is used, as before.\n */\nexport const fontFallback = css`\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans');\n font-weight: 100 450;\n font-style: normal;\n size-adjust: 94.52%;\n ascent-override: 100.93%;\n descent-override: 26.56%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans');\n font-weight: 451 599;\n font-style: normal;\n size-adjust: 95.99%;\n ascent-override: 99.18%;\n descent-override: 26.04%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src:\n local('Arial Bold'), local('Arial-BoldMT'), local('Liberation Sans Bold'),\n local('LiberationSans-Bold');\n font-weight: 600 1000;\n font-style: normal;\n size-adjust: 91.32%;\n ascent-override: 104.03%;\n descent-override: 27.38%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src:\n local('Arial Italic'), local('Arial-ItalicMT'), local('Liberation Sans Italic'),\n local('LiberationSans-Italic');\n font-weight: 100 599;\n font-style: italic;\n size-adjust: 95.06%;\n ascent-override: 101.09%;\n descent-override: 26.4%;\n line-gap-override: 0%;\n }\n`;\n","// GENERATED by scripts/sync-tokens.mjs from ../monorepo/packages/drupal_library_theme/src/scss/base — do not edit\nimport { css } from 'lit';\n\nexport const tokens = css`\n :root {\n --uva-brand-blue-lightest: #87B9D9;\n --uva-brand-blue-lighter: #3395D4;\n --uva-brand-blue-light: #0370B7;\n --uva-brand-blue-base: #232D4B;\n --uva-brand-blue-300: #87B9D9;\n --uva-brand-blue-200: #3395D4;\n --uva-brand-blue-100: #0370B7;\n --uva-brand-blue: #232D4B;\n --uva-brand-orange-lightest: #FFEAD6;\n --uva-brand-orange-lighter: #FFC999;\n --uva-brand-orange-light: #FFB370;\n --uva-brand-orange-base: #E57200;\n --uva-brand-orange-dark: #B35900;\n --uva-brand-orange-darker: #854200;\n --uva-brand-orange-300: #FFEAD6;\n --uva-brand-orange-200: #FFC999;\n --uva-brand-orange-100: #FFB370;\n --uva-brand-orange: #E57200;\n --uva-brand-orange-A: #B35900;\n --uva-brand-orange-B: #854200;\n --uva-blue-alt-lightest: #BFE7F7;\n --uva-blue-alt-lighter: #91D8F2;\n --uva-blue-alt-light: #55C4EC;\n --uva-blue-alt-base: #007BAC;\n --uva-blue-alt-dark: #005679;\n --uva-blue-alt-darkest: #141E3C;\n --uva-blue-alt-400: #e6f2f7;\n --uva-blue-alt-300: #BFE7F7;\n --uva-blue-alt-200: #91D8F2;\n --uva-blue-alt-100: #55C4EC;\n --uva-blue-alt: #007BAC;\n --uva-blue-alt-A: #005679;\n --uva-blue-alt-B: #141E3C;\n --uva-teal-lightest: #C8F2F4;\n --uva-teal-light: #5BD7DE;\n --uva-teal-base: #25CAD3;\n --uva-teal-dark: #1DA1A8;\n --uva-teal-darker: #16777C;\n --uva-teal-200: #C8F2F4;\n --uva-teal-100: #5BD7DE;\n --uva-teal: #25CAD3;\n --uva-teal-A: #1DA1A8;\n --uva-teal-B: #16777C;\n --uva-green-lightest: #DDEFDC;\n --uva-green-lighter: #89CC74;\n --uva-green-base: #62BB46;\n --uva-green-dark: #4E9737;\n --uva-green-200: #DDEFDC;\n --uva-green-100: #89CC74;\n --uva-green: #62BB46;\n --uva-green-A: #4E9737;\n --uva-red-lightest: #FBCFDA;\n --uva-red-base: #EF3F6B;\n --uva-red-dark: #DF1E43;\n --uva-red-darker: #B30000;\n --uva-red-100: #FBCFDA;\n --uva-red: #EF3F6B;\n --uva-red-A: #DF1E43;\n --uva-red-B: #B30000;\n --uva-yellow-lightest: #FEF6C8;\n --uva-yellow-base: #ECC602;\n --uva-yellow-dark: #B99C02;\n --uva-yellow-100: #FEF6C8;\n --uva-yellow: #ECC602;\n --uva-yellow-A: #B99C02;\n --uva-grey-lightest: #F1F1F1;\n --uva-grey-light: #DADADA;\n --uva-grey-base: #808080;\n --uva-grey-dark: #4F4F4F;\n --uva-grey-darkest: #2B2B2B;\n --uva-grey-200: #F1F1F1;\n --uva-grey-100: #DADADA;\n --uva-grey-50: #ADADAD;\n --uva-grey: #808080;\n --uva-grey-A: #4F4F4F;\n --uva-grey-B: #2B2B2B;\n --uva-font-family: franklin-gothic-urw, \"UVA Franklin Fallback\", Arial, Helvetica, sans-serif;\n --uva-font-size-base: 17px;\n }\n`;\n","import { css } from 'lit';\n\nexport const TYPEKIT_URL = 'https://use.typekit.net/oym8nvz.css';\n\n// The body background has no fallback: without dark mode it stays transparent, as before.\n//\n// site-page:not(:defined) applies when base.css is linked in <head>, before the element\n// upgrades: its own formatting context (flow-root), so a heading's top margin cannot collapse\n// through to <body> and shift the page once the element upgrades, and invisible, so its\n// content does not paint above where the header will go. If the script never loads, the\n// content appears anyway after two seconds.\nexport const base = css`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n html,\n body {\n font-family: var(\n --uva-font-family,\n franklin-gothic-urw,\n 'UVA Franklin Fallback',\n Arial,\n Helvetica,\n sans-serif\n );\n }\n html {\n font-size: var(--uva-font-size-base, 17px);\n }\n body {\n margin: 0;\n line-height: 1.5;\n min-height: 100vh;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n background-color: var(--uva-color-surface);\n }\n site-page:not(:defined) {\n display: flow-root;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-breadcrumbs:not(:defined),\n uvalib-card:not(:defined),\n uvalib-card-grid:not(:defined),\n uvalib-pager:not(:defined),\n uvalib-contents:not(:defined),\n uvalib-metadata:not(:defined),\n uvalib-tag-list:not(:defined) {\n display: block;\n line-height: 1.5;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n /* A chip row: hidden, one 44px row tall (with the scrolling row's padding), the raw\n children kept on one line so they cannot make it taller. */\n uvalib-chip-group:not(:defined) {\n display: block;\n min-height: 44px;\n max-width: 100%;\n overflow: hidden;\n white-space: nowrap;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-chip-group[scroll]:not(:defined) {\n min-height: calc(44px + 0.75rem);\n }\n /* A description: one line of it (0.875rem at 1.5, 0.25rem below the row). */\n uvalib-chip-group[description]:not(:defined) {\n padding-block-end: 1.5625rem;\n }\n /* Its text is drawn from attributes: hold one line until it upgrades. */\n uvalib-results-count:not(:defined) {\n display: block;\n min-block-size: 1.5em;\n }\n uvalib-tag-list:not(:defined)[hidden],\n uvalib-results-count:not(:defined)[hidden] {\n display: none;\n }\n /* The pre-upgrade rules here set display, which beats the hidden attribute's (issue #7).\n More specific than each of them (two pseudo-classes or attributes), so it needs no importance flag. */\n :where(\n site-page,\n uvalib-breadcrumbs,\n uvalib-card,\n uvalib-card-grid,\n uvalib-pager,\n uvalib-contents,\n uvalib-metadata,\n uvalib-chip-group,\n uvalib-tabs,\n uvalib-combobox,\n uvalib-image-regions,\n uvalib-map,\n uvalib-filter-drawer\n ):not(:defined)[hidden],\n :where(uvalib-combobox, uvalib-image-regions):not(:defined) > [hidden] {\n display: none;\n }\n /* Tabs stay readable before the script runs: a block, one panel, and a gap the\n size of the tab row (44px) plus its 1rem margin, so the first panel does not\n jump when the element upgrades. Later data-tab panels stay hidden. */\n uvalib-tabs:not(:defined) {\n display: block;\n padding-block-start: calc(44px + 1rem);\n }\n uvalib-tabs:not(:defined) > [data-tab] ~ [data-tab] {\n display: none;\n }\n /* A combobox: its label (from the attribute) and one 44px field (plus a one-line\n description) held, so nothing moves when it upgrades. A fallback <input list> child\n works meanwhile; the other children (options, a datalist) stay out of sight. */\n uvalib-combobox:not(:defined) {\n display: block;\n min-block-size: calc(1.5em + 0.25rem + 44px);\n line-height: 1.5;\n }\n uvalib-combobox[description]:not(:defined) {\n min-block-size: calc(3em + 0.5rem + 44px);\n }\n uvalib-combobox:not(:defined)::before {\n content: attr(label);\n display: block;\n margin-block-end: 0.25rem;\n font-weight: 600;\n }\n uvalib-combobox:not(:defined) > :not(input) {\n display: none;\n }\n uvalib-combobox:not(:defined) > input {\n display: block;\n box-sizing: border-box;\n inline-size: 100%;\n min-block-size: 44px;\n font: inherit;\n line-height: 1.2;\n }\n /* Image regions: the image at its own width and the list beside it (or under it), the\n layout the element keeps once it upgrades, so the image does not move. */\n uvalib-image-regions:not(:defined) {\n display: flex;\n flex-wrap: wrap;\n gap: 1rem;\n align-items: flex-start;\n }\n uvalib-image-regions:not(:defined) > :is(img, picture) {\n display: block;\n flex: 0 1 auto;\n min-width: 0;\n max-width: 100%;\n height: auto;\n }\n uvalib-image-regions:not(:defined) > :is(ol, ul) {\n flex: 1 1 14rem;\n min-width: 0;\n }\n /* A map: its key instructions (the same text it shows) and the map's height held above\n the child list, so the list does not move when the map is drawn over the page's\n Leaflet. Padding, not margin, so it cannot collapse with the list's own top margin. */\n uvalib-map:not(:defined) {\n display: block;\n }\n uvalib-map:not(:defined)::before {\n content: 'Tab or arrow keys move between places; Enter opens one. With the map focused, arrow keys pan and + and − zoom.';\n display: block;\n padding-block-end: calc(0.5rem + max(12rem, var(--uvalib-map-height, min(24rem, 75vw))));\n font-size: 0.875rem;\n line-height: 1.5;\n color: var(--uva-color-text-muted, #4b5563);\n }\n /* A filter drawer on a phone (the default 48rem breakpoint): once it upgrades only its 44px\n \"Search and filters\" button shows, so hold that height and keep the form and filters out\n of sight meanwhile; nothing moves when it upgrades. A page with its own breakpoint adds the\n same two rules in a media query of that width (see the README). Low specificity, so the\n [hidden] rule above still wins. */\n @media (max-width: 48rem) {\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) {\n display: block;\n min-block-size: 44px;\n }\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) > * {\n display: none;\n }\n }\n /* Printing a <site-page> (issue #20; its own styles leave out the chrome): a dark scheme\n prints light (the role tokens resolve to their light values), and the content's links\n are black and underlined, so they are told apart without colour. Content is <main> in\n light DOM and the unslotted children in shadow DOM. print-chrome keeps the page as it is\n shown, apart from the light scheme. */\n @media print {\n :root[data-uva-color-scheme]:has(site-page) {\n color-scheme: light;\n --uva-color-scheme: light;\n }\n /* Light DOM's trail, here too, as the pre-upgrade rule above (unlayered) would win. */\n site-page:not([print-chrome]) > [slot='breadcrumbs'] {\n display: none;\n }\n site-page:not([print-chrome]) > :not([slot], site-header, site-footer, .alerts-list) :any-link,\n site-page:not([print-chrome]) > :any-link:not([slot], .skip-link) {\n color: #000;\n text-decoration: underline;\n }\n }\n @keyframes uvalib-site-page-reveal {\n to {\n visibility: visible;\n }\n }\n`;\n"],"mappings":";;AAkBA,IAAaC,IAAe,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCflBC,IAAS,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCDZC,IAAc,uCASdC,IAAO,CAAG"}
|