@internetarchive/bookreader 5.0.0-67 → 5.0.0-68
Sign up to get free protection for your applications and to get access to all the features.
- package/BookReader/BookReader.css +53 -891
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +50 -48
- package/BookReader/ia-bookreader-bundle.js.map +1 -1
- package/BookReader/plugins/plugin.autoplay.js +1 -1
- package/BookReader/plugins/plugin.autoplay.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +1 -1
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.search.js +1 -1
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +1 -1
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReaderDemo/BookReaderDemo.css +0 -18
- package/BookReaderDemo/BookReaderJSAdvanced.js +0 -3
- package/BookReaderDemo/demo-autoplay.html +0 -2
- package/BookReaderDemo/demo-fullscreen-mobile.html +1 -4
- package/BookReaderDemo/demo-fullscreen.html +0 -3
- package/BookReaderDemo/demo-iiif.js +0 -1
- package/BookReaderDemo/demo-vendor-fullscreen.html +0 -3
- package/BookReaderDemo/immersion-1up.html +0 -1
- package/BookReaderDemo/immersion-mode.html +0 -3
- package/CHANGELOG.md +5 -0
- package/package.json +7 -8
- package/src/BookReader/BookModel.js +0 -12
- package/src/BookReader/Mode1Up.js +1 -1
- package/src/BookReader/Mode1UpLit.js +1 -1
- package/src/BookReader/events.js +0 -1
- package/src/BookReader.js +1 -2
- package/src/css/BookReader.scss +1 -5
- package/src/css/_BRnav.scss +0 -8
- package/src/plugins/plugin.autoplay.js +1 -2
- package/src/plugins/search/plugin.search.js +0 -3
- package/tests/e2e/base.test.js +3 -11
- package/tests/e2e/helpers/base.js +26 -26
- package/tests/e2e/helpers/rightToLeft.js +4 -4
- package/tests/e2e/helpers/{desktopSearch.js → search.js} +19 -19
- package/tests/e2e/models/Navigation.js +16 -42
- package/tests/e2e/viewmode.test.js +3 -3
- package/tests/jest/plugins/plugin.chapters.test.js +0 -1
- package/tests/jest/plugins/search/plugin.search.view.test.js +0 -1
- package/webpack.config.js +0 -1
- package/BookReader/plugins/plugin.mobile_nav.js +0 -2
- package/BookReader/plugins/plugin.mobile_nav.js.map +0 -1
- package/src/css/_MobileNav.scss +0 -168
- package/src/plugins/plugin.mobile_nav.js +0 -288
- package/tests/e2e/helpers/mobileSearch.js +0 -85
- package/tests/jest/plugins/plugin.mobile_nav.test.js +0 -66
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[320],{2024:function(t,e,i){i(7327),i(1539);var o,
|
1
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[320],{2024:function(t,e,i){i(7327),i(1539);var o,a=i(5311),n=i(5311);a.extend(BookReader.defaultOptions,{enableAutoPlayPlugin:!0}),BookReader.prototype.setup=(o=BookReader.prototype.setup,function(t){o.call(this,t),this.auto=!1,this.autoTimer=null,this.flipDelay=5e3}),BookReader.prototype.init=function(t){return function(e){var i=this;t.call(this,e),this.options.enableAutoPlayPlugin&&this.bind(BookReader.eventNames.stop,(function(){return i.autoStop()}))}}(BookReader.prototype.init),BookReader.prototype.bindNavigationHandlers=function(t){return function(){var e=this;if(t.call(this),this.options.enableAutoPlayPlugin){var i=this.$(".BRicon");i.filter(".play").click((function(){return e.autoToggle(),!1})),i.filter(".pause").click((function(){return e.autoToggle(),!1}))}}}(BookReader.prototype.bindNavigationHandlers),BookReader.prototype.autoToggle=function(t){var e=this;if(this.options.enableAutoPlayPlugin){var i=n.extend({flipSpeed:this.flipSpeed,flipDelay:this.flipDelay},t);this.flipSpeed="number"==typeof i.flipSpeed?i.flipSpeed:this.flipSpeed,this.flipDelay="number"==typeof i.flipDelay?i.flipDelay:this.flipDelay,this.trigger(BookReader.eventNames.stop);var o=!1;this.constMode2up!=this.mode&&(o=!0,this.switchMode(this.constMode2up)),null==this.autoTimer?("rl"==this.pageProgression&&o||this.next({triggerStop:!1}),this.$(".play").hide(),this.$(".pause").show(),this.autoTimer=setInterval((function(){e.animating||(Math.max(e.twoPage.currentIndexL,e.twoPage.currentIndexR)>=e.book.getNumLeafs()-1?e.prev({triggerStop:!1}):e.next({triggerStop:!1}))}),this.flipDelay)):this.autoStop()}},BookReader.prototype.autoStop=function(){this.options.enableAutoPlayPlugin&&null!=this.autoTimer&&(clearInterval(this.autoTimer),this.flipSpeed="fast",this.$(".pause").hide(),this.$(".play").show(),this.autoTimer=null)}}},function(t){t(t.s=2024)}]);
|
2
2
|
//# sourceMappingURL=plugin.autoplay.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugins/plugin.autoplay.js","mappings":"mKAYuCA,E,oBAPvCC,EAAOC,OAAOC,WAAWC,eAAgB,CACvCC,sBAAsB,IAMxBF,WAAWG,UAAUC,OAAkBP,EAQpCG,WAAWG,UAAUC,MAPf,SAAUC,GACfR,EAAOS,KAAKC,KAAMF,GAElBE,KAAKC,MAAY,EACjBD,KAAKE,UAAY,KACjBF,KAAKG,UAAY,GACnB,GAMFV,WAAWG,UAAUQ,KAAQ,SAASd,GACpC,OAAO,SAAUQ,GAAS,IAAAO,EAAA,KACxBf,EAAOS,KAAKC,KAAMF,GAEbE,KAAKF,QAAQH,sBAClBK,KAAKM,KAAKb,WAAWc,WAAWC,MAAM,kBAAMH,EAAKI,UAAU,GAC7D,CACF,CAP6B,CAO1BhB,WAAWG,UAAUQ,MAKxBX,WAAWG,UAAUc,uBAA0B,SAASpB,GACtD,OAAO,WAAW,IAAAqB,EAAA,KAGhB,GAFArB,EAAOS,KAAKC,MAEPA,KAAKF,QAAQH,qBAAlB,
|
1
|
+
{"version":3,"file":"plugins/plugin.autoplay.js","mappings":"mKAYuCA,E,oBAPvCC,EAAO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jBrB,KAAKwB,WAAWxB,KAAKsB,eAGnB,MAAQtB,KAAKE,WAKV,MAAQF,KAAKyB,iBAAoBJ,GAIpCrB,KAAK0B,KAAK,CAAEC,aAAa,IAG3B3B,KAAKa,EAAE,SAASe,OAChB5B,KAAKa,EAAE,UAAUgB,OACjB7B,KAAKE,UAAY4B,aAAY,WACvBZ,EAAKa,YAELC,KAAKC,IAAIf,EAAKgB,QAAQC,cAAejB,EAAKgB,QAAQE,gBAAkBlB,EAAKmB,KAAKC,cAAgB,EAChGpB,EAAKqB,KAAK,CAAEZ,aAAa,IAEzBT,EAAKQ,KAAK,CAAEC,aAAa,IAE7B,GAAG3B,KAAKG,YAERH,KAAKS,UAzCuC,CA2ChD,EAKAhB,WAAWG,UAAUa,SAAW,WACzBT,KAAKF,QAAQH,sBAEd,MAAQK,KAAKE,YACfsC,cAAcxC,KAAKE,WACnBF,KAAKmB,UAAY,OACjBnB,KAAKa,EAAE,UAAUe,OACjB5B,KAAKa,EAAE,SAASgB,OAChB7B,KAAKE,UAAY,KAErB,C","sources":["webpack://@internetarchive/bookreader/./src/plugins/plugin.autoplay.js"],"sourcesContent":["/*global BookReader */\n\n/**\n * Plugin which adds an autoplay feature. Useful for kiosk situations.\n */\njQuery.extend(BookReader.defaultOptions, {\n enableAutoPlayPlugin: true\n});\n\n/**\n * @override BookReader.setup\n */\nBookReader.prototype.setup = (function(super_) {\n return function (options) {\n super_.call(this, options);\n\n this.auto = false;\n this.autoTimer = null;\n this.flipDelay = 5000;\n };\n})(BookReader.prototype.setup);\n\n/**\n * @override BookReader.init\n */\nBookReader.prototype.init = (function(super_) {\n return function (options) {\n super_.call(this, options);\n\n if (!this.options.enableAutoPlayPlugin) return;\n this.bind(BookReader.eventNames.stop, () => this.autoStop());\n };\n})(BookReader.prototype.init);\n\n/**\n * @override BookReader.bindNavigationHandlers\n */\nBookReader.prototype.bindNavigationHandlers = (function(super_) {\n return function() {\n super_.call(this);\n\n if (!this.options.enableAutoPlayPlugin) return;\n\n const jIcons = this.$('.BRicon');\n\n jIcons.filter('.play').click(() => {\n this.autoToggle();\n return false;\n });\n\n jIcons.filter('.pause').click(() => {\n this.autoToggle();\n return false;\n });\n };\n})(BookReader.prototype.bindNavigationHandlers);\n\n/**\n * Starts autoplay mode\n * @param {object} overrides\n * @param {number} overrides.flipSpeed\n * @param {number} overrides.flipDelay\n */\nBookReader.prototype.autoToggle = function(overrides) {\n if (!this.options.enableAutoPlayPlugin) return;\n\n const options = $.extend({\n flipSpeed: this.flipSpeed,\n flipDelay: this.flipDelay\n }, overrides);\n\n this.flipSpeed = typeof options.flipSpeed === \"number\" ? options.flipSpeed : this.flipSpeed;\n this.flipDelay = typeof options.flipDelay === \"number\" ? options.flipDelay : this.flipDelay;\n this.trigger(BookReader.eventNames.stop);\n\n let bComingFrom1up = false;\n if (this.constMode2up != this.mode) {\n bComingFrom1up = true;\n this.switchMode(this.constMode2up);\n }\n\n if (null == this.autoTimer) {\n // $$$ Draw events currently cause layout problems when they occur during animation.\n // There is a specific problem when changing from 1-up immediately to autoplay in RTL so\n // we workaround for now by not triggering immediate animation in that case.\n // See https://bugs.launchpad.net/gnubook/+bug/328327\n if (('rl' == this.pageProgression) && bComingFrom1up) {\n // don't flip immediately -- wait until timer fires\n } else {\n // flip immediately\n this.next({ triggerStop: false });\n }\n\n this.$('.play').hide();\n this.$('.pause').show();\n this.autoTimer = setInterval(() => {\n if (this.animating) return;\n\n if (Math.max(this.twoPage.currentIndexL, this.twoPage.currentIndexR) >= this.book.getNumLeafs() - 1) {\n this.prev({ triggerStop: false }); // $$$ really what we want?\n } else {\n this.next({ triggerStop: false });\n }\n }, this.flipDelay);\n } else {\n this.autoStop();\n }\n};\n\n/**\n * Stop autoplay mode, allowing animations to finish\n */\nBookReader.prototype.autoStop = function() {\n if (!this.options.enableAutoPlayPlugin) return;\n\n if (null != this.autoTimer) {\n clearInterval(this.autoTimer);\n this.flipSpeed = 'fast';\n this.$('.pause').hide();\n this.$('.play').show();\n this.autoTimer = null;\n }\n};\n"],"names":["super_","jQuery","extend","BookReader","defaultOptions","enableAutoPlayPlugin","prototype","setup","options","call","this","auto","autoTimer","flipDelay","init","_this","bind","eventNames","stop","autoStop","bindNavigationHandlers","_this2","jIcons","$","filter","click","autoToggle","overrides","_this3","flipSpeed","trigger","bComingFrom1up","constMode2up","mode","switchMode","pageProgression","next","triggerStop","hide","show","setInterval","animating","Math","max","twoPage","currentIndexL","currentIndexR","book","getNumLeafs","prev","clearInterval"],"sourceRoot":""}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*! For license information please see plugin.chapters.js.LICENSE.txt */
|
2
|
-
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[529],{4775:function(e,t,r){r(2526),r(1817),r(2165),r(6992),r(8783),r(3948),r(2443),r(3680),r(3706),r(2703),r(489),r(4747),r(8309),r(7042),r(3371),r(9714),r(1038),r(4916),r(4819),r(5003),r(6649),r(6078),r(9653),r(561),r(9826),r(2419),r(1249),r(9601),r(9600),r(7327),r(1539),r(1058),r(2222),r(5069),r(4553),r(8674);var n=r(
|
2
|
+
"use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[529],{4775:function(e,t,r){r(2526),r(1817),r(2165),r(6992),r(8783),r(3948),r(2443),r(3680),r(3706),r(2703),r(489),r(4747),r(8309),r(7042),r(3371),r(9714),r(1038),r(4916),r(4819),r(5003),r(6649),r(6078),r(9653),r(561),r(9826),r(2419),r(1249),r(9601),r(9600),r(7327),r(1539),r(1058),r(2222),r(5069),r(4553),r(8674);var n=r(8318),o=r(9089),i=r(4817),a=r(1312),c=n.dy`
|
3
3
|
<svg
|
4
4
|
viewBox="0 0 24 24"
|
5
5
|
xmlns="http://www.w3.org/2000/svg"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugins/plugin.chapters.js","mappings":";wdAEA,EAAe,IAAI;;;;;;;;;;ECCnB,MAAMA,UAAk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AAtBoI,EAAS9B,UAE3B,OAAOc,EAAAA,EAAAA,IAAIyG,IAAAA,EAAAvG,EAAA,qNAILsG,EAAY,YAAc,GAC1BxF,GAAY7C,KAAK4G,eAAiB,UAAY,IAEzC2B,EAAAA,EAAAA,GAAS,CAACC,WAAmC,IAAtB3F,EAAS4F,MAAQ,GAAU,OC3MvB,OAAbP,ED4MgBG,EAAY,8BAA2B5N,GC5M1CyN,EAASQ,EAAAA,ID6MnC,kBAAMP,EAAKQ,WAAW9F,EAAS9B,UAAU,GAEjDqH,EACAvF,EAAS3B,SAAUW,EAAAA,EAAAA,IAAI+G,IAAAA,EAAA7G,EAAA,uFAEec,EAAS3B,SAC7C2H,EAAAA,GAER,GAAC,CAAAlB,KAAA,SAAA/Q,IAAA,oBAAAE,MAED,WACEgS,EAAAC,EAzDS9B,EAAe1Q,WAAA,0BAAAoC,KAAA,MA0DxBqH,KAAKgJ,cAAc,IAAIC,YAAY,aACrC,GAAC,CAAAtB,KAAA,SAAA/Q,IAAA,UAAAE,MAED,SAAQoS,GACuC,IAAAC,EAAzCD,EAAkBE,IAAI,oBACmB,QAA3CD,EAAAnJ,KAAKqJ,WAAW9E,cAAc,qBAAa,IAAA4E,GAA3CA,EAA6CG,eAAe,CAC1DC,MAAO,UACPC,SAAU,WAGhB,GAAC,CAAA7B,KAAA,MAAA8B,QAAA,EAAA7S,IAAA,SAAAE,MAED,WACE,OAAOiN,EAAAA,EAAAA,IAAG2F,IAAAA,EAAA3H,EAAA,inBA8BZ,IAAC,GArGkC4H,EAAAA","sources":["webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-toc/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-toc/icon-toc.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.chapters.js","webpack://@internetarchive/bookreader/../src/directives/if-defined.ts"],"sourcesContent":["import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"tocTitleID tocDescID\"\n>\n <title id=\"tocTitleID\">Table of contents icon</title>\n <desc id=\"tocDescID\">An illustration of three text list items</desc>\n <g class=\"fill-color\" fill-rule=\"evenodd\"><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"21\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"14\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"7\"/><rect height=\"3\" rx=\"1.5\" width=\"4\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"21\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"14\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"7\"/></g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconToc extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-toc', IAIconToc);\n\nexport default IAIconToc;\n","/* global BookReader */\nimport { css, html, LitElement, nothing } from \"lit\";\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport '@internetarchive/icon-toc/icon-toc';\n/** @typedef {import('@/src/BookNavigator/book-navigator.js').BookNavigator} BookNavigator */\n\n/**\n * Plugin for chapter markers in BookReader. Fetches from openlibrary.org\n * Could be forked, or extended to alter behavior\n */\n\njQuery.extend(BookReader.defaultOptions, {\n olHost: 'https://openlibrary.org',\n enableChaptersPlugin: true,\n bookId: '',\n});\n\n/** @override Extend to call Open Library for TOC */\nBookReader.prototype.init = (function(super_) {\n return function() {\n super_.call(this);\n if (this.options.enableChaptersPlugin && this.ui !== 'embed') {\n this._chapterInit();\n }\n };\n})(BookReader.prototype.init);\n\nBookReader.prototype._chapterInit = async function() {\n const olEdition = await this.getOpenLibraryRecord(this.options.olHost, this.options.bookId);\n if (olEdition?.table_of_contents?.length) {\n this._tocEntries = olEdition.table_of_contents.map(rawTOCEntry => (\n Object.assign({}, rawTOCEntry, {pageIndex: this.book.getPageIndex(rawTOCEntry.pagenum)})\n ));\n this._chaptersRender(this._tocEntries);\n this.bind(BookReader.eventNames.pageChanged, () => this._chaptersUpdateCurrent());\n }\n};\n\n/**\n * Update the table of contents based on array of TOC entries.\n */\nBookReader.prototype._chaptersRender = function() {\n const shell = /** @type {BookNavigator} */(this.shell);\n shell.menuProviders['chapters'] = {\n id: 'chapters',\n icon: html`<ia-icon-toc style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-toc>`,\n label: 'Table of Contents',\n component: html`<br-chapters-panel\n .contents=\"${this._tocEntries}\"\n .jumpToPage=\"${(pageIndex) => {\n this._chaptersUpdateCurrent(pageIndex);\n this.jumpToIndex(pageIndex);\n }}\"\n @connected=\"${(e) => {\n this._chaptersPanel = e.target;\n this._chaptersUpdateCurrent();\n }}\"\n />`,\n };\n shell.updateMenuContents();\n for (const tocEntry of this._tocEntries) {\n this._chaptersRenderMarker(tocEntry);\n }\n};\n\n/**\n * @typedef {Object} TocEntry\n * Table of contents entry as defined by Open Library, with some extra values for internal use\n * @property {string} pagenum\n * @property {number} level\n * @property {string} label\n * @property {string} title\n * @property {number} pageIndex - Added\n *\n * @example {\n * \"pagenum\": \"17\",\n * \"level\": 1,\n * \"label\": \"CHAPTER I\",\n * \"title\": \"THE COUNTRY AND THE MISSION\"\n * }\n */\n\n/**\n * @param {TocEntry} tocEntry\n */\nBookReader.prototype._chaptersRenderMarker = function(tocEntry) {\n if (tocEntry.pageIndex == undefined) return;\n\n //creates a string with non-void tocEntry.label and tocEntry.title\n const chapterStr = [tocEntry.label, tocEntry.title]\n .filter(x => x)\n .join(' ');\n\n const percentThrough = BookReader.util.cssPercentage(tocEntry.pageIndex, this.book.getNumLeafs() - 1);\n $(`<div></div>`)\n .append(\n $('<div />')\n .text(chapterStr)\n .append($('<div class=\"BRchapterPage\" />').text(`Page ${tocEntry.pagenum}`))\n )\n .addClass('BRchapter')\n .css({ left: percentThrough })\n .appendTo(this.$('.BRnavline'))\n .on(\"mouseenter\", event => {\n // remove hover effect from other markers then turn on just for this\n const marker = event.currentTarget;\n const tooltip = marker.querySelector('div');\n const tooltipOffset = tooltip.getBoundingClientRect();\n const targetOffset = marker.getBoundingClientRect();\n const boxSizeAdjust = parseInt(getComputedStyle(tooltip).paddingLeft) * 2;\n if (tooltipOffset.x - boxSizeAdjust < 0) {\n tooltip.style.setProperty('transform', `translateX(-${targetOffset.left - boxSizeAdjust}px)`);\n }\n this.$('.BRsearch,.BRchapter').removeClass('front');\n $(event.target).addClass('front');\n })\n .on(\"mouseleave\", event => $(event.target).removeClass('front'))\n .on('click', () => {\n this._chaptersUpdateCurrent(tocEntry.pageIndex);\n this.jumpToIndex(tocEntry.pageIndex);\n });\n\n this.$('.BRchapter, .BRsearch').each((i, el) => {\n const $el = $(el);\n $el\n .on(\"mouseenter\", () => $el.addClass('front'))\n .on(\"mouseleave\", () => $el.removeClass('front'));\n });\n};\n\n/**\n * This makes a call to OL API and calls the given callback function with the\n * response from the API.\n *\n * @param {string} olHost\n * @param {string} ocaid\n */\nBookReader.prototype.getOpenLibraryRecord = async function (olHost, ocaid) {\n // Try looking up by ocaid first, then by source_record\n const baseURL = `${olHost}/query.json?type=/type/edition&*=`;\n const fetchUrlByBookId = `${baseURL}&ocaid=${ocaid}`;\n\n let data = await $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' });\n\n if (!data || !data.length) {\n // try sourceid\n data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}`, dataType: 'jsonp' });\n }\n\n return data?.[0];\n};\n\n/**\n * @private\n * Highlights the current chapter based on current page\n * @param {PageIndex} curIndex\n */\nBookReader.prototype._chaptersUpdateCurrent = function(\n curIndex = (this.mode == 2 ? Math.max(...this.displayedIndices) : this.firstIndex)\n) {\n const tocEntriesIndexed = this._tocEntries.filter((el) => el.pageIndex != undefined).reverse();\n const currChapter = tocEntriesIndexed[\n // subtract one so that 2up shows the right label\n tocEntriesIndexed.findIndex((chapter) => chapter.pageIndex <= curIndex)\n ];\n if (this._chaptersPanel) {\n this._chaptersPanel.currentChapter = currChapter;\n }\n};\n\n@customElement('br-chapters-panel')\nexport class BRChaptersPanel extends LitElement {\n /** @type {TocEntry[]} */\n @property({ type: Array })\n contents = [];\n\n /** @type {TocEntry?} */\n @property({ type: Object })\n currentChapter = {};\n\n /** @type {(pageIndex: PageIndex) => void} */\n jumpToPage = () => {};\n\n /**\n * @param {TocEntry[]} contents\n */\n constructor(contents) {\n super();\n this.contents = contents;\n }\n\n render() {\n return html`\n <ol>\n ${this.contents.map(tocEntry => this.renderTOCEntry(tocEntry))}\n </ol>\n `;\n }\n\n /**\n * @param {TocEntry} tocEntry\n */\n renderTOCEntry(tocEntry) {\n const chapterTitle = [tocEntry.label, tocEntry.title]\n .filter(x => x)\n .join(' ');\n const clickable = tocEntry.pageIndex != undefined;\n // note the click-tracking won't work...\n return html`\n <li\n class=\"\n BRtable-contents-el\n ${clickable ? 'clickable' : ''}\n ${tocEntry == this.currentChapter ? 'current' : ''}\n \"\n style=\"${styleMap({marginLeft: (tocEntry.level - 1) * 10 + 'px'})}\"\n data-event-click-tracking=\"${ifDefined(clickable ? \"BRTOCPanel|GoToChapter\" : undefined)}\"\n @click=\"${() => this.jumpToPage(tocEntry.pageIndex)}\"\n >\n ${chapterTitle}\n ${tocEntry.pagenum ? html`\n <br />\n <span class=\"BRTOCElementPage\">Page ${tocEntry.pagenum}</span>\n ` : nothing}\n </li>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.dispatchEvent(new CustomEvent('connected'));\n }\n\n updated(changedProperties) {\n if (changedProperties.has('currentChapter')) {\n this.shadowRoot.querySelector('li.current')?.scrollIntoView({\n block: 'nearest',\n behavior: 'smooth',\n });\n }\n }\n\n static get styles() {\n return css`\n ol {\n padding: 0;\n margin: 0;\n margin-right: 5px;\n }\n li {\n padding: 10px;\n overflow: hidden;\n border-radius: 4px;\n }\n li.clickable {\n font-weight: normal;\n cursor: pointer;\n transition: background-color 0.2s;\n }\n\n li.clickable:not(.current):hover {\n background-color: rgba(255,255,255, 0.05);\n }\n\n li.current {\n background-color: rgba(255,255,255,0.9);\n color: #333;\n }\n\n .BRTOCElementPage {\n font-size: 0.85em;\n opacity: .8;\n }`;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing} from '../lit-html.js';\n\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = <T>(value: T) => value ?? nothing;\n"],"names":["IAIconToc","styles","render","customElements","define","super_","_regeneratorRuntime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","defineProperty","obj","key","desc","value","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","methodName","return","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","jQuery","extend","BookReader","defaultOptions","olHost","enableChaptersPlugin","bookId","init","this","options","ui","_chapterInit","_callee","_olEdition$table_of_c","olEdition","_this","_context","getOpenLibraryRecord","table_of_contents","_tocEntries","map","rawTOCEntry","assign","pageIndex","book","getPageIndex","pagenum","_chaptersRender","bind","eventNames","pageChanged","_chaptersUpdateCurrent","_this2","shell","menuProviders","id","icon","html","_templateObject","_taggedTemplateLiteral","label","component","_templateObject2","jumpToIndex","e","_chaptersPanel","target","updateMenuContents","_step","_iterator","_createForOfIteratorHelper","s","n","tocEntry","_chaptersRenderMarker","f","_this3","chapterStr","title","filter","x","join","percentThrough","util","cssPercentage","getNumLeafs","$","append","text","concat","addClass","css","left","appendTo","on","event","marker","currentTarget","tooltip","querySelector","tooltipOffset","getBoundingClientRect","targetOffset","boxSizeAdjust","parseInt","getComputedStyle","paddingLeft","style","setProperty","removeClass","each","el","$el","_ref2","_callee2","ocaid","_data","baseURL","fetchUrlByBookId","data","_context2","ajax","url","dataType","_x","_x2","curIndex","mode","Math","max","displayedIndices","firstIndex","tocEntriesIndexed","currChapter","findIndex","chapter","currentChapter","_decorate","customElement","_initialize","_LitElement","BRChaptersPanel","_LitElement2","_inherits","_super","contents","_this4","_classCallCheck","_assertThisInitialized","F","d","kind","decorators","property","Array","_this5","_templateObject3","renderTOCEntry","l","_this6","chapterTitle","clickable","_templateObject4","styleMap","marginLeft","level","t","jumpToPage","_templateObject5","nothing","_get","_getPrototypeOf","dispatchEvent","CustomEvent","changedProperties","_this$shadowRoot$quer","has","shadowRoot","scrollIntoView","block","behavior","static","_templateObject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EAAA,KACjBC,EAAe,CAACvF,EAASb,MAAOa,EAASK,OAC5CC,QAAO,SAAAC,GAAC,OAAIA,CAAC,IACbC,KAAK,KACFgF,EAAkC5N,MAAtBoI,EAAS9B,UAE3B,OAAOc,EAAAA,EAAAA,IAAIyG,IAAAA,EAAAvG,EAAA,qNAILsG,EAAY,YAAc,GAC1BxF,GAAY7C,KAAK4G,eAAiB,UAAY,IAEzC2B,EAAAA,EAAAA,GAAS,CAACC,WAAmC,IAAtB3F,EAAS4F,MAAQ,GAAU,OC3MvB,OAAbP,ED4MgBG,EAAY,8BAA2B5N,GC5M1CyN,EAASQ,EAAAA,ID6MnC,kBAAMP,EAAKQ,WAAW9F,EAAS9B,UAAU,GAEjDqH,EACAvF,EAAS3B,SAAUW,EAAAA,EAAAA,IAAI+G,IAAAA,EAAA7G,EAAA,uFAEec,EAAS3B,SAC7C2H,EAAAA,GAER,GAAC,CAAAlB,KAAA,SAAA/Q,IAAA,oBAAAE,MAED,WACEgS,EAAAC,EAzDS9B,EAAe1Q,WAAA,0BAAAoC,KAAA,MA0DxBqH,KAAKgJ,cAAc,IAAIC,YAAY,aACrC,GAAC,CAAAtB,KAAA,SAAA/Q,IAAA,UAAAE,MAED,SAAQoS,GACuC,IAAAC,EAAzCD,EAAkBE,IAAI,oBACmB,QAA3CD,EAAAnJ,KAAKqJ,WAAW9E,cAAc,qBAAa,IAAA4E,GAA3CA,EAA6CG,eAAe,CAC1DC,MAAO,UACPC,SAAU,WAGhB,GAAC,CAAA7B,KAAA,MAAA8B,QAAA,EAAA7S,IAAA,SAAAE,MAED,WACE,OAAOiN,EAAAA,EAAAA,IAAG2F,IAAAA,EAAA3H,EAAA,inBA8BZ,IAAC,GArGkC4H,EAAAA","sources":["webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-toc/index.js","webpack://@internetarchive/bookreader/./node_modules/@internetarchive/icon-toc/icon-toc.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.chapters.js","webpack://@internetarchive/bookreader/../src/directives/if-defined.ts"],"sourcesContent":["import { html } from 'lit';\n\nexport default html`\n<svg\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"tocTitleID tocDescID\"\n>\n <title id=\"tocTitleID\">Table of contents icon</title>\n <desc id=\"tocDescID\">An illustration of three text list items</desc>\n <g class=\"fill-color\" fill-rule=\"evenodd\"><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"21\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"14\"/><rect height=\"3\" rx=\"1.5\" width=\"18\" x=\"6\" y=\"7\"/><rect height=\"3\" rx=\"1.5\" width=\"4\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"21\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"14\"/><rect height=\"3\" rx=\"1.5\" width=\"4\" y=\"7\"/></g>\n</svg>\n`;\n","import icon from './index.js';\nimport { css, LitElement } from 'lit';\n\nclass IAIconToc extends LitElement {\n static get styles() {\n return css`\n :host {\n width: var(--iconWidth, 'auto');\n height: var(--iconHeight, 'auto');\n }\n\n .fill-color {\n fill: var(--iconFillColor);\n }\n\n .stroke-color {\n stroke: var(--iconStrokeColor);\n }\n `;\n }\n\n render() {\n return icon;\n }\n}\n\ncustomElements.define('ia-icon-toc', IAIconToc);\n\nexport default IAIconToc;\n","/* global BookReader */\nimport { css, html, LitElement, nothing } from \"lit\";\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport '@internetarchive/icon-toc/icon-toc';\n/** @typedef {import('@/src/BookNavigator/book-navigator.js').BookNavigator} BookNavigator */\n\n/**\n * Plugin for chapter markers in BookReader. Fetches from openlibrary.org\n * Could be forked, or extended to alter behavior\n */\n\njQuery.extend(BookReader.defaultOptions, {\n olHost: 'https://openlibrary.org',\n enableChaptersPlugin: true,\n bookId: '',\n});\n\n/** @override Extend to call Open Library for TOC */\nBookReader.prototype.init = (function(super_) {\n return function() {\n super_.call(this);\n if (this.options.enableChaptersPlugin && this.ui !== 'embed') {\n this._chapterInit();\n }\n };\n})(BookReader.prototype.init);\n\nBookReader.prototype._chapterInit = async function() {\n const olEdition = await this.getOpenLibraryRecord(this.options.olHost, this.options.bookId);\n if (olEdition?.table_of_contents?.length) {\n this._tocEntries = olEdition.table_of_contents.map(rawTOCEntry => (\n Object.assign({}, rawTOCEntry, {pageIndex: this.book.getPageIndex(rawTOCEntry.pagenum)})\n ));\n this._chaptersRender(this._tocEntries);\n this.bind(BookReader.eventNames.pageChanged, () => this._chaptersUpdateCurrent());\n }\n};\n\n/**\n * Update the table of contents based on array of TOC entries.\n */\nBookReader.prototype._chaptersRender = function() {\n const shell = /** @type {BookNavigator} */(this.shell);\n shell.menuProviders['chapters'] = {\n id: 'chapters',\n icon: html`<ia-icon-toc style=\"width: var(--iconWidth); height: var(--iconHeight);\"></ia-icon-toc>`,\n label: 'Table of Contents',\n component: html`<br-chapters-panel\n .contents=\"${this._tocEntries}\"\n .jumpToPage=\"${(pageIndex) => {\n this._chaptersUpdateCurrent(pageIndex);\n this.jumpToIndex(pageIndex);\n }}\"\n @connected=\"${(e) => {\n this._chaptersPanel = e.target;\n this._chaptersUpdateCurrent();\n }}\"\n />`,\n };\n shell.updateMenuContents();\n for (const tocEntry of this._tocEntries) {\n this._chaptersRenderMarker(tocEntry);\n }\n};\n\n/**\n * @typedef {Object} TocEntry\n * Table of contents entry as defined by Open Library, with some extra values for internal use\n * @property {string} pagenum\n * @property {number} level\n * @property {string} label\n * @property {string} title\n * @property {number} pageIndex - Added\n *\n * @example {\n * \"pagenum\": \"17\",\n * \"level\": 1,\n * \"label\": \"CHAPTER I\",\n * \"title\": \"THE COUNTRY AND THE MISSION\"\n * }\n */\n\n/**\n * @param {TocEntry} tocEntry\n */\nBookReader.prototype._chaptersRenderMarker = function(tocEntry) {\n if (tocEntry.pageIndex == undefined) return;\n\n //creates a string with non-void tocEntry.label and tocEntry.title\n const chapterStr = [tocEntry.label, tocEntry.title]\n .filter(x => x)\n .join(' ');\n\n const percentThrough = BookReader.util.cssPercentage(tocEntry.pageIndex, this.book.getNumLeafs() - 1);\n $(`<div></div>`)\n .append(\n $('<div />')\n .text(chapterStr)\n .append($('<div class=\"BRchapterPage\" />').text(`Page ${tocEntry.pagenum}`))\n )\n .addClass('BRchapter')\n .css({ left: percentThrough })\n .appendTo(this.$('.BRnavline'))\n .on(\"mouseenter\", event => {\n // remove hover effect from other markers then turn on just for this\n const marker = event.currentTarget;\n const tooltip = marker.querySelector('div');\n const tooltipOffset = tooltip.getBoundingClientRect();\n const targetOffset = marker.getBoundingClientRect();\n const boxSizeAdjust = parseInt(getComputedStyle(tooltip).paddingLeft) * 2;\n if (tooltipOffset.x - boxSizeAdjust < 0) {\n tooltip.style.setProperty('transform', `translateX(-${targetOffset.left - boxSizeAdjust}px)`);\n }\n this.$('.BRsearch,.BRchapter').removeClass('front');\n $(event.target).addClass('front');\n })\n .on(\"mouseleave\", event => $(event.target).removeClass('front'))\n .on('click', () => {\n this._chaptersUpdateCurrent(tocEntry.pageIndex);\n this.jumpToIndex(tocEntry.pageIndex);\n });\n\n this.$('.BRchapter, .BRsearch').each((i, el) => {\n const $el = $(el);\n $el\n .on(\"mouseenter\", () => $el.addClass('front'))\n .on(\"mouseleave\", () => $el.removeClass('front'));\n });\n};\n\n/**\n * This makes a call to OL API and calls the given callback function with the\n * response from the API.\n *\n * @param {string} olHost\n * @param {string} ocaid\n */\nBookReader.prototype.getOpenLibraryRecord = async function (olHost, ocaid) {\n // Try looking up by ocaid first, then by source_record\n const baseURL = `${olHost}/query.json?type=/type/edition&*=`;\n const fetchUrlByBookId = `${baseURL}&ocaid=${ocaid}`;\n\n let data = await $.ajax({ url: fetchUrlByBookId, dataType: 'jsonp' });\n\n if (!data || !data.length) {\n // try sourceid\n data = await $.ajax({ url: `${baseURL}&source_records=ia:${ocaid}`, dataType: 'jsonp' });\n }\n\n return data?.[0];\n};\n\n/**\n * @private\n * Highlights the current chapter based on current page\n * @param {PageIndex} curIndex\n */\nBookReader.prototype._chaptersUpdateCurrent = function(\n curIndex = (this.mode == 2 ? Math.max(...this.displayedIndices) : this.firstIndex)\n) {\n const tocEntriesIndexed = this._tocEntries.filter((el) => el.pageIndex != undefined).reverse();\n const currChapter = tocEntriesIndexed[\n // subtract one so that 2up shows the right label\n tocEntriesIndexed.findIndex((chapter) => chapter.pageIndex <= curIndex)\n ];\n if (this._chaptersPanel) {\n this._chaptersPanel.currentChapter = currChapter;\n }\n};\n\n@customElement('br-chapters-panel')\nexport class BRChaptersPanel extends LitElement {\n /** @type {TocEntry[]} */\n @property({ type: Array })\n contents = [];\n\n /** @type {TocEntry?} */\n @property({ type: Object })\n currentChapter = {};\n\n /** @type {(pageIndex: PageIndex) => void} */\n jumpToPage = () => {};\n\n /**\n * @param {TocEntry[]} contents\n */\n constructor(contents) {\n super();\n this.contents = contents;\n }\n\n render() {\n return html`\n <ol>\n ${this.contents.map(tocEntry => this.renderTOCEntry(tocEntry))}\n </ol>\n `;\n }\n\n /**\n * @param {TocEntry} tocEntry\n */\n renderTOCEntry(tocEntry) {\n const chapterTitle = [tocEntry.label, tocEntry.title]\n .filter(x => x)\n .join(' ');\n const clickable = tocEntry.pageIndex != undefined;\n // note the click-tracking won't work...\n return html`\n <li\n class=\"\n BRtable-contents-el\n ${clickable ? 'clickable' : ''}\n ${tocEntry == this.currentChapter ? 'current' : ''}\n \"\n style=\"${styleMap({marginLeft: (tocEntry.level - 1) * 10 + 'px'})}\"\n data-event-click-tracking=\"${ifDefined(clickable ? \"BRTOCPanel|GoToChapter\" : undefined)}\"\n @click=\"${() => this.jumpToPage(tocEntry.pageIndex)}\"\n >\n ${chapterTitle}\n ${tocEntry.pagenum ? html`\n <br />\n <span class=\"BRTOCElementPage\">Page ${tocEntry.pagenum}</span>\n ` : nothing}\n </li>`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.dispatchEvent(new CustomEvent('connected'));\n }\n\n updated(changedProperties) {\n if (changedProperties.has('currentChapter')) {\n this.shadowRoot.querySelector('li.current')?.scrollIntoView({\n block: 'nearest',\n behavior: 'smooth',\n });\n }\n }\n\n static get styles() {\n return css`\n ol {\n padding: 0;\n margin: 0;\n margin-right: 5px;\n }\n li {\n padding: 10px;\n overflow: hidden;\n border-radius: 4px;\n }\n li.clickable {\n font-weight: normal;\n cursor: pointer;\n transition: background-color 0.2s;\n }\n\n li.clickable:not(.current):hover {\n background-color: rgba(255,255,255, 0.05);\n }\n\n li.current {\n background-color: rgba(255,255,255,0.9);\n color: #333;\n }\n\n .BRTOCElementPage {\n font-size: 0.85em;\n opacity: .8;\n }`;\n }\n}\n","/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\nimport {nothing} from '../lit-html.js';\n\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = <T>(value: T) => value ?? nothing;\n"],"names":["IAIconToc","styles","render","customElements","define","super_","_regeneratorRuntime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","defineProperty","obj","key","desc","value","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","call","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","methodName","return","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","val","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","arguments","apply","jQuery","extend","BookReader","defaultOptions","olHost","enableChaptersPlugin","bookId","init","this","options","ui","_chapterInit","_callee","_olEdition$table_of_c","olEdition","_this","_context","getOpenLibraryRecord","table_of_contents","_tocEntries","map","rawTOCEntry","assign","pageIndex","book","getPageIndex","pagenum","_chaptersRender","bind","eventNames","pageChanged","_chaptersUpdateCurrent","_this2","shell","menuProviders","id","icon","html","_templateObject","_taggedTemplateLiteral","label","component","_templateObject2","jumpToIndex","e","_chaptersPanel","target","updateMenuContents","_step","_iterator","_createForOfIteratorHelper","s","n","tocEntry","_chaptersRenderMarker","f","_this3","chapterStr","title","filter","x","join","percentThrough","util","cssPercentage","getNumLeafs","$","append","text","concat","addClass","css","left","appendTo","on","event","marker","currentTarget","tooltip","querySelector","tooltipOffset","getBoundingClientRect","targetOffset","boxSizeAdjust","parseInt","getComputedStyle","paddingLeft","style","setProperty","removeClass","each","el","$el","_ref2","_callee2","ocaid","_data","baseURL","fetchUrlByBookId","data","_context2","ajax","url","dataType","_x","_x2","curIndex","mode","Math","max","displayedIndices","firstIndex","tocEntriesIndexed","currChapter","findIndex","chapter","currentChapter","_decorate","customElement","_initialize","_LitElement","BRChaptersPanel","_LitElement2","_inherits","_super","contents","_this4","_classCallCheck","_assertThisInitialized","F","d","kind","decorators","property","Array","_this5","_templateObject3","renderTOCEntry","l","_this6","chapterTitle","clickable","_templateObject4","styleMap","marginLeft","level","t","jumpToPage","_templateObject5","nothing","_get","_getPrototypeOf","dispatchEvent","CustomEvent","changedProperties","_this$shadowRoot$quer","has","shadowRoot","scrollIntoView","block","behavior","static","_templateObject6","LitElement"],"sourceRoot":""}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
/*! For license information please see plugin.search.js.LICENSE.txt */
|
2
|
-
(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[73],{2225:function(e,t,r){"use strict";r(4916),r(4765),r(9826),r(1539),r(1249),r(5306),r(2222),r(9601),r(8674),r(9720),r(4678),r(6992),r(8783),r(3948),r(1637),r(2526),r(1817),r(2165),r(2443),r(3680),r(3706),r(2703),r(489),r(4747),r(8309),r(5069),r(7042),r(9714),r(1038);var n=r(5685),a=r(9860),o=(r(1058),r(6649),r(6078),r(9653),r(5311));function i(e){return i="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},i(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(void 0,a=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n.key),"symbol"===i(a)?a:String(a)),n)}var a}var c=function(){function e(t){var r=t.br,n=t.searchCancelledCallback,a=void 0===n?function(){}:n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.br=r,this.matches=[],this.cacheDOMElements(),this.bindEvents(),this.cancelSearch=a}var t,r;return t=e,r=[{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.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";o(".BRnav").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=o(".".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,r){return t[0]>r}))+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,r){return e[e.length-1]>r}))-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=function t(r,n){if(1===r.length)return r[0];var a=r.slice(0,r.length/2),o=r.slice(r.length/2);return t(e(a,o,n)?a:o,n)}(this.matches.map((function(e){return e.par[0].page})),this.br.currentIndex()+1);return this.matches.indexOf(this.matches.find((function(e){return e.par[0].page===t})))}},{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=o(".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.imagesBaseURL,'icon_search_button.svg" />\n </button>\n </form>\n '),e}},{key:"renderPins",value:function(e){var t=this;e.forEach((function(e){var r=t.br.book.leafNumToIndex(e.par[0].page),n=t.br.constructor.util.cssPercentage(r,t.br.book.getNumLeafs()-1),a=e.html;if(a.length>200){var i=Math.max(0,a.indexOf("<mark>")-100);0!=i&&(a="…"+e.html.substring(i).replace(/^\S+/,""))}o("<div>").addClass("BRsearch").css({left:n}).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,r=t.querySelector(".BRquery"),n=r.getBoundingClientRect(),a=t.getBoundingClientRect(),i=2*parseInt(getComputedStyle(r).paddingLeft);n.x-i<0&&r.style.setProperty("transform","translateX(-".concat(a.left-i,"px)")),o(".BRsearch,.BRchapter").removeClass("front"),o(e.target).addClass("front")})).on("mouseleave",(function(e){return o(e.target).removeClass("front")})).on("click",(function(){t.br._searchPluginGoToResult(e.matchIndex)}))}))}},{key:"toggleSearchPending",value:function(e){var t=this;e?this.br.showProgressPopup("Search results will appear below...",(function(){return t.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,document.querySelector(this.br.el).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 r=this,n=t.results,a=t.options;this.matches=n.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderPins(n.matches),this.toggleSearchPending(!1),a.goToFirstResult?o(document).one("BookReader:pageChanged",(function(){r.br.resize()})):this.br.resize()}},{key:"handleSearchStarted",value:function(){this.emptyMatches(),this.br.removeSearchHilites(),this.removeResultPins(),this.toggleSearchPending(!0),this.teardownSearchNavigation(),this.setQuery(this.br.searchTerm)}},{key:"handleSearchCallbackError",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.toggleSearchPending(!1);var r=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(r)}},{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)),o(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))}}],r&&s(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),h=c;function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=u(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function u(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r){var a=(0,n.escapeRegExp)((0,n.escapeHTML)(t)),o=(0,n.escapeRegExp)((0,n.escapeHTML)(r)),i=new RegExp("".concat(a,"([^]+?)").concat(o),"g");return(0,n.escapeHTML)(e).replace(i,"<mark>$1</mark>").replace(/(\b)- /g,"$1")}r(4603);var p,v=r(5311),g=r(5311);function m(e){return m="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},m(e)}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function b(e,t){if(e){if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function S(){S=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function h(e,t,r,a){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),s=new B(a||[]);return n(i,"_invoke",{value:R(e,r,s)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=h;var u={};function d(){}function f(){}function p(){}var v={};c(v,o,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(C([])));y&&y!==t&&r.call(y,o)&&(v=y);var b=p.prototype=d.prototype=Object.create(v);function k(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function a(n,o,i,s){var c=l(e[n],e,o);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==m(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){a("next",e,i,s)}),(function(e){a("throw",e,i,s)})):t.resolve(u).then((function(e){h.value=e,i(h)}),(function(e){return a("throw",e,i,s)}))}s(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){a(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function R(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=w(i,r);if(s){if(s===u)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function w(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var a=l(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,u;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function B(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:M}}function M(){return{value:void 0,done:!0}}return f.prototype=p,n(b,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=c(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,c(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},k(x.prototype),c(x.prototype,i,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new x(h(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(b),c(b,s,"Generator"),c(b,o,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=C,B.prototype={constructor:B,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;I(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function x(e,t,r,n,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,a)}function R(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){x(o,n,a,i,s,"next",e)}function s(e){x(o,n,a,i,s,"throw",e)}i(void 0)}))}}v.extend(BookReader.defaultOptions,{server:"ia600609.us.archive.org",bookId:"",subPrefix:"",bookPath:"",enableSearch:!0,searchInsideProtocol:"https",searchInsideUrl:"/fulltext/inside.php",searchInsidePreTag:"{{{",searchInsidePostTag:"}}}",initialSearchTerm:null}),BookReader.prototype.setup=(p=BookReader.prototype.setup,function(e){p.call(this,e),this.searchTerm="",this.searchResults=null,this.searchInsideUrl=e.searchInsideUrl,this.enableSearch=e.enableSearch,this.bookId=e.bookId,this.server=e.server,this.subPrefix=e.subPrefix,this.bookPath=e.bookPath,this.searchXHR=null,this._cancelSearch.bind(this),this.cancelSearchRequest.bind(this),this._searchBoxesByIndex={},this.searchView=void 0}),BookReader.prototype.init=function(e){return function(){var t=this;e.call(this),this.searchView=new h({br:this,searchCancelledCallback:function(){t._cancelSearch(),t.trigger("SearchCanceled",{term:t.searchTerm,instance:t})}}),this.options.enableSearch&&this.options.initialSearchTerm&&this.search(this.options.initialSearchTerm,{goToFirstResult:this.options.goToFirstResult,suppressFragmentChange:!1})}}(BookReader.prototype.init),BookReader.prototype.buildToolbarElement=function(e){return function(){var t=e.call(this);if(this.enableSearch)return this.searchView.dom.toolbarSearch&&t.find(".BRtoolbarSectionInfo").after(this.searchView.dom.toolbarSearch),t}}(BookReader.prototype.buildToolbarElement),BookReader.prototype._createPageContainer=function(e){return function(t){var r=e.call(this,t);if(this.enableSearch&&r.page&&t in this._searchBoxesByIndex){var n=r.page.index,o=this._searchBoxesByIndex[n];(0,a.Tm)("searchHiliteLayer",o,r.page,r.$container[0],o.map((function(e){return"match-index-".concat(e.matchIndex)})))}return r}}(BookReader.prototype._createPageContainer),BookReader.prototype.search=R(S().mark((function e(){var t,r,n,a,o,i,s,c,h,l,u,d,f=this,p=arguments;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:"",r=p.length>1&&void 0!==p[1]?p[1]:{},n={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},a=v.extend({},n,r),this.suppressFragmentChange=a.suppressFragmentChange,this.searchCancelled=!1,this.searchTerm=t.replace(/\//g," "),a.suppressFragmentChange||this.trigger(BookReader.eventNames.fragmentChange),o=this.server.replace(/:.+/,""),i="".concat(this.options.searchInsideProtocol,"://").concat(o).concat(this.searchInsideUrl,"?"),s=this.bookPath,c="/".concat(this.subPrefix),this.bookPath.length-this.bookPath.lastIndexOf(c)==c.length&&(s=this.bookPath.substr(0,this.bookPath.length-c.length)),h={item_id:this.bookId,doc:this.subPrefix,path:s,q:t,pre_tag:this.options.searchInsidePreTag,post_tag:this.options.searchInsidePostTag},l=g.param(h).replace(/%2F/g,"/"),u="".concat(i).concat(l),d=function(e){if(!f.searchCancelled){var t=e.error||!e.matches.length,r="function"==typeof a.error,n="function"==typeof a.success;t?(console.error("Search Inside Response Error",e.error||"matches.length == 0"),r?a.error.call(f,e,a):f.BRSearchCallbackError(e,a)):n?a.success.call(f,e,a):f.BRSearchCallback(e,a)}},this.trigger("SearchStarted",{term:this.searchTerm,instance:this}),e.t0=d,e.next=21,g.ajax({url:u,dataType:"jsonp",cache:!0,beforeSend:function(e){f.searchXHR=e}});case 21:e.t1=e.sent,(0,e.t0)(e.t1);case 23:case"end":return e.stop()}}),e,this)}))),BookReader.prototype._cancelSearch=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=[]},BookReader.prototype.cancelSearchRequest=function(){this.searchCancelled=!0,null!==this.searchXHR&&(this._cancelSearch(),this.searchView.toggleSearchPending(),this.trigger("SearchCanceled",{term:this.searchTerm,instance:this}))},BookReader.prototype.BRSearchCallback=function(e,t){var r=this;!function(e,t,n,a){var o,i,s,c,h=l(e.matches.entries());try{for(h.s();!(o=h.n()).done;){var d=(s=o.value,c=2,function(e){if(Array.isArray(e))return e}(s)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],c=!0,h=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){h=!0,a=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(h)throw a}}return s}}(s,c)||u(s,c)||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.")}()),p=d[0],v=d[1];v.matchIndex=p,v.displayPageNumber=(i=v.par[0].page,r.book.getPageNum(r.book.leafNumToIndex(i))),v.html=f(v.text,n,a);var g,m=l(v.par);try{for(m.s();!(g=m.n()).done;){var y,b=l(g.value.boxes);try{for(b.s();!(y=b.n()).done;)y.value.matchIndex=p}catch(e){b.e(e)}finally{b.f()}}}catch(e){m.e(e)}finally{m.f()}}}catch(e){h.e(e)}finally{h.f()}}(e,0,this.options.searchInsidePreTag,this.options.searchInsidePostTag),this.searchResults=e||[],this.updateSearchHilites(),this.removeProgressPopup(),t.goToFirstResult&&this._searchPluginGoToResult(0),this.trigger("SearchCallback",{results:e,options:t,instance:this})},BookReader.prototype.BRSearchCallbackError=function(e){this._BRSearchCallbackError(e)},BookReader.prototype._BRSearchCallbackError=function(e){this.searchResults=e;var t={term:this.searchTerm,instance:this};if(e.error){var r=Object.assign({},t,{results:e});this.trigger("SearchCallbackError",r)}else if(0==e.matches.length){if(!1===e.indexed)return void this.trigger("SearchCallbackBookNotIndexed",t);this.trigger("SearchCallbackEmpty",t)}},BookReader.prototype.updateSearchHilites=function(){var e,t=(null===(e=this.searchResults)||void 0===e?void 0:e.matches)||[],r={};this.removeSearchHilites();var n,o,i,s=y(t);try{for(s.s();!(n=s.n()).done;){var c,h=y(n.value.par[0].boxes);try{for(h.s();!(c=h.n()).done;){var l=c.value,u=this.book.leafNumToIndex(l.page);(r[u]||(r[u]=[])).push(l)}}catch(e){h.e(e)}finally{h.f()}}}catch(e){s.e(e)}finally{s.f()}for(var d=0,f=Object.entries(r);d<f.length;d++){var p,v=(o=f[d],i=2,function(e){if(Array.isArray(e))return e}(o)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],c=!0,h=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){h=!0,a=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(h)throw a}}return s}}(o,i)||b(o,i)||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.")}()),g=v[0],m=v[1],k=parseFloat(g),S=this.book.getPage(k),x=y(this.getActivePageContainerElementsForIndex(k));try{for(x.s();!(p=x.n()).done;){var R=p.value;(0,a.Tm)("searchHiliteLayer",m,S,R,m.map((function(e){return"match-index-".concat(e.matchIndex)})))}}catch(e){x.e(e)}finally{x.f()}}this._searchBoxesByIndex=r},BookReader.prototype.removeSearchHilites=function(){g(this.getActivePageContainerElements()).find(".searchHiliteLayer").remove()},BookReader.prototype._searchPluginGoToResult=function(){var e=R(S().mark((function e(t){var r,a,o,i,s,c,h,l,u,d,f,p;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null===(r=this.searchResults)||void 0===r?void 0:r.matches[t],o=this.book,i=o.leafNumToIndex(a.par[0].page),s=o.getPage(i),c=Math.abs(this.currentIndex()-i)<3,h=!1,s.isViewable){e.next=17;break}return e.next=9,fetch("/services/bookreader/request_page?"+new URLSearchParams({id:this.options.bookId,subprefix:this.options.subPrefix,leafNum:s.leafNum})).then((function(e){return e.json()}));case 9:l=e.sent,u=y(l.value);try{for(u.s();!(d=u.n()).done;)f=d.value,o.getPage(o.leafNumToIndex(f)).makeViewable()}catch(e){u.e(e)}finally{u.f()}if(l.value.length||(o.getPage(i).makeViewable(),h=!0),this._modes.mode1Up.mode1UpLit.updatePages(),this.activeMode!=this._modes.mode1Up){e.next=17;break}return e.next=17,this._modes.mode1Up.mode1UpLit.updateComplete;case 17:return this._isIndexDisplayed(i)||(this.suppressFragmentChange=!1,this.jumpToIndex(i)),h&&o.getPage(i).makeViewable(!1),e.next=21,(0,n.poll)((function(){return g("rect.match-index-".concat(a.matchIndex))}),{until:function(e){return e.length>0}});case 21:if(!(p=e.sent).length){e.next=28;break}return p.css("animation","none"),p[0].scrollIntoView({block:this.constMode1up==this.mode||this.isFullscreenActive?"center":"nearest",inline:"center",behavior:c?"smooth":"auto"}),e.next=27,new Promise((function(e){return setTimeout(e,100)}));case 27:p.removeAttr("style");case 28:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),BookReader.prototype.removeSearchResults=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.removeSearchHilites(),this.searchTerm=null,this.searchResults=null,e||this.trigger(BookReader.eventNames.fragmentChange)},BookReader.prototype.searchHighlightVisible=function(){var e=this,t=this.searchResults,r=[];if(null==t)return!1;if(this.constMode2up==this.mode)r=[this.twoPage.currentIndexL,this.twoPage.currentIndexR];else{if(this.constMode1up!=this.mode)return!1;r=[this.currentIndex()]}return t.matches.some((function(t){return t.par[0].boxes.some((function(t){var n=e.book.leafNumToIndex(t.page);if(v.inArray(n,r)>=0)return!0}))})),!1}},9720:function(e,t,r){var n=r(2109),a=r(4699).entries;n({target:"Object",stat:!0},{entries:function(e){return a(e)}})}},function(e){e(e.s=2225)}]);
|
2
|
+
(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[73],{2225:function(e,t,r){"use strict";r(4916),r(4765),r(9826),r(1539),r(1249),r(5306),r(2222),r(9601),r(8674),r(9720),r(4678),r(6992),r(8783),r(3948),r(1637),r(2526),r(1817),r(2165),r(2443),r(3680),r(3706),r(2703),r(489),r(4747),r(8309),r(5069),r(7042),r(9714),r(1038);var n=r(5685),a=r(9860),o=(r(1058),r(6649),r(6078),r(9653),r(5311));function i(e){return i="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},i(e)}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,(void 0,a=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n.key),"symbol"===i(a)?a:String(a)),n)}var a}var c=function(){function e(t){var r=t.br,n=t.searchCancelledCallback,a=void 0===n?function(){}:n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.br=r,this.matches=[],this.cacheDOMElements(),this.bindEvents(),this.cancelSearch=a}var t,r;return t=e,r=[{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.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";o(".BRnav").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=o(".".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,r){return t[0]>r}))+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,r){return e[e.length-1]>r}))-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=function t(r,n){if(1===r.length)return r[0];var a=r.slice(0,r.length/2),o=r.slice(r.length/2);return t(e(a,o,n)?a:o,n)}(this.matches.map((function(e){return e.par[0].page})),this.br.currentIndex()+1);return this.matches.indexOf(this.matches.find((function(e){return e.par[0].page===t})))}},{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=o(".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.imagesBaseURL,'icon_search_button.svg" />\n </button>\n </form>\n '),e}},{key:"renderPins",value:function(e){var t=this;e.forEach((function(e){var r=t.br.book.leafNumToIndex(e.par[0].page),n=t.br.constructor.util.cssPercentage(r,t.br.book.getNumLeafs()-1),a=e.html;if(a.length>200){var i=Math.max(0,a.indexOf("<mark>")-100);0!=i&&(a="…"+e.html.substring(i).replace(/^\S+/,""))}o("<div>").addClass("BRsearch").css({left:n}).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,r=t.querySelector(".BRquery"),n=r.getBoundingClientRect(),a=t.getBoundingClientRect(),i=2*parseInt(getComputedStyle(r).paddingLeft);n.x-i<0&&r.style.setProperty("transform","translateX(-".concat(a.left-i,"px)")),o(".BRsearch,.BRchapter").removeClass("front"),o(e.target).addClass("front")})).on("mouseleave",(function(e){return o(e.target).removeClass("front")})).on("click",(function(){t.br._searchPluginGoToResult(e.matchIndex)}))}))}},{key:"toggleSearchPending",value:function(e){var t=this;e?this.br.showProgressPopup("Search results will appear below...",(function(){return t.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,document.querySelector(this.br.el).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 r=this,n=t.results,a=t.options;this.matches=n.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderPins(n.matches),this.toggleSearchPending(!1),a.goToFirstResult?o(document).one("BookReader:pageChanged",(function(){r.br.resize()})):this.br.resize()}},{key:"handleSearchStarted",value:function(){this.emptyMatches(),this.br.removeSearchHilites(),this.removeResultPins(),this.toggleSearchPending(!0),this.teardownSearchNavigation(),this.setQuery(this.br.searchTerm)}},{key:"handleSearchCallbackError",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.toggleSearchPending(!1);var r=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(r)}},{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)),o(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))}}],r&&s(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),h=c;function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=u(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function u(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t,r){var a=(0,n.escapeRegExp)((0,n.escapeHTML)(t)),o=(0,n.escapeRegExp)((0,n.escapeHTML)(r)),i=new RegExp("".concat(a,"([^]+?)").concat(o),"g");return(0,n.escapeHTML)(e).replace(i,"<mark>$1</mark>").replace(/(\b)- /g,"$1")}r(4603);var p,v=r(5311),g=r(5311);function m(e){return m="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},m(e)}function y(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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 o,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw o}}}}function b(e,t){if(e){if("string"==typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function k(){k=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function h(e,t,r,a){var o=t&&t.prototype instanceof d?t:d,i=Object.create(o.prototype),s=new B(a||[]);return n(i,"_invoke",{value:R(e,r,s)}),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=h;var u={};function d(){}function f(){}function p(){}var v={};c(v,o,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(C([])));y&&y!==t&&r.call(y,o)&&(v=y);var b=p.prototype=d.prototype=Object.create(v);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){function a(n,o,i,s){var c=l(e[n],e,o);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==m(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){a("next",e,i,s)}),(function(e){a("throw",e,i,s)})):t.resolve(u).then((function(e){h.value=e,i(h)}),(function(e){return a("throw",e,i,s)}))}s(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){a(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function R(e,t,r){var n="suspendedStart";return function(a,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===a)throw o;return{value:void 0,done:!0}}for(r.method=a,r.arg=o;;){var i=r.delegate;if(i){var s=w(i,r);if(s){if(s===u)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function w(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),u;var a=l(n,e.iterator,t.arg);if("throw"===a.type)return t.method="throw",t.arg=a.arg,t.delegate=null,u;var o=a.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function B(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function C(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:M}}function M(){return{value:void 0,done:!0}}return f.prototype=p,n(b,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=c(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,c(e,s,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},S(x.prototype),c(x.prototype,i,(function(){return this})),e.AsyncIterator=x,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new x(h(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(b),c(b,s,"Generator"),c(b,o,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=C,B.prototype={constructor:B,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),I(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;I(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:C(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function x(e,t,r,n,a,o,i){try{var s=e[o](i),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,a)}function R(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){x(o,n,a,i,s,"next",e)}function s(e){x(o,n,a,i,s,"throw",e)}i(void 0)}))}}v.extend(BookReader.defaultOptions,{server:"ia600609.us.archive.org",bookId:"",subPrefix:"",bookPath:"",enableSearch:!0,searchInsideProtocol:"https",searchInsideUrl:"/fulltext/inside.php",searchInsidePreTag:"{{{",searchInsidePostTag:"}}}",initialSearchTerm:null}),BookReader.prototype.setup=(p=BookReader.prototype.setup,function(e){p.call(this,e),this.searchTerm="",this.searchResults=null,this.searchInsideUrl=e.searchInsideUrl,this.enableSearch=e.enableSearch,this.bookId=e.bookId,this.server=e.server,this.subPrefix=e.subPrefix,this.bookPath=e.bookPath,this.searchXHR=null,this._cancelSearch.bind(this),this.cancelSearchRequest.bind(this),this._searchBoxesByIndex={},this.searchView=void 0}),BookReader.prototype.init=function(e){return function(){var t=this;e.call(this),this.searchView=new h({br:this,searchCancelledCallback:function(){t._cancelSearch(),t.trigger("SearchCanceled",{term:t.searchTerm,instance:t})}}),this.options.enableSearch&&this.options.initialSearchTerm&&this.search(this.options.initialSearchTerm,{goToFirstResult:this.options.goToFirstResult,suppressFragmentChange:!1})}}(BookReader.prototype.init),BookReader.prototype.buildToolbarElement=function(e){return function(){var t=e.call(this);if(this.enableSearch)return this.searchView.dom.toolbarSearch&&t.find(".BRtoolbarSectionInfo").after(this.searchView.dom.toolbarSearch),t}}(BookReader.prototype.buildToolbarElement),BookReader.prototype._createPageContainer=function(e){return function(t){var r=e.call(this,t);if(this.enableSearch&&r.page&&t in this._searchBoxesByIndex){var n=r.page.index,o=this._searchBoxesByIndex[n];(0,a.Tm)("searchHiliteLayer",o,r.page,r.$container[0],o.map((function(e){return"match-index-".concat(e.matchIndex)})))}return r}}(BookReader.prototype._createPageContainer),BookReader.prototype.search=R(k().mark((function e(){var t,r,n,a,o,i,s,c,h,l,u,d,f=this,p=arguments;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.length>0&&void 0!==p[0]?p[0]:"",r=p.length>1&&void 0!==p[1]?p[1]:{},n={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},a=v.extend({},n,r),this.suppressFragmentChange=a.suppressFragmentChange,this.searchCancelled=!1,this.searchTerm=t.replace(/\//g," "),a.suppressFragmentChange||this.trigger(BookReader.eventNames.fragmentChange),o=this.server.replace(/:.+/,""),i="".concat(this.options.searchInsideProtocol,"://").concat(o).concat(this.searchInsideUrl,"?"),s=this.bookPath,c="/".concat(this.subPrefix),this.bookPath.length-this.bookPath.lastIndexOf(c)==c.length&&(s=this.bookPath.substr(0,this.bookPath.length-c.length)),h={item_id:this.bookId,doc:this.subPrefix,path:s,q:t,pre_tag:this.options.searchInsidePreTag,post_tag:this.options.searchInsidePostTag},l=g.param(h).replace(/%2F/g,"/"),u="".concat(i).concat(l),d=function(e){if(!f.searchCancelled){var t=e.error||!e.matches.length,r="function"==typeof a.error,n="function"==typeof a.success;t?(console.error("Search Inside Response Error",e.error||"matches.length == 0"),r?a.error.call(f,e,a):f.BRSearchCallbackError(e,a)):n?a.success.call(f,e,a):f.BRSearchCallback(e,a)}},this.trigger("SearchStarted",{term:this.searchTerm,instance:this}),e.t0=d,e.next=21,g.ajax({url:u,dataType:"jsonp",cache:!0,beforeSend:function(e){f.searchXHR=e}});case 21:e.t1=e.sent,(0,e.t0)(e.t1);case 23:case"end":return e.stop()}}),e,this)}))),BookReader.prototype._cancelSearch=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=[]},BookReader.prototype.cancelSearchRequest=function(){this.searchCancelled=!0,null!==this.searchXHR&&(this._cancelSearch(),this.searchView.toggleSearchPending(),this.trigger("SearchCanceled",{term:this.searchTerm,instance:this}))},BookReader.prototype.BRSearchCallback=function(e,t){var r=this;!function(e,t,n,a){var o,i,s,c,h=l(e.matches.entries());try{for(h.s();!(o=h.n()).done;){var d=(s=o.value,c=2,function(e){if(Array.isArray(e))return e}(s)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],c=!0,h=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){h=!0,a=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(h)throw a}}return s}}(s,c)||u(s,c)||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.")}()),p=d[0],v=d[1];v.matchIndex=p,v.displayPageNumber=(i=v.par[0].page,r.book.getPageNum(r.book.leafNumToIndex(i))),v.html=f(v.text,n,a);var g,m=l(v.par);try{for(m.s();!(g=m.n()).done;){var y,b=l(g.value.boxes);try{for(b.s();!(y=b.n()).done;)y.value.matchIndex=p}catch(e){b.e(e)}finally{b.f()}}}catch(e){m.e(e)}finally{m.f()}}}catch(e){h.e(e)}finally{h.f()}}(e,0,this.options.searchInsidePreTag,this.options.searchInsidePostTag),this.searchResults=e||[],this.updateSearchHilites(),this.removeProgressPopup(),t.goToFirstResult&&this._searchPluginGoToResult(0),this.trigger("SearchCallback",{results:e,options:t,instance:this})},BookReader.prototype.BRSearchCallbackError=function(e){this._BRSearchCallbackError(e)},BookReader.prototype._BRSearchCallbackError=function(e){this.searchResults=e;var t={term:this.searchTerm,instance:this};if(e.error){var r=Object.assign({},t,{results:e});this.trigger("SearchCallbackError",r)}else if(0==e.matches.length){if(!1===e.indexed)return void this.trigger("SearchCallbackBookNotIndexed",t);this.trigger("SearchCallbackEmpty",t)}},BookReader.prototype.updateSearchHilites=function(){var e,t=(null===(e=this.searchResults)||void 0===e?void 0:e.matches)||[],r={};this.removeSearchHilites();var n,o,i,s=y(t);try{for(s.s();!(n=s.n()).done;){var c,h=y(n.value.par[0].boxes);try{for(h.s();!(c=h.n()).done;){var l=c.value,u=this.book.leafNumToIndex(l.page);(r[u]||(r[u]=[])).push(l)}}catch(e){h.e(e)}finally{h.f()}}}catch(e){s.e(e)}finally{s.f()}for(var d=0,f=Object.entries(r);d<f.length;d++){var p,v=(o=f[d],i=2,function(e){if(Array.isArray(e))return e}(o)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,s=[],c=!0,h=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(s.push(n.value),s.length!==t);c=!0);}catch(e){h=!0,a=e}finally{try{if(!c&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(h)throw a}}return s}}(o,i)||b(o,i)||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.")}()),g=v[0],m=v[1],S=parseFloat(g),k=this.book.getPage(S),x=y(this.getActivePageContainerElementsForIndex(S));try{for(x.s();!(p=x.n()).done;){var R=p.value;(0,a.Tm)("searchHiliteLayer",m,k,R,m.map((function(e){return"match-index-".concat(e.matchIndex)})))}}catch(e){x.e(e)}finally{x.f()}}this._searchBoxesByIndex=r},BookReader.prototype.removeSearchHilites=function(){g(this.getActivePageContainerElements()).find(".searchHiliteLayer").remove()},BookReader.prototype._searchPluginGoToResult=function(){var e=R(k().mark((function e(t){var r,a,o,i,s,c,h,l,u,d,f,p;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null===(r=this.searchResults)||void 0===r?void 0:r.matches[t],o=this.book,i=o.leafNumToIndex(a.par[0].page),s=o.getPage(i),c=Math.abs(this.currentIndex()-i)<3,h=!1,s.isViewable){e.next=17;break}return e.next=9,fetch("/services/bookreader/request_page?"+new URLSearchParams({id:this.options.bookId,subprefix:this.options.subPrefix,leafNum:s.leafNum})).then((function(e){return e.json()}));case 9:l=e.sent,u=y(l.value);try{for(u.s();!(d=u.n()).done;)f=d.value,o.getPage(o.leafNumToIndex(f)).makeViewable()}catch(e){u.e(e)}finally{u.f()}if(l.value.length||(o.getPage(i).makeViewable(),h=!0),this._modes.mode1Up.mode1UpLit.updatePages(),this.activeMode!=this._modes.mode1Up){e.next=17;break}return e.next=17,this._modes.mode1Up.mode1UpLit.updateComplete;case 17:return this._isIndexDisplayed(i)||(this.suppressFragmentChange=!1,this.jumpToIndex(i)),h&&o.getPage(i).makeViewable(!1),e.next=21,(0,n.poll)((function(){return g("rect.match-index-".concat(a.matchIndex))}),{until:function(e){return e.length>0}});case 21:if(!(p=e.sent).length){e.next=28;break}return p.css("animation","none"),p[0].scrollIntoView({block:this.constMode1up==this.mode||this.isFullscreenActive?"center":"nearest",inline:"center",behavior:c?"smooth":"auto"}),e.next=27,new Promise((function(e){return setTimeout(e,100)}));case 27:p.removeAttr("style");case 28:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),BookReader.prototype.removeSearchResults=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.removeSearchHilites(),this.searchTerm=null,this.searchResults=null,e||this.trigger(BookReader.eventNames.fragmentChange)},BookReader.prototype.searchHighlightVisible=function(){var e=this,t=this.searchResults,r=[];if(null==t)return!1;if(this.constMode2up==this.mode)r=[this.twoPage.currentIndexL,this.twoPage.currentIndexR];else{if(this.constMode1up!=this.mode)return!1;r=[this.currentIndex()]}return t.matches.some((function(t){return t.par[0].boxes.some((function(t){var n=e.book.leafNumToIndex(t.page);if(v.inArray(n,r)>=0)return!0}))})),!1}},2814:function(e,t,r){var n=r(7854),a=r(7293),o=r(1702),i=r(1340),s=r(3111).trim,c=r(1361),h=o("".charAt),l=n.parseFloat,u=n.Symbol,d=u&&u.iterator,f=1/l(c+"-0")!=-1/0||d&&!a((function(){l(Object(d))}));e.exports=f?function(e){var t=s(i(e)),r=l(t);return 0===r&&"-"==h(t,0)?-0:r}:l},9720:function(e,t,r){var n=r(2109),a=r(4699).entries;n({target:"Object",stat:!0},{entries:function(e){return a(e)}})},4678:function(e,t,r){var n=r(2109),a=r(2814);n({global:!0,forced:parseFloat!=a},{parseFloat:a})}},function(e){e(e.s=2225)}]);
|
3
3
|
//# sourceMappingURL=plugin.search.js.map
|