New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@internetarchive/bookreader

Package Overview
Dependencies
Maintainers
11
Versions
311
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/bookreader - npm Package Compare versions

Comparing version 4.26.1 to 4.26.2-alpha1

2

BookReader/plugins/plugin.search.js

@@ -1,2 +0,2 @@

(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[73],{2728:function(e,t,n){"use strict";n(2222),n(9826),n(9554),n(6992),n(4986),n(5827),n(5212),n(9601),n(1539),n(8674),n(4916),n(8783),n(5306),n(4765),n(4747),n(3948),n(285),n(5666),n(2772),n(9600),n(1249),n(7042),n(4603),n(9714);var r=n(3609);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i,o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.selector?(this.br=t.br,this.matcher=new RegExp("{{{(.+?)}}}","g"),this.matches=[],this.cacheDOMElements(t.selector),this.bindEvents()):console.warn("BookReader::Search - SearchView must be passed a valid CSS selector")}var t,n;return t=e,(n=[{key:"cacheDOMElements",value:function(e){this.dom={},this.dom.searchTray=this.renderSearchTray(e),this.dom.results=this.dom.searchTray.querySelector('[data-id="results"]'),this.dom.resultsCount=this.dom.searchTray.querySelector('[data-id="results_count"]'),this.dom.searchField=this.dom.searchTray.querySelector('[name="query"]'),this.dom.searchPending=this.dom.searchTray.querySelector('[data-id="searchPending"]'),this.dom.mobileSearch=this.buildMobileDrawer(),this.dom.toolbarSearch=this.buildToolbarSearch()}},{key:"toggleSearchTray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dom.searchTray.classList.contains("hidden");this.dom.searchTray.classList.toggle("hidden",!e)}},{key:"toggleResultsCount",value:function(e){this.dom.resultsCount.classList.toggle("visible",e)}},{key:"updateResultsCount",value:function(e){this.dom.resultsCount.innerText="(".concat(e," result").concat(1!=e?"s":"",")"),this.toggleResultsCount(!0)}},{key:"setQuery",value:function(e){this.br.$('[name="query"]').val(e)}},{key:"emptyMatches",value:function(){this.dom.results.innerHTML="",this.matches=[]}},{key:"removeResultPins",value:function(){this.br.$(".BRnavpos .BRsearch").remove()}},{key:"clearSearchFieldAndResults",value:function(){this.br.removeSearchResults(),this.toggleResultsCount(!1),this.removeResultPins(),this.emptyMatches(),this.setQuery(""),this.teardownSearchNavigation(),this.br.trigger("SearchResultsCleared")}},{key:"toggleSidebar",value:function(){this.br.trigger("ToggleSearchMenu")}},{key:"renderSearchTray",value:function(e){var t=document.createElement("div");return t.setAttribute("id",e.replace(/^#/,"")),t.innerHTML='\n <header>\n <div>\n <h3>Search inside</h3>\n <p data-id="results_count"></p>\n </div>\n <a href="#" class="close"></a>\n </header>\n <form action="" method="get">\n <fieldset>\n <input name="all_files" id="all_files" type="checkbox" />\n <label class="checkbox" for="all_files">Search all files</label>\n <input type="search" name="query" placeholder="Enter a search term" />\n </fieldset>\n </form>\n <div data-id="searchPending" id="search_pending">\n <p>Your search results will appear below</p>\n <div class="loader tc mt20"></div>\n </div>\n <ul data-id="results"></ul>\n ',t}},{key:"renderSearchNavigation",value:function(){var e="BRsearch-navigation";r(".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=r(".".concat(e))}},{key:"resultsPosition",value:function(){var e="".concat(this.matches.length," result").concat(1===this.matches.length?"":"s");return~this.currentMatchIndex&&(e="".concat(this.currentMatchIndex+1," / ").concat(this.matches.length)),e}},{key:"bindSearchNavigationEvents",value:function(){if(this.dom.searchNavigation){var e="searchNavigation";this.dom.searchNavigation.on("click.".concat(e),".clear",this.clearSearchFieldAndResults.bind(this)).on("click.".concat(e),".prev",this.showPrevResult.bind(this)).on("click.".concat(e),".next",this.showNextResult.bind(this)).on("click.".concat(e),".toggle-sidebar",this.toggleSidebar.bind(this)).on("click.".concat(e),!1)}}},{key:"showPrevResult",value:function(){0!==this.currentMatchIndex&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex((function(e,t,n){return t[0]>n}))+1),this.br.$(".BRnavline .BRsearch").eq(--this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"showNextResult",value:function(){this.currentMatchIndex+1!==this.matches.length&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex((function(e,t,n){return e[e.length-1]>n}))-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=function t(n,r){if(1===n.length)return n[0];var a=n.slice(0,n.length/2),i=n.slice(n.length/2);return t(e(a,i,r)?a:i,r)}(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.find("[data-id=resultsCount]").text(this.resultsPosition())}},{key:"updateSearchNavigationButtons",value:function(){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=r(".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:"renderMatches",value:function(e){var t=this,n=e.map((function(e){return'\n <li data-page="'.concat(e.par[0].page,'" data-page-index="').concat(t.br.leafNumToIndex(e.par[0].page),'">\n <h4>Page ').concat(e.par[0].page,"</h4>\n <p>").concat(e.text.replace(t.matcher,"<mark>$1</mark>"),"</p>\n </li>\n ")}));this.dom.results.innerHTML=n.join("")}},{key:"togglePinsFor",value:function(e){var t=e?"visible":"hidden";this.br.refs.$BRfooter.find(".BRsearch").css({visibility:t})}},{key:"buildMobileDrawer",value:function(){var e=document.createElement("li");return e.innerHTML='\n <span>\n <span class="DrawerIconWrapper">\n <img class="DrawerIcon" src="'.concat(this.br.imagesBaseURL,'icon_search_button.svg" />\n </span>\n Search\n </span>\n <div data-id="search_slot">\n </div>\n '),e.querySelector('[data-id="search_slot"]').appendChild(this.dom.searchTray),e.classList.add("BRmobileMenu__search"),e}},{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 n=e.text,a=t.br.leafNumToIndex(e.par[0].page),i=t.br.getPageNum(a),o=t.br.constructor.util.cssPercentage(a,t.br.getNumLeafs()-1),s=n.replace(t.matcher,"<b>$1</b>"),c="";n.length>100&&(c=n.replace(/^(.{100}[^\s]*).*/,"$1").replace(t.matcher,"<b>$1</b>")+"..."),r("<div>").addClass("BRsearch").css({left:o}).attr("title","Search result").append('\n <div class="BRquery">\n <div>'.concat(c||s,"</div>\n <div>").concat("Page"," ").concat(i,"</div>\n </div>\n ")).data({pageIndex:a}).appendTo(t.br.$(".BRnavline")).hover((function(e){var t=e.currentTarget,n=t.querySelector(".BRquery"),a=n.getBoundingClientRect(),i=t.getBoundingClientRect(),o=2*parseInt(getComputedStyle(n).paddingLeft);a.x-o<0&&n.style.setProperty("transform","translateX(-".concat(i.left-o,"px)")),r(".BRsearch,.BRchapter").removeClass("front"),r(e.target).addClass("front")}),(function(e){return r(e.target).removeClass("front")})).click(function(e){this.br._searchPluginGoToResult(+r(e.target).data("pageIndex")),this.br.updateSearchHilites()}.bind(t))}))}},{key:"toggleSearchPending",value:function(e){this.dom.searchPending.classList.toggle("visible",e),e?this.br.showProgressPopup("Search results will appear below..."):this.br.removeProgressPopup()}},{key:"renderErrorModal",value:function(){this.renderModalMessage("\n Sorry, there was an error with your search.\n <br />\n The text may still be processing.\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:"openMobileMenu",value:function(){this.br.refs.$mmenu.data("mmenu").open()}},{key:"closeMobileMenu",value:function(){this.br.refs.$mmenu.data("mmenu").close()}},{key:"submitHandler",value:function(e){e.preventDefault();var t=e.target.querySelector('[name="query"]').value;return!!t.length&&(this.br.search(t),this.dom.searchField.blur(),this.emptyMatches(),this.toggleSearchPending(!0),!1)}},{key:"handleSearchCallback",value:function(e,t){var n=this,a=t.results,i=t.options;this.matches=a.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderMatches(a.matches),this.renderPins(a.matches),this.updateResultsCount(a.matches.length),this.toggleSearchPending(!1),i.goToFirstResult?r(document).one("BookReader:pageChanged",(function(){n.br.resize()})):this.br.resize()}},{key:"handleNavToggledCallback",value:function(e){var t=this.br.navigationIsVisible();this.togglePinsFor(t),this.toggleSearchTray(!!t&&!!this.dom.results.querySelector("li"))}},{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(){this.toggleSearchPending(!1),this.renderErrorModal()}},{key:"handleSearchCallbackBookNotIndexed",value:function(){this.toggleSearchPending(!1),this.renderBookNotIndexedModal()}},{key:"handleSearchCallbackEmpty",value:function(){this.toggleSearchPending(!1),this.renderResultsEmptyModal()}},{key:"bindEvents",value:function(){var e=this,t="BookReader:";r(document).on("".concat(t,"SearchCallback"),this.handleSearchCallback.bind(this)).on("".concat(t,"navToggled"),this.handleNavToggledCallback.bind(this)).on("".concat(t,"SearchStarted"),this.handleSearchStarted.bind(this)).on("".concat(t,"SearchCallbackError"),this.handleSearchCallbackError.bind(this)).on("".concat(t,"SearchCallbackBookNotIndexed"),this.handleSearchCallbackBookNotIndexed.bind(this)).on("".concat(t,"SearchCallbackEmpty"),this.handleSearchCallbackEmpty.bind(this)).on("".concat(t,"pageChanged"),this.updateSearchNavigation.bind(this)),this.dom.searchTray.addEventListener("submit",this.submitHandler.bind(this)),this.dom.toolbarSearch.querySelector("form").addEventListener("submit",this.submitHandler.bind(this)),this.dom.searchField.addEventListener("search",(function(){e.dom.searchField.value||e.clearSearchFieldAndResults()})),r(this.dom.results).on("click","li",(function(t){e.br._searchPluginGoToResult(+t.currentTarget.dataset.pageIndex),e.br.updateSearchHilites(),e.closeMobileMenu()}))}}])&&a(t.prototype,n),e}(),s=n(3609),c=n(3609);function h(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n,r,a,i,o){try{var s=e[i](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}s.extend(BookReader.defaultOptions,{server:"ia600609.us.archive.org",bookId:"",subPrefix:"",bookPath:"",enableSearch:!0,searchInsideUrl:"/fulltext/inside.php",initialSearchTerm:null}),BookReader.prototype.setup=(i=BookReader.prototype.setup,function(e){i.call(this,e),this.searchTerm="",this.searchResults=null,this.searchInsideUrl=e.searchInsideUrl,this.enableSearch=e.enableSearch,this.goToFirstResult=!1,this.bookId=e.bookId,this.server=e.server,this.subPrefix=e.subPrefix,this.bookPath=e.bookPath,this.searchView||(this.searchView=new o({br:this,selector:"#BRsearch_tray"}))}),BookReader.prototype.init=function(e){return function(){e.call(this),this.options.enableSearch&&this.options.initialSearchTerm&&this.search(this.options.initialSearchTerm,{goToFirstResult:this.goToFirstResult,suppressFragmentChange:!0})}}(BookReader.prototype.init),BookReader.prototype.buildMobileDrawerElement=function(e){return function(){var t=e.call(this);if(this.enableSearch)return this.searchView.dom.mobileSearch&&t.find(".BRmobileMenu__moreInfoRow").after(this.searchView.dom.mobileSearch),t}}(BookReader.prototype.buildMobileDrawerElement),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.search=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},a=s.extend({},r,n);this.suppressFragmentChange=a.suppressFragmentChange,this.searchTerm=t.replace(/\//g," "),a.suppressFragmentChange||this.trigger(BookReader.eventNames.fragmentChange);var i=this.server.replace(/:.+/,""),o="https://".concat(i).concat(this.searchInsideUrl,"?"),h=this.bookPath,u="/".concat(this.subPrefix);this.bookPath.length-this.bookPath.lastIndexOf(u)==u.length&&(h=this.bookPath.substr(0,this.bookPath.length-u.length));var l={item_id:this.bookId,doc:this.subPrefix,path:h,q:t},d=c.param(l).replace(/%2F/g,"/"),f="".concat(o).concat(d),p=function(t){var n=t.error||!t.matches.length,r="function"==typeof a.error,i="function"==typeof a.success;n?r?a.error.call(e,t,a):e.BRSearchCallbackError(t,a):i?a.success.call(e,t,a):e.BRSearchCallback(t,a)};return this.trigger("SearchStarted",{term:this.searchTerm}),c.ajax({url:f,dataType:"jsonp"}).then(p)},BookReader.prototype.BRSearchCallback=function(e,t){this.searchResults=e,this.updateSearchHilites(),this.removeProgressPopup(),t.goToFirstResult&&this._searchPluginGoToResult(e.matches[0].par[0].page),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 n=Object.assign({},t,{results:e});this.trigger("SearchCallbackError",n)}else if(0==e.matches.length){if(!1===e.indexed)return void this.trigger("SearchCallbackBookNotIndexed",t);this.trigger("SearchCallbackEmpty",t)}},BookReader.prototype.updateSearchHilites=function(){this.constMode2up!=this.mode?this.updateSearchHilites1UP():this.updateSearchHilites2UP()},BookReader.prototype.updateSearchHilites1UP=function(){var e=this,t=this.searchResults;null!=t&&t.matches.forEach((function(t){t.par[0].boxes.forEach((function(t){var n=e.leafNumToIndex(t.page);if(s.inArray(n,e.displayedIndices)>=0){t.div||(t.div=document.createElement("div"),c(t.div).prop("className","BookReaderSearchHilite").appendTo(e.$(".pagediv".concat(n))));var r={width:"".concat((t.r-t.l)/e.reduce,"px"),height:"".concat((t.b-t.t)/e.reduce,"px"),left:"".concat(t.l/e.reduce,"px"),top:"".concat(t.t/e.reduce,"px")};c(t.div).css(r)}else t.div&&(c(t.div).remove(),t.div=null)}))}))},BookReader.prototype.updateSearchHilites2UP=function(){var e=this,t=this.searchResults;null!==t&&t.matches.forEach((function(t){t.par[0].boxes.forEach((function(n){var r=e.leafNumToIndex(t.par[0].page),a=s.inArray(r,e.displayedIndices)>=0,i=e._models.book.getPage(r).isViewable;a&&i?(n.div||(n.div=document.createElement("div"),c(n.div).addClass("BookReaderSearchHilite").appendTo(e.refs.$brTwoPageView)),e.setHilightCss2UP(n.div,r,n.l,n.r,n.t,n.b)):n.div&&(c(n.div).remove(),n.div=null)}))}))},BookReader.prototype.removeSearchHilites=function(){var e=this.searchResults;null!=e&&e.matches&&e.matches.forEach((function(e){e.par[0].boxes.forEach((function(e){null!=e.div&&(c(e.div).remove(),e.div=null)}))}))},BookReader.prototype._searchPluginGoToResult=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,r,a,i,o,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._models.book,r=n.getPage(t),a=!1,r.isViewable){e.next=10;break}return e.next=6,fetch("/services/bookreader/request_page?"+new URLSearchParams({id:this.options.bookId,subprefix:this.options.subPrefix,leafNum:r.leafNum})).then((function(e){return e.json()}));case 6:i=e.sent,o=h(i.value);try{for(o.s();!(s=o.n()).done;)c=s.value,n.getPage(n.leafNumToIndex(c)).makeViewable()}catch(e){o.e(e)}finally{o.f()}i.value.length||(n.getPage(t).makeViewable(),a=!0);case 10:this.suppressFragmentChange=!1,this.jumpToIndex(t),a&&n.getPage(t).makeViewable(!1);case 13:case"end":return e.stop()}}),e,this)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){l(i,r,a,o,s,"next",e)}function s(e){l(i,r,a,o,s,"throw",e)}o(void 0)}))});return function(e){return t.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,n=[];if(null==t)return!1;if(this.constMode2up==this.mode)n=[this.twoPage.currentIndexL,this.twoPage.currentIndexR];else{if(this.constMode1up!=this.mode)return!1;n=[this.currentIndex()]}return t.matches.some((function(t){return t.par[0].boxes.some((function(t){var r=e.leafNumToIndex(t.page);if(s.inArray(r,n)>=0)return!0}))})),!1}},8533:function(e,t,n){"use strict";var r=n(2092).forEach,a=n(9341),i=n(9207),o=a("forEach"),s=i("forEach");e.exports=o&&s?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},6583:function(e,t,n){"use strict";var r=n(5656),a=n(9958),i=n(7466),o=n(9341),s=n(9207),c=Math.min,h=[].lastIndexOf,u=!!h&&1/[1].lastIndexOf(1,-0)<0,l=o("lastIndexOf"),d=s("indexOf",{ACCESSORS:!0,1:0}),f=u||!l||!d;e.exports=f?function(e){if(u)return h.apply(this,arguments)||0;var t=r(this),n=i(t.length),o=n-1;for(arguments.length>1&&(o=c(o,a(arguments[1]))),o<0&&(o=n+o);o>=0;o--)if(o in t&&t[o]===e)return o||0;return-1}:h},7072:function(e,t,n){var r=n(5112)("iterator"),a=!1;try{var i=0,o={next:function(){return{done:!!i++}},return:function(){a=!0}};o[r]=function(){return this},Array.from(o,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!a)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},6833:function(e,t,n){var r=n(8113);e.exports=/(iphone|ipod|ipad).*applewebkit/i.test(r)},842:function(e,t,n){var r=n(7854);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},9587:function(e,t,n){var r=n(111),a=n(7674);e.exports=function(e,t,n){var i,o;return a&&"function"==typeof(i=t.constructor)&&i!==n&&r(o=i.prototype)&&o!==n.prototype&&a(e,o),e}},408:function(e,t,n){var r=n(9670),a=n(7659),i=n(7466),o=n(9974),s=n(1246),c=n(9212),h=function(e,t){this.stopped=e,this.result=t};e.exports=function(e,t,n){var u,l,d,f,p,v,g,m=n&&n.that,b=!(!n||!n.AS_ENTRIES),y=!(!n||!n.IS_ITERATOR),k=!(!n||!n.INTERRUPTED),S=o(t,m,1+b+k),R=function(e){return u&&c(u),new h(!0,e)},x=function(e){return b?(r(e),k?S(e[0],e[1],R):S(e[0],e[1])):k?S(e,R):S(e)};if(y)u=e;else{if("function"!=typeof(l=s(e)))throw TypeError("Target is not iterable");if(a(l)){for(d=0,f=i(e.length);f>d;d++)if((p=x(e[d]))&&p instanceof h)return p;return new h(!1)}u=l.call(e)}for(v=u.next;!(g=v.call(u)).done;){try{p=x(g.value)}catch(e){throw c(u),e}if("object"==typeof p&&p&&p instanceof h)return p}return new h(!1)}},5948:function(e,t,n){var r,a,i,o,s,c,h,u,l=n(7854),d=n(1236).f,f=n(261).set,p=n(6833),v=n(5268),g=l.MutationObserver||l.WebKitMutationObserver,m=l.document,b=l.process,y=l.Promise,k=d(l,"queueMicrotask"),S=k&&k.value;S||(r=function(){var e,t;for(v&&(e=b.domain)&&e.exit();a;){t=a.fn,a=a.next;try{t()}catch(e){throw a?o():i=void 0,e}}i=void 0,e&&e.enter()},!p&&!v&&g&&m?(s=!0,c=m.createTextNode(""),new g(r).observe(c,{characterData:!0}),o=function(){c.data=s=!s}):y&&y.resolve?(h=y.resolve(void 0),u=h.then,o=function(){u.call(h,r)}):o=v?function(){b.nextTick(r)}:function(){f.call(l,r)}),e.exports=S||function(e){var t={fn:e,next:void 0};i&&(i.next=t),a||(a=t,o()),i=t}},3366:function(e,t,n){var r=n(7854);e.exports=r.Promise},8523:function(e,t,n){"use strict";var r=n(3099),a=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new a(e)}},2534:function(e){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},9478:function(e,t,n){var r=n(9670),a=n(111),i=n(8523);e.exports=function(e,t){if(r(e),a(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},6340:function(e,t,n){"use strict";var r=n(5005),a=n(3070),i=n(5112),o=n(9781),s=i("species");e.exports=function(e){var t=r(e),n=a.f;o&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},261:function(e,t,n){var r,a,i,o=n(7854),s=n(7293),c=n(9974),h=n(490),u=n(317),l=n(6833),d=n(5268),f=o.location,p=o.setImmediate,v=o.clearImmediate,g=o.process,m=o.MessageChannel,b=o.Dispatch,y=0,k={},S=function(e){if(k.hasOwnProperty(e)){var t=k[e];delete k[e],t()}},R=function(e){return function(){S(e)}},x=function(e){S(e.data)},P=function(e){o.postMessage(e+"",f.protocol+"//"+f.host)};p&&v||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return k[++y]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},r(y),y},v=function(e){delete k[e]},d?r=function(e){g.nextTick(R(e))}:b&&b.now?r=function(e){b.now(R(e))}:m&&!l?(i=(a=new m).port2,a.port1.onmessage=x,r=c(i.postMessage,i,1)):o.addEventListener&&"function"==typeof postMessage&&!o.importScripts&&f&&"file:"!==f.protocol&&!s(P)?(r=P,o.addEventListener("message",x,!1)):r="onreadystatechange"in u("script")?function(e){h.appendChild(u("script")).onreadystatechange=function(){h.removeChild(this),S(e)}}:function(e){setTimeout(R(e),0)}),e.exports={set:p,clear:v}},9554:function(e,t,n){"use strict";var r=n(2109),a=n(8533);r({target:"Array",proto:!0,forced:[].forEach!=a},{forEach:a})},4986:function(e,t,n){var r=n(2109),a=n(6583);r({target:"Array",proto:!0,forced:a!==[].lastIndexOf},{lastIndexOf:a})},5212:function(e,t,n){"use strict";var r=n(2109),a=n(2092).some,i=n(9341),o=n(9207),s=i("some"),c=o("some");r({target:"Array",proto:!0,forced:!s||!c},{some:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},8674:function(e,t,n){"use strict";var r,a,i,o,s=n(2109),c=n(1913),h=n(7854),u=n(5005),l=n(3366),d=n(1320),f=n(2248),p=n(8003),v=n(6340),g=n(111),m=n(3099),b=n(5787),y=n(2788),k=n(408),S=n(7072),R=n(6707),x=n(261).set,P=n(5948),M=n(9478),w=n(842),T=n(8523),E=n(2534),B=n(9909),I=n(4705),C=n(5112),N=n(5268),_=n(7392),j=C("species"),F="Promise",H=B.get,L=B.set,O=B.getterFor(F),q=l,A=h.TypeError,U=h.document,V=h.process,$=u("fetch"),D=T.f,G=D,z=!!(U&&U.createEvent&&h.dispatchEvent),Q="function"==typeof PromiseRejectionEvent,W="unhandledrejection",Y=I(F,(function(){if(y(q)===String(q)){if(66===_)return!0;if(!N&&!Q)return!0}if(c&&!q.prototype.finally)return!0;if(_>=51&&/native code/.test(q))return!1;var e=q.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[j]=t,!(e.then((function(){}))instanceof t)})),K=Y||!S((function(e){q.all(e).catch((function(){}))})),X=function(e){var t;return!(!g(e)||"function"!=typeof(t=e.then))&&t},J=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;P((function(){for(var r=e.value,a=1==e.state,i=0;n.length>i;){var o,s,c,h=n[i++],u=a?h.ok:h.fail,l=h.resolve,d=h.reject,f=h.domain;try{u?(a||(2===e.rejection&&ne(e),e.rejection=1),!0===u?o=r:(f&&f.enter(),o=u(r),f&&(f.exit(),c=!0)),o===h.promise?d(A("Promise-chain cycle")):(s=X(o))?s.call(o,l,d):l(o)):d(r)}catch(e){f&&!c&&f.exit(),d(e)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&ee(e)}))}},Z=function(e,t,n){var r,a;z?((r=U.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),h.dispatchEvent(r)):r={promise:t,reason:n},!Q&&(a=h["on"+e])?a(r):e===W&&w("Unhandled promise rejection",n)},ee=function(e){x.call(h,(function(){var t,n=e.facade,r=e.value;if(te(e)&&(t=E((function(){N?V.emit("unhandledRejection",r,n):Z(W,n,r)})),e.rejection=N||te(e)?2:1,t.error))throw t.value}))},te=function(e){return 1!==e.rejection&&!e.parent},ne=function(e){x.call(h,(function(){var t=e.facade;N?V.emit("rejectionHandled",t):Z("rejectionhandled",t,e.value)}))},re=function(e,t,n){return function(r){e(t,r,n)}},ae=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,J(e,!0))},ie=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw A("Promise can't be resolved itself");var r=X(t);r?P((function(){var n={done:!1};try{r.call(t,re(ie,n,e),re(ae,n,e))}catch(t){ae(n,t,e)}})):(e.value=t,e.state=1,J(e,!1))}catch(t){ae({done:!1},t,e)}}};Y&&(q=function(e){b(this,q,F),m(e),r.call(this);var t=H(this);try{e(re(ie,t),re(ae,t))}catch(e){ae(t,e)}},(r=function(e){L(this,{type:F,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=f(q.prototype,{then:function(e,t){var n=O(this),r=D(R(this,q));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=N?V.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&J(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new r,t=H(e);this.promise=e,this.resolve=re(ie,t),this.reject=re(ae,t)},T.f=D=function(e){return e===q||e===i?new a(e):G(e)},c||"function"!=typeof l||(o=l.prototype.then,d(l.prototype,"then",(function(e,t){var n=this;return new q((function(e,t){o.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof $&&s({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return M(q,$.apply(h,arguments))}}))),s({global:!0,wrap:!0,forced:Y},{Promise:q}),p(q,F,!1,!0),v(F),i=u(F),s({target:F,stat:!0,forced:Y},{reject:function(e){var t=D(this);return t.reject.call(void 0,e),t.promise}}),s({target:F,stat:!0,forced:c||Y},{resolve:function(e){return M(c&&this===i?q:this,e)}}),s({target:F,stat:!0,forced:K},{all:function(e){var t=this,n=D(t),r=n.resolve,a=n.reject,i=E((function(){var n=m(t.resolve),i=[],o=0,s=1;k(e,(function(e){var c=o++,h=!1;i.push(void 0),s++,n.call(t,e).then((function(e){h||(h=!0,i[c]=e,--s||r(i))}),a)})),--s||r(i)}));return i.error&&a(i.value),n.promise},race:function(e){var t=this,n=D(t),r=n.reject,a=E((function(){var a=m(t.resolve);k(e,(function(e){a.call(t,e).then(n.resolve,r)}))}));return a.error&&r(a.value),n.promise}})},4603:function(e,t,n){var r=n(9781),a=n(7854),i=n(4705),o=n(9587),s=n(3070).f,c=n(8006).f,h=n(7850),u=n(7066),l=n(2999),d=n(1320),f=n(7293),p=n(9909).set,v=n(6340),g=n(5112)("match"),m=a.RegExp,b=m.prototype,y=/a/g,k=/a/g,S=new m(y)!==y,R=l.UNSUPPORTED_Y;if(r&&i("RegExp",!S||R||f((function(){return k[g]=!1,m(y)!=y||m(k)==k||"/a/i"!=m(y,"i")})))){for(var x=function(e,t){var n,r=this instanceof x,a=h(e),i=void 0===t;if(!r&&a&&e.constructor===x&&i)return e;S?a&&!i&&(e=e.source):e instanceof x&&(i&&(t=u.call(e)),e=e.source),R&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var s=o(S?new m(e,t):m(e,t),r?this:b,x);return R&&n&&p(s,{sticky:n}),s},P=function(e){e in x||s(x,e,{configurable:!0,get:function(){return m[e]},set:function(t){m[e]=t}})},M=c(m),w=0;M.length>w;)P(M[w++]);b.constructor=x,x.prototype=b,d(a,"RegExp",x)}v("RegExp")},4747:function(e,t,n){var r=n(7854),a=n(8324),i=n(8533),o=n(8880);for(var s in a){var c=r[s],h=c&&c.prototype;if(h&&h.forEach!==i)try{o(h,"forEach",i)}catch(e){h.forEach=i}}}},0,[[2728,898]]]);
(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[73],{2728:function(e,t,n){"use strict";n(2222),n(9826),n(9554),n(6992),n(4986),n(5827),n(5212),n(9601),n(1539),n(8674),n(4916),n(8783),n(5306),n(4765),n(4747),n(3948),n(285),n(5666),n(2772),n(9600),n(1249),n(7042),n(4603),n(9714);var r=n(3609);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i,o=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t.selector?(this.br=t.br,this.matcher=new RegExp("{{{(.+?)}}}","g"),this.matches=[],this.cacheDOMElements(t.selector),this.bindEvents()):console.warn("BookReader::Search - SearchView must be passed a valid CSS selector")}var t,n;return t=e,(n=[{key:"cacheDOMElements",value:function(e){this.dom={},this.dom.searchTray=this.renderSearchTray(e),this.dom.results=this.dom.searchTray.querySelector('[data-id="results"]'),this.dom.resultsCount=this.dom.searchTray.querySelector('[data-id="results_count"]'),this.dom.searchField=this.dom.searchTray.querySelector('[name="query"]'),this.dom.searchPending=this.dom.searchTray.querySelector('[data-id="searchPending"]'),this.dom.mobileSearch=this.buildMobileDrawer(),this.dom.toolbarSearch=this.buildToolbarSearch()}},{key:"toggleSearchTray",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dom.searchTray.classList.contains("hidden");this.dom.searchTray.classList.toggle("hidden",!e)}},{key:"toggleResultsCount",value:function(e){this.dom.resultsCount.classList.toggle("visible",e)}},{key:"updateResultsCount",value:function(e){this.dom.resultsCount.innerText="(".concat(e," result").concat(1!=e?"s":"",")"),this.toggleResultsCount(!0)}},{key:"setQuery",value:function(e){this.br.$('[name="query"]').val(e)}},{key:"emptyMatches",value:function(){this.dom.results.innerHTML="",this.matches=[]}},{key:"removeResultPins",value:function(){this.br.$(".BRnavpos .BRsearch").remove()}},{key:"clearSearchFieldAndResults",value:function(){this.br.removeSearchResults(),this.toggleResultsCount(!1),this.removeResultPins(),this.emptyMatches(),this.setQuery(""),this.teardownSearchNavigation(),this.br.trigger("SearchResultsCleared")}},{key:"toggleSidebar",value:function(){this.br.trigger("ToggleSearchMenu")}},{key:"renderSearchTray",value:function(e){var t=document.createElement("div");return t.setAttribute("id",e.replace(/^#/,"")),t.innerHTML='\n <header>\n <div>\n <h3>Search inside</h3>\n <p data-id="results_count"></p>\n </div>\n <a href="#" class="close"></a>\n </header>\n <form action="" method="get">\n <fieldset>\n <input name="all_files" id="all_files" type="checkbox" />\n <label class="checkbox" for="all_files">Search all files</label>\n <input type="search" name="query" placeholder="Enter a search term" />\n </fieldset>\n </form>\n <div data-id="searchPending" id="search_pending">\n <p>Your search results will appear below</p>\n <div class="loader tc mt20"></div>\n </div>\n <ul data-id="results"></ul>\n ',t}},{key:"renderSearchNavigation",value:function(){var e="BRsearch-navigation";r(".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=r(".".concat(e))}},{key:"resultsPosition",value:function(){var e="".concat(this.matches.length," result").concat(1===this.matches.length?"":"s");return~this.currentMatchIndex&&(e="".concat(this.currentMatchIndex+1," / ").concat(this.matches.length)),e}},{key:"bindSearchNavigationEvents",value:function(){if(this.dom.searchNavigation){var e="searchNavigation";this.dom.searchNavigation.on("click.".concat(e),".clear",this.clearSearchFieldAndResults.bind(this)).on("click.".concat(e),".prev",this.showPrevResult.bind(this)).on("click.".concat(e),".next",this.showNextResult.bind(this)).on("click.".concat(e),".toggle-sidebar",this.toggleSidebar.bind(this)).on("click.".concat(e),!1)}}},{key:"showPrevResult",value:function(){0!==this.currentMatchIndex&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex((function(e,t,n){return t[0]>n}))+1),this.br.$(".BRnavline .BRsearch").eq(--this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"showNextResult",value:function(){this.currentMatchIndex+1!==this.matches.length&&(this.br.mode===this.br.constModeThumb&&this.br.switchMode(this.br.constMode1up),~this.currentMatchIndex||(this.currentMatchIndex=this.getClosestMatchIndex((function(e,t,n){return e[e.length-1]>n}))-1),this.br.$(".BRnavline .BRsearch").eq(++this.currentMatchIndex).click(),this.updateResultsPosition(),this.updateSearchNavigationButtons())}},{key:"getClosestMatchIndex",value:function(e){var t=function t(n,r){if(1===n.length)return n[0];var a=n.slice(0,n.length/2),i=n.slice(n.length/2);return t(e(a,i,r)?a:i,r)}(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.find("[data-id=resultsCount]").text(this.resultsPosition())}},{key:"updateSearchNavigationButtons",value:function(){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=r(".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:"renderMatches",value:function(e){var t=this,n=e.map((function(e){return'\n <li data-page="'.concat(e.par[0].page,'" data-page-index="').concat(t.br.leafNumToIndex(e.par[0].page),'">\n <h4>Page ').concat(e.par[0].page,"</h4>\n <p>").concat(e.text.replace(t.matcher,"<mark>$1</mark>"),"</p>\n </li>\n ")}));this.dom.results.innerHTML=n.join("")}},{key:"togglePinsFor",value:function(e){var t=e?"visible":"hidden";this.br.refs.$BRfooter.find(".BRsearch").css({visibility:t})}},{key:"buildMobileDrawer",value:function(){var e=document.createElement("li");return e.innerHTML='\n <span>\n <span class="DrawerIconWrapper">\n <img class="DrawerIcon" src="'.concat(this.br.imagesBaseURL,'icon_search_button.svg" />\n </span>\n Search\n </span>\n <div data-id="search_slot">\n </div>\n '),e.querySelector('[data-id="search_slot"]').appendChild(this.dom.searchTray),e.classList.add("BRmobileMenu__search"),e}},{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 n=e.text,a=t.br.leafNumToIndex(e.par[0].page),i=t.br.getPageNum(a),o=t.br.constructor.util.cssPercentage(a,t.br.getNumLeafs()-1),s=n.replace(t.matcher,"<b>$1</b>"),c="";n.length>100&&(c=n.replace(/^(.{100}[^\s]*).*/,"$1").replace(t.matcher,"<b>$1</b>")+"..."),r("<div>").addClass("BRsearch").css({left:o}).attr("title","Search result").append('\n <div class="BRquery">\n <div>'.concat(c||s,"</div>\n <div>").concat("Page"," ").concat(i,"</div>\n </div>\n ")).data({pageIndex:a}).appendTo(t.br.$(".BRnavline")).hover((function(e){var t=e.currentTarget,n=t.querySelector(".BRquery"),a=n.getBoundingClientRect(),i=t.getBoundingClientRect(),o=2*parseInt(getComputedStyle(n).paddingLeft);a.x-o<0&&n.style.setProperty("transform","translateX(-".concat(i.left-o,"px)")),r(".BRsearch,.BRchapter").removeClass("front"),r(e.target).addClass("front")}),(function(e){return r(e.target).removeClass("front")})).click(function(e){this.br._searchPluginGoToResult(+r(e.target).data("pageIndex")),this.br.updateSearchHilites()}.bind(t))}))}},{key:"toggleSearchPending",value:function(e){this.dom.searchPending.classList.toggle("visible",e),e?this.br.showProgressPopup("Search results will appear below..."):this.br.removeProgressPopup()}},{key:"renderErrorModal",value:function(){this.renderModalMessage("\n Sorry, there was an error with your search.\n <br />\n The text may still be processing.\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:"openMobileMenu",value:function(){this.br.refs.$mmenu.data("mmenu").open()}},{key:"closeMobileMenu",value:function(){this.br.refs.$mmenu.data("mmenu").close()}},{key:"submitHandler",value:function(e){e.preventDefault();var t=e.target.querySelector('[name="query"]').value;return!!t.length&&(this.br.search(t),this.dom.searchField.blur(),this.emptyMatches(),this.toggleSearchPending(!0),!1)}},{key:"handleSearchCallback",value:function(e,t){var n=this,a=t.results,i=t.options;this.matches=a.matches,this.setCurrentMatchIndex(),this.teardownSearchNavigation(),this.renderSearchNavigation(),this.bindSearchNavigationEvents(),this.renderMatches(a.matches),this.renderPins(a.matches),this.updateResultsCount(a.matches.length),this.toggleSearchPending(!1),i.goToFirstResult?r(document).one("BookReader:pageChanged",(function(){n.br.resize()})):this.br.resize()}},{key:"handleNavToggledCallback",value:function(e){var t=this.br.navigationIsVisible();this.togglePinsFor(t),this.toggleSearchTray(!!t&&!!this.dom.results.querySelector("li"))}},{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(){this.toggleSearchPending(!1),this.renderErrorModal()}},{key:"handleSearchCallbackBookNotIndexed",value:function(){this.toggleSearchPending(!1),this.renderBookNotIndexedModal()}},{key:"handleSearchCallbackEmpty",value:function(){this.toggleSearchPending(!1),this.renderResultsEmptyModal()}},{key:"bindEvents",value:function(){var e=this,t="BookReader:";r(document).on("".concat(t,"SearchCallback"),this.handleSearchCallback.bind(this)).on("".concat(t,"navToggled"),this.handleNavToggledCallback.bind(this)).on("".concat(t,"SearchStarted"),this.handleSearchStarted.bind(this)).on("".concat(t,"SearchCallbackError"),this.handleSearchCallbackError.bind(this)).on("".concat(t,"SearchCallbackBookNotIndexed"),this.handleSearchCallbackBookNotIndexed.bind(this)).on("".concat(t,"SearchCallbackEmpty"),this.handleSearchCallbackEmpty.bind(this)).on("".concat(t,"pageChanged"),this.updateSearchNavigation.bind(this)),this.dom.searchTray.addEventListener("submit",this.submitHandler.bind(this)),this.dom.toolbarSearch.querySelector("form").addEventListener("submit",this.submitHandler.bind(this)),this.dom.searchField.addEventListener("search",(function(){e.dom.searchField.value||e.clearSearchFieldAndResults()})),r(this.dom.results).on("click","li",(function(t){e.br._searchPluginGoToResult(+t.currentTarget.dataset.pageIndex),e.br.updateSearchHilites(),e.closeMobileMenu()}))}}])&&a(t.prototype,n),e}(),s=n(3609),c=n(3609);function h(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function l(e,t,n,r,a,i,o){try{var s=e[i](o),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,a)}s.extend(BookReader.defaultOptions,{server:"ia600609.us.archive.org",bookId:"",subPrefix:"",bookPath:"",enableSearch:!0,searchInsideUrl:"/fulltext/inside.php",initialSearchTerm:null}),BookReader.prototype.setup=(i=BookReader.prototype.setup,function(e){i.call(this,e),this.searchTerm="",this.searchResults=null,this.searchInsideUrl=e.searchInsideUrl,this.enableSearch=e.enableSearch,this.goToFirstResult=!1,this.bookId=e.bookId,this.server=e.server,this.subPrefix=e.subPrefix,this.bookPath=e.bookPath,this.searchView||(this.searchView=new o({br:this,selector:"#BRsearch_tray"}))}),BookReader.prototype.init=function(e){return function(){e.call(this),this.options.enableSearch&&this.options.initialSearchTerm&&(c(window).width()>=640&&this.trigger("OpenSearchMenu",{action:"open"}),this.search(this.options.initialSearchTerm,{goToFirstResult:this.goToFirstResult,suppressFragmentChange:!0}))}}(BookReader.prototype.init),BookReader.prototype.buildMobileDrawerElement=function(e){return function(){var t=e.call(this);if(this.enableSearch)return this.searchView.dom.mobileSearch&&t.find(".BRmobileMenu__moreInfoRow").after(this.searchView.dom.mobileSearch),t}}(BookReader.prototype.buildMobileDrawerElement),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.search=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={goToFirstResult:!1,disablePopup:!1,suppressFragmentChange:!1,error:null,success:null},a=s.extend({},r,n);this.suppressFragmentChange=a.suppressFragmentChange,this.searchTerm=t.replace(/\//g," "),a.suppressFragmentChange||this.trigger(BookReader.eventNames.fragmentChange);var i=this.server.replace(/:.+/,""),o="https://".concat(i).concat(this.searchInsideUrl,"?"),h=this.bookPath,u="/".concat(this.subPrefix);this.bookPath.length-this.bookPath.lastIndexOf(u)==u.length&&(h=this.bookPath.substr(0,this.bookPath.length-u.length));var l={item_id:this.bookId,doc:this.subPrefix,path:h,q:t},d=c.param(l).replace(/%2F/g,"/"),f="".concat(o).concat(d),p=function(t){var n=t.error||!t.matches.length,r="function"==typeof a.error,i="function"==typeof a.success;n?r?a.error.call(e,t,a):e.BRSearchCallbackError(t,a):i?a.success.call(e,t,a):e.BRSearchCallback(t,a)};return this.trigger("SearchStarted",{term:this.searchTerm}),c.ajax({url:f,dataType:"jsonp"}).then(p)},BookReader.prototype.BRSearchCallback=function(e,t){this.searchResults=e,this.updateSearchHilites(),this.removeProgressPopup(),t.goToFirstResult&&this._searchPluginGoToResult(e.matches[0].par[0].page),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 n=Object.assign({},t,{results:e});this.trigger("SearchCallbackError",n)}else if(0==e.matches.length){if(!1===e.indexed)return void this.trigger("SearchCallbackBookNotIndexed",t);this.trigger("SearchCallbackEmpty",t)}},BookReader.prototype.updateSearchHilites=function(){this.constMode2up!=this.mode?this.updateSearchHilites1UP():this.updateSearchHilites2UP()},BookReader.prototype.updateSearchHilites1UP=function(){var e=this,t=this.searchResults;null!=t&&t.matches.forEach((function(t){t.par[0].boxes.forEach((function(t){var n=e.leafNumToIndex(t.page);if(s.inArray(n,e.displayedIndices)>=0){t.div||(t.div=document.createElement("div"),c(t.div).prop("className","BookReaderSearchHilite").appendTo(e.$(".pagediv".concat(n))));var r={width:"".concat((t.r-t.l)/e.reduce,"px"),height:"".concat((t.b-t.t)/e.reduce,"px"),left:"".concat(t.l/e.reduce,"px"),top:"".concat(t.t/e.reduce,"px")};c(t.div).css(r)}else t.div&&(c(t.div).remove(),t.div=null)}))}))},BookReader.prototype.updateSearchHilites2UP=function(){var e=this,t=this.searchResults;null!==t&&t.matches.forEach((function(t){t.par[0].boxes.forEach((function(n){var r=e.leafNumToIndex(t.par[0].page),a=s.inArray(r,e.displayedIndices)>=0,i=e._models.book.getPage(r).isViewable;a&&i?(n.div||(n.div=document.createElement("div"),c(n.div).addClass("BookReaderSearchHilite").appendTo(e.refs.$brTwoPageView)),e.setHilightCss2UP(n.div,r,n.l,n.r,n.t,n.b)):n.div&&(c(n.div).remove(),n.div=null)}))}))},BookReader.prototype.removeSearchHilites=function(){var e=this.searchResults;null!=e&&e.matches&&e.matches.forEach((function(e){e.par[0].boxes.forEach((function(e){null!=e.div&&(c(e.div).remove(),e.div=null)}))}))},BookReader.prototype._searchPluginGoToResult=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,r,a,i,o,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this._models.book,r=n.getPage(t),a=!1,r.isViewable){e.next=10;break}return e.next=6,fetch("/services/bookreader/request_page?"+new URLSearchParams({id:this.options.bookId,subprefix:this.options.subPrefix,leafNum:r.leafNum})).then((function(e){return e.json()}));case 6:i=e.sent,o=h(i.value);try{for(o.s();!(s=o.n()).done;)c=s.value,n.getPage(n.leafNumToIndex(c)).makeViewable()}catch(e){o.e(e)}finally{o.f()}i.value.length||(n.getPage(t).makeViewable(),a=!0);case 10:this.suppressFragmentChange=!1,this.jumpToIndex(t),a&&n.getPage(t).makeViewable(!1);case 13:case"end":return e.stop()}}),e,this)})),function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function o(e){l(i,r,a,o,s,"next",e)}function s(e){l(i,r,a,o,s,"throw",e)}o(void 0)}))});return function(e){return t.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,n=[];if(null==t)return!1;if(this.constMode2up==this.mode)n=[this.twoPage.currentIndexL,this.twoPage.currentIndexR];else{if(this.constMode1up!=this.mode)return!1;n=[this.currentIndex()]}return t.matches.some((function(t){return t.par[0].boxes.some((function(t){var r=e.leafNumToIndex(t.page);if(s.inArray(r,n)>=0)return!0}))})),!1}},8533:function(e,t,n){"use strict";var r=n(2092).forEach,a=n(9341),i=n(9207),o=a("forEach"),s=i("forEach");e.exports=o&&s?[].forEach:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}},6583:function(e,t,n){"use strict";var r=n(5656),a=n(9958),i=n(7466),o=n(9341),s=n(9207),c=Math.min,h=[].lastIndexOf,u=!!h&&1/[1].lastIndexOf(1,-0)<0,l=o("lastIndexOf"),d=s("indexOf",{ACCESSORS:!0,1:0}),f=u||!l||!d;e.exports=f?function(e){if(u)return h.apply(this,arguments)||0;var t=r(this),n=i(t.length),o=n-1;for(arguments.length>1&&(o=c(o,a(arguments[1]))),o<0&&(o=n+o);o>=0;o--)if(o in t&&t[o]===e)return o||0;return-1}:h},7072:function(e,t,n){var r=n(5112)("iterator"),a=!1;try{var i=0,o={next:function(){return{done:!!i++}},return:function(){a=!0}};o[r]=function(){return this},Array.from(o,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!a)return!1;var n=!1;try{var i={};i[r]=function(){return{next:function(){return{done:n=!0}}}},e(i)}catch(e){}return n}},6833:function(e,t,n){var r=n(8113);e.exports=/(iphone|ipod|ipad).*applewebkit/i.test(r)},842:function(e,t,n){var r=n(7854);e.exports=function(e,t){var n=r.console;n&&n.error&&(1===arguments.length?n.error(e):n.error(e,t))}},9587:function(e,t,n){var r=n(111),a=n(7674);e.exports=function(e,t,n){var i,o;return a&&"function"==typeof(i=t.constructor)&&i!==n&&r(o=i.prototype)&&o!==n.prototype&&a(e,o),e}},408:function(e,t,n){var r=n(9670),a=n(7659),i=n(7466),o=n(9974),s=n(1246),c=n(9212),h=function(e,t){this.stopped=e,this.result=t};e.exports=function(e,t,n){var u,l,d,f,p,v,g,m=n&&n.that,b=!(!n||!n.AS_ENTRIES),y=!(!n||!n.IS_ITERATOR),k=!(!n||!n.INTERRUPTED),S=o(t,m,1+b+k),R=function(e){return u&&c(u),new h(!0,e)},x=function(e){return b?(r(e),k?S(e[0],e[1],R):S(e[0],e[1])):k?S(e,R):S(e)};if(y)u=e;else{if("function"!=typeof(l=s(e)))throw TypeError("Target is not iterable");if(a(l)){for(d=0,f=i(e.length);f>d;d++)if((p=x(e[d]))&&p instanceof h)return p;return new h(!1)}u=l.call(e)}for(v=u.next;!(g=v.call(u)).done;){try{p=x(g.value)}catch(e){throw c(u),e}if("object"==typeof p&&p&&p instanceof h)return p}return new h(!1)}},5948:function(e,t,n){var r,a,i,o,s,c,h,u,l=n(7854),d=n(1236).f,f=n(261).set,p=n(6833),v=n(5268),g=l.MutationObserver||l.WebKitMutationObserver,m=l.document,b=l.process,y=l.Promise,k=d(l,"queueMicrotask"),S=k&&k.value;S||(r=function(){var e,t;for(v&&(e=b.domain)&&e.exit();a;){t=a.fn,a=a.next;try{t()}catch(e){throw a?o():i=void 0,e}}i=void 0,e&&e.enter()},!p&&!v&&g&&m?(s=!0,c=m.createTextNode(""),new g(r).observe(c,{characterData:!0}),o=function(){c.data=s=!s}):y&&y.resolve?(h=y.resolve(void 0),u=h.then,o=function(){u.call(h,r)}):o=v?function(){b.nextTick(r)}:function(){f.call(l,r)}),e.exports=S||function(e){var t={fn:e,next:void 0};i&&(i.next=t),a||(a=t,o()),i=t}},3366:function(e,t,n){var r=n(7854);e.exports=r.Promise},8523:function(e,t,n){"use strict";var r=n(3099),a=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new a(e)}},2534:function(e){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},9478:function(e,t,n){var r=n(9670),a=n(111),i=n(8523);e.exports=function(e,t){if(r(e),a(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},6340:function(e,t,n){"use strict";var r=n(5005),a=n(3070),i=n(5112),o=n(9781),s=i("species");e.exports=function(e){var t=r(e),n=a.f;o&&t&&!t[s]&&n(t,s,{configurable:!0,get:function(){return this}})}},261:function(e,t,n){var r,a,i,o=n(7854),s=n(7293),c=n(9974),h=n(490),u=n(317),l=n(6833),d=n(5268),f=o.location,p=o.setImmediate,v=o.clearImmediate,g=o.process,m=o.MessageChannel,b=o.Dispatch,y=0,k={},S=function(e){if(k.hasOwnProperty(e)){var t=k[e];delete k[e],t()}},R=function(e){return function(){S(e)}},x=function(e){S(e.data)},M=function(e){o.postMessage(e+"",f.protocol+"//"+f.host)};p&&v||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return k[++y]=function(){("function"==typeof e?e:Function(e)).apply(void 0,t)},r(y),y},v=function(e){delete k[e]},d?r=function(e){g.nextTick(R(e))}:b&&b.now?r=function(e){b.now(R(e))}:m&&!l?(i=(a=new m).port2,a.port1.onmessage=x,r=c(i.postMessage,i,1)):o.addEventListener&&"function"==typeof postMessage&&!o.importScripts&&f&&"file:"!==f.protocol&&!s(M)?(r=M,o.addEventListener("message",x,!1)):r="onreadystatechange"in u("script")?function(e){h.appendChild(u("script")).onreadystatechange=function(){h.removeChild(this),S(e)}}:function(e){setTimeout(R(e),0)}),e.exports={set:p,clear:v}},9554:function(e,t,n){"use strict";var r=n(2109),a=n(8533);r({target:"Array",proto:!0,forced:[].forEach!=a},{forEach:a})},4986:function(e,t,n){var r=n(2109),a=n(6583);r({target:"Array",proto:!0,forced:a!==[].lastIndexOf},{lastIndexOf:a})},5212:function(e,t,n){"use strict";var r=n(2109),a=n(2092).some,i=n(9341),o=n(9207),s=i("some"),c=o("some");r({target:"Array",proto:!0,forced:!s||!c},{some:function(e){return a(this,e,arguments.length>1?arguments[1]:void 0)}})},8674:function(e,t,n){"use strict";var r,a,i,o,s=n(2109),c=n(1913),h=n(7854),u=n(5005),l=n(3366),d=n(1320),f=n(2248),p=n(8003),v=n(6340),g=n(111),m=n(3099),b=n(5787),y=n(2788),k=n(408),S=n(7072),R=n(6707),x=n(261).set,M=n(5948),P=n(9478),w=n(842),T=n(8523),E=n(2534),B=n(9909),I=n(4705),C=n(5112),N=n(5268),_=n(7392),j=C("species"),F="Promise",H=B.get,L=B.set,O=B.getterFor(F),q=l,A=h.TypeError,U=h.document,V=h.process,$=u("fetch"),D=T.f,G=D,z=!!(U&&U.createEvent&&h.dispatchEvent),Q="function"==typeof PromiseRejectionEvent,W="unhandledrejection",Y=I(F,(function(){if(y(q)===String(q)){if(66===_)return!0;if(!N&&!Q)return!0}if(c&&!q.prototype.finally)return!0;if(_>=51&&/native code/.test(q))return!1;var e=q.resolve(1),t=function(e){e((function(){}),(function(){}))};return(e.constructor={})[j]=t,!(e.then((function(){}))instanceof t)})),K=Y||!S((function(e){q.all(e).catch((function(){}))})),X=function(e){var t;return!(!g(e)||"function"!=typeof(t=e.then))&&t},J=function(e,t){if(!e.notified){e.notified=!0;var n=e.reactions;M((function(){for(var r=e.value,a=1==e.state,i=0;n.length>i;){var o,s,c,h=n[i++],u=a?h.ok:h.fail,l=h.resolve,d=h.reject,f=h.domain;try{u?(a||(2===e.rejection&&ne(e),e.rejection=1),!0===u?o=r:(f&&f.enter(),o=u(r),f&&(f.exit(),c=!0)),o===h.promise?d(A("Promise-chain cycle")):(s=X(o))?s.call(o,l,d):l(o)):d(r)}catch(e){f&&!c&&f.exit(),d(e)}}e.reactions=[],e.notified=!1,t&&!e.rejection&&ee(e)}))}},Z=function(e,t,n){var r,a;z?((r=U.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),h.dispatchEvent(r)):r={promise:t,reason:n},!Q&&(a=h["on"+e])?a(r):e===W&&w("Unhandled promise rejection",n)},ee=function(e){x.call(h,(function(){var t,n=e.facade,r=e.value;if(te(e)&&(t=E((function(){N?V.emit("unhandledRejection",r,n):Z(W,n,r)})),e.rejection=N||te(e)?2:1,t.error))throw t.value}))},te=function(e){return 1!==e.rejection&&!e.parent},ne=function(e){x.call(h,(function(){var t=e.facade;N?V.emit("rejectionHandled",t):Z("rejectionhandled",t,e.value)}))},re=function(e,t,n){return function(r){e(t,r,n)}},ae=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,J(e,!0))},ie=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw A("Promise can't be resolved itself");var r=X(t);r?M((function(){var n={done:!1};try{r.call(t,re(ie,n,e),re(ae,n,e))}catch(t){ae(n,t,e)}})):(e.value=t,e.state=1,J(e,!1))}catch(t){ae({done:!1},t,e)}}};Y&&(q=function(e){b(this,q,F),m(e),r.call(this);var t=H(this);try{e(re(ie,t),re(ae,t))}catch(e){ae(t,e)}},(r=function(e){L(this,{type:F,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=f(q.prototype,{then:function(e,t){var n=O(this),r=D(R(this,q));return r.ok="function"!=typeof e||e,r.fail="function"==typeof t&&t,r.domain=N?V.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&J(n,!1),r.promise},catch:function(e){return this.then(void 0,e)}}),a=function(){var e=new r,t=H(e);this.promise=e,this.resolve=re(ie,t),this.reject=re(ae,t)},T.f=D=function(e){return e===q||e===i?new a(e):G(e)},c||"function"!=typeof l||(o=l.prototype.then,d(l.prototype,"then",(function(e,t){var n=this;return new q((function(e,t){o.call(n,e,t)})).then(e,t)}),{unsafe:!0}),"function"==typeof $&&s({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return P(q,$.apply(h,arguments))}}))),s({global:!0,wrap:!0,forced:Y},{Promise:q}),p(q,F,!1,!0),v(F),i=u(F),s({target:F,stat:!0,forced:Y},{reject:function(e){var t=D(this);return t.reject.call(void 0,e),t.promise}}),s({target:F,stat:!0,forced:c||Y},{resolve:function(e){return P(c&&this===i?q:this,e)}}),s({target:F,stat:!0,forced:K},{all:function(e){var t=this,n=D(t),r=n.resolve,a=n.reject,i=E((function(){var n=m(t.resolve),i=[],o=0,s=1;k(e,(function(e){var c=o++,h=!1;i.push(void 0),s++,n.call(t,e).then((function(e){h||(h=!0,i[c]=e,--s||r(i))}),a)})),--s||r(i)}));return i.error&&a(i.value),n.promise},race:function(e){var t=this,n=D(t),r=n.reject,a=E((function(){var a=m(t.resolve);k(e,(function(e){a.call(t,e).then(n.resolve,r)}))}));return a.error&&r(a.value),n.promise}})},4603:function(e,t,n){var r=n(9781),a=n(7854),i=n(4705),o=n(9587),s=n(3070).f,c=n(8006).f,h=n(7850),u=n(7066),l=n(2999),d=n(1320),f=n(7293),p=n(9909).set,v=n(6340),g=n(5112)("match"),m=a.RegExp,b=m.prototype,y=/a/g,k=/a/g,S=new m(y)!==y,R=l.UNSUPPORTED_Y;if(r&&i("RegExp",!S||R||f((function(){return k[g]=!1,m(y)!=y||m(k)==k||"/a/i"!=m(y,"i")})))){for(var x=function(e,t){var n,r=this instanceof x,a=h(e),i=void 0===t;if(!r&&a&&e.constructor===x&&i)return e;S?a&&!i&&(e=e.source):e instanceof x&&(i&&(t=u.call(e)),e=e.source),R&&(n=!!t&&t.indexOf("y")>-1)&&(t=t.replace(/y/g,""));var s=o(S?new m(e,t):m(e,t),r?this:b,x);return R&&n&&p(s,{sticky:n}),s},M=function(e){e in x||s(x,e,{configurable:!0,get:function(){return m[e]},set:function(t){m[e]=t}})},P=c(m),w=0;P.length>w;)M(P[w++]);b.constructor=x,x.prototype=b,d(a,"RegExp",x)}v("RegExp")},4747:function(e,t,n){var r=n(7854),a=n(8324),i=n(8533),o=n(8880);for(var s in a){var c=r[s],h=c&&c.prototype;if(h&&h.forEach!==i)try{o(h,"forEach",i)}catch(e){h.forEach=i}}}},0,[[2728,898]]]);
//# sourceMappingURL=plugin.search.js.map
{
"name": "@internetarchive/bookreader",
"version": "4.26.1",
"version": "4.26.2-alpha1",
"description": "The Internet Archive BookReader.",

@@ -5,0 +5,0 @@ "repository": {

@@ -67,2 +67,6 @@ /* global BookReader */

if (this.options.enableSearch && this.options.initialSearchTerm) {
if ($(window).width() >= 640) { /* open search panel */
this.trigger('OpenSearchMenu', { action: 'open' });
}
this.search(

@@ -69,0 +73,0 @@ this.options.initialSearchTerm,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc