@internetarchive/bookreader 5.0.0-12-fixsorting-7 → 5.0.0-120

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 (420) hide show
  1. package/BookReader/474.js +2 -0
  2. package/BookReader/474.js.map +1 -0
  3. package/BookReader/BookReader.css +670 -1190
  4. package/BookReader/bergamot-translator-worker.js +2966 -0
  5. package/BookReader/bergamot-translator-worker.wasm +0 -0
  6. package/BookReader/hypothesis/LICENSE +50 -0
  7. package/BookReader/hypothesis/README.md +55 -0
  8. package/BookReader/hypothesis/build/boot-template.js +1 -0
  9. package/BookReader/hypothesis/build/boot.js +1 -0
  10. package/BookReader/hypothesis/build/manifest.json +20 -0
  11. package/BookReader/hypothesis/build/scripts/annotator.bundle.js +199 -0
  12. package/BookReader/hypothesis/build/scripts/annotator.bundle.js.map +1 -0
  13. package/BookReader/hypothesis/build/scripts/sidebar.bundle.js +811 -0
  14. package/BookReader/hypothesis/build/scripts/sidebar.bundle.js.map +1 -0
  15. package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js +437 -0
  16. package/BookReader/hypothesis/build/scripts/ui-playground.bundle.js.map +1 -0
  17. package/BookReader/hypothesis/build/styles/annotator.css +4 -0
  18. package/BookReader/hypothesis/build/styles/annotator.css.map +1 -0
  19. package/BookReader/hypothesis/build/styles/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  20. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  21. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  22. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  23. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  24. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Bold.woff2 +0 -0
  25. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  26. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Italic.woff2 +0 -0
  27. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Main-Regular.woff2 +0 -0
  28. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  29. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Math-Italic.woff2 +0 -0
  30. package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  31. package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  32. package/BookReader/hypothesis/build/styles/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  33. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Script-Regular.woff2 +0 -0
  34. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  35. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  36. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  37. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  38. package/BookReader/hypothesis/build/styles/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  39. package/BookReader/hypothesis/build/styles/highlights.css +2 -0
  40. package/BookReader/hypothesis/build/styles/highlights.css.map +1 -0
  41. package/BookReader/hypothesis/build/styles/katex.min.css +3 -0
  42. package/BookReader/hypothesis/build/styles/katex.min.css.map +1 -0
  43. package/BookReader/hypothesis/build/styles/pdfjs-overrides.css +14 -0
  44. package/BookReader/hypothesis/build/styles/pdfjs-overrides.css.map +1 -0
  45. package/BookReader/hypothesis/build/styles/sidebar.css +4 -0
  46. package/BookReader/hypothesis/build/styles/sidebar.css.map +1 -0
  47. package/BookReader/hypothesis/build/styles/ui-playground.css +4 -0
  48. package/BookReader/hypothesis/build/styles/ui-playground.css.map +1 -0
  49. package/BookReader/hypothesis/package.json +126 -0
  50. package/BookReader/ia-bookreader.js +1886 -0
  51. package/BookReader/{BookReader.js.LICENSE.txt → ia-bookreader.js.LICENSE.txt} +26 -20
  52. package/BookReader/ia-bookreader.js.map +1 -0
  53. package/BookReader/icons/1up.svg +1 -12
  54. package/BookReader/icons/2up.svg +1 -15
  55. package/BookReader/icons/advance.svg +3 -26
  56. package/BookReader/icons/chevron-right.svg +1 -1
  57. package/BookReader/icons/close-circle-dark.svg +1 -1
  58. package/BookReader/icons/close-circle.svg +1 -1
  59. package/BookReader/icons/fullscreen.svg +1 -17
  60. package/BookReader/icons/fullscreen_exit.svg +1 -17
  61. package/BookReader/icons/hamburger.svg +1 -15
  62. package/BookReader/icons/left-arrow.svg +1 -12
  63. package/BookReader/icons/magnify-minus.svg +1 -16
  64. package/BookReader/icons/magnify-plus.svg +1 -17
  65. package/BookReader/icons/magnify.svg +1 -15
  66. package/BookReader/icons/pause.svg +1 -23
  67. package/BookReader/icons/play.svg +1 -22
  68. package/BookReader/icons/playback-speed.svg +1 -34
  69. package/BookReader/icons/read-aloud.svg +1 -22
  70. package/BookReader/icons/review.svg +3 -22
  71. package/BookReader/icons/slider-toggle.svg +1 -0
  72. package/BookReader/icons/thumbnails.svg +1 -17
  73. package/BookReader/icons/voice.svg +1 -0
  74. package/BookReader/icons/volume-full.svg +1 -22
  75. package/BookReader/images/BRicons.svg +5 -94
  76. package/BookReader/images/books_graphic.svg +1 -177
  77. package/BookReader/images/hypothesis.ico +0 -0
  78. package/BookReader/images/icon_book.svg +1 -12
  79. package/BookReader/images/icon_bookmark.svg +1 -12
  80. package/BookReader/images/icon_experiment.svg +1 -0
  81. package/BookReader/images/icon_gear.svg +1 -14
  82. package/BookReader/images/icon_hamburger.svg +1 -20
  83. package/BookReader/images/icon_home.svg +1 -21
  84. package/BookReader/images/icon_info.svg +1 -11
  85. package/BookReader/images/icon_one_page.svg +1 -8
  86. package/BookReader/images/icon_pause.svg +1 -1
  87. package/BookReader/images/icon_play.svg +1 -1
  88. package/BookReader/images/icon_playback-rate.svg +1 -15
  89. package/BookReader/images/icon_search_button.svg +1 -8
  90. package/BookReader/images/icon_share.svg +1 -9
  91. package/BookReader/images/icon_skip-ahead.svg +1 -6
  92. package/BookReader/images/icon_skip-back.svg +2 -13
  93. package/BookReader/images/icon_speaker.svg +1 -18
  94. package/BookReader/images/icon_speaker_open.svg +1 -10
  95. package/BookReader/images/icon_thumbnails.svg +1 -12
  96. package/BookReader/images/icon_toc.svg +1 -5
  97. package/BookReader/images/icon_two_pages.svg +1 -9
  98. package/BookReader/images/marker_chap-off.svg +1 -11
  99. package/BookReader/images/marker_chap-on.svg +1 -11
  100. package/BookReader/images/marker_srch-on.svg +1 -11
  101. package/BookReader/images/translate.svg +1 -0
  102. package/BookReader/images/unviewable_page.png +0 -0
  103. package/BookReader/jquery-3.js +2 -0
  104. package/BookReader/jquery-3.js.LICENSE.txt +24 -0
  105. package/BookReader/plugins/plugin.archive_analytics.js +1 -172
  106. package/BookReader/plugins/plugin.archive_analytics.js.map +1 -1
  107. package/BookReader/plugins/plugin.autoplay.js +1 -165
  108. package/BookReader/plugins/plugin.autoplay.js.map +1 -1
  109. package/BookReader/plugins/plugin.chapters.js +19 -301
  110. package/BookReader/plugins/plugin.chapters.js.LICENSE.txt +1 -0
  111. package/BookReader/plugins/plugin.chapters.js.map +1 -1
  112. package/BookReader/plugins/plugin.experiments.js +3 -0
  113. package/BookReader/plugins/plugin.experiments.js.LICENSE.txt +1 -0
  114. package/BookReader/plugins/plugin.experiments.js.map +1 -0
  115. package/BookReader/plugins/plugin.iframe.js +1 -74
  116. package/BookReader/plugins/plugin.iframe.js.map +1 -1
  117. package/BookReader/plugins/plugin.iiif.js +2 -0
  118. package/BookReader/plugins/plugin.iiif.js.map +1 -0
  119. package/BookReader/plugins/plugin.resume.js +1 -368
  120. package/BookReader/plugins/plugin.resume.js.map +1 -1
  121. package/BookReader/plugins/plugin.search.js +2 -1385
  122. package/BookReader/plugins/plugin.search.js.LICENSE.txt +1 -0
  123. package/BookReader/plugins/plugin.search.js.map +1 -1
  124. package/BookReader/plugins/plugin.text_selection.js +2 -1080
  125. package/BookReader/plugins/plugin.text_selection.js.LICENSE.txt +1 -0
  126. package/BookReader/plugins/plugin.text_selection.js.map +1 -1
  127. package/BookReader/plugins/plugin.translate.js +3 -0
  128. package/BookReader/plugins/plugin.translate.js.LICENSE.txt +1 -0
  129. package/BookReader/plugins/plugin.translate.js.map +1 -0
  130. package/BookReader/plugins/plugin.tts.js +2 -9193
  131. package/BookReader/plugins/plugin.tts.js.LICENSE.txt +2 -0
  132. package/BookReader/plugins/plugin.tts.js.map +1 -1
  133. package/BookReader/plugins/plugin.url.js +1 -269
  134. package/BookReader/plugins/plugin.url.js.map +1 -1
  135. package/BookReader/plugins/plugin.vendor-fullscreen.js +1 -379
  136. package/BookReader/plugins/plugin.vendor-fullscreen.js.map +1 -1
  137. package/BookReader/plugins/translator-worker.js +2 -0
  138. package/BookReader/plugins/translator-worker.js.map +1 -0
  139. package/BookReader/silence.mp3 +0 -0
  140. package/BookReader/translator-worker.js +475 -0
  141. package/BookReader/webcomponents-bundle.js +3 -0
  142. package/BookReader/webcomponents-bundle.js.LICENSE.txt +9 -0
  143. package/BookReader/webcomponents-bundle.js.map +1 -0
  144. package/README.md +17 -4
  145. package/dist/esm/ia-bookreader.js +3 -0
  146. package/dist/esm/ia-bookreader.js.LICENSE.txt +17 -0
  147. package/dist/esm/ia-bookreader.js.map +1 -0
  148. package/dist/esm/plugins/plugin.archive_analytics.js +2 -0
  149. package/dist/esm/plugins/plugin.archive_analytics.js.map +1 -0
  150. package/dist/esm/plugins/plugin.autoplay.js +2 -0
  151. package/dist/esm/plugins/plugin.autoplay.js.map +1 -0
  152. package/dist/esm/plugins/plugin.chapters.js +2 -0
  153. package/dist/esm/plugins/plugin.chapters.js.map +1 -0
  154. package/dist/esm/plugins/plugin.experiments.js +2 -0
  155. package/dist/esm/plugins/plugin.experiments.js.map +1 -0
  156. package/dist/esm/plugins/plugin.iframe.js +2 -0
  157. package/dist/esm/plugins/plugin.iframe.js.map +1 -0
  158. package/dist/esm/plugins/plugin.iiif.js +2 -0
  159. package/dist/esm/plugins/plugin.iiif.js.map +1 -0
  160. package/dist/esm/plugins/plugin.resume.js +2 -0
  161. package/dist/esm/plugins/plugin.resume.js.map +1 -0
  162. package/dist/esm/plugins/plugin.search.js +2 -0
  163. package/dist/esm/plugins/plugin.search.js.map +1 -0
  164. package/dist/esm/plugins/plugin.text_selection.js +2 -0
  165. package/dist/esm/plugins/plugin.text_selection.js.map +1 -0
  166. package/dist/esm/plugins/plugin.translate.js +2 -0
  167. package/dist/esm/plugins/plugin.translate.js.map +1 -0
  168. package/dist/esm/plugins/plugin.tts.js +2 -0
  169. package/dist/esm/plugins/plugin.tts.js.map +1 -0
  170. package/dist/esm/plugins/plugin.url.js +2 -0
  171. package/dist/esm/plugins/plugin.url.js.map +1 -0
  172. package/dist/esm/plugins/plugin.vendor-fullscreen.js +2 -0
  173. package/dist/esm/plugins/plugin.vendor-fullscreen.js.map +1 -0
  174. package/jsconfig.json +18 -0
  175. package/package.json +113 -71
  176. package/src/BookReader/BookModel.js +92 -46
  177. package/src/BookReader/DragScrollable.js +233 -0
  178. package/src/BookReader/ImageCache.js +49 -16
  179. package/src/BookReader/Mode1Up.js +66 -365
  180. package/src/BookReader/Mode1UpLit.js +392 -0
  181. package/src/BookReader/Mode2Up.js +87 -1315
  182. package/src/BookReader/Mode2UpLit.js +786 -0
  183. package/src/BookReader/ModeAbstract.js +43 -0
  184. package/src/BookReader/ModeCoordinateSpace.js +29 -0
  185. package/src/BookReader/ModeSmoothZoom.js +312 -0
  186. package/src/BookReader/ModeThumb.js +29 -15
  187. package/src/BookReader/Navbar/Navbar.js +204 -84
  188. package/src/BookReader/PageContainer.js +120 -23
  189. package/src/BookReader/ReduceSet.js +2 -2
  190. package/src/BookReader/Toolbar/Toolbar.js +18 -40
  191. package/src/BookReader/events.js +3 -3
  192. package/src/BookReader/options.js +105 -18
  193. package/src/BookReader/utils/HTMLDimensionsCacher.js +44 -0
  194. package/src/BookReader/utils/ScrollClassAdder.js +31 -0
  195. package/src/BookReader/utils/SelectionObserver.js +72 -0
  196. package/src/BookReader/utils/classes.js +1 -1
  197. package/src/BookReader/utils.js +136 -12
  198. package/src/BookReader.js +732 -1231
  199. package/src/BookReaderPlugin.js +52 -0
  200. package/src/assets/icons/magnify-minus.svg +3 -7
  201. package/src/assets/icons/magnify-plus.svg +3 -7
  202. package/src/assets/icons/slider-toggle.svg +1 -0
  203. package/src/assets/icons/voice.svg +1 -0
  204. package/src/assets/images/hypothesis.ico +0 -0
  205. package/src/assets/images/icon_experiment.svg +1 -0
  206. package/src/assets/images/translate.svg +1 -0
  207. package/src/assets/images/unviewable_page.png +0 -0
  208. package/src/assets/silence.mp3 +0 -0
  209. package/src/css/BookReader.scss +1 -5
  210. package/src/css/_BRBookmarks.scss +1 -1
  211. package/src/css/_BRComponent.scss +1 -1
  212. package/src/css/_BRicon.scss +8 -2
  213. package/src/css/_BRmain.scss +16 -3
  214. package/src/css/_BRnav.scss +74 -70
  215. package/src/css/_BRpages.scss +174 -42
  216. package/src/css/_BRsearch.scss +69 -30
  217. package/src/css/_BRtoolbar.scss +5 -5
  218. package/src/css/_TextSelection.scss +249 -25
  219. package/src/css/_colorbox.scss +2 -2
  220. package/src/css/_controls.scss +24 -7
  221. package/src/css/_icons.scss +8 -1
  222. package/src/{BookNavigator/assets → css}/button-base.js +2 -2
  223. package/src/css/icon_checkmark.js +9 -0
  224. package/src/css/sharedStyles.js +15 -0
  225. package/src/ia-bookreader/downloads/downloads-provider.js +81 -0
  226. package/src/{BookNavigator → ia-bookreader}/downloads/downloads.js +25 -5
  227. package/src/ia-bookreader/ia-bookreader.js +686 -0
  228. package/src/ia-bookreader/sharing.js +27 -0
  229. package/src/ia-bookreader/viewable-files.js +98 -0
  230. package/src/{BookNavigator → ia-bookreader}/visual-adjustments/visual-adjustments-provider.js +17 -17
  231. package/src/{BookNavigator → ia-bookreader}/visual-adjustments/visual-adjustments.js +75 -67
  232. package/src/{BookNavigator → plugins}/bookmarks/bookmark-button.js +4 -3
  233. package/src/{BookNavigator/assets → plugins/bookmarks}/bookmark-colors.js +1 -1
  234. package/src/{BookNavigator → plugins}/bookmarks/bookmark-edit.js +43 -31
  235. package/src/{BookNavigator → plugins}/bookmarks/bookmarks-list.js +48 -49
  236. package/src/{BookNavigator → plugins}/bookmarks/bookmarks-loginCTA.js +3 -3
  237. package/src/plugins/bookmarks/bookmarks-provider.js +63 -0
  238. package/src/{BookNavigator → plugins/bookmarks}/delete-modal-actions.js +1 -1
  239. package/src/{BookNavigator → plugins}/bookmarks/ia-bookmarks.js +117 -68
  240. package/src/plugins/plugin.archive_analytics.js +84 -78
  241. package/src/plugins/plugin.autoplay.js +99 -104
  242. package/src/plugins/plugin.chapters.js +323 -205
  243. package/src/plugins/plugin.experiments.js +375 -0
  244. package/src/plugins/plugin.iframe.js +36 -37
  245. package/src/plugins/plugin.iiif.js +147 -0
  246. package/src/plugins/plugin.resume.js +54 -51
  247. package/src/plugins/plugin.text_selection.js +464 -219
  248. package/src/plugins/plugin.vendor-fullscreen.js +5 -5
  249. package/src/plugins/search/plugin.search.js +347 -397
  250. package/src/{BookNavigator → plugins}/search/search-provider.js +59 -27
  251. package/src/{BookNavigator → plugins}/search/search-results.js +105 -76
  252. package/src/plugins/search/utils.js +50 -0
  253. package/src/plugins/search/view.js +51 -69
  254. package/src/plugins/translate/TranslationManager.js +164 -0
  255. package/src/plugins/translate/plugin.translate.js +559 -0
  256. package/src/plugins/tts/AbstractTTSEngine.js +78 -49
  257. package/src/plugins/tts/FestivalTTSEngine.js +20 -30
  258. package/src/plugins/tts/PageChunk.js +117 -23
  259. package/src/plugins/tts/PageChunkIterator.js +11 -17
  260. package/src/plugins/tts/WebTTSEngine.js +132 -92
  261. package/src/plugins/tts/plugin.tts.js +341 -351
  262. package/src/plugins/tts/utils.js +76 -67
  263. package/src/plugins/url/UrlPlugin.js +213 -0
  264. package/src/plugins/{plugin.url.js → url/plugin.url.js} +54 -18
  265. package/src/util/TextSelectionManager.js +1464 -0
  266. package/src/util/browserSniffing.js +42 -1
  267. package/src/util/cache.js +20 -0
  268. package/src/util/docCookies.js +21 -2
  269. package/src/util/dom.js +88 -0
  270. package/src/util/generators.js +89 -0
  271. package/src/util/lit.js +15 -0
  272. package/src/util/strings.js +11 -0
  273. package/.babelrc +0 -12
  274. package/.dependabot/config.yml +0 -6
  275. package/.eslintrc.js +0 -50
  276. package/.gitattributes +0 -2
  277. package/.github/ISSUE_TEMPLATE/bug.md +0 -32
  278. package/.github/ISSUE_TEMPLATE/feature-request.md +0 -30
  279. package/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -15
  280. package/.github/workflows/node.js.yml +0 -37
  281. package/.github/workflows/npm-publish.yml +0 -47
  282. package/.testcaferc.json +0 -5
  283. package/BookReader/BookReader.js +0 -21613
  284. package/BookReader/BookReader.js.map +0 -1
  285. package/BookReader/bookreader-component-bundle.js +0 -14497
  286. package/BookReader/bookreader-component-bundle.js.LICENSE.txt +0 -38
  287. package/BookReader/bookreader-component-bundle.js.map +0 -1
  288. package/BookReader/jquery-1.10.1.js +0 -108
  289. package/BookReader/jquery-1.10.1.js.LICENSE.txt +0 -24
  290. package/BookReader/plugins/plugin.menu_toggle.js +0 -369
  291. package/BookReader/plugins/plugin.menu_toggle.js.map +0 -1
  292. package/BookReader/plugins/plugin.mobile_nav.js +0 -335
  293. package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
  294. package/BookReaderDemo/BookReaderDemo.css +0 -41
  295. package/BookReaderDemo/BookReaderJSAdvanced.js +0 -115
  296. package/BookReaderDemo/BookReaderJSAutoplay.js +0 -56
  297. package/BookReaderDemo/BookReaderJSSimple.js +0 -55
  298. package/BookReaderDemo/IIIFBookReader.js +0 -207
  299. package/BookReaderDemo/assets/v5/Bookreader-logo-cool-grad.svg +0 -1
  300. package/BookReaderDemo/assets/v5/Bookreader-logo-flat.svg +0 -1
  301. package/BookReaderDemo/assets/v5/Bookreader-logo-hex-cool-grad.png +0 -0
  302. package/BookReaderDemo/assets/v5/Bookreader-logo-hex-flat.png +0 -0
  303. package/BookReaderDemo/assets/v5/Bookreader-logo-lines.png +0 -0
  304. package/BookReaderDemo/assets/v5/Bookreader-logo-lines.svg +0 -1
  305. package/BookReaderDemo/assets/v5/Bookreader-logo-warm.svg +0 -1
  306. package/BookReaderDemo/assets/v5/bookreader-logo-renders@1x.png +0 -0
  307. package/BookReaderDemo/assets/v5/bookreader-logo-renders@2x.png +0 -0
  308. package/BookReaderDemo/assets/v5/bookreader-v5-screenshot.png +0 -0
  309. package/BookReaderDemo/bookreader-template-bundle.js +0 -7178
  310. package/BookReaderDemo/demo-advanced.html +0 -33
  311. package/BookReaderDemo/demo-autoplay.html +0 -38
  312. package/BookReaderDemo/demo-embed-iframe-src.html +0 -84
  313. package/BookReaderDemo/demo-embed.html +0 -26
  314. package/BookReaderDemo/demo-fullscreen-mobile.html +0 -36
  315. package/BookReaderDemo/demo-fullscreen.html +0 -33
  316. package/BookReaderDemo/demo-iiif.html +0 -34
  317. package/BookReaderDemo/demo-iiif.js +0 -26
  318. package/BookReaderDemo/demo-internetarchive.html +0 -74
  319. package/BookReaderDemo/demo-multiple.html +0 -43
  320. package/BookReaderDemo/demo-plugin-menu-toggle.html +0 -34
  321. package/BookReaderDemo/demo-preview-pages.html +0 -1092
  322. package/BookReaderDemo/demo-simple.html +0 -34
  323. package/BookReaderDemo/demo-vendor-fullscreen.html +0 -36
  324. package/BookReaderDemo/immersion-1up.html +0 -64
  325. package/BookReaderDemo/immersion-mode.html +0 -35
  326. package/BookReaderDemo/toggle_controls.html +0 -53
  327. package/BookReaderDemo/view_mode.html +0 -39
  328. package/BookReaderDemo/viewmode-cycle.html +0 -41
  329. package/CHANGELOG.md +0 -499
  330. package/CONTRIBUTING.md +0 -7
  331. package/codecov.yml +0 -17
  332. package/index.html +0 -31
  333. package/karma.conf.js +0 -23
  334. package/screenshot.png +0 -0
  335. package/scripts/postversion.js +0 -10
  336. package/scripts/preversion.js +0 -14
  337. package/scripts/version.js +0 -26
  338. package/src/BookNavigator/BookModel.js +0 -14
  339. package/src/BookNavigator/BookNavigator.js +0 -459
  340. package/src/BookNavigator/assets/book-loader.js +0 -27
  341. package/src/BookNavigator/assets/icon_checkmark.js +0 -6
  342. package/src/BookNavigator/assets/icon_close.js +0 -3
  343. package/src/BookNavigator/assets/icon_sort_ascending.js +0 -5
  344. package/src/BookNavigator/assets/icon_sort_descending.js +0 -5
  345. package/src/BookNavigator/assets/icon_sort_neutral.js +0 -5
  346. package/src/BookNavigator/assets/icon_volumes.js +0 -11
  347. package/src/BookNavigator/bookmarks/bookmarks-provider.js +0 -53
  348. package/src/BookNavigator/br-fullscreen-mgr.js +0 -83
  349. package/src/BookNavigator/downloads/downloads-provider.js +0 -66
  350. package/src/BookNavigator/search/a-search-result.js +0 -55
  351. package/src/BookNavigator/volumes/volumes-provider.js +0 -83
  352. package/src/BookNavigator/volumes/volumes.js +0 -178
  353. package/src/BookReader/DebugConsole.js +0 -54
  354. package/src/BookReaderComponent/BookReaderComponent.js +0 -112
  355. package/src/ItemNavigator/ItemNavigator.js +0 -376
  356. package/src/ItemNavigator/providers/sharing.js +0 -33
  357. package/src/css/_MobileNav.scss +0 -194
  358. package/src/dragscrollable-br.js +0 -261
  359. package/src/plugins/menu_toggle/plugin.menu_toggle.js +0 -324
  360. package/src/plugins/plugin.mobile_nav.js +0 -287
  361. package/tests/BookReader/BookModel.test.js +0 -312
  362. package/tests/BookReader/BookReaderPublicFunctions.test.js +0 -171
  363. package/tests/BookReader/DebugConsole.test.js +0 -25
  364. package/tests/BookReader/ImageCache.test.js +0 -150
  365. package/tests/BookReader/Mode1Up.test.js +0 -164
  366. package/tests/BookReader/Mode2Up.test.js +0 -247
  367. package/tests/BookReader/Navbar/Navbar.test.js +0 -169
  368. package/tests/BookReader/PageContainer.test.js +0 -115
  369. package/tests/BookReader/ReduceSet.test.js +0 -38
  370. package/tests/BookReader/Toolbar/Toolbar.test.js +0 -26
  371. package/tests/BookReader/utils/classes.test.js +0 -88
  372. package/tests/BookReader/utils.test.js +0 -109
  373. package/tests/BookReader.options.test.js +0 -39
  374. package/tests/BookReader.test.js +0 -301
  375. package/tests/e2e/README.md +0 -75
  376. package/tests/e2e/autoplay.test.js +0 -13
  377. package/tests/e2e/base.test.js +0 -35
  378. package/tests/e2e/helpers/base.js +0 -263
  379. package/tests/e2e/helpers/debug.js +0 -13
  380. package/tests/e2e/helpers/desktopSearch.js +0 -72
  381. package/tests/e2e/helpers/mobileSearch.js +0 -85
  382. package/tests/e2e/helpers/mockSearch.js +0 -93
  383. package/tests/e2e/helpers/rightToLeft.js +0 -29
  384. package/tests/e2e/ia-production/ia-prod-base.js +0 -17
  385. package/tests/e2e/models/BookReader.js +0 -11
  386. package/tests/e2e/models/Navigation.js +0 -56
  387. package/tests/e2e/rightToLeft.test.js +0 -20
  388. package/tests/e2e/viewmode.test.js +0 -37
  389. package/tests/karma/BookNavigator/book-navigator.test.js +0 -139
  390. package/tests/karma/BookNavigator/bookmarks/bookmark-edit.test.js +0 -133
  391. package/tests/karma/BookNavigator/bookmarks/bookmarks-list.test.js +0 -222
  392. package/tests/karma/BookNavigator/search/search-provider.test.js +0 -23
  393. package/tests/karma/BookNavigator/search/search-results.test.js +0 -240
  394. package/tests/karma/BookNavigator/sharing/sharing-provider.test.js +0 -40
  395. package/tests/karma/BookNavigator/visual-adjustments.test.js +0 -201
  396. package/tests/karma/BookNavigator/volumes/volumes-provider.test.js +0 -141
  397. package/tests/karma/BookNavigator/volumes/volumes.test.js +0 -98
  398. package/tests/plugins/menu_toggle/plugin.menu_toggle.test.js +0 -68
  399. package/tests/plugins/plugin.archive_analytics.test.js +0 -23
  400. package/tests/plugins/plugin.autoplay.test.js +0 -52
  401. package/tests/plugins/plugin.chapters.test.js +0 -130
  402. package/tests/plugins/plugin.iframe.test.js +0 -42
  403. package/tests/plugins/plugin.mobile_nav.test.js +0 -66
  404. package/tests/plugins/plugin.resume.test.js +0 -98
  405. package/tests/plugins/plugin.text_selection.test.js +0 -203
  406. package/tests/plugins/plugin.url.test.js +0 -129
  407. package/tests/plugins/plugin.vendor-fullscreen.test.js +0 -65
  408. package/tests/plugins/search/plugin.search.test.js +0 -173
  409. package/tests/plugins/search/plugin.search.view.test.js +0 -106
  410. package/tests/plugins/tts/AbstractTTSEngine.test.js +0 -153
  411. package/tests/plugins/tts/FestivalTTSEngine.test.js +0 -59
  412. package/tests/plugins/tts/PageChunk.test.js +0 -57
  413. package/tests/plugins/tts/PageChunkIterator.test.js +0 -179
  414. package/tests/plugins/tts/WebTTSEngine.test.js +0 -126
  415. package/tests/plugins/tts/utils.test.js +0 -133
  416. package/tests/util/browserSniffing.test.js +0 -56
  417. package/tests/util/docCookies.test.js +0 -15
  418. package/tests/util/strings.test.js +0 -63
  419. package/tests/utils.js +0 -42
  420. package/webpack.config.js +0 -86
@@ -1,1386 +1,3 @@
1
- (self["webpackChunk_internetarchive_bookreader"] = self["webpackChunk_internetarchive_bookreader"] || []).push([["plugins/plugin.search.js"],{
2
-
3
- /***/ "./src/plugins/search/plugin.search.js":
4
- /*!*********************************************!*\
5
- !*** ./src/plugins/search/plugin.search.js ***!
6
- \*********************************************/
7
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8
-
9
- "use strict";
10
- __webpack_require__.r(__webpack_exports__);
11
- /* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! regenerator-runtime/runtime.js */ "./node_modules/regenerator-runtime/runtime.js");
12
- /* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__);
13
- /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.regexp.exec.js */ "./node_modules/core-js/modules/es.regexp.exec.js");
14
- /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__);
15
- /* harmony import */ var core_js_modules_es_string_search_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.string.search.js */ "./node_modules/core-js/modules/es.string.search.js");
16
- /* harmony import */ var core_js_modules_es_string_search_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_search_js__WEBPACK_IMPORTED_MODULE_2__);
17
- /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.array.find.js */ "./node_modules/core-js/modules/es.array.find.js");
18
- /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_3__);
19
- /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.string.replace.js */ "./node_modules/core-js/modules/es.string.replace.js");
20
- /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_4__);
21
- /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.array.concat.js */ "./node_modules/core-js/modules/es.array.concat.js");
22
- /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_5__);
23
- /* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.object.assign.js */ "./node_modules/core-js/modules/es.object.assign.js");
24
- /* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_6__);
25
- /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js");
26
- /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7__);
27
- /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js");
28
- /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_8__);
29
- /* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! core-js/modules/es.promise.js */ "./node_modules/core-js/modules/es.promise.js");
30
- /* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_9__);
31
- /* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! core-js/modules/es.array.iterator.js */ "./node_modules/core-js/modules/es.array.iterator.js");
32
- /* harmony import */ var core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_iterator_js__WEBPACK_IMPORTED_MODULE_10__);
33
- /* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! core-js/modules/es.string.iterator.js */ "./node_modules/core-js/modules/es.string.iterator.js");
34
- /* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_11__);
35
- /* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ "./node_modules/core-js/modules/web.dom-collections.iterator.js");
36
- /* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_12__);
37
- /* harmony import */ var core_js_modules_web_url_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! core-js/modules/web.url.js */ "./node_modules/core-js/modules/web.url.js");
38
- /* harmony import */ var core_js_modules_web_url_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_url_js__WEBPACK_IMPORTED_MODULE_13__);
39
- /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ "./node_modules/core-js/modules/es.array.slice.js");
40
- /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_14__);
41
- /* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! core-js/modules/es.function.name.js */ "./node_modules/core-js/modules/es.function.name.js");
42
- /* harmony import */ var core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_name_js__WEBPACK_IMPORTED_MODULE_15__);
43
- /* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! core-js/modules/es.array.from.js */ "./node_modules/core-js/modules/es.array.from.js");
44
- /* harmony import */ var core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_from_js__WEBPACK_IMPORTED_MODULE_16__);
45
- /* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! core-js/modules/es.symbol.js */ "./node_modules/core-js/modules/es.symbol.js");
46
- /* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_17__);
47
- /* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! core-js/modules/es.symbol.description.js */ "./node_modules/core-js/modules/es.symbol.description.js");
48
- /* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_18__);
49
- /* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ "./node_modules/core-js/modules/es.symbol.iterator.js");
50
- /* harmony import */ var core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_iterator_js__WEBPACK_IMPORTED_MODULE_19__);
51
- /* harmony import */ var _view_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./view.js */ "./src/plugins/search/view.js");
52
- /* provided dependency */ var jQuery = __webpack_require__(/*! jquery */ "jquery");
53
- /* provided dependency */ var $ = __webpack_require__(/*! jquery */ "jquery");
54
-
55
-
56
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
57
-
58
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
59
-
60
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
61
-
62
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
63
-
64
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
- /* global BookReader */
87
-
88
- /**
89
- * Plugin for Archive.org book search
90
- * NOTE: This script must be loaded AFTER `plugin.mobile_nav.js`
91
- * as it mutates mobile nav drawer
92
- *
93
- * Events fired at various points throughout search processing are published
94
- * on the document DOM element. These can be subscribed to using jQuery's event
95
- * binding method `$.fn.on`. All of the events are prefixed with a BookReader
96
- * namespace. The events are:
97
- *
98
- * @event BookReader:SearchStarted - When a search form is submitted, immediately
99
- * before an AJAX call is made to request search results
100
- * @event BookReader:SearchCallback - When the search AJAX call is returned and at
101
- * least one result is returned. The event callback receives an object
102
- * with the `results`, plugin `options`, and the BookReader `instance`
103
- * @event BookReader:SearchCallbackError - When the AJAX request returns an error.
104
- * Receives the `results` and `instance`
105
- * @event BookReader:SearchCallbackNotIndexed - When a message is received that
106
- * the book has not had OCR text indexed yet. Receives `instance`
107
- * @event BookReader:SearchCallbackEmpty - When no results found. Receives
108
- * `instance`
109
- * @event BookReader:SearchCanceled - When no results found. Receives
110
- * `instance`
111
- */
112
-
113
- jQuery.extend(BookReader.defaultOptions, {
114
- server: 'ia600609.us.archive.org',
115
- bookId: '',
116
- subPrefix: '',
117
- bookPath: '',
118
- enableSearch: true,
119
- searchInsideUrl: '/fulltext/inside.php',
120
- initialSearchTerm: null
121
- });
122
- /** @override */
123
-
124
- BookReader.prototype.setup = function (super_) {
125
- return function (options) {
126
- var _this = this;
127
-
128
- super_.call(this, options);
129
- this.searchTerm = '';
130
- this.searchResults = null;
131
- this.searchInsideUrl = options.searchInsideUrl;
132
- this.enableSearch = options.enableSearch; // Base server used by some api calls
133
-
134
- this.bookId = options.bookId;
135
- this.server = options.server;
136
- this.subPrefix = options.subPrefix;
137
- this.bookPath = options.bookPath;
138
- this.searchXHR = null;
139
-
140
- this._cancelSearch.bind(this);
141
-
142
- this.cancelSearchRequest.bind(this);
143
-
144
- if (this.searchView) {
145
- return;
146
- }
147
-
148
- this.searchView = new _view_js__WEBPACK_IMPORTED_MODULE_20__.default({
149
- br: this,
150
- searchCancelledCallback: function searchCancelledCallback() {
151
- _this._cancelSearch();
152
-
153
- _this.trigger('SearchCanceled', {
154
- term: _this.searchTerm,
155
- instance: _this
156
- });
157
- }
158
- });
159
- };
160
- }(BookReader.prototype.setup);
161
- /** @override */
162
-
163
-
164
- BookReader.prototype.init = function (super_) {
165
- return function () {
166
- super_.call(this);
167
-
168
- if (this.options.enableSearch && this.options.initialSearchTerm) {
169
- this.search(this.options.initialSearchTerm, {
170
- goToFirstResult: this.options.goToFirstResult,
171
- suppressFragmentChange: true
172
- });
173
- }
174
- };
175
- }(BookReader.prototype.init);
176
- /** @override */
177
-
178
-
179
- BookReader.prototype.buildToolbarElement = function (super_) {
180
- return function () {
181
- var $el = super_.call(this);
182
-
183
- if (!this.enableSearch) {
184
- return;
185
- }
186
-
187
- if (this.searchView.dom.toolbarSearch) {
188
- $el.find('.BRtoolbarSectionInfo').after(this.searchView.dom.toolbarSearch);
189
- }
190
-
191
- return $el;
192
- };
193
- }(BookReader.prototype.buildToolbarElement);
194
- /**
195
- * @typedef {object} SearchOptions
196
- * @property {boolean} goToFirstResult
197
- * @property {boolean} disablePopup
198
- * @property {(null|function)} error - @deprecated at v.5.0
199
- * @property {(null|function)} success - @deprecated at v.5.0
200
- */
201
-
202
- /**
203
- * Submits search request
204
- *
205
- * @param {string} term
206
- * @param {SearchOptions} overrides
207
- */
208
-
209
-
210
- BookReader.prototype.search = function () {
211
- var _this2 = this;
212
-
213
- var term = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
214
- var overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
215
-
216
- /** @type {SearchOptions} */
217
- var defaultOptions = {
218
- goToFirstResult: false,
219
-
220
- /* jump to the first result (default=false) */
221
- disablePopup: false,
222
-
223
- /* don't show the modal progress (default=false) */
224
- suppressFragmentChange: false,
225
-
226
- /* don't change the URL on initial load */
227
- error: null,
228
-
229
- /* optional error handler (default=null) */
230
- success: null
231
- /* optional success handler (default=null) */
232
-
233
- };
234
- var options = jQuery.extend({}, defaultOptions, overrides);
235
- this.suppressFragmentChange = options.suppressFragmentChange; // strip slashes, since this goes in the url
236
-
237
- this.searchTerm = term.replace(/\//g, ' ');
238
-
239
- if (!options.suppressFragmentChange) {
240
- this.trigger(BookReader.eventNames.fragmentChange);
241
- } // Add quotes to the term. This is to compenstate for the backends default OR query
242
- // term = term.replace(/['"]+/g, '');
243
- // term = '"' + term + '"';
244
- // Remove the port and userdir
245
-
246
-
247
- var serverPath = this.server.replace(/:.+/, '');
248
- var baseUrl = "https://".concat(serverPath).concat(this.searchInsideUrl, "?"); // Remove subPrefix from end of path
249
-
250
- var path = this.bookPath;
251
- var subPrefixWithSlash = "/".concat(this.subPrefix);
252
-
253
- if (this.bookPath.length - this.bookPath.lastIndexOf(subPrefixWithSlash) == subPrefixWithSlash.length) {
254
- path = this.bookPath.substr(0, this.bookPath.length - subPrefixWithSlash.length);
255
- }
256
-
257
- var urlParams = {
258
- item_id: this.bookId,
259
- doc: this.subPrefix,
260
- path: path,
261
- q: term
262
- }; // NOTE that the API does not expect / (slashes) to be encoded. (%2F) won't work
263
-
264
- var paramStr = $.param(urlParams).replace(/%2F/g, '/');
265
- var url = "".concat(baseUrl).concat(paramStr);
266
-
267
- var cleanup = function cleanup() {
268
- _this2.searchXHR = null;
269
-
270
- window.BRSearchInProgress = function () {};
271
- };
272
-
273
- var processSearchResults = function processSearchResults(searchInsideResults) {
274
- if (!_this2.searchXHR) {
275
- return;
276
- }
277
-
278
- var responseHasError = searchInsideResults.error || !searchInsideResults.matches.length;
279
- var hasCustomError = typeof options.error === 'function';
280
- var hasCustomSuccess = typeof options.success === 'function';
281
-
282
- if (responseHasError) {
283
- hasCustomError ? options.error.call(_this2, searchInsideResults, options) : _this2.BRSearchCallbackError(searchInsideResults, options);
284
- } else {
285
- hasCustomSuccess ? options.success.call(_this2, searchInsideResults, options) : _this2.BRSearchCallback(searchInsideResults, options);
286
- }
287
-
288
- cleanup();
289
- };
290
-
291
- var beforeSend = function beforeSend(xhr) {
292
- _this2.searchXHR = xhr;
293
- window.BRSearchInProgress = processSearchResults;
294
- };
295
-
296
- this.trigger('SearchStarted', {
297
- term: this.searchTerm,
298
- instance: this
299
- });
300
- return $.ajax({
301
- url: url,
302
- dataType: 'jsonp',
303
- beforeSend: beforeSend,
304
- jsonpCallback: 'BRSearchInProgress'
305
- }).then(processSearchResults);
306
- };
307
- /**
308
- * cancels AJAX Call
309
- * emits custom event
310
- */
311
-
312
-
313
- BookReader.prototype._cancelSearch = function () {
314
- var _this$searchXHR;
315
-
316
- (_this$searchXHR = this.searchXHR) === null || _this$searchXHR === void 0 ? void 0 : _this$searchXHR.abort();
317
- this.searchView.clearSearchFieldAndResults(false);
318
- this.searchTerm = '';
319
- this.searchXHR = null;
320
- this.searchResults = [];
321
-
322
- window.BRSearchInProgress = function () {};
323
- };
324
- /**
325
- * External function to cancel search
326
- * checks for term & xhr in flight before running
327
- */
328
-
329
-
330
- BookReader.prototype.cancelSearchRequest = function () {
331
- if (this.searchXHR !== null) {
332
- this._cancelSearch();
333
-
334
- this.searchView.toggleSearchPending();
335
- this.trigger('SearchCanceled', {
336
- term: this.searchTerm,
337
- instance: this
338
- });
339
- }
340
- };
341
- /**
342
- * @typedef {object} SearchInsideMatchBox
343
- * @property {number} page
344
- * @property {number} r
345
- * @property {number} l
346
- * @property {number} b
347
- * @property {number} t
348
- * @property {HTMLDivElement} [div]
349
- */
350
-
351
- /**
352
- * @typedef {object} SearchInsideMatch
353
- * @property {string} text
354
- * @property {Array<{ page: number, boxes: SearchInsideMatchBox[] }>} par
355
- */
356
-
357
- /**
358
- * @typedef {object} SearchInsideResults
359
- * @property {string} error
360
- * @property {SearchInsideMatch[]} matches
361
- * @property {boolean} indexed
362
- */
363
-
364
- /**
365
- * Search Results return handler
366
- * @callback
367
- * @param {SearchInsideResults} results
368
- * @param {object} options
369
- * @param {boolean} options.goToFirstResult
370
- */
371
-
372
-
373
- BookReader.prototype.BRSearchCallback = function (results, options) {
374
- this.searchResults = results || [];
375
- this.updateSearchHilites();
376
- this.removeProgressPopup();
377
-
378
- if (options.goToFirstResult) {
379
- var pageIndex = this._models.book.leafNumToIndex(results.matches[0].par[0].page);
380
-
381
- this._searchPluginGoToResult(pageIndex);
382
- }
383
-
384
- this.trigger('SearchCallback', {
385
- results: results,
386
- options: options,
387
- instance: this
388
- });
389
- };
390
- /**
391
- * Main search results error handler
392
- * @callback
393
- * @param {SearchInsideResults} results
394
- */
395
-
396
-
397
- BookReader.prototype.BRSearchCallbackError = function (results) {
398
- this._BRSearchCallbackError(results);
399
- };
400
- /**
401
- * @private draws search results error
402
- * @callback
403
- * @param {SearchInsideResults} results
404
- * @param {jQuery} $el
405
- * @param {boolean} fade
406
- */
407
-
408
-
409
- BookReader.prototype._BRSearchCallbackError = function (results) {
410
- this.searchResults = results;
411
- var basePayload = {
412
- term: this.searchTerm,
413
- instance: this
414
- };
415
-
416
- if (results.error) {
417
- var payload = Object.assign({}, basePayload, {
418
- results: results
419
- });
420
- this.trigger('SearchCallbackError', payload);
421
- } else if (0 == results.matches.length) {
422
- if (false === results.indexed) {
423
- this.trigger('SearchCallbackBookNotIndexed', basePayload);
424
- return;
425
- }
426
-
427
- this.trigger('SearchCallbackEmpty', basePayload);
428
- }
429
- };
430
- /**
431
- * updates search on-page highlights controller
432
- */
433
-
434
-
435
- BookReader.prototype.updateSearchHilites = function () {
436
- if (this.constMode2up == this.mode) {
437
- this.updateSearchHilites2UP();
438
- return;
439
- }
440
-
441
- this.updateSearchHilites1UP();
442
- };
443
- /**
444
- * update search on-page highlights in 1up mode
445
- */
446
-
447
-
448
- BookReader.prototype.updateSearchHilites1UP = function () {
449
- var _results$matches,
450
- _this3 = this;
451
-
452
- var results = this.searchResults;
453
- if (null == results) return;
454
- (_results$matches = results.matches) === null || _results$matches === void 0 ? void 0 : _results$matches.forEach(function (match) {
455
- match.par[0].boxes.forEach(function (box) {
456
- var pageIndex = _this3.leafNumToIndex(box.page);
457
-
458
- var pageIsInView = jQuery.inArray(pageIndex, _this3.displayedIndices) >= 0;
459
-
460
- if (pageIsInView) {
461
- if (!box.div) {
462
- //create a div for the search highlight, and stash it in the box object
463
- box.div = document.createElement('div');
464
- $(box.div).prop('className', 'BookReaderSearchHilite').appendTo(_this3.$(".pagediv".concat(pageIndex)));
465
- }
466
-
467
- var page = _this3._models.book.getPage(pageIndex);
468
-
469
- var highlight = {
470
- width: _this3._modes.mode1Up.physicalInchesToDisplayPixels((box.r - box.l) / page.ppi),
471
- height: _this3._modes.mode1Up.physicalInchesToDisplayPixels((box.b - box.t) / page.ppi),
472
- left: _this3._modes.mode1Up.physicalInchesToDisplayPixels(box.l / page.ppi),
473
- top: _this3._modes.mode1Up.physicalInchesToDisplayPixels(box.t / page.ppi)
474
- };
475
- $(box.div).css(highlight);
476
- } else {
477
- if (box.div) {
478
- $(box.div).remove();
479
- box.div = null;
480
- }
481
- }
482
- });
483
- });
484
- };
485
- /**
486
- * update search on-page highlights in 2up mode
487
- */
488
-
489
-
490
- BookReader.prototype.updateSearchHilites2UP = function () {
491
- var _this4 = this;
492
-
493
- var results = this.searchResults;
494
- if (results === null) return;
495
- var _results$matches2 = results.matches,
496
- matches = _results$matches2 === void 0 ? [] : _results$matches2;
497
- matches.forEach(function (match) {
498
- match.par[0].boxes.forEach(function (box) {
499
- var pageIndex = _this4.leafNumToIndex(match.par[0].page);
500
-
501
- var pageIsInView = jQuery.inArray(pageIndex, _this4.displayedIndices) >= 0;
502
-
503
- var _this4$_models$book$g = _this4._models.book.getPage(pageIndex),
504
- isViewable = _this4$_models$book$g.isViewable;
505
-
506
- if (pageIsInView && isViewable) {
507
- if (!box.div) {
508
- //create a div for the search highlight, and stash it in the box object
509
- box.div = document.createElement('div');
510
- $(box.div).addClass('BookReaderSearchHilite').appendTo(_this4.refs.$brTwoPageView);
511
- }
512
-
513
- _this4.setHilightCss2UP(box.div, pageIndex, box.l, box.r, box.t, box.b);
514
- } else {
515
- // clear stale reference
516
- if (box.div) {
517
- $(box.div).remove();
518
- box.div = null;
519
- }
520
- }
521
- });
522
- });
523
- };
524
- /**
525
- * remove search highlights
526
- */
527
-
528
-
529
- BookReader.prototype.removeSearchHilites = function () {
530
- var results = this.searchResults;
531
-
532
- if (null == results || !results.matches) {
533
- return;
534
- }
535
-
536
- results.matches.forEach(function (match) {
537
- match.par[0].boxes.forEach(function (box) {
538
- if (null != box.div) {
539
- $(box.div).remove();
540
- box.div = null;
541
- }
542
- });
543
- });
544
- };
545
- /**
546
- * @private
547
- * Goes to the page specified. If the page is not viewable, tries to load the page
548
- * FIXME Most of this logic is IA specific, and should be less integrated into here
549
- * or at least more configurable.
550
- * @param {PageIndex} pageIndex
551
- */
552
-
553
-
554
- BookReader.prototype._searchPluginGoToResult = /*#__PURE__*/function () {
555
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(pageIndex) {
556
- var book, page, makeUnviewableAtEnd, resp, _iterator, _step, leafNum;
557
-
558
- return regeneratorRuntime.wrap(function _callee$(_context) {
559
- while (1) {
560
- switch (_context.prev = _context.next) {
561
- case 0:
562
- book = this._models.book;
563
- page = book.getPage(pageIndex);
564
- makeUnviewableAtEnd = false;
565
-
566
- if (page.isViewable) {
567
- _context.next = 10;
568
- break;
569
- }
570
-
571
- _context.next = 6;
572
- return fetch('/services/bookreader/request_page?' + new URLSearchParams({
573
- id: this.options.bookId,
574
- subprefix: this.options.subPrefix,
575
- leafNum: page.leafNum
576
- })).then(function (r) {
577
- return r.json();
578
- });
579
-
580
- case 6:
581
- resp = _context.sent;
582
- _iterator = _createForOfIteratorHelper(resp.value);
583
-
584
- try {
585
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
586
- leafNum = _step.value;
587
- book.getPage(book.leafNumToIndex(leafNum)).makeViewable();
588
- } // not able to show page; make the page viewable anyways so that it can
589
- // actually open. On IA, it has a fallback to a special error page.
590
-
591
- } catch (err) {
592
- _iterator.e(err);
593
- } finally {
594
- _iterator.f();
595
- }
596
-
597
- if (!resp.value.length) {
598
- book.getPage(pageIndex).makeViewable();
599
- makeUnviewableAtEnd = true;
600
- }
601
-
602
- case 10:
603
- /* this updates the URL */
604
- this.suppressFragmentChange = false;
605
- this.jumpToIndex(pageIndex); // Reset it to unviewable if it wasn't resolved
606
-
607
- if (makeUnviewableAtEnd) {
608
- book.getPage(pageIndex).makeViewable(false);
609
- }
610
-
611
- case 13:
612
- case "end":
613
- return _context.stop();
614
- }
615
- }
616
- }, _callee, this);
617
- }));
618
-
619
- return function (_x) {
620
- return _ref.apply(this, arguments);
621
- };
622
- }();
623
- /**
624
- * Removes all search pins
625
- */
626
-
627
-
628
- BookReader.prototype.removeSearchResults = function () {
629
- var suppressFragmentChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
630
- this.removeSearchHilites(); //be sure to set all box.divs to null
631
-
632
- this.searchTerm = null;
633
- this.searchResults = null;
634
-
635
- if (!suppressFragmentChange) {
636
- this.trigger(BookReader.eventNames.fragmentChange);
637
- }
638
- };
639
- /**
640
- * Returns true if a search highlight is currently being displayed
641
- * @returns {boolean}
642
- */
643
-
644
-
645
- BookReader.prototype.searchHighlightVisible = function () {
646
- var _this5 = this;
647
-
648
- var results = this.searchResults;
649
- var visiblePages = [];
650
- if (null == results) return false;
651
-
652
- if (this.constMode2up == this.mode) {
653
- visiblePages = [this.twoPage.currentIndexL, this.twoPage.currentIndexR];
654
- } else if (this.constMode1up == this.mode) {
655
- visiblePages = [this.currentIndex()];
656
- } else {
657
- return false;
658
- }
659
-
660
- results.matches.some(function (match) {
661
- return match.par[0].boxes.some(function (box) {
662
- var pageIndex = _this5.leafNumToIndex(box.page);
663
-
664
- if (jQuery.inArray(pageIndex, visiblePages) >= 0) {
665
- return true;
666
- }
667
- });
668
- });
669
- return false;
670
- };
671
-
672
- /***/ }),
673
-
674
- /***/ "./src/plugins/search/view.js":
675
- /*!************************************!*\
676
- !*** ./src/plugins/search/view.js ***!
677
- \************************************/
678
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
679
-
680
- "use strict";
681
- __webpack_require__.r(__webpack_exports__);
682
- /* harmony import */ var core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ "./node_modules/core-js/modules/es.regexp.constructor.js");
683
- /* harmony import */ var core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_constructor_js__WEBPACK_IMPORTED_MODULE_0__);
684
- /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.regexp.exec.js */ "./node_modules/core-js/modules/es.regexp.exec.js");
685
- /* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_1__);
686
- /* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ "./node_modules/core-js/modules/es.regexp.to-string.js");
687
- /* harmony import */ var core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_2__);
688
- /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.array.concat.js */ "./node_modules/core-js/modules/es.array.concat.js");
689
- /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_3__);
690
- /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.array.map.js */ "./node_modules/core-js/modules/es.array.map.js");
691
- /* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_4__);
692
- /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ "./node_modules/core-js/modules/es.array.slice.js");
693
- /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_5__);
694
- /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.array.find.js */ "./node_modules/core-js/modules/es.array.find.js");
695
- /* harmony import */ var core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_js__WEBPACK_IMPORTED_MODULE_6__);
696
- /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js");
697
- /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_7__);
698
- /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! core-js/modules/es.string.replace.js */ "./node_modules/core-js/modules/es.string.replace.js");
699
- /* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_8__);
700
- /* harmony import */ var core_js_modules_es_string_search_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! core-js/modules/es.string.search.js */ "./node_modules/core-js/modules/es.string.search.js");
701
- /* harmony import */ var core_js_modules_es_string_search_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_search_js__WEBPACK_IMPORTED_MODULE_9__);
702
- /* provided dependency */ var $ = __webpack_require__(/*! jquery */ "jquery");
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
-
712
-
713
-
714
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
715
-
716
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
717
-
718
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
719
-
720
- var SearchView = /*#__PURE__*/function () {
721
- /**
722
- * @param {object} params
723
- * @param {object} params.br The BookReader instance
724
- * @param {function} params.cancelSearch callback when a user wants to cancel search
725
- *
726
- * @event BookReader:SearchResultsCleared - when the search results nav gets cleared
727
- * @event BookReader:ToggleSearchMenu - when search results menu should toggle
728
- */
729
- function SearchView(_ref) {
730
- var br = _ref.br,
731
- _ref$searchCancelledC = _ref.searchCancelledCallback,
732
- searchCancelledCallback = _ref$searchCancelledC === void 0 ? function () {} : _ref$searchCancelledC;
733
-
734
- _classCallCheck(this, SearchView);
735
-
736
- this.br = br; // Search results are returned as a text blob with the hits wrapped in
737
- // triple mustaches. Hits occasionally include text beyond the search
738
- // term, so everything within the staches is captured and wrapped.
739
-
740
- this.matcher = new RegExp('{{{(.+?)}}}', 'g');
741
- this.matches = [];
742
- this.cacheDOMElements();
743
- this.bindEvents();
744
- this.cancelSearch = searchCancelledCallback;
745
- }
746
-
747
- _createClass(SearchView, [{
748
- key: "cacheDOMElements",
749
- value: function cacheDOMElements() {
750
- this.dom = {}; // Search input within the top toolbar. Will be removed once the mobile menu is replaced.
751
-
752
- this.dom.toolbarSearch = this.buildToolbarSearch();
753
- }
754
- /**
755
- * @param {string} query
756
- */
757
-
758
- }, {
759
- key: "setQuery",
760
- value: function setQuery(query) {
761
- this.br.$('[name="query"]').val(query);
762
- }
763
- }, {
764
- key: "emptyMatches",
765
- value: function emptyMatches() {
766
- this.matches = [];
767
- }
768
- }, {
769
- key: "removeResultPins",
770
- value: function removeResultPins() {
771
- this.br.$('.BRnavpos .BRsearch').remove();
772
- }
773
- }, {
774
- key: "clearSearchFieldAndResults",
775
- value: function clearSearchFieldAndResults() {
776
- var dispatchEventWhenComplete = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
777
- this.br.removeSearchResults();
778
- this.removeResultPins();
779
- this.emptyMatches();
780
- this.setQuery('');
781
- this.teardownSearchNavigation();
782
-
783
- if (dispatchEventWhenComplete) {
784
- this.br.trigger('SearchResultsCleared');
785
- }
786
- }
787
- }, {
788
- key: "toggleSidebar",
789
- value: function toggleSidebar() {
790
- this.br.trigger('ToggleSearchMenu');
791
- }
792
- }, {
793
- key: "renderSearchNavigation",
794
- value: function renderSearchNavigation() {
795
- var selector = 'BRsearch-navigation';
796
- $('.BRnav').before("\n <div class=\"".concat(selector, "\">\n <button class=\"toggle-sidebar\">\n <h4>\n <span class=\"icon icon-search\"></span> Results\n </h4>\n </button>\n <div class=\"pagination\">\n <button class=\"prev\" title=\"Previous result\"><span class=\"icon icon-chevron hflip\"></span></button>\n <span data-id=\"resultsCount\">").concat(this.resultsPosition(), "</span>\n <button class=\"next\" title=\"Next result\"><span class=\"icon icon-chevron\"></button>\n </div>\n <button class=\"clear\" title=\"Clear search results\">\n <span class=\"icon icon-close\"></span>\n </button>\n </div>\n "));
797
- this.dom.searchNavigation = $(".".concat(selector));
798
- }
799
- }, {
800
- key: "resultsPosition",
801
- value: function resultsPosition() {
802
- var positionMessage = "".concat(this.matches.length, " result").concat(this.matches.length === 1 ? '' : 's');
803
-
804
- if (~this.currentMatchIndex) {
805
- positionMessage = "".concat(this.currentMatchIndex + 1, " / ").concat(this.matches.length);
806
- }
807
-
808
- return positionMessage;
809
- }
810
- }, {
811
- key: "bindSearchNavigationEvents",
812
- value: function bindSearchNavigationEvents() {
813
- if (!this.dom.searchNavigation) {
814
- return;
815
- }
816
-
817
- var namespace = 'searchNavigation';
818
- this.dom.searchNavigation.on("click.".concat(namespace), '.clear', this.clearSearchFieldAndResults.bind(this)).on("click.".concat(namespace), '.prev', this.showPrevResult.bind(this)).on("click.".concat(namespace), '.next', this.showNextResult.bind(this)).on("click.".concat(namespace), '.toggle-sidebar', this.toggleSidebar.bind(this)).on("click.".concat(namespace), false);
819
- }
820
- }, {
821
- key: "showPrevResult",
822
- value: function showPrevResult() {
823
- if (this.currentMatchIndex === 0) {
824
- return;
825
- }
826
-
827
- if (this.br.mode === this.br.constModeThumb) {
828
- this.br.switchMode(this.br.constMode1up);
829
- }
830
-
831
- if (!~this.currentMatchIndex) {
832
- this.currentMatchIndex = this.getClosestMatchIndex(function (start, end, comparator) {
833
- return end[0] > comparator;
834
- }) + 1;
835
- }
836
-
837
- this.br.$('.BRnavline .BRsearch').eq(--this.currentMatchIndex).click();
838
- this.updateResultsPosition();
839
- this.updateSearchNavigationButtons();
840
- }
841
- }, {
842
- key: "showNextResult",
843
- value: function showNextResult() {
844
- if (this.currentMatchIndex + 1 === this.matches.length) {
845
- return;
846
- }
847
-
848
- if (this.br.mode === this.br.constModeThumb) {
849
- this.br.switchMode(this.br.constMode1up);
850
- }
851
-
852
- if (!~this.currentMatchIndex) {
853
- this.currentMatchIndex = this.getClosestMatchIndex(function (start, end, comparator) {
854
- return start[start.length - 1] > comparator;
855
- }) - 1;
856
- }
857
-
858
- this.br.$('.BRnavline .BRsearch').eq(++this.currentMatchIndex).click();
859
- this.updateResultsPosition();
860
- this.updateSearchNavigationButtons();
861
- }
862
- /**
863
- * Obtains closest match based on the logical comparison function passed in.
864
- * When the comparison function returns true, the starting (left) half of the
865
- * matches array is used in the binary split, else the ending (right) half is
866
- * used. A recursive call is made to perform the same split and comparison
867
- * on the winning half of the matches. This is traditionally known as binary
868
- * search (https://en.wikipedia.org/wiki/Binary_search_algorithm), and in
869
- * most cases (medium to large search result arrays) should outperform
870
- * traversing the array from start to finish. In the case of small arrays,
871
- * the speed difference is negligible.
872
- *
873
- * @param {function} comparisonFn
874
- * @return {number} matchIndex
875
- */
876
-
877
- }, {
878
- key: "getClosestMatchIndex",
879
- value: function getClosestMatchIndex(comparisonFn) {
880
- var matchPages = this.matches.map(function (m) {
881
- return m.par[0].page;
882
- });
883
- var currentPage = this.br.currentIndex() + 1;
884
-
885
- var closestTo = function closestTo(pool, comparator) {
886
- if (pool.length === 1) {
887
- return pool[0];
888
- }
889
-
890
- var start = pool.slice(0, pool.length / 2);
891
- var end = pool.slice(pool.length / 2);
892
- return closestTo(comparisonFn(start, end, comparator) ? start : end, comparator);
893
- };
894
-
895
- var closestPage = closestTo(matchPages, currentPage);
896
- return this.matches.indexOf(this.matches.find(function (m) {
897
- return m.par[0].page === closestPage;
898
- }));
899
- }
900
- }, {
901
- key: "updateResultsPosition",
902
- value: function updateResultsPosition() {
903
- this.dom.searchNavigation.find('[data-id=resultsCount]').text(this.resultsPosition());
904
- }
905
- }, {
906
- key: "updateSearchNavigationButtons",
907
- value: function updateSearchNavigationButtons() {
908
- this.dom.searchNavigation.find('.prev').attr('disabled', !this.currentMatchIndex);
909
- this.dom.searchNavigation.find('.next').attr('disabled', this.currentMatchIndex + 1 === this.matches.length);
910
- }
911
- }, {
912
- key: "teardownSearchNavigation",
913
- value: function teardownSearchNavigation() {
914
- if (!this.dom.searchNavigation) {
915
- this.dom.searchNavigation = $('.BRsearch-navigation');
916
- }
917
-
918
- if (!this.dom.searchNavigation.length) {
919
- return;
920
- }
921
-
922
- this.dom.searchNavigation.off('.searchNavigation').remove();
923
- this.dom.searchNavigation = null;
924
- this.br.resize();
925
- }
926
- }, {
927
- key: "setCurrentMatchIndex",
928
- value: function setCurrentMatchIndex() {
929
- var matchingSearchResult;
930
-
931
- if (this.br.mode === this.br.constModeThumb) {
932
- this.currentMatchIndex = -1;
933
- return;
934
- }
935
-
936
- if (this.br.mode === this.br.constMode2up) {
937
- matchingSearchResult = this.find2upMatchingSearchResult();
938
- } else {
939
- matchingSearchResult = this.find1upMatchingSearchResult();
940
- }
941
-
942
- this.currentMatchIndex = this.matches.indexOf(matchingSearchResult);
943
- }
944
- }, {
945
- key: "find1upMatchingSearchResult",
946
- value: function find1upMatchingSearchResult() {
947
- var _this = this;
948
-
949
- return this.matches.find(function (m) {
950
- return _this.br.currentIndex() === m.par[0].page - 1;
951
- });
952
- }
953
- }, {
954
- key: "find2upMatchingSearchResult",
955
- value: function find2upMatchingSearchResult() {
956
- var _this2 = this;
957
-
958
- return this.matches.find(function (m) {
959
- return _this2.br._isIndexDisplayed(m.par[0].page - 1);
960
- });
961
- }
962
- }, {
963
- key: "updateSearchNavigation",
964
- value: function updateSearchNavigation() {
965
- if (!this.matches.length) {
966
- return;
967
- }
968
-
969
- this.setCurrentMatchIndex();
970
- this.updateResultsPosition();
971
- this.updateSearchNavigationButtons();
972
- }
973
- /**
974
- * @param {boolean} bool
975
- */
976
-
977
- }, {
978
- key: "togglePinsFor",
979
- value: function togglePinsFor(bool) {
980
- var pinsVisibleState = bool ? 'visible' : 'hidden';
981
- this.br.refs.$BRfooter.find('.BRsearch').css({
982
- visibility: pinsVisibleState
983
- });
984
- }
985
- }, {
986
- key: "buildToolbarSearch",
987
- value: function buildToolbarSearch() {
988
- var toolbarSearch = document.createElement('span');
989
- toolbarSearch.classList.add('BRtoolbarSection', 'BRtoolbarSectionSearch');
990
- toolbarSearch.innerHTML = "\n <form class=\"BRbooksearch desktop\">\n <input type=\"search\" name=\"query\" class=\"BRsearchInput\" value=\"\" placeholder=\"Search inside\"/>\n <button type=\"submit\" class=\"BRsearchSubmit\">\n <img src=\"".concat(this.br.imagesBaseURL, "icon_search_button.svg\" />\n </button>\n </form>\n ");
991
- return toolbarSearch;
992
- }
993
- /**
994
- * @param {array} matches
995
- */
996
-
997
- }, {
998
- key: "renderPins",
999
- value: function renderPins(matches) {
1000
- var _this3 = this;
1001
-
1002
- matches.forEach(function (match) {
1003
- var queryString = match.text;
1004
-
1005
- var pageIndex = _this3.br.leafNumToIndex(match.par[0].page);
1006
-
1007
- var pageNumber = _this3.br.getPageNum(pageIndex);
1008
-
1009
- var uiStringSearch = "Search result"; // i18n
1010
-
1011
- var uiStringPage = "Page"; // i18n
1012
-
1013
- var percentThrough = _this3.br.constructor.util.cssPercentage(pageIndex, _this3.br.getNumLeafs() - 1);
1014
-
1015
- var queryStringWithB = queryString.replace(_this3.matcher, '<b>$1</b>');
1016
- var queryStringWithBTruncated = '';
1017
-
1018
- if (queryString.length > 100) {
1019
- queryStringWithBTruncated = queryString.replace(/^(.{100}[^\s]*).*/, "$1").replace(_this3.matcher, '<b>$1</b>') + '...';
1020
- } // draw marker
1021
-
1022
-
1023
- $('<div>').addClass('BRsearch').css({
1024
- left: percentThrough
1025
- }).attr('title', uiStringSearch).append("\n <div class=\"BRquery\">\n <div>".concat(queryStringWithBTruncated || queryStringWithB, "</div>\n <div>").concat(uiStringPage, " ").concat(pageNumber, "</div>\n </div>\n ")).data({
1026
- pageIndex: pageIndex
1027
- }).appendTo(_this3.br.$('.BRnavline')).hover(function (event) {
1028
- // remove from other markers then turn on just for this
1029
- // XXX should be done when nav slider moves
1030
- var marker = event.currentTarget;
1031
- var tooltip = marker.querySelector('.BRquery');
1032
- var tooltipOffset = tooltip.getBoundingClientRect();
1033
- var targetOffset = marker.getBoundingClientRect();
1034
- var boxSizeAdjust = parseInt(getComputedStyle(tooltip).paddingLeft) * 2;
1035
-
1036
- if (tooltipOffset.x - boxSizeAdjust < 0) {
1037
- tooltip.style.setProperty('transform', "translateX(-".concat(targetOffset.left - boxSizeAdjust, "px)"));
1038
- }
1039
-
1040
- $('.BRsearch,.BRchapter').removeClass('front');
1041
- $(event.target).addClass('front');
1042
- }, function (event) {
1043
- return $(event.target).removeClass('front');
1044
- }).click(function (event) {
1045
- // closures are nested and deep, using an arrow function breaks references.
1046
- // Todo: update to arrow function & clean up closures
1047
- // to remove `bind` dependency
1048
- this.br._searchPluginGoToResult(+$(event.target).data('pageIndex'));
1049
-
1050
- this.br.updateSearchHilites();
1051
- }.bind(_this3));
1052
- });
1053
- }
1054
- /**
1055
- * @param {boolean} bool
1056
- */
1057
-
1058
- }, {
1059
- key: "toggleSearchPending",
1060
- value: function toggleSearchPending(bool) {
1061
- var _this4 = this;
1062
-
1063
- if (bool) {
1064
- this.br.showProgressPopup("Search results will appear below...", function () {
1065
- return _this4.progressPopupClosed();
1066
- });
1067
- } else {
1068
- this.br.removeProgressPopup();
1069
- }
1070
- }
1071
- /**
1072
- * Primary callback when user cancels search popup
1073
- */
1074
-
1075
- }, {
1076
- key: "progressPopupClosed",
1077
- value: function progressPopupClosed() {
1078
- this.toggleSearchPending();
1079
- this.cancelSearch();
1080
- }
1081
- }, {
1082
- key: "renderErrorModal",
1083
- value: function renderErrorModal() {
1084
- var textIsProcessing = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1085
- var errorDetails = "".concat(!textIsProcessing ? 'The text may still be processing. ' : '', "Please try again.");
1086
- this.renderModalMessage("\n Sorry, there was an error with your search.\n <br />\n ".concat(errorDetails, "\n "));
1087
- this.delayModalRemovalFor(4000);
1088
- }
1089
- }, {
1090
- key: "renderBookNotIndexedModal",
1091
- value: function renderBookNotIndexedModal() {
1092
- this.renderModalMessage("\n <p>\n This book hasn't been indexed for searching yet.\n We've just started indexing it, so search should be available soon.\n <br />\n Please try again later. Thanks!\n </p>\n ");
1093
- this.delayModalRemovalFor(5000);
1094
- }
1095
- }, {
1096
- key: "renderResultsEmptyModal",
1097
- value: function renderResultsEmptyModal() {
1098
- this.renderModalMessage('No matches were found.');
1099
- this.delayModalRemovalFor(2000);
1100
- }
1101
- /**
1102
- * @param {string} messageHTML The innerHTML string used to popupate the modal contents
1103
- */
1104
-
1105
- }, {
1106
- key: "renderModalMessage",
1107
- value: function renderModalMessage(messageHTML) {
1108
- var modal = document.createElement('div');
1109
- modal.classList.add('BRprogresspopup', 'search_modal');
1110
- modal.innerHTML = messageHTML;
1111
- document.querySelector(this.br.el).append(modal);
1112
- }
1113
- /**
1114
- * @param {number} timeoutMS
1115
- */
1116
-
1117
- }, {
1118
- key: "delayModalRemovalFor",
1119
- value: function delayModalRemovalFor(timeoutMS) {
1120
- setTimeout(this.br.removeProgressPopup.bind(this.br), timeoutMS);
1121
- }
1122
- /**
1123
- * @param {Event} e
1124
- */
1125
-
1126
- }, {
1127
- key: "submitHandler",
1128
- value: function submitHandler(e) {
1129
- e.preventDefault();
1130
- var query = e.target.querySelector('[name="query"]').value;
1131
-
1132
- if (!query.length) {
1133
- return false;
1134
- }
1135
-
1136
- this.br.search(query);
1137
- this.emptyMatches();
1138
- this.toggleSearchPending(true);
1139
- return false;
1140
- }
1141
- /**
1142
- * @param {Event} e
1143
- * @param {object} properties
1144
- * @param {object} properties.results
1145
- * @param {object} properties.options
1146
- */
1147
-
1148
- }, {
1149
- key: "handleSearchCallback",
1150
- value: function handleSearchCallback(e, _ref2) {
1151
- var _this5 = this;
1152
-
1153
- var results = _ref2.results,
1154
- options = _ref2.options;
1155
- this.matches = results.matches;
1156
- this.setCurrentMatchIndex();
1157
- this.teardownSearchNavigation();
1158
- this.renderSearchNavigation();
1159
- this.bindSearchNavigationEvents();
1160
- this.renderPins(results.matches);
1161
- this.toggleSearchPending(false);
1162
-
1163
- if (options.goToFirstResult) {
1164
- $(document).one('BookReader:pageChanged', function () {
1165
- _this5.br.resize();
1166
- });
1167
- } else {
1168
- this.br.resize();
1169
- }
1170
- }
1171
- /**
1172
- * @param {Event} e
1173
- */
1174
-
1175
- }, {
1176
- key: "handleNavToggledCallback",
1177
- value: function handleNavToggledCallback(e) {
1178
- var is_visible = this.br.navigationIsVisible();
1179
- this.togglePinsFor(is_visible);
1180
- }
1181
- }, {
1182
- key: "handleSearchStarted",
1183
- value: function handleSearchStarted() {
1184
- this.emptyMatches();
1185
- this.br.removeSearchHilites();
1186
- this.removeResultPins();
1187
- this.toggleSearchPending(true);
1188
- this.teardownSearchNavigation();
1189
- this.setQuery(this.br.searchTerm);
1190
- }
1191
- /**
1192
- * Event listener for: `BookReader:SearchCallbackError`
1193
- * @param {CustomEvent} event
1194
- */
1195
-
1196
- }, {
1197
- key: "handleSearchCallbackError",
1198
- value: function handleSearchCallbackError() {
1199
- var _event$detail, _event$detail$props, _event$detail$props$r;
1200
-
1201
- var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1202
- this.toggleSearchPending(false);
1203
- var isIndexed = event === null || event === void 0 ? void 0 : (_event$detail = event.detail) === null || _event$detail === void 0 ? void 0 : (_event$detail$props = _event$detail.props) === null || _event$detail$props === void 0 ? void 0 : (_event$detail$props$r = _event$detail$props.results) === null || _event$detail$props$r === void 0 ? void 0 : _event$detail$props$r.indexed;
1204
- this.renderErrorModal(isIndexed);
1205
- }
1206
- }, {
1207
- key: "handleSearchCallbackBookNotIndexed",
1208
- value: function handleSearchCallbackBookNotIndexed() {
1209
- this.toggleSearchPending(false);
1210
- this.renderBookNotIndexedModal();
1211
- }
1212
- }, {
1213
- key: "handleSearchCallbackEmpty",
1214
- value: function handleSearchCallbackEmpty() {
1215
- this.toggleSearchPending(false);
1216
- this.renderResultsEmptyModal();
1217
- }
1218
- }, {
1219
- key: "bindEvents",
1220
- value: function bindEvents() {
1221
- var namespace = 'BookReader:';
1222
- window.addEventListener("".concat(namespace, "SearchCallbackError"), this.handleSearchCallbackError.bind(this));
1223
- $(document).on("".concat(namespace, "SearchCallback"), this.handleSearchCallback.bind(this)).on("".concat(namespace, "navToggled"), this.handleNavToggledCallback.bind(this)).on("".concat(namespace, "SearchStarted"), this.handleSearchStarted.bind(this)).on("".concat(namespace, "SearchCallbackBookNotIndexed"), this.handleSearchCallbackBookNotIndexed.bind(this)).on("".concat(namespace, "SearchCallbackEmpty"), this.handleSearchCallbackEmpty.bind(this)).on("".concat(namespace, "pageChanged"), this.updateSearchNavigation.bind(this));
1224
- this.dom.toolbarSearch.querySelector('form').addEventListener('submit', this.submitHandler.bind(this));
1225
- }
1226
- }]);
1227
-
1228
- return SearchView;
1229
- }();
1230
-
1231
- /* harmony default export */ __webpack_exports__["default"] = (SearchView);
1232
-
1233
- /***/ }),
1234
-
1235
- /***/ "./node_modules/core-js/internals/inherit-if-required.js":
1236
- /*!***************************************************************!*\
1237
- !*** ./node_modules/core-js/internals/inherit-if-required.js ***!
1238
- \***************************************************************/
1239
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1240
-
1241
- var isObject = __webpack_require__(/*! ../internals/is-object */ "./node_modules/core-js/internals/is-object.js");
1242
- var setPrototypeOf = __webpack_require__(/*! ../internals/object-set-prototype-of */ "./node_modules/core-js/internals/object-set-prototype-of.js");
1243
-
1244
- // makes subclassing work correct for wrapped built-ins
1245
- module.exports = function ($this, dummy, Wrapper) {
1246
- var NewTarget, NewTargetPrototype;
1247
- if (
1248
- // it can work only with native `setPrototypeOf`
1249
- setPrototypeOf &&
1250
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
1251
- typeof (NewTarget = dummy.constructor) == 'function' &&
1252
- NewTarget !== Wrapper &&
1253
- isObject(NewTargetPrototype = NewTarget.prototype) &&
1254
- NewTargetPrototype !== Wrapper.prototype
1255
- ) setPrototypeOf($this, NewTargetPrototype);
1256
- return $this;
1257
- };
1258
-
1259
-
1260
- /***/ }),
1261
-
1262
- /***/ "./node_modules/core-js/modules/es.object.assign.js":
1263
- /*!**********************************************************!*\
1264
- !*** ./node_modules/core-js/modules/es.object.assign.js ***!
1265
- \**********************************************************/
1266
- /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
1267
-
1268
- var $ = __webpack_require__(/*! ../internals/export */ "./node_modules/core-js/internals/export.js");
1269
- var assign = __webpack_require__(/*! ../internals/object-assign */ "./node_modules/core-js/internals/object-assign.js");
1270
-
1271
- // `Object.assign` method
1272
- // https://tc39.es/ecma262/#sec-object.assign
1273
- // eslint-disable-next-line es/no-object-assign -- required for testing
1274
- $({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
1275
- assign: assign
1276
- });
1277
-
1278
-
1279
- /***/ }),
1280
-
1281
- /***/ "./node_modules/core-js/modules/es.regexp.constructor.js":
1282
- /*!***************************************************************!*\
1283
- !*** ./node_modules/core-js/modules/es.regexp.constructor.js ***!
1284
- \***************************************************************/
1285
- /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
1286
-
1287
- var DESCRIPTORS = __webpack_require__(/*! ../internals/descriptors */ "./node_modules/core-js/internals/descriptors.js");
1288
- var global = __webpack_require__(/*! ../internals/global */ "./node_modules/core-js/internals/global.js");
1289
- var isForced = __webpack_require__(/*! ../internals/is-forced */ "./node_modules/core-js/internals/is-forced.js");
1290
- var inheritIfRequired = __webpack_require__(/*! ../internals/inherit-if-required */ "./node_modules/core-js/internals/inherit-if-required.js");
1291
- var defineProperty = __webpack_require__(/*! ../internals/object-define-property */ "./node_modules/core-js/internals/object-define-property.js").f;
1292
- var getOwnPropertyNames = __webpack_require__(/*! ../internals/object-get-own-property-names */ "./node_modules/core-js/internals/object-get-own-property-names.js").f;
1293
- var isRegExp = __webpack_require__(/*! ../internals/is-regexp */ "./node_modules/core-js/internals/is-regexp.js");
1294
- var getFlags = __webpack_require__(/*! ../internals/regexp-flags */ "./node_modules/core-js/internals/regexp-flags.js");
1295
- var stickyHelpers = __webpack_require__(/*! ../internals/regexp-sticky-helpers */ "./node_modules/core-js/internals/regexp-sticky-helpers.js");
1296
- var redefine = __webpack_require__(/*! ../internals/redefine */ "./node_modules/core-js/internals/redefine.js");
1297
- var fails = __webpack_require__(/*! ../internals/fails */ "./node_modules/core-js/internals/fails.js");
1298
- var enforceInternalState = __webpack_require__(/*! ../internals/internal-state */ "./node_modules/core-js/internals/internal-state.js").enforce;
1299
- var setSpecies = __webpack_require__(/*! ../internals/set-species */ "./node_modules/core-js/internals/set-species.js");
1300
- var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "./node_modules/core-js/internals/well-known-symbol.js");
1301
-
1302
- var MATCH = wellKnownSymbol('match');
1303
- var NativeRegExp = global.RegExp;
1304
- var RegExpPrototype = NativeRegExp.prototype;
1305
- var re1 = /a/g;
1306
- var re2 = /a/g;
1307
-
1308
- // "new" should create a new object, old webkit bug
1309
- var CORRECT_NEW = new NativeRegExp(re1) !== re1;
1310
-
1311
- var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
1312
-
1313
- var FORCED = DESCRIPTORS && isForced('RegExp', (!CORRECT_NEW || UNSUPPORTED_Y || fails(function () {
1314
- re2[MATCH] = false;
1315
- // RegExp constructor can alter flags and IsRegExp works correct with @@match
1316
- return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
1317
- })));
1318
-
1319
- // `RegExp` constructor
1320
- // https://tc39.es/ecma262/#sec-regexp-constructor
1321
- if (FORCED) {
1322
- var RegExpWrapper = function RegExp(pattern, flags) {
1323
- var thisIsRegExp = this instanceof RegExpWrapper;
1324
- var patternIsRegExp = isRegExp(pattern);
1325
- var flagsAreUndefined = flags === undefined;
1326
- var sticky;
1327
-
1328
- if (!thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined) {
1329
- return pattern;
1330
- }
1331
-
1332
- if (CORRECT_NEW) {
1333
- if (patternIsRegExp && !flagsAreUndefined) pattern = pattern.source;
1334
- } else if (pattern instanceof RegExpWrapper) {
1335
- if (flagsAreUndefined) flags = getFlags.call(pattern);
1336
- pattern = pattern.source;
1337
- }
1338
-
1339
- if (UNSUPPORTED_Y) {
1340
- sticky = !!flags && flags.indexOf('y') > -1;
1341
- if (sticky) flags = flags.replace(/y/g, '');
1342
- }
1343
-
1344
- var result = inheritIfRequired(
1345
- CORRECT_NEW ? new NativeRegExp(pattern, flags) : NativeRegExp(pattern, flags),
1346
- thisIsRegExp ? this : RegExpPrototype,
1347
- RegExpWrapper
1348
- );
1349
-
1350
- if (UNSUPPORTED_Y && sticky) {
1351
- var state = enforceInternalState(result);
1352
- state.sticky = true;
1353
- }
1354
-
1355
- return result;
1356
- };
1357
- var proxy = function (key) {
1358
- key in RegExpWrapper || defineProperty(RegExpWrapper, key, {
1359
- configurable: true,
1360
- get: function () { return NativeRegExp[key]; },
1361
- set: function (it) { NativeRegExp[key] = it; }
1362
- });
1363
- };
1364
- var keys = getOwnPropertyNames(NativeRegExp);
1365
- var index = 0;
1366
- while (keys.length > index) proxy(keys[index++]);
1367
- RegExpPrototype.constructor = RegExpWrapper;
1368
- RegExpWrapper.prototype = RegExpPrototype;
1369
- redefine(global, 'RegExp', RegExpWrapper);
1370
- }
1371
-
1372
- // https://tc39.es/ecma262/#sec-get-regexp-@@species
1373
- setSpecies('RegExp');
1374
-
1375
-
1376
- /***/ })
1377
-
1378
- },
1379
- /******/ function(__webpack_require__) { // webpackRuntimeModules
1380
- /******/ "use strict";
1381
- /******/
1382
- /******/ var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
1383
- /******/ var __webpack_exports__ = (__webpack_exec__("./src/plugins/search/plugin.search.js"));
1384
- /******/ }
1385
- ]);
1
+ /*! For license information please see plugin.search.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[924],{706:function(e,t,n){var r=n(350).PROPER,a=n(9039),i=n(7452);e.exports=function(e){return a(function(){return!!i[e]()||"​…᠎"!=="​…᠎"[e]()||r&&i[e].name!==e})}},2762:function(e,t,n){var r=n(6518),a=n(3802).Bq;r({target:"String",proto:!0,forced:n(706)("trim")},{trim:function(){return a(this)}})},1041:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}function i(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}n.d(t,{S:function(){return o}}),n(2675),n(9463),n(2259),n(5700),n(3792),n(9572),n(2892),n(9085),n(6099),n(7764),n(2953);var o=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.br=t,this.options},(t=[{key:"setup",value:function(e){this.options=Object.assign({},this.options,e)}},{key:"init",value:function(){}},{key:"_configurePageContainer",value:function(e){}},{key:"_configureToolbar",value:function(e){}},{key:"_bindNavigationHandlers",value:function(){}},{key:"extendNavBar",value:function(e){}}])&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}()},5372:function(e,t,n){n(2675),n(9463),n(2259),n(5700),n(8706),n(113),n(3418),n(3792),n(8598),n(2062),n(4782),n(9572),n(2010),n(2892),n(5506),n(3851),n(875),n(6099),n(8459),n(3362),n(825),n(888),n(7495),n(8781),n(7764),n(5440),n(5746),n(2953);var r=n(8004),a=n(4907),i=(n(8940),n(3500),n(1669));function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,l(r.key),r)}}function l(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}var u=function(){return e=function e(t){var n=t.br,r=t.searchCancelledCallback,a=void 0===r?function(){}:r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.br=n,this.matches=[],this.cacheDOMElements(),this.cancelSearch=a},t=[{key:"init",value:function(){this.bindEvents()}},{key:"cacheDOMElements",value:function(){this.dom={},this.dom.toolbarSearch=this.buildToolbarSearch()}},{key:"setQuery",value:function(e){this.br.$('[name="query"]').val(e)}},{key:"emptyMatches",value:function(){this.matches=[]}},{key:"removeResultPins",value:function(){this.br.$(".BRnavpos .BRsearch").remove()}},{key:"clearSearchFieldAndResults",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.br.plugins.search.removeSearchResults(),this.removeResultPins(),this.emptyMatches(),this.setQuery(""),this.teardownSearchNavigation(),e&&this.br.trigger("SearchResultsCleared")}},{key:"toggleSidebar",value:function(){this.br.trigger("ToggleSearchMenu")}},{key:"renderSearchNavigation",value:function(){var e="BRsearch-navigation";i(".BRnav.BRnavMain").before('\n <div class="'.concat(e,'">\n <button class="toggle-sidebar">\n <h4>\n <span class="icon icon-search"></span> Results\n </h4>\n </button>\n <div class="pagination">\n <button class="prev" title="Previous result"><span class="icon icon-chevron hflip"></span></button>\n <span data-id="resultsCount">').concat(this.resultsPosition(),'</span>\n <button class="next" title="Next result"><span class="icon icon-chevron"></button>\n </div>\n <button class="clear" title="Clear search results">\n <span class="icon icon-close"></span>\n </button>\n </div>\n ')),this.dom.searchNavigation=i(".".concat(e))}},{key:"resultsPosition",value:function(){var e="".concat(this.matches.length," result").concat(1===this.matches.length?"":"s");return~this.currentMatchIndex&&(e="".concat(this.currentMatchIndex+1," / ").concat(this.matches.length)),e}},{key:"bindSearchNavigationEvents",value:function(){if(this.dom.searchNavigation){var e="searchNavigation";this.dom.searchNavigation.on("click.".concat(e),".clear",this.clearSearchFieldAndResults.bind(this)).on("click.".concat(e),".prev",this.showPrevResult.bind(this)).on("click.".concat(e),".next",this.showNextResult.bind(this)).on("click.".concat(e),".toggle-sidebar",this.toggleSidebar.bind(this)).on("click.".concat(e),!1)}}},{key:"showPrevResult",value:function(){0!==this.currentMatchIndex&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex(function(e,t,n){return t[0]>n})+1),this.br.$(".BRnavline .BRsearch").eq(--this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"showNextResult",value:function(){this.currentMatchIndex+1!==this.matches.length&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex(function(e,t,n){return e[e.length-1]>n})-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=this.matches.map(function(e){return e.par[0].page}),n=this.br.currentIndex()+1,r=function(t,n){if(1===t.length)return t[0];var a=t.slice(0,t.length/2),i=t.slice(t.length/2);return r(e(a,i,n)?a:i,n)},a=r(t,n);return this.matches.indexOf(this.matches.find(function(e){return e.par[0].page===a}))}},{key:"updateResultsPosition",value:function(){this.dom.searchNavigation&&this.dom.searchNavigation.find("[data-id=resultsCount]").text(this.resultsPosition())}},{key:"updateSearchNavigationButtons",value:function(){this.dom.searchNavigation&&(this.dom.searchNavigation.find(".prev").attr("disabled",!this.currentMatchIndex),this.dom.searchNavigation.find(".next").attr("disabled",this.currentMatchIndex+1===this.matches.length))}},{key:"teardownSearchNavigation",value:function(){this.dom.searchNavigation||(this.dom.searchNavigation=i(".BRsearch-navigation")),this.dom.searchNavigation.length&&(this.dom.searchNavigation.off(".searchNavigation").remove(),this.dom.searchNavigation=null,this.br.resize())}},{key:"setCurrentMatchIndex",value:function(){var e;this.br.mode!==this.br.constModeThumb?(e=this.br.mode===this.br.constMode2up?this.find2upMatchingSearchResult():this.find1upMatchingSearchResult(),this.currentMatchIndex=this.matches.indexOf(e)):this.currentMatchIndex=-1}},{key:"find1upMatchingSearchResult",value:function(){var e=this;return this.matches.find(function(t){return e.br.currentIndex()===t.par[0].page-1})}},{key:"find2upMatchingSearchResult",value:function(){var e=this;return this.matches.find(function(t){return e.br._isIndexDisplayed(t.par[0].page-1)})}},{key:"updateSearchNavigation",value:function(){this.matches.length&&(this.setCurrentMatchIndex(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"togglePinsFor",value:function(e){var t=e?"visible":"hidden";this.br.refs.$BRfooter.find(".BRsearch").css({visibility:t})}},{key:"buildToolbarSearch",value:function(){var e=document.createElement("span");return e.classList.add("BRtoolbarSection","BRtoolbarSectionSearch"),e.innerHTML='\n <form class="BRbooksearch desktop">\n <input type="search" name="query" class="BRsearchInput" value="" placeholder="Search inside"/>\n <button type="submit" class="BRsearchSubmit">\n <img src="'.concat(this.br.options.imagesBaseURL,'icon_search_button.svg" />\n </button>\n </form>\n '),e}},{key:"renderPins",value:function(e){var t=this;e.forEach(function(e){var n=t.br.book.leafNumToIndex(e.par[0].page),r=t.br.constructor.util.cssPercentage(n,t.br.book.getNumLeafs()-1),a=e.html;if(a.length>200){var o=Math.max(0,a.indexOf("<mark>")-100);0!=o&&(a="…"+e.html.substring(o).replace(/^\S+/,""))}i("<div>").addClass("BRsearch").css({left:r}).attr("title","Search result").append('\n <div class="BRquery">\n <main>'.concat(a,"</main>\n <footer>Page ").concat(e.displayPageNumber,"</footer>\n </div>\n ")).appendTo(t.br.$(".BRnavline")).on("mouseenter",function(e){var t=e.currentTarget,n=t.querySelector(".BRquery"),r=n.getBoundingClientRect(),a=t.getBoundingClientRect(),o=2*parseInt(getComputedStyle(n).paddingLeft);r.x-o<0&&n.style.setProperty("transform","translateX(-".concat(a.left-o,"px)")),i(".BRsearch,.BRchapter").removeClass("front"),i(e.target).addClass("front")}).on("mouseleave",function(e){return i(e.target).removeClass("front")}).on("click",function(){t.br.plugins.search.jumpToMatch(e.matchIndex)})})}},{key:"toggleSearchPending",value:function(){var e=this;arguments.length>0&&void 0!==arguments[0]&&arguments[0]?this.br.showProgressPopup("Search results will appear below...",function(){return e.progressPopupClosed()}):this.br.removeProgressPopup()}},{key:"progressPopupClosed",value:function(){this.toggleSearchPending(),this.cancelSearch()}},{key:"renderErrorModal",value:function(){var e="".concat(arguments.length>0&&void 0!==arguments[0]&&arguments[0]?"":"The text may still be processing. ","Please try again.");this.renderModalMessage("\n Sorry, there was an error with your search.\n <br />\n ".concat(e,"\n ")),this.delayModalRemovalFor(4e3)}},{key:"renderBookNotIndexedModal",value:function(){this.renderModalMessage("\n <p>\n This book hasn't been indexed for searching yet.\n We've just started indexing it, so search should be available soon.\n <br />\n Please try again later. Thanks!\n </p>\n "),this.delayModalRemovalFor(5e3)}},{key:"renderResultsEmptyModal",value:function(){this.renderModalMessage("No matches were found."),this.delayModalRemovalFor(2e3)}},{key:"renderModalMessage",value:function(e){var t=document.createElement("div");t.classList.add("BRprogresspopup","search_modal"),t.innerHTML=e,this.br.refs.$br[0].append(t)}},{key:"delayModalRemovalFor",value:function(e){setTimeout(this.br.removeProgressPopup.bind(this.br),e)}},{key:"submitHandler",value:function(e){e.preventDefault();var t=e.target.querySelector('[name="query"]').value;return!!t.length&&(this.br.search(t),this.emptyMatches(),this.toggleSearchPending(!0),!1)}},{key:"handleSearchCallback",value:function(e,t){var n=this,r=t.results,a=t.options;this.matches=r.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderPins(r.matches),this.toggleSearchPending(!1),a.goToFirstResult?i(document).one("BookReader:pageChanged",function(){n.br.resize()}):this.br.resize()}},{key:"handleSearchStarted",value:function(){this.emptyMatches(),this.br.plugins.search.removeSearchHilites(),this.removeResultPins(),this.toggleSearchPending(!0),this.teardownSearchNavigation(),this.setQuery(this.br.plugins.search.searchTerm)}},{key:"handleSearchCallbackError",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.toggleSearchPending(!1);var n=null==t||null===(e=t.detail)||void 0===e||null===(e=e.props)||void 0===e||null===(e=e.results)||void 0===e?void 0:e.indexed;this.renderErrorModal(n)}},{key:"handleSearchCallbackBookNotIndexed",value:function(){this.toggleSearchPending(!1),this.renderBookNotIndexedModal()}},{key:"handleSearchCallbackEmpty",value:function(){this.toggleSearchPending(!1),this.renderResultsEmptyModal()}},{key:"bindEvents",value:function(){var e="BookReader:";window.addEventListener("".concat(e,"SearchCallbackError"),this.handleSearchCallbackError.bind(this)),i(document).on("".concat(e,"SearchCallback"),this.handleSearchCallback.bind(this)).on("".concat(e,"SearchStarted"),this.handleSearchStarted.bind(this)).on("".concat(e,"SearchCallbackBookNotIndexed"),this.handleSearchCallbackBookNotIndexed.bind(this)).on("".concat(e,"SearchCallbackEmpty"),this.handleSearchCallbackEmpty.bind(this)).on("".concat(e,"pageChanged"),this.updateSearchNavigation.bind(this)),this.dom.toolbarSearch.querySelector("form").addEventListener("submit",this.submitHandler.bind(this))}}],t&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),c=u;function h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw a}}return s}}(e,t)||d(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=d(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function d(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t,n){var a=(0,r.Nt)((0,r.Zn)(t)),i=(0,r.Nt)((0,r.Zn)(n)),o=new RegExp("".concat(a,"([^]+?)").concat(i),"g");return(0,r.Zn)(e).replace(o,"<mark>$1</mark>").replace(/(\b)- /g,"$1")}n(4864);var b=n(1041),m=n(9073),p=n(4160),y=n(1669),k=n(1669);function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i,o,s=[],l=!0,u=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw a}}return s}}(e,t)||C(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=C(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function C(e,t){if(e){if("string"==typeof e)return T(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?T(e,t):void 0}}function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function i(n,r,a,i){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return I(u,"_invoke",function(n,r,a){var i,s,l,u=0,c=a||[],h=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,s=0,l=e,f.n=n,o}};function d(n,r){for(s=n,l=r,t=0;!h&&u&&!a&&t<c.length;t++){var a,i=c[t],d=f.p,v=i[2];n>3?(a=v===r)&&(l=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=d&&((a=n<2&&d<i[1])?(s=0,f.v=r,f.n=i[1]):d<v&&(a=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,f.n=v,s=0))}if(a||n>1)return o;throw h=!0,r}return function(a,c,v){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&d(c,v),s=c,l=v;(t=s<2?e:l)||!h;){i||(s?s<3?(s>1&&(f.n=-1),d(s,l)):f.n=l:f.v=l);try{if(u=2,i){if(s||(a="next"),t=i[a]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=i.return)&&t.call(i),s<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),s=1);i=e}else if((t=(h=f.n<0)?l:n.call(r,f))!==o)break}catch(t){i=e,s=1,l=t}finally{u=1}}return{value:t,done:h}}}(n,a,i),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(I(t={},r,function(){return this}),t),h=u.prototype=s.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,I(e,a,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,I(h,"constructor",u),I(u,"constructor",l),l.displayName="GeneratorFunction",I(u,a,"GeneratorFunction"),I(h),I(h,a,"Generator"),I(h,r,function(){return this}),I(h,"toString",function(){return"[object Generator]"}),(x=function(){return{w:i,m:f}})()}function I(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}I=function(e,t,n,r){function i(t,n){I(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},I(e,t,n,r)}function P(e,t,n,r,a,i,o){try{var s=e[i](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function j(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var i=e.apply(t,n);function o(e){P(i,r,a,o,s,"next",e)}function s(e){P(i,r,a,o,s,"throw",e)}o(void 0)})}}function M(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}function N(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(N=function(){return!!e})()}function B(e,t,n,r){var a=O(E(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof a?function(e){return a.apply(n,e)}:a}function O(){return O="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=E(e)););return e}(e,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},O.apply(null,arguments)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}function _(e){var t=function(e){if("object"!=S(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=S(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==S(t)?t:t+""}var z=window.BookReader,L=function(e){function t(){var e,n,r,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return e=function(e,t,n){return t=E(t),function(e,t){if(t&&("object"==S(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,N()?Reflect.construct(t,n||[],E(e).constructor):t.apply(e,n))}(this,t,[].concat(o)),n=e,r="options",a={enabled:!0,preTag:"{{{",postTag:"}}}",searchInsideUrl:"/fulltext/inside.php?"+["q={{query|urlencode}}","pre_tag={{preTag|urlencode}}","post_tag={{postTag|urlencode}}"].join("&"),initialSearchTerm:null,goToFirstResult:!1},(r=_(r))in n?Object.defineProperty(n,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[r]=a,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&A(e,t)}(t,e),n=t,i=[{key:"setup",value:function(e){var n=this;B(t,"setup",this,3)([e]),this.searchTerm="",this.searchResults=null,this.searchInsideUrl=this.options.searchInsideUrl,this.enabled=this.options.enabled,this.searchXHR=null,this._searchBoxesByIndex={},this.enabled?this.searchView=new c({br:this.br,searchCancelledCallback:function(){n._cancelSearch(),n.br.trigger("SearchCanceled",{term:n.searchTerm,instance:n.br})}}):this.searchView=null}},{key:"init",value:function(){var e;B(t,"init",this,3)([]),this.enabled&&(this.searchView.init(),this.options.initialSearchTerm?this.search(this.options.initialSearchTerm,{goToFirstResult:this.options.goToFirstResult,suppressFragmentChange:!1}):"search"===(null===(e=this.br.urlPlugin)||void 0===e?void 0:e.getUrlParam("focus"))&&this.searchView.toggleSidebar())}},{key:"_configureToolbar",value:function(e){if(this.enabled)return this.searchView.dom.toolbarSearch&&e.find(".BRtoolbarSectionInfo").after(this.searchView.dom.toolbarSearch),e}},{key:"_configurePageContainer",value:function(e){if(this.enabled&&e.page&&e.page.index in this._searchBoxesByIndex){var t=e.page.index,n=this._searchBoxesByIndex[t];(0,a.KL)("searchHiliteLayer",n,e.page,e.$container[0],n.map(function(e){return"match-index-".concat(e.matchIndex)}))}return e}},{key:"search",value:(s=j(x().m(function e(){var t,n,r,a,i,o,s,l=this,u=arguments;return x().w(function(e){for(;;)switch(e.n){case 0:return t=u.length>0&&void 0!==u[0]?u[0]:"",n=u.length>1&&void 0!==u[1]?u[1]:{},r={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},a=y.extend({},r,n),this.suppressFragmentChange=a.suppressFragmentChange,this.searchCancelled=!1,this.searchTerm=t.replace(/\//g," "),a.suppressFragmentChange||this.br.trigger(z.eventNames.fragmentChange),i=(0,m.gT)(this.options.searchInsideUrl,this.br.options.vars,{query:t,preTag:this.options.preTag,postTag:this.options.postTag}),o=function(e){if(!l.searchCancelled){var t=e.error||!e.matches.length,n="function"==typeof a.error,r="function"==typeof a.success;t?(console.error("Search Inside Response Error",e.error||"matches.length == 0"),n?a.error.call(l,e,a):l.BRSearchCallbackError(e)):r?a.success.call(l,e,a):l.BRSearchCallback(e,a)}},this.br.trigger("SearchStarted",{term:this.searchTerm,instance:this.br}),s=o,e.n=1,k.ajax({url:i,cache:!0,xhrFields:{withCredentials:this.br.protected},beforeSend:function(e){l.searchXHR=e}});case 1:s(e.v);case 2:return e.a(2)}},e,this)})),function(){return s.apply(this,arguments)})},{key:"_cancelSearch",value:function(){var e;null===(e=this.searchXHR)||void 0===e||e.abort(),this.searchView.clearSearchFieldAndResults(!1),this.searchTerm="",this.searchXHR=null,this.searchCancelled=!0,this.searchResults=null}},{key:"cancelSearchRequest",value:function(){this.searchCancelled=!0,null!==this.searchXHR&&(this._cancelSearch(),this.searchView.toggleSearchPending(),this.br.trigger("SearchCanceled",{term:this.searchTerm,instance:this.br}))}},{key:"BRSearchCallback",value:function(e,t){var n=this,r=(0,p.YH)(this.br.options.bookLanguage);!function(e,t,n,r,a){var i,o=f(e.matches.entries());try{for(o.s();!(i=o.n()).done;){var s=h(i.value,2),l=s[0],u=s[1];u.matchIndex=l,u.displayPageNumber=t(u.par[0].page),u.html=g(u.text,n,r),u.lang=a;var c,d=f(u.par);try{for(d.s();!(c=d.n()).done;){var v,b=f(c.value.boxes);try{for(b.s();!(v=b.n()).done;)v.value.matchIndex=l}catch(e){b.e(e)}finally{b.f()}}}catch(e){d.e(e)}finally{d.f()}}}catch(e){o.e(e)}finally{o.f()}}(e,function(e){return n.br.book.getPageNum(n.br.book.leafNumToIndex(e))},this.options.preTag,this.options.postTag,r),this.searchResults=e||null,this.updateSearchHilites(),this.br.removeProgressPopup(),t.goToFirstResult&&this.jumpToMatch(0),this.br.trigger("SearchCallback",{results:e,options:t,instance:this.br})}},{key:"BRSearchCallbackError",value:function(e){this._BRSearchCallbackError(e)}},{key:"_BRSearchCallbackError",value:function(e){this.searchResults=e;var t={term:this.searchTerm,results:e,instance:this.br};if(e.error)this.br.trigger("SearchCallbackError",t);else if(0==e.matches.length){if(!1===e.indexed)return void this.br.trigger("SearchCallbackBookNotIndexed",t);this.br.trigger("SearchCallbackEmpty",t)}}},{key:"updateSearchHilites",value:function(){var e,t=(null===(e=this.searchResults)||void 0===e?void 0:e.matches)||[],n={};this.removeSearchHilites();var r,i=R(t);try{for(i.s();!(r=i.n()).done;){var o,s=R(r.value.par[0].boxes);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=this.br.book.leafNumToIndex(l.page);(n[u]||(n[u]=[])).push(l)}}catch(e){s.e(e)}finally{s.f()}}}catch(e){i.e(e)}finally{i.f()}for(var c=0,h=Object.entries(n);c<h.length;c++){var f,d=w(h[c],2),v=d[0],g=d[1],b=parseFloat(v),m=this.br.book.getPage(b),p=R(this.br.getActivePageContainerElementsForIndex(b));try{for(p.s();!(f=p.n()).done;){var y=f.value;(0,a.KL)("searchHiliteLayer",g,m,y,g.map(function(e){return"match-index-".concat(e.matchIndex)}))}}catch(e){p.e(e)}finally{p.f()}}this._searchBoxesByIndex=n}},{key:"removeSearchHilites",value:function(){k(this.br.getActivePageContainerElements()).find(".searchHiliteLayer").remove()}},{key:"jumpToMatch",value:(o=j(x().m(function e(t){var n,a,i,o,s,l,u;return x().w(function(e){for(;;)switch(e.n){case 0:return a=null===(n=this.searchResults)||void 0===n?void 0:n.matches[t],i=this.br.book,o=i.leafNumToIndex(a.par[0].page),s=i.getPage(o),l=Math.abs(this.br.currentIndex()-o)<3,e.n=1,this.br.requestPage(s);case 1:return this.br._isIndexDisplayed(o)||(this.suppressFragmentChange=!1,this.br.jumpToIndex(o,{ariaLive:!0,allowUnviewable:!0})),e.n=2,(0,r.wt)(function(){return k("rect.match-index-".concat(a.matchIndex))},{until:function(e){return e.length>0}});case 2:if(!(u=e.v).length){e.n=4;break}return u.css("animation","none"),this.br.scrollIntoView(u[0],{block:"center",inline:"center",behavior:l?"smooth":"auto"}),e.n=3,new Promise(function(e){return setTimeout(e,100)});case 3:u.removeAttr("style");case 4:return e.a(2)}},e,this)})),function(e){return o.apply(this,arguments)})},{key:"removeSearchResults",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.removeSearchHilites(),this.searchTerm=null,this.searchResults=null,e||this.br.trigger(z.eventNames.fragmentChange)}}],i&&M(n.prototype,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,i,o,s}(b.S);null==z||z.registerPlugin("search",L)},4160:function(e,t,n){n.d(t,{$x:function(){return g},ND:function(){return v},YH:function(){return h},_4:function(){return f}}),n(2675),n(9463),n(2259),n(3418),n(4423),n(3792),n(4782),n(2010),n(875),n(6099),n(3362),n(7495),n(8781),n(1699),n(7764),n(2953);var r=[],a={},i={},o={};[["Serbian","српски језик","sr","srp","srp"],["Romanian, Moldavian, Moldovan","Română","ro","ron","rum"],["Sichuan Yi, Nuosu","ꆈꌠ꒿ Nuosuhxop","ii","iii","iii"],["Tahitian","Reo Tahiti","ty","tah","tah"],["Tagalog","Wikang Tagalog","tl","tgl","tgl"],["Yiddish","ייִדיש","yi","yid","yid"],["Akan","Akan","ak","aka","aka"],["Malay","Bahasa Melayu, بهاس ملايو","ms","msa","may"],["Arabic","العربية","ar","ara","ara"],["Norwegian","Norsk","no","nor","nor"],["Ojibwa","ᐊᓂᔑᓈᐯᒧᐎᓐ","oj","oji","oji"],["Fulah","Fulfulde, Pulaar, Pular","ff","ful","ful"],["Persian","فارسی","fa","fas","per"],["Albanian","Shqip","sq","sqi","alb"],["Aymara","aymar aru","ay","aym","aym"],["Azerbaijani","azərbaycan dili","az","aze","aze"],["Chinese","中文 (Zhōngwén), 汉语, 漢語","zh","zho","chi"],["Cree","ᓀᐦᐃᔭᐍᐏᐣ","cr","cre","cre"],["Estonian","eesti, eesti keel","et","est","est"],["Guaraní","Avañe'ẽ","gn","grn","grn"],["Inupiaq","Iñupiaq, Iñupiatun","ik","ipk","ipk"],["Inuktitut","ᐃᓄᒃᑎᑐᑦ","iu","iku","iku"],["Kanuri","Kanuri","kr","kau","kau"],["Komi","коми кыв","kv","kom","kom"],["Kongo","Kikongo","kg","kon","kon"],["Kurdish","Kurdî, أۇزبېك","ku","kur","kur"],["Latvian","latviešu valoda","lv","lav","lav"],["Malagasy","fiteny malagasy","mg","mlg","mlg"],["Mongolian","Монгол хэл","mn","mon","mon"],["Oromo","Afaan Oromoo","om","orm","orm"],["Pashto, Pushto","پښتو","ps","pus","pus"],["Quechua","Runa Simi, Kichwa","qu","que","que"],["Sardinian","sardu","sc","srd","srd"],["Swahili","Kiswahili","sw","swa","swa"],["Uzbek","Oʻzbek, Ўзбек, ","uz","uzb","uzb"],["Zhuang, Chuang","Saɯ cueŋƅ, Saw cuengh","za","zha","zha"],["Bislama","Bislama","bi","bis","bis"],["Norwegian Bokmål","Norsk Bokmål","nb","nob","nob"],["Norwegian Nynorsk","Norsk Nynorsk","nn","nno","nno"],["Indonesian","Bahasa Indonesia","id","ind","ind"],["Twi","Twi","tw","twi","twi"],["Esperanto","Esperanto","eo","epo","epo"],["Interlingua","Interlingua","ia","ina","ina"],["Interlingue","Originally called Occidental; then Interlingue after WWII","ie","ile","ile"],["Ido","Ido","io","ido","ido"],["Volapük","Volapük","vo","vol","vol"],["Bihari languages","भोजपुरी","bh","bih","bih"],["Hebrew (modern)","עברית","he","heb","heb"],["Sanskrit","संस्कृतम्","sa","san","san"],["Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian","ѩзыкъ словѣньскъ","cu","chu","chu"],["Pali","पाऴि","pi","pli","pli"],["Avestan","avesta","ae","ave","ave"],["Latin","latine, lingua latina","la","lat","lat"],["Armenian","Հայերեն","hy","hye","arm"],["Swati","SiSwati","ss","ssw","ssw"],["Tibetan","བོད་ཡིག","bo","bod","tib"],["South Ndebele","isiNdebele","nr","nbl","nbl"],["Slovene","Slovenski Jezik, Slovenščina","sl","slv","slv"],["Oriya","ଓଡ଼ିଆ","or","ori","ori"],["North Ndebele","isiNdebele","nd","nde","nde"],["Nauru","Dorerin Naoero","na","nau","nau"],["Maori","te reo Māori","mi","mri","mao"],["Marathi","मराठी","mr","mar","mar"],["Luba-Katanga","Kiluba","lu","lub","lub"],["Rundi","Ikirundi","rn","run","run"],["Central Khmer","ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ","km","khm","khm"],["Western Frisian","Frysk","fy","fry","fry"],["Bengali","বাংলা","bn","ben","ben"],["Avaric","авар мацӀ, магӀарул мацӀ","av","ava","ava"],["Abkhazian","аҧсуа бызшәа, аҧсшәа","ab","abk","abk"],["Afar","Afaraf","aa","aar","aar"],["Afrikaans","Afrikaans","af","afr","afr"],["Amharic","አማርኛ","am","amh","amh"],["Aragonese","aragonés","an","arg","arg"],["Assamese","অসমীয়া","as","asm","asm"],["Bambara","bamanankan","bm","bam","bam"],["Bashkir","башҡорт теле","ba","bak","bak"],["Basque","euskara, euskera","eu","eus","baq"],["Belarusian","беларуская мова","be","bel","bel"],["Bosnian","bosanski jezik","bs","bos","bos"],["Breton","brezhoneg","br","bre","bre"],["Bulgarian","български език","bg","bul","bul"],["Burmese","ဗမာစာ","my","mya","bur"],["Catalan, Valencian","català, valencià","ca","cat","cat"],["Chamorro","Chamoru","ch","cha","cha"],["Chechen","нохчийн мотт","ce","che","che"],["Chichewa, Chewa, Nyanja","chiCheŵa, chinyanja","ny","nya","nya"],["Chuvash","чӑваш чӗлхи","cv","chv","chv"],["Cornish","Kernewek","kw","cor","cor"],["Corsican","corsu, lingua corsa","co","cos","cos"],["Croatian","hrvatski jezik","hr","hrv","hrv"],["Czech","čeština, český jazyk","cs","ces","cze"],["Danish","dansk","da","dan","dan"],["Divehi, Dhivehi, Maldivian","ދިވެހި","dv","div","div"],["Dutch, Flemish","Nederlands, Vlaams","nl","nld","dut"],["Dzongkha","རྫོང་ཁ","dz","dzo","dzo"],["English","English","en","eng","eng"],["Ewe","Eʋegbe","ee","ewe","ewe"],["Faroese","føroyskt","fo","fao","fao"],["Fijian","vosa Vakaviti","fj","fij","fij"],["Finnish","suomi, suomen kieli","fi","fin","fin"],["French","français, langue française","fr","fra","fre"],["Galician","Galego","gl","glg","glg"],["Georgian","ქართული","ka","kat","geo"],["German","Deutsch","de","deu","ger"],["Greek (modern)","ελληνικά","el","ell","gre"],["Gujarati","ગુજરાતી","gu","guj","guj"],["Haitian, Haitian Creole","Kreyòl ayisyen","ht","hat","hat"],["Hausa","(Hausa) هَوُسَ","ha","hau","hau"],["Herero","Otjiherero","hz","her","her"],["Hindi","हिन्दी, हिंदी","hi","hin","hin"],["Hiri Motu","Hiri Motu","ho","hmo","hmo"],["Hungarian","magyar","hu","hun","hun"],["Irish","Gaeilge","ga","gle","gle"],["Igbo","Asụsụ Igbo","ig","ibo","ibo"],["Icelandic","Íslenska","is","isl","ice"],["Italian","Italiano","it","ita","ita"],["Japanese","日本語 (にほんご)","ja","jpn","jpn"],["Javanese","ꦧꦱꦗꦮ, Basa Jawa","jv","jav","jav"],["Kalaallisut, Greenlandic","kalaallisut, kalaallit oqaasii","kl","kal","kal"],["Kannada","ಕನ್ನಡ","kn","kan","kan"],["Kashmiri","कश्मीरी, كشميري","ks","kas","kas"],["Kazakh","қазақ тілі","kk","kaz","kaz"],["Kikuyu, Gikuyu","Gĩkũyũ","ki","kik","kik"],["Kinyarwanda","Ikinyarwanda","rw","kin","kin"],["Kirghiz, Kyrgyz","Кыргызча, Кыргыз тили","ky","kir","kir"],["Korean","한국어","ko","kor","kor"],["Kuanyama, Kwanyama","Kuanyama","kj","kua","kua"],["Luxembourgish, Letzeburgesch","Lëtzebuergesch","lb","ltz","ltz"],["Ganda","Luganda","lg","lug","lug"],["Limburgan, Limburger, Limburgish","Limburgs","li","lim","lim"],["Lingala","Lingála","ln","lin","lin"],["Lao","ພາສາລາວ","lo","lao","lao"],["Lithuanian","lietuvių kalba","lt","lit","lit"],["Manx","Gaelg, Gailck","gv","glv","glv"],["Macedonian","македонски јазик","mk","mkd","mac"],["Malayalam","മലയാളം","ml","mal","mal"],["Maltese","Malti","mt","mlt","mlt"],["Marshallese","Kajin M̧ajeļ","mh","mah","mah"],["Navajo, Navaho","Diné bizaad","nv","nav","nav"],["Nepali","नेपाली","ne","nep","nep"],["Ndonga","Owambo","ng","ndo","ndo"],["Occitan","occitan, lenga d'òc","oc","oci","oci"],["Ossetian, Ossetic","ирон æвзаг","os","oss","oss"],["Panjabi, Punjabi","ਪੰਜਾਬੀ","pa","pan","pan"],["Polish","język polski, polszczyzna","pl","pol","pol"],["Portuguese","Português","pt","por","por"],["Romansh","Rumantsch Grischun","rm","roh","roh"],["Russian","русский","ru","rus","rus"],["Sindhi","सिन्धी, سنڌي، سندھی","sd","snd","snd"],["Northern Sami","Davvisámegiella","se","sme","sme"],["Samoan","gagana fa'a Samoa","sm","smo","smo"],["Sango","yângâ tî sängö","sg","sag","sag"],["Gaelic, Scottish Gaelic","Gàidhlig","gd","gla","gla"],["Shona","chiShona","sn","sna","sna"],["Sinhala, Sinhalese","සිංහල","si","sin","sin"],["Slovak","Slovenčina, Slovenský Jazyk","sk","slk","slo"],["Somali","Soomaaliga, af Soomaali","so","som","som"],["Southern Sotho","Sesotho","st","sot","sot"],["Spanish, Castilian","Español","es","spa","spa"],["Sundanese","Basa Sunda","su","sun","sun"],["Swedish","Svenska","sv","swe","swe"],["Tamil","தமிழ்","ta","tam","tam"],["Telugu","తెలుగు","te","tel","tel"],["Tajik","тоҷикӣ, toçikī, تاجیکی","tg","tgk","tgk"],["Thai","ไทย","th","tha","tha"],["Tigrinya","ትግርኛ","ti","tir","tir"],["Turkmen","Türkmen, Түркмен","tk","tuk","tuk"],["Tswana","Setswana","tn","tsn","tsn"],["Tongan (Tonga Islands)","Faka Tonga","to","ton","ton"],["Turkish","Türkçe","tr","tur","tur"],["Tsonga","Xitsonga","ts","tso","tso"],["Tatar","татар теле, tatar tele","tt","tat","tat"],["Uighur, Uyghur","ئۇيغۇرچە, Uyghurche","ug","uig","uig"],["Ukrainian","Українська","uk","ukr","ukr"],["Urdu","اردو","ur","urd","urd"],["Venda","Tshivenḓa","ve","ven","ven"],["Vietnamese","Tiếng Việt","vi","vie","vie"],["Walloon","Walon","wa","wln","wln"],["Welsh","Cymraeg","cy","cym","wel"],["Wolof","Wollof","wo","wol","wol"],["Xhosa","isiXhosa","xh","xho","xho"],["Yoruba","Yorùbá","yo","yor","yor"],["Zulu","isiZulu","zu","zul","zul"]].forEach(e=>{var t={name:e[0],nativeName:e[1],iso639_1:e[2],iso639_2T:e[3],iso639_2B:e[4]};a[e[2]]=i[e[3]]=o[e[4]]=t,r.push(t)});var s=r;function l(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c={"zh-hans":"中文 (Zhōngwén)"};function h(e){if(!e)return null;if(e=e.toLocaleLowerCase(),c[e])return e;var t=d(e,["iso639_1"])||d(e,["iso639_2T"])||d(e,["iso639_2B","name","nativeName"]);return t?t.iso639_1:null}function f(e){if(!e)return null;if(e=e.toLocaleLowerCase(),c[e])return c[e];var t=d(e,["iso639_1"])||d(e,["iso639_2T"])||d(e,["iso639_2B","name","nativeName"]);return null!=t&&t.nativeName?t.nativeName.split(", ")[0]:null}function d(e,t){if(!e)return null;e=e.toLowerCase();var n,r=l(s);try{for(r.s();!(n=r.n()).done;){var a,i=n.value,o=l(t);try{for(o.s();!(a=o.n()).done;){var u;if(null!==(u=i[a.value])&&void 0!==u&&u.toLowerCase().split(", ").includes(e))return i}}catch(e){o.e(e)}finally{o.f()}}}catch(e){r.e(e)}finally{r.f()}return null}function v(){try{return!!window.localStorage}catch(e){return!1}}var g=-1!=location.toString().indexOf("_debugReadAloud=true")},9073:function(e,t,n){function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e){var t=e.match(/\S+/g);return t?t.length:0}function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o;return null==e?void 0:e.replace(/\{\{([^}]*?)\}\}/g,function(e,i){if(!i)return e;var o,s=function(e){if(Array.isArray(e))return e}(o=i.split("|").map(function(e){return e.trim()}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),l=s[0],u=r(s).slice(1);if(!(l in n)&&!(l in t))return e;var c=l in n?n[l]:l in t?t[l]:null;return u.map(function(e){return a[e]}).reduce(function(e,t){return t(e)},c&&c.toString())})}n.d(t,{gT:function(){return i},rj:function(){return a}}),n(2675),n(9463),n(2259),n(3418),n(3792),n(2062),n(2712),n(4782),n(2010),n(6099),n(7495),n(8781),n(7764),n(1761),n(5440),n(2762),n(2953);var o={urlencode:encodeURIComponent}}},function(e){e(5372)}]);
1386
3
  //# sourceMappingURL=plugin.search.js.map