@internetarchive/collection-browser 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/.editorconfig +29 -29
  2. package/.husky/pre-commit +4 -4
  3. package/LICENSE +661 -661
  4. package/README.md +83 -83
  5. package/dist/index.d.ts +12 -12
  6. package/dist/index.js +12 -12
  7. package/dist/src/app-root.d.ts +91 -91
  8. package/dist/src/app-root.js +487 -487
  9. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
  10. package/dist/src/assets/img/icons/arrow-left.js +2 -2
  11. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
  12. package/dist/src/assets/img/icons/arrow-right.js +2 -2
  13. package/dist/src/assets/img/icons/chevron.d.ts +2 -2
  14. package/dist/src/assets/img/icons/chevron.js +2 -2
  15. package/dist/src/assets/img/icons/contract.d.ts +2 -2
  16. package/dist/src/assets/img/icons/contract.js +2 -2
  17. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  18. package/dist/src/assets/img/icons/empty-query.js +2 -2
  19. package/dist/src/assets/img/icons/expand.d.ts +2 -2
  20. package/dist/src/assets/img/icons/expand.js +2 -2
  21. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  22. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  23. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  24. package/dist/src/assets/img/icons/eye.js +2 -2
  25. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  26. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  27. package/dist/src/assets/img/icons/favorite-unfilled.d.ts +1 -1
  28. package/dist/src/assets/img/icons/favorite-unfilled.js +2 -2
  29. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  30. package/dist/src/assets/img/icons/login-required.js +2 -2
  31. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  32. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  33. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  34. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  35. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  36. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  37. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  38. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  39. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  40. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  41. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  42. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  43. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  44. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  45. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  46. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  47. package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
  48. package/dist/src/assets/img/icons/mediatype/search.js +2 -2
  49. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  50. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  51. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  52. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  53. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  54. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  55. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  56. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  57. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  58. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  59. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  60. package/dist/src/assets/img/icons/null-result.js +2 -2
  61. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  62. package/dist/src/assets/img/icons/restricted.js +2 -2
  63. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  64. package/dist/src/assets/img/icons/reviews.js +2 -2
  65. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  66. package/dist/src/assets/img/icons/upload.js +2 -2
  67. package/dist/src/assets/img/icons/views.d.ts +1 -1
  68. package/dist/src/assets/img/icons/views.js +2 -2
  69. package/dist/src/circular-activity-indicator.d.ts +5 -5
  70. package/dist/src/circular-activity-indicator.js +17 -17
  71. package/dist/src/collection-browser.d.ts +466 -466
  72. package/dist/src/collection-browser.js +1475 -1475
  73. package/dist/src/collection-facets/facet-row.d.ts +30 -30
  74. package/dist/src/collection-facets/facet-row.js +114 -114
  75. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  76. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  77. package/dist/src/collection-facets/facets-template.d.ts +17 -17
  78. package/dist/src/collection-facets/facets-template.js +114 -114
  79. package/dist/src/collection-facets/more-facets-content.d.ts +74 -74
  80. package/dist/src/collection-facets/more-facets-content.js +360 -360
  81. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  82. package/dist/src/collection-facets/more-facets-pagination.js +196 -196
  83. package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
  84. package/dist/src/collection-facets/toggle-switch.js +94 -94
  85. package/dist/src/collection-facets.d.ts +103 -103
  86. package/dist/src/collection-facets.js +510 -510
  87. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +241 -241
  88. package/dist/src/data-source/collection-browser-data-source-interface.js +1 -1
  89. package/dist/src/data-source/collection-browser-data-source.d.ts +378 -378
  90. package/dist/src/data-source/collection-browser-data-source.js +985 -985
  91. package/dist/src/data-source/collection-browser-query-state.d.ts +43 -43
  92. package/dist/src/data-source/collection-browser-query-state.js +1 -1
  93. package/dist/src/data-source/models.d.ts +28 -28
  94. package/dist/src/data-source/models.js +8 -8
  95. package/dist/src/empty-placeholder.d.ts +23 -23
  96. package/dist/src/empty-placeholder.js +74 -74
  97. package/dist/src/expanded-date-picker.d.ts +43 -43
  98. package/dist/src/expanded-date-picker.js +109 -109
  99. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  100. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  101. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  102. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  103. package/dist/src/manage/manage-bar.d.ts +30 -30
  104. package/dist/src/manage/manage-bar.js +61 -61
  105. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  106. package/dist/src/mediatype/mediatype-config.js +91 -91
  107. package/dist/src/models.d.ts +209 -209
  108. package/dist/src/models.js +381 -381
  109. package/dist/src/restoration-state-handler.d.ts +70 -70
  110. package/dist/src/restoration-state-handler.js +357 -357
  111. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
  112. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
  113. package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
  114. package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
  115. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  116. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  117. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  118. package/dist/src/sort-filter-bar/img/list.js +2 -2
  119. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
  120. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
  121. package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
  122. package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
  123. package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
  124. package/dist/src/sort-filter-bar/img/sort-toggle-up.js +2 -2
  125. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  126. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  127. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  128. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  129. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +222 -222
  130. package/dist/src/sort-filter-bar/sort-filter-bar.js +696 -696
  131. package/dist/src/styles/ia-button.d.ts +2 -2
  132. package/dist/src/styles/ia-button.js +16 -16
  133. package/dist/src/styles/item-image-styles.d.ts +8 -8
  134. package/dist/src/styles/item-image-styles.js +9 -9
  135. package/dist/src/styles/sr-only.d.ts +1 -1
  136. package/dist/src/styles/sr-only.js +2 -2
  137. package/dist/src/tiles/base-tile-component.d.ts +19 -19
  138. package/dist/src/tiles/base-tile-component.js +63 -63
  139. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  140. package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
  141. package/dist/src/tiles/grid/account-tile.d.ts +18 -18
  142. package/dist/src/tiles/grid/account-tile.js +72 -72
  143. package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
  144. package/dist/src/tiles/grid/collection-tile.js +80 -80
  145. package/dist/src/tiles/grid/item-tile.d.ts +30 -30
  146. package/dist/src/tiles/grid/item-tile.js +149 -149
  147. package/dist/src/tiles/grid/search-tile.d.ts +10 -10
  148. package/dist/src/tiles/grid/search-tile.js +51 -51
  149. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  150. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +8 -8
  151. package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
  152. package/dist/src/tiles/grid/tile-stats.js +53 -53
  153. package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
  154. package/dist/src/tiles/hover/hover-pane-controller.js +354 -352
  155. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  156. package/dist/src/tiles/hover/tile-hover-pane.d.ts +18 -15
  157. package/dist/src/tiles/hover/tile-hover-pane.js +127 -47
  158. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  159. package/dist/src/tiles/image-block.d.ts +17 -17
  160. package/dist/src/tiles/image-block.js +74 -74
  161. package/dist/src/tiles/image-block.js.map +1 -1
  162. package/dist/src/tiles/item-image.d.ts +39 -39
  163. package/dist/src/tiles/item-image.js +154 -154
  164. package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
  165. package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
  166. package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
  167. package/dist/src/tiles/list/tile-list-compact.js +114 -114
  168. package/dist/src/tiles/list/tile-list.d.ts +50 -50
  169. package/dist/src/tiles/list/tile-list.js +315 -315
  170. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  171. package/dist/src/tiles/mediatype-icon.js +47 -47
  172. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  173. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  174. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  175. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  176. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  177. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  178. package/dist/src/tiles/review-block.d.ts +12 -12
  179. package/dist/src/tiles/review-block.js +56 -56
  180. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  181. package/dist/src/tiles/text-snippet-block.js +73 -73
  182. package/dist/src/tiles/tile-dispatcher.d.ts +64 -64
  183. package/dist/src/tiles/tile-dispatcher.js +229 -229
  184. package/dist/src/tiles/tile-display-value-provider.d.ts +47 -47
  185. package/dist/src/tiles/tile-display-value-provider.js +94 -94
  186. package/dist/src/utils/analytics-events.d.ts +28 -28
  187. package/dist/src/utils/analytics-events.js +30 -30
  188. package/dist/src/utils/array-equals.d.ts +4 -4
  189. package/dist/src/utils/array-equals.js +10 -10
  190. package/dist/src/utils/collapse-repeated-quotes.d.ts +11 -11
  191. package/dist/src/utils/collapse-repeated-quotes.js +13 -13
  192. package/dist/src/utils/format-count.d.ts +7 -7
  193. package/dist/src/utils/format-count.js +76 -76
  194. package/dist/src/utils/format-date.d.ts +2 -2
  195. package/dist/src/utils/format-date.js +25 -25
  196. package/dist/src/utils/format-unit-size.d.ts +2 -2
  197. package/dist/src/utils/format-unit-size.js +33 -33
  198. package/dist/src/utils/local-date-from-utc.d.ts +9 -9
  199. package/dist/src/utils/local-date-from-utc.js +15 -15
  200. package/dist/src/utils/log.d.ts +7 -7
  201. package/dist/src/utils/log.js +15 -15
  202. package/dist/src/utils/resolve-mediatype.d.ts +8 -8
  203. package/dist/src/utils/resolve-mediatype.js +23 -23
  204. package/dist/src/utils/sha1.d.ts +2 -2
  205. package/dist/src/utils/sha1.js +8 -8
  206. package/dist/test/collection-browser.test.d.ts +1 -1
  207. package/dist/test/collection-browser.test.js +1293 -1293
  208. package/dist/test/collection-facets/facet-row.test.d.ts +1 -1
  209. package/dist/test/collection-facets/facet-row.test.js +203 -203
  210. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  211. package/dist/test/collection-facets/facets-template.test.js +105 -105
  212. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  213. package/dist/test/collection-facets/more-facets-content.test.js +139 -139
  214. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  215. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  216. package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -1
  217. package/dist/test/collection-facets/toggle-switch.test.js +73 -73
  218. package/dist/test/collection-facets.test.d.ts +2 -2
  219. package/dist/test/collection-facets.test.js +652 -652
  220. package/dist/test/data-source/collection-browser-data-source.test.d.ts +1 -1
  221. package/dist/test/data-source/collection-browser-data-source.test.js +89 -89
  222. package/dist/test/empty-placeholder.test.d.ts +1 -1
  223. package/dist/test/empty-placeholder.test.js +63 -63
  224. package/dist/test/expanded-date-picker.test.d.ts +1 -1
  225. package/dist/test/expanded-date-picker.test.js +95 -95
  226. package/dist/test/icon-overlay.test.d.ts +1 -1
  227. package/dist/test/icon-overlay.test.js +24 -24
  228. package/dist/test/image-block.test.d.ts +1 -1
  229. package/dist/test/image-block.test.js +48 -48
  230. package/dist/test/item-image.test.d.ts +1 -1
  231. package/dist/test/item-image.test.js +85 -85
  232. package/dist/test/manage/manage-bar.test.d.ts +1 -1
  233. package/dist/test/manage/manage-bar.test.js +81 -81
  234. package/dist/test/mediatype-config.test.d.ts +1 -1
  235. package/dist/test/mediatype-config.test.js +16 -16
  236. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  237. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  238. package/dist/test/mocks/mock-search-responses.d.ts +24 -24
  239. package/dist/test/mocks/mock-search-responses.js +860 -860
  240. package/dist/test/mocks/mock-search-service.d.ts +15 -15
  241. package/dist/test/mocks/mock-search-service.js +53 -53
  242. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  243. package/dist/test/restoration-state-handler.test.js +270 -270
  244. package/dist/test/review-block.test.d.ts +1 -1
  245. package/dist/test/review-block.test.js +44 -44
  246. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
  247. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
  248. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  249. package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
  250. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  251. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +426 -426
  252. package/dist/test/text-overlay.test.d.ts +1 -1
  253. package/dist/test/text-overlay.test.js +48 -48
  254. package/dist/test/text-snippet-block.test.d.ts +1 -1
  255. package/dist/test/text-snippet-block.test.js +57 -57
  256. package/dist/test/tile-stats.test.d.ts +1 -1
  257. package/dist/test/tile-stats.test.js +81 -81
  258. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  259. package/dist/test/tiles/grid/account-tile.test.js +76 -76
  260. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
  261. package/dist/test/tiles/grid/collection-tile.test.js +73 -73
  262. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  263. package/dist/test/tiles/grid/item-tile.test.js +312 -312
  264. package/dist/test/tiles/grid/search-tile.test.d.ts +1 -1
  265. package/dist/test/tiles/grid/search-tile.test.js +51 -51
  266. package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
  267. package/dist/test/tiles/hover/hover-pane-controller.test.js +259 -259
  268. package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
  269. package/dist/test/tiles/hover/tile-hover-pane.test.js +56 -13
  270. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
  271. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  272. package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
  273. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  274. package/dist/test/tiles/list/tile-list.test.js +297 -297
  275. package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
  276. package/dist/test/tiles/tile-dispatcher.test.js +100 -100
  277. package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
  278. package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
  279. package/dist/test/utils/array-equals.test.d.ts +1 -1
  280. package/dist/test/utils/array-equals.test.js +26 -26
  281. package/dist/test/utils/format-count.test.d.ts +1 -1
  282. package/dist/test/utils/format-count.test.js +23 -23
  283. package/dist/test/utils/format-date.test.d.ts +1 -1
  284. package/dist/test/utils/format-date.test.js +17 -17
  285. package/dist/test/utils/format-unit-size.test.d.ts +1 -1
  286. package/dist/test/utils/format-unit-size.test.js +17 -17
  287. package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
  288. package/dist/test/utils/local-date-from-utc.test.js +26 -26
  289. package/local.archive.org.cert +86 -86
  290. package/local.archive.org.key +27 -27
  291. package/package.json +1 -1
  292. package/renovate.json +6 -6
  293. package/src/tiles/hover/hover-pane-controller.ts +2 -0
  294. package/src/tiles/hover/tile-hover-pane.ts +100 -11
  295. package/src/tiles/image-block.ts +1 -1
  296. package/test/tiles/hover/tile-hover-pane.test.ts +61 -0
  297. package/tsconfig.json +21 -21
  298. package/web-dev-server.config.mjs +30 -30
  299. package/web-test-runner.config.mjs +41 -41
@@ -1,364 +1,364 @@
1
- import { __decorate } from "tslib";
2
- /* eslint-disable import/no-duplicates */
3
- import { html, css, LitElement, nothing, } from 'lit';
4
- import { customElement, property, query, state } from 'lit/decorators.js';
5
- import { classMap } from 'lit/directives/class-map.js';
6
- import { msg } from '@lit/localize';
7
- import { SearchType, } from '@internetarchive/search-service';
8
- import '@internetarchive/infinite-scroller';
9
- import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, } from './models';
10
- import { RestorationStateHandler, } from './restoration-state-handler';
11
- import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
12
- import { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
13
- import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
14
- import chevronIcon from './assets/img/icons/chevron';
15
- import { srOnlyStyle } from './styles/sr-only';
16
- import { sha1 } from './utils/sha1';
17
- import { formatDate } from './utils/format-date';
18
- import { log } from './utils/log';
19
- import './empty-placeholder';
20
- import './tiles/tile-dispatcher';
21
- import './tiles/collection-browser-loading-tile';
22
- import './sort-filter-bar/sort-filter-bar';
23
- import './manage/manage-bar';
24
- import './collection-facets';
25
- import './circular-activity-indicator';
26
- let CollectionBrowser = class CollectionBrowser extends LitElement {
27
- constructor() {
28
- super();
29
- this.baseImageUrl = 'https://archive.org';
30
- /**
31
- * Which backend should be targeted by searches (e.g., metadata or FTS)
32
- */
33
- this.searchType = SearchType.METADATA;
34
- this.defaultSortParam = null;
35
- this.selectedSort = SortField.default;
36
- this.selectedTitleFilter = null;
37
- this.selectedCreatorFilter = null;
38
- this.sortDirection = null;
39
- this.pageSize = 50;
40
- /**
41
- * Whether to show the date picker (above the facets)
42
- */
43
- this.showHistogramDatePicker = false;
44
- /**
45
- * Whether placeholder views should be suppressed. If true, searches that produce an
46
- * error or empty result set will simply show a blank results view instead of a placeholder.
47
- */
48
- this.suppressPlaceholders = false;
49
- /**
50
- * Whether the result count text should be suppressed.
51
- * If true, no "X Results" message will be shown.
52
- */
53
- this.suppressResultCount = false;
54
- /**
55
- * Whether the scrolling result view should be suppressed entirely.
56
- * If true, no infinite scroller (and thus no result tiles) will be rendered.
57
- */
58
- this.suppressResultTiles = false;
59
- /**
60
- * Whether to suppress persistence of the query to the URL.
61
- * If true, the `query` param will not be added to the URL or updated on query changes.
62
- */
63
- this.suppressURLQuery = false;
64
- /**
65
- * Whether to suppress display of the sort bar.
66
- * If true, the entire sort bar (incl. display modes) will be omitted from rendering.
67
- */
68
- this.suppressSortBar = false;
69
- /**
70
- * Whether to suppress showing the display mode options in the sort bar.
71
- * If true, those options will be omitted (though the rest of the sort bar may still render).
72
- */
73
- this.suppressDisplayModes = false;
74
- /**
75
- * What strategy to use for when/whether to load facet data for a search.
76
- *
77
- * Defaults to `eager`, always loading facets immediately alongside search results.
78
- *
79
- * To eliminate facets that are never seen, this can be reduced to `lazy-mobile`, which
80
- * will delay loading facets in the mobile view until the "Filters" accordion is opened.
81
- * Facets are still loaded eagerly when viewing the desktop layout.
82
- *
83
- * To further reduce facet requests for patrons who do not need to use them, this can be
84
- * again reduced to `opt-in`, which will also require desktop users to explicitly request
85
- * that they be loaded (in addition to the lazy mobile behavior described above).
86
- *
87
- * To entirely suppress facets from being loaded, this may be set to `off`.
88
- */
89
- this.facetLoadStrategy = 'eager';
90
- this.clearResultsOnEmptyQuery = false;
91
- this.collectionPagePath = '/details/';
92
- /** describes where this component is being used */
93
- this.searchContext = analyticsCategories.default;
94
- this.pageContext = 'search';
95
- this.restorationStateHandler = new RestorationStateHandler({
96
- context: this.pageContext,
97
- });
98
- this.mobileBreakpoint = 600;
99
- this.loggedIn = false;
100
- this.modalManager = undefined;
101
- /**
102
- * If item management UI active
103
- */
104
- this.isManageView = false;
105
- this.manageViewLabel = 'Select items to remove';
106
- /** Whether to replace the default sort options with a slot for customization (default: false) */
107
- this.enableSortOptionsSlot = false;
108
- /**
109
- * The results per page so we can paginate.
110
- *
111
- * This allows us to start in the middle of the search results and
112
- * fetch data before or after the current page. If we don't have a key
113
- * for the previous/next page, we'll fetch the next/previous page to populate it
114
- */
115
- this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
116
- /**
117
- * The page that the consumer wants to load.
118
- */
119
- this.initialPageNumber = 1;
120
- /**
121
- * This the the number of pages that we want to show.
122
- *
123
- * The data isn't necessarily loaded for all of the pages, but this lets us
124
- * know how many cells we should render.
125
- */
126
- this.pagesToRender = this.initialPageNumber;
127
- /**
128
- * Whether the initial page fetch for a new query is currently in progress.
129
- */
130
- this.searchResultsLoading = false;
131
- this.facetsLoading = false;
132
- this.mobileView = false;
133
- this.collapsibleFacetsVisible = false;
134
- this.defaultSortField = SortField.relevance;
135
- this.defaultSortDirection = null;
136
- this.placeholderType = null;
137
- /** Whether layout size analytics have been sent already. */
138
- this.layoutSizeAnalyticsSent = false;
139
- /**
140
- * When we're animated scrolling to the page, we don't want to fetch
141
- * all of the pages as it scrolls so this lets us know if we're scrolling
142
- */
143
- this.isScrollingToCell = false;
144
- /**
145
- * When page width resizes from desktop to mobile, set true to
146
- * disable expand/collapse transition when loading.
147
- */
148
- this.isResizeToMobile = false;
149
- /**
150
- * Flag indicating that a new data source is currently being installed.
151
- * During the install, any URL persistence operation should replace the current entry
152
- * instead of creating a new one.
153
- */
154
- this.dataSourceInstallInProgress = false;
155
- this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
156
- /**
157
- * How many tiles to offset the data source by, to account for any removed tiles.
158
- */
159
- this.tileModelOffset = 0;
160
- /**
161
- * Updates the height of the left column according to its position on the page.
162
- * Arrow function ensures proper `this` binding.
163
- */
164
- this.updateLeftColumnHeight = () => {
165
- var _a, _b, _c, _d, _e;
166
- if (this.mobileView) {
167
- (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
168
- }
169
- else {
170
- const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
171
- (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', `${window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0) - 3}px`);
172
- }
173
- };
174
- /**
175
- * Toggles whether the fade-out is visible at the bottom of the facets.
176
- * It should only be visible if the facets are not scrolled to the bottom.
177
- * Arrow function ensures proper `this` binding.
178
- */
179
- this.updateFacetFadeOut = (entries) => {
180
- var _a, _b;
181
- const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
182
- 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);
183
- };
184
- // we only want to scroll on the very first query change
185
- // so this keeps track of whether we've already set the initial query
186
- this.initialQueryChangeHappened = false;
187
- this.historyPopOccurred = false;
188
- this.addController(this.dataSource);
189
- }
190
- tileModelAtCellIndex(index) {
191
- const model = this.dataSource.getTileModelAt(index);
192
- /**
193
- * If we encounter a model we don't have yet and we're not in the middle of an
194
- * automated scroll, fetch the page and just return undefined.
195
- * The datasource will be updated once the page is loaded and the cell will be rendered.
196
- *
197
- * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
198
- * user may never see.
199
- */
200
- if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
201
- const pageNumber = Math.floor(index / this.pageSize) + 1;
202
- this.dataSource.fetchPage(pageNumber);
203
- }
204
- return model;
205
- }
206
- // this is the total number of tiles we expect if
207
- // the data returned is a full page worth
208
- // this is useful for putting in placeholders for the expected number of tiles
209
- get estimatedTileCount() {
210
- return this.pagesToRender * this.pageSize;
211
- }
212
- /**
213
- * Returns a promise resolving to a unique string that persists for the current browser session.
214
- * Used in generating unique IDs for search requests, so that multiple requests coming from the
215
- * same browser session can be identified.
216
- */
217
- async getSessionId() {
218
- try {
219
- const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
220
- if (storedSessionId) {
221
- return storedSessionId;
222
- }
223
- // If we enter this method a second time while a first session ID is already being generated,
224
- // ensure we produce the same ID from both calls instead of generating another one.
225
- if (this.sessionIdGenPromise) {
226
- return this.sessionIdGenPromise;
227
- }
228
- this.sessionIdGenPromise = sha1(Math.random().toString());
229
- const newSessionId = await this.sessionIdGenPromise;
230
- sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
231
- return newSessionId;
232
- }
233
- catch (err) {
234
- // Either we can't generate the hash or we're restricted from accessing sessionStorage
235
- return '';
236
- }
237
- }
238
- /**
239
- * Go to the given page of results
240
- *
241
- * @param pageNumber
242
- */
243
- goToPage(pageNumber) {
244
- this.initialPageNumber = pageNumber;
245
- this.pagesToRender = pageNumber;
246
- return this.scrollToPage(pageNumber);
247
- }
248
- /**
249
- * Sets the state for whether the initial set of search results is loading in.
250
- */
251
- setSearchResultsLoading(loading) {
252
- this.searchResultsLoading = loading;
253
- }
254
- /**
255
- * Sets the state for whether facet data is loading in
256
- */
257
- setFacetsLoading(loading) {
258
- this.facetsLoading = loading;
259
- }
260
- /**
261
- * Sets the total number of results to be displayed for the current search
262
- */
263
- setTotalResultCount(totalResults) {
264
- this.totalResults = totalResults;
265
- }
266
- /**
267
- * Clears all selected/negated facets, date ranges, and letter filters.
268
- *
269
- * By default, the current sort field/direction are not cleared,
270
- * but this can be overridden by setting the `sort` option to `true`.
271
- *
272
- * Similarly, it is possible to finely control what is cleared by
273
- * setting any of the `facets`, `dateRange`, or `letterFilters` flags
274
- * in the options object.
275
- */
276
- clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
277
- // Don't bother clearing facets if none are checked, so that we don't
278
- // trigger unnecessary update cycles.
279
- if (facets && this.hasCheckedFacets) {
280
- this.selectedFacets = getDefaultSelectedFacets();
281
- }
282
- if (dateRange) {
283
- this.minSelectedDate = undefined;
284
- this.maxSelectedDate = undefined;
285
- }
286
- if (letterFilters) {
287
- this.selectedTitleFilter = null;
288
- this.selectedCreatorFilter = null;
289
- }
290
- if (sort) {
291
- this.sortDirection = null;
292
- this.selectedSort = SortField.default;
293
- }
294
- }
295
- /**
296
- * Returns true if the current value of `this.selectedFacets` contains
297
- * any facet buckets than have been selected or negated, or false otherwise.
298
- */
299
- get hasCheckedFacets() {
300
- if (!this.selectedFacets)
301
- return false;
302
- for (const facetGroup of Object.values(this.selectedFacets)) {
303
- for (const bucket of Object.values(facetGroup)) {
304
- if (bucket.state !== 'none')
305
- return true;
306
- }
307
- }
308
- return false;
309
- }
310
- /**
311
- * Returns true if there are any currently selected/negated facet buckets,
312
- * any selected date range, or any selected letter filters. False otherwise.
313
- *
314
- * Ignores sorting options.
315
- */
316
- get hasActiveFilters() {
317
- return !!(this.hasCheckedFacets ||
318
- this.minSelectedDate ||
319
- this.maxSelectedDate ||
320
- this.selectedTitleFilter ||
321
- this.selectedCreatorFilter);
322
- }
323
- render() {
324
- this.setPlaceholderType();
1
+ import { __decorate } from "tslib";
2
+ /* eslint-disable import/no-duplicates */
3
+ import { html, css, LitElement, nothing, } from 'lit';
4
+ import { customElement, property, query, state } from 'lit/decorators.js';
5
+ import { classMap } from 'lit/directives/class-map.js';
6
+ import { msg } from '@lit/localize';
7
+ import { SearchType, } from '@internetarchive/search-service';
8
+ import '@internetarchive/infinite-scroller';
9
+ import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, } from './models';
10
+ import { RestorationStateHandler, } from './restoration-state-handler';
11
+ import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
12
+ import { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
13
+ import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
14
+ import chevronIcon from './assets/img/icons/chevron';
15
+ import { srOnlyStyle } from './styles/sr-only';
16
+ import { sha1 } from './utils/sha1';
17
+ import { formatDate } from './utils/format-date';
18
+ import { log } from './utils/log';
19
+ import './empty-placeholder';
20
+ import './tiles/tile-dispatcher';
21
+ import './tiles/collection-browser-loading-tile';
22
+ import './sort-filter-bar/sort-filter-bar';
23
+ import './manage/manage-bar';
24
+ import './collection-facets';
25
+ import './circular-activity-indicator';
26
+ let CollectionBrowser = class CollectionBrowser extends LitElement {
27
+ constructor() {
28
+ super();
29
+ this.baseImageUrl = 'https://archive.org';
30
+ /**
31
+ * Which backend should be targeted by searches (e.g., metadata or FTS)
32
+ */
33
+ this.searchType = SearchType.METADATA;
34
+ this.defaultSortParam = null;
35
+ this.selectedSort = SortField.default;
36
+ this.selectedTitleFilter = null;
37
+ this.selectedCreatorFilter = null;
38
+ this.sortDirection = null;
39
+ this.pageSize = 50;
40
+ /**
41
+ * Whether to show the date picker (above the facets)
42
+ */
43
+ this.showHistogramDatePicker = false;
44
+ /**
45
+ * Whether placeholder views should be suppressed. If true, searches that produce an
46
+ * error or empty result set will simply show a blank results view instead of a placeholder.
47
+ */
48
+ this.suppressPlaceholders = false;
49
+ /**
50
+ * Whether the result count text should be suppressed.
51
+ * If true, no "X Results" message will be shown.
52
+ */
53
+ this.suppressResultCount = false;
54
+ /**
55
+ * Whether the scrolling result view should be suppressed entirely.
56
+ * If true, no infinite scroller (and thus no result tiles) will be rendered.
57
+ */
58
+ this.suppressResultTiles = false;
59
+ /**
60
+ * Whether to suppress persistence of the query to the URL.
61
+ * If true, the `query` param will not be added to the URL or updated on query changes.
62
+ */
63
+ this.suppressURLQuery = false;
64
+ /**
65
+ * Whether to suppress display of the sort bar.
66
+ * If true, the entire sort bar (incl. display modes) will be omitted from rendering.
67
+ */
68
+ this.suppressSortBar = false;
69
+ /**
70
+ * Whether to suppress showing the display mode options in the sort bar.
71
+ * If true, those options will be omitted (though the rest of the sort bar may still render).
72
+ */
73
+ this.suppressDisplayModes = false;
74
+ /**
75
+ * What strategy to use for when/whether to load facet data for a search.
76
+ *
77
+ * Defaults to `eager`, always loading facets immediately alongside search results.
78
+ *
79
+ * To eliminate facets that are never seen, this can be reduced to `lazy-mobile`, which
80
+ * will delay loading facets in the mobile view until the "Filters" accordion is opened.
81
+ * Facets are still loaded eagerly when viewing the desktop layout.
82
+ *
83
+ * To further reduce facet requests for patrons who do not need to use them, this can be
84
+ * again reduced to `opt-in`, which will also require desktop users to explicitly request
85
+ * that they be loaded (in addition to the lazy mobile behavior described above).
86
+ *
87
+ * To entirely suppress facets from being loaded, this may be set to `off`.
88
+ */
89
+ this.facetLoadStrategy = 'eager';
90
+ this.clearResultsOnEmptyQuery = false;
91
+ this.collectionPagePath = '/details/';
92
+ /** describes where this component is being used */
93
+ this.searchContext = analyticsCategories.default;
94
+ this.pageContext = 'search';
95
+ this.restorationStateHandler = new RestorationStateHandler({
96
+ context: this.pageContext,
97
+ });
98
+ this.mobileBreakpoint = 600;
99
+ this.loggedIn = false;
100
+ this.modalManager = undefined;
101
+ /**
102
+ * If item management UI active
103
+ */
104
+ this.isManageView = false;
105
+ this.manageViewLabel = 'Select items to remove';
106
+ /** Whether to replace the default sort options with a slot for customization (default: false) */
107
+ this.enableSortOptionsSlot = false;
108
+ /**
109
+ * The results per page so we can paginate.
110
+ *
111
+ * This allows us to start in the middle of the search results and
112
+ * fetch data before or after the current page. If we don't have a key
113
+ * for the previous/next page, we'll fetch the next/previous page to populate it
114
+ */
115
+ this.dataSource = new CollectionBrowserDataSource(this, this.pageSize);
116
+ /**
117
+ * The page that the consumer wants to load.
118
+ */
119
+ this.initialPageNumber = 1;
120
+ /**
121
+ * This the the number of pages that we want to show.
122
+ *
123
+ * The data isn't necessarily loaded for all of the pages, but this lets us
124
+ * know how many cells we should render.
125
+ */
126
+ this.pagesToRender = this.initialPageNumber;
127
+ /**
128
+ * Whether the initial page fetch for a new query is currently in progress.
129
+ */
130
+ this.searchResultsLoading = false;
131
+ this.facetsLoading = false;
132
+ this.mobileView = false;
133
+ this.collapsibleFacetsVisible = false;
134
+ this.defaultSortField = SortField.relevance;
135
+ this.defaultSortDirection = null;
136
+ this.placeholderType = null;
137
+ /** Whether layout size analytics have been sent already. */
138
+ this.layoutSizeAnalyticsSent = false;
139
+ /**
140
+ * When we're animated scrolling to the page, we don't want to fetch
141
+ * all of the pages as it scrolls so this lets us know if we're scrolling
142
+ */
143
+ this.isScrollingToCell = false;
144
+ /**
145
+ * When page width resizes from desktop to mobile, set true to
146
+ * disable expand/collapse transition when loading.
147
+ */
148
+ this.isResizeToMobile = false;
149
+ /**
150
+ * Flag indicating that a new data source is currently being installed.
151
+ * During the install, any URL persistence operation should replace the current entry
152
+ * instead of creating a new one.
153
+ */
154
+ this.dataSourceInstallInProgress = false;
155
+ this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
156
+ /**
157
+ * How many tiles to offset the data source by, to account for any removed tiles.
158
+ */
159
+ this.tileModelOffset = 0;
160
+ /**
161
+ * Updates the height of the left column according to its position on the page.
162
+ * Arrow function ensures proper `this` binding.
163
+ */
164
+ this.updateLeftColumnHeight = () => {
165
+ var _a, _b, _c, _d, _e;
166
+ if (this.mobileView) {
167
+ (_b = (_a = this.leftColumn) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.removeProperty('height');
168
+ }
169
+ else {
170
+ const clientTop = (_c = this.leftColumn) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect().top;
171
+ (_e = (_d = this.leftColumn) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.setProperty('height', `${window.innerHeight - (clientTop !== null && clientTop !== void 0 ? clientTop : 0) - 3}px`);
172
+ }
173
+ };
174
+ /**
175
+ * Toggles whether the fade-out is visible at the bottom of the facets.
176
+ * It should only be visible if the facets are not scrolled to the bottom.
177
+ * Arrow function ensures proper `this` binding.
178
+ */
179
+ this.updateFacetFadeOut = (entries) => {
180
+ var _a, _b;
181
+ const fadeElmt = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('facets-bottom-fade');
182
+ 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);
183
+ };
184
+ // we only want to scroll on the very first query change
185
+ // so this keeps track of whether we've already set the initial query
186
+ this.initialQueryChangeHappened = false;
187
+ this.historyPopOccurred = false;
188
+ this.addController(this.dataSource);
189
+ }
190
+ tileModelAtCellIndex(index) {
191
+ const model = this.dataSource.getTileModelAt(index);
192
+ /**
193
+ * If we encounter a model we don't have yet and we're not in the middle of an
194
+ * automated scroll, fetch the page and just return undefined.
195
+ * The datasource will be updated once the page is loaded and the cell will be rendered.
196
+ *
197
+ * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the
198
+ * user may never see.
199
+ */
200
+ if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {
201
+ const pageNumber = Math.floor(index / this.pageSize) + 1;
202
+ this.dataSource.fetchPage(pageNumber);
203
+ }
204
+ return model;
205
+ }
206
+ // this is the total number of tiles we expect if
207
+ // the data returned is a full page worth
208
+ // this is useful for putting in placeholders for the expected number of tiles
209
+ get estimatedTileCount() {
210
+ return this.pagesToRender * this.pageSize;
211
+ }
212
+ /**
213
+ * Returns a promise resolving to a unique string that persists for the current browser session.
214
+ * Used in generating unique IDs for search requests, so that multiple requests coming from the
215
+ * same browser session can be identified.
216
+ */
217
+ async getSessionId() {
218
+ try {
219
+ const storedSessionId = sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.getItem('cb-session');
220
+ if (storedSessionId) {
221
+ return storedSessionId;
222
+ }
223
+ // If we enter this method a second time while a first session ID is already being generated,
224
+ // ensure we produce the same ID from both calls instead of generating another one.
225
+ if (this.sessionIdGenPromise) {
226
+ return this.sessionIdGenPromise;
227
+ }
228
+ this.sessionIdGenPromise = sha1(Math.random().toString());
229
+ const newSessionId = await this.sessionIdGenPromise;
230
+ sessionStorage === null || sessionStorage === void 0 ? void 0 : sessionStorage.setItem('cb-session', newSessionId);
231
+ return newSessionId;
232
+ }
233
+ catch (err) {
234
+ // Either we can't generate the hash or we're restricted from accessing sessionStorage
235
+ return '';
236
+ }
237
+ }
238
+ /**
239
+ * Go to the given page of results
240
+ *
241
+ * @param pageNumber
242
+ */
243
+ goToPage(pageNumber) {
244
+ this.initialPageNumber = pageNumber;
245
+ this.pagesToRender = pageNumber;
246
+ return this.scrollToPage(pageNumber);
247
+ }
248
+ /**
249
+ * Sets the state for whether the initial set of search results is loading in.
250
+ */
251
+ setSearchResultsLoading(loading) {
252
+ this.searchResultsLoading = loading;
253
+ }
254
+ /**
255
+ * Sets the state for whether facet data is loading in
256
+ */
257
+ setFacetsLoading(loading) {
258
+ this.facetsLoading = loading;
259
+ }
260
+ /**
261
+ * Sets the total number of results to be displayed for the current search
262
+ */
263
+ setTotalResultCount(totalResults) {
264
+ this.totalResults = totalResults;
265
+ }
266
+ /**
267
+ * Clears all selected/negated facets, date ranges, and letter filters.
268
+ *
269
+ * By default, the current sort field/direction are not cleared,
270
+ * but this can be overridden by setting the `sort` option to `true`.
271
+ *
272
+ * Similarly, it is possible to finely control what is cleared by
273
+ * setting any of the `facets`, `dateRange`, or `letterFilters` flags
274
+ * in the options object.
275
+ */
276
+ clearFilters({ facets = true, dateRange = true, letterFilters = true, sort = false, } = {}) {
277
+ // Don't bother clearing facets if none are checked, so that we don't
278
+ // trigger unnecessary update cycles.
279
+ if (facets && this.hasCheckedFacets) {
280
+ this.selectedFacets = getDefaultSelectedFacets();
281
+ }
282
+ if (dateRange) {
283
+ this.minSelectedDate = undefined;
284
+ this.maxSelectedDate = undefined;
285
+ }
286
+ if (letterFilters) {
287
+ this.selectedTitleFilter = null;
288
+ this.selectedCreatorFilter = null;
289
+ }
290
+ if (sort) {
291
+ this.sortDirection = null;
292
+ this.selectedSort = SortField.default;
293
+ }
294
+ }
295
+ /**
296
+ * Returns true if the current value of `this.selectedFacets` contains
297
+ * any facet buckets than have been selected or negated, or false otherwise.
298
+ */
299
+ get hasCheckedFacets() {
300
+ if (!this.selectedFacets)
301
+ return false;
302
+ for (const facetGroup of Object.values(this.selectedFacets)) {
303
+ for (const bucket of Object.values(facetGroup)) {
304
+ if (bucket.state !== 'none')
305
+ return true;
306
+ }
307
+ }
308
+ return false;
309
+ }
310
+ /**
311
+ * Returns true if there are any currently selected/negated facet buckets,
312
+ * any selected date range, or any selected letter filters. False otherwise.
313
+ *
314
+ * Ignores sorting options.
315
+ */
316
+ get hasActiveFilters() {
317
+ return !!(this.hasCheckedFacets ||
318
+ this.minSelectedDate ||
319
+ this.maxSelectedDate ||
320
+ this.selectedTitleFilter ||
321
+ this.selectedCreatorFilter);
322
+ }
323
+ render() {
324
+ this.setPlaceholderType();
325
325
  return html `
326
326
  <div
327
327
  id="content-container"
328
328
  class=${this.mobileView ? 'mobile' : 'desktop'}
329
329
  >
330
- ${this.placeholderType
331
- ? this.emptyPlaceholderTemplate
330
+ ${this.placeholderType
331
+ ? this.emptyPlaceholderTemplate
332
332
  : this.collectionBrowserTemplate}
333
333
  </div>
334
- `;
335
- }
336
- setPlaceholderType() {
337
- var _a;
338
- const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
339
- const isCollection = !!this.withinCollection;
340
- const isProfile = !!this.withinProfile;
341
- const noResults = !this.searchResultsLoading &&
342
- (this.dataSource.size === 0 || !this.searchService);
343
- this.placeholderType = null;
344
- if (this.suppressPlaceholders)
345
- return;
346
- if (!hasQuery && !isCollection && !isProfile) {
347
- this.placeholderType = 'empty-query';
348
- }
349
- else if (noResults) {
350
- // Within a collection, no query + no results means the collection simply has no viewable items.
351
- // Otherwise, we must have a user query that produced 0 results.
352
- this.placeholderType =
353
- !hasQuery && isCollection ? 'empty-collection' : 'no-results';
354
- }
355
- if (this.dataSource.queryErrorMessage) {
356
- this.placeholderType =
357
- !hasQuery && isCollection ? 'collection-error' : 'query-error';
358
- }
359
- }
360
- get emptyPlaceholderTemplate() {
361
- var _a;
334
+ `;
335
+ }
336
+ setPlaceholderType() {
337
+ var _a;
338
+ const hasQuery = !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
339
+ const isCollection = !!this.withinCollection;
340
+ const isProfile = !!this.withinProfile;
341
+ const noResults = !this.searchResultsLoading &&
342
+ (this.dataSource.size === 0 || !this.searchService);
343
+ this.placeholderType = null;
344
+ if (this.suppressPlaceholders)
345
+ return;
346
+ if (!hasQuery && !isCollection && !isProfile) {
347
+ this.placeholderType = 'empty-query';
348
+ }
349
+ else if (noResults) {
350
+ // Within a collection, no query + no results means the collection simply has no viewable items.
351
+ // Otherwise, we must have a user query that produced 0 results.
352
+ this.placeholderType =
353
+ !hasQuery && isCollection ? 'empty-collection' : 'no-results';
354
+ }
355
+ if (this.dataSource.queryErrorMessage) {
356
+ this.placeholderType =
357
+ !hasQuery && isCollection ? 'collection-error' : 'query-error';
358
+ }
359
+ }
360
+ get emptyPlaceholderTemplate() {
361
+ var _a;
362
362
  return html `
363
363
  <empty-placeholder
364
364
  .placeholderType=${this.placeholderType}
@@ -367,33 +367,33 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
367
367
  .detailMessage=${(_a = this.dataSource.queryErrorMessage) !== null && _a !== void 0 ? _a : ''}
368
368
  .baseNavigationUrl=${this.baseNavigationUrl}
369
369
  ></empty-placeholder>
370
- `;
371
- }
372
- /**
373
- * Top-level template for rendering the left (facets) and right (results) columns.
374
- */
375
- get collectionBrowserTemplate() {
370
+ `;
371
+ }
372
+ /**
373
+ * Top-level template for rendering the left (facets) and right (results) columns.
374
+ */
375
+ get collectionBrowserTemplate() {
376
376
  return html `
377
377
  <div id="left-column-scroll-sentinel"></div>
378
378
  ${this.leftColumnTemplate} ${this.rightColumnTemplate}
379
- `;
380
- }
381
- /**
382
- * Template for either the mobile or desktop version of the left column, depending
383
- * on current component state.
384
- */
385
- get leftColumnTemplate() {
386
- if (this.mobileView) {
387
- return this.mobileLeftColumnTemplate;
388
- }
389
- return this.desktopLeftColumnTemplate;
390
- }
391
- /**
392
- * Template for the mobile version of the "left column" (which in this case, appears
393
- * *above* the search results rather than beside them), for rendering the
394
- * accordion-style facets.
395
- */
396
- get mobileLeftColumnTemplate() {
379
+ `;
380
+ }
381
+ /**
382
+ * Template for either the mobile or desktop version of the left column, depending
383
+ * on current component state.
384
+ */
385
+ get leftColumnTemplate() {
386
+ if (this.mobileView) {
387
+ return this.mobileLeftColumnTemplate;
388
+ }
389
+ return this.desktopLeftColumnTemplate;
390
+ }
391
+ /**
392
+ * Template for the mobile version of the "left column" (which in this case, appears
393
+ * *above* the search results rather than beside them), for rendering the
394
+ * accordion-style facets.
395
+ */
396
+ get mobileLeftColumnTemplate() {
397
397
  return html `
398
398
  <div
399
399
  id="left-column"
@@ -402,12 +402,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
402
402
  ${this.facetTopViewSlot} ${this.resultsCountTemplate}
403
403
  <div id="facets-header-container">${this.mobileFacetsTemplate}</div>
404
404
  </div>
405
- `;
406
- }
407
- /**
408
- * Template for the desktop version of the left column, displaying the facets sidebar.
409
- */
410
- get desktopLeftColumnTemplate() {
405
+ `;
406
+ }
407
+ /**
408
+ * Template for the desktop version of the left column, displaying the facets sidebar.
409
+ */
410
+ get desktopLeftColumnTemplate() {
411
411
  return html `
412
412
  <div id="left-column" class="column">
413
413
  ${this.facetTopViewSlot}
@@ -421,28 +421,28 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
421
421
  </div>
422
422
  <div id="facets-bottom-fade"></div>
423
423
  </div>
424
- `;
425
- }
426
- /**
427
- * Slot which is placed at top of the facets area for user-profile page
428
- * - mainly used to render userlists
429
- */
430
- get facetTopViewSlot() {
424
+ `;
425
+ }
426
+ /**
427
+ * Slot which is placed at top of the facets area for user-profile page
428
+ * - mainly used to render userlists
429
+ */
430
+ get facetTopViewSlot() {
431
431
  return html `<div id="facet-top-view">
432
432
  <slot name="facet-top-slot"></slot>
433
- </div>`;
434
- }
435
- /**
436
- * Template for the "X Results" count at the top of the search results.
437
- * Changes to the "Searching..." label if the search results are still loading.
438
- */
439
- get resultsCountTemplate() {
440
- var _a;
441
- if (this.suppressResultCount)
442
- return nothing;
443
- const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
444
- const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
445
- const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
433
+ </div>`;
434
+ }
435
+ /**
436
+ * Template for the "X Results" count at the top of the search results.
437
+ * Changes to the "Searching..." label if the search results are still loading.
438
+ */
439
+ get resultsCountTemplate() {
440
+ var _a;
441
+ if (this.suppressResultCount)
442
+ return nothing;
443
+ const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
444
+ const resultsCount = (_a = this.totalResults) === null || _a === void 0 ? void 0 : _a.toLocaleString();
445
+ const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
446
446
  return html `
447
447
  <div id="results-total">
448
448
  <span id="big-results-count">
@@ -452,30 +452,30 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
452
452
  ${shouldShowSearching ? nothing : resultsLabel}
453
453
  </span>
454
454
  </div>
455
- `;
456
- }
457
- /**
458
- * Template for the right column of the collection browser, where the result
459
- * tiles and sort/filter bar are shown.
460
- */
461
- get rightColumnTemplate() {
455
+ `;
456
+ }
457
+ /**
458
+ * Template for the right column of the collection browser, where the result
459
+ * tiles and sort/filter bar are shown.
460
+ */
461
+ get rightColumnTemplate() {
462
462
  return html `
463
463
  <div id="right-column" class="column">
464
464
  <div id="cb-top-view">
465
465
  <slot name="cb-top-slot"></slot>
466
466
  </div>
467
- ${this.isManageView
468
- ? this.manageBarTemplate
467
+ ${this.isManageView
468
+ ? this.manageBarTemplate
469
469
  : this.sortFilterBarTemplate}
470
470
  <slot name="cb-results"></slot>
471
- ${this.displayMode === `list-compact` && this.totalResults
472
- ? this.listHeaderTemplate
471
+ ${this.displayMode === `list-compact` && this.totalResults
472
+ ? this.listHeaderTemplate
473
473
  : nothing}
474
474
  ${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}
475
475
  </div>
476
- `;
477
- }
478
- get infiniteScrollerTemplate() {
476
+ `;
477
+ }
478
+ get infiniteScrollerTemplate() {
479
479
  return html `<infinite-scroller
480
480
  class=${this.infiniteScrollerClasses}
481
481
  itemCount=${this.placeholderType ? 0 : nothing}
@@ -484,22 +484,22 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
484
484
  .placeholderCellTemplate=${this.placeholderCellTemplate}
485
485
  @scrollThresholdReached=${this.scrollThresholdReached}
486
486
  @visibleCellsChanged=${this.visibleCellsChanged}
487
- >${this.displayMode === 'grid'
488
- ? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
487
+ >${this.displayMode === 'grid'
488
+ ? html `<slot name="result-last-tile" slot="result-last-tile"></slot>`
489
489
  : nothing}
490
- </infinite-scroller>`;
491
- }
492
- get infiniteScrollerClasses() {
493
- var _a;
494
- return classMap({
495
- [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
496
- hidden: !!this.placeholderType,
497
- });
498
- }
499
- get sortFilterBarTemplate() {
500
- var _a;
501
- if (this.suppressSortBar)
502
- return nothing;
490
+ </infinite-scroller>`;
491
+ }
492
+ get infiniteScrollerClasses() {
493
+ var _a;
494
+ return classMap({
495
+ [(_a = this.displayMode) !== null && _a !== void 0 ? _a : '']: !!this.displayMode,
496
+ hidden: !!this.placeholderType,
497
+ });
498
+ }
499
+ get sortFilterBarTemplate() {
500
+ var _a;
501
+ if (this.suppressSortBar)
502
+ return nothing;
503
503
  return html `
504
504
  <sort-filter-bar
505
505
  .defaultSortField=${this.defaultSortField}
@@ -524,9 +524,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
524
524
  <slot name="sort-options" slot="sort-options"></slot>
525
525
  <slot name="sort-options-right" slot="sort-options-right"></slot>
526
526
  </sort-filter-bar>
527
- `;
528
- }
529
- get manageBarTemplate() {
527
+ `;
528
+ }
529
+ get manageBarTemplate() {
530
530
  return html `
531
531
  <manage-bar
532
532
  .label=${this.manageViewLabel}
@@ -536,172 +536,172 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
536
536
  @removeItems=${this.handleRemoveItems}
537
537
  @selectAll=${() => this.dataSource.checkAllTiles()}
538
538
  @unselectAll=${() => this.dataSource.uncheckAllTiles()}
539
- @cancel=${() => {
540
- this.isManageView = false;
541
- this.dataSource.uncheckAllTiles();
539
+ @cancel=${() => {
540
+ this.isManageView = false;
541
+ this.dataSource.uncheckAllTiles();
542
542
  }}
543
543
  ></manage-bar>
544
- `;
545
- }
546
- /**
547
- * Handler for when the user requests to remove all checked items via the manage bar.
548
- * Emits an `itemRemovalRequested` event with all checked tile models.
549
- */
550
- handleRemoveItems() {
551
- this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
552
- detail: {
553
- items: this.dataSource.checkedTileModels.map(model => {
554
- const cloned = model.clone();
555
- cloned.dateStr = formatDate(model.datePublished, 'long');
556
- return cloned;
557
- }),
558
- },
559
- }));
560
- }
561
- /**
562
- * Removes all tile models that are currently checked & adjusts the paging
563
- * of the data source to account for any new gaps in the data.
564
- */
565
- removeCheckedTiles() {
566
- this.dataSource.removeCheckedTiles();
567
- }
568
- userChangedSort(e) {
569
- var _a;
570
- const { selectedSort, sortDirection } = e.detail;
571
- this.selectedSort = selectedSort;
572
- this.sortDirection = sortDirection;
573
- if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
574
- this.goToPage(1);
575
- }
576
- this.currentPage = 1;
577
- }
578
- sendSortByAnalytics(prevSortDirection) {
579
- var _a;
580
- const directionCleared = prevSortDirection && !this.sortDirection;
581
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
582
- category: this.searchContext,
583
- action: analyticsActions.sortBy,
584
- label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
585
- });
586
- }
587
- selectedSortChanged() {
588
- // Lazy-load the alphabet counts for title/creator sort bar as needed
589
- this.dataSource.updatePrefixFiltersForCurrentSort();
590
- }
591
- get sortParam() {
592
- var _a;
593
- const sortOption = SORT_OPTIONS[this.selectedSort];
594
- if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
595
- return null;
596
- }
597
- // If the sort option specified in the URL is unrecognized, we just use it as-is
598
- const urlSortParam = new URL(window.location.href).searchParams.get('sort');
599
- const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
600
- // If the sort direction is still null at this point, then we assume ascending
601
- // (i.e., it was unrecognized and had no directional flag)
602
- if (!this.sortDirection)
603
- this.sortDirection = 'asc';
604
- if (!sortField)
605
- return null;
606
- return { field: sortField, direction: this.sortDirection };
607
- }
608
- displayModeChanged(e) {
609
- var _a;
610
- this.displayMode = e.detail.displayMode;
611
- if (this.displayMode) {
612
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
613
- category: this.searchContext,
614
- action: analyticsActions.displayMode,
615
- label: this.displayMode,
616
- });
617
- }
618
- }
619
- /**
620
- * Returns a query clause identifying the currently selected title filter,
621
- * e.g., `firstTitle:X`.
622
- */
623
- get titleQuery() {
624
- return this.selectedTitleFilter
625
- ? `firstTitle:${this.selectedTitleFilter}`
626
- : undefined;
627
- }
628
- /**
629
- * Returns a query clause identifying the currently selected creator filter,
630
- * e.g., `firstCreator:X`.
631
- */
632
- get creatorQuery() {
633
- return this.selectedCreatorFilter
634
- ? `firstCreator:${this.selectedCreatorFilter}`
635
- : undefined;
636
- }
637
- /**
638
- * Send Analytics when sorting by title's first letter
639
- * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
640
- */
641
- sendFilterByTitleAnalytics(prevSelectedLetter) {
642
- var _a;
643
- if (!prevSelectedLetter && !this.selectedTitleFilter) {
644
- return;
645
- }
646
- const cleared = prevSelectedLetter && !this.selectedTitleFilter;
647
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
648
- category: this.searchContext,
649
- action: analyticsActions.filterByTitle,
650
- label: cleared
651
- ? `clear-${prevSelectedLetter}`
652
- : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
653
- });
654
- }
655
- /**
656
- * Send Analytics when filtering by creator's first letter
657
- * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
658
- */
659
- sendFilterByCreatorAnalytics(prevSelectedLetter) {
660
- var _a;
661
- if (!prevSelectedLetter && !this.selectedCreatorFilter) {
662
- return;
663
- }
664
- const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
665
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
666
- category: this.searchContext,
667
- action: analyticsActions.filterByCreator,
668
- label: cleared
669
- ? `clear-${prevSelectedLetter}`
670
- : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
671
- });
672
- }
673
- /**
674
- * Handler for changes to which letter is selected in the title alphabet bar.
675
- */
676
- titleLetterSelected(e) {
677
- this.selectedCreatorFilter = null;
678
- this.selectedTitleFilter = e.detail.selectedLetter;
679
- }
680
- /**
681
- * Handler for changes to which letter is selected in the creator alphabet bar.
682
- */
683
- creatorLetterSelected(e) {
684
- this.selectedTitleFilter = null;
685
- this.selectedCreatorFilter = e.detail.selectedLetter;
686
- }
687
- /**
688
- * The full template for how the facets should be structured in mobile view,
689
- * including the collapsible container (with header) and the facets themselves.
690
- */
691
- get mobileFacetsTemplate() {
692
- if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
693
- return nothing;
694
- const toggleFacetsVisible = (e) => {
695
- var _a;
696
- const target = e.target;
697
- this.isResizeToMobile = false;
698
- this.collapsibleFacetsVisible = target.open;
699
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
700
- category: this.searchContext,
701
- action: analyticsActions.mobileFacetsToggled,
702
- label: target.open ? 'open' : 'closed',
703
- });
704
- };
544
+ `;
545
+ }
546
+ /**
547
+ * Handler for when the user requests to remove all checked items via the manage bar.
548
+ * Emits an `itemRemovalRequested` event with all checked tile models.
549
+ */
550
+ handleRemoveItems() {
551
+ this.dispatchEvent(new CustomEvent('itemRemovalRequested', {
552
+ detail: {
553
+ items: this.dataSource.checkedTileModels.map(model => {
554
+ const cloned = model.clone();
555
+ cloned.dateStr = formatDate(model.datePublished, 'long');
556
+ return cloned;
557
+ }),
558
+ },
559
+ }));
560
+ }
561
+ /**
562
+ * Removes all tile models that are currently checked & adjusts the paging
563
+ * of the data source to account for any new gaps in the data.
564
+ */
565
+ removeCheckedTiles() {
566
+ this.dataSource.removeCheckedTiles();
567
+ }
568
+ userChangedSort(e) {
569
+ var _a;
570
+ const { selectedSort, sortDirection } = e.detail;
571
+ this.selectedSort = selectedSort;
572
+ this.sortDirection = sortDirection;
573
+ if (((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1) > 1) {
574
+ this.goToPage(1);
575
+ }
576
+ this.currentPage = 1;
577
+ }
578
+ sendSortByAnalytics(prevSortDirection) {
579
+ var _a;
580
+ const directionCleared = prevSortDirection && !this.sortDirection;
581
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
582
+ category: this.searchContext,
583
+ action: analyticsActions.sortBy,
584
+ label: `${this.selectedSort}${this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''}`,
585
+ });
586
+ }
587
+ selectedSortChanged() {
588
+ // Lazy-load the alphabet counts for title/creator sort bar as needed
589
+ this.dataSource.updatePrefixFiltersForCurrentSort();
590
+ }
591
+ get sortParam() {
592
+ var _a;
593
+ const sortOption = SORT_OPTIONS[this.selectedSort];
594
+ if (!(sortOption === null || sortOption === void 0 ? void 0 : sortOption.handledBySearchService)) {
595
+ return null;
596
+ }
597
+ // If the sort option specified in the URL is unrecognized, we just use it as-is
598
+ const urlSortParam = new URL(window.location.href).searchParams.get('sort');
599
+ const sortField = (_a = sortOption.searchServiceKey) !== null && _a !== void 0 ? _a : urlSortParam === null || urlSortParam === void 0 ? void 0 : urlSortParam.replace(/^-/, '');
600
+ // If the sort direction is still null at this point, then we assume ascending
601
+ // (i.e., it was unrecognized and had no directional flag)
602
+ if (!this.sortDirection)
603
+ this.sortDirection = 'asc';
604
+ if (!sortField)
605
+ return null;
606
+ return { field: sortField, direction: this.sortDirection };
607
+ }
608
+ displayModeChanged(e) {
609
+ var _a;
610
+ this.displayMode = e.detail.displayMode;
611
+ if (this.displayMode) {
612
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
613
+ category: this.searchContext,
614
+ action: analyticsActions.displayMode,
615
+ label: this.displayMode,
616
+ });
617
+ }
618
+ }
619
+ /**
620
+ * Returns a query clause identifying the currently selected title filter,
621
+ * e.g., `firstTitle:X`.
622
+ */
623
+ get titleQuery() {
624
+ return this.selectedTitleFilter
625
+ ? `firstTitle:${this.selectedTitleFilter}`
626
+ : undefined;
627
+ }
628
+ /**
629
+ * Returns a query clause identifying the currently selected creator filter,
630
+ * e.g., `firstCreator:X`.
631
+ */
632
+ get creatorQuery() {
633
+ return this.selectedCreatorFilter
634
+ ? `firstCreator:${this.selectedCreatorFilter}`
635
+ : undefined;
636
+ }
637
+ /**
638
+ * Send Analytics when sorting by title's first letter
639
+ * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
640
+ */
641
+ sendFilterByTitleAnalytics(prevSelectedLetter) {
642
+ var _a;
643
+ if (!prevSelectedLetter && !this.selectedTitleFilter) {
644
+ return;
645
+ }
646
+ const cleared = prevSelectedLetter && !this.selectedTitleFilter;
647
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
648
+ category: this.searchContext,
649
+ action: analyticsActions.filterByTitle,
650
+ label: cleared
651
+ ? `clear-${prevSelectedLetter}`
652
+ : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,
653
+ });
654
+ }
655
+ /**
656
+ * Send Analytics when filtering by creator's first letter
657
+ * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
658
+ */
659
+ sendFilterByCreatorAnalytics(prevSelectedLetter) {
660
+ var _a;
661
+ if (!prevSelectedLetter && !this.selectedCreatorFilter) {
662
+ return;
663
+ }
664
+ const cleared = prevSelectedLetter && !this.selectedCreatorFilter;
665
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
666
+ category: this.searchContext,
667
+ action: analyticsActions.filterByCreator,
668
+ label: cleared
669
+ ? `clear-${prevSelectedLetter}`
670
+ : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,
671
+ });
672
+ }
673
+ /**
674
+ * Handler for changes to which letter is selected in the title alphabet bar.
675
+ */
676
+ titleLetterSelected(e) {
677
+ this.selectedCreatorFilter = null;
678
+ this.selectedTitleFilter = e.detail.selectedLetter;
679
+ }
680
+ /**
681
+ * Handler for changes to which letter is selected in the creator alphabet bar.
682
+ */
683
+ creatorLetterSelected(e) {
684
+ this.selectedTitleFilter = null;
685
+ this.selectedCreatorFilter = e.detail.selectedLetter;
686
+ }
687
+ /**
688
+ * The full template for how the facets should be structured in mobile view,
689
+ * including the collapsible container (with header) and the facets themselves.
690
+ */
691
+ get mobileFacetsTemplate() {
692
+ if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
693
+ return nothing;
694
+ const toggleFacetsVisible = (e) => {
695
+ var _a;
696
+ const target = e.target;
697
+ this.isResizeToMobile = false;
698
+ this.collapsibleFacetsVisible = target.open;
699
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
700
+ category: this.searchContext,
701
+ action: analyticsActions.mobileFacetsToggled,
702
+ label: target.open ? 'open' : 'closed',
703
+ });
704
+ };
705
705
  return html `
