@internetarchive/collection-browser 1.14.3 → 1.14.5

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.
@@ -25,6 +25,7 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
25
25
  baseQuery?: string;
26
26
  displayMode?: CollectionDisplayMode;
27
27
  sortParam: SortParam | null;
28
+ defaultSortParam: SortParam | null;
28
29
  selectedSort: SortField;
29
30
  selectedTitleFilter: string | null;
30
31
  selectedCreatorFilter: string | null;
@@ -25,6 +25,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
25
25
  this.baseImageUrl = 'https://archive.org';
26
26
  this.searchType = SearchType.METADATA;
27
27
  this.sortParam = null;
28
+ this.defaultSortParam = null;
28
29
  this.selectedSort = SortField.default;
29
30
  this.selectedTitleFilter = null;
30
31
  this.selectedCreatorFilter = null;
@@ -778,6 +779,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
778
779
  .tileDisplayMode=${'list-header'}
779
780
  .resizeObserver=${this.resizeObserver}
780
781
  .sortParam=${this.sortParam}
782
+ .defaultSortParam=${this.defaultSortParam}
781
783
  .mobileBreakpoint=${this.mobileBreakpoint}
782
784
  .loggedIn=${this.loggedIn}
783
785
  >
@@ -1621,6 +1623,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1621
1623
  if (sortField && sortField !== SortField.default) {
1622
1624
  this.defaultSortField = sortField;
1623
1625
  this.defaultSortDirection = dir;
1626
+ this.defaultSortParam = {
1627
+ field: this.defaultSortField,
1628
+ direction: this.defaultSortDirection,
1629
+ };
1624
1630
  }
1625
1631
  }
1626
1632
  /**
@@ -1846,6 +1852,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1846
1852
  .resizeObserver=${this.resizeObserver}
1847
1853
  .collectionNameCache=${this.collectionNameCache}
1848
1854
  .sortParam=${this.sortParam}
1855
+ .defaultSortParam=${this.defaultSortParam}
1849
1856
  .creatorFilter=${this.selectedCreatorFilter}
1850
1857
  .mobileBreakpoint=${this.mobileBreakpoint}
1851
1858
  .loggedIn=${this.loggedIn}
@@ -2267,6 +2274,9 @@ __decorate([
2267
2274
  __decorate([
2268
2275
  property({ type: Object })
2269
2276
  ], CollectionBrowser.prototype, "sortParam", void 0);
2277
+ __decorate([
2278
+ property({ type: Object })
2279
+ ], CollectionBrowser.prototype, "defaultSortParam", void 0);
2270
2280
  __decorate([
2271
2281
  property({ type: String })
2272
2282
  ], CollectionBrowser.prototype, "selectedSort", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"collection-browser.js","sourceRoot":"","sources":["../../src/collection-browser.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,OAAO,EACL,IAAI,EACJ,GAAG,EACH,UAAU,EAGV,OAAO,GACR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAOvD,OAAO,EAIL,gBAAgB,EAEhB,gBAAgB,EAIhB,UAAU,GAGX,MAAM,iCAAiC,CAAC;AAKzC,OAAO,oCAAoC,CAAC;AAK5C,OAAO,yBAAyB,CAAC;AACjC,OAAO,yCAAyC,CAAC;AACjD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAEL,SAAS,EAET,wBAAwB,EAMxB,2BAA2B,EAE3B,uBAAuB,EACvB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,uBAAuB,GAExB,MAAM,6BAA6B,CAAC;AACrC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAErD,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,E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AAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAkD;AAG7E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAC8B;AAE7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAA8C;AAK5C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAsB;AAazC;IAAR,KAAK,EAAE;wDAAgD;AAK/C;IAAR,KAAK,EAAE;+DAAsC;AAErC;IAAR,KAAK,EAAE;wDAA+B;AAE9B;IAAR,KAAK,EAAE;qEAA4C;AAE3C;IAAR,KAAK,EAAE;uDAAoD;AAEnD;IAAR,KAAK,EAAE;wEAAgE;AAE/D;IAAR,KAAK,EAAE;uDAA+B;AAE9B;IAAR,KAAK,EAAE;4DAAoC;AAEnC;IAAR,KAAK,EAAE;qDAA4B;AAE3B;IAAR,KAAK,EAAE;8DAAqC;AAEpC;IAAR,KAAK,EAAE;uDAA+B;AAE9B;IAAR,KAAK,EAAE;2DACc;AAEb;IAAR,KAAK,EAAE;+DAA2D;AAE1D;IAAR,KAAK,EAAE;0DAAiD;AAEhD;IAAR,KAAK,EAAE;+DAED;AAEsB;IAA5B,KAAK,CAAC,oBAAoB,CAAC;2DAA2C;AAEhD;IAAtB,KAAK,CAAC,cAAc,CAAC;qDAAqC;AAE/B;IAA3B,KAAK,CAAC,mBAAmB,CAAC;2DAA6C;AAGxE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2DACQ;AAuErD;IADC,KAAK,CAAC,mBAAmB,CAAC;2DACiB;AA/MjC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAqmF7B;SArmFY,iBAAiB","sourcesContent":["/* eslint-disable import/no-duplicates */\nimport {\n html,\n css,\n LitElement,\n PropertyValues,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';\nimport type {\n InfiniteScroller,\n InfiniteScrollerCellProviderInterface,\n} from '@internetarchive/infinite-scroller';\nimport {\n Aggregation,\n Bucket,\n CollectionExtraInfo,\n FilterConstraint,\n FilterMap,\n FilterMapBuilder,\n SearchParams,\n SearchResult,\n SearchServiceInterface,\n SearchType,\n SortDirection,\n SortParam,\n} from '@internetarchive/search-service';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/infinite-scroller';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { ModalManagerInterface } from '@internetarchive/modal-manager';\nimport type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-feedback';\nimport type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';\nimport './tiles/tile-dispatcher';\nimport './tiles/collection-browser-loading-tile';\nimport './sort-filter-bar/sort-filter-bar';\nimport './manage/manage-bar';\nimport './collection-facets';\nimport './circular-activity-indicator';\nimport {\n SelectedFacets,\n SortField,\n CollectionBrowserContext,\n getDefaultSelectedFacets,\n TileModel,\n CollectionDisplayMode,\n FacetBucket,\n PrefixFilterType,\n PrefixFilterCounts,\n prefixFilterAggregationKeys,\n FacetEventDetails,\n sortOptionFromAPIString,\n SORT_OPTIONS,\n} from './models';\nimport {\n RestorationStateHandlerInterface,\n RestorationStateHandler,\n RestorationState,\n} from './restoration-state-handler';\nimport chevronIcon from './assets/img/icons/chevron';\nimport type { PlaceholderType } from './empty-placeholder';\nimport './empty-placeholder';\n\nimport {\n analyticsActions,\n analyticsCategories,\n} from './utils/analytics-events';\nimport { srOnlyStyle } from './styles/sr-only';\nimport { sha1 } from './utils/sha1';\nimport type { CollectionFacets } from './collection-facets';\nimport type { ManageableItem } from './manage/manage-bar';\nimport { formatDate } from './utils/format-date';\n\ntype RequestKind = 'full' | 'hits' | 'aggregations';\n\n@customElement('collection-browser')\nexport class CollectionBrowser\n extends LitElement\n implements\n InfiniteScrollerCellProviderInterface,\n SharedResizeObserverResizeHandlerInterface\n{\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl: string = 'https://archive.org';\n\n @property({ type: Object }) searchService?: SearchServiceInterface;\n\n @property({ type: String }) searchType: SearchType = SearchType.METADATA;\n\n @property({ type: String }) withinCollection?: string;\n\n @property({ type: String }) baseQuery?: string;\n\n @property({ type: String }) displayMode?: CollectionDisplayMode;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: String }) selectedSort: SortField = SortField.default;\n\n @property({ type: String }) selectedTitleFilter: string | null = null;\n\n @property({ type: String }) selectedCreatorFilter: string | null = null;\n\n @property({ type: String }) sortDirection: SortDirection | null = null;\n\n @property({ type: Number }) pageSize = 50;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Number }) currentPage?: number;\n\n @property({ type: String }) minSelectedDate?: string;\n\n @property({ type: String }) maxSelectedDate?: string;\n\n @property({ type: Object }) selectedFacets?: SelectedFacets;\n\n @property({ type: Boolean }) showHistogramDatePicker = false;\n\n @property({ type: String }) collectionPagePath: string = '/details/';\n\n @property({ type: Object }) collectionInfo?: CollectionExtraInfo;\n\n @property({ type: Array }) parentCollections: string[] = [];\n\n /** describes where this component is being used */\n @property({ type: String, reflect: true }) searchContext: string =\n analyticsCategories.default;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: String }) pageContext: CollectionBrowserContext = 'search';\n\n @property({ type: Object })\n restorationStateHandler: RestorationStateHandlerInterface = new RestorationStateHandler(\n {\n context: this.pageContext,\n }\n );\n\n @property({ type: Number }) mobileBreakpoint = 600;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Object }) modalManager?: ModalManagerInterface = undefined;\n\n @property({ type: Object })\n featureFeedbackService?: FeatureFeedbackServiceInterface;\n\n @property({ type: Object }) recaptchaManager?: RecaptchaManagerInterface;\n\n /**\n * If item management UI active\n */\n @property({ type: Boolean }) isManageView = false;\n\n /**\n * The page that the consumer wants to load.\n */\n private initialPageNumber = 1;\n\n /**\n * This the the number of pages that we want to show.\n *\n * The data isn't necessarily loaded for all of the pages, but this lets us\n * know how many cells we should render.\n */\n @state() private pagesToRender = this.initialPageNumber;\n\n /**\n * Whether the initial page fetch for a new query is currently in progress.\n */\n @state() private searchResultsLoading = false;\n\n @state() private facetsLoading = false;\n\n @state() private fullYearAggregationLoading = false;\n\n @state() private aggregations?: Record<string, Aggregation>;\n\n @state() private fullYearsHistogramAggregation: Aggregation | undefined;\n\n @state() private totalResults?: number;\n\n @state() private queryErrorMessage?: string;\n\n @state() private mobileView = false;\n\n @state() private mobileFacetsVisible = false;\n\n @state() private contentWidth?: number;\n\n @state() private defaultSortField: Exclude<SortField, SortField.default> =\n SortField.relevance;\n\n @state() private defaultSortDirection: SortDirection | null = null;\n\n @state() private placeholderType: PlaceholderType = null;\n\n @state() private prefixFilterCountMap: Partial<\n Record<PrefixFilterType, PrefixFilterCounts>\n > = {};\n\n @query('#content-container') private contentContainer!: HTMLDivElement;\n\n @query('#left-column') private leftColumn?: HTMLDivElement;\n\n @query('collection-facets') private collectionFacets?: CollectionFacets;\n\n @property({ type: Object, attribute: false })\n private analyticsHandler?: AnalyticsManagerInterface;\n\n /**\n * When we're animated scrolling to the page, we don't want to fetch\n * all of the pages as it scrolls so this lets us know if we're scrolling\n */\n private isScrollingToCell = false;\n\n /**\n * When we've reached the end of the data, stop trying to fetch more\n */\n private endOfDataReached = false;\n\n /**\n * When page width resizes from desktop to mobile, set true to\n * disable expand/collapse transition when loading.\n */\n private isResizeToMobile = false;\n\n private leftColIntersectionObserver?: IntersectionObserver;\n\n private facetsIntersectionObserver?: IntersectionObserver;\n\n private placeholderCellTemplate = html`<collection-browser-loading-tile></collection-browser-loading-tile>`;\n\n private tileModelAtCellIndex(index: number): TileModel | undefined {\n const offsetIndex = index + this.tileModelOffset;\n const pageNumber = Math.floor(offsetIndex / this.pageSize) + 1;\n const itemIndex = offsetIndex % this.pageSize;\n const model = this.dataSource[pageNumber]?.[itemIndex];\n /**\n * If we encounter a model we don't have yet and we're not in the middle of an\n * automated scroll, fetch the page and just return undefined.\n * The datasource will be updated once the page is loaded and the cell will be rendered.\n *\n * We disable it during the automated scroll since we may fetch pages for cells the\n * user may never see.\n */\n if (!model && !this.isScrollingToCell) {\n this.fetchPage(pageNumber);\n }\n return model;\n }\n\n private get sortFilterQueries(): string {\n const queries = [this.titleQuery, this.creatorQuery];\n return queries.filter(q => q).join(' AND ');\n }\n\n // this is the total number of tiles we expect if\n // the data returned is a full page worth\n // this is useful for putting in placeholders for the expected number of tiles\n private get estimatedTileCount(): number {\n return this.pagesToRender * this.pageSize;\n }\n\n /**\n * The results per page so we can paginate.\n *\n * This allows us to start in the middle of the search results and\n * fetch data before or after the current page. If we don't have a key\n * for the previous/next page, we'll fetch the next/previous page to populate it\n */\n private dataSource: Record<string, TileModel[]> = {};\n\n /**\n * How many tiles to offset the data source by, to account for any removed tiles.\n */\n private tileModelOffset = 0;\n\n @query('infinite-scroller')\n private infiniteScroller!: InfiniteScroller;\n\n private sessionIdGenPromise?: Promise<string>;\n\n /**\n * Returns a promise resolving to a unique string that persists for the current browser session.\n * Used in generating unique IDs for search requests, so that multiple requests coming from the\n * same browser session can be identified.\n */\n private async getSessionId(): Promise<string> {\n try {\n const storedSessionId = sessionStorage?.getItem('cb-session');\n if (storedSessionId) {\n return storedSessionId;\n }\n\n // If we enter this method a second time while a first session ID is already being generated,\n // ensure we produce the same ID from both calls instead of generating another one.\n if (this.sessionIdGenPromise) {\n return this.sessionIdGenPromise;\n }\n\n this.sessionIdGenPromise = sha1(Math.random().toString());\n const newSessionId = await this.sessionIdGenPromise;\n\n sessionStorage?.setItem('cb-session', newSessionId);\n return newSessionId;\n } catch (err) {\n // Either we can't generate the hash or we're restricted from accessing sessionStorage\n return '';\n }\n }\n\n /**\n * Go to the given page of results\n *\n * @param pageNumber\n */\n goToPage(pageNumber: number) {\n this.initialPageNumber = pageNumber;\n this.pagesToRender = pageNumber;\n return this.scrollToPage(pageNumber);\n }\n\n /**\n * Clears all selected/negated facets, date ranges, and letter filters.\n *\n * By default, the current sort field/direction are not cleared,\n * but this can be overridden by setting the `sort` option to `true`.\n *\n * Similarly, it is possible to finely control what is cleared by\n * setting any of the `facets`, `dateRange`, or `letterFilters` flags\n * in the options object.\n */\n clearFilters({\n facets = true,\n dateRange = true,\n letterFilters = true,\n sort = false,\n } = {}): void {\n // Don't bother clearing facets if none are checked, so that we don't\n // trigger unnecessary update cycles.\n if (facets && this.hasCheckedFacets) {\n this.selectedFacets = getDefaultSelectedFacets();\n }\n\n if (dateRange) {\n this.minSelectedDate = undefined;\n this.maxSelectedDate = undefined;\n }\n\n if (letterFilters) {\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = null;\n }\n\n if (sort) {\n this.sortParam = null;\n this.sortDirection = null;\n this.selectedSort = SortField.default;\n }\n }\n\n /**\n * Returns true if the current value of `this.selectedFacets` contains\n * any facet buckets than have been selected or negated, or false otherwise.\n */\n private get hasCheckedFacets(): boolean {\n if (!this.selectedFacets) return false;\n\n for (const facetGroup of Object.values(this.selectedFacets)) {\n for (const bucket of Object.values(facetGroup)) {\n if (bucket.state !== 'none') return true;\n }\n }\n\n return false;\n }\n\n /**\n * Returns true if there are any currently selected/negated facet buckets,\n * any selected date range, or any selected letter filters. False otherwise.\n *\n * Ignores sorting options.\n */\n private get hasActiveFilters(): boolean {\n return !!(\n this.hasCheckedFacets ||\n this.minSelectedDate ||\n this.maxSelectedDate ||\n this.selectedTitleFilter ||\n this.selectedCreatorFilter\n );\n }\n\n render() {\n this.setPlaceholderType();\n return html`\n <div\n id=\"content-container\"\n class=${this.mobileView ? 'mobile' : 'desktop'}\n >\n ${this.placeholderType\n ? this.emptyPlaceholderTemplate\n : this.collectionBrowserTemplate}\n </div>\n `;\n }\n\n private setPlaceholderType() {\n const hasQuery = !!this.baseQuery?.trim();\n const isCollection = !!this.withinCollection;\n const noResults =\n !this.searchResultsLoading &&\n (this.totalResults === 0 || !this.searchService);\n\n this.placeholderType = null;\n if (!hasQuery && !isCollection) {\n this.placeholderType = 'empty-query';\n } else if (noResults) {\n // Within a collection, no query + no results means the collection simply has no viewable items.\n // Otherwise, we must have a user query that produced 0 results.\n this.placeholderType =\n !hasQuery && isCollection ? 'empty-collection' : 'no-results';\n }\n\n if (this.queryErrorMessage) {\n this.placeholderType =\n !hasQuery && isCollection ? 'collection-error' : 'query-error';\n }\n }\n\n private get emptyPlaceholderTemplate() {\n return html`\n <empty-placeholder\n .placeholderType=${this.placeholderType}\n ?isMobileView=${this.mobileView}\n ?isCollection=${!!this.withinCollection}\n .detailMessage=${this.queryErrorMessage ?? ''}\n .baseNavigationUrl=${this.baseNavigationUrl}\n ></empty-placeholder>\n ${this.infiniteScrollerTemplate}\n `;\n }\n\n /**\n * Top-level template for rendering the left (facets) and right (results) columns.\n */\n private get collectionBrowserTemplate() {\n return html`\n <div id=\"left-column-scroll-sentinel\"></div>\n ${this.leftColumnTemplate} ${this.rightColumnTemplate}\n `;\n }\n\n /**\n * Template for either the mobile or desktop version of the left column, depending\n * on current component state.\n */\n private get leftColumnTemplate(): TemplateResult {\n if (this.mobileView) {\n return this.mobileLeftColumnTemplate;\n }\n return this.desktopLeftColumnTemplate;\n }\n\n /**\n * Template for the mobile version of the \"left column\" (which in this case, appears\n * *above* the search results rather than beside them), for rendering the\n * accordion-style facets.\n */\n private get mobileLeftColumnTemplate(): TemplateResult {\n return html`\n <div\n id=\"left-column\"\n class=\"column${this.isResizeToMobile ? ' preload' : ''}\"\n >\n ${this.resultsCountTemplate}\n <div id=\"facets-header-container\">${this.mobileFacetsTemplate}</div>\n </div>\n `;\n }\n\n /**\n * Template for the desktop version of the left column, displaying the facets sidebar.\n */\n private get desktopLeftColumnTemplate(): TemplateResult {\n return html`\n <div id=\"left-column\" class=\"column\">\n <div id=\"facets-header-container\">\n <h2 id=\"facets-header\" class=\"sr-only\">Filters</h2>\n ${this.resultsCountTemplate} ${this.clearFiltersBtnTemplate(false)}\n </div>\n <div id=\"facets-container\" aria-labelledby=\"facets-header\">\n ${this.facetsTemplate}\n <div id=\"facets-scroll-sentinel\"></div>\n </div>\n <div id=\"facets-bottom-fade\"></div>\n </div>\n `;\n }\n\n /**\n * Template for the \"X Results\" count at the top of the search results.\n * Changes to the \"Searching...\" label if the search results are still loading.\n */\n private get resultsCountTemplate(): TemplateResult {\n const shouldShowSearching =\n this.searchResultsLoading || this.totalResults === undefined;\n const resultsCount = this.totalResults?.toLocaleString();\n const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';\n\n return html`\n <div id=\"results-total\">\n <span id=\"big-results-count\">\n ${shouldShowSearching ? html`Searching&hellip;` : resultsCount}\n </span>\n <span id=\"big-results-label\">\n ${shouldShowSearching ? nothing : resultsLabel}\n </span>\n </div>\n `;\n }\n\n /**\n * Template for the right column of the collection browser, where the result\n * tiles and sort/filter bar are shown.\n */\n private get rightColumnTemplate(): TemplateResult {\n return html`\n <div id=\"right-column\" class=\"column\">\n ${this.isManageView\n ? this.manageBarTemplate\n : this.sortFilterBarTemplate}\n ${this.displayMode === `list-compact`\n ? this.listHeaderTemplate\n : nothing}\n ${this.infiniteScrollerTemplate}\n </div>\n `;\n }\n\n private get infiniteScrollerTemplate() {\n return html`<infinite-scroller\n class=${this.infiniteScrollerClasses}\n itemCount=${this.placeholderType ? 0 : nothing}\n ariaLandmarkLabel=\"Search results\"\n .cellProvider=${this}\n .placeholderCellTemplate=${this.placeholderCellTemplate}\n @scrollThresholdReached=${this.scrollThresholdReached}\n @visibleCellsChanged=${this.visibleCellsChanged}\n ></infinite-scroller>`;\n }\n\n private get infiniteScrollerClasses() {\n return classMap({\n [this.displayMode ?? '']: !!this.displayMode,\n hidden: !!this.placeholderType,\n });\n }\n\n private get sortFilterBarTemplate() {\n return html`\n <sort-filter-bar\n .defaultSortField=${this.defaultSortField}\n .defaultSortDirection=${this.defaultSortDirection}\n .selectedSort=${this.selectedSort}\n .sortDirection=${this.sortDirection}\n .showRelevance=${this.isRelevanceSortAvailable}\n .showDateFavorited=${this.withinCollection?.startsWith('fav-')}\n .displayMode=${this.displayMode}\n .selectedTitleFilter=${this.selectedTitleFilter}\n .selectedCreatorFilter=${this.selectedCreatorFilter}\n .prefixFilterCountMap=${this.prefixFilterCountMap}\n .resizeObserver=${this.resizeObserver}\n @sortChanged=${this.userChangedSort}\n @displayModeChanged=${this.displayModeChanged}\n @titleLetterChanged=${this.titleLetterSelected}\n @creatorLetterChanged=${this.creatorLetterSelected}\n >\n </sort-filter-bar>\n `;\n }\n\n private get manageBarTemplate(): TemplateResult {\n return html`\n <manage-bar\n showSelectAll\n showUnselectAll\n @removeItems=${this.handleRemoveItems}\n @selectAll=${this.checkAllTiles}\n @unselectAll=${this.uncheckAllTiles}\n @cancel=${() => {\n this.isManageView = false;\n this.uncheckAllTiles();\n }}\n ></manage-bar>\n `;\n }\n\n /**\n * Handler for when the user requests to remove all checked items via the manage bar.\n * Emits an `itemRemovalRequested` event with all checked tile models.\n */\n private handleRemoveItems(): void {\n this.dispatchEvent(\n new CustomEvent<{ items: ManageableItem[] }>('itemRemovalRequested', {\n detail: {\n items: this.checkedTileModels.map(model => ({\n ...model,\n date: formatDate(model.datePublished, 'long'),\n })),\n },\n })\n );\n }\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void {\n // To make sure our data source remains page-aligned, we will offset our data source by\n // the number of removed tiles, so that we can just add the offset when the infinite\n // scroller queries for cell contents.\n // This only matters while we're still viewing the same set of results. If the user changes\n // their query/filters/sort, then the data source is overwritten and the offset cleared.\n const { checkedTileModels, uncheckedTileModels } = this;\n const numChecked = checkedTileModels.length;\n if (numChecked === 0) return;\n this.tileModelOffset += numChecked;\n\n const newDataSource: typeof this.dataSource = {};\n\n // Which page the remaining tile models start on, post-offset\n let offsetPageNumber = Math.floor(this.tileModelOffset / this.pageSize) + 1;\n let indexOnPage = this.tileModelOffset % this.pageSize;\n\n // Fill the pages up to that point with empty models\n for (let page = 1; page <= offsetPageNumber; page += 1) {\n const remainingHidden = this.tileModelOffset - this.pageSize * (page - 1);\n const offsetCellsOnPage = Math.min(this.pageSize, remainingHidden);\n newDataSource[page] = Array(offsetCellsOnPage).fill(undefined);\n }\n\n // Shift all the remaining tiles into their new positions in the data source\n for (const model of uncheckedTileModels) {\n if (!newDataSource[offsetPageNumber])\n newDataSource[offsetPageNumber] = [];\n newDataSource[offsetPageNumber].push(model);\n indexOnPage += 1;\n if (indexOnPage >= this.pageSize) {\n offsetPageNumber += 1;\n indexOnPage = 0;\n }\n }\n\n // Swap in the new data source and update the infinite scroller\n this.dataSource = newDataSource;\n if (this.totalResults) this.totalResults -= numChecked;\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount -= numChecked;\n this.infiniteScroller.refreshAllVisibleCells();\n }\n }\n\n /**\n * Checks every tile's management checkbox\n */\n checkAllTiles(): void {\n this.mapDataSource(model => ({ ...model, checked: true }));\n }\n\n /**\n * Unchecks every tile's management checkbox\n */\n uncheckAllTiles(): void {\n this.mapDataSource(model => ({ ...model, checked: false }));\n }\n\n /**\n * Applies the given map function to all of the tile models in every page of the data\n * source. This method updates the data source object in immutable fashion.\n *\n * @param mapFn A callback function to apply on each tile model, as with Array.map\n */\n private mapDataSource(\n mapFn: (model: TileModel, index: number, array: TileModel[]) => TileModel\n ): void {\n this.dataSource = Object.fromEntries(\n Object.entries(this.dataSource).map(([page, tileModels]) => [\n page,\n tileModels.map((model, index, array) =>\n model ? mapFn(model, index, array) : model\n ),\n ])\n );\n this.infiniteScroller?.refreshAllVisibleCells();\n }\n\n /**\n * An array of all the tile models whose management checkboxes are checked\n */\n get checkedTileModels(): TileModel[] {\n return this.getFilteredTileModels(model => model.checked);\n }\n\n /**\n * An array of all the tile models whose management checkboxes are unchecked\n */\n get uncheckedTileModels(): TileModel[] {\n return this.getFilteredTileModels(model => !model.checked);\n }\n\n /**\n * Returns a flattened, filtered array of all the tile models in the data source\n * for which the given predicate returns a truthy value.\n *\n * @param predicate A callback function to apply on each tile model, as with Array.filter\n * @returns A filtered array of tile models satisfying the predicate\n */\n private getFilteredTileModels(\n predicate: (model: TileModel, index: number, array: TileModel[]) => unknown\n ): TileModel[] {\n return Object.values(this.dataSource)\n .flat()\n .filter((model, index, array) =>\n model ? predicate(model, index, array) : false\n );\n }\n\n private userChangedSort(\n e: CustomEvent<{\n selectedSort: SortField;\n sortDirection: SortDirection | null;\n }>\n ) {\n const { selectedSort, sortDirection } = e.detail;\n this.selectedSort = selectedSort;\n this.sortDirection = sortDirection;\n\n if ((this.currentPage ?? 1) > 1) {\n this.goToPage(1);\n }\n this.currentPage = 1;\n }\n\n private sendSortByAnalytics(prevSortDirection: SortDirection | null): void {\n const directionCleared = prevSortDirection && !this.sortDirection;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.sortBy,\n label: `${this.selectedSort}${\n this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''\n }`,\n });\n }\n\n private selectedSortChanged(): void {\n const sortOption = SORT_OPTIONS[this.selectedSort];\n if (!sortOption.handledBySearchService) {\n this.sortParam = null;\n return;\n }\n\n // If the sort option specified in the URL is unrecognized, we just use it as-is\n const urlSortParam = new URL(window.location.href).searchParams.get('sort');\n const sortField =\n sortOption.searchServiceKey ?? urlSortParam?.replace(/^-/, '');\n\n // If the sort direction is still null at this point, then we assume ascending\n // (i.e., it was unrecognized and had no directional flag)\n if (!this.sortDirection) this.sortDirection = 'asc';\n\n if (!sortField) return;\n this.sortParam = { field: sortField, direction: this.sortDirection };\n\n // Lazy-load the alphabet counts for title/creator sort bar as needed\n this.updatePrefixFiltersForCurrentSort();\n }\n\n private displayModeChanged(\n e: CustomEvent<{ displayMode?: CollectionDisplayMode }>\n ): void {\n this.displayMode = e.detail.displayMode;\n\n if (this.displayMode) {\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.displayMode,\n label: this.displayMode,\n });\n }\n }\n\n /**\n * Returns a query clause identifying the currently selected title filter,\n * e.g., `firstTitle:X`.\n */\n private get titleQuery(): string | undefined {\n return this.selectedTitleFilter\n ? `firstTitle:${this.selectedTitleFilter}`\n : undefined;\n }\n\n /**\n * Returns a query clause identifying the currently selected creator filter,\n * e.g., `firstCreator:X`.\n */\n private get creatorQuery(): string | undefined {\n return this.selectedCreatorFilter\n ? `firstCreator:${this.selectedCreatorFilter}`\n : undefined;\n }\n\n /**\n * Send Analytics when sorting by title's first letter\n * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'\n */\n private sendFilterByTitleAnalytics(prevSelectedLetter: string | null): void {\n if (!prevSelectedLetter && !this.selectedTitleFilter) {\n return;\n }\n const cleared = prevSelectedLetter && !this.selectedTitleFilter;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.filterByTitle,\n label: cleared\n ? `clear-${prevSelectedLetter}`\n : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,\n });\n }\n\n /**\n * Send Analytics when filtering by creator's first letter\n * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'\n */\n private sendFilterByCreatorAnalytics(\n prevSelectedLetter: string | null\n ): void {\n if (!prevSelectedLetter && !this.selectedCreatorFilter) {\n return;\n }\n const cleared = prevSelectedLetter && !this.selectedCreatorFilter;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.filterByCreator,\n label: cleared\n ? `clear-${prevSelectedLetter}`\n : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,\n });\n }\n\n /**\n * Handler for changes to which letter is selected in the title alphabet bar.\n */\n private titleLetterSelected(\n e: CustomEvent<{ selectedLetter: string | null }>\n ): void {\n this.selectedCreatorFilter = null;\n this.selectedTitleFilter = e.detail.selectedLetter;\n }\n\n /**\n * Handler for changes to which letter is selected in the creator alphabet bar.\n */\n private creatorLetterSelected(\n e: CustomEvent<{ selectedLetter: string | null }>\n ): void {\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = e.detail.selectedLetter;\n }\n\n /**\n * The full template for how the facets should be structured in mobile view,\n * including the collapsible container (with header) and the facets themselves.\n */\n private get mobileFacetsTemplate(): TemplateResult {\n const toggleFacetsVisible = () => {\n this.isResizeToMobile = false;\n this.mobileFacetsVisible = !this.mobileFacetsVisible;\n };\n\n return html`\n <details\n id=\"mobile-filter-collapse\"\n @click=${toggleFacetsVisible}\n @keyup=${toggleFacetsVisible}\n >\n <summary>\n <span class=\"collapser-icon\">${chevronIcon}</span>\n <h2>Filters</h2>\n ${this.clearFiltersBtnTemplate(true)}\n </summary>\n ${this.facetsTemplate}\n </details>\n `;\n }\n\n /**\n * The template for the facets component alone, without any surrounding wrappers.\n */\n private get facetsTemplate() {\n return html`\n <collection-facets\n @facetsChanged=${this.facetsChanged}\n @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}\n .collectionPagePath=${this.collectionPagePath}\n .parentCollections=${this.parentCollections}\n .withinCollection=${this.withinCollection}\n .searchService=${this.searchService}\n .featureFeedbackService=${this.featureFeedbackService}\n .recaptchaManager=${this.recaptchaManager}\n .resizeObserver=${this.resizeObserver}\n .searchType=${this.searchType}\n .aggregations=${this.aggregations}\n .fullYearsHistogramAggregation=${this.fullYearsHistogramAggregation}\n .minSelectedDate=${this.minSelectedDate}\n .maxSelectedDate=${this.maxSelectedDate}\n .selectedFacets=${this.selectedFacets}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .collectionNameCache=${this.collectionNameCache}\n .showHistogramDatePicker=${this.showHistogramDatePicker}\n .allowExpandingDatePicker=${!this.mobileView}\n .contentWidth=${this.contentWidth}\n .query=${this.baseQuery}\n .filterMap=${this.filterMap}\n .isManageView=${this.isManageView}\n .modalManager=${this.modalManager}\n ?collapsableFacets=${this.mobileView}\n ?facetsLoading=${this.facetsLoading}\n ?fullYearAggregationLoading=${this.facetsLoading}\n @facetClick=${this.facetClickHandler}\n .analyticsHandler=${this.analyticsHandler}\n >\n </collection-facets>\n `;\n }\n\n /**\n * The HTML template for the \"Clear all filters\" button, or `nothing` if no\n * filters are currently active.\n *\n * @param mobile Whether to style/shorten the button for mobile view\n */\n private clearFiltersBtnTemplate(\n mobile: boolean\n ): TemplateResult | typeof nothing {\n if (!this.hasActiveFilters) return nothing;\n\n const buttonClasses = classMap({\n 'clear-filters-btn': true,\n mobile,\n });\n\n const buttonText = mobile ? 'Clear all' : 'Clear all filters';\n\n return html`\n <div class=\"clear-filters-btn-row\">\n ${mobile\n ? html`<span class=\"clear-filters-btn-separator\">&nbsp;</span>`\n : nothing}\n <button class=${buttonClasses} @click=${this.clearFilters}>\n ${buttonText}\n </button>\n </div>\n `;\n }\n\n private get loadingTemplate() {\n return html`\n <div class=\"loading-cover\">\n <circular-activity-indicator></circular-activity-indicator>\n </div>\n `;\n }\n\n private get listHeaderTemplate() {\n return html`\n <div id=\"list-header\">\n <tile-dispatcher\n .tileDisplayMode=${'list-header'}\n .resizeObserver=${this.resizeObserver}\n .sortParam=${this.sortParam}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .loggedIn=${this.loggedIn}\n >\n </tile-dispatcher>\n </div>\n `;\n }\n\n private histogramDateRangeUpdated(\n e: CustomEvent<{\n minDate: string;\n maxDate: string;\n }>\n ) {\n const { minDate, maxDate } = e.detail;\n [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.histogramChanged,\n label: this.dateRangeQueryClause,\n });\n }\n\n private get dateRangeQueryClause() {\n if (!this.minSelectedDate || !this.maxSelectedDate) {\n return undefined;\n }\n\n return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;\n }\n\n /**\n * Emits an event indicating a change in whether the manage mode is shown.\n */\n private emitManageModeChangedEvent(): void {\n this.dispatchEvent(\n new CustomEvent<boolean>('manageModeChanged', {\n detail: this.isManageView,\n })\n );\n }\n\n firstUpdated(): void {\n this.setupStateRestorationObserver();\n this.restoreState();\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('placeholderType') && this.placeholderType === null) {\n if (!this.leftColIntersectionObserver) {\n this.setupLeftColumnScrollListeners();\n }\n if (!this.facetsIntersectionObserver) {\n this.setupFacetsScrollListeners();\n }\n this.updateLeftColumnHeight();\n }\n\n if (\n changed.has('displayMode') ||\n changed.has('baseNavigationUrl') ||\n changed.has('baseImageUrl') ||\n changed.has('loggedIn')\n ) {\n this.infiniteScroller?.reload();\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('searchType') ||\n changed.has('withinCollection')\n ) {\n // Unless this query/search type update is from the initial page load or the\n // result of hitting the back button,\n // we need to clear any existing filters since they may no longer be valid for\n // the new set of search results.\n if (!this.historyPopOccurred && this.initialQueryChangeHappened) {\n // Ordinarily, we leave the sort param unchanged between searches.\n // However, if we are changing the target collection itself, we want the sort cleared too,\n // since different collections may have different sorting options available.\n const shouldClearSort =\n changed.has('withinCollection') &&\n !changed.has('selectedSort') &&\n !changed.has('sortDirection');\n\n // Otherwise, only clear filters that haven't been simultaneously applied in this update\n this.clearFilters({\n sort: shouldClearSort,\n facets: !changed.has('selectedFacets'),\n dateRange: !(\n changed.has('minSelectedDate') || changed.has('maxSelectedDate')\n ),\n letterFilters: !(\n changed.has('selectedTitleFilter') ||\n changed.has('selectedCreatorFilter')\n ),\n });\n }\n }\n\n if (changed.has('baseQuery')) {\n this.emitBaseQueryChanged();\n }\n if (changed.has('searchType')) {\n this.emitSearchTypeChanged();\n }\n\n if (changed.has('currentPage') || changed.has('displayMode')) {\n this.persistState();\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('minSelectedDate') ||\n changed.has('maxSelectedDate') ||\n changed.has('selectedFacets') ||\n changed.has('searchService') ||\n changed.has('withinCollection')\n ) {\n this.refreshLetterCounts();\n }\n\n if (changed.has('selectedSort') || changed.has('sortDirection')) {\n const prevSortDirection = changed.get('sortDirection') as SortDirection;\n this.sendSortByAnalytics(prevSortDirection);\n this.selectedSortChanged();\n }\n\n if (changed.has('selectedTitleFilter')) {\n this.sendFilterByTitleAnalytics(\n changed.get('selectedTitleFilter') as string\n );\n }\n if (changed.has('selectedCreatorFilter')) {\n this.sendFilterByCreatorAnalytics(\n changed.get('selectedCreatorFilter') as string\n );\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('searchType') ||\n changed.has('selectedTitleFilter') ||\n changed.has('selectedCreatorFilter') ||\n changed.has('minSelectedDate') ||\n changed.has('maxSelectedDate') ||\n changed.has('sortParam') ||\n changed.has('selectedFacets') ||\n changed.has('searchService') ||\n changed.has('withinCollection')\n ) {\n this.handleQueryChange();\n }\n\n if (changed.has('searchResultsLoading')) {\n this.emitSearchResultsLoadingChanged();\n }\n\n if (\n changed.has('facetsLoading') &&\n this.facetsLoading &&\n this.collectionFacets\n ) {\n this.collectionFacets.moreLinksVisible =\n this.searchType !== SearchType.FULLTEXT;\n }\n\n if (changed.has('pagesToRender')) {\n if (!this.endOfDataReached && this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.estimatedTileCount;\n }\n }\n\n if (changed.has('isManageView')) {\n if (this.isManageView) this.displayMode = 'grid';\n this.infiniteScroller?.refreshAllVisibleCells();\n this.emitManageModeChangedEvent();\n }\n\n if (changed.has('resizeObserver')) {\n const oldObserver = changed.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n if (oldObserver) this.disconnectResizeObserver(oldObserver);\n this.setupResizeObserver();\n }\n }\n\n disconnectedCallback(): void {\n if (this.resizeObserver) {\n this.disconnectResizeObserver(this.resizeObserver);\n }\n if (this.boundNavigationHandler) {\n window.removeEventListener('popstate', this.boundNavigationHandler);\n }\n\n this.leftColIntersectionObserver?.disconnect();\n this.facetsIntersectionObserver?.disconnect();\n window.removeEventListener('resize', this.updateLeftColumnHeight);\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n const previousView = this.mobileView;\n if (entry.target === this.contentContainer) {\n this.contentWidth = entry.contentRect.width;\n this.mobileView =\n this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;\n // If changing from desktop to mobile disable transition\n if (this.mobileView && !previousView) {\n this.isResizeToMobile = true;\n }\n }\n\n // Ensure the facet sidebar remains sized correctly\n this.updateLeftColumnHeight();\n }\n\n /**\n * Sets up listeners for events that may require updating the left column height.\n */\n private setupLeftColumnScrollListeners(): void {\n // We observe intersections between the left column's scroll sentinel and\n // the viewport, so that we can ensure the left column is always sized to\n // match the _available_ viewport height. This should generally be more\n // performant than listening to scroll events on the page or column.\n const leftColumnSentinel = this.shadowRoot?.querySelector(\n '#left-column-scroll-sentinel'\n );\n if (leftColumnSentinel) {\n this.leftColIntersectionObserver = new IntersectionObserver(\n this.updateLeftColumnHeight,\n {\n threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%\n }\n );\n this.leftColIntersectionObserver.observe(leftColumnSentinel);\n }\n\n // We also listen for window resize events, as they are not always captured\n // by the resize observer and can affect the desired height of the left column.\n window.addEventListener('resize', this.updateLeftColumnHeight);\n }\n\n /**\n * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.\n * Note this uses a separate IntersectionObserver from the left column, because we\n * don't need granular intersection thresholds for this.\n */\n private setupFacetsScrollListeners(): void {\n const facetsSentinel = this.shadowRoot?.querySelector(\n '#facets-scroll-sentinel'\n );\n if (facetsSentinel) {\n this.facetsIntersectionObserver = new IntersectionObserver(\n this.updateFacetFadeOut\n );\n this.facetsIntersectionObserver.observe(facetsSentinel);\n }\n }\n\n /**\n * Updates the height of the left column according to its position on the page.\n * Arrow function ensures proper `this` binding.\n */\n private updateLeftColumnHeight = (): void => {\n if (this.mobileView) {\n this.leftColumn?.style?.removeProperty('height');\n } else {\n const clientTop = this.leftColumn?.getBoundingClientRect().top;\n this.leftColumn?.style?.setProperty(\n 'height',\n `${window.innerHeight - (clientTop ?? 0) - 3}px`\n );\n }\n };\n\n /**\n * Toggles whether the fade-out is visible at the bottom of the facets.\n * It should only be visible if the facets are not scrolled to the bottom.\n * Arrow function ensures proper `this` binding.\n */\n private updateFacetFadeOut = (entries: IntersectionObserverEntry[]): void => {\n const fadeElmt = this.shadowRoot?.getElementById('facets-bottom-fade');\n fadeElmt?.classList.toggle('hidden', entries?.[0]?.isIntersecting);\n };\n\n private emitBaseQueryChanged() {\n this.dispatchEvent(\n new CustomEvent<{ baseQuery?: string }>('baseQueryChanged', {\n detail: {\n baseQuery: this.baseQuery,\n },\n })\n );\n }\n\n private emitSearchTypeChanged() {\n this.dispatchEvent(\n new CustomEvent<SearchType>('searchTypeChanged', {\n detail: this.searchType,\n })\n );\n }\n\n private emitEmptyResults() {\n this.dispatchEvent(new Event('emptyResults'));\n }\n\n private disconnectResizeObserver(\n resizeObserver: SharedResizeObserverInterface\n ) {\n resizeObserver.removeObserver({\n target: this.contentContainer,\n handler: this,\n });\n }\n\n private setupResizeObserver() {\n if (!this.resizeObserver) return;\n this.resizeObserver.addObserver({\n target: this.contentContainer,\n handler: this,\n });\n }\n\n /**\n * When the visible cells change from the infinite scroller, we want to emit\n * which page is currently visible so the consumer can update its UI or the URL\n *\n * @param e\n * @returns\n */\n private visibleCellsChanged(\n e: CustomEvent<{ visibleCellIndices: number[] }>\n ) {\n if (this.isScrollingToCell) return;\n const { visibleCellIndices } = e.detail;\n if (visibleCellIndices.length === 0) return;\n const lastVisibleCellIndex =\n visibleCellIndices[visibleCellIndices.length - 1];\n const lastVisibleCellPage =\n Math.floor(lastVisibleCellIndex / this.pageSize) + 1;\n if (this.currentPage !== lastVisibleCellPage) {\n this.currentPage = lastVisibleCellPage;\n }\n const event = new CustomEvent('visiblePageChanged', {\n detail: {\n pageNumber: lastVisibleCellPage,\n },\n });\n this.dispatchEvent(event);\n }\n\n // we only want to scroll on the very first query change\n // so this keeps track of whether we've already set the initial query\n private initialQueryChangeHappened = false;\n\n private historyPopOccurred = false;\n\n // this lets us store the query key so we know if it's actually changed or not\n private previousQueryKey?: string;\n\n /**\n * Internal property to store the `resolve` function for the most recent\n * `initialSearchComplete` promise, allowing us to resolve it at the appropriate time.\n */\n private _initialSearchCompleteResolver!: (val: boolean) => void;\n\n /**\n * Internal property to store the private value backing the `initialSearchComplete` getter.\n */\n private _initialSearchCompletePromise: Promise<boolean> = new Promise(res => {\n this._initialSearchCompleteResolver = res;\n });\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n get initialSearchComplete(): Promise<boolean> {\n return this._initialSearchCompletePromise;\n }\n\n private async handleQueryChange() {\n // only reset if the query has actually changed\n if (!this.searchService || this.pageFetchQueryKey === this.previousQueryKey)\n return;\n\n // If the new state prevents us from updating the search results, don't reset\n if (!this.canPerformSearch) return;\n\n this.previousQueryKey = this.pageFetchQueryKey;\n\n this.dataSource = {};\n this.tileModelOffset = 0;\n this.totalResults = undefined;\n this.aggregations = undefined;\n this.fullYearsHistogramAggregation = undefined;\n this.pageFetchesInProgress = {};\n this.endOfDataReached = false;\n this.pagesToRender =\n this.initialPageNumber === 1\n ? 2 // First two pages are batched into one request when starting from page 1\n : this.initialPageNumber;\n this.queryErrorMessage = undefined;\n\n // Reset the infinite scroller's item count, so that it\n // shows tile placeholders until the new query's results load in\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.estimatedTileCount;\n this.infiniteScroller.reload();\n }\n\n if (this.withinCollection && this.baseQuery?.trim()) {\n this.defaultSortField = SortField.relevance;\n this.defaultSortDirection = null;\n }\n\n if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {\n this.scrollToPage(this.initialPageNumber);\n }\n this.initialQueryChangeHappened = true;\n\n // if the query changed as part of a window.history pop event, we don't want to\n // persist the state because it overwrites the forward history\n if (!this.historyPopOccurred) {\n this.persistState();\n }\n this.historyPopOccurred = false;\n\n // Reset the `initialSearchComplete` promise with a new value for the imminent search\n this._initialSearchCompletePromise = new Promise(res => {\n this._initialSearchCompleteResolver = res;\n });\n\n // Fire the initial page and facets requests\n await Promise.all([this.doInitialPageFetch(), this.fetchFacets()]);\n\n // Resolve the `initialSearchComplete` promise for this search\n this._initialSearchCompleteResolver(true);\n }\n\n private setupStateRestorationObserver() {\n if (this.boundNavigationHandler) return;\n this.boundNavigationHandler = this.historyNavigationHandler.bind(this);\n // when the user navigates back, we want to update the UI to match the URL\n window.addEventListener('popstate', this.boundNavigationHandler);\n }\n\n private boundNavigationHandler?: () => void;\n\n private historyNavigationHandler() {\n this.historyPopOccurred = true;\n this.restoreState();\n }\n\n private restoreState() {\n const restorationState = this.restorationStateHandler.getRestorationState();\n this.displayMode = restorationState.displayMode;\n if (restorationState.searchType != null)\n this.searchType = restorationState.searchType;\n this.selectedSort = restorationState.selectedSort ?? SortField.default;\n this.sortDirection = restorationState.sortDirection ?? null;\n this.selectedTitleFilter = restorationState.selectedTitleFilter ?? null;\n this.selectedCreatorFilter = restorationState.selectedCreatorFilter ?? null;\n this.selectedFacets = restorationState.selectedFacets;\n this.baseQuery = restorationState.baseQuery;\n this.currentPage = restorationState.currentPage ?? 1;\n this.minSelectedDate = restorationState.minSelectedDate;\n this.maxSelectedDate = restorationState.maxSelectedDate;\n if (this.currentPage > 1) {\n this.goToPage(this.currentPage);\n }\n }\n\n private persistState() {\n const restorationState: RestorationState = {\n displayMode: this.displayMode,\n searchType: this.searchType,\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection ?? undefined,\n selectedFacets: this.selectedFacets ?? getDefaultSelectedFacets(),\n baseQuery: this.baseQuery,\n currentPage: this.currentPage,\n titleQuery: this.titleQuery,\n creatorQuery: this.creatorQuery,\n minSelectedDate: this.minSelectedDate,\n maxSelectedDate: this.maxSelectedDate,\n selectedTitleFilter: this.selectedTitleFilter ?? undefined,\n selectedCreatorFilter: this.selectedCreatorFilter ?? undefined,\n };\n this.restorationStateHandler.persistState(restorationState);\n }\n\n private async doInitialPageFetch(): Promise<void> {\n this.searchResultsLoading = true;\n // Try to batch 2 initial page requests when possible\n await this.fetchPage(this.initialPageNumber, 2);\n this.searchResultsLoading = false;\n }\n\n private emitSearchResultsLoadingChanged(): void {\n this.dispatchEvent(\n new CustomEvent<{ loading: boolean }>('searchResultsLoadingChanged', {\n detail: {\n loading: this.searchResultsLoading,\n },\n })\n );\n }\n\n /**\n * Produces a compact unique ID for a search request that can help with debugging\n * on the backend by making related requests easier to trace through different services.\n * (e.g., tying the hits/aggregations requests for the same page back to a single hash).\n *\n * @param params The search service parameters for the request\n * @param kind The kind of request (hits-only, aggregations-only, or both)\n * @returns A Promise resolving to the uid to apply to the request\n */\n private async requestUID(\n params: SearchParams,\n kind: RequestKind\n ): Promise<string> {\n const paramsToHash = JSON.stringify({\n pageType: params.pageType,\n pageTarget: params.pageTarget,\n query: params.query,\n fields: params.fields,\n filters: params.filters,\n sort: params.sort,\n searchType: this.searchType,\n });\n\n const fullQueryHash = (await sha1(paramsToHash)).slice(0, 20); // First 80 bits of SHA-1 are plenty for this\n const sessionId = (await this.getSessionId()).slice(0, 20); // Likewise\n const page = params.page ?? 0;\n const kindPrefix = kind.charAt(0); // f = full, h = hits, a = aggregations\n const currentTime = Date.now();\n\n return `R:${fullQueryHash}-S:${sessionId}-P:${page}-K:${kindPrefix}-T:${currentTime}`;\n }\n\n /**\n * Constructs a search service FilterMap object from the combination of\n * all the currently-applied filters. This includes any facets, letter\n * filters, and date range.\n */\n private get filterMap(): FilterMap {\n const builder = new FilterMapBuilder();\n\n // Add the date range, if applicable\n if (this.minSelectedDate) {\n builder.addFilter(\n 'year',\n this.minSelectedDate,\n FilterConstraint.GREATER_OR_EQUAL\n );\n }\n if (this.maxSelectedDate) {\n builder.addFilter(\n 'year',\n this.maxSelectedDate,\n FilterConstraint.LESS_OR_EQUAL\n );\n }\n\n // Add any selected facets\n if (this.selectedFacets) {\n for (const [facetName, facetValues] of Object.entries(\n this.selectedFacets\n )) {\n const { name, values } = this.prepareFacetForFetch(\n facetName,\n facetValues\n );\n for (const [value, bucket] of Object.entries(values)) {\n let constraint;\n if (bucket.state === 'selected') {\n constraint = FilterConstraint.INCLUDE;\n } else if (bucket.state === 'hidden') {\n constraint = FilterConstraint.EXCLUDE;\n }\n\n if (constraint) {\n builder.addFilter(name, value, constraint);\n }\n }\n }\n }\n\n // Add any letter filters\n if (this.selectedTitleFilter) {\n builder.addFilter(\n 'firstTitle',\n this.selectedTitleFilter,\n FilterConstraint.INCLUDE\n );\n }\n if (this.selectedCreatorFilter) {\n builder.addFilter(\n 'firstCreator',\n this.selectedCreatorFilter,\n FilterConstraint.INCLUDE\n );\n }\n\n const filterMap = builder.build();\n return filterMap;\n }\n\n /** The full query, including year facets and date range clauses */\n private get fullQuery(): string | undefined {\n let fullQuery = this.baseQuery?.trim() ?? '';\n\n const { facetQuery, dateRangeQueryClause, sortFilterQueries } = this;\n\n if (facetQuery) {\n fullQuery += ` AND ${facetQuery}`;\n }\n if (dateRangeQueryClause) {\n fullQuery += ` AND ${dateRangeQueryClause}`;\n }\n if (sortFilterQueries) {\n fullQuery += ` AND ${sortFilterQueries}`;\n }\n return fullQuery.trim();\n }\n\n /**\n * Generates a query string for the given facets\n *\n * Example: `mediatype:(\"collection\" OR \"audio\" OR -\"etree\") AND year:(\"2000\" OR \"2001\")`\n */\n private get facetQuery(): string | undefined {\n if (!this.selectedFacets) return undefined;\n const facetClauses = [];\n for (const [facetName, facetValues] of Object.entries(\n this.selectedFacets\n )) {\n facetClauses.push(this.buildFacetClause(facetName, facetValues));\n }\n return this.joinFacetClauses(facetClauses)?.trim();\n }\n\n /**\n * Builds an OR-joined facet clause for the given facet name and values.\n *\n * E.g., for name `subject` and values\n * `{ foo: { state: 'selected' }, bar: { state: 'hidden' } }`\n * this will produce the clause\n * `subject:(\"foo\" OR -\"bar\")`.\n *\n * @param facetName The facet type (e.g., 'collection')\n * @param facetValues The facet buckets, mapped by their keys\n */\n private buildFacetClause(\n facetName: string,\n facetValues: Record<string, FacetBucket>\n ): string {\n const { name: facetQueryName, values } = this.prepareFacetForFetch(\n facetName,\n facetValues\n );\n const facetEntries = Object.entries(values);\n if (facetEntries.length === 0) return '';\n\n const facetValuesArray: string[] = [];\n for (const [key, facetData] of facetEntries) {\n const plusMinusPrefix = facetData.state === 'hidden' ? '-' : '';\n facetValuesArray.push(`${plusMinusPrefix}\"${key}\"`);\n }\n\n const valueQuery = facetValuesArray.join(` OR `);\n return `${facetQueryName}:(${valueQuery})`;\n }\n\n /**\n * Handles some special pre-request normalization steps for certain facet types\n * that require them.\n *\n * @param facetName The name of the facet type (e.g., 'language')\n * @param facetValues An array of values for that facet type\n */\n private prepareFacetForFetch(\n facetName: string,\n facetValues: Record<string, FacetBucket>\n ): { name: string; values: Record<string, FacetBucket> } {\n // eslint-disable-next-line prefer-const\n let [normalizedName, normalizedValues] = [facetName, facetValues];\n\n // The full \"search engine\" name of the lending field is \"lending___status\"\n if (facetName === 'lending') {\n normalizedName = 'lending___status';\n }\n\n return {\n name: normalizedName,\n values: normalizedValues,\n };\n }\n\n /**\n * Takes an array of facet clauses, and combines them into a\n * full AND-joined facet query string. Empty clauses are ignored.\n */\n private joinFacetClauses(facetClauses: string[]): string | undefined {\n const nonEmptyFacetClauses = facetClauses.filter(\n clause => clause.length > 0\n );\n return nonEmptyFacetClauses.length > 0\n ? `(${nonEmptyFacetClauses.join(' AND ')})`\n : undefined;\n }\n\n facetsChanged(e: CustomEvent<SelectedFacets>) {\n this.selectedFacets = e.detail;\n }\n\n facetClickHandler({\n detail: { key, state: facetState, negative },\n }: CustomEvent<FacetEventDetails>): void {\n if (negative) {\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action:\n facetState !== 'none'\n ? analyticsActions.facetNegativeSelected\n : analyticsActions.facetNegativeDeselected,\n label: key,\n });\n } else {\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action:\n facetState !== 'none'\n ? analyticsActions.facetSelected\n : analyticsActions.facetDeselected,\n label: key,\n });\n }\n }\n\n private async fetchFacets() {\n const trimmedQuery = this.baseQuery?.trim();\n if (!this.canPerformSearch) return;\n\n const { facetFetchQueryKey } = this;\n\n const sortParams = this.sortParam ? [this.sortParam] : [];\n const params: SearchParams = {\n ...this.collectionParams,\n query: trimmedQuery || '',\n rows: 0,\n filters: this.filterMap,\n // Fetch a few extra buckets beyond the 6 we show, in case some get suppressed\n aggregationsSize: 10,\n // Note: we don't need an aggregations param to fetch the default aggregations from the PPS.\n // The default aggregations for the search_results page type should be what we need here.\n };\n params.uid = await this.requestUID(\n { ...params, sort: sortParams },\n 'aggregations'\n );\n\n this.facetsLoading = true;\n const searchResponse = await this.searchService?.search(\n params,\n this.searchType\n );\n const success = searchResponse?.success;\n\n // This is checking to see if the query has changed since the data was fetched.\n // If so, we just want to discard this set of aggregations because they are\n // likely no longer valid for the newer query.\n const queryChangedSinceFetch =\n facetFetchQueryKey !== this.facetFetchQueryKey;\n if (queryChangedSinceFetch) return;\n\n if (!success) {\n const errorMsg = searchResponse?.error?.message;\n const detailMsg = searchResponse?.error?.details?.message;\n\n if (!errorMsg && !detailMsg) {\n // @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'\n window?.Sentry?.captureMessage?.(\n 'Missing or malformed facet response from backend',\n 'error'\n );\n }\n\n return;\n }\n\n const { aggregations, collectionTitles } = success.response;\n this.aggregations = aggregations;\n\n if (collectionTitles) {\n this.collectionNameCache?.addKnownTitles(collectionTitles);\n } else if (this.aggregations?.collection) {\n this.collectionNameCache?.preloadIdentifiers(\n (this.aggregations.collection.buckets as Bucket[]).map(bucket =>\n bucket.key?.toString()\n )\n );\n }\n\n this.fullYearsHistogramAggregation =\n success?.response?.aggregations?.year_histogram;\n\n this.facetsLoading = false;\n }\n\n private scrollToPage(pageNumber: number): Promise<void> {\n return new Promise(resolve => {\n const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);\n // without this setTimeout, Safari just pauses until the `fetchPage` is complete\n // then scrolls to the cell\n setTimeout(() => {\n this.isScrollingToCell = true;\n this.infiniteScroller?.scrollToCell(cellIndexToScrollTo, true);\n // This timeout is to give the scroll animation time to finish\n // then updating the infinite scroller once we're done scrolling\n // There's no scroll animation completion callback so we're\n // giving it 0.5s to finish.\n setTimeout(() => {\n this.isScrollingToCell = false;\n this.infiniteScroller?.refreshAllVisibleCells();\n resolve();\n }, 500);\n }, 0);\n });\n }\n\n /**\n * Whether sorting by relevance makes sense for the current state.\n * Currently equivalent to having a non-empty query.\n */\n private get isRelevanceSortAvailable(): boolean {\n return !!this.baseQuery?.trim();\n }\n\n /**\n * Whether a search may be performed in the current state of the component.\n * This is only true if the search service is defined, and either\n * (a) a non-empty query is set, or\n * (b) we are on a collection page in metadata search mode.\n */\n private get canPerformSearch(): boolean {\n if (!this.searchService) return false;\n\n const trimmedQuery = this.baseQuery?.trim();\n const hasNonEmptyQuery = !!trimmedQuery;\n const isCollectionSearch = !!this.withinCollection;\n const isMetadataSearch = this.searchType === SearchType.METADATA;\n\n // Metadata searches within a collection are allowed to have no query.\n // Otherwise, a non-empty query must be set.\n return hasNonEmptyQuery || (isCollectionSearch && isMetadataSearch);\n }\n\n /**\n * Additional params to pass to the search service if targeting a collection page,\n * or null otherwise.\n */\n private get collectionParams(): {\n pageType: string;\n pageTarget: string;\n } | null {\n return this.withinCollection\n ? { pageType: 'collection_details', pageTarget: this.withinCollection }\n : null;\n }\n\n /**\n * The query key is a string that uniquely identifies the current search.\n * It consists of:\n * - The current base query\n * - The current collection\n * - The current search type\n * - Any currently-applied facets\n * - Any currently-applied date range\n * - Any currently-applied prefix filters\n * - The current sort options\n *\n * This lets us keep track of queries so we don't persist data that's\n * no longer relevant.\n */\n private get pageFetchQueryKey(): string {\n const sortField = this.sortParam?.field ?? 'none';\n const sortDirection = this.sortParam?.direction ?? 'none';\n return `${this.fullQuery}-${this.withinCollection}-${this.searchType}-${sortField}-${sortDirection}`;\n }\n\n /**\n * Similar to `pageFetchQueryKey` above, but excludes sort fields since they\n * are not relevant in determining aggregation queries.\n */\n private get facetFetchQueryKey(): string {\n return `${this.fullQuery}-${this.withinCollection}-${this.searchType}`;\n }\n\n // this maps the query to the pages being fetched for that query\n private pageFetchesInProgress: Record<string, Set<number>> = {};\n\n /**\n * Fetches one or more pages of results and updates the data source.\n *\n * @param pageNumber The page number to fetch\n * @param numInitialPages If this is an initial page fetch (`pageNumber = 1`),\n * specifies how many pages to batch together in one request. Ignored\n * if `pageNumber != 1`, defaulting to a single page.\n */\n async fetchPage(pageNumber: number, numInitialPages = 1) {\n const trimmedQuery = this.baseQuery?.trim();\n if (!this.canPerformSearch) return;\n\n // if we already have data, don't fetch again\n if (this.dataSource[pageNumber]) return;\n\n if (this.endOfDataReached) return;\n\n // Batch multiple initial page requests together if needed (e.g., can request\n // pages 1 and 2 together in a single request).\n const numPages = pageNumber === 1 ? numInitialPages : 1;\n const numRows = this.pageSize * numPages;\n\n // if a fetch is already in progress for this query and page, don't fetch again\n const { pageFetchQueryKey } = this;\n const pageFetches =\n this.pageFetchesInProgress[pageFetchQueryKey] ?? new Set();\n if (pageFetches.has(pageNumber)) return;\n for (let i = 0; i < numPages; i += 1) {\n pageFetches.add(pageNumber + i);\n }\n this.pageFetchesInProgress[pageFetchQueryKey] = pageFetches;\n\n const sortParams = this.sortParam ? [this.sortParam] : [];\n const params: SearchParams = {\n ...this.collectionParams,\n query: trimmedQuery || '',\n page: pageNumber,\n rows: numRows,\n sort: sortParams,\n filters: this.filterMap,\n aggregations: { omit: true },\n };\n params.uid = await this.requestUID(params, 'hits');\n\n const searchResponse = await this.searchService?.search(\n params,\n this.searchType\n );\n const success = searchResponse?.success;\n\n // This is checking to see if the query has changed since the data was fetched.\n // If so, we just want to discard the data since there should be a new query\n // right behind it.\n const queryChangedSinceFetch = pageFetchQueryKey !== this.pageFetchQueryKey;\n if (queryChangedSinceFetch) return;\n\n if (!success) {\n const errorMsg = searchResponse?.error?.message;\n const detailMsg = searchResponse?.error?.details?.message;\n\n this.queryErrorMessage = `${errorMsg ?? ''}${\n detailMsg ? `; ${detailMsg}` : ''\n }`;\n\n if (!this.queryErrorMessage) {\n this.queryErrorMessage = 'Missing or malformed response from backend';\n // @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'\n window?.Sentry?.captureMessage?.(this.queryErrorMessage, 'error');\n }\n\n for (let i = 0; i < numPages; i += 1) {\n this.pageFetchesInProgress[pageFetchQueryKey]?.delete(pageNumber + i);\n }\n\n this.searchResultsLoading = false;\n return;\n }\n\n this.totalResults = success.response.totalResults - this.tileModelOffset;\n\n // display event to offshoot when result count is zero.\n if (this.totalResults === 0) {\n this.emitEmptyResults();\n }\n\n if (this.withinCollection) {\n this.collectionInfo = success.response.collectionExtraInfo;\n\n // For collections, we want the UI to respect the default sort option\n // which can be specified in metadata, or otherwise assumed to be week:desc\n this.applyDefaultCollectionSort(this.collectionInfo);\n\n if (this.collectionInfo) {\n this.parentCollections = [].concat(\n this.collectionInfo.public_metadata?.collection ?? []\n );\n }\n }\n\n const { results, collectionTitles } = success.response;\n if (results && results.length > 0) {\n // Load any collection titles present on the response into the cache,\n // or queue up preload fetches for them if none were present.\n if (collectionTitles) {\n this.collectionNameCache?.addKnownTitles(collectionTitles);\n } else {\n this.preloadCollectionNames(results);\n }\n\n // Update the data source for each returned page\n for (let i = 0; i < numPages; i += 1) {\n const pageStartIndex = this.pageSize * i;\n this.updateDataSource(\n pageNumber + i,\n results.slice(pageStartIndex, pageStartIndex + this.pageSize)\n );\n }\n }\n\n // When we reach the end of the data, we can set the infinite scroller's\n // item count to the real total number of results (rather than the\n // temporary estimates based on pages rendered so far).\n const resultCountDiscrepancy = numRows - results.length;\n if (resultCountDiscrepancy > 0) {\n this.endOfDataReached = true;\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.totalResults;\n }\n }\n\n for (let i = 0; i < numPages; i += 1) {\n this.pageFetchesInProgress[pageFetchQueryKey]?.delete(pageNumber + i);\n }\n }\n\n private preloadCollectionNames(results: SearchResult[]) {\n const collectionIds = results\n .map(result => result.collection?.values)\n .flat();\n const collectionIdsArray = Array.from(new Set(collectionIds)) as string[];\n this.collectionNameCache?.preloadIdentifiers(collectionIdsArray);\n }\n\n /**\n * Applies any default sort option for the current collection, by checking\n * for one in the collection's metadata. If none is found, defaults to sorting\n * descending by:\n * - Date Favorited for fav-* collections\n * - Weekly views for all other collections\n */\n private applyDefaultCollectionSort(collectionInfo?: CollectionExtraInfo) {\n if (this.baseQuery) {\n // If there's a query set, then we default to relevance sorting regardless of\n // the collection metadata-specified sort.\n this.defaultSortField = SortField.relevance;\n this.defaultSortDirection = null;\n return;\n }\n\n // Favorite collections sort on Date Favorited by default.\n // Other collections fall back to sorting on weekly views.\n const baseDefaultSort: string =\n collectionInfo?.public_metadata?.identifier?.startsWith('fav-')\n ? '-favoritedate'\n : '-week';\n\n // The collection metadata may override the default sorting with something else\n const metadataSort: string | undefined =\n collectionInfo?.public_metadata?.['sort-by'];\n\n // Prefer the metadata-specified sort if one exists\n const defaultSortToApply = metadataSort ?? baseDefaultSort;\n\n // Account for both -field and field:dir formats\n let [field, dir] = defaultSortToApply.split(':');\n if (field.startsWith('-')) {\n field = field.slice(1);\n dir = 'desc';\n } else if (!['asc', 'desc'].includes(dir)) {\n dir = 'asc';\n }\n\n const sortOption = sortOptionFromAPIString(field);\n const sortField = sortOption.field;\n if (sortField && sortField !== SortField.default) {\n this.defaultSortField = sortField;\n this.defaultSortDirection = dir as SortDirection;\n }\n }\n\n /**\n * This is useful for determining whether we need to reload the scroller.\n *\n * When the fetch completes, we need to reload the scroller if the cells for that\n * page are visible, but if the page is not currenlty visible, we don't need to reload\n */\n private get currentVisiblePageNumbers(): number[] {\n const visibleCells = this.infiniteScroller?.getVisibleCellIndices() ?? [];\n const visiblePages = new Set<number>();\n visibleCells.forEach(cellIndex => {\n const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;\n visiblePages.add(visiblePage);\n });\n return Array.from(visiblePages);\n }\n\n /**\n * Update the datasource from the fetch response\n *\n * @param pageNumber\n * @param results\n */\n private updateDataSource(pageNumber: number, results: SearchResult[]) {\n // copy our existing datasource so when we set it below, it gets set\n // instead of modifying the existing dataSource since object changes\n // don't trigger a re-render\n const datasource = { ...this.dataSource };\n const tiles: TileModel[] = [];\n results?.forEach(result => {\n if (!result.identifier) return;\n\n let loginRequired = false;\n let contentWarning = false;\n // Check if item and item in \"modifying\" collection, setting above flags\n if (\n result.collection?.values.length &&\n result.mediatype?.value !== 'collection'\n ) {\n for (const collection of result.collection?.values ?? []) {\n if (collection === 'loggedin') {\n loginRequired = true;\n if (contentWarning) break;\n }\n if (collection === 'no-preview') {\n contentWarning = true;\n if (loginRequired) break;\n }\n }\n }\n\n tiles.push({\n averageRating: result.avg_rating?.value,\n checked: false,\n collections: result.collection?.values ?? [],\n collectionFilesCount: result.collection_files_count?.value ?? 0,\n collectionSize: result.collection_size?.value ?? 0,\n commentCount: result.num_reviews?.value ?? 0,\n creator: result.creator?.value,\n creators: result.creator?.values ?? [],\n dateAdded: result.addeddate?.value,\n dateArchived: result.publicdate?.value,\n datePublished: result.date?.value,\n dateReviewed: result.reviewdate?.value,\n description: result.description?.values.join('\\n'),\n favCount: result.num_favorites?.value ?? 0,\n href: this.collapseRepeatedQuotes(result.__href__?.value),\n identifier: result.identifier,\n issue: result.issue?.value,\n itemCount: result.item_count?.value ?? 0,\n mediatype: this.getMediatype(result),\n snippets: result.highlight?.values ?? [],\n source: result.source?.value,\n subjects: result.subject?.values ?? [],\n title: result.title?.value ?? '',\n volume: result.volume?.value,\n viewCount: result.downloads?.value ?? 0,\n weeklyViewCount: result.week?.value,\n loginRequired,\n contentWarning,\n });\n });\n datasource[pageNumber] = tiles;\n this.dataSource = datasource;\n const visiblePages = this.currentVisiblePageNumbers;\n const needsReload = visiblePages.includes(pageNumber);\n if (needsReload) {\n this.infiniteScroller?.refreshAllVisibleCells();\n }\n }\n\n private getMediatype(result: SearchResult) {\n /**\n * hit_type == 'favorited_search' is basically a new hit_type\n * - we are getting from PPS.\n * - which gives response for fav- collection\n * - having favorited items like account/collection/item etc..\n * - as user can also favorite a search result (a search page)\n * - so we need to have response (having fav- items and fav- search results)\n *\n * if backend hit_type == 'favorited_search'\n * - let's assume a \"search\" as new mediatype\n */\n if (result?.rawMetadata?.hit_type === 'favorited_search') {\n return 'search';\n }\n\n return result.mediatype?.value ?? 'data';\n }\n\n /**\n * Returns the input string, but removing one set of quotes from all instances of\n * \"\"clauses wrapped in two sets of quotes\"\". This assumes the quotes are already\n * URL-encoded.\n *\n * This should be a temporary measure to address the fact that the __href__ field\n * sometimes acquires extra quotation marks during query rewriting. Once there is a\n * full Lucene parser in place that handles quoted queries correctly, this can likely\n * be removed.\n */\n private collapseRepeatedQuotes(str?: string): string | undefined {\n return str?.replace(/%22%22(?!%22%22)(.+?)%22%22/g, '%22$1%22');\n }\n\n /** Fetches the aggregation buckets for the given prefix filter type. */\n private async fetchPrefixFilterBuckets(\n filterType: PrefixFilterType\n ): Promise<Bucket[]> {\n const trimmedQuery = this.baseQuery?.trim();\n if (!this.canPerformSearch) return [];\n\n const filterAggregationKey = prefixFilterAggregationKeys[filterType];\n const sortParams = this.sortParam ? [this.sortParam] : [];\n\n const params: SearchParams = {\n ...this.collectionParams,\n query: trimmedQuery || '',\n rows: 0,\n filters: this.filterMap,\n // Only fetch the firstTitle or firstCreator aggregation\n aggregations: { simpleParams: [filterAggregationKey] },\n // Fetch all 26 letter buckets\n aggregationsSize: 26,\n };\n params.uid = await this.requestUID(\n { ...params, sort: sortParams },\n 'aggregations'\n );\n\n const searchResponse = await this.searchService?.search(\n params,\n this.searchType\n );\n\n return (searchResponse?.success?.response?.aggregations?.[\n filterAggregationKey\n ]?.buckets ?? []) as Bucket[];\n }\n\n /** Fetches and caches the prefix filter counts for the given filter type. */\n private async updatePrefixFilterCounts(\n filterType: PrefixFilterType\n ): Promise<void> {\n const { facetFetchQueryKey } = this;\n const buckets = await this.fetchPrefixFilterBuckets(filterType);\n\n // Don't update the filter counts for an outdated query (if it has been changed\n // since we sent the request)\n const queryChangedSinceFetch =\n facetFetchQueryKey !== this.facetFetchQueryKey;\n if (queryChangedSinceFetch) return;\n\n // Unpack the aggregation buckets into a simple map like { 'A': 50, 'B': 25, ... }\n this.prefixFilterCountMap = { ...this.prefixFilterCountMap }; // Clone the object to trigger an update\n this.prefixFilterCountMap[filterType] = buckets.reduce(\n (acc: Record<string, number>, bucket: Bucket) => {\n acc[(bucket.key as string).toUpperCase()] = bucket.doc_count;\n return acc;\n },\n {}\n );\n }\n\n /**\n * Fetches and caches the prefix filter counts for the current sort type,\n * provided it is one that permits prefix filtering. (If not, this does nothing).\n */\n private async updatePrefixFiltersForCurrentSort(): Promise<void> {\n if (['title', 'creator'].includes(this.selectedSort)) {\n const filterType = this.selectedSort as PrefixFilterType;\n if (!this.prefixFilterCountMap[filterType]) {\n this.updatePrefixFilterCounts(filterType);\n }\n }\n }\n\n /**\n * Clears the cached letter counts for both title and creator, and\n * fetches a new set of counts for whichever of them is the currently\n * selected sort option (which may be neither).\n *\n * Call this whenever the counts are invalidated (e.g., by a query change).\n */\n private refreshLetterCounts(): void {\n if (Object.keys(this.prefixFilterCountMap).length > 0) {\n this.prefixFilterCountMap = {};\n }\n this.updatePrefixFiltersForCurrentSort();\n }\n\n /**\n * Callback when a result is selected\n */\n resultSelected(event: CustomEvent<TileModel>): void {\n if (this.isManageView) {\n // Checked/unchecked state change -- rerender to ensure it propagates\n // this.mapDataSource(model => ({ ...model }));\n const cellIndex = Object.values(this.dataSource)\n .flat()\n .indexOf(event.detail);\n if (cellIndex >= 0)\n this.infiniteScroller?.refreshCell(cellIndex - this.tileModelOffset);\n }\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.resultSelected,\n label: event.detail.mediatype,\n });\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.resultSelected,\n label: `page-${this.currentPage}`,\n });\n }\n\n cellForIndex(index: number): TemplateResult | undefined {\n const model = this.tileModelAtCellIndex(index);\n if (!model) return undefined;\n\n return html`\n <tile-dispatcher\n .collectionPagePath=${this.collectionPagePath}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .baseImageUrl=${this.baseImageUrl}\n .model=${model}\n .tileDisplayMode=${this.displayMode}\n .resizeObserver=${this.resizeObserver}\n .collectionNameCache=${this.collectionNameCache}\n .sortParam=${this.sortParam}\n .creatorFilter=${this.selectedCreatorFilter}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .loggedIn=${this.loggedIn}\n .isManageView=${this.isManageView}\n ?enableHoverPane=${true}\n @resultSelected=${(e: CustomEvent) => this.resultSelected(e)}\n >\n </tile-dispatcher>\n `;\n }\n\n /**\n * When the user scrolls near to the bottom of the page, fetch the next page\n * increase the number of pages to render and start fetching data for the new page\n */\n private scrollThresholdReached() {\n if (!this.endOfDataReached) {\n this.pagesToRender += 1;\n this.fetchPage(this.pagesToRender);\n }\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n css`\n :host {\n display: block;\n\n --leftColumnWidth: 18rem;\n --leftColumnPaddingRight: 2.5rem;\n }\n\n /**\n * When page width resizes from desktop to mobile, use this class to\n * disable expand/collapse transition when loading.\n */\n .preload * {\n transition: none !important;\n -webkit-transition: none !important;\n -moz-transition: none !important;\n -ms-transition: none !important;\n -o-transition: none !important;\n }\n\n #content-container {\n display: flex;\n }\n\n empty-placeholder {\n margin-top: var(--placeholderMarginTop, 0);\n }\n\n .collapser-icon {\n display: inline-block;\n }\n\n .collapser-icon svg {\n display: inline-block;\n width: 12px;\n height: 12px;\n transition: transform 0.2s ease-out;\n }\n\n #mobile-filter-collapse {\n width: 100%;\n }\n\n #mobile-filter-collapse > summary {\n cursor: pointer;\n list-style: none;\n }\n\n #mobile-filter-collapse[open] > summary {\n margin-bottom: 10px;\n }\n\n #mobile-filter-collapse h2 {\n display: inline-block;\n margin: 0;\n font-size: 2rem;\n }\n\n #mobile-filter-collapse[open] svg {\n transform: rotate(90deg);\n }\n\n #content-container.mobile {\n display: block;\n }\n\n .column {\n padding-top: 2rem;\n }\n\n #right-column {\n flex: 1;\n position: relative;\n border-left: 1px solid rgb(232, 232, 232);\n border-right: 1px solid rgb(232, 232, 232);\n padding-left: 1rem;\n padding-right: 1rem;\n margin-top: var(--rightColumnMarginTop, 0);\n background: #fff;\n }\n\n .mobile #right-column {\n border-left: none;\n padding: 5px 5px 0;\n }\n\n #left-column {\n width: var(--leftColumnWidth, 18rem);\n /* Prevents Safari from shrinking col at first draw */\n min-width: var(--leftColumnWidth, 18rem);\n padding-top: 0;\n /* Reduced padding by 0.2rem to add the invisible border in the rule below */\n padding-right: calc(var(--leftColumnPaddingRight, 2.5rem) - 0.2rem);\n border-right: 0.2rem solid transparent; /* Pads to the right of the scrollbar a bit */\n z-index: 1;\n }\n\n .desktop #left-column {\n top: 0;\n position: sticky;\n height: calc(100vh - 2rem);\n max-height: calc(100vh - 2rem);\n overflow-x: hidden;\n overflow-y: scroll;\n\n /*\n * Firefox doesn't support any of the -webkit-scrollbar stuff below, but\n * does at least give us a tiny bit of control over width & color.\n */\n scrollbar-width: thin;\n scrollbar-color: transparent transparent;\n }\n .desktop #left-column:hover {\n scrollbar-color: auto;\n }\n .desktop #left-column::-webkit-scrollbar {\n appearance: none;\n width: 6px;\n }\n .desktop #left-column::-webkit-scrollbar-button {\n height: 3px;\n background: transparent;\n }\n .desktop #left-column::-webkit-scrollbar-corner {\n background: transparent;\n }\n .desktop #left-column::-webkit-scrollbar-thumb {\n border-radius: 4px;\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.15);\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb:hover {\n background: rgba(0, 0, 0, 0.2);\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb:active {\n background: rgba(0, 0, 0, 0.3);\n }\n\n #facets-bottom-fade {\n background: linear-gradient(\n to bottom,\n #f5f5f700 0%,\n #f5f5f7c0 50%,\n #f5f5f7 80%,\n #f5f5f7 100%\n );\n position: fixed;\n bottom: 0;\n height: 50px;\n /* Wide enough to cover the content, but leave the scrollbar uncovered */\n width: calc(\n var(--leftColumnWidth) + var(--leftColumnPaddingRight) - 10px\n );\n z-index: 2;\n pointer-events: none;\n transition: height 0.1s ease;\n }\n #facets-bottom-fade.hidden {\n height: 0;\n }\n\n .desktop #left-column-scroll-sentinel {\n width: 1px;\n height: 100vh;\n background: transparent;\n }\n\n .desktop #facets-scroll-sentinel {\n width: 1px;\n height: 1px;\n background: transparent;\n }\n\n #facets-header-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n margin: 10px 0;\n }\n\n .desktop #facets-header-container {\n padding-top: 2rem;\n flex-wrap: wrap;\n }\n\n .mobile #left-column {\n width: 100%;\n padding: 0;\n }\n\n .clear-filters-btn-row {\n display: inline-block;\n }\n\n .desktop .clear-filters-btn-row {\n width: 100%;\n }\n\n .clear-filters-btn {\n display: inline-block;\n appearance: none;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n color: var(--ia-theme-link-color);\n font-size: 1.4rem;\n font-family: inherit;\n cursor: pointer;\n }\n\n .clear-filters-btn:hover {\n text-decoration: underline;\n }\n\n .clear-filters-btn-separator {\n display: inline-block;\n margin-left: 5px;\n border-left: 1px solid #2c2c2c;\n font-size: 1.4rem;\n line-height: 1.3rem;\n }\n\n #facets-container {\n position: relative;\n max-height: 0;\n transition: max-height 0.2s ease-in-out;\n z-index: 1;\n margin-top: 5rem;\n padding-bottom: 2rem;\n }\n\n .desktop #facets-container {\n width: 18rem;\n }\n\n .mobile #facets-container {\n overflow: hidden;\n padding-bottom: 0;\n padding-left: 10px;\n padding-right: 10px;\n }\n\n #facets-container.expanded {\n max-height: 2000px;\n }\n\n #results-total {\n display: flex;\n align-items: baseline;\n }\n\n .mobile #results-total {\n float: right;\n margin-bottom: 0;\n margin-right: 5px;\n }\n\n #big-results-count {\n font-size: 2.4rem;\n font-weight: 500;\n margin-right: 5px;\n }\n\n .mobile #big-results-count {\n font-size: 2rem;\n }\n\n #big-results-label {\n font-size: 1.4rem;\n font-weight: 200;\n }\n\n #list-header {\n max-height: 4.2rem;\n }\n\n .loading-cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n z-index: 1;\n padding-top: 50px;\n }\n\n circular-activity-indicator {\n width: 30px;\n height: 30px;\n }\n\n sort-filter-bar {\n display: block;\n margin-bottom: 4rem;\n }\n\n infinite-scroller {\n display: block;\n --infiniteScrollerRowGap: var(--collectionBrowserRowGap, 1.7rem);\n --infiniteScrollerColGap: var(--collectionBrowserColGap, 1.7rem);\n }\n\n infinite-scroller.list-compact {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 100%\n );\n --infiniteScrollerCellMinHeight: 34px; /* override infinite scroller component */\n --infiniteScrollerCellMaxHeight: 56px;\n --infiniteScrollerRowGap: 0px;\n }\n\n infinite-scroller.list-detail {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 100%\n );\n --infiniteScrollerCellMinHeight: var(\n --collectionBrowserCellMinHeight,\n 5rem\n );\n /*\n 30px in spec, compensating for a -4px margin\n to align title with top of item image\n src/tiles/list/tile-list.ts\n */\n --infiniteScrollerRowGap: 34px;\n }\n\n .mobile infinite-scroller.list-detail {\n --infiniteScrollerRowGap: 24px;\n }\n\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 17rem\n );\n --infiniteScrollerCellMaxWidth: var(\n --collectionBrowserCellMaxWidth,\n 1fr\n );\n }\n\n /* Allow tiles to shrink a bit further at smaller viewport widths */\n @media screen and (max-width: 880px) {\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 15rem\n );\n }\n }\n /* At very small widths, maintain a 2-tile layout as far as it can reasonably go */\n @media screen and (max-width: 360px) {\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 12rem\n );\n }\n }\n\n infinite-scroller.hidden {\n display: none;\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"collection-browser.js","sourceRoot":"","sources":["../../src/collection-browser.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,OAAO,EACL,IAAI,EACJ,GAAG,EACH,UAAU,EAGV,OAAO,GACR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAOvD,OAAO,EAIL,gBAAgB,EAEhB,gBAAgB,EAIhB,UAAU,GAGX,MAAM,iCAAiC,CAAC;AAKzC,OAAO,oCAAoC,CAAC;AAK5C,OAAO,yBAAyB,CAAC;AACjC,OAAO,yCAAyC,CAAC;AACjD,OAAO,mCAAmC,CAAC;AAC3C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAEL,SAAS,EAET,wBAAwB,EAMxB,2BAA2B,EAE3B,uBAAuB,EACvB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,uBAAuB,GAExB,MAAM,6BAA6B,CAAC;AACrC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAErD,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKjD,IAAa,iBAAiB,GAA9B,MAAa,iBACX,SAAQ,UAAU;IADpB;;QAQ8B,iBAA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import/no-duplicates */\nimport {\n html,\n css,\n LitElement,\n PropertyValues,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';\nimport type {\n InfiniteScroller,\n InfiniteScrollerCellProviderInterface,\n} from '@internetarchive/infinite-scroller';\nimport {\n Aggregation,\n Bucket,\n CollectionExtraInfo,\n FilterConstraint,\n FilterMap,\n FilterMapBuilder,\n SearchParams,\n SearchResult,\n SearchServiceInterface,\n SearchType,\n SortDirection,\n SortParam,\n} from '@internetarchive/search-service';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/infinite-scroller';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { ModalManagerInterface } from '@internetarchive/modal-manager';\nimport type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-feedback';\nimport type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';\nimport './tiles/tile-dispatcher';\nimport './tiles/collection-browser-loading-tile';\nimport './sort-filter-bar/sort-filter-bar';\nimport './manage/manage-bar';\nimport './collection-facets';\nimport './circular-activity-indicator';\nimport {\n SelectedFacets,\n SortField,\n CollectionBrowserContext,\n getDefaultSelectedFacets,\n TileModel,\n CollectionDisplayMode,\n FacetBucket,\n PrefixFilterType,\n PrefixFilterCounts,\n prefixFilterAggregationKeys,\n FacetEventDetails,\n sortOptionFromAPIString,\n SORT_OPTIONS,\n} from './models';\nimport {\n RestorationStateHandlerInterface,\n RestorationStateHandler,\n RestorationState,\n} from './restoration-state-handler';\nimport chevronIcon from './assets/img/icons/chevron';\nimport type { PlaceholderType } from './empty-placeholder';\nimport './empty-placeholder';\n\nimport {\n analyticsActions,\n analyticsCategories,\n} from './utils/analytics-events';\nimport { srOnlyStyle } from './styles/sr-only';\nimport { sha1 } from './utils/sha1';\nimport type { CollectionFacets } from './collection-facets';\nimport type { ManageableItem } from './manage/manage-bar';\nimport { formatDate } from './utils/format-date';\n\ntype RequestKind = 'full' | 'hits' | 'aggregations';\n\n@customElement('collection-browser')\nexport class CollectionBrowser\n extends LitElement\n implements\n InfiniteScrollerCellProviderInterface,\n SharedResizeObserverResizeHandlerInterface\n{\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl: string = 'https://archive.org';\n\n @property({ type: Object }) searchService?: SearchServiceInterface;\n\n @property({ type: String }) searchType: SearchType = SearchType.METADATA;\n\n @property({ type: String }) withinCollection?: string;\n\n @property({ type: String }) baseQuery?: string;\n\n @property({ type: String }) displayMode?: CollectionDisplayMode;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: Object }) defaultSortParam: SortParam | null = null;\n\n @property({ type: String }) selectedSort: SortField = SortField.default;\n\n @property({ type: String }) selectedTitleFilter: string | null = null;\n\n @property({ type: String }) selectedCreatorFilter: string | null = null;\n\n @property({ type: String }) sortDirection: SortDirection | null = null;\n\n @property({ type: Number }) pageSize = 50;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Number }) currentPage?: number;\n\n @property({ type: String }) minSelectedDate?: string;\n\n @property({ type: String }) maxSelectedDate?: string;\n\n @property({ type: Object }) selectedFacets?: SelectedFacets;\n\n @property({ type: Boolean }) showHistogramDatePicker = false;\n\n @property({ type: String }) collectionPagePath: string = '/details/';\n\n @property({ type: Object }) collectionInfo?: CollectionExtraInfo;\n\n @property({ type: Array }) parentCollections: string[] = [];\n\n /** describes where this component is being used */\n @property({ type: String, reflect: true }) searchContext: string =\n analyticsCategories.default;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: String }) pageContext: CollectionBrowserContext = 'search';\n\n @property({ type: Object })\n restorationStateHandler: RestorationStateHandlerInterface = new RestorationStateHandler(\n {\n context: this.pageContext,\n }\n );\n\n @property({ type: Number }) mobileBreakpoint = 600;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Object }) modalManager?: ModalManagerInterface = undefined;\n\n @property({ type: Object })\n featureFeedbackService?: FeatureFeedbackServiceInterface;\n\n @property({ type: Object }) recaptchaManager?: RecaptchaManagerInterface;\n\n /**\n * If item management UI active\n */\n @property({ type: Boolean }) isManageView = false;\n\n /**\n * The page that the consumer wants to load.\n */\n private initialPageNumber = 1;\n\n /**\n * This the the number of pages that we want to show.\n *\n * The data isn't necessarily loaded for all of the pages, but this lets us\n * know how many cells we should render.\n */\n @state() private pagesToRender = this.initialPageNumber;\n\n /**\n * Whether the initial page fetch for a new query is currently in progress.\n */\n @state() private searchResultsLoading = false;\n\n @state() private facetsLoading = false;\n\n @state() private fullYearAggregationLoading = false;\n\n @state() private aggregations?: Record<string, Aggregation>;\n\n @state() private fullYearsHistogramAggregation: Aggregation | undefined;\n\n @state() private totalResults?: number;\n\n @state() private queryErrorMessage?: string;\n\n @state() private mobileView = false;\n\n @state() private mobileFacetsVisible = false;\n\n @state() private contentWidth?: number;\n\n @state() private defaultSortField: Exclude<SortField, SortField.default> =\n SortField.relevance;\n\n @state() private defaultSortDirection: SortDirection | null = null;\n\n @state() private placeholderType: PlaceholderType = null;\n\n @state() private prefixFilterCountMap: Partial<\n Record<PrefixFilterType, PrefixFilterCounts>\n > = {};\n\n @query('#content-container') private contentContainer!: HTMLDivElement;\n\n @query('#left-column') private leftColumn?: HTMLDivElement;\n\n @query('collection-facets') private collectionFacets?: CollectionFacets;\n\n @property({ type: Object, attribute: false })\n private analyticsHandler?: AnalyticsManagerInterface;\n\n /**\n * When we're animated scrolling to the page, we don't want to fetch\n * all of the pages as it scrolls so this lets us know if we're scrolling\n */\n private isScrollingToCell = false;\n\n /**\n * When we've reached the end of the data, stop trying to fetch more\n */\n private endOfDataReached = false;\n\n /**\n * When page width resizes from desktop to mobile, set true to\n * disable expand/collapse transition when loading.\n */\n private isResizeToMobile = false;\n\n private leftColIntersectionObserver?: IntersectionObserver;\n\n private facetsIntersectionObserver?: IntersectionObserver;\n\n private placeholderCellTemplate = html`<collection-browser-loading-tile></collection-browser-loading-tile>`;\n\n private tileModelAtCellIndex(index: number): TileModel | undefined {\n const offsetIndex = index + this.tileModelOffset;\n const pageNumber = Math.floor(offsetIndex / this.pageSize) + 1;\n const itemIndex = offsetIndex % this.pageSize;\n const model = this.dataSource[pageNumber]?.[itemIndex];\n /**\n * If we encounter a model we don't have yet and we're not in the middle of an\n * automated scroll, fetch the page and just return undefined.\n * The datasource will be updated once the page is loaded and the cell will be rendered.\n *\n * We disable it during the automated scroll since we may fetch pages for cells the\n * user may never see.\n */\n if (!model && !this.isScrollingToCell) {\n this.fetchPage(pageNumber);\n }\n return model;\n }\n\n private get sortFilterQueries(): string {\n const queries = [this.titleQuery, this.creatorQuery];\n return queries.filter(q => q).join(' AND ');\n }\n\n // this is the total number of tiles we expect if\n // the data returned is a full page worth\n // this is useful for putting in placeholders for the expected number of tiles\n private get estimatedTileCount(): number {\n return this.pagesToRender * this.pageSize;\n }\n\n /**\n * The results per page so we can paginate.\n *\n * This allows us to start in the middle of the search results and\n * fetch data before or after the current page. If we don't have a key\n * for the previous/next page, we'll fetch the next/previous page to populate it\n */\n private dataSource: Record<string, TileModel[]> = {};\n\n /**\n * How many tiles to offset the data source by, to account for any removed tiles.\n */\n private tileModelOffset = 0;\n\n @query('infinite-scroller')\n private infiniteScroller!: InfiniteScroller;\n\n private sessionIdGenPromise?: Promise<string>;\n\n /**\n * Returns a promise resolving to a unique string that persists for the current browser session.\n * Used in generating unique IDs for search requests, so that multiple requests coming from the\n * same browser session can be identified.\n */\n private async getSessionId(): Promise<string> {\n try {\n const storedSessionId = sessionStorage?.getItem('cb-session');\n if (storedSessionId) {\n return storedSessionId;\n }\n\n // If we enter this method a second time while a first session ID is already being generated,\n // ensure we produce the same ID from both calls instead of generating another one.\n if (this.sessionIdGenPromise) {\n return this.sessionIdGenPromise;\n }\n\n this.sessionIdGenPromise = sha1(Math.random().toString());\n const newSessionId = await this.sessionIdGenPromise;\n\n sessionStorage?.setItem('cb-session', newSessionId);\n return newSessionId;\n } catch (err) {\n // Either we can't generate the hash or we're restricted from accessing sessionStorage\n return '';\n }\n }\n\n /**\n * Go to the given page of results\n *\n * @param pageNumber\n */\n goToPage(pageNumber: number) {\n this.initialPageNumber = pageNumber;\n this.pagesToRender = pageNumber;\n return this.scrollToPage(pageNumber);\n }\n\n /**\n * Clears all selected/negated facets, date ranges, and letter filters.\n *\n * By default, the current sort field/direction are not cleared,\n * but this can be overridden by setting the `sort` option to `true`.\n *\n * Similarly, it is possible to finely control what is cleared by\n * setting any of the `facets`, `dateRange`, or `letterFilters` flags\n * in the options object.\n */\n clearFilters({\n facets = true,\n dateRange = true,\n letterFilters = true,\n sort = false,\n } = {}): void {\n // Don't bother clearing facets if none are checked, so that we don't\n // trigger unnecessary update cycles.\n if (facets && this.hasCheckedFacets) {\n this.selectedFacets = getDefaultSelectedFacets();\n }\n\n if (dateRange) {\n this.minSelectedDate = undefined;\n this.maxSelectedDate = undefined;\n }\n\n if (letterFilters) {\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = null;\n }\n\n if (sort) {\n this.sortParam = null;\n this.sortDirection = null;\n this.selectedSort = SortField.default;\n }\n }\n\n /**\n * Returns true if the current value of `this.selectedFacets` contains\n * any facet buckets than have been selected or negated, or false otherwise.\n */\n private get hasCheckedFacets(): boolean {\n if (!this.selectedFacets) return false;\n\n for (const facetGroup of Object.values(this.selectedFacets)) {\n for (const bucket of Object.values(facetGroup)) {\n if (bucket.state !== 'none') return true;\n }\n }\n\n return false;\n }\n\n /**\n * Returns true if there are any currently selected/negated facet buckets,\n * any selected date range, or any selected letter filters. False otherwise.\n *\n * Ignores sorting options.\n */\n private get hasActiveFilters(): boolean {\n return !!(\n this.hasCheckedFacets ||\n this.minSelectedDate ||\n this.maxSelectedDate ||\n this.selectedTitleFilter ||\n this.selectedCreatorFilter\n );\n }\n\n render() {\n this.setPlaceholderType();\n return html`\n <div\n id=\"content-container\"\n class=${this.mobileView ? 'mobile' : 'desktop'}\n >\n ${this.placeholderType\n ? this.emptyPlaceholderTemplate\n : this.collectionBrowserTemplate}\n </div>\n `;\n }\n\n private setPlaceholderType() {\n const hasQuery = !!this.baseQuery?.trim();\n const isCollection = !!this.withinCollection;\n const noResults =\n !this.searchResultsLoading &&\n (this.totalResults === 0 || !this.searchService);\n\n this.placeholderType = null;\n if (!hasQuery && !isCollection) {\n this.placeholderType = 'empty-query';\n } else if (noResults) {\n // Within a collection, no query + no results means the collection simply has no viewable items.\n // Otherwise, we must have a user query that produced 0 results.\n this.placeholderType =\n !hasQuery && isCollection ? 'empty-collection' : 'no-results';\n }\n\n if (this.queryErrorMessage) {\n this.placeholderType =\n !hasQuery && isCollection ? 'collection-error' : 'query-error';\n }\n }\n\n private get emptyPlaceholderTemplate() {\n return html`\n <empty-placeholder\n .placeholderType=${this.placeholderType}\n ?isMobileView=${this.mobileView}\n ?isCollection=${!!this.withinCollection}\n .detailMessage=${this.queryErrorMessage ?? ''}\n .baseNavigationUrl=${this.baseNavigationUrl}\n ></empty-placeholder>\n ${this.infiniteScrollerTemplate}\n `;\n }\n\n /**\n * Top-level template for rendering the left (facets) and right (results) columns.\n */\n private get collectionBrowserTemplate() {\n return html`\n <div id=\"left-column-scroll-sentinel\"></div>\n ${this.leftColumnTemplate} ${this.rightColumnTemplate}\n `;\n }\n\n /**\n * Template for either the mobile or desktop version of the left column, depending\n * on current component state.\n */\n private get leftColumnTemplate(): TemplateResult {\n if (this.mobileView) {\n return this.mobileLeftColumnTemplate;\n }\n return this.desktopLeftColumnTemplate;\n }\n\n /**\n * Template for the mobile version of the \"left column\" (which in this case, appears\n * *above* the search results rather than beside them), for rendering the\n * accordion-style facets.\n */\n private get mobileLeftColumnTemplate(): TemplateResult {\n return html`\n <div\n id=\"left-column\"\n class=\"column${this.isResizeToMobile ? ' preload' : ''}\"\n >\n ${this.resultsCountTemplate}\n <div id=\"facets-header-container\">${this.mobileFacetsTemplate}</div>\n </div>\n `;\n }\n\n /**\n * Template for the desktop version of the left column, displaying the facets sidebar.\n */\n private get desktopLeftColumnTemplate(): TemplateResult {\n return html`\n <div id=\"left-column\" class=\"column\">\n <div id=\"facets-header-container\">\n <h2 id=\"facets-header\" class=\"sr-only\">Filters</h2>\n ${this.resultsCountTemplate} ${this.clearFiltersBtnTemplate(false)}\n </div>\n <div id=\"facets-container\" aria-labelledby=\"facets-header\">\n ${this.facetsTemplate}\n <div id=\"facets-scroll-sentinel\"></div>\n </div>\n <div id=\"facets-bottom-fade\"></div>\n </div>\n `;\n }\n\n /**\n * Template for the \"X Results\" count at the top of the search results.\n * Changes to the \"Searching...\" label if the search results are still loading.\n */\n private get resultsCountTemplate(): TemplateResult {\n const shouldShowSearching =\n this.searchResultsLoading || this.totalResults === undefined;\n const resultsCount = this.totalResults?.toLocaleString();\n const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';\n\n return html`\n <div id=\"results-total\">\n <span id=\"big-results-count\">\n ${shouldShowSearching ? html`Searching&hellip;` : resultsCount}\n </span>\n <span id=\"big-results-label\">\n ${shouldShowSearching ? nothing : resultsLabel}\n </span>\n </div>\n `;\n }\n\n /**\n * Template for the right column of the collection browser, where the result\n * tiles and sort/filter bar are shown.\n */\n private get rightColumnTemplate(): TemplateResult {\n return html`\n <div id=\"right-column\" class=\"column\">\n ${this.isManageView\n ? this.manageBarTemplate\n : this.sortFilterBarTemplate}\n ${this.displayMode === `list-compact`\n ? this.listHeaderTemplate\n : nothing}\n ${this.infiniteScrollerTemplate}\n </div>\n `;\n }\n\n private get infiniteScrollerTemplate() {\n return html`<infinite-scroller\n class=${this.infiniteScrollerClasses}\n itemCount=${this.placeholderType ? 0 : nothing}\n ariaLandmarkLabel=\"Search results\"\n .cellProvider=${this}\n .placeholderCellTemplate=${this.placeholderCellTemplate}\n @scrollThresholdReached=${this.scrollThresholdReached}\n @visibleCellsChanged=${this.visibleCellsChanged}\n ></infinite-scroller>`;\n }\n\n private get infiniteScrollerClasses() {\n return classMap({\n [this.displayMode ?? '']: !!this.displayMode,\n hidden: !!this.placeholderType,\n });\n }\n\n private get sortFilterBarTemplate() {\n return html`\n <sort-filter-bar\n .defaultSortField=${this.defaultSortField}\n .defaultSortDirection=${this.defaultSortDirection}\n .selectedSort=${this.selectedSort}\n .sortDirection=${this.sortDirection}\n .showRelevance=${this.isRelevanceSortAvailable}\n .showDateFavorited=${this.withinCollection?.startsWith('fav-')}\n .displayMode=${this.displayMode}\n .selectedTitleFilter=${this.selectedTitleFilter}\n .selectedCreatorFilter=${this.selectedCreatorFilter}\n .prefixFilterCountMap=${this.prefixFilterCountMap}\n .resizeObserver=${this.resizeObserver}\n @sortChanged=${this.userChangedSort}\n @displayModeChanged=${this.displayModeChanged}\n @titleLetterChanged=${this.titleLetterSelected}\n @creatorLetterChanged=${this.creatorLetterSelected}\n >\n </sort-filter-bar>\n `;\n }\n\n private get manageBarTemplate(): TemplateResult {\n return html`\n <manage-bar\n showSelectAll\n showUnselectAll\n @removeItems=${this.handleRemoveItems}\n @selectAll=${this.checkAllTiles}\n @unselectAll=${this.uncheckAllTiles}\n @cancel=${() => {\n this.isManageView = false;\n this.uncheckAllTiles();\n }}\n ></manage-bar>\n `;\n }\n\n /**\n * Handler for when the user requests to remove all checked items via the manage bar.\n * Emits an `itemRemovalRequested` event with all checked tile models.\n */\n private handleRemoveItems(): void {\n this.dispatchEvent(\n new CustomEvent<{ items: ManageableItem[] }>('itemRemovalRequested', {\n detail: {\n items: this.checkedTileModels.map(model => ({\n ...model,\n date: formatDate(model.datePublished, 'long'),\n })),\n },\n })\n );\n }\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void {\n // To make sure our data source remains page-aligned, we will offset our data source by\n // the number of removed tiles, so that we can just add the offset when the infinite\n // scroller queries for cell contents.\n // This only matters while we're still viewing the same set of results. If the user changes\n // their query/filters/sort, then the data source is overwritten and the offset cleared.\n const { checkedTileModels, uncheckedTileModels } = this;\n const numChecked = checkedTileModels.length;\n if (numChecked === 0) return;\n this.tileModelOffset += numChecked;\n\n const newDataSource: typeof this.dataSource = {};\n\n // Which page the remaining tile models start on, post-offset\n let offsetPageNumber = Math.floor(this.tileModelOffset / this.pageSize) + 1;\n let indexOnPage = this.tileModelOffset % this.pageSize;\n\n // Fill the pages up to that point with empty models\n for (let page = 1; page <= offsetPageNumber; page += 1) {\n const remainingHidden = this.tileModelOffset - this.pageSize * (page - 1);\n const offsetCellsOnPage = Math.min(this.pageSize, remainingHidden);\n newDataSource[page] = Array(offsetCellsOnPage).fill(undefined);\n }\n\n // Shift all the remaining tiles into their new positions in the data source\n for (const model of uncheckedTileModels) {\n if (!newDataSource[offsetPageNumber])\n newDataSource[offsetPageNumber] = [];\n newDataSource[offsetPageNumber].push(model);\n indexOnPage += 1;\n if (indexOnPage >= this.pageSize) {\n offsetPageNumber += 1;\n indexOnPage = 0;\n }\n }\n\n // Swap in the new data source and update the infinite scroller\n this.dataSource = newDataSource;\n if (this.totalResults) this.totalResults -= numChecked;\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount -= numChecked;\n this.infiniteScroller.refreshAllVisibleCells();\n }\n }\n\n /**\n * Checks every tile's management checkbox\n */\n checkAllTiles(): void {\n this.mapDataSource(model => ({ ...model, checked: true }));\n }\n\n /**\n * Unchecks every tile's management checkbox\n */\n uncheckAllTiles(): void {\n this.mapDataSource(model => ({ ...model, checked: false }));\n }\n\n /**\n * Applies the given map function to all of the tile models in every page of the data\n * source. This method updates the data source object in immutable fashion.\n *\n * @param mapFn A callback function to apply on each tile model, as with Array.map\n */\n private mapDataSource(\n mapFn: (model: TileModel, index: number, array: TileModel[]) => TileModel\n ): void {\n this.dataSource = Object.fromEntries(\n Object.entries(this.dataSource).map(([page, tileModels]) => [\n page,\n tileModels.map((model, index, array) =>\n model ? mapFn(model, index, array) : model\n ),\n ])\n );\n this.infiniteScroller?.refreshAllVisibleCells();\n }\n\n /**\n * An array of all the tile models whose management checkboxes are checked\n */\n get checkedTileModels(): TileModel[] {\n return this.getFilteredTileModels(model => model.checked);\n }\n\n /**\n * An array of all the tile models whose management checkboxes are unchecked\n */\n get uncheckedTileModels(): TileModel[] {\n return this.getFilteredTileModels(model => !model.checked);\n }\n\n /**\n * Returns a flattened, filtered array of all the tile models in the data source\n * for which the given predicate returns a truthy value.\n *\n * @param predicate A callback function to apply on each tile model, as with Array.filter\n * @returns A filtered array of tile models satisfying the predicate\n */\n private getFilteredTileModels(\n predicate: (model: TileModel, index: number, array: TileModel[]) => unknown\n ): TileModel[] {\n return Object.values(this.dataSource)\n .flat()\n .filter((model, index, array) =>\n model ? predicate(model, index, array) : false\n );\n }\n\n private userChangedSort(\n e: CustomEvent<{\n selectedSort: SortField;\n sortDirection: SortDirection | null;\n }>\n ) {\n const { selectedSort, sortDirection } = e.detail;\n this.selectedSort = selectedSort;\n this.sortDirection = sortDirection;\n\n if ((this.currentPage ?? 1) > 1) {\n this.goToPage(1);\n }\n this.currentPage = 1;\n }\n\n private sendSortByAnalytics(prevSortDirection: SortDirection | null): void {\n const directionCleared = prevSortDirection && !this.sortDirection;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.sortBy,\n label: `${this.selectedSort}${\n this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''\n }`,\n });\n }\n\n private selectedSortChanged(): void {\n const sortOption = SORT_OPTIONS[this.selectedSort];\n if (!sortOption.handledBySearchService) {\n this.sortParam = null;\n return;\n }\n\n // If the sort option specified in the URL is unrecognized, we just use it as-is\n const urlSortParam = new URL(window.location.href).searchParams.get('sort');\n const sortField =\n sortOption.searchServiceKey ?? urlSortParam?.replace(/^-/, '');\n\n // If the sort direction is still null at this point, then we assume ascending\n // (i.e., it was unrecognized and had no directional flag)\n if (!this.sortDirection) this.sortDirection = 'asc';\n\n if (!sortField) return;\n this.sortParam = { field: sortField, direction: this.sortDirection };\n\n // Lazy-load the alphabet counts for title/creator sort bar as needed\n this.updatePrefixFiltersForCurrentSort();\n }\n\n private displayModeChanged(\n e: CustomEvent<{ displayMode?: CollectionDisplayMode }>\n ): void {\n this.displayMode = e.detail.displayMode;\n\n if (this.displayMode) {\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.displayMode,\n label: this.displayMode,\n });\n }\n }\n\n /**\n * Returns a query clause identifying the currently selected title filter,\n * e.g., `firstTitle:X`.\n */\n private get titleQuery(): string | undefined {\n return this.selectedTitleFilter\n ? `firstTitle:${this.selectedTitleFilter}`\n : undefined;\n }\n\n /**\n * Returns a query clause identifying the currently selected creator filter,\n * e.g., `firstCreator:X`.\n */\n private get creatorQuery(): string | undefined {\n return this.selectedCreatorFilter\n ? `firstCreator:${this.selectedCreatorFilter}`\n : undefined;\n }\n\n /**\n * Send Analytics when sorting by title's first letter\n * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'\n */\n private sendFilterByTitleAnalytics(prevSelectedLetter: string | null): void {\n if (!prevSelectedLetter && !this.selectedTitleFilter) {\n return;\n }\n const cleared = prevSelectedLetter && !this.selectedTitleFilter;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.filterByTitle,\n label: cleared\n ? `clear-${prevSelectedLetter}`\n : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,\n });\n }\n\n /**\n * Send Analytics when filtering by creator's first letter\n * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'\n */\n private sendFilterByCreatorAnalytics(\n prevSelectedLetter: string | null\n ): void {\n if (!prevSelectedLetter && !this.selectedCreatorFilter) {\n return;\n }\n const cleared = prevSelectedLetter && !this.selectedCreatorFilter;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.filterByCreator,\n label: cleared\n ? `clear-${prevSelectedLetter}`\n : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,\n });\n }\n\n /**\n * Handler for changes to which letter is selected in the title alphabet bar.\n */\n private titleLetterSelected(\n e: CustomEvent<{ selectedLetter: string | null }>\n ): void {\n this.selectedCreatorFilter = null;\n this.selectedTitleFilter = e.detail.selectedLetter;\n }\n\n /**\n * Handler for changes to which letter is selected in the creator alphabet bar.\n */\n private creatorLetterSelected(\n e: CustomEvent<{ selectedLetter: string | null }>\n ): void {\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = e.detail.selectedLetter;\n }\n\n /**\n * The full template for how the facets should be structured in mobile view,\n * including the collapsible container (with header) and the facets themselves.\n */\n private get mobileFacetsTemplate(): TemplateResult {\n const toggleFacetsVisible = () => {\n this.isResizeToMobile = false;\n this.mobileFacetsVisible = !this.mobileFacetsVisible;\n };\n\n return html`\n <details\n id=\"mobile-filter-collapse\"\n @click=${toggleFacetsVisible}\n @keyup=${toggleFacetsVisible}\n >\n <summary>\n <span class=\"collapser-icon\">${chevronIcon}</span>\n <h2>Filters</h2>\n ${this.clearFiltersBtnTemplate(true)}\n </summary>\n ${this.facetsTemplate}\n </details>\n `;\n }\n\n /**\n * The template for the facets component alone, without any surrounding wrappers.\n */\n private get facetsTemplate() {\n return html`\n <collection-facets\n @facetsChanged=${this.facetsChanged}\n @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}\n .collectionPagePath=${this.collectionPagePath}\n .parentCollections=${this.parentCollections}\n .withinCollection=${this.withinCollection}\n .searchService=${this.searchService}\n .featureFeedbackService=${this.featureFeedbackService}\n .recaptchaManager=${this.recaptchaManager}\n .resizeObserver=${this.resizeObserver}\n .searchType=${this.searchType}\n .aggregations=${this.aggregations}\n .fullYearsHistogramAggregation=${this.fullYearsHistogramAggregation}\n .minSelectedDate=${this.minSelectedDate}\n .maxSelectedDate=${this.maxSelectedDate}\n .selectedFacets=${this.selectedFacets}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .collectionNameCache=${this.collectionNameCache}\n .showHistogramDatePicker=${this.showHistogramDatePicker}\n .allowExpandingDatePicker=${!this.mobileView}\n .contentWidth=${this.contentWidth}\n .query=${this.baseQuery}\n .filterMap=${this.filterMap}\n .isManageView=${this.isManageView}\n .modalManager=${this.modalManager}\n ?collapsableFacets=${this.mobileView}\n ?facetsLoading=${this.facetsLoading}\n ?fullYearAggregationLoading=${this.facetsLoading}\n @facetClick=${this.facetClickHandler}\n .analyticsHandler=${this.analyticsHandler}\n >\n </collection-facets>\n `;\n }\n\n /**\n * The HTML template for the \"Clear all filters\" button, or `nothing` if no\n * filters are currently active.\n *\n * @param mobile Whether to style/shorten the button for mobile view\n */\n private clearFiltersBtnTemplate(\n mobile: boolean\n ): TemplateResult | typeof nothing {\n if (!this.hasActiveFilters) return nothing;\n\n const buttonClasses = classMap({\n 'clear-filters-btn': true,\n mobile,\n });\n\n const buttonText = mobile ? 'Clear all' : 'Clear all filters';\n\n return html`\n <div class=\"clear-filters-btn-row\">\n ${mobile\n ? html`<span class=\"clear-filters-btn-separator\">&nbsp;</span>`\n : nothing}\n <button class=${buttonClasses} @click=${this.clearFilters}>\n ${buttonText}\n </button>\n </div>\n `;\n }\n\n private get loadingTemplate() {\n return html`\n <div class=\"loading-cover\">\n <circular-activity-indicator></circular-activity-indicator>\n </div>\n `;\n }\n\n private get listHeaderTemplate() {\n return html`\n <div id=\"list-header\">\n <tile-dispatcher\n .tileDisplayMode=${'list-header'}\n .resizeObserver=${this.resizeObserver}\n .sortParam=${this.sortParam}\n .defaultSortParam=${this.defaultSortParam}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .loggedIn=${this.loggedIn}\n >\n </tile-dispatcher>\n </div>\n `;\n }\n\n private histogramDateRangeUpdated(\n e: CustomEvent<{\n minDate: string;\n maxDate: string;\n }>\n ) {\n const { minDate, maxDate } = e.detail;\n [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.histogramChanged,\n label: this.dateRangeQueryClause,\n });\n }\n\n private get dateRangeQueryClause() {\n if (!this.minSelectedDate || !this.maxSelectedDate) {\n return undefined;\n }\n\n return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;\n }\n\n /**\n * Emits an event indicating a change in whether the manage mode is shown.\n */\n private emitManageModeChangedEvent(): void {\n this.dispatchEvent(\n new CustomEvent<boolean>('manageModeChanged', {\n detail: this.isManageView,\n })\n );\n }\n\n firstUpdated(): void {\n this.setupStateRestorationObserver();\n this.restoreState();\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('placeholderType') && this.placeholderType === null) {\n if (!this.leftColIntersectionObserver) {\n this.setupLeftColumnScrollListeners();\n }\n if (!this.facetsIntersectionObserver) {\n this.setupFacetsScrollListeners();\n }\n this.updateLeftColumnHeight();\n }\n\n if (\n changed.has('displayMode') ||\n changed.has('baseNavigationUrl') ||\n changed.has('baseImageUrl') ||\n changed.has('loggedIn')\n ) {\n this.infiniteScroller?.reload();\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('searchType') ||\n changed.has('withinCollection')\n ) {\n // Unless this query/search type update is from the initial page load or the\n // result of hitting the back button,\n // we need to clear any existing filters since they may no longer be valid for\n // the new set of search results.\n if (!this.historyPopOccurred && this.initialQueryChangeHappened) {\n // Ordinarily, we leave the sort param unchanged between searches.\n // However, if we are changing the target collection itself, we want the sort cleared too,\n // since different collections may have different sorting options available.\n const shouldClearSort =\n changed.has('withinCollection') &&\n !changed.has('selectedSort') &&\n !changed.has('sortDirection');\n\n // Otherwise, only clear filters that haven't been simultaneously applied in this update\n this.clearFilters({\n sort: shouldClearSort,\n facets: !changed.has('selectedFacets'),\n dateRange: !(\n changed.has('minSelectedDate') || changed.has('maxSelectedDate')\n ),\n letterFilters: !(\n changed.has('selectedTitleFilter') ||\n changed.has('selectedCreatorFilter')\n ),\n });\n }\n }\n\n if (changed.has('baseQuery')) {\n this.emitBaseQueryChanged();\n }\n if (changed.has('searchType')) {\n this.emitSearchTypeChanged();\n }\n\n if (changed.has('currentPage') || changed.has('displayMode')) {\n this.persistState();\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('minSelectedDate') ||\n changed.has('maxSelectedDate') ||\n changed.has('selectedFacets') ||\n changed.has('searchService') ||\n changed.has('withinCollection')\n ) {\n this.refreshLetterCounts();\n }\n\n if (changed.has('selectedSort') || changed.has('sortDirection')) {\n const prevSortDirection = changed.get('sortDirection') as SortDirection;\n this.sendSortByAnalytics(prevSortDirection);\n this.selectedSortChanged();\n }\n\n if (changed.has('selectedTitleFilter')) {\n this.sendFilterByTitleAnalytics(\n changed.get('selectedTitleFilter') as string\n );\n }\n if (changed.has('selectedCreatorFilter')) {\n this.sendFilterByCreatorAnalytics(\n changed.get('selectedCreatorFilter') as string\n );\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('searchType') ||\n changed.has('selectedTitleFilter') ||\n changed.has('selectedCreatorFilter') ||\n changed.has('minSelectedDate') ||\n changed.has('maxSelectedDate') ||\n changed.has('sortParam') ||\n changed.has('selectedFacets') ||\n changed.has('searchService') ||\n changed.has('withinCollection')\n ) {\n this.handleQueryChange();\n }\n\n if (changed.has('searchResultsLoading')) {\n this.emitSearchResultsLoadingChanged();\n }\n\n if (\n changed.has('facetsLoading') &&\n this.facetsLoading &&\n this.collectionFacets\n ) {\n this.collectionFacets.moreLinksVisible =\n this.searchType !== SearchType.FULLTEXT;\n }\n\n if (changed.has('pagesToRender')) {\n if (!this.endOfDataReached && this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.estimatedTileCount;\n }\n }\n\n if (changed.has('isManageView')) {\n if (this.isManageView) this.displayMode = 'grid';\n this.infiniteScroller?.refreshAllVisibleCells();\n this.emitManageModeChangedEvent();\n }\n\n if (changed.has('resizeObserver')) {\n const oldObserver = changed.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n if (oldObserver) this.disconnectResizeObserver(oldObserver);\n this.setupResizeObserver();\n }\n }\n\n disconnectedCallback(): void {\n if (this.resizeObserver) {\n this.disconnectResizeObserver(this.resizeObserver);\n }\n if (this.boundNavigationHandler) {\n window.removeEventListener('popstate', this.boundNavigationHandler);\n }\n\n this.leftColIntersectionObserver?.disconnect();\n this.facetsIntersectionObserver?.disconnect();\n window.removeEventListener('resize', this.updateLeftColumnHeight);\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n const previousView = this.mobileView;\n if (entry.target === this.contentContainer) {\n this.contentWidth = entry.contentRect.width;\n this.mobileView =\n this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;\n // If changing from desktop to mobile disable transition\n if (this.mobileView && !previousView) {\n this.isResizeToMobile = true;\n }\n }\n\n // Ensure the facet sidebar remains sized correctly\n this.updateLeftColumnHeight();\n }\n\n /**\n * Sets up listeners for events that may require updating the left column height.\n */\n private setupLeftColumnScrollListeners(): void {\n // We observe intersections between the left column's scroll sentinel and\n // the viewport, so that we can ensure the left column is always sized to\n // match the _available_ viewport height. This should generally be more\n // performant than listening to scroll events on the page or column.\n const leftColumnSentinel = this.shadowRoot?.querySelector(\n '#left-column-scroll-sentinel'\n );\n if (leftColumnSentinel) {\n this.leftColIntersectionObserver = new IntersectionObserver(\n this.updateLeftColumnHeight,\n {\n threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%\n }\n );\n this.leftColIntersectionObserver.observe(leftColumnSentinel);\n }\n\n // We also listen for window resize events, as they are not always captured\n // by the resize observer and can affect the desired height of the left column.\n window.addEventListener('resize', this.updateLeftColumnHeight);\n }\n\n /**\n * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.\n * Note this uses a separate IntersectionObserver from the left column, because we\n * don't need granular intersection thresholds for this.\n */\n private setupFacetsScrollListeners(): void {\n const facetsSentinel = this.shadowRoot?.querySelector(\n '#facets-scroll-sentinel'\n );\n if (facetsSentinel) {\n this.facetsIntersectionObserver = new IntersectionObserver(\n this.updateFacetFadeOut\n );\n this.facetsIntersectionObserver.observe(facetsSentinel);\n }\n }\n\n /**\n * Updates the height of the left column according to its position on the page.\n * Arrow function ensures proper `this` binding.\n */\n private updateLeftColumnHeight = (): void => {\n if (this.mobileView) {\n this.leftColumn?.style?.removeProperty('height');\n } else {\n const clientTop = this.leftColumn?.getBoundingClientRect().top;\n this.leftColumn?.style?.setProperty(\n 'height',\n `${window.innerHeight - (clientTop ?? 0) - 3}px`\n );\n }\n };\n\n /**\n * Toggles whether the fade-out is visible at the bottom of the facets.\n * It should only be visible if the facets are not scrolled to the bottom.\n * Arrow function ensures proper `this` binding.\n */\n private updateFacetFadeOut = (entries: IntersectionObserverEntry[]): void => {\n const fadeElmt = this.shadowRoot?.getElementById('facets-bottom-fade');\n fadeElmt?.classList.toggle('hidden', entries?.[0]?.isIntersecting);\n };\n\n private emitBaseQueryChanged() {\n this.dispatchEvent(\n new CustomEvent<{ baseQuery?: string }>('baseQueryChanged', {\n detail: {\n baseQuery: this.baseQuery,\n },\n })\n );\n }\n\n private emitSearchTypeChanged() {\n this.dispatchEvent(\n new CustomEvent<SearchType>('searchTypeChanged', {\n detail: this.searchType,\n })\n );\n }\n\n private emitEmptyResults() {\n this.dispatchEvent(new Event('emptyResults'));\n }\n\n private disconnectResizeObserver(\n resizeObserver: SharedResizeObserverInterface\n ) {\n resizeObserver.removeObserver({\n target: this.contentContainer,\n handler: this,\n });\n }\n\n private setupResizeObserver() {\n if (!this.resizeObserver) return;\n this.resizeObserver.addObserver({\n target: this.contentContainer,\n handler: this,\n });\n }\n\n /**\n * When the visible cells change from the infinite scroller, we want to emit\n * which page is currently visible so the consumer can update its UI or the URL\n *\n * @param e\n * @returns\n */\n private visibleCellsChanged(\n e: CustomEvent<{ visibleCellIndices: number[] }>\n ) {\n if (this.isScrollingToCell) return;\n const { visibleCellIndices } = e.detail;\n if (visibleCellIndices.length === 0) return;\n const lastVisibleCellIndex =\n visibleCellIndices[visibleCellIndices.length - 1];\n const lastVisibleCellPage =\n Math.floor(lastVisibleCellIndex / this.pageSize) + 1;\n if (this.currentPage !== lastVisibleCellPage) {\n this.currentPage = lastVisibleCellPage;\n }\n const event = new CustomEvent('visiblePageChanged', {\n detail: {\n pageNumber: lastVisibleCellPage,\n },\n });\n this.dispatchEvent(event);\n }\n\n // we only want to scroll on the very first query change\n // so this keeps track of whether we've already set the initial query\n private initialQueryChangeHappened = false;\n\n private historyPopOccurred = false;\n\n // this lets us store the query key so we know if it's actually changed or not\n private previousQueryKey?: string;\n\n /**\n * Internal property to store the `resolve` function for the most recent\n * `initialSearchComplete` promise, allowing us to resolve it at the appropriate time.\n */\n private _initialSearchCompleteResolver!: (val: boolean) => void;\n\n /**\n * Internal property to store the private value backing the `initialSearchComplete` getter.\n */\n private _initialSearchCompletePromise: Promise<boolean> = new Promise(res => {\n this._initialSearchCompleteResolver = res;\n });\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n get initialSearchComplete(): Promise<boolean> {\n return this._initialSearchCompletePromise;\n }\n\n private async handleQueryChange() {\n // only reset if the query has actually changed\n if (!this.searchService || this.pageFetchQueryKey === this.previousQueryKey)\n return;\n\n // If the new state prevents us from updating the search results, don't reset\n if (!this.canPerformSearch) return;\n\n this.previousQueryKey = this.pageFetchQueryKey;\n\n this.dataSource = {};\n this.tileModelOffset = 0;\n this.totalResults = undefined;\n this.aggregations = undefined;\n this.fullYearsHistogramAggregation = undefined;\n this.pageFetchesInProgress = {};\n this.endOfDataReached = false;\n this.pagesToRender =\n this.initialPageNumber === 1\n ? 2 // First two pages are batched into one request when starting from page 1\n : this.initialPageNumber;\n this.queryErrorMessage = undefined;\n\n // Reset the infinite scroller's item count, so that it\n // shows tile placeholders until the new query's results load in\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.estimatedTileCount;\n this.infiniteScroller.reload();\n }\n\n if (this.withinCollection && this.baseQuery?.trim()) {\n this.defaultSortField = SortField.relevance;\n this.defaultSortDirection = null;\n }\n\n if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {\n this.scrollToPage(this.initialPageNumber);\n }\n this.initialQueryChangeHappened = true;\n\n // if the query changed as part of a window.history pop event, we don't want to\n // persist the state because it overwrites the forward history\n if (!this.historyPopOccurred) {\n this.persistState();\n }\n this.historyPopOccurred = false;\n\n // Reset the `initialSearchComplete` promise with a new value for the imminent search\n this._initialSearchCompletePromise = new Promise(res => {\n this._initialSearchCompleteResolver = res;\n });\n\n // Fire the initial page and facets requests\n await Promise.all([this.doInitialPageFetch(), this.fetchFacets()]);\n\n // Resolve the `initialSearchComplete` promise for this search\n this._initialSearchCompleteResolver(true);\n }\n\n private setupStateRestorationObserver() {\n if (this.boundNavigationHandler) return;\n this.boundNavigationHandler = this.historyNavigationHandler.bind(this);\n // when the user navigates back, we want to update the UI to match the URL\n window.addEventListener('popstate', this.boundNavigationHandler);\n }\n\n private boundNavigationHandler?: () => void;\n\n private historyNavigationHandler() {\n this.historyPopOccurred = true;\n this.restoreState();\n }\n\n private restoreState() {\n const restorationState = this.restorationStateHandler.getRestorationState();\n this.displayMode = restorationState.displayMode;\n if (restorationState.searchType != null)\n this.searchType = restorationState.searchType;\n this.selectedSort = restorationState.selectedSort ?? SortField.default;\n this.sortDirection = restorationState.sortDirection ?? null;\n this.selectedTitleFilter = restorationState.selectedTitleFilter ?? null;\n this.selectedCreatorFilter = restorationState.selectedCreatorFilter ?? null;\n this.selectedFacets = restorationState.selectedFacets;\n this.baseQuery = restorationState.baseQuery;\n this.currentPage = restorationState.currentPage ?? 1;\n this.minSelectedDate = restorationState.minSelectedDate;\n this.maxSelectedDate = restorationState.maxSelectedDate;\n if (this.currentPage > 1) {\n this.goToPage(this.currentPage);\n }\n }\n\n private persistState() {\n const restorationState: RestorationState = {\n displayMode: this.displayMode,\n searchType: this.searchType,\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection ?? undefined,\n selectedFacets: this.selectedFacets ?? getDefaultSelectedFacets(),\n baseQuery: this.baseQuery,\n currentPage: this.currentPage,\n titleQuery: this.titleQuery,\n creatorQuery: this.creatorQuery,\n minSelectedDate: this.minSelectedDate,\n maxSelectedDate: this.maxSelectedDate,\n selectedTitleFilter: this.selectedTitleFilter ?? undefined,\n selectedCreatorFilter: this.selectedCreatorFilter ?? undefined,\n };\n this.restorationStateHandler.persistState(restorationState);\n }\n\n private async doInitialPageFetch(): Promise<void> {\n this.searchResultsLoading = true;\n // Try to batch 2 initial page requests when possible\n await this.fetchPage(this.initialPageNumber, 2);\n this.searchResultsLoading = false;\n }\n\n private emitSearchResultsLoadingChanged(): void {\n this.dispatchEvent(\n new CustomEvent<{ loading: boolean }>('searchResultsLoadingChanged', {\n detail: {\n loading: this.searchResultsLoading,\n },\n })\n );\n }\n\n /**\n * Produces a compact unique ID for a search request that can help with debugging\n * on the backend by making related requests easier to trace through different services.\n * (e.g., tying the hits/aggregations requests for the same page back to a single hash).\n *\n * @param params The search service parameters for the request\n * @param kind The kind of request (hits-only, aggregations-only, or both)\n * @returns A Promise resolving to the uid to apply to the request\n */\n private async requestUID(\n params: SearchParams,\n kind: RequestKind\n ): Promise<string> {\n const paramsToHash = JSON.stringify({\n pageType: params.pageType,\n pageTarget: params.pageTarget,\n query: params.query,\n fields: params.fields,\n filters: params.filters,\n sort: params.sort,\n searchType: this.searchType,\n });\n\n const fullQueryHash = (await sha1(paramsToHash)).slice(0, 20); // First 80 bits of SHA-1 are plenty for this\n const sessionId = (await this.getSessionId()).slice(0, 20); // Likewise\n const page = params.page ?? 0;\n const kindPrefix = kind.charAt(0); // f = full, h = hits, a = aggregations\n const currentTime = Date.now();\n\n return `R:${fullQueryHash}-S:${sessionId}-P:${page}-K:${kindPrefix}-T:${currentTime}`;\n }\n\n /**\n * Constructs a search service FilterMap object from the combination of\n * all the currently-applied filters. This includes any facets, letter\n * filters, and date range.\n */\n private get filterMap(): FilterMap {\n const builder = new FilterMapBuilder();\n\n // Add the date range, if applicable\n if (this.minSelectedDate) {\n builder.addFilter(\n 'year',\n this.minSelectedDate,\n FilterConstraint.GREATER_OR_EQUAL\n );\n }\n if (this.maxSelectedDate) {\n builder.addFilter(\n 'year',\n this.maxSelectedDate,\n FilterConstraint.LESS_OR_EQUAL\n );\n }\n\n // Add any selected facets\n if (this.selectedFacets) {\n for (const [facetName, facetValues] of Object.entries(\n this.selectedFacets\n )) {\n const { name, values } = this.prepareFacetForFetch(\n facetName,\n facetValues\n );\n for (const [value, bucket] of Object.entries(values)) {\n let constraint;\n if (bucket.state === 'selected') {\n constraint = FilterConstraint.INCLUDE;\n } else if (bucket.state === 'hidden') {\n constraint = FilterConstraint.EXCLUDE;\n }\n\n if (constraint) {\n builder.addFilter(name, value, constraint);\n }\n }\n }\n }\n\n // Add any letter filters\n if (this.selectedTitleFilter) {\n builder.addFilter(\n 'firstTitle',\n this.selectedTitleFilter,\n FilterConstraint.INCLUDE\n );\n }\n if (this.selectedCreatorFilter) {\n builder.addFilter(\n 'firstCreator',\n this.selectedCreatorFilter,\n FilterConstraint.INCLUDE\n );\n }\n\n const filterMap = builder.build();\n return filterMap;\n }\n\n /** The full query, including year facets and date range clauses */\n private get fullQuery(): string | undefined {\n let fullQuery = this.baseQuery?.trim() ?? '';\n\n const { facetQuery, dateRangeQueryClause, sortFilterQueries } = this;\n\n if (facetQuery) {\n fullQuery += ` AND ${facetQuery}`;\n }\n if (dateRangeQueryClause) {\n fullQuery += ` AND ${dateRangeQueryClause}`;\n }\n if (sortFilterQueries) {\n fullQuery += ` AND ${sortFilterQueries}`;\n }\n return fullQuery.trim();\n }\n\n /**\n * Generates a query string for the given facets\n *\n * Example: `mediatype:(\"collection\" OR \"audio\" OR -\"etree\") AND year:(\"2000\" OR \"2001\")`\n */\n private get facetQuery(): string | undefined {\n if (!this.selectedFacets) return undefined;\n const facetClauses = [];\n for (const [facetName, facetValues] of Object.entries(\n this.selectedFacets\n )) {\n facetClauses.push(this.buildFacetClause(facetName, facetValues));\n }\n return this.joinFacetClauses(facetClauses)?.trim();\n }\n\n /**\n * Builds an OR-joined facet clause for the given facet name and values.\n *\n * E.g., for name `subject` and values\n * `{ foo: { state: 'selected' }, bar: { state: 'hidden' } }`\n * this will produce the clause\n * `subject:(\"foo\" OR -\"bar\")`.\n *\n * @param facetName The facet type (e.g., 'collection')\n * @param facetValues The facet buckets, mapped by their keys\n */\n private buildFacetClause(\n facetName: string,\n facetValues: Record<string, FacetBucket>\n ): string {\n const { name: facetQueryName, values } = this.prepareFacetForFetch(\n facetName,\n facetValues\n );\n const facetEntries = Object.entries(values);\n if (facetEntries.length === 0) return '';\n\n const facetValuesArray: string[] = [];\n for (const [key, facetData] of facetEntries) {\n const plusMinusPrefix = facetData.state === 'hidden' ? '-' : '';\n facetValuesArray.push(`${plusMinusPrefix}\"${key}\"`);\n }\n\n const valueQuery = facetValuesArray.join(` OR `);\n return `${facetQueryName}:(${valueQuery})`;\n }\n\n /**\n * Handles some special pre-request normalization steps for certain facet types\n * that require them.\n *\n * @param facetName The name of the facet type (e.g., 'language')\n * @param facetValues An array of values for that facet type\n */\n private prepareFacetForFetch(\n facetName: string,\n facetValues: Record<string, FacetBucket>\n ): { name: string; values: Record<string, FacetBucket> } {\n // eslint-disable-next-line prefer-const\n let [normalizedName, normalizedValues] = [facetName, facetValues];\n\n // The full \"search engine\" name of the lending field is \"lending___status\"\n if (facetName === 'lending') {\n normalizedName = 'lending___status';\n }\n\n return {\n name: normalizedName,\n values: normalizedValues,\n };\n }\n\n /**\n * Takes an array of facet clauses, and combines them into a\n * full AND-joined facet query string. Empty clauses are ignored.\n */\n private joinFacetClauses(facetClauses: string[]): string | undefined {\n const nonEmptyFacetClauses = facetClauses.filter(\n clause => clause.length > 0\n );\n return nonEmptyFacetClauses.length > 0\n ? `(${nonEmptyFacetClauses.join(' AND ')})`\n : undefined;\n }\n\n facetsChanged(e: CustomEvent<SelectedFacets>) {\n this.selectedFacets = e.detail;\n }\n\n facetClickHandler({\n detail: { key, state: facetState, negative },\n }: CustomEvent<FacetEventDetails>): void {\n if (negative) {\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action:\n facetState !== 'none'\n ? analyticsActions.facetNegativeSelected\n : analyticsActions.facetNegativeDeselected,\n label: key,\n });\n } else {\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action:\n facetState !== 'none'\n ? analyticsActions.facetSelected\n : analyticsActions.facetDeselected,\n label: key,\n });\n }\n }\n\n private async fetchFacets() {\n const trimmedQuery = this.baseQuery?.trim();\n if (!this.canPerformSearch) return;\n\n const { facetFetchQueryKey } = this;\n\n const sortParams = this.sortParam ? [this.sortParam] : [];\n const params: SearchParams = {\n ...this.collectionParams,\n query: trimmedQuery || '',\n rows: 0,\n filters: this.filterMap,\n // Fetch a few extra buckets beyond the 6 we show, in case some get suppressed\n aggregationsSize: 10,\n // Note: we don't need an aggregations param to fetch the default aggregations from the PPS.\n // The default aggregations for the search_results page type should be what we need here.\n };\n params.uid = await this.requestUID(\n { ...params, sort: sortParams },\n 'aggregations'\n );\n\n this.facetsLoading = true;\n const searchResponse = await this.searchService?.search(\n params,\n this.searchType\n );\n const success = searchResponse?.success;\n\n // This is checking to see if the query has changed since the data was fetched.\n // If so, we just want to discard this set of aggregations because they are\n // likely no longer valid for the newer query.\n const queryChangedSinceFetch =\n facetFetchQueryKey !== this.facetFetchQueryKey;\n if (queryChangedSinceFetch) return;\n\n if (!success) {\n const errorMsg = searchResponse?.error?.message;\n const detailMsg = searchResponse?.error?.details?.message;\n\n if (!errorMsg && !detailMsg) {\n // @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'\n window?.Sentry?.captureMessage?.(\n 'Missing or malformed facet response from backend',\n 'error'\n );\n }\n\n return;\n }\n\n const { aggregations, collectionTitles } = success.response;\n this.aggregations = aggregations;\n\n if (collectionTitles) {\n this.collectionNameCache?.addKnownTitles(collectionTitles);\n } else if (this.aggregations?.collection) {\n this.collectionNameCache?.preloadIdentifiers(\n (this.aggregations.collection.buckets as Bucket[]).map(bucket =>\n bucket.key?.toString()\n )\n );\n }\n\n this.fullYearsHistogramAggregation =\n success?.response?.aggregations?.year_histogram;\n\n this.facetsLoading = false;\n }\n\n private scrollToPage(pageNumber: number): Promise<void> {\n return new Promise(resolve => {\n const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);\n // without this setTimeout, Safari just pauses until the `fetchPage` is complete\n // then scrolls to the cell\n setTimeout(() => {\n this.isScrollingToCell = true;\n this.infiniteScroller?.scrollToCell(cellIndexToScrollTo, true);\n // This timeout is to give the scroll animation time to finish\n // then updating the infinite scroller once we're done scrolling\n // There's no scroll animation completion callback so we're\n // giving it 0.5s to finish.\n setTimeout(() => {\n this.isScrollingToCell = false;\n this.infiniteScroller?.refreshAllVisibleCells();\n resolve();\n }, 500);\n }, 0);\n });\n }\n\n /**\n * Whether sorting by relevance makes sense for the current state.\n * Currently equivalent to having a non-empty query.\n */\n private get isRelevanceSortAvailable(): boolean {\n return !!this.baseQuery?.trim();\n }\n\n /**\n * Whether a search may be performed in the current state of the component.\n * This is only true if the search service is defined, and either\n * (a) a non-empty query is set, or\n * (b) we are on a collection page in metadata search mode.\n */\n private get canPerformSearch(): boolean {\n if (!this.searchService) return false;\n\n const trimmedQuery = this.baseQuery?.trim();\n const hasNonEmptyQuery = !!trimmedQuery;\n const isCollectionSearch = !!this.withinCollection;\n const isMetadataSearch = this.searchType === SearchType.METADATA;\n\n // Metadata searches within a collection are allowed to have no query.\n // Otherwise, a non-empty query must be set.\n return hasNonEmptyQuery || (isCollectionSearch && isMetadataSearch);\n }\n\n /**\n * Additional params to pass to the search service if targeting a collection page,\n * or null otherwise.\n */\n private get collectionParams(): {\n pageType: string;\n pageTarget: string;\n } | null {\n return this.withinCollection\n ? { pageType: 'collection_details', pageTarget: this.withinCollection }\n : null;\n }\n\n /**\n * The query key is a string that uniquely identifies the current search.\n * It consists of:\n * - The current base query\n * - The current collection\n * - The current search type\n * - Any currently-applied facets\n * - Any currently-applied date range\n * - Any currently-applied prefix filters\n * - The current sort options\n *\n * This lets us keep track of queries so we don't persist data that's\n * no longer relevant.\n */\n private get pageFetchQueryKey(): string {\n const sortField = this.sortParam?.field ?? 'none';\n const sortDirection = this.sortParam?.direction ?? 'none';\n return `${this.fullQuery}-${this.withinCollection}-${this.searchType}-${sortField}-${sortDirection}`;\n }\n\n /**\n * Similar to `pageFetchQueryKey` above, but excludes sort fields since they\n * are not relevant in determining aggregation queries.\n */\n private get facetFetchQueryKey(): string {\n return `${this.fullQuery}-${this.withinCollection}-${this.searchType}`;\n }\n\n // this maps the query to the pages being fetched for that query\n private pageFetchesInProgress: Record<string, Set<number>> = {};\n\n /**\n * Fetches one or more pages of results and updates the data source.\n *\n * @param pageNumber The page number to fetch\n * @param numInitialPages If this is an initial page fetch (`pageNumber = 1`),\n * specifies how many pages to batch together in one request. Ignored\n * if `pageNumber != 1`, defaulting to a single page.\n */\n async fetchPage(pageNumber: number, numInitialPages = 1) {\n const trimmedQuery = this.baseQuery?.trim();\n if (!this.canPerformSearch) return;\n\n // if we already have data, don't fetch again\n if (this.dataSource[pageNumber]) return;\n\n if (this.endOfDataReached) return;\n\n // Batch multiple initial page requests together if needed (e.g., can request\n // pages 1 and 2 together in a single request).\n const numPages = pageNumber === 1 ? numInitialPages : 1;\n const numRows = this.pageSize * numPages;\n\n // if a fetch is already in progress for this query and page, don't fetch again\n const { pageFetchQueryKey } = this;\n const pageFetches =\n this.pageFetchesInProgress[pageFetchQueryKey] ?? new Set();\n if (pageFetches.has(pageNumber)) return;\n for (let i = 0; i < numPages; i += 1) {\n pageFetches.add(pageNumber + i);\n }\n this.pageFetchesInProgress[pageFetchQueryKey] = pageFetches;\n\n const sortParams = this.sortParam ? [this.sortParam] : [];\n const params: SearchParams = {\n ...this.collectionParams,\n query: trimmedQuery || '',\n page: pageNumber,\n rows: numRows,\n sort: sortParams,\n filters: this.filterMap,\n aggregations: { omit: true },\n };\n params.uid = await this.requestUID(params, 'hits');\n\n const searchResponse = await this.searchService?.search(\n params,\n this.searchType\n );\n const success = searchResponse?.success;\n\n // This is checking to see if the query has changed since the data was fetched.\n // If so, we just want to discard the data since there should be a new query\n // right behind it.\n const queryChangedSinceFetch = pageFetchQueryKey !== this.pageFetchQueryKey;\n if (queryChangedSinceFetch) return;\n\n if (!success) {\n const errorMsg = searchResponse?.error?.message;\n const detailMsg = searchResponse?.error?.details?.message;\n\n this.queryErrorMessage = `${errorMsg ?? ''}${\n detailMsg ? `; ${detailMsg}` : ''\n }`;\n\n if (!this.queryErrorMessage) {\n this.queryErrorMessage = 'Missing or malformed response from backend';\n // @ts-ignore: Property 'Sentry' does not exist on type 'Window & typeof globalThis'\n window?.Sentry?.captureMessage?.(this.queryErrorMessage, 'error');\n }\n\n for (let i = 0; i < numPages; i += 1) {\n this.pageFetchesInProgress[pageFetchQueryKey]?.delete(pageNumber + i);\n }\n\n this.searchResultsLoading = false;\n return;\n }\n\n this.totalResults = success.response.totalResults - this.tileModelOffset;\n\n // display event to offshoot when result count is zero.\n if (this.totalResults === 0) {\n this.emitEmptyResults();\n }\n\n if (this.withinCollection) {\n this.collectionInfo = success.response.collectionExtraInfo;\n\n // For collections, we want the UI to respect the default sort option\n // which can be specified in metadata, or otherwise assumed to be week:desc\n this.applyDefaultCollectionSort(this.collectionInfo);\n\n if (this.collectionInfo) {\n this.parentCollections = [].concat(\n this.collectionInfo.public_metadata?.collection ?? []\n );\n }\n }\n\n const { results, collectionTitles } = success.response;\n if (results && results.length > 0) {\n // Load any collection titles present on the response into the cache,\n // or queue up preload fetches for them if none were present.\n if (collectionTitles) {\n this.collectionNameCache?.addKnownTitles(collectionTitles);\n } else {\n this.preloadCollectionNames(results);\n }\n\n // Update the data source for each returned page\n for (let i = 0; i < numPages; i += 1) {\n const pageStartIndex = this.pageSize * i;\n this.updateDataSource(\n pageNumber + i,\n results.slice(pageStartIndex, pageStartIndex + this.pageSize)\n );\n }\n }\n\n // When we reach the end of the data, we can set the infinite scroller's\n // item count to the real total number of results (rather than the\n // temporary estimates based on pages rendered so far).\n const resultCountDiscrepancy = numRows - results.length;\n if (resultCountDiscrepancy > 0) {\n this.endOfDataReached = true;\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.totalResults;\n }\n }\n\n for (let i = 0; i < numPages; i += 1) {\n this.pageFetchesInProgress[pageFetchQueryKey]?.delete(pageNumber + i);\n }\n }\n\n private preloadCollectionNames(results: SearchResult[]) {\n const collectionIds = results\n .map(result => result.collection?.values)\n .flat();\n const collectionIdsArray = Array.from(new Set(collectionIds)) as string[];\n this.collectionNameCache?.preloadIdentifiers(collectionIdsArray);\n }\n\n /**\n * Applies any default sort option for the current collection, by checking\n * for one in the collection's metadata. If none is found, defaults to sorting\n * descending by:\n * - Date Favorited for fav-* collections\n * - Weekly views for all other collections\n */\n private applyDefaultCollectionSort(collectionInfo?: CollectionExtraInfo) {\n if (this.baseQuery) {\n // If there's a query set, then we default to relevance sorting regardless of\n // the collection metadata-specified sort.\n this.defaultSortField = SortField.relevance;\n this.defaultSortDirection = null;\n return;\n }\n\n // Favorite collections sort on Date Favorited by default.\n // Other collections fall back to sorting on weekly views.\n const baseDefaultSort: string =\n collectionInfo?.public_metadata?.identifier?.startsWith('fav-')\n ? '-favoritedate'\n : '-week';\n\n // The collection metadata may override the default sorting with something else\n const metadataSort: string | undefined =\n collectionInfo?.public_metadata?.['sort-by'];\n\n // Prefer the metadata-specified sort if one exists\n const defaultSortToApply = metadataSort ?? baseDefaultSort;\n\n // Account for both -field and field:dir formats\n let [field, dir] = defaultSortToApply.split(':');\n if (field.startsWith('-')) {\n field = field.slice(1);\n dir = 'desc';\n } else if (!['asc', 'desc'].includes(dir)) {\n dir = 'asc';\n }\n\n const sortOption = sortOptionFromAPIString(field);\n const sortField = sortOption.field;\n if (sortField && sortField !== SortField.default) {\n this.defaultSortField = sortField;\n this.defaultSortDirection = dir as SortDirection;\n this.defaultSortParam = {\n field: this.defaultSortField,\n direction: this.defaultSortDirection,\n };\n }\n }\n\n /**\n * This is useful for determining whether we need to reload the scroller.\n *\n * When the fetch completes, we need to reload the scroller if the cells for that\n * page are visible, but if the page is not currenlty visible, we don't need to reload\n */\n private get currentVisiblePageNumbers(): number[] {\n const visibleCells = this.infiniteScroller?.getVisibleCellIndices() ?? [];\n const visiblePages = new Set<number>();\n visibleCells.forEach(cellIndex => {\n const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;\n visiblePages.add(visiblePage);\n });\n return Array.from(visiblePages);\n }\n\n /**\n * Update the datasource from the fetch response\n *\n * @param pageNumber\n * @param results\n */\n private updateDataSource(pageNumber: number, results: SearchResult[]) {\n // copy our existing datasource so when we set it below, it gets set\n // instead of modifying the existing dataSource since object changes\n // don't trigger a re-render\n const datasource = { ...this.dataSource };\n const tiles: TileModel[] = [];\n results?.forEach(result => {\n if (!result.identifier) return;\n\n let loginRequired = false;\n let contentWarning = false;\n // Check if item and item in \"modifying\" collection, setting above flags\n if (\n result.collection?.values.length &&\n result.mediatype?.value !== 'collection'\n ) {\n for (const collection of result.collection?.values ?? []) {\n if (collection === 'loggedin') {\n loginRequired = true;\n if (contentWarning) break;\n }\n if (collection === 'no-preview') {\n contentWarning = true;\n if (loginRequired) break;\n }\n }\n }\n\n tiles.push({\n averageRating: result.avg_rating?.value,\n checked: false,\n collections: result.collection?.values ?? [],\n collectionFilesCount: result.collection_files_count?.value ?? 0,\n collectionSize: result.collection_size?.value ?? 0,\n commentCount: result.num_reviews?.value ?? 0,\n creator: result.creator?.value,\n creators: result.creator?.values ?? [],\n dateAdded: result.addeddate?.value,\n dateArchived: result.publicdate?.value,\n datePublished: result.date?.value,\n dateReviewed: result.reviewdate?.value,\n description: result.description?.values.join('\\n'),\n favCount: result.num_favorites?.value ?? 0,\n href: this.collapseRepeatedQuotes(result.__href__?.value),\n identifier: result.identifier,\n issue: result.issue?.value,\n itemCount: result.item_count?.value ?? 0,\n mediatype: this.getMediatype(result),\n snippets: result.highlight?.values ?? [],\n source: result.source?.value,\n subjects: result.subject?.values ?? [],\n title: result.title?.value ?? '',\n volume: result.volume?.value,\n viewCount: result.downloads?.value ?? 0,\n weeklyViewCount: result.week?.value,\n loginRequired,\n contentWarning,\n });\n });\n datasource[pageNumber] = tiles;\n this.dataSource = datasource;\n const visiblePages = this.currentVisiblePageNumbers;\n const needsReload = visiblePages.includes(pageNumber);\n if (needsReload) {\n this.infiniteScroller?.refreshAllVisibleCells();\n }\n }\n\n private getMediatype(result: SearchResult) {\n /**\n * hit_type == 'favorited_search' is basically a new hit_type\n * - we are getting from PPS.\n * - which gives response for fav- collection\n * - having favorited items like account/collection/item etc..\n * - as user can also favorite a search result (a search page)\n * - so we need to have response (having fav- items and fav- search results)\n *\n * if backend hit_type == 'favorited_search'\n * - let's assume a \"search\" as new mediatype\n */\n if (result?.rawMetadata?.hit_type === 'favorited_search') {\n return 'search';\n }\n\n return result.mediatype?.value ?? 'data';\n }\n\n /**\n * Returns the input string, but removing one set of quotes from all instances of\n * \"\"clauses wrapped in two sets of quotes\"\". This assumes the quotes are already\n * URL-encoded.\n *\n * This should be a temporary measure to address the fact that the __href__ field\n * sometimes acquires extra quotation marks during query rewriting. Once there is a\n * full Lucene parser in place that handles quoted queries correctly, this can likely\n * be removed.\n */\n private collapseRepeatedQuotes(str?: string): string | undefined {\n return str?.replace(/%22%22(?!%22%22)(.+?)%22%22/g, '%22$1%22');\n }\n\n /** Fetches the aggregation buckets for the given prefix filter type. */\n private async fetchPrefixFilterBuckets(\n filterType: PrefixFilterType\n ): Promise<Bucket[]> {\n const trimmedQuery = this.baseQuery?.trim();\n if (!this.canPerformSearch) return [];\n\n const filterAggregationKey = prefixFilterAggregationKeys[filterType];\n const sortParams = this.sortParam ? [this.sortParam] : [];\n\n const params: SearchParams = {\n ...this.collectionParams,\n query: trimmedQuery || '',\n rows: 0,\n filters: this.filterMap,\n // Only fetch the firstTitle or firstCreator aggregation\n aggregations: { simpleParams: [filterAggregationKey] },\n // Fetch all 26 letter buckets\n aggregationsSize: 26,\n };\n params.uid = await this.requestUID(\n { ...params, sort: sortParams },\n 'aggregations'\n );\n\n const searchResponse = await this.searchService?.search(\n params,\n this.searchType\n );\n\n return (searchResponse?.success?.response?.aggregations?.[\n filterAggregationKey\n ]?.buckets ?? []) as Bucket[];\n }\n\n /** Fetches and caches the prefix filter counts for the given filter type. */\n private async updatePrefixFilterCounts(\n filterType: PrefixFilterType\n ): Promise<void> {\n const { facetFetchQueryKey } = this;\n const buckets = await this.fetchPrefixFilterBuckets(filterType);\n\n // Don't update the filter counts for an outdated query (if it has been changed\n // since we sent the request)\n const queryChangedSinceFetch =\n facetFetchQueryKey !== this.facetFetchQueryKey;\n if (queryChangedSinceFetch) return;\n\n // Unpack the aggregation buckets into a simple map like { 'A': 50, 'B': 25, ... }\n this.prefixFilterCountMap = { ...this.prefixFilterCountMap }; // Clone the object to trigger an update\n this.prefixFilterCountMap[filterType] = buckets.reduce(\n (acc: Record<string, number>, bucket: Bucket) => {\n acc[(bucket.key as string).toUpperCase()] = bucket.doc_count;\n return acc;\n },\n {}\n );\n }\n\n /**\n * Fetches and caches the prefix filter counts for the current sort type,\n * provided it is one that permits prefix filtering. (If not, this does nothing).\n */\n private async updatePrefixFiltersForCurrentSort(): Promise<void> {\n if (['title', 'creator'].includes(this.selectedSort)) {\n const filterType = this.selectedSort as PrefixFilterType;\n if (!this.prefixFilterCountMap[filterType]) {\n this.updatePrefixFilterCounts(filterType);\n }\n }\n }\n\n /**\n * Clears the cached letter counts for both title and creator, and\n * fetches a new set of counts for whichever of them is the currently\n * selected sort option (which may be neither).\n *\n * Call this whenever the counts are invalidated (e.g., by a query change).\n */\n private refreshLetterCounts(): void {\n if (Object.keys(this.prefixFilterCountMap).length > 0) {\n this.prefixFilterCountMap = {};\n }\n this.updatePrefixFiltersForCurrentSort();\n }\n\n /**\n * Callback when a result is selected\n */\n resultSelected(event: CustomEvent<TileModel>): void {\n if (this.isManageView) {\n // Checked/unchecked state change -- rerender to ensure it propagates\n // this.mapDataSource(model => ({ ...model }));\n const cellIndex = Object.values(this.dataSource)\n .flat()\n .indexOf(event.detail);\n if (cellIndex >= 0)\n this.infiniteScroller?.refreshCell(cellIndex - this.tileModelOffset);\n }\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.resultSelected,\n label: event.detail.mediatype,\n });\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.resultSelected,\n label: `page-${this.currentPage}`,\n });\n }\n\n cellForIndex(index: number): TemplateResult | undefined {\n const model = this.tileModelAtCellIndex(index);\n if (!model) return undefined;\n\n return html`\n <tile-dispatcher\n .collectionPagePath=${this.collectionPagePath}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .baseImageUrl=${this.baseImageUrl}\n .model=${model}\n .tileDisplayMode=${this.displayMode}\n .resizeObserver=${this.resizeObserver}\n .collectionNameCache=${this.collectionNameCache}\n .sortParam=${this.sortParam}\n .defaultSortParam=${this.defaultSortParam}\n .creatorFilter=${this.selectedCreatorFilter}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .loggedIn=${this.loggedIn}\n .isManageView=${this.isManageView}\n ?enableHoverPane=${true}\n @resultSelected=${(e: CustomEvent) => this.resultSelected(e)}\n >\n </tile-dispatcher>\n `;\n }\n\n /**\n * When the user scrolls near to the bottom of the page, fetch the next page\n * increase the number of pages to render and start fetching data for the new page\n */\n private scrollThresholdReached() {\n if (!this.endOfDataReached) {\n this.pagesToRender += 1;\n this.fetchPage(this.pagesToRender);\n }\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n css`\n :host {\n display: block;\n\n --leftColumnWidth: 18rem;\n --leftColumnPaddingRight: 2.5rem;\n }\n\n /**\n * When page width resizes from desktop to mobile, use this class to\n * disable expand/collapse transition when loading.\n */\n .preload * {\n transition: none !important;\n -webkit-transition: none !important;\n -moz-transition: none !important;\n -ms-transition: none !important;\n -o-transition: none !important;\n }\n\n #content-container {\n display: flex;\n }\n\n empty-placeholder {\n margin-top: var(--placeholderMarginTop, 0);\n }\n\n .collapser-icon {\n display: inline-block;\n }\n\n .collapser-icon svg {\n display: inline-block;\n width: 12px;\n height: 12px;\n transition: transform 0.2s ease-out;\n }\n\n #mobile-filter-collapse {\n width: 100%;\n }\n\n #mobile-filter-collapse > summary {\n cursor: pointer;\n list-style: none;\n }\n\n #mobile-filter-collapse[open] > summary {\n margin-bottom: 10px;\n }\n\n #mobile-filter-collapse h2 {\n display: inline-block;\n margin: 0;\n font-size: 2rem;\n }\n\n #mobile-filter-collapse[open] svg {\n transform: rotate(90deg);\n }\n\n #content-container.mobile {\n display: block;\n }\n\n .column {\n padding-top: 2rem;\n }\n\n #right-column {\n flex: 1;\n position: relative;\n border-left: 1px solid rgb(232, 232, 232);\n border-right: 1px solid rgb(232, 232, 232);\n padding-left: 1rem;\n padding-right: 1rem;\n margin-top: var(--rightColumnMarginTop, 0);\n background: #fff;\n }\n\n .mobile #right-column {\n border-left: none;\n padding: 5px 5px 0;\n }\n\n #left-column {\n width: var(--leftColumnWidth, 18rem);\n /* Prevents Safari from shrinking col at first draw */\n min-width: var(--leftColumnWidth, 18rem);\n padding-top: 0;\n /* Reduced padding by 0.2rem to add the invisible border in the rule below */\n padding-right: calc(var(--leftColumnPaddingRight, 2.5rem) - 0.2rem);\n border-right: 0.2rem solid transparent; /* Pads to the right of the scrollbar a bit */\n z-index: 1;\n }\n\n .desktop #left-column {\n top: 0;\n position: sticky;\n height: calc(100vh - 2rem);\n max-height: calc(100vh - 2rem);\n overflow-x: hidden;\n overflow-y: scroll;\n\n /*\n * Firefox doesn't support any of the -webkit-scrollbar stuff below, but\n * does at least give us a tiny bit of control over width & color.\n */\n scrollbar-width: thin;\n scrollbar-color: transparent transparent;\n }\n .desktop #left-column:hover {\n scrollbar-color: auto;\n }\n .desktop #left-column::-webkit-scrollbar {\n appearance: none;\n width: 6px;\n }\n .desktop #left-column::-webkit-scrollbar-button {\n height: 3px;\n background: transparent;\n }\n .desktop #left-column::-webkit-scrollbar-corner {\n background: transparent;\n }\n .desktop #left-column::-webkit-scrollbar-thumb {\n border-radius: 4px;\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.15);\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb:hover {\n background: rgba(0, 0, 0, 0.2);\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb:active {\n background: rgba(0, 0, 0, 0.3);\n }\n\n #facets-bottom-fade {\n background: linear-gradient(\n to bottom,\n #f5f5f700 0%,\n #f5f5f7c0 50%,\n #f5f5f7 80%,\n #f5f5f7 100%\n );\n position: fixed;\n bottom: 0;\n height: 50px;\n /* Wide enough to cover the content, but leave the scrollbar uncovered */\n width: calc(\n var(--leftColumnWidth) + var(--leftColumnPaddingRight) - 10px\n );\n z-index: 2;\n pointer-events: none;\n transition: height 0.1s ease;\n }\n #facets-bottom-fade.hidden {\n height: 0;\n }\n\n .desktop #left-column-scroll-sentinel {\n width: 1px;\n height: 100vh;\n background: transparent;\n }\n\n .desktop #facets-scroll-sentinel {\n width: 1px;\n height: 1px;\n background: transparent;\n }\n\n #facets-header-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n margin: 10px 0;\n }\n\n .desktop #facets-header-container {\n padding-top: 2rem;\n flex-wrap: wrap;\n }\n\n .mobile #left-column {\n width: 100%;\n padding: 0;\n }\n\n .clear-filters-btn-row {\n display: inline-block;\n }\n\n .desktop .clear-filters-btn-row {\n width: 100%;\n }\n\n .clear-filters-btn {\n display: inline-block;\n appearance: none;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n color: var(--ia-theme-link-color);\n font-size: 1.4rem;\n font-family: inherit;\n cursor: pointer;\n }\n\n .clear-filters-btn:hover {\n text-decoration: underline;\n }\n\n .clear-filters-btn-separator {\n display: inline-block;\n margin-left: 5px;\n border-left: 1px solid #2c2c2c;\n font-size: 1.4rem;\n line-height: 1.3rem;\n }\n\n #facets-container {\n position: relative;\n max-height: 0;\n transition: max-height 0.2s ease-in-out;\n z-index: 1;\n margin-top: 5rem;\n padding-bottom: 2rem;\n }\n\n .desktop #facets-container {\n width: 18rem;\n }\n\n .mobile #facets-container {\n overflow: hidden;\n padding-bottom: 0;\n padding-left: 10px;\n padding-right: 10px;\n }\n\n #facets-container.expanded {\n max-height: 2000px;\n }\n\n #results-total {\n display: flex;\n align-items: baseline;\n }\n\n .mobile #results-total {\n float: right;\n margin-bottom: 0;\n margin-right: 5px;\n }\n\n #big-results-count {\n font-size: 2.4rem;\n font-weight: 500;\n margin-right: 5px;\n }\n\n .mobile #big-results-count {\n font-size: 2rem;\n }\n\n #big-results-label {\n font-size: 1.4rem;\n font-weight: 200;\n }\n\n #list-header {\n max-height: 4.2rem;\n }\n\n .loading-cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n z-index: 1;\n padding-top: 50px;\n }\n\n circular-activity-indicator {\n width: 30px;\n height: 30px;\n }\n\n sort-filter-bar {\n display: block;\n margin-bottom: 4rem;\n }\n\n infinite-scroller {\n display: block;\n --infiniteScrollerRowGap: var(--collectionBrowserRowGap, 1.7rem);\n --infiniteScrollerColGap: var(--collectionBrowserColGap, 1.7rem);\n }\n\n infinite-scroller.list-compact {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 100%\n );\n --infiniteScrollerCellMinHeight: 34px; /* override infinite scroller component */\n --infiniteScrollerCellMaxHeight: 56px;\n --infiniteScrollerRowGap: 0px;\n }\n\n infinite-scroller.list-detail {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 100%\n );\n --infiniteScrollerCellMinHeight: var(\n --collectionBrowserCellMinHeight,\n 5rem\n );\n /*\n 30px in spec, compensating for a -4px margin\n to align title with top of item image\n src/tiles/list/tile-list.ts\n */\n --infiniteScrollerRowGap: 34px;\n }\n\n .mobile infinite-scroller.list-detail {\n --infiniteScrollerRowGap: 24px;\n }\n\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 17rem\n );\n --infiniteScrollerCellMaxWidth: var(\n --collectionBrowserCellMaxWidth,\n 1fr\n );\n }\n\n /* Allow tiles to shrink a bit further at smaller viewport widths */\n @media screen and (max-width: 880px) {\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 15rem\n );\n }\n }\n /* At very small widths, maintain a 2-tile layout as far as it can reasonably go */\n @media screen and (max-width: 360px) {\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 12rem\n );\n }\n }\n\n infinite-scroller.hidden {\n display: none;\n }\n `,\n ];\n }\n}\n"]}
