@internetarchive/collection-browser 3.4.1-alpha-webdev7761.4 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +27 -27
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +4 -4
  7. package/.prettierignore +1 -1
  8. package/LICENSE +661 -661
  9. package/README.md +83 -83
  10. package/dist/src/app-root.js +28 -19
  11. package/dist/src/app-root.js.map +1 -1
  12. package/dist/src/collection-browser.d.ts +4 -24
  13. package/dist/src/collection-browser.js +125 -286
  14. package/dist/src/collection-browser.js.map +1 -1
  15. package/dist/src/collection-facets/facet-row.js +143 -143
  16. package/dist/src/collection-facets/facet-row.js.map +1 -1
  17. package/dist/src/collection-facets/more-facets-content.d.ts +1 -1
  18. package/dist/src/collection-facets/more-facets-content.js +48 -34
  19. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  20. package/dist/src/collection-facets/more-facets-pagination.js +10 -6
  21. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  22. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +21 -16
  23. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
  24. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +10 -7
  25. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  26. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +2 -3
  27. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
  28. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +11 -9
  29. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  30. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +7 -7
  31. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
  32. package/dist/src/collection-facets/toggle-switch.js +6 -4
  33. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  34. package/dist/src/collection-facets.js +310 -309
  35. package/dist/src/collection-facets.js.map +1 -1
  36. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +1 -10
  37. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  38. package/dist/src/data-source/collection-browser-data-source.d.ts +1 -19
  39. package/dist/src/data-source/collection-browser-data-source.js +65 -71
  40. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  41. package/dist/src/data-source/collection-browser-query-state.d.ts +2 -1
  42. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  43. package/dist/src/data-source/models.d.ts +0 -11
  44. package/dist/src/data-source/models.js.map +1 -1
  45. package/dist/src/empty-placeholder.js +18 -19
  46. package/dist/src/empty-placeholder.js.map +1 -1
  47. package/dist/src/expanded-date-picker.js +10 -6
  48. package/dist/src/expanded-date-picker.js.map +1 -1
  49. package/dist/src/language-code-handler/language-code-handler.js +2 -2
  50. package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
  51. package/dist/src/manage/manage-bar.js +15 -9
  52. package/dist/src/manage/manage-bar.js.map +1 -1
  53. package/dist/src/manage/remove-items-modal-content.js +2 -2
  54. package/dist/src/manage/remove-items-modal-content.js.map +1 -1
  55. package/dist/src/models.d.ts +6 -2
  56. package/dist/src/models.js +54 -46
  57. package/dist/src/models.js.map +1 -1
  58. package/dist/src/restoration-state-handler.d.ts +2 -1
  59. package/dist/src/restoration-state-handler.js +19 -12
  60. package/dist/src/restoration-state-handler.js.map +1 -1
  61. package/dist/src/sort-filter-bar/alpha-bar.js +14 -9
  62. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  63. package/dist/src/sort-filter-bar/sort-filter-bar.js +24 -14
  64. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  65. package/dist/src/tiles/base-tile-component.js +2 -1
  66. package/dist/src/tiles/base-tile-component.js.map +1 -1
  67. package/dist/src/tiles/grid/account-tile.js +7 -5
  68. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  69. package/dist/src/tiles/grid/collection-tile.js +6 -3
  70. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  71. package/dist/src/tiles/grid/item-tile.js +33 -23
  72. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  73. package/dist/src/tiles/grid/search-tile.js +2 -1
  74. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  75. package/dist/src/tiles/grid/tile-stats.js +3 -2
  76. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  77. package/dist/src/tiles/hover/hover-pane-controller.js +28 -21
  78. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  79. package/dist/src/tiles/hover/tile-hover-pane.js +4 -3
  80. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  81. package/dist/src/tiles/image-block.js +8 -5
  82. package/dist/src/tiles/image-block.js.map +1 -1
  83. package/dist/src/tiles/item-image.js +19 -12
  84. package/dist/src/tiles/item-image.js.map +1 -1
  85. package/dist/src/tiles/list/tile-list-compact.js +25 -17
  86. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  87. package/dist/src/tiles/list/tile-list.js +55 -34
  88. package/dist/src/tiles/list/tile-list.js.map +1 -1
  89. package/dist/src/tiles/overlay/icon-overlay.js +2 -1
  90. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
  91. package/dist/src/tiles/overlay/text-overlay.js +4 -2
  92. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  93. package/dist/src/tiles/text-snippet-block.js +4 -2
  94. package/dist/src/tiles/text-snippet-block.js.map +1 -1
  95. package/dist/src/tiles/tile-dispatcher.js +30 -22
  96. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  97. package/dist/src/tiles/tile-display-value-provider.js +9 -5
  98. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  99. package/dist/src/tiles/tile-mediatype-icon.js +19 -12
  100. package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
  101. package/dist/src/utils/collapse-repeated-quotes.js +1 -1
  102. package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
  103. package/dist/src/utils/facet-utils.js +5 -3
  104. package/dist/src/utils/facet-utils.js.map +1 -1
  105. package/dist/src/utils/format-count.js +10 -10
  106. package/dist/src/utils/format-count.js.map +1 -1
  107. package/dist/src/utils/resolve-mediatype.js +3 -2
  108. package/dist/src/utils/resolve-mediatype.js.map +1 -1
  109. package/dist/test/collection-browser.test.js +380 -336
  110. package/dist/test/collection-browser.test.js.map +1 -1
  111. package/dist/test/collection-facets/facet-row.test.js +52 -37
  112. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  113. package/dist/test/collection-facets/facets-template.test.js +23 -17
  114. package/dist/test/collection-facets/facets-template.test.js.map +1 -1
  115. package/dist/test/collection-facets/more-facets-content.test.js +32 -22
  116. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  117. package/dist/test/collection-facets/more-facets-pagination.test.js +22 -16
  118. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  119. package/dist/test/collection-facets/toggle-switch.test.js +19 -22
  120. package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
  121. package/dist/test/collection-facets.test.js +77 -60
  122. package/dist/test/collection-facets.test.js.map +1 -1
  123. package/dist/test/empty-placeholder.test.js +17 -11
  124. package/dist/test/empty-placeholder.test.js.map +1 -1
  125. package/dist/test/expanded-date-picker.test.js +14 -8
  126. package/dist/test/expanded-date-picker.test.js.map +1 -1
  127. package/dist/test/icon-overlay.test.js +6 -7
  128. package/dist/test/icon-overlay.test.js.map +1 -1
  129. package/dist/test/image-block.test.js +26 -16
  130. package/dist/test/image-block.test.js.map +1 -1
  131. package/dist/test/item-image.test.js +32 -23
  132. package/dist/test/item-image.test.js.map +1 -1
  133. package/dist/test/manage/manage-bar.test.js +33 -21
  134. package/dist/test/manage/manage-bar.test.js.map +1 -1
  135. package/dist/test/manage/remove-items-modal-content.test.js +15 -10
  136. package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
  137. package/dist/test/mocks/mock-search-service.js +3 -2
  138. package/dist/test/mocks/mock-search-service.js.map +1 -1
  139. package/dist/test/restoration-state-handler.test.js +54 -14
  140. package/dist/test/restoration-state-handler.test.js.map +1 -1
  141. package/dist/test/review-block.test.js +18 -16
  142. package/dist/test/review-block.test.js.map +1 -1
  143. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +3 -2
  144. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
  145. package/dist/test/sort-filter-bar/alpha-bar.test.js +24 -18
  146. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  147. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +180 -178
  148. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  149. package/dist/test/text-overlay.test.js +15 -16
  150. package/dist/test/text-overlay.test.js.map +1 -1
  151. package/dist/test/text-snippet-block.test.js +19 -14
  152. package/dist/test/text-snippet-block.test.js.map +1 -1
  153. package/dist/test/tile-stats.test.js +34 -73
  154. package/dist/test/tile-stats.test.js.map +1 -1
  155. package/dist/test/tiles/grid/account-tile.test.js +25 -25
  156. package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
  157. package/dist/test/tiles/grid/collection-tile.test.js +19 -13
  158. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
  159. package/dist/test/tiles/grid/item-tile.test.js +91 -64
  160. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  161. package/dist/test/tiles/grid/search-tile.test.js +13 -9
  162. package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
  163. package/dist/test/tiles/hover/hover-pane-controller.test.js +35 -23
  164. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  165. package/dist/test/tiles/hover/tile-hover-pane.test.js +16 -12
  166. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
  167. package/dist/test/tiles/list/tile-list-compact.test.js +48 -34
  168. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  169. package/dist/test/tiles/list/tile-list.test.js +105 -76
  170. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  171. package/dist/test/tiles/tile-dispatcher.test.js +30 -17
  172. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  173. package/dist/test/tiles/tile-mediatype-icon.test.js +24 -12
  174. package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
  175. package/eslint.config.mjs +53 -53
  176. package/index.html +24 -24
  177. package/local.archive.org.cert +86 -86
  178. package/local.archive.org.key +27 -27
  179. package/package.json +118 -120
  180. package/renovate.json +6 -6
  181. package/src/collection-browser.ts +15 -246
  182. package/src/collection-facets/facet-row.ts +296 -299
  183. package/src/collection-facets/more-facets-content.ts +8 -5
  184. package/src/collection-facets.ts +995 -1010
  185. package/src/data-source/collection-browser-data-source-interface.ts +333 -345
  186. package/src/data-source/collection-browser-data-source.ts +1401 -1441
  187. package/src/data-source/collection-browser-query-state.ts +65 -59
  188. package/src/data-source/models.ts +43 -56
  189. package/src/models.ts +870 -866
  190. package/src/restoration-state-handler.ts +544 -546
  191. package/test/collection-browser.test.ts +2403 -2413
  192. package/test/restoration-state-handler.test.ts +510 -480
  193. package/tsconfig.json +20 -25
  194. package/vite.config.ts +22 -29
  195. package/web-dev-server.config.mjs +30 -30
  196. package/web-test-runner.config.mjs +41 -41
  197. package/dist/src/combo-box/caret-closed.d.ts +0 -2
  198. package/dist/src/combo-box/caret-closed.js +0 -7
  199. package/dist/src/combo-box/caret-closed.js.map +0 -1
  200. package/dist/src/combo-box/caret-open.d.ts +0 -2
  201. package/dist/src/combo-box/caret-open.js +0 -7
  202. package/dist/src/combo-box/caret-open.js.map +0 -1
  203. package/dist/src/combo-box/clear.d.ts +0 -2
  204. package/dist/src/combo-box/clear.js +0 -11
  205. package/dist/src/combo-box/clear.js.map +0 -1
  206. package/dist/src/combo-box/ia-combo-box.d.ts +0 -422
  207. package/dist/src/combo-box/ia-combo-box.js +0 -1203
  208. package/dist/src/combo-box/ia-combo-box.js.map +0 -1
  209. package/dist/src/combo-box/models.d.ts +0 -75
  210. package/dist/src/combo-box/models.js +0 -40
  211. package/dist/src/combo-box/models.js.map +0 -1
  212. package/src/combo-box/caret-closed.ts +0 -7
  213. package/src/combo-box/caret-open.ts +0 -7
  214. package/src/combo-box/clear.ts +0 -11
  215. package/src/combo-box/ia-combo-box.ts +0 -1288
  216. package/src/combo-box/models.ts +0 -113