706
706
  <details id="mobile-filter-collapse" @toggle=${toggleFacetsVisible}>
707
707
  <summary>
@@ -711,21 +711,21 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
711
711
  </summary>
712
712
  ${this.facetsTemplate}
713
713
  </details>
714
- `;
715
- }
716
- /**
717
- * The template for the facets component alone, without any surrounding wrappers.
718
- */
719
- get facetsTemplate() {
720
- if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
721
- return nothing;
722
- if (this.facetLoadStrategy === 'off') {
714
+ `;
715
+ }
716
+ /**
717
+ * The template for the facets component alone, without any surrounding wrappers.
718
+ */
719
+ get facetsTemplate() {
720
+ if (FACETLESS_PAGE_ELEMENTS.includes(this.profileElement))
721
+ return nothing;
722
+ if (this.facetLoadStrategy === 'off') {
723
723
  return html `
724
724
  <p class="facets-message">
725
725
  ${msg('Facets are temporarily unavailable.')}
726
726
  </p>
727
- `;
728
- }
727
+ `;
728
+ }
729
729
  const facets = html `
730
730
  <collection-facets
731
731
  @facetsChanged=${this.facetsChanged}
@@ -739,7 +739,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
739
739
  .resizeObserver=${this.resizeObserver}
740
740
  .searchType=${this.searchType}
741
741
  .aggregations=${this.dataSource.aggregations}
742
- .fullYearsHistogramAggregation=${this.dataSource
742
+ .fullYearsHistogramAggregation=${this.dataSource
743
743
  .yearHistogramAggregation}
744
744
  .minSelectedDate=${this.minSelectedDate}
745
745
  .maxSelectedDate=${this.maxSelectedDate}
@@ -760,16 +760,16 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
760
760
  .analyticsHandler=${this.analyticsHandler}
761
761
  >
762
762
  </collection-facets>
763
- `;
764
- // In the desktop facets opt-in case, wrap the facet sidebar in a <details> widget
765
- // that can be opened and closed as needed.
766
- if (this.facetLoadStrategy === 'opt-in' && !this.mobileView) {
763
+ `;
764
+ // In the desktop facets opt-in case, wrap the facet sidebar in a <details> widget
765
+ // that can be opened and closed as needed.
766
+ if (this.facetLoadStrategy === 'opt-in' && !this.mobileView) {
767
767
  return html `
768
768
  <details
769
769
  class="desktop-facets-dropdown"
770
- @toggle=${(e) => {
771
- const target = e.target;
772
- this.collapsibleFacetsVisible = target.open;
770
+ @toggle=${(e) => {
771
+ const target = e.target;
772
+ this.collapsibleFacetsVisible = target.open;
773
773
  }}
774
774
  >
775
775
  <summary>
@@ -778,44 +778,44 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
778
778
  </summary>
779
779
  ${facets}
780
780
  </button>
781
- `;
782
- }
783
- // Otherwise, just render the facets component bare
784
- return facets;
785
- }
786
- /**
787
- * The HTML template for the "Clear all filters" button, or `nothing` if no
788
- * filters are currently active.
789
- *
790
- * @param mobile Whether to style/shorten the button for mobile view
791
- */
792
- clearFiltersBtnTemplate(mobile) {
793
- if (!this.hasActiveFilters)
794
- return nothing;
795
- const buttonClasses = classMap({
796
- 'clear-filters-btn': true,
797
- mobile,
798
- });
799
- const buttonText = mobile ? 'Clear all' : 'Clear all filters';
781
+ `;
782
+ }
783
+ // Otherwise, just render the facets component bare
784
+ return facets;
785
+ }
786
+ /**
787
+ * The HTML template for the "Clear all filters" button, or `nothing` if no
788
+ * filters are currently active.
789
+ *
790
+ * @param mobile Whether to style/shorten the button for mobile view
791
+ */
792
+ clearFiltersBtnTemplate(mobile) {
793
+ if (!this.hasActiveFilters)
794
+ return nothing;
795
+ const buttonClasses = classMap({
796
+ 'clear-filters-btn': true,
797
+ mobile,
798
+ });
799
+ const buttonText = mobile ? 'Clear all' : 'Clear all filters';
800
800
  return html `
801
801
  <div class="clear-filters-btn-row">
802
- ${mobile
803
- ? html `<span class="clear-filters-btn-separator">&nbsp;</span>`
802
+ ${mobile
803
+ ? html `<span class="clear-filters-btn-separator">&nbsp;</span>`
804
804
  : nothing}
805
805
  <button class=${buttonClasses} @click=${this.clearFilters}>
806
806
  ${buttonText}
807
807
  </button>
808
808
  </div>
809
- `;
810
- }
811
- get loadingTemplate() {
809
+ `;
810
+ }
811
+ get loadingTemplate() {
812
812
  return html `
813
813
  <div class="loading-cover">
814
814
  <circular-activity-indicator></circular-activity-indicator>
815
815
  </div>
816
- `;
817
- }
818
- get listHeaderTemplate() {
816
+ `;
817
+ }
818
+ get listHeaderTemplate() {
819
819
  return html `
820
820
  <div id="list-header">
821
821
  <tile-dispatcher
@@ -828,641 +828,641 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
828
828
  >
829
829
  </tile-dispatcher>
830
830
  </div>
831
- `;
832
- }
833
- histogramDateRangeUpdated(e) {
834
- var _a;
835
- const { minDate, maxDate } = e.detail;
836
- [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
837
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
838
- category: this.searchContext,
839
- action: analyticsActions.histogramChanged,
840
- label: this.dateRangeQueryClause,
841
- });
842
- }
843
- get dateRangeQueryClause() {
844
- if (!this.minSelectedDate || !this.maxSelectedDate) {
845
- return undefined;
846
- }
847
- return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
848
- }
849
- /**
850
- * Emits an event indicating a change in whether the manage mode is shown.
851
- */
852
- emitManageModeChangedEvent() {
853
- this.dispatchEvent(new CustomEvent('manageModeChanged', {
854
- detail: this.isManageView,
855
- }));
856
- }
857
- async installDataSourceAndQueryState(dataSource, queryState) {
858
- var _a, _b;
859
- log('Installing data source & query state in CB:', dataSource, queryState);
860
- if (this.dataSource)
861
- this.removeController(this.dataSource);
862
- this.dataSource = dataSource;
863
- this.addController(this.dataSource);
864
- this.baseQuery = queryState.baseQuery;
865
- this.profileElement = queryState.profileElement;
866
- this.searchType = queryState.searchType;
867
- this.selectedFacets =
868
- (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
869
- this.minSelectedDate = queryState.minSelectedDate;
870
- this.maxSelectedDate = queryState.maxSelectedDate;
871
- this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
872
- this.sortDirection = queryState.sortDirection;
873
- this.selectedTitleFilter = queryState.selectedTitleFilter;
874
- this.selectedCreatorFilter = queryState.selectedCreatorFilter;
875
- // We set this flag during the update to prevent the URL state persistence
876
- // from creating an unwanted extra history entry.
877
- this.dataSourceInstallInProgress = true;
878
- this.requestUpdate();
879
- await this.updateComplete;
880
- this.dataSourceInstallInProgress = false;
881
- if (!this.searchResultsLoading) {
882
- this.setTotalResultCount(this.dataSource.totalResults);
883
- this.setTileCount(this.dataSource.size);
884
- }
885
- this.refreshVisibleResults();
886
- }
887
- firstUpdated() {
888
- this.restoreState();
889
- this.setInitialSize();
890
- }
891
- setInitialSize() {
892
- this.contentWidth = this.contentContainer.getBoundingClientRect().width;
893
- this.mobileView =
894
- this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
895
- this.sendLayoutSizeAnalytics();
896
- }
897
- sendLayoutSizeAnalytics() {
898
- if (this.analyticsHandler) {
899
- this.layoutSizeAnalyticsSent = true;
900
- this.analyticsHandler.sendEvent({
901
- category: this.searchContext,
902
- action: this.mobileView
903
- ? analyticsActions.loadMobileView
904
- : analyticsActions.loadDesktopView,
905
- });
906
- }
907
- }
908
- updated(changed) {
909
- var _a, _b;
910
- if (changed.has('placeholderType') && this.placeholderType === null) {
911
- if (!this.leftColIntersectionObserver) {
912
- this.setupLeftColumnScrollListeners();
913
- }
914
- if (!this.facetsIntersectionObserver) {
915
- this.setupFacetsScrollListeners();
916
- }
917
- this.updateLeftColumnHeight();
918
- }
919
- if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {
920
- this.sendLayoutSizeAnalytics();
921
- }
922
- if (changed.has('displayMode') ||
923
- changed.has('baseNavigationUrl') ||
924
- changed.has('baseImageUrl') ||
925
- changed.has('loggedIn')) {
926
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
927
- }
928
- if (changed.has('baseQuery') ||
929
- changed.has('searchType') ||
930
- changed.has('withinCollection')) {
931
- // Unless this query/search type update is from the initial page load or the
932
- // result of hitting the back button,
933
- // we need to clear any existing filters since they may no longer be valid for
934
- // the new set of search results.
935
- if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
936
- // Ordinarily, we leave the sort param unchanged between searches.
937
- // However, if we are changing the target collection itself, we want the sort cleared too,
938
- // since different collections may have different sorting options available.
939
- const shouldClearSort = changed.has('withinCollection') &&
940
- !changed.has('selectedSort') &&
941
- !changed.has('sortDirection');
942
- // Otherwise, only clear filters that haven't been simultaneously applied in this update
943
- this.clearFilters({
944
- sort: shouldClearSort,
945
- facets: !changed.has('selectedFacets'),
946
- dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
947
- letterFilters: !(changed.has('selectedTitleFilter') ||
948
- changed.has('selectedCreatorFilter')),
949
- });
950
- }
951
- }
952
- if (changed.has('profileElement')) {
953
- this.applyDefaultProfileSort();
954
- }
955
- if (changed.has('baseQuery')) {
956
- this.emitBaseQueryChanged();
957
- }
958
- if (changed.has('searchType')) {
959
- this.emitSearchTypeChanged();
960
- }
961
- if (changed.has('currentPage') || changed.has('displayMode')) {
962
- this.persistState();
963
- }
964
- if (changed.has('baseQuery') ||
965
- changed.has('minSelectedDate') ||
966
- changed.has('maxSelectedDate') ||
967
- changed.has('selectedFacets') ||
968
- changed.has('searchService') ||
969
- changed.has('withinCollection') ||
970
- changed.has('withinProfile') ||
971
- changed.has('profileElement')) {
972
- this.dataSource.refreshLetterCounts();
973
- }
974
- if (changed.has('selectedSort') || changed.has('sortDirection')) {
975
- const prevSortDirection = changed.get('sortDirection');
976
- this.sendSortByAnalytics(prevSortDirection);
977
- this.selectedSortChanged();
978
- }
979
- if (changed.has('selectedTitleFilter')) {
980
- this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
981
- }
982
- if (changed.has('selectedCreatorFilter')) {
983
- this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
984
- }
985
- this.updateFacetReadiness();
986
- if (changed.has('baseQuery') ||
987
- changed.has('searchType') ||
988
- changed.has('selectedTitleFilter') ||
989
- changed.has('selectedCreatorFilter') ||
990
- changed.has('minSelectedDate') ||
991
- changed.has('maxSelectedDate') ||
992
- changed.has('selectedSort') ||
993
- changed.has('sortDirection') ||
994
- changed.has('selectedFacets') ||
995
- changed.has('searchService') ||
996
- changed.has('withinCollection') ||
997
- changed.has('withinProfile') ||
998
- changed.has('profileElement')) {
999
- this.handleQueryChange();
1000
- }
1001
- if (changed.has('searchResultsLoading')) {
1002
- this.emitSearchResultsLoadingChanged();
1003
- }
1004
- if (changed.has('facetsLoading') &&
1005
- this.facetsLoading &&
1006
- this.collectionFacets) {
1007
- this.collectionFacets.moreLinksVisible =
1008
- this.searchType !== SearchType.FULLTEXT;
1009
- }
1010
- if (changed.has('pagesToRender')) {
1011
- if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
1012
- this.infiniteScroller.itemCount = this.estimatedTileCount;
1013
- }
1014
- }
1015
- if (changed.has('isManageView')) {
1016
- if (this.isManageView)
1017
- this.displayMode = 'grid';
1018
- (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
1019
- this.emitManageModeChangedEvent();
1020
- }
1021
- if (changed.has('resizeObserver')) {
1022
- const oldObserver = changed.get('resizeObserver');
1023
- if (oldObserver)
1024
- this.disconnectResizeObserver(oldObserver);
1025
- this.setupResizeObserver();
1026
- }
1027
- }
1028
- connectedCallback() {
1029
- var _a;
1030
- (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
1031
- this.setupStateRestorationObserver();
1032
- this.setupResizeObserver();
1033
- }
1034
- disconnectedCallback() {
1035
- var _a, _b;
1036
- if (this.resizeObserver) {
1037
- this.disconnectResizeObserver(this.resizeObserver);
1038
- }
1039
- if (this.boundNavigationHandler) {
1040
- window.removeEventListener('popstate', this.boundNavigationHandler);
1041
- }
1042
- (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
1043
- (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
1044
- window.removeEventListener('resize', this.updateLeftColumnHeight);
1045
- }
1046
- handleResize(entry) {
1047
- const previousView = this.mobileView;
1048
- if (entry.target === this.contentContainer) {
1049
- this.contentWidth = entry.contentRect.width;
1050
- this.mobileView =
1051
- this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
1052
- // If changing from desktop to mobile disable transition
1053
- if (this.mobileView && !previousView) {
1054
- this.isResizeToMobile = true;
1055
- }
1056
- }
1057
- // Ensure the facet sidebar remains sized correctly
1058
- this.updateLeftColumnHeight();
1059
- }
1060
- /**
1061
- * Updates the data source with the current state of facet readiness for loading,
1062
- * so that they will begin to load in at the appropriate time according to the
1063
- * current facet loading strategy.
1064
- */
1065
- updateFacetReadiness() {
1066
- // In desktop view, we are always ready to load facets *unless* we are
1067
- // using the `opt-in` strategy and the facets dropdown is not open.
1068
- const desktopFacetsReady = !this.mobileView &&
1069
- (this.facetLoadStrategy !== 'opt-in' || this.collapsibleFacetsVisible);
1070
- // In mobile view, facets are considered ready provided they are currently visible (their dropdown is opened).
1071
- const mobileFacetsReady = this.mobileView && this.collapsibleFacetsVisible;
1072
- this.dataSource.handleFacetReadinessChange(desktopFacetsReady || mobileFacetsReady);
1073
- }
1074
- /**
1075
- * Sets up listeners for events that may require updating the left column height.
1076
- */
1077
- setupLeftColumnScrollListeners() {
1078
- var _a;
1079
- // We observe intersections between the left column's scroll sentinel and
1080
- // the viewport, so that we can ensure the left column is always sized to
1081
- // match the _available_ viewport height. This should generally be more
1082
- // performant than listening to scroll events on the page or column.
1083
- const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
1084
- if (leftColumnSentinel) {
1085
- this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
1086
- threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%
1087
- });
1088
- this.leftColIntersectionObserver.observe(leftColumnSentinel);
1089
- }
1090
- // We also listen for window resize events, as they are not always captured
1091
- // by the resize observer and can affect the desired height of the left column.
1092
- window.addEventListener('resize', this.updateLeftColumnHeight);
1093
- }
1094
- /**
1095
- * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
1096
- * Note this uses a separate IntersectionObserver from the left column, because we
1097
- * don't need granular intersection thresholds for this.
1098
- */
1099
- setupFacetsScrollListeners() {
1100
- var _a;
1101
- const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
1102
- if (facetsSentinel) {
1103
- this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
1104
- this.facetsIntersectionObserver.observe(facetsSentinel);
1105
- }
1106
- }
1107
- emitBaseQueryChanged() {
1108
- this.dispatchEvent(new CustomEvent('baseQueryChanged', {
1109
- detail: {
1110
- baseQuery: this.baseQuery,
1111
- },
1112
- }));
1113
- }
1114
- emitSearchTypeChanged() {
1115
- this.dispatchEvent(new CustomEvent('searchTypeChanged', {
1116
- detail: this.searchType,
1117
- }));
1118
- }
1119
- emitQueryStateChanged() {
1120
- this.dispatchEvent(new CustomEvent('queryStateChanged', {
1121
- detail: {
1122
- baseQuery: this.baseQuery,
1123
- withinCollection: this.withinCollection,
1124
- withinProfile: this.withinProfile,
1125
- profileElement: this.profileElement,
1126
- searchType: this.searchType,
1127
- selectedFacets: this.selectedFacets,
1128
- minSelectedDate: this.minSelectedDate,
1129
- maxSelectedDate: this.maxSelectedDate,
1130
- selectedSort: this.selectedSort,
1131
- sortDirection: this.sortDirection,
1132
- selectedTitleFilter: this.selectedTitleFilter,
1133
- selectedCreatorFilter: this.selectedCreatorFilter,
1134
- },
1135
- }));
1136
- }
1137
- emitEmptyResults() {
1138
- this.dispatchEvent(new Event('emptyResults'));
1139
- }
1140
- disconnectResizeObserver(resizeObserver) {
1141
- resizeObserver.removeObserver({
1142
- target: this.contentContainer,
1143
- handler: this,
1144
- });
1145
- }
1146
- setupResizeObserver() {
1147
- if (!this.resizeObserver || !this.contentContainer)
1148
- return;
1149
- this.resizeObserver.addObserver({
1150
- target: this.contentContainer,
1151
- handler: this,
1152
- });
1153
- }
1154
- /**
1155
- * When the visible cells change from the infinite scroller, we want to emit
1156
- * which page is currently visible so the consumer can update its UI or the URL
1157
- *
1158
- * @param e
1159
- * @returns
1160
- */
1161
- visibleCellsChanged(e) {
1162
- if (this.isScrollingToCell)
1163
- return;
1164
- const { visibleCellIndices } = e.detail;
1165
- if (visibleCellIndices.length === 0)
1166
- return;
1167
- // For page determination, do not count more than a single page of visible cells,
1168
- // since otherwise patrons using very tall screens will be treated as one page
1169
- // further than they actually are.
1170
- const lastIndexWithinCurrentPage = Math.min(this.pageSize, visibleCellIndices.length) - 1;
1171
- const lastVisibleCellIndex = visibleCellIndices[lastIndexWithinCurrentPage];
1172
- const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
1173
- if (this.currentPage !== lastVisibleCellPage) {
1174
- this.currentPage = lastVisibleCellPage;
1175
- }
1176
- const event = new CustomEvent('visiblePageChanged', {
1177
- detail: {
1178
- pageNumber: lastVisibleCellPage,
1179
- },
1180
- });
1181
- this.dispatchEvent(event);
1182
- }
1183
- /**
1184
- * A Promise which, after each query change, resolves once the fetches for the initial
1185
- * search have completed. Waits for *both* the hits and aggregations fetches to finish.
1186
- *
1187
- * Ensure you await this component's `updateComplete` promise before awaiting this
1188
- * one, to ensure you do not await an obsolete promise from the previous update.
1189
- */
1190
- get initialSearchComplete() {
1191
- return this.dataSource.initialSearchComplete;
1192
- }
1193
- async handleQueryChange() {
1194
- var _a;
1195
- // only reset if the query has actually changed
1196
- if (!this.searchService ||
1197
- this.dataSource.pageFetchQueryKey === this.previousQueryKey)
1198
- return;
1199
- // If the new state prevents us from updating the search results, don't reset
1200
- if (!this.dataSource.canPerformSearch &&
1201
- !(this.clearResultsOnEmptyQuery && this.baseQuery === ''))
1202
- return;
1203
- this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1204
- // this.emitQueryStateChanged();
1205
- this.tileModelOffset = 0;
1206
- this.totalResults = undefined;
1207
- this.pagesToRender =
1208
- this.initialPageNumber === 1
1209
- ? 2 // First two pages are batched into one request when starting from page 1
1210
- : this.initialPageNumber;
1211
- // Reset the infinite scroller's item count, so that it
1212
- // shows tile placeholders until the new query's results load in
1213
- if (this.infiniteScroller) {
1214
- this.infiniteScroller.itemCount = this.estimatedTileCount;
1215
- this.infiniteScroller.reload();
1216
- }
1217
- if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1218
- this.defaultSortField = SortField.relevance;
1219
- this.defaultSortDirection = null;
1220
- }
1221
- if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
1222
- this.scrollToPage(this.initialPageNumber);
1223
- }
1224
- this.initialQueryChangeHappened = true;
1225
- // if the query changed as part of a window.history pop event, we don't want to
1226
- // persist the state because it overwrites the forward history
1227
- if (!this.historyPopOccurred) {
1228
- this.persistState();
1229
- }
1230
- this.historyPopOccurred = false;
1231
- // Fire the initial page and facets requests
1232
- // await this.dataSource.handleQueryChange();
1233
- }
1234
- setupStateRestorationObserver() {
1235
- if (!this.boundNavigationHandler) {
1236
- this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
1237
- }
1238
- // when the user navigates back, we want to update the UI to match the URL
1239
- window.addEventListener('popstate', this.boundNavigationHandler);
1240
- }
1241
- historyNavigationHandler() {
1242
- this.historyPopOccurred = true;
1243
- this.restoreState();
1244
- }
1245
- restoreState() {
1246
- var _a, _b, _c, _d, _e;
1247
- const restorationState = this.restorationStateHandler.getRestorationState();
1248
- this.displayMode = restorationState.displayMode;
1249
- if (restorationState.searchType != null)
1250
- this.searchType = restorationState.searchType;
1251
- this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1252
- this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1253
- this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1254
- this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1255
- this.selectedFacets = restorationState.selectedFacets;
1256
- if (!this.suppressURLQuery)
1257
- this.baseQuery = restorationState.baseQuery;
1258
- this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1259
- this.minSelectedDate = restorationState.minSelectedDate;
1260
- this.maxSelectedDate = restorationState.maxSelectedDate;
1261
- if (this.currentPage > 1) {
1262
- this.goToPage(this.currentPage);
1263
- }
1264
- }
1265
- persistState() {
1266
- var _a, _b, _c, _d;
1267
- const restorationState = {
1268
- displayMode: this.displayMode,
1269
- searchType: this.searchType,
1270
- selectedSort: this.selectedSort,
1271
- sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1272
- selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1273
- baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1274
- currentPage: this.currentPage,
1275
- titleQuery: this.titleQuery,
1276
- creatorQuery: this.creatorQuery,
1277
- minSelectedDate: this.minSelectedDate,
1278
- maxSelectedDate: this.maxSelectedDate,
1279
- selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1280
- selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1281
- };
1282
- this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
1283
- }
1284
- emitSearchResultsLoadingChanged() {
1285
- this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
1286
- detail: {
1287
- loading: this.searchResultsLoading,
1288
- },
1289
- }));
1290
- }
1291
- facetsChanged(e) {
1292
- this.selectedFacets = e.detail;
1293
- }
1294
- facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1295
- var _a;
1296
- let action;
1297
- if (negative) {
1298
- action =
1299
- bucket.state !== 'none'
1300
- ? analyticsActions.facetNegativeSelected
1301
- : analyticsActions.facetNegativeDeselected;
1302
- }
1303
- else {
1304
- action =
1305
- bucket.state !== 'none'
1306
- ? analyticsActions.facetSelected
1307
- : analyticsActions.facetDeselected;
1308
- }
1309
- (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1310
- category: this.searchContext,
1311
- action,
1312
- label: facetType,
1313
- });
1314
- }
1315
- scrollToPage(pageNumber) {
1316
- return new Promise(resolve => {
1317
- const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1318
- // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1319
- // then scrolls to the cell
1320
- setTimeout(() => {
1321
- var _a;
1322
- this.isScrollingToCell = true;
1323
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1324
- // This timeout is to give the scroll animation time to finish
1325
- // then updating the infinite scroller once we're done scrolling
1326
- // There's no scroll animation completion callback so we're
1327
- // giving it 0.5s to finish.
1328
- setTimeout(() => {
1329
- var _a;
1330
- this.isScrollingToCell = false;
1331
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1332
- resolve();
1333
- }, 500);
1334
- }, 0);
1335
- });
1336
- }
1337
- /**
1338
- * Whether sorting by relevance makes sense for the current state.
1339
- * Currently equivalent to having a non-empty query.
1340
- */
1341
- get isRelevanceSortAvailable() {
1342
- var _a;
1343
- return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1344
- }
1345
- /**
1346
- * Sets the total number of tiles displayed in the infinite scroller.
1347
- */
1348
- setTileCount(count) {
1349
- if (this.infiniteScroller) {
1350
- this.infiniteScroller.itemCount = count;
1351
- }
1352
- }
1353
- /**
1354
- * Applies any default sort option for the current collection, by checking
1355
- * for one in the collection's metadata. If none is found, defaults to sorting
1356
- * descending by:
1357
- * - Date Favorited for fav-* collections
1358
- * - Weekly views for all other collections
1359
- */
1360
- applyDefaultCollectionSort(collectionInfo) {
1361
- var _a, _b, _c;
1362
- if (this.baseQuery) {
1363
- // If there's a query set, then we default to relevance sorting regardless of
1364
- // the collection metadata-specified sort.
1365
- this.defaultSortField = SortField.relevance;
1366
- this.defaultSortDirection = null;
1367
- return;
1368
- }
1369
- // Favorite collections sort on Date Favorited by default.
1370
- // Other collections fall back to sorting on weekly views.
1371
- 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-'))
1372
- ? '-favoritedate'
1373
- : '-week';
1374
- // The collection metadata may override the default sorting with something else
1375
- const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1376
- // Prefer the metadata-specified sort if one exists
1377
- const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1378
- // Account for both -field and field:dir formats
1379
- let [field, dir] = defaultSortToApply.split(':');
1380
- if (field.startsWith('-')) {
1381
- field = field.slice(1);
1382
- dir = 'desc';
1383
- }
1384
- else if (!['asc', 'desc'].includes(dir)) {
1385
- dir = 'asc';
1386
- }
1387
- const sortOption = sortOptionFromAPIString(field);
1388
- const sortField = sortOption.field;
1389
- if (sortField && sortField !== SortField.default) {
1390
- this.defaultSortField = sortField;
1391
- this.defaultSortDirection = dir;
1392
- this.defaultSortParam = {
1393
- field: this.defaultSortField,
1394
- direction: this.defaultSortDirection,
1395
- };
1396
- }
1397
- }
1398
- /**
1399
- * Applies the default sort option for the current profile element
1400
- */
1401
- applyDefaultProfileSort() {
1402
- if (this.profileElement) {
1403
- const defaultSortField = defaultProfileElementSorts[this.profileElement];
1404
- this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1405
- }
1406
- else {
1407
- this.defaultSortField = SortField.weeklyview;
1408
- }
1409
- this.defaultSortDirection = 'desc';
1410
- this.defaultSortParam = {
1411
- field: this.defaultSortField,
1412
- direction: this.defaultSortDirection,
1413
- };
1414
- }
1415
- /**
1416
- * This is useful for determining whether we need to reload the scroller.
1417
- *
1418
- * When the fetch completes, we need to reload the scroller if the cells for that
1419
- * page are visible, but if the page is not currenlty visible, we don't need to reload
1420
- */
1421
- get currentVisiblePageNumbers() {
1422
- var _a, _b;
1423
- const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1424
- const visiblePages = new Set();
1425
- visibleCells.forEach(cellIndex => {
1426
- const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
1427
- visiblePages.add(visiblePage);
1428
- });
1429
- return Array.from(visiblePages);
1430
- }
1431
- /**
1432
- * Refreshes all visible result cells in the infinite scroller.
1433
- */
1434
- refreshVisibleResults() {
1435
- var _a;
1436
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1437
- }
1438
- /**
1439
- * Callback when a result is selected
1440
- */
1441
- resultSelected(event) {
1442
- var _a, _b, _c;
1443
- if (this.isManageView) {
1444
- // Checked/unchecked state change -- rerender to ensure it propagates
1445
- // this.mapDataSource(model => ({ ...model }));
1446
- const cellIndex = this.dataSource.indexOf(event.detail);
1447
- if (cellIndex >= 0)
1448
- (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1449
- this.requestUpdate();
1450
- }
1451
- (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1452
- category: this.searchContext,
1453
- action: analyticsActions.resultSelected,
1454
- label: event.detail.mediatype,
1455
- });
1456
- (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1457
- category: this.searchContext,
1458
- action: analyticsActions.resultSelected,
1459
- label: `page-${this.currentPage}`,
1460
- });
1461
- }
1462
- cellForIndex(index) {
1463
- const model = this.tileModelAtCellIndex(index);
1464
- if (!model)
1465
- return undefined;
831
+ `;
832
+ }
833
+ histogramDateRangeUpdated(e) {
834
+ var _a;
835
+ const { minDate, maxDate } = e.detail;
836
+ [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
837
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
838
+ category: this.searchContext,
839
+ action: analyticsActions.histogramChanged,
840
+ label: this.dateRangeQueryClause,
841
+ });
842
+ }
843
+ get dateRangeQueryClause() {
844
+ if (!this.minSelectedDate || !this.maxSelectedDate) {
845
+ return undefined;
846
+ }
847
+ return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;
848
+ }
849
+ /**
850
+ * Emits an event indicating a change in whether the manage mode is shown.
851
+ */
852
+ emitManageModeChangedEvent() {
853
+ this.dispatchEvent(new CustomEvent('manageModeChanged', {
854
+ detail: this.isManageView,
855
+ }));
856
+ }
857
+ async installDataSourceAndQueryState(dataSource, queryState) {
858
+ var _a, _b;
859
+ log('Installing data source & query state in CB:', dataSource, queryState);
860
+ if (this.dataSource)
861
+ this.removeController(this.dataSource);
862
+ this.dataSource = dataSource;
863
+ this.addController(this.dataSource);
864
+ this.baseQuery = queryState.baseQuery;
865
+ this.profileElement = queryState.profileElement;
866
+ this.searchType = queryState.searchType;
867
+ this.selectedFacets =
868
+ (_a = queryState.selectedFacets) !== null && _a !== void 0 ? _a : getDefaultSelectedFacets();
869
+ this.minSelectedDate = queryState.minSelectedDate;
870
+ this.maxSelectedDate = queryState.maxSelectedDate;
871
+ this.selectedSort = (_b = queryState.selectedSort) !== null && _b !== void 0 ? _b : SortField.default;
872
+ this.sortDirection = queryState.sortDirection;
873
+ this.selectedTitleFilter = queryState.selectedTitleFilter;
874
+ this.selectedCreatorFilter = queryState.selectedCreatorFilter;
875
+ // We set this flag during the update to prevent the URL state persistence
876
+ // from creating an unwanted extra history entry.
877
+ this.dataSourceInstallInProgress = true;
878
+ this.requestUpdate();
879
+ await this.updateComplete;
880
+ this.dataSourceInstallInProgress = false;
881
+ if (!this.searchResultsLoading) {
882
+ this.setTotalResultCount(this.dataSource.totalResults);
883
+ this.setTileCount(this.dataSource.size);
884
+ }
885
+ this.refreshVisibleResults();
886
+ }
887
+ firstUpdated() {
888
+ this.restoreState();
889
+ this.setInitialSize();
890
+ }
891
+ setInitialSize() {
892
+ this.contentWidth = this.contentContainer.getBoundingClientRect().width;
893
+ this.mobileView =
894
+ this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
895
+ this.sendLayoutSizeAnalytics();
896
+ }
897
+ sendLayoutSizeAnalytics() {
898
+ if (this.analyticsHandler) {
899
+ this.layoutSizeAnalyticsSent = true;
900
+ this.analyticsHandler.sendEvent({
901
+ category: this.searchContext,
902
+ action: this.mobileView
903
+ ? analyticsActions.loadMobileView
904
+ : analyticsActions.loadDesktopView,
905
+ });
906
+ }
907
+ }
908
+ updated(changed) {
909
+ var _a, _b;
910
+ if (changed.has('placeholderType') && this.placeholderType === null) {
911
+ if (!this.leftColIntersectionObserver) {
912
+ this.setupLeftColumnScrollListeners();
913
+ }
914
+ if (!this.facetsIntersectionObserver) {
915
+ this.setupFacetsScrollListeners();
916
+ }
917
+ this.updateLeftColumnHeight();
918
+ }
919
+ if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {
920
+ this.sendLayoutSizeAnalytics();
921
+ }
922
+ if (changed.has('displayMode') ||
923
+ changed.has('baseNavigationUrl') ||
924
+ changed.has('baseImageUrl') ||
925
+ changed.has('loggedIn')) {
926
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();
927
+ }
928
+ if (changed.has('baseQuery') ||
929
+ changed.has('searchType') ||
930
+ changed.has('withinCollection')) {
931
+ // Unless this query/search type update is from the initial page load or the
932
+ // result of hitting the back button,
933
+ // we need to clear any existing filters since they may no longer be valid for
934
+ // the new set of search results.
935
+ if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
936
+ // Ordinarily, we leave the sort param unchanged between searches.
937
+ // However, if we are changing the target collection itself, we want the sort cleared too,
938
+ // since different collections may have different sorting options available.
939
+ const shouldClearSort = changed.has('withinCollection') &&
940
+ !changed.has('selectedSort') &&
941
+ !changed.has('sortDirection');
942
+ // Otherwise, only clear filters that haven't been simultaneously applied in this update
943
+ this.clearFilters({
944
+ sort: shouldClearSort,
945
+ facets: !changed.has('selectedFacets'),
946
+ dateRange: !(changed.has('minSelectedDate') || changed.has('maxSelectedDate')),
947
+ letterFilters: !(changed.has('selectedTitleFilter') ||
948
+ changed.has('selectedCreatorFilter')),
949
+ });
950
+ }
951
+ }
952
+ if (changed.has('profileElement')) {
953
+ this.applyDefaultProfileSort();
954
+ }
955
+ if (changed.has('baseQuery')) {
956
+ this.emitBaseQueryChanged();
957
+ }
958
+ if (changed.has('searchType')) {
959
+ this.emitSearchTypeChanged();
960
+ }
961
+ if (changed.has('currentPage') || changed.has('displayMode')) {
962
+ this.persistState();
963
+ }
964
+ if (changed.has('baseQuery') ||
965
+ changed.has('minSelectedDate') ||
966
+ changed.has('maxSelectedDate') ||
967
+ changed.has('selectedFacets') ||
968
+ changed.has('searchService') ||
969
+ changed.has('withinCollection') ||
970
+ changed.has('withinProfile') ||
971
+ changed.has('profileElement')) {
972
+ this.dataSource.refreshLetterCounts();
973
+ }
974
+ if (changed.has('selectedSort') || changed.has('sortDirection')) {
975
+ const prevSortDirection = changed.get('sortDirection');
976
+ this.sendSortByAnalytics(prevSortDirection);
977
+ this.selectedSortChanged();
978
+ }
979
+ if (changed.has('selectedTitleFilter')) {
980
+ this.sendFilterByTitleAnalytics(changed.get('selectedTitleFilter'));
981
+ }
982
+ if (changed.has('selectedCreatorFilter')) {
983
+ this.sendFilterByCreatorAnalytics(changed.get('selectedCreatorFilter'));
984
+ }
985
+ this.updateFacetReadiness();
986
+ if (changed.has('baseQuery') ||
987
+ changed.has('searchType') ||
988
+ changed.has('selectedTitleFilter') ||
989
+ changed.has('selectedCreatorFilter') ||
990
+ changed.has('minSelectedDate') ||
991
+ changed.has('maxSelectedDate') ||
992
+ changed.has('selectedSort') ||
993
+ changed.has('sortDirection') ||
994
+ changed.has('selectedFacets') ||
995
+ changed.has('searchService') ||
996
+ changed.has('withinCollection') ||
997
+ changed.has('withinProfile') ||
998
+ changed.has('profileElement')) {
999
+ this.handleQueryChange();
1000
+ }
1001
+ if (changed.has('searchResultsLoading')) {
1002
+ this.emitSearchResultsLoadingChanged();
1003
+ }
1004
+ if (changed.has('facetsLoading') &&
1005
+ this.facetsLoading &&
1006
+ this.collectionFacets) {
1007
+ this.collectionFacets.moreLinksVisible =
1008
+ this.searchType !== SearchType.FULLTEXT;
1009
+ }
1010
+ if (changed.has('pagesToRender')) {
1011
+ if (!this.dataSource.endOfDataReached && this.infiniteScroller) {
1012
+ this.infiniteScroller.itemCount = this.estimatedTileCount;
1013
+ }
1014
+ }
1015
+ if (changed.has('isManageView')) {
1016
+ if (this.isManageView)
1017
+ this.displayMode = 'grid';
1018
+ (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.refreshAllVisibleCells();
1019
+ this.emitManageModeChangedEvent();
1020
+ }
1021
+ if (changed.has('resizeObserver')) {
1022
+ const oldObserver = changed.get('resizeObserver');
1023
+ if (oldObserver)
1024
+ this.disconnectResizeObserver(oldObserver);
1025
+ this.setupResizeObserver();
1026
+ }
1027
+ }
1028
+ connectedCallback() {
1029
+ var _a;
1030
+ (_a = super.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
1031
+ this.setupStateRestorationObserver();
1032
+ this.setupResizeObserver();
1033
+ }
1034
+ disconnectedCallback() {
1035
+ var _a, _b;
1036
+ if (this.resizeObserver) {
1037
+ this.disconnectResizeObserver(this.resizeObserver);
1038
+ }
1039
+ if (this.boundNavigationHandler) {
1040
+ window.removeEventListener('popstate', this.boundNavigationHandler);
1041
+ }
1042
+ (_a = this.leftColIntersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
1043
+ (_b = this.facetsIntersectionObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
1044
+ window.removeEventListener('resize', this.updateLeftColumnHeight);
1045
+ }
1046
+ handleResize(entry) {
1047
+ const previousView = this.mobileView;
1048
+ if (entry.target === this.contentContainer) {
1049
+ this.contentWidth = entry.contentRect.width;
1050
+ this.mobileView =
1051
+ this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
1052
+ // If changing from desktop to mobile disable transition
1053
+ if (this.mobileView && !previousView) {
1054
+ this.isResizeToMobile = true;
1055
+ }
1056
+ }
1057
+ // Ensure the facet sidebar remains sized correctly
1058
+ this.updateLeftColumnHeight();
1059
+ }
1060
+ /**
1061
+ * Updates the data source with the current state of facet readiness for loading,
1062
+ * so that they will begin to load in at the appropriate time according to the
1063
+ * current facet loading strategy.
1064
+ */
1065
+ updateFacetReadiness() {
1066
+ // In desktop view, we are always ready to load facets *unless* we are
1067
+ // using the `opt-in` strategy and the facets dropdown is not open.
1068
+ const desktopFacetsReady = !this.mobileView &&
1069
+ (this.facetLoadStrategy !== 'opt-in' || this.collapsibleFacetsVisible);
1070
+ // In mobile view, facets are considered ready provided they are currently visible (their dropdown is opened).
1071
+ const mobileFacetsReady = this.mobileView && this.collapsibleFacetsVisible;
1072
+ this.dataSource.handleFacetReadinessChange(desktopFacetsReady || mobileFacetsReady);
1073
+ }
1074
+ /**
1075
+ * Sets up listeners for events that may require updating the left column height.
1076
+ */
1077
+ setupLeftColumnScrollListeners() {
1078
+ var _a;
1079
+ // We observe intersections between the left column's scroll sentinel and
1080
+ // the viewport, so that we can ensure the left column is always sized to
1081
+ // match the _available_ viewport height. This should generally be more
1082
+ // performant than listening to scroll events on the page or column.
1083
+ const leftColumnSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#left-column-scroll-sentinel');
1084
+ if (leftColumnSentinel) {
1085
+ this.leftColIntersectionObserver = new IntersectionObserver(this.updateLeftColumnHeight, {
1086
+ threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%
1087
+ });
1088
+ this.leftColIntersectionObserver.observe(leftColumnSentinel);
1089
+ }
1090
+ // We also listen for window resize events, as they are not always captured
1091
+ // by the resize observer and can affect the desired height of the left column.
1092
+ window.addEventListener('resize', this.updateLeftColumnHeight);
1093
+ }
1094
+ /**
1095
+ * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.
1096
+ * Note this uses a separate IntersectionObserver from the left column, because we
1097
+ * don't need granular intersection thresholds for this.
1098
+ */
1099
+ setupFacetsScrollListeners() {
1100
+ var _a;
1101
+ const facetsSentinel = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#facets-scroll-sentinel');
1102
+ if (facetsSentinel) {
1103
+ this.facetsIntersectionObserver = new IntersectionObserver(this.updateFacetFadeOut);
1104
+ this.facetsIntersectionObserver.observe(facetsSentinel);
1105
+ }
1106
+ }
1107
+ emitBaseQueryChanged() {
1108
+ this.dispatchEvent(new CustomEvent('baseQueryChanged', {
1109
+ detail: {
1110
+ baseQuery: this.baseQuery,
1111
+ },
1112
+ }));
1113
+ }
1114
+ emitSearchTypeChanged() {
1115
+ this.dispatchEvent(new CustomEvent('searchTypeChanged', {
1116
+ detail: this.searchType,
1117
+ }));
1118
+ }
1119
+ emitQueryStateChanged() {
1120
+ this.dispatchEvent(new CustomEvent('queryStateChanged', {
1121
+ detail: {
1122
+ baseQuery: this.baseQuery,
1123
+ withinCollection: this.withinCollection,
1124
+ withinProfile: this.withinProfile,
1125
+ profileElement: this.profileElement,
1126
+ searchType: this.searchType,
1127
+ selectedFacets: this.selectedFacets,
1128
+ minSelectedDate: this.minSelectedDate,
1129
+ maxSelectedDate: this.maxSelectedDate,
1130
+ selectedSort: this.selectedSort,
1131
+ sortDirection: this.sortDirection,
1132
+ selectedTitleFilter: this.selectedTitleFilter,
1133
+ selectedCreatorFilter: this.selectedCreatorFilter,
1134
+ },
1135
+ }));
1136
+ }
1137
+ emitEmptyResults() {
1138
+ this.dispatchEvent(new Event('emptyResults'));
1139
+ }
1140
+ disconnectResizeObserver(resizeObserver) {
1141
+ resizeObserver.removeObserver({
1142
+ target: this.contentContainer,
1143
+ handler: this,
1144
+ });
1145
+ }
1146
+ setupResizeObserver() {
1147
+ if (!this.resizeObserver || !this.contentContainer)
1148
+ return;
1149
+ this.resizeObserver.addObserver({
1150
+ target: this.contentContainer,
1151
+ handler: this,
1152
+ });
1153
+ }
1154
+ /**
1155
+ * When the visible cells change from the infinite scroller, we want to emit
1156
+ * which page is currently visible so the consumer can update its UI or the URL
1157
+ *
1158
+ * @param e
1159
+ * @returns
1160
+ */
1161
+ visibleCellsChanged(e) {
1162
+ if (this.isScrollingToCell)
1163
+ return;
1164
+ const { visibleCellIndices } = e.detail;
1165
+ if (visibleCellIndices.length === 0)
1166
+ return;
1167
+ // For page determination, do not count more than a single page of visible cells,
1168
+ // since otherwise patrons using very tall screens will be treated as one page
1169
+ // further than they actually are.
1170
+ const lastIndexWithinCurrentPage = Math.min(this.pageSize, visibleCellIndices.length) - 1;
1171
+ const lastVisibleCellIndex = visibleCellIndices[lastIndexWithinCurrentPage];
1172
+ const lastVisibleCellPage = Math.floor(lastVisibleCellIndex / this.pageSize) + 1;
1173
+ if (this.currentPage !== lastVisibleCellPage) {
1174
+ this.currentPage = lastVisibleCellPage;
1175
+ }
1176
+ const event = new CustomEvent('visiblePageChanged', {
1177
+ detail: {
1178
+ pageNumber: lastVisibleCellPage,
1179
+ },
1180
+ });
1181
+ this.dispatchEvent(event);
1182
+ }
1183
+ /**
1184
+ * A Promise which, after each query change, resolves once the fetches for the initial
1185
+ * search have completed. Waits for *both* the hits and aggregations fetches to finish.
1186
+ *
1187
+ * Ensure you await this component's `updateComplete` promise before awaiting this
1188
+ * one, to ensure you do not await an obsolete promise from the previous update.
1189
+ */
1190
+ get initialSearchComplete() {
1191
+ return this.dataSource.initialSearchComplete;
1192
+ }
1193
+ async handleQueryChange() {
1194
+ var _a;
1195
+ // only reset if the query has actually changed
1196
+ if (!this.searchService ||
1197
+ this.dataSource.pageFetchQueryKey === this.previousQueryKey)
1198
+ return;
1199
+ // If the new state prevents us from updating the search results, don't reset
1200
+ if (!this.dataSource.canPerformSearch &&
1201
+ !(this.clearResultsOnEmptyQuery && this.baseQuery === ''))
1202
+ return;
1203
+ this.previousQueryKey = this.dataSource.pageFetchQueryKey;
1204
+ // this.emitQueryStateChanged();
1205
+ this.tileModelOffset = 0;
1206
+ this.totalResults = undefined;
1207
+ this.pagesToRender =
1208
+ this.initialPageNumber === 1
1209
+ ? 2 // First two pages are batched into one request when starting from page 1
1210
+ : this.initialPageNumber;
1211
+ // Reset the infinite scroller's item count, so that it
1212
+ // shows tile placeholders until the new query's results load in
1213
+ if (this.infiniteScroller) {
1214
+ this.infiniteScroller.itemCount = this.estimatedTileCount;
1215
+ this.infiniteScroller.reload();
1216
+ }
1217
+ if (this.withinCollection && ((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim())) {
1218
+ this.defaultSortField = SortField.relevance;
1219
+ this.defaultSortDirection = null;
1220
+ }
1221
+ if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {
1222
+ this.scrollToPage(this.initialPageNumber);
1223
+ }
1224
+ this.initialQueryChangeHappened = true;
1225
+ // if the query changed as part of a window.history pop event, we don't want to
1226
+ // persist the state because it overwrites the forward history
1227
+ if (!this.historyPopOccurred) {
1228
+ this.persistState();
1229
+ }
1230
+ this.historyPopOccurred = false;
1231
+ // Fire the initial page and facets requests
1232
+ // await this.dataSource.handleQueryChange();
1233
+ }
1234
+ setupStateRestorationObserver() {
1235
+ if (!this.boundNavigationHandler) {
1236
+ this.boundNavigationHandler = this.historyNavigationHandler.bind(this);
1237
+ }
1238
+ // when the user navigates back, we want to update the UI to match the URL
1239
+ window.addEventListener('popstate', this.boundNavigationHandler);
1240
+ }
1241
+ historyNavigationHandler() {
1242
+ this.historyPopOccurred = true;
1243
+ this.restoreState();
1244
+ }
1245
+ restoreState() {
1246
+ var _a, _b, _c, _d, _e;
1247
+ const restorationState = this.restorationStateHandler.getRestorationState();
1248
+ this.displayMode = restorationState.displayMode;
1249
+ if (restorationState.searchType != null)
1250
+ this.searchType = restorationState.searchType;
1251
+ this.selectedSort = (_a = restorationState.selectedSort) !== null && _a !== void 0 ? _a : SortField.default;
1252
+ this.sortDirection = (_b = restorationState.sortDirection) !== null && _b !== void 0 ? _b : null;
1253
+ this.selectedTitleFilter = (_c = restorationState.selectedTitleFilter) !== null && _c !== void 0 ? _c : null;
1254
+ this.selectedCreatorFilter = (_d = restorationState.selectedCreatorFilter) !== null && _d !== void 0 ? _d : null;
1255
+ this.selectedFacets = restorationState.selectedFacets;
1256
+ if (!this.suppressURLQuery)
1257
+ this.baseQuery = restorationState.baseQuery;
1258
+ this.currentPage = (_e = restorationState.currentPage) !== null && _e !== void 0 ? _e : 1;
1259
+ this.minSelectedDate = restorationState.minSelectedDate;
1260
+ this.maxSelectedDate = restorationState.maxSelectedDate;
1261
+ if (this.currentPage > 1) {
1262
+ this.goToPage(this.currentPage);
1263
+ }
1264
+ }
1265
+ persistState() {
1266
+ var _a, _b, _c, _d;
1267
+ const restorationState = {
1268
+ displayMode: this.displayMode,
1269
+ searchType: this.searchType,
1270
+ selectedSort: this.selectedSort,
1271
+ sortDirection: (_a = this.sortDirection) !== null && _a !== void 0 ? _a : undefined,
1272
+ selectedFacets: (_b = this.selectedFacets) !== null && _b !== void 0 ? _b : getDefaultSelectedFacets(),
1273
+ baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,
1274
+ currentPage: this.currentPage,
1275
+ titleQuery: this.titleQuery,
1276
+ creatorQuery: this.creatorQuery,
1277
+ minSelectedDate: this.minSelectedDate,
1278
+ maxSelectedDate: this.maxSelectedDate,
1279
+ selectedTitleFilter: (_c = this.selectedTitleFilter) !== null && _c !== void 0 ? _c : undefined,
1280
+ selectedCreatorFilter: (_d = this.selectedCreatorFilter) !== null && _d !== void 0 ? _d : undefined,
1281
+ };
1282
+ this.restorationStateHandler.persistState(restorationState, this.dataSourceInstallInProgress);
1283
+ }
1284
+ emitSearchResultsLoadingChanged() {
1285
+ this.dispatchEvent(new CustomEvent('searchResultsLoadingChanged', {
1286
+ detail: {
1287
+ loading: this.searchResultsLoading,
1288
+ },
1289
+ }));
1290
+ }
1291
+ facetsChanged(e) {
1292
+ this.selectedFacets = e.detail;
1293
+ }
1294
+ facetClickHandler({ detail: { facetType, bucket, negative }, }) {
1295
+ var _a;
1296
+ let action;
1297
+ if (negative) {
1298
+ action =
1299
+ bucket.state !== 'none'
1300
+ ? analyticsActions.facetNegativeSelected
1301
+ : analyticsActions.facetNegativeDeselected;
1302
+ }
1303
+ else {
1304
+ action =
1305
+ bucket.state !== 'none'
1306
+ ? analyticsActions.facetSelected
1307
+ : analyticsActions.facetDeselected;
1308
+ }
1309
+ (_a = this.analyticsHandler) === null || _a === void 0 ? void 0 : _a.sendEvent({
1310
+ category: this.searchContext,
1311
+ action,
1312
+ label: facetType,
1313
+ });
1314
+ }
1315
+ scrollToPage(pageNumber) {
1316
+ return new Promise(resolve => {
1317
+ const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1318
+ // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1319
+ // then scrolls to the cell
1320
+ setTimeout(() => {
1321
+ var _a;
1322
+ this.isScrollingToCell = true;
1323
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1324
+ // This timeout is to give the scroll animation time to finish
1325
+ // then updating the infinite scroller once we're done scrolling
1326
+ // There's no scroll animation completion callback so we're
1327
+ // giving it 0.5s to finish.
1328
+ setTimeout(() => {
1329
+ var _a;
1330
+ this.isScrollingToCell = false;
1331
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1332
+ resolve();
1333
+ }, 500);
1334
+ }, 0);
1335
+ });
1336
+ }
1337
+ /**
1338
+ * Whether sorting by relevance makes sense for the current state.
1339
+ * Currently equivalent to having a non-empty query.
1340
+ */
1341
+ get isRelevanceSortAvailable() {
1342
+ var _a;
1343
+ return !!((_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim());
1344
+ }
1345
+ /**
1346
+ * Sets the total number of tiles displayed in the infinite scroller.
1347
+ */
1348
+ setTileCount(count) {
1349
+ if (this.infiniteScroller) {
1350
+ this.infiniteScroller.itemCount = count;
1351
+ }
1352
+ }
1353
+ /**
1354
+ * Applies any default sort option for the current collection, by checking
1355
+ * for one in the collection's metadata. If none is found, defaults to sorting
1356
+ * descending by:
1357
+ * - Date Favorited for fav-* collections
1358
+ * - Weekly views for all other collections
1359
+ */
1360
+ applyDefaultCollectionSort(collectionInfo) {
1361
+ var _a, _b, _c;
1362
+ if (this.baseQuery) {
1363
+ // If there's a query set, then we default to relevance sorting regardless of
1364
+ // the collection metadata-specified sort.
1365
+ this.defaultSortField = SortField.relevance;
1366
+ this.defaultSortDirection = null;
1367
+ return;
1368
+ }
1369
+ // Favorite collections sort on Date Favorited by default.
1370
+ // Other collections fall back to sorting on weekly views.
1371
+ 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-'))
1372
+ ? '-favoritedate'
1373
+ : '-week';
1374
+ // The collection metadata may override the default sorting with something else
1375
+ const metadataSort = (_c = collectionInfo === null || collectionInfo === void 0 ? void 0 : collectionInfo.public_metadata) === null || _c === void 0 ? void 0 : _c['sort-by'];
1376
+ // Prefer the metadata-specified sort if one exists
1377
+ const defaultSortToApply = metadataSort !== null && metadataSort !== void 0 ? metadataSort : baseDefaultSort;
1378
+ // Account for both -field and field:dir formats
1379
+ let [field, dir] = defaultSortToApply.split(':');
1380
+ if (field.startsWith('-')) {
1381
+ field = field.slice(1);
1382
+ dir = 'desc';
1383
+ }
1384
+ else if (!['asc', 'desc'].includes(dir)) {
1385
+ dir = 'asc';
1386
+ }
1387
+ const sortOption = sortOptionFromAPIString(field);
1388
+ const sortField = sortOption.field;
1389
+ if (sortField && sortField !== SortField.default) {
1390
+ this.defaultSortField = sortField;
1391
+ this.defaultSortDirection = dir;
1392
+ this.defaultSortParam = {
1393
+ field: this.defaultSortField,
1394
+ direction: this.defaultSortDirection,
1395
+ };
1396
+ }
1397
+ }
1398
+ /**
1399
+ * Applies the default sort option for the current profile element
1400
+ */
1401
+ applyDefaultProfileSort() {
1402
+ if (this.profileElement) {
1403
+ const defaultSortField = defaultProfileElementSorts[this.profileElement];
1404
+ this.defaultSortField = defaultSortField !== null && defaultSortField !== void 0 ? defaultSortField : SortField.weeklyview;
1405
+ }
1406
+ else {
1407
+ this.defaultSortField = SortField.weeklyview;
1408
+ }
1409
+ this.defaultSortDirection = 'desc';
1410
+ this.defaultSortParam = {
1411
+ field: this.defaultSortField,
1412
+ direction: this.defaultSortDirection,
1413
+ };
1414
+ }
1415
+ /**
1416
+ * This is useful for determining whether we need to reload the scroller.
1417
+ *
1418
+ * When the fetch completes, we need to reload the scroller if the cells for that
1419
+ * page are visible, but if the page is not currenlty visible, we don't need to reload
1420
+ */
1421
+ get currentVisiblePageNumbers() {
1422
+ var _a, _b;
1423
+ const visibleCells = (_b = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.getVisibleCellIndices()) !== null && _b !== void 0 ? _b : [];
1424
+ const visiblePages = new Set();
1425
+ visibleCells.forEach(cellIndex => {
1426
+ const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;
1427
+ visiblePages.add(visiblePage);
1428
+ });
1429
+ return Array.from(visiblePages);
1430
+ }
1431
+ /**
1432
+ * Refreshes all visible result cells in the infinite scroller.
1433
+ */
1434
+ refreshVisibleResults() {
1435
+ var _a;
1436
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1437
+ }
1438
+ /**
1439
+ * Callback when a result is selected
1440
+ */
1441
+ resultSelected(event) {
1442
+ var _a, _b, _c;
1443
+ if (this.isManageView) {
1444
+ // Checked/unchecked state change -- rerender to ensure it propagates
1445
+ // this.mapDataSource(model => ({ ...model }));
1446
+ const cellIndex = this.dataSource.indexOf(event.detail);
1447
+ if (cellIndex >= 0)
1448
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshCell(cellIndex);
1449
+ this.requestUpdate();
1450
+ }
1451
+ (_b = this.analyticsHandler) === null || _b === void 0 ? void 0 : _b.sendEvent({
1452
+ category: this.searchContext,
1453
+ action: analyticsActions.resultSelected,
1454
+ label: event.detail.mediatype,
1455
+ });
1456
+ (_c = this.analyticsHandler) === null || _c === void 0 ? void 0 : _c.sendEvent({
1457
+ category: this.searchContext,
1458
+ action: analyticsActions.resultSelected,
1459
+ label: `page-${this.currentPage}`,
1460
+ });
1461
+ }
1462
+ cellForIndex(index) {
1463
+ const model = this.tileModelAtCellIndex(index);
1464
+ if (!model)
1465
+ return undefined;
1466
1466
  return html `
1467
1467
  <tile-dispatcher
1468
1468
  .collectionPagePath=${this.collectionPagePath}
@@ -1482,21 +1482,21 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1482
1482
  @resultSelected=${(e) => this.resultSelected(e)}
1483
1483
  >
1484
1484
  </tile-dispatcher>
1485
- `;
1486
- }
1487
- /**
1488
- * When the user scrolls near to the bottom of the page, fetch the next page
1489
- * increase the number of pages to render and start fetching data for the new page
1490
- */
1491
- scrollThresholdReached() {
1492
- if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
1493
- this.pagesToRender += 1;
1494
- this.dataSource.fetchPage(this.pagesToRender);
1495
- }
1496
- }
1497
- static get styles() {
1498
- return [
1499
- srOnlyStyle,
1485
+ `;
1486
+ }
1487
+ /**
1488
+ * When the user scrolls near to the bottom of the page, fetch the next page
1489
+ * increase the number of pages to render and start fetching data for the new page
1490
+ */
1491
+ scrollThresholdReached() {
1492
+ if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {
1493
+ this.pagesToRender += 1;
1494
+ this.dataSource.fetchPage(this.pagesToRender);
1495
+ }
1496
+ }
1497
+ static get styles() {
1498
+ return [
1499
+ srOnlyStyle,
1500
1500
  css `
1501
1501
  :host {
1502
1502
  display: block;
@@ -1894,183 +1894,183 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1894
1894
  infinite-scroller.hidden {
1895
1895
  display: none;
1896
1896
  }
1897
- `,
1898
- ];
1899
- }
1900
- };
1901
- __decorate([
1902
- property({ type: String })
1903
- ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
1904
- __decorate([
1905
- property({ type: String })
1906
- ], CollectionBrowser.prototype, "baseImageUrl", void 0);
1907
- __decorate([
1908
- property({ type: Object })
1909
- ], CollectionBrowser.prototype, "searchService", void 0);
1910
- __decorate([
1911
- property({ type: String })
1912
- ], CollectionBrowser.prototype, "searchType", void 0);
1913
- __decorate([
1914
- property({ type: String })
1915
- ], CollectionBrowser.prototype, "withinCollection", void 0);
1916
- __decorate([
1917
- property({ type: String })
1918
- ], CollectionBrowser.prototype, "withinProfile", void 0);
1919
- __decorate([
1920
- property({ type: String })
1921
- ], CollectionBrowser.prototype, "profileElement", void 0);
1922
- __decorate([
1923
- property({ type: String })
1924
- ], CollectionBrowser.prototype, "baseQuery", void 0);
1925
- __decorate([
1926
- property({ type: String })
1927
- ], CollectionBrowser.prototype, "displayMode", void 0);
1928
- __decorate([
1929
- property({ type: Object })
1930
- ], CollectionBrowser.prototype, "defaultSortParam", void 0);
1931
- __decorate([
1932
- property({ type: String })
1933
- ], CollectionBrowser.prototype, "selectedSort", void 0);
1934
- __decorate([
1935
- property({ type: String })
1936
- ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
1937
- __decorate([
1938
- property({ type: String })
1939
- ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
1940
- __decorate([
1941
- property({ type: String })
1942
- ], CollectionBrowser.prototype, "sortDirection", void 0);
1943
- __decorate([
1944
- property({ type: Number })
1945
- ], CollectionBrowser.prototype, "pageSize", void 0);
1946
- __decorate([
1947
- property({ type: Number })
1948
- ], CollectionBrowser.prototype, "currentPage", void 0);
1949
- __decorate([
1950
- property({ type: String })
1951
- ], CollectionBrowser.prototype, "minSelectedDate", void 0);
1952
- __decorate([
1953
- property({ type: String })
1954
- ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
1955
- __decorate([
1956
- property({ type: Object })
1957
- ], CollectionBrowser.prototype, "selectedFacets", void 0);
1958
- __decorate([
1959
- property({ type: Boolean })
1960
- ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
1961
- __decorate([
1962
- property({ type: Boolean })
1963
- ], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
1964
- __decorate([
1965
- property({ type: Boolean })
1966
- ], CollectionBrowser.prototype, "suppressResultCount", void 0);
1967
- __decorate([
1968
- property({ type: Boolean })
1969
- ], CollectionBrowser.prototype, "suppressResultTiles", void 0);
1970
- __decorate([
1971
- property({ type: Boolean })
1972
- ], CollectionBrowser.prototype, "suppressURLQuery", void 0);
1973
- __decorate([
1974
- property({ type: Boolean })
1975
- ], CollectionBrowser.prototype, "suppressSortBar", void 0);
1976
- __decorate([
1977
- property({ type: Boolean })
1978
- ], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
1979
- __decorate([
1980
- property({ type: String })
1981
- ], CollectionBrowser.prototype, "facetLoadStrategy", void 0);
1982
- __decorate([
1983
- property({ type: Boolean })
1984
- ], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
1985
- __decorate([
1986
- property({ type: String })
1987
- ], CollectionBrowser.prototype, "collectionPagePath", void 0);
1988
- __decorate([
1989
- property({ type: String, reflect: true })
1990
- ], CollectionBrowser.prototype, "searchContext", void 0);
1991
- __decorate([
1992
- property({ type: String })
1993
- ], CollectionBrowser.prototype, "pageContext", void 0);
1994
- __decorate([
1995
- property({ type: Object })
1996
- ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
1997
- __decorate([
1998
- property({ type: Number })
1999
- ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
2000
- __decorate([
2001
- property({ type: Boolean })
2002
- ], CollectionBrowser.prototype, "loggedIn", void 0);
2003
- __decorate([
2004
- property({ type: Object })
2005
- ], CollectionBrowser.prototype, "resizeObserver", void 0);
2006
- __decorate([
2007
- property({ type: Object })
2008
- ], CollectionBrowser.prototype, "modalManager", void 0);
2009
- __decorate([
2010
- property({ type: Object })
2011
- ], CollectionBrowser.prototype, "featureFeedbackService", void 0);
2012
- __decorate([
2013
- property({ type: Object })
2014
- ], CollectionBrowser.prototype, "recaptchaManager", void 0);
2015
- __decorate([
2016
- property({ type: Boolean })
2017
- ], CollectionBrowser.prototype, "isManageView", void 0);
2018
- __decorate([
2019
- property({ type: String })
2020
- ], CollectionBrowser.prototype, "manageViewLabel", void 0);
2021
- __decorate([
2022
- property({ type: Boolean })
2023
- ], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
2024
- __decorate([
2025
- property({ type: Object })
2026
- ], CollectionBrowser.prototype, "dataSource", void 0);
2027
- __decorate([
2028
- state()
2029
- ], CollectionBrowser.prototype, "pagesToRender", void 0);
2030
- __decorate([
2031
- state()
2032
- ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
2033
- __decorate([
2034
- state()
2035
- ], CollectionBrowser.prototype, "facetsLoading", void 0);
2036
- __decorate([
2037
- state()
2038
- ], CollectionBrowser.prototype, "totalResults", void 0);
2039
- __decorate([
2040
- state()
2041
- ], CollectionBrowser.prototype, "mobileView", void 0);
2042
- __decorate([
2043
- state()
2044
- ], CollectionBrowser.prototype, "collapsibleFacetsVisible", void 0);
2045
- __decorate([
2046
- state()
2047
- ], CollectionBrowser.prototype, "contentWidth", void 0);
2048
- __decorate([
2049
- state()
2050
- ], CollectionBrowser.prototype, "defaultSortField", void 0);
2051
- __decorate([
2052
- state()
2053
- ], CollectionBrowser.prototype, "defaultSortDirection", void 0);
2054
- __decorate([
2055
- state()
2056
- ], CollectionBrowser.prototype, "placeholderType", void 0);
2057
- __decorate([
2058
- query('#content-container')
2059
- ], CollectionBrowser.prototype, "contentContainer", void 0);
2060
- __decorate([
2061
- query('#left-column')
2062
- ], CollectionBrowser.prototype, "leftColumn", void 0);
2063
- __decorate([
2064
- query('collection-facets')
2065
- ], CollectionBrowser.prototype, "collectionFacets", void 0);
2066
- __decorate([
2067
- property({ type: Object, attribute: false })
2068
- ], CollectionBrowser.prototype, "analyticsHandler", void 0);
2069
- __decorate([
2070
- query('infinite-scroller')
2071
- ], CollectionBrowser.prototype, "infiniteScroller", void 0);
2072
- CollectionBrowser = __decorate([
2073
- customElement('collection-browser')
2074
- ], CollectionBrowser);
2075
- export { CollectionBrowser };
1897
+ `,
1898
+ ];
1899
+ }
1900
+ };
1901
+ __decorate([
1902
+ property({ type: String })
1903
+ ], CollectionBrowser.prototype, "baseNavigationUrl", void 0);
1904
+ __decorate([
1905
+ property({ type: String })
1906
+ ], CollectionBrowser.prototype, "baseImageUrl", void 0);
1907
+ __decorate([
1908
+ property({ type: Object })
1909
+ ], CollectionBrowser.prototype, "searchService", void 0);
1910
+ __decorate([
1911
+ property({ type: String })
1912
+ ], CollectionBrowser.prototype, "searchType", void 0);
1913
+ __decorate([
1914
+ property({ type: String })
1915
+ ], CollectionBrowser.prototype, "withinCollection", void 0);
1916
+ __decorate([
1917
+ property({ type: String })
1918
+ ], CollectionBrowser.prototype, "withinProfile", void 0);
1919
+ __decorate([
1920
+ property({ type: String })
1921
+ ], CollectionBrowser.prototype, "profileElement", void 0);
1922
+ __decorate([
1923
+ property({ type: String })
1924
+ ], CollectionBrowser.prototype, "baseQuery", void 0);
1925
+ __decorate([
1926
+ property({ type: String })
1927
+ ], CollectionBrowser.prototype, "displayMode", void 0);
1928
+ __decorate([
1929
+ property({ type: Object })
1930
+ ], CollectionBrowser.prototype, "defaultSortParam", void 0);
1931
+ __decorate([
1932
+ property({ type: String })
1933
+ ], CollectionBrowser.prototype, "selectedSort", void 0);
1934
+ __decorate([
1935
+ property({ type: String })
1936
+ ], CollectionBrowser.prototype, "selectedTitleFilter", void 0);
1937
+ __decorate([
1938
+ property({ type: String })
1939
+ ], CollectionBrowser.prototype, "selectedCreatorFilter", void 0);
1940
+ __decorate([
1941
+ property({ type: String })
1942
+ ], CollectionBrowser.prototype, "sortDirection", void 0);
1943
+ __decorate([
1944
+ property({ type: Number })
1945
+ ], CollectionBrowser.prototype, "pageSize", void 0);
1946
+ __decorate([
1947
+ property({ type: Number })
1948
+ ], CollectionBrowser.prototype, "currentPage", void 0);
1949
+ __decorate([
1950
+ property({ type: String })
1951
+ ], CollectionBrowser.prototype, "minSelectedDate", void 0);
1952
+ __decorate([
1953
+ property({ type: String })
1954
+ ], CollectionBrowser.prototype, "maxSelectedDate", void 0);
1955
+ __decorate([
1956
+ property({ type: Object })
1957
+ ], CollectionBrowser.prototype, "selectedFacets", void 0);
1958
+ __decorate([
1959
+ property({ type: Boolean })
1960
+ ], CollectionBrowser.prototype, "showHistogramDatePicker", void 0);
1961
+ __decorate([
1962
+ property({ type: Boolean })
1963
+ ], CollectionBrowser.prototype, "suppressPlaceholders", void 0);
1964
+ __decorate([
1965
+ property({ type: Boolean })
1966
+ ], CollectionBrowser.prototype, "suppressResultCount", void 0);
1967
+ __decorate([
1968
+ property({ type: Boolean })
1969
+ ], CollectionBrowser.prototype, "suppressResultTiles", void 0);
1970
+ __decorate([
1971
+ property({ type: Boolean })
1972
+ ], CollectionBrowser.prototype, "suppressURLQuery", void 0);
1973
+ __decorate([
1974
+ property({ type: Boolean })
1975
+ ], CollectionBrowser.prototype, "suppressSortBar", void 0);
1976
+ __decorate([
1977
+ property({ type: Boolean })
1978
+ ], CollectionBrowser.prototype, "suppressDisplayModes", void 0);
1979
+ __decorate([
1980
+ property({ type: String })
1981
+ ], CollectionBrowser.prototype, "facetLoadStrategy", void 0);
1982
+ __decorate([
1983
+ property({ type: Boolean })
1984
+ ], CollectionBrowser.prototype, "clearResultsOnEmptyQuery", void 0);
1985
+ __decorate([
1986
+ property({ type: String })
1987
+ ], CollectionBrowser.prototype, "collectionPagePath", void 0);
1988
+ __decorate([
1989
+ property({ type: String, reflect: true })
1990
+ ], CollectionBrowser.prototype, "searchContext", void 0);
1991
+ __decorate([
1992
+ property({ type: String })
1993
+ ], CollectionBrowser.prototype, "pageContext", void 0);
1994
+ __decorate([
1995
+ property({ type: Object })
1996
+ ], CollectionBrowser.prototype, "restorationStateHandler", void 0);
1997
+ __decorate([
1998
+ property({ type: Number })
1999
+ ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
2000
+ __decorate([
2001
+ property({ type: Boolean })
2002
+ ], CollectionBrowser.prototype, "loggedIn", void 0);
2003
+ __decorate([
2004
+ property({ type: Object })
2005
+ ], CollectionBrowser.prototype, "resizeObserver", void 0);
2006
+ __decorate([
2007
+ property({ type: Object })
2008
+ ], CollectionBrowser.prototype, "modalManager", void 0);
2009
+ __decorate([
2010
+ property({ type: Object })
2011
+ ], CollectionBrowser.prototype, "featureFeedbackService", void 0);
2012
+ __decorate([
2013
+ property({ type: Object })
2014
+ ], CollectionBrowser.prototype, "recaptchaManager", void 0);
2015
+ __decorate([
2016
+ property({ type: Boolean })
2017
+ ], CollectionBrowser.prototype, "isManageView", void 0);
2018
+ __decorate([
2019
+ property({ type: String })
2020
+ ], CollectionBrowser.prototype, "manageViewLabel", void 0);
2021
+ __decorate([
2022
+ property({ type: Boolean })
2023
+ ], CollectionBrowser.prototype, "enableSortOptionsSlot", void 0);
2024
+ __decorate([
2025
+ property({ type: Object })
2026
+ ], CollectionBrowser.prototype, "dataSource", void 0);
2027
+ __decorate([
2028
+ state()
2029
+ ], CollectionBrowser.prototype, "pagesToRender", void 0);
2030
+ __decorate([
2031
+ state()
2032
+ ], CollectionBrowser.prototype, "searchResultsLoading", void 0);
2033
+ __decorate([
2034
+ state()
2035
+ ], CollectionBrowser.prototype, "facetsLoading", void 0);
2036
+ __decorate([
2037
+ state()
2038
+ ], CollectionBrowser.prototype, "totalResults", void 0);
2039
+ __decorate([
2040
+ state()
2041
+ ], CollectionBrowser.prototype, "mobileView", void 0);
2042
+ __decorate([
2043
+ state()
2044
+ ], CollectionBrowser.prototype, "collapsibleFacetsVisible", void 0);
2045
+ __decorate([
2046
+ state()
2047
+ ], CollectionBrowser.prototype, "contentWidth", void 0);
2048
+ __decorate([
2049
+ state()
2050
+ ], CollectionBrowser.prototype, "defaultSortField", void 0);
2051
+ __decorate([
2052
+ state()
2053
+ ], CollectionBrowser.prototype, "defaultSortDirection", void 0);
2054
+ __decorate([
2055
+ state()
2056
+ ], CollectionBrowser.prototype, "placeholderType", void 0);
2057
+ __decorate([
2058
+ query('#content-container')
2059
+ ], CollectionBrowser.prototype, "contentContainer", void 0);
2060
+ __decorate([
2061
+ query('#left-column')
2062
+ ], CollectionBrowser.prototype, "leftColumn", void 0);
2063
+ __decorate([
2064
+ query('collection-facets')
2065
+ ], CollectionBrowser.prototype, "collectionFacets", void 0);
2066
+ __decorate([
2067
+ property({ type: Object, attribute: false })
2068
+ ], CollectionBrowser.prototype, "analyticsHandler", void 0);
2069
+ __decorate([
2070
+ query('infinite-scroller')
2071
+ ], CollectionBrowser.prototype, "infiniteScroller", void 0);
2072
+ CollectionBrowser = __decorate([
2073
+ customElement('collection-browser')
2074
+ ], CollectionBrowser);
2075
+ export { CollectionBrowser };
2076
2076
  //# sourceMappingURL=collection-browser.js.map