@@ -10,6 +10,7 @@ export declare abstract class BaseTileComponent extends LitElement {
10
10
  baseImageUrl?: string;
11
11
  collectionPagePath?: string;
12
12
  sortParam: SortParam | null;
13
+ defaultSortParam: SortParam | null;
13
14
  creatorFilter?: string;
14
15
  mobileBreakpoint?: number;
15
16
  loggedIn: boolean;
@@ -6,6 +6,7 @@ export class BaseTileComponent extends LitElement {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
  this.sortParam = null;
9
+ this.defaultSortParam = null;
9
10
  this.loggedIn = false;
10
11
  this.displayValueProvider = new TileDisplayValueProvider();
11
12
  }
@@ -48,6 +49,9 @@ __decorate([
48
49
  __decorate([
49
50
  property({ type: Object })
50
51
  ], BaseTileComponent.prototype, "sortParam", void 0);
52
+ __decorate([
53
+ property({ type: Object })
54
+ ], BaseTileComponent.prototype, "defaultSortParam", void 0);
51
55
  __decorate([
52
56
  property({ type: String })
53
57
  ], BaseTileComponent.prototype, "creatorFilter", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"base-tile-component.js","sourceRoot":"","sources":["../../../src/tiles/base-tile-component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAGzE,MAAM,OAAgB,iB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DAAoC;AAEnC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAA2B;AAEzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAkB","sourcesContent":["import { LitElement, PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { SortParam } from '@internetarchive/search-service';\nimport { TileDisplayValueProvider } from './tile-display-value-provider';\nimport type { TileModel } from '../models';\n\nexport abstract class BaseTileComponent extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: String }) collectionPagePath?: string;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: String }) creatorFilter?: string;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: Boolean }) loggedIn = false;\n\n protected displayValueProvider = new TileDisplayValueProvider();\n\n protected willUpdate(changed: PropertyValues<this>) {\n // Ensure the TileDisplayValueProvider stays up-to-date as properties change\n if (\n changed.has('model') ||\n changed.has('baseNavigationUrl') ||\n changed.has('collectionPagePath') ||\n changed.has('sortParam') ||\n changed.has('creatorFilter')\n ) {\n this.displayValueProvider = new TileDisplayValueProvider({\n model: this.model,\n baseNavigationUrl: this.baseNavigationUrl,\n collectionPagePath: this.collectionPagePath,\n sortParam: this.sortParam ?? undefined,\n creatorFilter: this.creatorFilter,\n });\n }\n }\n}\n"]}
1
+ {"version":3,"file":"base-tile-component.js","sourceRoot":"","sources":["../../../src/tiles/base-tile-component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7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AE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAA6B;AAE5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAoC;AAEnC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAA2C;AAE1C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAA2B;AAEzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAkB","sourcesContent":["import { LitElement, PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport type { SortParam } from '@internetarchive/search-service';\nimport { TileDisplayValueProvider } from './tile-display-value-provider';\nimport type { TileModel } from '../models';\n\nexport abstract class BaseTileComponent extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: String }) collectionPagePath?: string;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @property({ type: Object }) defaultSortParam: SortParam | null = null;\n\n @property({ type: String }) creatorFilter?: string;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: Boolean }) loggedIn = false;\n\n protected displayValueProvider = new TileDisplayValueProvider();\n\n protected willUpdate(changed: PropertyValues<this>) {\n // Ensure the TileDisplayValueProvider stays up-to-date as properties change\n if (\n changed.has('model') ||\n changed.has('baseNavigationUrl') ||\n changed.has('collectionPagePath') ||\n changed.has('sortParam') ||\n changed.has('creatorFilter')\n ) {\n this.displayValueProvider = new TileDisplayValueProvider({\n model: this.model,\n baseNavigationUrl: this.baseNavigationUrl,\n collectionPagePath: this.collectionPagePath,\n sortParam: this.sortParam ?? undefined,\n creatorFilter: this.creatorFilter,\n });\n }\n }\n}\n"]}
@@ -57,12 +57,12 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
57
57
  }
58
58
  }
59
59
  get headerTemplate() {
60
- const { currentWidth, sortParam, mobileBreakpoint } = this;
60
+ const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } = this;
61
61
  return html `
62
62
  <tile-list-compact-header
63
63
  class="header"
64
64
  .currentWidth=${currentWidth}
65
- .sortParam=${sortParam}
65
+ .sortParam=${sortParam || defaultSortParam}
66
66
  .mobileBreakpoint=${mobileBreakpoint}
67
67
  >
68
68
  </tile-list-compact-header>
@@ -201,7 +201,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
201
201
  });
202
202
  }
203
203
  get tile() {
204
- const { model, collectionPagePath, baseNavigationUrl, currentWidth, currentHeight, sortParam, creatorFilter, mobileBreakpoint, } = this;
204
+ const { model, collectionPagePath, baseNavigationUrl, currentWidth, currentHeight, sortParam, creatorFilter, mobileBreakpoint, defaultSortParam, } = this;
205
205
  if (!model)
206
206
  return nothing;
207
207
  switch (this.tileDisplayMode) {
@@ -254,7 +254,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
254
254
  .currentHeight=${this.currentHeight}
255
255
  .collectionNameCache=${this.collectionNameCache}
256
256
  .baseImageUrl=${this.baseImageUrl}
257
- .sortParam=${sortParam}
257
+ .sortParam=${sortParam || defaultSortParam}
258
258
  .creatorFilter=${creatorFilter}
259
259
  .loggedIn=${this.loggedIn}
260
260
  .isManageView=${this.isManageView}
@@ -270,7 +270,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
270
270
  .currentWidth=${currentWidth}
271
271
  .currentHeight=${currentHeight}
272
272
  .baseNavigationUrl=${baseNavigationUrl}
273
- .sortParam=${sortParam}
273
+ .sortParam=${sortParam || defaultSortParam}
274
274
  .creatorFilter=${creatorFilter}
275
275
  .mobileBreakpoint=${mobileBreakpoint}
276
276
  .baseImageUrl=${this.baseImageUrl}
@@ -285,7 +285,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
285
285
  .currentWidth=${currentWidth}
286
286
  .currentHeight=${currentHeight}
287
287
  .baseNavigationUrl=${baseNavigationUrl}
288
- .sortParam=${sortParam}
288
+ .sortParam=${sortParam || defaultSortParam}
289
289
  .creatorFilter=${creatorFilter}
290
290
  .mobileBreakpoint=${mobileBreakpoint}
291
291
  .baseImageUrl=${this.baseImageUrl}
@@ -1 +1 @@
1
- {"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,GAIpB,MAAM,+BAA+B,CAAC;AAGvC,IAAa,cAAc,sBAA3B,MAAa,cACX,SAAQ,iBAAiB;IAD3B;QAME;;;;;;;;;;;;WAYG;;QAI0B,iBAAY,GAAG,KAAK,CAAC;QAOlD,uFAAuF;QAC1D,oBAAe,GAAG,KAAK,CAAC;QAEzB,qBAAgB,GAAG,GAAG,CAChD,gCAAgC,CACjC,CAAC;IAoZJ,CA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AY;sBACrB,IAAI,CAAC,QAAQ;;qBAEd,CAAC;YAChB;gBACE,OAAO,OAAO,CAAC;SAClB;IACH,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoFT,CAAC;IACJ,CAAC;CACF,CAAA;AA1YC,+EAA+E;AACvD,uCAAwB,GAG5C;IACF,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,KAAK;CACpB,CAAA;AAjC0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAmC;AAEjC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAAsB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAGtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAEzB;AAKF;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AA1CvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAsb1B;SAtbY,cAAc","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { msg } from '@lit/localize';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { TileDisplayMode } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './grid/search-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Boolean }) isManageView = false;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n @property({ type: String }) manageCheckTitle = msg(\n 'Remove this item from the list'\n );\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${this.manageCheckTemplate} ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? 'Untitled item'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${this.handleLinkClicked}\n @contextmenu=${this.handleLinkContextMenu}\n >\n ${this.tile}\n </a>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection'\n );\n }\n\n private get manageCheckTemplate() {\n if (!this.isManageView || this.tileDisplayMode !== 'grid') return nothing;\n\n return html`\n <div class=\"manage-check\">\n <input\n type=\"checkbox\"\n title=${this.manageCheckTitle}\n .checked=${this.model?.checked}\n @change=${() => {\n if (this.model) this.model.checked = !this.model.checked;\n }}\n />\n </div>\n `;\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode] &&\n this.model?.mediatype !== 'search' // don't show hover panes on search tiles\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n /**\n * Handler for when the tile link is left-clicked. Emits the `resultSelected` event.\n * In manage view, it also checks/unchecks the tile.\n */\n private handleLinkClicked(e: Event): void {\n if (this.isManageView) {\n e.preventDefault();\n if (this.model) this.model.checked = !this.model.checked;\n }\n\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n );\n }\n\n /**\n * Handler for when the tile link is right-clicked.\n * In manage view, it opens the item in a new tab. Otherwise, does nothing.\n */\n private handleLinkContextMenu(e: Event): void {\n if (this.isManageView && this.linkTileHref !== nothing) {\n e.preventDefault();\n window.open(this.linkTileHref, '_blank');\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n case 'search':\n return html`<search-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .isManageView=${this.isManageView}\n ?showInfoButton=${false}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </search-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n search-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n --iconFillColor: #2c2c2c;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n .manage-check {\n position: absolute;\n right: 0;\n top: 0;\n border: 5px solid #2c2c2c;\n border-radius: 3px;\n background-color: #2c2c2c;\n z-index: 1;\n }\n\n .manage-check > input[type='checkbox'] {\n display: block;\n margin: 0;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,GAIpB,MAAM,+BAA+B,CAAC;AAGvC,IAAa,cAAc,sBAA3B,MAAa,cACX,SAAQ,iBAAiB;IAD3B;QAME;;;;;;;;;;;;WAYG;;QAI0B,iBAAY,GAAG,KAAK,CAAC;QAOlD,uFAAuF;QAC1D,oBAAe,GAAG,KAAK,CAAC;QAEzB,qBAAgB,GAAG,GAAG,CAChD,gCAAgC,CACjC,CAAC;IAsZJ,CAAC;IAjYC,MAAM;;QACJ,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,KAAK,MAAM,CAAC;Q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,CAAC,YAAY;sBACrB,IAAI,CAAC,QAAQ;;qBAEd,CAAC;YAChB;gBACE,OAAO,OAAO,CAAC;SAClB;IACH,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoFT,CAAC;IACJ,CAAC;CACF,CAAA;AA5YC,+EAA+E;AACvD,uCAAwB,GAG5C;IACF,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,KAAK;CACpB,CAAA;AAjC0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAmC;AAEjC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAAsB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAGtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAEzB;AAKF;IADC,KAAK,CAAC,YAAY,CAAC;iDACe;AAGnC;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACS;AA1CvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAwb1B;SAxbY,cAAc","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { msg } from '@lit/localize';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { TileDisplayMode } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './grid/search-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Boolean }) isManageView = false;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n @property({ type: String }) manageCheckTitle = msg(\n 'Remove this item from the list'\n );\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${this.manageCheckTemplate} ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } =\n this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam || defaultSortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? 'Untitled item'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${this.handleLinkClicked}\n @contextmenu=${this.handleLinkContextMenu}\n >\n ${this.tile}\n </a>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection'\n );\n }\n\n private get manageCheckTemplate() {\n if (!this.isManageView || this.tileDisplayMode !== 'grid') return nothing;\n\n return html`\n <div class=\"manage-check\">\n <input\n type=\"checkbox\"\n title=${this.manageCheckTitle}\n .checked=${this.model?.checked}\n @change=${() => {\n if (this.model) this.model.checked = !this.model.checked;\n }}\n />\n </div>\n `;\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode] &&\n this.model?.mediatype !== 'search' // don't show hover panes on search tiles\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n /**\n * Handler for when the tile link is left-clicked. Emits the `resultSelected` event.\n * In manage view, it also checks/unchecks the tile.\n */\n private handleLinkClicked(e: Event): void {\n if (this.isManageView) {\n e.preventDefault();\n if (this.model) this.model.checked = !this.model.checked;\n }\n\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n );\n }\n\n /**\n * Handler for when the tile link is right-clicked.\n * In manage view, it opens the item in a new tab. Otherwise, does nothing.\n */\n private handleLinkContextMenu(e: Event): void {\n if (this.isManageView && this.linkTileHref !== nothing) {\n e.preventDefault();\n window.open(this.linkTileHref, '_blank');\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n defaultSortParam,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n case 'search':\n return html`<search-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .isManageView=${this.isManageView}\n ?showInfoButton=${false}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </search-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam || defaultSortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam || defaultSortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam || defaultSortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n search-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n --iconFillColor: #2c2c2c;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: 0 0 6px 2px rgba(8, 8, 32, 0.8);\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n .manage-check {\n position: absolute;\n right: 0;\n top: 0;\n border: 5px solid #2c2c2c;\n border-radius: 3px;\n background-color: #2c2c2c;\n z-index: 1;\n }\n\n .manage-check > input[type='checkbox'] {\n display: block;\n margin: 0;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "1.14.3",
6
+ "version": "1.14.5",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "types": "dist/index.d.ts",
24
24
  "dependencies": {
25
25
  "@internetarchive/analytics-manager": "^0.1.2",
26
- "@internetarchive/collection-name-cache": "^0.2.14",
26
+ "@internetarchive/collection-name-cache": "^0.2.15",
27
27
  "@internetarchive/feature-feedback": "^0.1.4",
28
28
  "@internetarchive/field-parsers": "^0.1.4",
29
29
  "@internetarchive/histogram-date-range": "^1.1.0",
@@ -32,7 +32,7 @@
32
32
  "@internetarchive/infinite-scroller": "^1.0.0",
33
33
  "@internetarchive/local-cache": "^0.2.1",
34
34
  "@internetarchive/modal-manager": "^0.2.8",
35
- "@internetarchive/search-service": "^1.2.2",
35
+ "@internetarchive/search-service": "^1.2.3",
36
36
  "@internetarchive/shared-resize-observer": "^0.2.0",
37
37
  "@lit/localize": "^0.11.2",
38
38
  "dompurify": "^2.3.6",
@@ -103,6 +103,8 @@ export class CollectionBrowser
103
103
 
104
104
  @property({ type: Object }) sortParam: SortParam | null = null;
105
105
 
106
+ @property({ type: Object }) defaultSortParam: SortParam | null = null;
107
+
106
108
  @property({ type: String }) selectedSort: SortField = SortField.default;
107
109
 
108
110
  @property({ type: String }) selectedTitleFilter: string | null = null;
@@ -995,6 +997,7 @@ export class CollectionBrowser
995
997
  .tileDisplayMode=${'list-header'}
996
998
  .resizeObserver=${this.resizeObserver}
997
999
  .sortParam=${this.sortParam}
1000
+ .defaultSortParam=${this.defaultSortParam}
998
1001
  .mobileBreakpoint=${this.mobileBreakpoint}
999
1002
  .loggedIn=${this.loggedIn}
1000
1003
  >
@@ -2091,6 +2094,10 @@ export class CollectionBrowser
2091
2094
  if (sortField && sortField !== SortField.default) {
2092
2095
  this.defaultSortField = sortField;
2093
2096
  this.defaultSortDirection = dir as SortDirection;
2097
+ this.defaultSortParam = {
2098
+ field: this.defaultSortField,
2099
+ direction: this.defaultSortDirection,
2100
+ };
2094
2101
  }
2095
2102
  }
2096
2103
 
@@ -2344,6 +2351,7 @@ export class CollectionBrowser
2344
2351
  .resizeObserver=${this.resizeObserver}
2345
2352
  .collectionNameCache=${this.collectionNameCache}
2346
2353
  .sortParam=${this.sortParam}
2354
+ .defaultSortParam=${this.defaultSortParam}
2347
2355
  .creatorFilter=${this.selectedCreatorFilter}
2348
2356
  .mobileBreakpoint=${this.mobileBreakpoint}
2349
2357
  .loggedIn=${this.loggedIn}
@@ -19,6 +19,8 @@ export abstract class BaseTileComponent extends LitElement {
19
19
 
20
20
  @property({ type: Object }) sortParam: SortParam | null = null;
21
21
 
22
+ @property({ type: Object }) defaultSortParam: SortParam | null = null;
23
+
22
24
  @property({ type: String }) creatorFilter?: string;
23
25
 
24
26
  @property({ type: Number }) mobileBreakpoint?: number;
@@ -105,12 +105,13 @@ export class TileDispatcher
105
105
  }
106
106
 
107
107
  private get headerTemplate() {
108
- const { currentWidth, sortParam, mobileBreakpoint } = this;
108
+ const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } =
109
+ this;
109
110
  return html`
110
111
  <tile-list-compact-header
111
112
  class="header"
112
113
  .currentWidth=${currentWidth}
113
- .sortParam=${sortParam}
114
+ .sortParam=${sortParam || defaultSortParam}
114
115
  .mobileBreakpoint=${mobileBreakpoint}
115
116
  >
116
117
  </tile-list-compact-header>
@@ -280,6 +281,7 @@ export class TileDispatcher
280
281
  sortParam,
281
282
  creatorFilter,
282
283
  mobileBreakpoint,
284
+ defaultSortParam,
283
285
  } = this;
284
286
 
285
287
  if (!model) return nothing;
@@ -334,7 +336,7 @@ export class TileDispatcher
334
336
  .currentHeight=${this.currentHeight}
335
337
  .collectionNameCache=${this.collectionNameCache}
336
338
  .baseImageUrl=${this.baseImageUrl}
337
- .sortParam=${sortParam}
339
+ .sortParam=${sortParam || defaultSortParam}
338
340
  .creatorFilter=${creatorFilter}
339
341
  .loggedIn=${this.loggedIn}
340
342
  .isManageView=${this.isManageView}
@@ -350,7 +352,7 @@ export class TileDispatcher
350
352
  .currentWidth=${currentWidth}
351
353
  .currentHeight=${currentHeight}
352
354
  .baseNavigationUrl=${baseNavigationUrl}
353
- .sortParam=${sortParam}
355
+ .sortParam=${sortParam || defaultSortParam}
354
356
  .creatorFilter=${creatorFilter}
355
357
  .mobileBreakpoint=${mobileBreakpoint}
356
358
  .baseImageUrl=${this.baseImageUrl}
@@ -365,7 +367,7 @@ export class TileDispatcher
365
367
  .currentWidth=${currentWidth}
366
368
  .currentHeight=${currentHeight}
367
369
  .baseNavigationUrl=${baseNavigationUrl}
368
- .sortParam=${sortParam}
370
+ .sortParam=${sortParam || defaultSortParam}
369
371
  .creatorFilter=${creatorFilter}
370
372
  .mobileBreakpoint=${mobileBreakpoint}
371
373
  .baseImageUrl=${this.baseImageUrl}