@@ -10,12 +10,10 @@ import { RestorationStateHandler, } from './restoration-state-handler';
10
10
  import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
11
11
  import { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
12
12
  import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
13
- import { updateSelectedFacetBucket } from './utils/facet-utils';
14
13
  import chevronIcon from './assets/img/icons/chevron';
15
14
  import { srOnlyStyle } from './styles/sr-only';
16
15
  import { sha1 } from './utils/sha1';
17
16
  import { log } from './utils/log';
18
- import '@internetarchive/elements/ia-combo-box/ia-combo-box';
19
17
  import './empty-placeholder';
20
18
  import './tiles/tile-dispatcher';
21
19
  import './tiles/collection-browser-loading-tile';
@@ -35,6 +33,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
35
33
  this.selectedSort = SortField.default;
36
34
  this.selectedTitleFilter = null;
37
35
  this.selectedCreatorFilter = null;
36
+ this.tvClipFilter = 'all';
38
37
  this.sortDirection = null;
39
38
  this.defaultSortField = SortField.relevance;
40
39
  this.defaultSortDirection = null;
@@ -165,11 +164,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
165
164
  this.tileBlurOverrideState = 'no-override';
166
165
  this.collapsibleFacetsVisible = false;
167
166
  this.placeholderType = null;
168
- this.selectedTVNetwork = undefined;
169
- this.selectedTVShow = undefined;
170
- this.tvMapsPopulated = false;
171
- this.loadingNetworks = false;
172
- this.loadingShows = false;
173
167
  /** Whether layout size analytics have been sent already. */
174
168
  this.layoutSizeAnalyticsSent = false;
175
169
  /**
@@ -194,17 +188,18 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
194
188
  * Arrow function ensures proper `this` binding.
195
189
  */
196
190
  this.updateLeftColumnHeight = () => {
191
+ var _a, _b, _c, _d, _e;
197
192
  if (this.mobileView) {
198
- this.leftColumn?.style?.removeProperty('height');
193
+ (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
199
194
  }
200
195
  else {
201
- const clientTop = this.leftColumn?.getBoundingClientRect().top;
202
- const columnHeight = window.innerHeight - (clientTop ?? 0);
196
+ const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
197
+ const columnHeight = window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0);
203
198
  const cssHeightValue = clientTop === 0
204
199
  ? null
205
200
  : // Subtract off the column's top padding so that it doesn't overflow
206
201
  `calc(${columnHeight}px - var(--leftColumnPaddingTop, 2rem))`;
207
- this.leftColumn?.style?.setProperty('height', cssHeightValue);
202
+ (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', cssHeightValue);
208
203
  }
209
204
  };
210
205
  /**
@@ -213,8 +208,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
213
208
  * Arrow function ensures proper `this` binding.
214
209
  */
215
210
  this.updateFacetFadeOut = (entries) => {
216
- const fadeElmt = this.shadowRoot?.getElementById('facets-bottom-fade');
217
- fadeElmt?.classList.toggle('hidden', entries?.[0]?.isIntersecting);
211
+ var _a, _b;
212
+ const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
213
+ fadeElmt === null || fadeElmt === void 0 ? void 0 : fadeElmt.classList.toggle('hidden', (_b = entries === null || entries === void 0 ? void 0 : entries[0]) === null || _b === void 0 ? void 0 : _b.isIntersecting);
218
214
  };
219
215
  // we only want to scroll on the very first query change
220
216
  // so this keeps track of whether we've already set the initial query
@@ -251,7 +247,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
251
247
  */
252
248
  async getSessionId() {
253
249
  try {
254
- const storedSessionId = sessionStorage?.getItem('cb-session');
250
+ const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
255
251
  if (storedSessionId) {
256
252
  return storedSessionId;
257
253
  }
@@ -262,10 +258,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
262
258
  }
263
259
  this.sessionIdGenPromise = sha1(Math.random().toString());
264
260
  const newSessionId = await this.sessionIdGenPromise;
265
- sessionStorage?.setItem('cb-session', newSessionId);
261
+ sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
266
262
  return newSessionId;
267
263
  }
268
- catch {
264
+ catch (_a) {
269
265
  // Either we can't generate the hash or we're restricted from accessing sessionStorage
270
266
  return '';
271
267
  }
@@ -326,24 +322,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
326
322
  this.sortDirection = null;
327
323
  this.selectedSort = SortField.default;
328
324
  }
329
- this.clearTVDropdowns();
330
325
  if (this.smartFacetBar) {
331
326
  this.smartFacetBar.deselectAll();
332
327
  }
333
328
  }
334
- /**
335
- * Resets any selected TV network/show dropdowns to their default state
336
- */
337
- clearTVDropdowns() {
338
- this.selectedTVNetwork = undefined;
339
- this.selectedTVShow = undefined;
340
- if (this.tvNetworksDropdown) {
341
- this.tvNetworksDropdown.clearSelectedOption();
342
- }
343
- if (this.tvShowsDropdown) {
344
- this.tvShowsDropdown.clearSelectedOption();
345
- }
346
- }
347
329
  /**
348
330
  * Returns true if the current value of `this.selectedFacets` contains
349
331
  * any facet buckets than have been selected or negated, or false otherwise.
@@ -413,9 +395,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
413
395
  * - An error occurred on the most recent search attempt
414
396
  */
415
397
  setPlaceholderType() {
398
+ var _a, _b;
416
399
  const isInitialized = this.dataSource.queryInitialized;
417
- const hasQuery = !!this.baseQuery?.trim();
418
- const hasIdentifiers = !!this.identifiers?.length;
400
+ const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
401
+ const hasIdentifiers = !!((_b = this.identifiers) === null || _b === void 0 ? void 0 : _b.length);
419
402
  const isCollection = !!this.withinCollection;
420
403
  const isProfile = !!this.withinProfile;
421
404
  const isSearchResults = !isCollection && !isProfile;
@@ -445,12 +428,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
445
428
  * Template for the placeholder content to show when no results are available.
446
429
  */
447
430
  get emptyPlaceholderTemplate() {
431
+ var _a;
448
432
  return html `
449
433
  <empty-placeholder
450
434
  .placeholderType=${this.placeholderType}
451
435
  ?isMobileView=${this.mobileView}
452
436
  ?isCollection=${!!this.withinCollection}
453
- .detailMessage=${this.dataSource.queryErrorMessage ?? ''}
437
+ .detailMessage=${(_a = this.dataSource.queryErrorMessage) !== null && _a !== void 0 ? _a : ''}
454
438
  .baseNavigationUrl=${this.baseNavigationUrl}
455
439
  ></empty-placeholder>
456
440
  `;
@@ -523,15 +507,15 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
523
507
  * Changes to the "Searching..." label if the search results are still loading.
524
508
  */
525
509
  get resultsCountTemplate() {
510
+ var _a;
526
511
  if (this.suppressResultCount)
527
512
  return nothing;
528
513
  const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
529
- const classes = classMap({ filtered: this.hasActiveFilters });
530
- const resultsCount = this.totalResults?.toLocaleString();
514
+ const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
531
515
  const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
532
516
  // Added data-testid for Playwright testing
533
517
  return html `
534
- <div id="results-total" class=${classes} data-testid="results-total">
518
+ <div id="results-total" data-testid="results-total">
535
519
  <span id="big-results-count">
536
520
  ${shouldShowSearching ? html `Searching&hellip;` : resultsCount}
537
521
  </span>
@@ -597,8 +581,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
597
581
  * given the current display mode & placeholder case.
598
582
  */
599
583
  get infiniteScrollerClasses() {
584
+ var _a;
600
585
  return classMap({
601
- [this.displayMode ?? '']: !!this.displayMode,
586
+ [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
602
587
  hidden: !!this.placeholderType,
603
588
  });
604
589
  }
@@ -606,6 +591,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
606
591
  * Template for the sort & filtering bar that appears atop the search results.
607
592
  */
608
593
  get sortFilterBarTemplate() {
594
+ var _a;
609
595
  if (this.suppressSortBar)
610
596
  return nothing;
611
597
  // Determine the set of sortable fields that should be shown in the sort bar
@@ -613,7 +599,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
613
599
  let defaultDateSort = SortField.date;
614
600
  let sortFieldAvailability = defaultSortAvailability;
615
601
  // We adjust the sort options for a couple of special cases...
616
- if (this.withinCollection?.startsWith('fav-')) {
602
+ if ((_a = this.withinCollection) === null || _a === void 0 ? void 0 : _a.startsWith('fav-')) {
617
603
  // When viewing a fav- collection, we include the Date Favorited option and show
618
604
  // it as the default in the date dropdown.
619
605
  defaultDateSort = SortField.datefavorited;
@@ -661,8 +647,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
661
647
  * sensitive content in result tiles.
662
648
  */
663
649
  get tileBlurCheckboxTemplate() {
650
+ var _a;
664
651
  // Only show the checkbox for @archive.org users
665
- if (!this.dataSource.sessionContext?.is_archive_user)
652
+ if (!((_a = this.dataSource.sessionContext) === null || _a === void 0 ? void 0 : _a.is_archive_user))
666
653
  return nothing;
667
654
  return html `
668
655
  <label
@@ -734,9 +721,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
734
721
  this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
735
722
  detail: {
736
723
  items: this.dataSource.checkedTileModels.map(model => {
724
+ var _a;
737
725
  // For favorited searches, we attach a search: prefix to differentiate it from an item
738
- const searchPrefix = model?.mediatype === 'search' ? 'search:' : '';
739
- const identifier = model?.identifier ?? '';
726
+ const searchPrefix = (model === null || model === void 0 ? void 0 : model.mediatype) === 'search' ? 'search:' : '';
727
+ const identifier = (_a = model === null || model === void 0 ? void 0 : model.identifier) !== null && _a !== void 0 ? _a : '';
740
728
  return `${searchPrefix}${identifier}`;
741
729
  }),
742
730
  },
@@ -748,24 +736,27 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
748
736
  handleManageItems() {
749
737
  this.dispatchEvent(new CustomEvent('itemManagerRequested', {
750
738
  detail: {
751
- items: this.dataSource.checkedTileModels.map(model => model?.identifier ? model.identifier : ''),
739
+ items: this.dataSource.checkedTileModels.map(model => (model === null || model === void 0 ? void 0 : model.identifier) ? model.identifier : ''),
752
740
  },
753
741
  }));
754
742
  }
755
743
  refreshSmartFacets() {
756
- this.smartFacetBar?.refresh();
744
+ var _a;
745
+ (_a = this.smartFacetBar) === null || _a === void 0 ? void 0 : _a.refresh();
757
746
  }
758
747
  /**
759
748
  * Handler to show processing modal while removing item
760
749
  */
761
750
  showRemoveItemsProcessingModal() {
762
- this.manageBar?.showRemoveItemsProcessingModal();
751
+ var _a;
752
+ (_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsProcessingModal();
763
753
  }
764
754
  /**
765
755
  * Handler to show error modal when item removal failed
766
756
  */
767
757
  showRemoveItemsErrorModal() {
768
- this.manageBar?.showRemoveItemsErrorModal();
758
+ var _a;
759
+ (_a = this.manageBar) === null || _a === void 0 ? void 0 : _a.showRemoveItemsErrorModal();
769
760
  }
770
761
  /**
771
762
  * Removes all tile models that are currently checked & adjusts the paging
@@ -778,9 +769,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
778
769
  * Handler for when the tile blurring checkbox state is toggled
779
770
  */
780
771
  tileBlurCheckboxChanged(e) {
772
+ var _a;
781
773
  const { checked } = e.target;
782
774
  this.tileBlurOverrideState = checked ? 'on' : 'off';
783
- this.infiniteScroller?.refreshAllVisibleCells();
775
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
784
776
  }
785
777
  /**
786
778
  * Whether result tiles should have the default blurring of sensitive content suppressed.
@@ -795,8 +787,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
795
787
  }
796
788
  // Not overriding, so use the preference from session context
797
789
  const { sessionContext } = this.dataSource;
798
- const userPrefs = sessionContext?.pps_relevant_user_preferences;
799
- const blurringPref = userPrefs?.display__blur_moderated_content;
790
+ const userPrefs = sessionContext === null || sessionContext === void 0 ? void 0 : sessionContext.pps_relevant_user_preferences;
791
+ const blurringPref = userPrefs === null || userPrefs === void 0 ? void 0 : userPrefs.display__blur_moderated_content;
800
792
  // Only suppress blurring if the preference is disabled.
801
793
  // If enabled or missing, tile blurring remains on.
802
794
  return blurringPref === 'off';
@@ -805,10 +797,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
805
797
  * Handler for when the user changes the selected sort option or direction.
806
798
  */
807
799
  userChangedSort(e) {
800
+ var _a;
808
801
  const { selectedSort, sortDirection } = e.detail;
809
802
  this.selectedSort = selectedSort;
810
803
  this.sortDirection = sortDirection;
811
- if ((this.currentPage ?? 1) > 1) {
804
+ if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
812
805
  this.goToPage(1);
813
806
  }
814
807
  this.currentPage = 1;
@@ -818,8 +811,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
818
811
  * @param prevSortDirection Which sort direction was previously set.
819
812
  */
820
813
  sendSortByAnalytics(prevSortDirection) {
814
+ var _a;
821
815
  const directionCleared = prevSortDirection && !this.sortDirection;
822
- this.analyticsHandler?.sendEvent({
816
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
823
817
  category: this.searchContext,
824
818
  action: analyticsActions.sortBy,
825
819
  label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
@@ -837,13 +831,14 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
837
831
  * An object representing the current sort field & direction.
838
832
  */
839
833
  get sortParam() {
834
+ var _a;
840
835
  const sortOption = SORT_OPTIONS[this.selectedSort];
841
- if (!sortOption?.handledBySearchService) {
836
+ if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
842
837
  return null;
843
838
  }
844
839
  // If the sort option specified in the URL is unrecognized, we just use it as-is
845
840
  const urlSortParam = new URL(window.location.href).searchParams.get('sort');
846
- const sortField = sortOption.searchServiceKey ?? urlSortParam?.replace(/^-/, '');
841
+ const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
847
842
  // If the sort direction is still null at this point, then we assume ascending
848
843
  // (i.e., it was unrecognized and had no directional flag)
849
844
  if (!this.sortDirection)
@@ -856,7 +851,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
856
851
  * An object representing the default sort field & direction, if none are explicitly set.
857
852
  */
858
853
  get defaultSortParam() {
859
- const direction = this.defaultSortDirection ?? 'asc';
854
+ var _a;
855
+ const direction = (_a = this.defaultSortDirection) !== null && _a !== void 0 ? _a : 'asc';
860
856
  const field = SORT_OPTIONS[this.defaultSortField].searchServiceKey;
861
857
  if (!field)
862
858
  return null;
@@ -866,9 +862,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
866
862
  * Handler for when the display mode option is changed (grid/list/compact-list views).
867
863
  */
868
864
  displayModeChanged(e) {
865
+ var _a;
869
866
  this.displayMode = e.detail.displayMode;
870
867
  if (this.displayMode) {
871
- this.analyticsHandler?.sendEvent({
868
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
872
869
  category: this.searchContext,
873
870
  action: analyticsActions.displayMode,
874
871
  label: this.displayMode,
@@ -898,11 +895,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
898
895
  * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
899
896
  */
900
897
  sendFilterByTitleAnalytics(prevSelectedLetter) {
898
+ var _a;
901
899
  if (!prevSelectedLetter && !this.selectedTitleFilter) {
902
900
  return;
903
901
  }
904
902
  const cleared = prevSelectedLetter && !this.selectedTitleFilter;
905
- this.analyticsHandler?.sendEvent({
903
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
906
904
  category: this.searchContext,
907
905
  action: analyticsActions.filterByTitle,
908
906
  label: cleared
@@ -915,11 +913,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
915
913
  * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
916
914
  */
917
915
  sendFilterByCreatorAnalytics(prevSelectedLetter) {
916
+ var _a;
918
917
  if (!prevSelectedLetter && !this.selectedCreatorFilter) {
919
918
  return;
920
919
  }
921
920
  const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
922
- this.analyticsHandler?.sendEvent({
921
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
923
922
  category: this.searchContext,
924
923
  action: analyticsActions.filterByCreator,
925
924
  label: cleared
@@ -949,10 +948,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
949
948
  if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
950
949
  return nothing;
951
950
  const toggleFacetsVisible = (e) => {
951
+ var _a;
952
952
  const target = e.target;
953
953
  this.isResizeToMobile = false;
954
954
  this.collapsibleFacetsVisible = target.open;
955
- this.analyticsHandler?.sendEvent({
955
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
956
956
  category: this.searchContext,
957
957
  action: analyticsActions.mobileFacetsToggled,
958
958
  label: target.open ? 'open' : 'closed',
@@ -969,122 +969,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
969
969
  </details>
970
970
  `;
971
971
  }
972
- async networksDropdownToggled() {
973
- if (this.tvMapsPopulated)
974
- return;
975
- this.loadingNetworks = true;
976
- await this.dataSource.populateTVChannelMaps();
977
- this.loadingNetworks = false;
978
- this.tvMapsPopulated = true;
979
- }
980
- async showsDropdownToggled() {
981
- if (this.tvMapsPopulated)
982
- return;
983
- this.loadingShows = true;
984
- await this.dataSource.populateTVChannelMaps();
985
- this.loadingShows = false;
986
- this.tvMapsPopulated = true;
987
- }
988
- async networksDropdownChanged() {
989
- const previousNetwork = this.selectedTVNetwork;
990
- const newNetwork = this.tvNetworksDropdown.selectedOption?.text;
991
- this.selectedTVNetwork = newNetwork ?? undefined;
992
- const entries = this.dataSource.tvChannelMaps.channelToNetwork.entries();
993
- for (const [channel, network] of entries) {
994
- if (network === previousNetwork) {
995
- // Remove any previously-applied network filter
996
- const removedBucket = {
997
- key: channel.toLowerCase(),
998
- count: 0,
999
- state: 'none',
1000
- };
1001
- this.selectedFacets = updateSelectedFacetBucket(this.selectedFacets, 'creator', removedBucket, true);
1002
- }
1003
- else if (network === this.selectedTVNetwork) {
1004
- const newBucket = {
1005
- key: channel.toLowerCase(),
1006
- count: 0,
1007
- state: 'selected',
1008
- };
1009
- this.selectedFacets = updateSelectedFacetBucket(this.selectedFacets, 'creator', newBucket);
1010
- }
1011
- }
1012
- }
1013
- async showsDropdownChanged() {
1014
- const previousShow = this.selectedTVShow;
1015
- const newShow = this.tvShowsDropdown.selectedOption?.text;
1016
- this.selectedTVShow = newShow ?? undefined;
1017
- // Remove any previously-applied shows filter
1018
- if (previousShow !== undefined) {
1019
- const removedBucket = {
1020
- key: previousShow,
1021
- count: 0,
1022
- state: 'none',
1023
- };
1024
- this.selectedFacets = updateSelectedFacetBucket(this.selectedFacets, 'program', removedBucket, true);
1025
- }
1026
- if (this.selectedTVShow) {
1027
- const newBucket = {
1028
- key: this.selectedTVShow,
1029
- count: 0,
1030
- state: 'selected',
1031
- };
1032
- this.selectedFacets = updateSelectedFacetBucket(this.selectedFacets, 'program', newBucket);
1033
- }
1034
- }
1035
- get tvDropdownFiltersTemplate() {
1036
- if (this.searchType !== SearchType.TV)
1037
- return nothing;
1038
- const { channelToNetwork, programToChannels } = this.dataSource.tvChannelMaps;
1039
- const networks = channelToNetwork
1040
- ? [...new Set(channelToNetwork.values())]
1041
- : [];
1042
- let showEntries = programToChannels ? [...programToChannels.entries()] : [];
1043
- if (channelToNetwork && this.selectedTVNetwork) {
1044
- showEntries = showEntries.filter(([, channels]) => Object.keys(channels).some(c => channelToNetwork.get(c) === this.selectedTVNetwork));
1045
- }
1046
- const shows = showEntries.map(([show]) => show);
1047
- const loadingIndicator = html `
1048
- <img src="https://archive.org/images/loading.gif" />
1049
- `;
1050
- return html `
1051
- <div id="tv-filters" slot="facets-top">
1052
- <ia-combo-box
1053
- id="tv-networks"
1054
- class="tv-filter-dropdown"
1055
- placeholder="Filter by Network"
1056
- clearable
1057
- wrap-arrow-keys
1058
- sort
1059
- .options=${networks.map((n, i) => ({ id: `network-${i}`, text: n }))}
1060
- @toggle=${this.networksDropdownToggled}
1061
- @change=${this.networksDropdownChanged}
1062
- >
1063
- <span slot="label" class="sr-only">${msg('Filter by Network')}</span>
1064
- ${this.loadingNetworks
1065
- ? html `<span slot="empty-options">${loadingIndicator}</span>`
1066
- : nothing}
1067
- </ia-combo-box>
1068
- <ia-combo-box
1069
- id="tv-shows"
1070
- class="tv-filter-dropdown"
1071
- placeholder="Filter by Show"
1072
- max-autocomplete-entries="500"
1073
- clearable
1074
- wrap-arrow-keys
1075
- sort
1076
- .options=${shows.map((s, i) => ({ id: `show-${i}`, text: s }))}
1077
- @toggle=${this.showsDropdownToggled}
1078
- @change=${this.showsDropdownChanged}
1079
- >
1080
- <span slot="label" class="sr-only">${msg('Filter by Show')}</span>
1081
- ${this.loadingShows
1082
- ? html `<span slot="empty-options">${loadingIndicator}</span>`
1083
- : nothing}
1084
- </ia-combo-box>
1085
- </div>
1086
- `;
1087
- }
1088
972
  /**
1089
973
  * The template for the facets component alone, without any surrounding wrappers.
1090
974
  */
@@ -1142,7 +1026,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1142
1026
  @facetsChanged=${this.facetsChanged}
1143
1027
  @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
1144
1028
  >
1145
- ${this.tvDropdownFiltersTemplate}
1146
1029
  </collection-facets>
1147
1030
  `;
1148
1031
  // If we are using one of the opt-in facet load strategies, we may need to wrap the
@@ -1218,9 +1101,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1218
1101
  * Handler for when the date picker's date range is changed.
1219
1102
  */
1220
1103
  histogramDateRangeUpdated(e) {
1104
+ var _a;
1221
1105
  const { minDate, maxDate } = e.detail;
1222
1106
  [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
1223
- this.analyticsHandler?.sendEvent({
1107
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1224
1108
  category: this.searchContext,
1225
1109
  action: analyticsActions.histogramChanged,
1226
1110
  label: this.dateRangeQueryClause,
@@ -1257,6 +1141,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1257
1141
  * represent, such as the search query, sort option, and any filters applied.
1258
1142
  */
1259
1143
  async installDataSourceAndQueryState(dataSource, queryState) {
1144
+ var _a, _b, _c;
1260
1145
  log('Installing data source & query state in CB:', dataSource, queryState);
1261
1146
  if (this.dataSource)
1262
1147
  this.removeController(this.dataSource);
@@ -1266,14 +1151,15 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1266
1151
  this.profileElement = queryState.profileElement;
1267
1152
  this.searchType = queryState.searchType;
1268
1153
  this.selectedFacets =
1269
- queryState.selectedFacets ?? getDefaultSelectedFacets();
1154
+ (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
1270
1155
  this.internalFilters = queryState.internalFilters;
1271
1156
  this.minSelectedDate = queryState.minSelectedDate;
1272
1157
  this.maxSelectedDate = queryState.maxSelectedDate;
1273
- this.selectedSort = queryState.selectedSort ?? SortField.default;
1158
+ this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
1274
1159
  this.sortDirection = queryState.sortDirection;
1275
1160
  this.selectedTitleFilter = queryState.selectedTitleFilter;
1276
1161
  this.selectedCreatorFilter = queryState.selectedCreatorFilter;
1162
+ this.tvClipFilter = (_c = queryState.tvClipFilter) !== null && _c !== void 0 ? _c : 'all';
1277
1163
  this.pagesToRender = this.initialPageNumber;
1278
1164
  // We set this flag during the update to prevent the URL state persistence
1279
1165
  // from creating an unwanted extra history entry.
@@ -1317,6 +1203,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1317
1203
  }
1318
1204
  }
1319
1205
  updated(changed) {
1206
+ var _a, _b, _c;
1320
1207
  if (changed.has('placeholderType') && this.placeholderType === null) {
1321
1208
  if (!this.leftColIntersectionObserver) {
1322
1209
  this.setupLeftColumnScrollListeners();
@@ -1333,7 +1220,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1333
1220
  changed.has('baseNavigationUrl') ||
1334
1221
  changed.has('baseImageUrl') ||
1335
1222
  changed.has('loggedIn')) {
1336
- this.infiniteScroller?.reload();
1223
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
1337
1224
  }
1338
1225
  if (changed.has('baseQuery') ||
1339
1226
  changed.has('identifiers') ||
@@ -1360,9 +1247,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1360
1247
  });
1361
1248
  }
1362
1249
  }
1363
- if (changed.has('searchType') && this.searchType === SearchType.TV) {
1364
- this.applyDefaultTVSearchSort();
1365
- }
1366
1250
  if (changed.has('profileElement')) {
1367
1251
  this.applyDefaultProfileSort();
1368
1252
  }
@@ -1434,8 +1318,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1434
1318
  this.fetchManageableSearchResults();
1435
1319
  }
1436
1320
  else if (this.pageContext === 'search')
1437
- this.infiniteScroller?.reload();
1438
- this.infiniteScroller?.refreshAllVisibleCells();
1321
+ (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
1322
+ (_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
1439
1323
  // Only emit change event if changing b/w true & false, not on initial value set.
1440
1324
  if (changed.get('isManageView') !== undefined) {
1441
1325
  this.emitManageModeChangedEvent();
@@ -1450,19 +1334,21 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1450
1334
  this.ensureAvailableTilesDisplayed();
1451
1335
  }
1452
1336
  connectedCallback() {
1453
- super.connectedCallback?.();
1337
+ var _a;
1338
+ (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
1454
1339
  this.setupStateRestorationObserver();
1455
1340
  this.setupResizeObserver();
1456
1341
  }
1457
1342
  disconnectedCallback() {
1343
+ var _a, _b;
1458
1344
  if (this.resizeObserver) {
1459
1345
  this.disconnectResizeObserver(this.resizeObserver);
1460
1346
  }
1461
1347
  if (this.boundNavigationHandler) {
1462
1348
  window.removeEventListener('popstate', this.boundNavigationHandler);
1463
1349
  }
1464
- this.leftColIntersectionObserver?.disconnect();
1465
- this.facetsIntersectionObserver?.disconnect();
1350
+ (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
1351
+ (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
1466
1352
  window.removeEventListener('resize', this.updateLeftColumnHeight);
1467
1353
  }
1468
1354
  handleResize(entry) {
@@ -1516,11 +1402,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1516
1402
  * Sets up listeners for events that may require updating the left column height.
1517
1403
  */
1518
1404
  setupLeftColumnScrollListeners() {
1405
+ var _a;
1519
1406
  // We observe intersections between the left column's scroll sentinel and
1520
1407
  // the viewport, so that we can ensure the left column is always sized to
1521
1408
  // match the _available_ viewport height. This should generally be more
1522
1409
  // performant than listening to scroll events on the page or column.
1523
- const leftColumnSentinel = this.shadowRoot?.querySelector('#left-column-scroll-sentinel');
1410
+ const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
1524
1411
  if (leftColumnSentinel) {
1525
1412
  this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
1526
1413
  threshold: [...Array(201).keys()].map(n => n / 200), // Threshold every 0.5%
@@ -1537,7 +1424,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1537
1424
  * don't need granular intersection thresholds for this.
1538
1425
  */
1539
1426
  setupFacetsScrollListeners() {
1540
- const facetsSentinel = this.shadowRoot?.querySelector('#facets-scroll-sentinel');
1427
+ var _a;
1428
+ const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
1541
1429
  if (facetsSentinel) {
1542
1430
  this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
1543
1431
  this.facetsIntersectionObserver.observe(facetsSentinel);
@@ -1600,6 +1488,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1600
1488
  sortDirection: this.sortDirection,
1601
1489
  selectedTitleFilter: this.selectedTitleFilter,
1602
1490
  selectedCreatorFilter: this.selectedCreatorFilter,
1491
+ tvClipFilter: this.tvClipFilter,
1603
1492
  },
1604
1493
  }));
1605
1494
  }
@@ -1668,6 +1557,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1668
1557
  * fetching new results.
1669
1558
  */
1670
1559
  async handleQueryChange() {
1560
+ var _a;
1671
1561
  // only reset if the query has actually changed
1672
1562
  if (!this.searchService ||
1673
1563
  this.dataSource.pageFetchQueryKey === this.previousQueryKey) {
@@ -1689,7 +1579,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1689
1579
  this.infiniteScroller.itemCount = this.estimatedTileCount;
1690
1580
  this.infiniteScroller.reload();
1691
1581
  }
1692
- if (this.withinCollection && this.baseQuery?.trim()) {
1582
+ if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1693
1583
  this.defaultSortField = SortField.relevance;
1694
1584
  this.defaultSortDirection = null;
1695
1585
  }
@@ -1716,40 +1606,43 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1716
1606
  this.restoreState();
1717
1607
  }
1718
1608
  restoreState() {
1609
+ var _a, _b, _c, _d, _e, _f;
1719
1610
  const restorationState = this.restorationStateHandler.getRestorationState();
1720
1611
  this.displayMode = restorationState.displayMode;
1721
1612
  if (!this.suppressURLSinParam && restorationState.searchType != null)
1722
1613
  this.searchType = restorationState.searchType;
1723
- this.selectedSort = restorationState.selectedSort ?? SortField.default;
1724
- this.sortDirection = restorationState.sortDirection ?? null;
1725
- this.selectedTitleFilter = restorationState.selectedTitleFilter ?? null;
1726
- this.selectedCreatorFilter = restorationState.selectedCreatorFilter ?? null;
1614
+ this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1615
+ this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1616
+ this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1617
+ this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1727
1618
  this.selectedFacets = restorationState.selectedFacets;
1728
1619
  if (!this.suppressURLQuery)
1729
1620
  this.baseQuery = restorationState.baseQuery;
1730
- this.currentPage = restorationState.currentPage ?? 1;
1621
+ this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1731
1622
  this.minSelectedDate = restorationState.minSelectedDate;
1732
1623
  this.maxSelectedDate = restorationState.maxSelectedDate;
1624
+ this.tvClipFilter = (_f = restorationState.tvClipFilter) !== null && _f !== void 0 ? _f : 'all';
1733
1625
  if (this.currentPage > 1) {
1734
1626
  this.goToPage(this.currentPage);
1735
1627
  }
1736
1628
  }
1737
1629
  persistState() {
1738
- const isDefaultSort = this.selectedSort === this.defaultSortField;
1630
+ var _a, _b, _c, _d;
1739
1631
  const restorationState = {
1740
1632
  displayMode: this.displayMode,
1741
1633
  searchType: this.suppressURLSinParam ? undefined : this.searchType,
1742
- selectedSort: isDefaultSort ? SortField.default : this.selectedSort,
1743
- sortDirection: this.sortDirection ?? undefined,
1744
- selectedFacets: this.selectedFacets ?? getDefaultSelectedFacets(),
1634
+ selectedSort: this.selectedSort,
1635
+ sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1636
+ selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1745
1637
  baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1746
1638
  currentPage: this.currentPage,
1747
1639
  titleQuery: this.titleQuery,
1748
1640
  creatorQuery: this.creatorQuery,
1749
1641
  minSelectedDate: this.minSelectedDate,
1750
1642
  maxSelectedDate: this.maxSelectedDate,
1751
- selectedTitleFilter: this.selectedTitleFilter ?? undefined,
1752
- selectedCreatorFilter: this.selectedCreatorFilter ?? undefined,
1643
+ selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1644
+ selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1645
+ tvClipFilter: this.tvClipFilter,
1753
1646
  };
1754
1647
  const persistOptions = {
1755
1648
  forceReplace: this.dataSourceInstallInProgress,
@@ -1779,6 +1672,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1779
1672
  * Fires analytics indicating the type of facet event that took place.
1780
1673
  */
1781
1674
  facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1675
+ var _a;
1782
1676
  let action;
1783
1677
  if (negative) {
1784
1678
  action =
@@ -1792,7 +1686,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1792
1686
  ? analyticsActions.facetSelected
1793
1687
  : analyticsActions.facetDeselected;
1794
1688
  }
1795
- this.analyticsHandler?.sendEvent({
1689
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1796
1690
  category: this.searchContext,
1797
1691
  action,
1798
1692
  label: facetType,
@@ -1804,15 +1698,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1804
1698
  // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1805
1699
  // then scrolls to the cell
1806
1700
  setTimeout(() => {
1701
+ var _a;
1807
1702
  this.isScrollingToCell = true;
1808
- this.infiniteScroller?.scrollToCell(cellIndexToScrollTo, true);
1703
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1809
1704
  // This timeout is to give the scroll animation time to finish
1810
1705
  // then updating the infinite scroller once we're done scrolling
1811
1706
  // There's no scroll animation completion callback so we're
1812
1707
  // giving it 0.5s to finish.
1813
1708
  setTimeout(() => {
1709
+ var _a;
1814
1710
  this.isScrollingToCell = false;
1815
- this.infiniteScroller?.refreshAllVisibleCells();
1711
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1816
1712
  resolve();
1817
1713
  }, 500);
1818
1714
  }, 0);
@@ -1823,7 +1719,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1823
1719
  * Currently equivalent to having a non-empty query.
1824
1720
  */
1825
1721
  get isRelevanceSortAvailable() {
1826
- return !!this.baseQuery?.trim();
1722
+ var _a;
1723
+ return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1827
1724
  }
1828
1725
  /**
1829
1726
  * Sets the total number of tiles displayed in the infinite scroller.
@@ -1833,13 +1730,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1833
1730
  this.infiniteScroller.itemCount = count;
1834
1731
  }
1835
1732
  }
1836
- /**
1837
- * Applies the default sort options for the TV search results page
1838
- */
1839
- applyDefaultTVSearchSort() {
1840
- this.defaultSortField = SortField.datearchived;
1841
- this.defaultSortDirection = 'desc';
1842
- }
1843
1733
  /**
1844
1734
  * Applies any default sort option for the current collection, by checking
1845
1735
  * for one in the collection's metadata. If none is found, defaults to sorting
@@ -1848,6 +1738,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1848
1738
  * - Weekly views for all other collections
1849
1739
  */
1850
1740
  applyDefaultCollectionSort(collectionInfo) {
1741
+ var _a, _b, _c;
1851
1742
  if (this.baseQuery) {
1852
1743
  // If there's a query set, then we default to relevance sorting regardless of
1853
1744
  // the collection metadata-specified sort.
@@ -1857,13 +1748,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1857
1748
  }
1858
1749
  // Favorite collections sort on Date Favorited by default.
1859
1750
  // Other collections fall back to sorting on weekly views.
1860
- const baseDefaultSort = collectionInfo?.public_metadata?.identifier?.startsWith('fav-')
1751
+ const baseDefaultSort = ((_b = (_a = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _a === void 0 ? void 0 : _a.identifier) === null || _b === void 0 ? void 0 : _b.startsWith('fav-'))
1861
1752
  ? '-favoritedate'
1862
1753
  : '-week';
1863
1754
  // The collection metadata may override the default sorting with something else
1864
- const metadataSort = collectionInfo?.public_metadata?.['sort-by'];
1755
+ const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1865
1756
  // Prefer the metadata-specified sort if one exists
1866
- const defaultSortToApply = metadataSort ?? baseDefaultSort;
1757
+ const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1867
1758
  // Account for both -field and field:dir formats
1868
1759
  let [field, dir] = defaultSortToApply.split(':');
1869
1760
  if (field.startsWith('-')) {
@@ -1886,7 +1777,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1886
1777
  applyDefaultProfileSort() {
1887
1778
  if (this.profileElement) {
1888
1779
  const defaultSortField = defaultProfileElementSorts[this.profileElement];
1889
- this.defaultSortField = defaultSortField ?? SortField.weeklyview;
1780
+ this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1890
1781
  }
1891
1782
  else {
1892
1783
  this.defaultSortField = SortField.weeklyview;
@@ -1900,7 +1791,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1900
1791
  * page are visible, but if the page is not currenlty visible, we don't need to reload
1901
1792
  */
1902
1793
  get currentVisiblePageNumbers() {
1903
- const visibleCells = this.infiniteScroller?.getVisibleCellIndices() ?? [];
1794
+ var _a, _b;
1795
+ const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1904
1796
  const visiblePages = new Set();
1905
1797
  visibleCells.forEach(cellIndex => {
1906
1798
  const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
@@ -1915,33 +1807,35 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1915
1807
  const { withinCollection } = this;
1916
1808
  const topCollections = ['radio'];
1917
1809
  const isTopCollection = topCollections.includes(withinCollection);
1918
- const isSubCollection = topCollections.some(topCollxn => this.dataSource.parentCollections?.includes(topCollxn));
1810
+ const isSubCollection = topCollections.some(topCollxn => { var _a; return (_a = this.dataSource.parentCollections) === null || _a === void 0 ? void 0 : _a.includes(topCollxn); });
1919
1811
  return isTopCollection || isSubCollection;
1920
1812
  }
1921
1813
  /**
1922
1814
  * Refreshes all visible result cells in the infinite scroller.
1923
1815
  */
1924
1816
  refreshVisibleResults() {
1925
- this.infiniteScroller?.refreshAllVisibleCells();
1817
+ var _a;
1818
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1926
1819
  }
1927
1820
  /**
1928
1821
  * Callback when a result is selected
1929
1822
  */
1930
1823
  resultSelected(event) {
1824
+ var _a, _b, _c;
1931
1825
  if (this.isManageView) {
1932
1826
  // Checked/unchecked state change -- rerender to ensure it propagates
1933
1827
  // this.mapDataSource(model => ({ ...model }));
1934
1828
  const cellIndex = this.dataSource.indexOf(event.detail);
1935
1829
  if (cellIndex >= 0)
1936
- this.infiniteScroller?.refreshCell(cellIndex);
1830
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1937
1831
  this.requestUpdate();
1938
1832
  }
1939
- this.analyticsHandler?.sendEvent({
1833
+ (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1940
1834
  category: this.searchContext,
1941
1835
  action: analyticsActions.resultSelected,
1942
1836
  label: event.detail.mediatype,
1943
1837
  });
1944
- this.analyticsHandler?.sendEvent({
1838
+ (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1945
1839
  category: this.searchContext,
1946
1840
  action: analyticsActions.resultSelected,
1947
1841
  label: `page-${this.currentPage}`,
@@ -2004,13 +1898,14 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
2004
1898
  * 4. Reloads the infinite scroller to display new results
2005
1899
  */
2006
1900
  fetchManageableSearchResults() {
1901
+ var _a;
2007
1902
  const hasNotLoadedInitialResults = !this.dataSource.totalResults;
2008
1903
  const hasLoadedWithMoreResultsAvailable = !this.searchResultsLoading && this.dataSource.totalResults > 100;
2009
1904
  if (this.pageContext === 'search' &&
2010
1905
  (hasNotLoadedInitialResults || hasLoadedWithMoreResultsAvailable)) {
2011
1906
  this.dataSource.resetPages();
2012
1907
  this.dataSource.fetchPage(1, this.maxPagesToManage);
2013
- this.infiniteScroller?.reload();
1908
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
2014
1909
  }
2015
1910
  }
2016
1911
  static get styles() {
@@ -2183,10 +2078,10 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
2183
2078
  #facets-bottom-fade {
2184
2079
  background: linear-gradient(
2185
2080
  to bottom,
2186
- #fbfbfd00 0%,
2187
- #fbfbfdc0 50%,
2188
- #fbfbfd 80%,
2189
- #fbfbfd 100%
2081
+ #f5f5f700 0%,
2082
+ #f5f5f7c0 50%,
2083
+ #f5f5f7 80%,
2084
+ #f5f5f7 100%
2190
2085
  );
2191
2086
  position: fixed;
2192
2087
  bottom: 0;
@@ -2289,46 +2184,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
2289
2184
  line-height: 1.3rem;
2290
2185
  }
2291
2186
 
2292
- #tv-filters {
2293
- margin-bottom: 15px;
2294
- }
2295
-
2296
- #tv-shows {
2297
- --comboBoxListWidth: 300px;
2298
- }
2299
-
2300
- .tv-filter-dropdown {
2301
- display: block;
2302
- font-size: 14px;
2303
- margin-left: 1px;
2304
- margin-bottom: 5px;
2305
- }
2306
-
2307
- .tv-filter-dropdown::part(combo-box) {
2308
- outline-offset: 1px;
2309
- }
2310
-
2311
- .tv-filter-dropdown::part(option) {
2312
- line-height: 1.1;
2313
- padding: 7px;
2314
- }
2315
-
2316
- .tv-filter-dropdown::part(clear-button) {
2317
- flex: 0 0 26px;
2318
- --combo-box-clear-icon-size: 14px;
2319
- }
2320
-
2321
- .tv-filter-dropdown::part(icon) {
2322
- width: 1.4rem;
2323
- height: 1.4rem;
2324
- }
2325
-
2326
2187
  #facets-container {
2327
2188
  position: relative;
2328
2189
  max-height: 0;
2329
2190
  transition: max-height 0.2s ease-in-out;
2330
2191
  z-index: 1;
2331
- margin-top: var(--facetsContainerMarginTop, 3rem);
2192
+ margin-top: var(--facetsContainerMarginTop, 5rem);
2332
2193
  padding-bottom: 2rem;
2333
2194
  }
2334
2195
 
@@ -2358,10 +2219,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
2358
2219
  align-items: baseline;
2359
2220
  }
2360
2221
 
2361
- #results-total:not(.filtered) {
2362
- padding-bottom: 2rem;
2363
- }
2364
-
2365
2222
  .mobile #results-total {
2366
2223
  position: absolute;
2367
2224
  right: 10px;
@@ -2532,6 +2389,9 @@ __decorate([
2532
2389
  __decorate([
2533
2390
  property({ type: String })
2534
2391
  ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
2392
+ __decorate([
2393
+ property({ type: String })
2394
+ ], CollectionBrowser.prototype, "tvClipFilter", void 0);
2535
2395
  __decorate([
2536
2396
  property({ type: String })
2537
2397
  ], CollectionBrowser.prototype, "sortDirection", void 0);
@@ -2679,21 +2539,6 @@ __decorate([
2679
2539
  __decorate([
2680
2540
  state()
2681
2541
  ], CollectionBrowser.prototype, "placeholderType", void 0);
2682
- __decorate([
2683
- state()
2684
- ], CollectionBrowser.prototype, "selectedTVNetwork", void 0);
2685
- __decorate([
2686
- state()
2687
- ], CollectionBrowser.prototype, "selectedTVShow", void 0);
2688
- __decorate([
2689
- state()
2690
- ], CollectionBrowser.prototype, "tvMapsPopulated", void 0);
2691
- __decorate([
2692
- state()
2693
- ], CollectionBrowser.prototype, "loadingNetworks", void 0);
2694
- __decorate([
2695
- state()
2696
- ], CollectionBrowser.prototype, "loadingShows", void 0);
2697
2542
  __decorate([
2698
2543
  query('#content-container')
2699
2544
  ], CollectionBrowser.prototype, "contentContainer", void 0);
@@ -2709,12 +2554,6 @@ __decorate([
2709
2554
  __decorate([
2710
2555
  query('smart-facet-bar')
2711
2556
  ], CollectionBrowser.prototype, "smartFacetBar", void 0);
2712
- __decorate([
2713
- query('#tv-networks')
2714
- ], CollectionBrowser.prototype, "tvNetworksDropdown", void 0);
2715
- __decorate([
2716
- query('#tv-shows')
2717
- ], CollectionBrowser.prototype, "tvShowsDropdown", void 0);
2718
2557
  __decorate([
2719
2558
  property({ type: Object, attribute: false })
2720
2559
  ], CollectionBrowser.prototype, "analyticsHandler", void 0);