@internetarchive/bookreader 5.0.0-98 → 5.0.0-99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see plugin.text_selection.js.LICENSE.txt */
2
- "use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[326],{706:function(t,e,n){var r=n(350).PROPER,a=n(9039),o=n(7452);t.exports=function(t){return a((function(){return!!o[t]()||"​…᠎"!=="​…᠎"[t]()||r&&o[t].name!==t}))}},2762:function(t,e,n){var r=n(6518),a=n(3802).trim;r({target:"String",proto:!0,forced:n(706)("trim")},{trim:function(){return a(this)}})},1041:function(t,e,n){function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function o(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,"string");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}n.d(e,{S:function(){return i}}),n(2675),n(9463),n(2259),n(5700),n(3792),n(9572),n(8130),n(9085),n(6099),n(7764),n(2953);var i=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.br=e,this.options},(e=[{key:"setup",value:function(t){this.options=Object.assign({},this.options,t)}},{key:"init",value:function(){}},{key:"_configurePageContainer",value:function(t){}},{key:"_configureToolbar",value:function(t){}},{key:"_bindNavigationHandlers",value:function(){}},{key:"extendNavBar",value:function(t){}}])&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},2763:function(t,e,n){n(2675),n(9463),n(6412),n(2259),n(5700),n(8125),n(8706),n(113),n(3418),n(3792),n(8598),n(2062),n(4490),n(4782),n(6910),n(9572),n(2010),n(4731),n(6033),n(479),n(8130),n(9085),n(875),n(6099),n(8459),n(3362),n(825),n(7495),n(8781),n(9449),n(7764),n(2762),n(3500),n(2953);var r=n(4907),a=n(1669);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,u(r.key),r)}}function l(t,e,n){return(e=u(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}var s=function(){return t=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),l(this,"selecting",!1),l(this,"startedInSelector",!1),l(this,"target",null),l(this,"_onSelectionChange",(function(){var t=window.getSelection();if(!r.selecting&&t.toString()){var e=a(t.anchorNode).closest(r.selector)[0];if(!e)return;r.target=e,r.selecting=!0,r.handler("started",r.target)}!r.selecting||!t.isCollapsed&&t.toString()&&a(t.anchorNode).closest(r.selector)[0]||(r.selecting=!1,r.handler("cleared",r.target))})),this.selector=e,this.handler=n},(e=[{key:"attach",value:function(){document.addEventListener("selectionchange",this._onSelectionChange)}},{key:"detach",value:function(){document.removeEventListener("selectionchange",this._onSelectionChange)}}])&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),c=n(1041),f=n(9073),h=n(4565),d=n(4160),p=n(1669);function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}var y=E().mark(G),g=E().mark(K),m=E().mark(W),b=E().mark(H),k=E().mark(Y);function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,l=[],u=!0,s=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);u=!0);}catch(t){s=!0,a=t}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}(t,e)||S(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=S(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},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,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function S(t,e){if(t){if("string"==typeof t)return j(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?j(t,e):void 0}}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function E(){E=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,i=Object.create(o.prototype),l=new R(r||[]);return a(i,"_invoke",{value:A(t,n,l)}),i}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",y="completed",g={};function m(){}function b(){}function k(){}var w={};s(w,i,(function(){return this}));var x=Object.getPrototypeOf,S=x&&x(x(B([])));S&&S!==n&&r.call(S,i)&&(w=S);var j=k.prototype=m.prototype=Object.create(w);function C(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(a,o,i,l){var u=f(t[a],t,o);if("throw"!==u.type){var s=u.arg,c=s.value;return c&&"object"==v(c)&&r.call(c,"__await")?e.resolve(c.__await).then((function(t){n("next",t,i,l)}),(function(t){n("throw",t,i,l)})):e.resolve(c).then((function(t){s.value=t,i(s)}),(function(t){return n("throw",t,i,l)}))}l(u.arg)}var o;a(this,"_invoke",{value:function(t,r){function a(){return new e((function(e,a){n(t,r,e,a)}))}return o=o?o.then(a,a):a()}})}function A(e,n,r){var a=h;return function(o,i){if(a===p)throw Error("Generator is already running");if(a===y){if("throw"===o)throw i;return{value:t,done:!0}}for(r.method=o,r.arg=i;;){var l=r.delegate;if(l){var u=L(l,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===h)throw a=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=p;var s=f(e,n,r);if("normal"===s.type){if(a=r.done?y:d,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=y,r.method="throw",r.arg=s.arg)}}}function L(e,n){var r=n.method,a=e.iterator[r];if(a===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,L(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=f(a,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var i=o.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function B(e){if(e||""===e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function n(){for(;++a<e.length;)if(r.call(e,a))return n.value=e[a],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(v(e)+" is not iterable")}return b.prototype=k,a(j,"constructor",{value:k,configurable:!0}),a(k,"constructor",{value:b,configurable:!0}),b.displayName=s(k,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,s(t,u,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},C(P.prototype),s(P.prototype,l,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new P(c(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},C(j),s(j,u,"Generator"),s(j,i,(function(){return this})),s(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=B,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function a(r,a){return l.type="throw",l.arg=e,n.next=r,a&&(n.method="next",n.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],l=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(t,e){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"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:B(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function C(t,e,n,r,a,o,i){try{var l=t[o](i),u=l.value}catch(t){return void n(t)}l.done?e(u):Promise.resolve(u).then(r,a)}function P(t){return function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(t){C(o,r,a,i,l,"next",t)}function l(t){C(o,r,a,i,l,"throw",t)}i(void 0)}))}}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,N(r.key),r)}}function O(t,e,n){return e&&L(t.prototype,e),n&&L(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function T(t,e,n){return e=B(e),function(t,e){if(e&&("object"==v(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,R()?Reflect.construct(e,n||[],B(t).constructor):e.apply(t,n))}function R(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(R=function(){return!!t})()}function B(t){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},B(t)}function z(t,e){return z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},z(t,e)}function I(t,e,n){return(e=N(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function N(t){var e=function(t,e){if("object"!=v(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:e+""}var _=window.BookReader,M=function(t){function e(t){var n;return A(this,e),I(n=T(this,e,[t]),"options",{enabled:!0,fullDjvuXmlUrl:null,singlePageDjvuXmlUrl:null,jsonp:!1,maxProtectedWords:200}),I(n,"djvuPagesPromise",null),I(n,"pageTextCache",new h.l),I(n,"maxWordRendered",2500),I(n,"_limitSelection",(function(){var t=window.getSelection();if(t.rangeCount){var e=t.getRangeAt(0),r=!!e.startContainer.parentElement.closest(".BRcontainer"),a=!!e.endContainer.parentElement.closest(".BRcontainer");if(r||a)if(r&&a){var o=function(t,e){var n,r=0,a=x(t);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(r==e)return o;r++}}catch(t){a.e(t)}finally{a.f()}}(G(Y(e.startContainer,e.endContainer),(function(t){var e;return null===(e=t.classList)||void 0===e?void 0:e.contains("BRwordElement")})),n.options.maxProtectedWords-1);if(o&&e.endContainer.parentNode!=o){var i=document.createRange();i.setStart(e.startContainer,e.startOffset),i.setEnd(o.firstChild,o.textContent.length),t.removeAllRanges(),t.addRange(i)}}else t.removeAllRanges()}})),I(n,"_onSelectionChange",(function(t,e){if("started"===t)n.textSelectingMode(e);else{if("cleared"!==t)throw new Error("Unknown type ".concat(t));n.defaultMode(e)}})),n.rtl="rl"===n.br.pageProgression,n.selectionObserver=new s(".BRtextLayer",n._onSelectionChange),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&z(t,e)}(e,t),O(e,[{key:"init",value:function(){var t=this;this.options.enabled&&(this.loadData(),this.selectionObserver.attach(),new s(".BRtextLayer",(function(e){var n;"started"==e&&(null===(n=t.br.plugins.archiveAnalytics)||void 0===n||n.sendEvent("BookReader","SelectStart"),t.br.refs.$br.find(".BRpagecontainer--hasSelection").removeClass("BRpagecontainer--hasSelection"),p(window.getSelection().anchorNode).closest(".BRpagecontainer").addClass("BRpagecontainer--hasSelection"))})).attach(),this.br.protected&&(document.addEventListener("selectionchange",this._limitSelection),p(document.body).on("contextmenu dragstart copy",(function(t){var e=document.getSelection();if(null!=e&&e.toString()&&p(".BRtextLayer").toArray().some((function(t){return e.containsNode(t,!0)})))return t.preventDefault(),!1}))))}},{key:"_configurePageContainer",value:function(t){return this.br.mode!==this.br.constModeThumb&&t.page&&this.createTextLayer(t),t}},{key:"loadData",value:function(){this.options.singlePageDjvuXmlUrl||(this.djvuPagesPromise=p.ajax({type:"GET",url:(0,f.g)(this.options.fullDjvuXmlUrl,this.br.options.vars),dataType:this.options.jsonp?"jsonp":"html",cache:!0,xhrFields:{withCredentials:this.br.protected},error:function(t){}}).then((function(t){try{var e=p.parseXML(t);return e&&p(e).find("OBJECT")}catch(t){return}})))}},{key:"getPageText",value:(a=P(E().mark((function t(e){var n,r,a,o,i;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.options.singlePageDjvuXmlUrl){t.next=19;break}if(!(n=this.pageTextCache.entries.find((function(t){return t.index==e})))){t.next=4;break}return t.abrupt("return",n.response);case 4:return t.next=6,p.ajax({type:"GET",url:(0,f.g)(this.options.singlePageDjvuXmlUrl,this.br.options.vars,{pageIndex:e}),dataType:this.options.jsonp?"jsonp":"html",cache:!0,xhrFields:{withCredentials:this.br.protected},error:function(t){}});case 6:return r=t.sent,t.prev=7,a=p.parseXML(r),o=a&&p(a).find("OBJECT")[0],this.pageTextCache.add({index:e,response:o}),t.abrupt("return",o);case 14:return t.prev=14,t.t0=t.catch(7),t.abrupt("return",void 0);case 17:t.next=24;break;case 19:return t.next=21,this.djvuPagesPromise;case 21:if(!(i=t.sent)){t.next=24;break}return t.abrupt("return",i[e]);case 24:case"end":return t.stop()}}),t,this,[[7,14]])}))),function(t){return a.apply(this,arguments)})},{key:"interceptCopy",value:function(t){t[0].addEventListener("copy",(function(t){var e=document.getSelection();t.clipboardData.setData("text/plain",e.toString()),t.preventDefault()}))}},{key:"defaultMode",value:function(t){var e=this,n=p(t).closest(".BRpagecontainer");t.style.pointerEvents="none",n.find("img").css("pointer-events","auto"),p(t).off(".textSelectPluginHandler");var r=this.mouseIsDown,a=this.mouseIsDown;r&&(t.style.pointerEvents="auto"),p(t).on("mousedown.textSelectPluginHandler",(function(t){e.mouseIsDown=!0,p(t.target).is(".BRwordElement, .BRspace")&&t.stopPropagation()})),p(t).on("mouseup.textSelectPluginHandler",(function(n){e.mouseIsDown=!1,t.style.pointerEvents="none",a&&(a=!1,n.stopPropagation())}))}},{key:"textSelectingMode",value:function(t){var e=this,n=p(t).closest(".BRpagecontainer");t.style.pointerEvents="all",n.find("img").css("pointer-events","none"),p(t).off(".textSelectPluginHandler"),p(t).on("mousedown.textSelectPluginHandler",(function(t){e.mouseIsDown=!0,t.stopPropagation()})),p(t).on("mouseup.textSelectPluginHandler",(function(t){e.mouseIsDown=!1,t.stopPropagation()}))}},{key:"stopPageFlip",value:function(t){var e=this,n=t.find(".BRtextLayer");n.length&&(n.each((function(t,n){return e.defaultMode(n)})),this.br.protected||this.interceptCopy(t))}},{key:"createTextLayer",value:(n=P(E().mark((function t(e){var n,a,o,i,l,u,s,c,f,h,v,y,g,m,b,k,S,j,C,P,A,L,O,T,R,B=this;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.page.index,!(a=e.$container).find(".BRtextLayer").length){t.next=5;break}return t.abrupt("return");case 5:return t.next=7,this.getPageText(n);case 7:if(o=t.sent){t.next=10;break}return t.abrupt("return");case 10:if(U(o),!((i=p(o).find("WORD").length)>this.maxWordRendered)){t.next=15;break}return console.log("Page ".concat(n," has too many words (").concat(i," > ").concat(this.maxWordRendered,"). Not rendering text layer.")),t.abrupt("return");case 15:return l=(0,r.Ql)(e.page,"BRtextLayer"),t.next=18,Promise.resolve();case 18:u=parseFloat(e.$container[0].style.width)/e.page.width,s=parseFloat(e.$container[0].style.height)/e.page.height,l.style.transform="scale(".concat(u,", ").concat(s,")"),(c=(0,d.YH)(this.br.options.bookLanguage))&&l.setAttribute("lang",c),l.setAttribute("dir",this.rtl?"rtl":"ltr"),f=p(o).find("PARAGRAPH[coords]").toArray(),h=f.map((function(t){var e=B.renderParagraph(t);return l.appendChild(e),e})),v=D(l,".BRparagraphElement"),y=0,g=x(H(f,h));try{for(g.s();!(m=g.n()).done;)b=w(m.value,2),k=b[0],S=b[1],j=p(k).attr("coords").split(",").map(parseFloat),C=v.get(S),P=w(j,4),A=P[0],L=P[2],O=P[3],T=this.rtl?C.right-L:A-C.left,R=O-(C.top+y),S.style[this.rtl?"marginRight":"marginLeft"]="".concat(T,"px"),S.style.marginTop="".concat(R,"px"),y+=R,l.appendChild(S)}catch(t){g.e(t)}finally{g.f()}a.append(l),this.stopPageFlip(a),this.br.trigger("textLayerRendered",{pageIndex:n,pageContainer:e});case 33:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"renderParagraph",value:function(t){var e=document.createElement("p");e.classList.add("BRparagraphElement"),t.getAttribute("x-role")&&(e.classList.add("ocr-role-header-footer"),e.ariaHidden="true");var n=w(p(t).attr("coords").split(",").map(parseFloat),4),r=n[0],a=n[1],o=n[2],i=n[3],l=[],u=p(t).find("LINE[coords]").toArray();if(!u.length)return e;var s,c=x(W(K(u,F)));try{for(c.s();!(s=c.n()).done;){var f=w(s.value,3),h=f[0],d=f[1],v=f[2],y=d.ocrElement==u[u.length-1],g=document.createElement("span");g.classList.add("BRlineElement");var m,b=x(d.words.entries());try{for(b.s();!(m=b.n()).done;){var k=w(m.value,2),E=k[0],C=k[1],P=w(p(C).attr("coords").split(",").map(parseFloat),4),A=P[1],L=P[2],O=P[3],T=A-O;if(l.push(T),0==E&&null!=h&&h.lastWord.textContent.trim().endsWith("-")){var R=w(p((v||h).firstWord).attr("coords").split(",").map(parseFloat),3)[0];p(C).attr("coords","".concat(R,",").concat(A,",").concat(L,",").concat(O))}var B=document.createElement("span");if(B.setAttribute("class","BRwordElement"),B.textContent=C.textContent.trim(),E>0){var z=document.createElement("span");z.classList.add("BRspace"),z.textContent=" ",g.append(z),g.appendChild(document.createTextNode(" "))}g.appendChild(B)}}catch(t){b.e(t)}finally{b.f()}var I=d.lastWord.textContent.trim().endsWith("-"),N=g.children[g.children.length-1];I&&!y&&(N.textContent=N.textContent.trim().slice(0,-1),N.classList.add("BRwordElement--hyphen")),e.appendChild(g),y||I||e.appendChild(document.createTextNode(" "))}}catch(t){c.e(t)}finally{c.f()}l.sort((function(t,e){return t-e}));var _=l[Math.floor(.85*l.length)]+4;e.style.left="".concat(r,"px"),e.style.top="".concat(i,"px"),e.style.width="".concat(o-r,"px"),e.style.height="".concat(a-i,"px"),e.style.fontSize="".concat(_,"px");var M,G=D(e,".BRwordElement"),U=x(H(p(t).find("WORD").toArray(),e.querySelectorAll(".BRwordElement")));try{for(U.s();!(M=U.n()).done;){var q=w(M.value,2),Y=q[0],X=q[1],V=G.get(X),$=w(p(Y).attr("coords").split(",").map(parseFloat),3),J=$[0],Z=$[2]-J;Y.textContent.endsWith(" ")&&(Z=Z*(Y.textContent.length-1)/Y.textContent.length);var Q=Z-V.width;X.style.letterSpacing="".concat(Q/(Y.textContent.length-1),"px")}}catch(t){U.e(t)}finally{U.f()}G=D(e,".BRwordElement");var tt,et,nt=D(e,".BRspace"),rt=p(t).find("LINE[coords]").toArray(),at=Array.from(e.querySelectorAll(".BRlineElement")),ot=i,it=x(H(rt,at));try{for(it.s();!(tt=it.n()).done;){var lt,ut=w(tt.value,2),st=ut[0],ct=ut[1],ft=p(st).find("WORD").toArray(),ht=this.rtl?o:r,dt=x(H(ft,ct.querySelectorAll(".BRwordElement")));try{for(dt.s();!(lt=dt.n()).done;){var pt=w(lt.value,2),vt=pt[0],yt=pt[1],gt=G.get(yt),mt=w(p(vt).attr("coords").split(",").map(parseFloat),3),bt=mt[0],kt=mt[2],wt=this.rtl?-(kt-ht):bt-ht;if(yt.previousElementSibling){var xt=yt.previousElementSibling;xt.style.letterSpacing="".concat(wt-nt.get(xt).width,"px")}else yt.style[this.rtl?"paddingRight":"paddingLeft"]="".concat(wt,"px");this.rtl?ht-=wt+gt.width:ht+=wt+gt.width}}catch(t){dt.e(t)}finally{dt.f()}var St=Math.min.apply(Math,function(t){if(Array.isArray(t))return j(t)}(et=ft.map((function(t){return parseFloat(p(t).attr("coords").split(",")[3])})))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(et)||S(et)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())-ot;ct.previousElementSibling&&(ct.previousElementSibling.style.lineHeight="".concat(St,"px"),ot+=St)}}catch(t){it.e(t)}finally{it.f()}return at[at.length-1].style.lineHeight="".concat(a-ot,"px"),e.appendChild(document.createElement("br")),e}}]);var n,a}(c.S);function D(t,e){var n={position:t.style.position,visibility:t.style.visibility,top:t.style.top,left:t.style.left,transform:t.style.transform};t.style.position="absolute",t.style.visibility="hidden",t.style.top="0",t.style.left="0",t.style.transform="none",document.body.appendChild(t);var r=new Map(Array.from(t.querySelectorAll(e)).map((function(t){var e=t.getBoundingClientRect();return[t,new q(e.left+window.scrollX,e.top+window.scrollY,e.width,e.height)]})));return document.body.removeChild(t),Object.assign(t.style,n),r}function F(t){var e=p(t).find("WORD").toArray();return{ocrElement:t,words:e,firstWord:e[0],lastWord:e[e.length-1]}}function G(t,e){var n,r,a;return E().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:n=x(t),o.prev=1,n.s();case 3:if((r=n.n()).done){o.next=10;break}if(a=r.value,!e(a)){o.next=8;break}return o.next=8,a;case 8:o.next=3;break;case 10:o.next=15;break;case 12:o.prev=12,o.t0=o.catch(1),n.e(o.t0);case 15:return o.prev=15,n.f(),o.finish(15);case 18:case"end":return o.stop()}}),y,null,[[1,12,15,18]])}function K(t,e){var n,r,a;return E().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:n=x(t),o.prev=1,n.s();case 3:if((r=n.n()).done){o.next=9;break}return a=r.value,o.next=7,e(a);case 7:o.next=3;break;case 9:o.next=14;break;case 11:o.prev=11,o.t0=o.catch(1),n.e(o.t0);case 14:return o.prev=14,n.f(),o.finish(14);case 17:case"end":return o.stop()}}),g,null,[[1,11,14,17]])}function W(t){var e,n,r,a,o,i;return E().wrap((function(l){for(;;)switch(l.prev=l.next){case 0:e=void 0,n=void 0,r=void 0,a=x(t),l.prev=4,a.s();case 6:if((o=a.n()).done){l.next=17;break}if(i=o.value,void 0===n){l.next=12;break}return r=i,l.next=12,[e,n,r];case 12:e=n,n=i,r=void 0;case 15:l.next=6;break;case 17:l.next=22;break;case 19:l.prev=19,l.t0=l.catch(4),a.e(l.t0);case 22:return l.prev=22,a.f(),l.finish(22);case 25:if(void 0===n){l.next=28;break}return l.next=28,[e,n,r];case 28:case"end":return l.stop()}}),m,null,[[4,19,22,25]])}function H(t,e){var n,r,a,o;return E().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:n=t[Symbol.iterator](),r=e[Symbol.iterator]();case 2:if(a=n.next(),o=r.next(),!a.done||!o.done){i.next=7;break}return i.abrupt("return");case 7:if(!a.done&&!o.done){i.next=9;break}throw new Error("zip: one of the iterators is done");case 9:return i.next=11,[a.value,o.value];case 11:i.next=2;break;case 13:case"end":return i.stop()}}),b)}function U(t){if(!p(t).attr("coords")&&t.children){var e=p(t).children().toArray();if(0!==e.length){var n,r=x(e);try{for(r.s();!(n=r.n()).done;)U(n.value)}catch(t){r.e(t)}finally{r.f()}var a,o=[],i=x(e);try{for(i.s();!(a=i.n()).done;){var l=a.value;p(l).attr("coords")&&o.push(p(l).attr("coords").split(",").map(parseFloat))}}catch(t){i.e(t)}finally{i.f()}var u=function(t){var e,n=1/0,r=-1/0,a=-1/0,o=1/0,i=x(t);try{for(i.s();!(e=i.n()).done;){var l=w(e.value,4),u=l[0],s=l[1],c=l[2],f=l[3];n=Math.min(n,u),r=Math.max(r,s),a=Math.max(a,c),o=Math.min(o,f)}}catch(t){i.e(t)}finally{i.f()}return[n,r,a,o]}(o);Math.abs(u[0])!=1/0&&p(t).attr("coords",u.join(","))}}}null==_||_.registerPlugin("textSelection",M);var q=function(){return O((function t(e,n,r,a){A(this,t),this.x=e,this.y=n,this.width=r,this.height=a}),[{key:"right",get:function(){return this.x+this.width}},{key:"bottom",get:function(){return this.y+this.height}},{key:"top",get:function(){return this.y}},{key:"left",get:function(){return this.x}}])}();function Y(t,e){var n,r;return E().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return r=function(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=a.children,i=void 0===o||o,l=a.parents,u=void 0===l||l,s=a.siblings,c=void 0===s||s;return E().mark((function a(){var o;return E().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(t!==e){a.next=5;break}return n=!0,a.next=4,t;case 4:return a.abrupt("return");case 5:return a.next=7,t;case 7:if(!i||!t.firstChild){a.next=11;break}return a.delegateYield(r(t.firstChild,{children:!0,parents:!1,siblings:!0}),"t0",9);case 9:if(!n){a.next=11;break}return a.abrupt("return");case 11:if(!c){a.next=20;break}o=t.nextSibling;case 13:if(!o){a.next=20;break}return a.delegateYield(r(o,{children:!0,parents:!1,siblings:!1}),"t1",15);case 15:if(!n){a.next=17;break}return a.abrupt("return");case 17:o=o.nextSibling,a.next=13;break;case 20:if(!u||!t.parentNode){a.next=24;break}return a.delegateYield(r(t.parentNode,{children:!1,parents:!0,siblings:!0}),"t2",22);case 22:if(!n){a.next=24;break}return a.abrupt("return");case 24:case"end":return a.stop()}}),a)}))()},n=!1,a.delegateYield(r(t),"t0",3);case 3:case"end":return a.stop()}}),k)}},4160:function(t,e,n){n.d(e,{$x:function(){return y},EF:function(){return c},ND:function(){return v},m0:function(){return f},YH:function(){return d}}),n(2675),n(9463),n(6412),n(2259),n(8125),n(8706),n(3418),n(3792),n(2062),n(4490),n(4782),n(2010),n(4731),n(479),n(875),n(6099),n(3362),n(7495),n(8781),n(7764),n(1761),n(3500),n(2953);var r=[],a={},o={},i={};[["Serbian","српски језик","sr","srp","srp"],["Romanian, Moldavian, Moldovan","Română","ro","ron","rum"],["Sichuan Yi, Nuosu","ꆈꌠ꒿ Nuosuhxop","ii","iii","iii"],["Tahitian","Reo Tahiti","ty","tah","tah"],["Tagalog","Wikang Tagalog","tl","tgl","tgl"],["Yiddish","ייִדיש","yi","yid","yid"],["Akan","Akan","ak","aka","aka"],["Malay","Bahasa Melayu, بهاس ملايو","ms","msa","may"],["Arabic","العربية","ar","ara","ara"],["Norwegian","Norsk","no","nor","nor"],["Ojibwa","ᐊᓂᔑᓈᐯᒧᐎᓐ","oj","oji","oji"],["Fulah","Fulfulde, Pulaar, Pular","ff","ful","ful"],["Persian","فارسی","fa","fas","per"],["Albanian","Shqip","sq","sqi","alb"],["Aymara","aymar aru","ay","aym","aym"],["Azerbaijani","azərbaycan dili","az","aze","aze"],["Chinese","中文 (Zhōngwén), 汉语, 漢語","zh","zho","chi"],["Cree","ᓀᐦᐃᔭᐍᐏᐣ","cr","cre","cre"],["Estonian","eesti, eesti keel","et","est","est"],["Guaraní","Avañe'ẽ","gn","grn","grn"],["Inupiaq","Iñupiaq, Iñupiatun","ik","ipk","ipk"],["Inuktitut","ᐃᓄᒃᑎᑐᑦ","iu","iku","iku"],["Kanuri","Kanuri","kr","kau","kau"],["Komi","коми кыв","kv","kom","kom"],["Kongo","Kikongo","kg","kon","kon"],["Kurdish","Kurdî, أۇزبېك","ku","kur","kur"],["Latvian","latviešu valoda","lv","lav","lav"],["Malagasy","fiteny malagasy","mg","mlg","mlg"],["Mongolian","Монгол хэл","mn","mon","mon"],["Oromo","Afaan Oromoo","om","orm","orm"],["Pashto, Pushto","پښتو","ps","pus","pus"],["Quechua","Runa Simi, Kichwa","qu","que","que"],["Sardinian","sardu","sc","srd","srd"],["Swahili","Kiswahili","sw","swa","swa"],["Uzbek","Oʻzbek, Ўзбек, ","uz","uzb","uzb"],["Zhuang, Chuang","Saɯ cueŋƅ, Saw cuengh","za","zha","zha"],["Bislama","Bislama","bi","bis","bis"],["Norwegian Bokmål","Norsk Bokmål","nb","nob","nob"],["Norwegian Nynorsk","Norsk Nynorsk","nn","nno","nno"],["Indonesian","Bahasa Indonesia","id","ind","ind"],["Twi","Twi","tw","twi","twi"],["Esperanto","Esperanto","eo","epo","epo"],["Interlingua","Interlingua","ia","ina","ina"],["Interlingue","Originally called Occidental; then Interlingue after WWII","ie","ile","ile"],["Ido","Ido","io","ido","ido"],["Volapük","Volapük","vo","vol","vol"],["Bihari languages","भोजपुरी","bh","bih","bih"],["Hebrew (modern)","עברית","he","heb","heb"],["Sanskrit","संस्कृतम्","sa","san","san"],["Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian","ѩзыкъ словѣньскъ","cu","chu","chu"],["Pali","पाऴि","pi","pli","pli"],["Avestan","avesta","ae","ave","ave"],["Latin","latine, lingua latina","la","lat","lat"],["Armenian","Հայերեն","hy","hye","arm"],["Swati","SiSwati","ss","ssw","ssw"],["Tibetan","བོད་ཡིག","bo","bod","tib"],["South Ndebele","isiNdebele","nr","nbl","nbl"],["Slovene","Slovenski Jezik, Slovenščina","sl","slv","slv"],["Oriya","ଓଡ଼ିଆ","or","ori","ori"],["North Ndebele","isiNdebele","nd","nde","nde"],["Nauru","Dorerin Naoero","na","nau","nau"],["Maori","te reo Māori","mi","mri","mao"],["Marathi","मराठी","mr","mar","mar"],["Luba-Katanga","Kiluba","lu","lub","lub"],["Rundi","Ikirundi","rn","run","run"],["Central Khmer","ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ","km","khm","khm"],["Western Frisian","Frysk","fy","fry","fry"],["Bengali","বাংলা","bn","ben","ben"],["Avaric","авар мацӀ, магӀарул мацӀ","av","ava","ava"],["Abkhazian","аҧсуа бызшәа, аҧсшәа","ab","abk","abk"],["Afar","Afaraf","aa","aar","aar"],["Afrikaans","Afrikaans","af","afr","afr"],["Amharic","አማርኛ","am","amh","amh"],["Aragonese","aragonés","an","arg","arg"],["Assamese","অসমীয়া","as","asm","asm"],["Bambara","bamanankan","bm","bam","bam"],["Bashkir","башҡорт теле","ba","bak","bak"],["Basque","euskara, euskera","eu","eus","baq"],["Belarusian","беларуская мова","be","bel","bel"],["Bosnian","bosanski jezik","bs","bos","bos"],["Breton","brezhoneg","br","bre","bre"],["Bulgarian","български език","bg","bul","bul"],["Burmese","ဗမာစာ","my","mya","bur"],["Catalan, Valencian","català, valencià","ca","cat","cat"],["Chamorro","Chamoru","ch","cha","cha"],["Chechen","нохчийн мотт","ce","che","che"],["Chichewa, Chewa, Nyanja","chiCheŵa, chinyanja","ny","nya","nya"],["Chuvash","чӑваш чӗлхи","cv","chv","chv"],["Cornish","Kernewek","kw","cor","cor"],["Corsican","corsu, lingua corsa","co","cos","cos"],["Croatian","hrvatski jezik","hr","hrv","hrv"],["Czech","čeština, český jazyk","cs","ces","cze"],["Danish","dansk","da","dan","dan"],["Divehi, Dhivehi, Maldivian","ދިވެހި","dv","div","div"],["Dutch, Flemish","Nederlands, Vlaams","nl","nld","dut"],["Dzongkha","རྫོང་ཁ","dz","dzo","dzo"],["English","English","en","eng","eng"],["Ewe","Eʋegbe","ee","ewe","ewe"],["Faroese","føroyskt","fo","fao","fao"],["Fijian","vosa Vakaviti","fj","fij","fij"],["Finnish","suomi, suomen kieli","fi","fin","fin"],["French","français, langue française","fr","fra","fre"],["Galician","Galego","gl","glg","glg"],["Georgian","ქართული","ka","kat","geo"],["German","Deutsch","de","deu","ger"],["Greek (modern)","ελληνικά","el","ell","gre"],["Gujarati","ગુજરાતી","gu","guj","guj"],["Haitian, Haitian Creole","Kreyòl ayisyen","ht","hat","hat"],["Hausa","(Hausa) هَوُسَ","ha","hau","hau"],["Herero","Otjiherero","hz","her","her"],["Hindi","हिन्दी, हिंदी","hi","hin","hin"],["Hiri Motu","Hiri Motu","ho","hmo","hmo"],["Hungarian","magyar","hu","hun","hun"],["Irish","Gaeilge","ga","gle","gle"],["Igbo","Asụsụ Igbo","ig","ibo","ibo"],["Icelandic","Íslenska","is","isl","ice"],["Italian","Italiano","it","ita","ita"],["Japanese","日本語 (にほんご)","ja","jpn","jpn"],["Javanese","ꦧꦱꦗꦮ, Basa Jawa","jv","jav","jav"],["Kalaallisut, Greenlandic","kalaallisut, kalaallit oqaasii","kl","kal","kal"],["Kannada","ಕನ್ನಡ","kn","kan","kan"],["Kashmiri","कश्मीरी, كشميري","ks","kas","kas"],["Kazakh","қазақ тілі","kk","kaz","kaz"],["Kikuyu, Gikuyu","Gĩkũyũ","ki","kik","kik"],["Kinyarwanda","Ikinyarwanda","rw","kin","kin"],["Kirghiz, Kyrgyz","Кыргызча, Кыргыз тили","ky","kir","kir"],["Korean","한국어","ko","kor","kor"],["Kuanyama, Kwanyama","Kuanyama","kj","kua","kua"],["Luxembourgish, Letzeburgesch","Lëtzebuergesch","lb","ltz","ltz"],["Ganda","Luganda","lg","lug","lug"],["Limburgan, Limburger, Limburgish","Limburgs","li","lim","lim"],["Lingala","Lingála","ln","lin","lin"],["Lao","ພາສາລາວ","lo","lao","lao"],["Lithuanian","lietuvių kalba","lt","lit","lit"],["Manx","Gaelg, Gailck","gv","glv","glv"],["Macedonian","македонски јазик","mk","mkd","mac"],["Malayalam","മലയാളം","ml","mal","mal"],["Maltese","Malti","mt","mlt","mlt"],["Marshallese","Kajin M̧ajeļ","mh","mah","mah"],["Navajo, Navaho","Diné bizaad","nv","nav","nav"],["Nepali","नेपाली","ne","nep","nep"],["Ndonga","Owambo","ng","ndo","ndo"],["Occitan","occitan, lenga d'òc","oc","oci","oci"],["Ossetian, Ossetic","ирон æвзаг","os","oss","oss"],["Panjabi, Punjabi","ਪੰਜਾਬੀ","pa","pan","pan"],["Polish","język polski, polszczyzna","pl","pol","pol"],["Portuguese","Português","pt","por","por"],["Romansh","Rumantsch Grischun","rm","roh","roh"],["Russian","русский","ru","rus","rus"],["Sindhi","सिन्धी, سنڌي، سندھی","sd","snd","snd"],["Northern Sami","Davvisámegiella","se","sme","sme"],["Samoan","gagana fa'a Samoa","sm","smo","smo"],["Sango","yângâ tî sängö","sg","sag","sag"],["Gaelic, Scottish Gaelic","Gàidhlig","gd","gla","gla"],["Shona","chiShona","sn","sna","sna"],["Sinhala, Sinhalese","සිංහල","si","sin","sin"],["Slovak","Slovenčina, Slovenský Jazyk","sk","slk","slo"],["Somali","Soomaaliga, af Soomaali","so","som","som"],["Southern Sotho","Sesotho","st","sot","sot"],["Spanish, Castilian","Español","es","spa","spa"],["Sundanese","Basa Sunda","su","sun","sun"],["Swedish","Svenska","sv","swe","swe"],["Tamil","தமிழ்","ta","tam","tam"],["Telugu","తెలుగు","te","tel","tel"],["Tajik","тоҷикӣ, toçikī, تاجیکی","tg","tgk","tgk"],["Thai","ไทย","th","tha","tha"],["Tigrinya","ትግርኛ","ti","tir","tir"],["Turkmen","Türkmen, Түркмен","tk","tuk","tuk"],["Tswana","Setswana","tn","tsn","tsn"],["Tongan (Tonga Islands)","Faka Tonga","to","ton","ton"],["Turkish","Türkçe","tr","tur","tur"],["Tsonga","Xitsonga","ts","tso","tso"],["Tatar","татар теле, tatar tele","tt","tat","tat"],["Uighur, Uyghur","ئۇيغۇرچە, Uyghurche","ug","uig","uig"],["Ukrainian","Українська","uk","ukr","ukr"],["Urdu","اردو","ur","urd","urd"],["Venda","Tshivenḓa","ve","ven","ven"],["Vietnamese","Tiếng Việt","vi","vie","vie"],["Walloon","Walon","wa","wln","wln"],["Welsh","Cymraeg","cy","cym","wel"],["Wolof","Wollof","wo","wol","wol"],["Xhosa","isiXhosa","xh","xho","xho"],["Yoruba","Yorùbá","yo","yor","yor"],["Zulu","isiZulu","zu","zul","zul"]].forEach((t=>{var e={name:t[0],nativeName:t[1],iso639_1:t[2],iso639_2T:t[3],iso639_2B:t[4]};a[t[2]]=o[t[3]]=i[t[4]]=e,r.push(e)}));var l=r;function u(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return s(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},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,l=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){l=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function c(t){var e=t.match(/\S+/g);return e?e.length:0}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator.userAgent;return/android/i.test(t)}var h={"zh-hans":"中文 (Zhōngwén)"};function d(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t?p(t=t.toLowerCase(),["iso639_1"],e)||p(t,["iso639_2T"],e)||p(t,["iso639_2B","nativeName","name"],e):null}function p(t,e,n){var r,a=u(l);try{for(a.s();!(r=a.n()).done;){var o,i=r.value,s=u(e);try{for(s.s();!(o=s.n()).done;)if(-1!=i[o.value].split(", ").map((function(t){return t.toLowerCase()})).indexOf(t))return n?"".concat(i.nativeName.split(", ")[0]," (").concat(i.iso639_1,")"):i.iso639_1}catch(t){s.e(t)}finally{s.f()}}}catch(t){a.e(t)}finally{a.f()}return h[t]?"".concat(h[t]," (").concat(t,")"):null}function v(){try{return!!window.localStorage}catch(t){return!1}}var y=-1!=location.toString().indexOf("_debugReadAloud=true")},4565:function(t,e,n){function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function o(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,"string");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}n.d(e,{l:function(){return i}}),n(2675),n(9463),n(2259),n(5700),n(3792),n(9572),n(8130),n(6099),n(7764),n(2953);var i=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maxSize=e,this.entries=[]},(e=[{key:"add",value:function(t){this.entries.length>=this.maxSize&&this.entries.shift(),this.entries.push(t)}}])&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},9073:function(t,e,n){function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o;return null==t?void 0:t.replace(/\{\{([^}]*?)\}\}/g,(function(t,o){if(!o)return t;var i,l=function(t){if(Array.isArray(t))return t}(i=o.split("|").map((function(t){return t.trim()})))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(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.")}(),u=l[0],s=l.slice(1);if(!(u in n)&&!(u in e))return t;var c=u in n?n[u]:u in e?e[u]:null;return s.map((function(t){return a[t]})).reduce((function(t,e){return e(t)}),c&&c.toString())}))}n.d(e,{g:function(){return a}}),n(2675),n(9463),n(2259),n(3418),n(3792),n(2062),n(2712),n(4782),n(2010),n(6099),n(7495),n(8781),n(7764),n(5440),n(2762),n(2953);var o={urlencode:encodeURIComponent}}},function(t){t(t.s=2763)}]);
2
+ "use strict";(self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[326],{706:function(t,e,n){var r=n(350).PROPER,a=n(9039),o=n(7452);t.exports=function(t){return a((function(){return!!o[t]()||"​…᠎"!=="​…᠎"[t]()||r&&o[t].name!==t}))}},2762:function(t,e,n){var r=n(6518),a=n(3802).trim;r({target:"String",proto:!0,forced:n(706)("trim")},{trim:function(){return a(this)}})},1041:function(t,e,n){function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function o(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,"string");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}n.d(e,{S:function(){return i}}),n(2675),n(9463),n(2259),n(5700),n(3792),n(9572),n(8130),n(9085),n(6099),n(7764),n(2953);var i=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.br=e,this.options},(e=[{key:"setup",value:function(t){this.options=Object.assign({},this.options,t)}},{key:"init",value:function(){}},{key:"_configurePageContainer",value:function(t){}},{key:"_configureToolbar",value:function(t){}},{key:"_bindNavigationHandlers",value:function(){}},{key:"extendNavBar",value:function(t){}}])&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},296:function(t,e,n){n(2675),n(9463),n(6412),n(2259),n(5700),n(8125),n(8706),n(113),n(3418),n(3792),n(8598),n(2062),n(4490),n(4782),n(6910),n(9572),n(2010),n(4731),n(6033),n(479),n(8130),n(9085),n(875),n(6099),n(8459),n(3362),n(825),n(7495),n(8781),n(9449),n(7764),n(2762),n(3500),n(2953);var r=n(4907),a=n(1041),o=n(9073),i=n(4565),u=n(4160),l=n(593),c=n(1669);function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}var f=g().mark(N),h=g().mark(I),p=g().mark(B);function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,o,i,u=[],l=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==e);l=!0);}catch(t){c=!0,a=t}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return u}}(t,e)||v(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=v(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},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,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){u=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(u)throw o}}}}function v(t,e){if(t){if("string"==typeof t)return m(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(t,e):void 0}}function m(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function g(){g=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),u=new _(r||[]);return a(i,"_invoke",{value:O(t,n,u)}),i}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",d="suspendedYield",y="executing",v="completed",m={};function b(){}function w(){}function k(){}var x={};c(x,i,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(R([])));E&&E!==n&&r.call(E,i)&&(x=E);var j=k.prototype=b.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(a,o,i,u){var l=h(t[a],t,o);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==s(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,i,u)}),(function(t){n("throw",t,i,u)})):e.resolve(f).then((function(t){c.value=t,i(c)}),(function(t){return n("throw",t,i,u)}))}u(l.arg)}var o;a(this,"_invoke",{value:function(t,r){function a(){return new e((function(e,a){n(t,r,e,a)}))}return o=o?o.then(a,a):a()}})}function O(e,n,r){var a=p;return function(o,i){if(a===y)throw Error("Generator is already running");if(a===v){if("throw"===o)throw i;return{value:t,done:!0}}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var l=C(u,r);if(l){if(l===m)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===p)throw a=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=y;var c=h(e,n,r);if("normal"===c.type){if(a=r.done?v:d,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(a=v,r.method="throw",r.arg=c.arg)}}}function C(e,n){var r=n.method,a=e.iterator[r];if(a===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=h(a,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,m;var i=o.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,m):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function R(e){if(e||""===e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function n(){for(;++a<e.length;)if(r.call(e,a))return n.value=e[a],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(s(e)+" is not iterable")}return w.prototype=k,a(j,"constructor",{value:k,configurable:!0}),a(k,"constructor",{value:w,configurable:!0}),w.displayName=c(k,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,c(t,l,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},L(P.prototype),c(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new P(f(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(j),c(j,l,"Generator"),c(j,i,(function(){return this})),c(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=R,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function a(r,a){return u.type="throw",u.arg=e,n.next=r,a&&(n.method="next",n.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(t,e){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"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:R(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),m}},e}function b(t,e,n,r,a,o,i){try{var u=t[o](i),l=u.value}catch(t){return void n(t)}u.done?e(l):Promise.resolve(l).then(r,a)}function w(t){return function(){var e=this,n=arguments;return new Promise((function(r,a){var o=t.apply(e,n);function i(t){b(o,r,a,i,u,"next",t)}function u(t){b(o,r,a,i,u,"throw",t)}i(void 0)}))}}function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function x(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,C(r.key),r)}}function S(t,e,n){return e&&x(t.prototype,e),n&&x(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function E(t,e,n){return e=L(e),function(t,e){if(e&&("object"==s(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,j()?Reflect.construct(e,n||[],L(t).constructor):e.apply(t,n))}function j(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(j=function(){return!!t})()}function L(t){return L=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},L(t)}function P(t,e){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},P(t,e)}function O(t,e,n){return(e=C(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function C(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==s(e)?e:e+""}var A=window.BookReader,T=function(t){function e(t){var n;return k(this,e),O(n=E(this,e,[t]),"options",{enabled:!0,fullDjvuXmlUrl:null,singlePageDjvuXmlUrl:null,jsonp:!1,maxProtectedWords:200}),O(n,"djvuPagesPromise",null),O(n,"pageTextCache",new i.l),O(n,"maxWordRendered",2500),n.rtl="rl"===n.br.pageProgression,n.textSelectionManager=new l.bg(".BRtextLayer",n.br,{selectionElement:[".BRwordElement",".BRspace"]},n.options.maxProtectedWords),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&P(t,e)}(e,t),S(e,[{key:"init",value:function(){this.options.enabled&&(this.loadData(),this.textSelectionManager.init())}},{key:"_configurePageContainer",value:function(t){return this.br.mode!==this.br.constModeThumb&&t.page&&this.createTextLayer(t),t}},{key:"loadData",value:function(){this.options.singlePageDjvuXmlUrl||(this.djvuPagesPromise=c.ajax({type:"GET",url:(0,o.g)(this.options.fullDjvuXmlUrl,this.br.options.vars),dataType:this.options.jsonp?"jsonp":"html",cache:!0,xhrFields:{withCredentials:this.br.protected},error:function(t){}}).then((function(t){try{var e=c.parseXML(t);return e&&c(e).find("OBJECT")}catch(t){return}})))}},{key:"getPageText",value:(a=w(g().mark((function t(e){var n,r,a,i,u;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.options.singlePageDjvuXmlUrl){t.next=19;break}if(!(n=this.pageTextCache.entries.find((function(t){return t.index==e})))){t.next=4;break}return t.abrupt("return",n.response);case 4:return t.next=6,c.ajax({type:"GET",url:(0,o.g)(this.options.singlePageDjvuXmlUrl,this.br.options.vars,{pageIndex:e}),dataType:this.options.jsonp?"jsonp":"html",cache:!0,xhrFields:{withCredentials:this.br.protected},error:function(t){}});case 6:return r=t.sent,t.prev=7,a=c.parseXML(r),i=a&&c(a).find("OBJECT")[0],this.pageTextCache.add({index:e,response:i}),t.abrupt("return",i);case 14:return t.prev=14,t.t0=t.catch(7),t.abrupt("return",void 0);case 17:t.next=24;break;case 19:return t.next=21,this.djvuPagesPromise;case 21:if(!(u=t.sent)){t.next=24;break}return t.abrupt("return",u[e]);case 24:case"end":return t.stop()}}),t,this,[[7,14]])}))),function(t){return a.apply(this,arguments)})},{key:"createTextLayer",value:(n=w(g().mark((function t(e){var n,a,o,i,l,s,f,h,p,v,m,b,w,k,x,S,E,j,L,P,O,C,A,T,R,N=this;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.page.index,!(a=e.$container).find(".BRtextLayer").length){t.next=5;break}return t.abrupt("return");case 5:return t.next=7,this.getPageText(n);case 7:if(o=t.sent){t.next=10;break}return t.abrupt("return");case 10:if(z(o),!((i=c(o).find("WORD").length)>this.maxWordRendered)){t.next=15;break}return console.log("Page ".concat(n," has too many words (").concat(i," > ").concat(this.maxWordRendered,"). Not rendering text layer.")),t.abrupt("return");case 15:return l=(0,r.Ql)(e.page,"BRtextLayer"),t.next=18,Promise.resolve();case 18:s=parseFloat(e.$container[0].style.width)/e.page.width,f=parseFloat(e.$container[0].style.height)/e.page.height,l.style.transform="scale(".concat(s,", ").concat(f,")"),(h=(0,u.YH)(this.br.options.bookLanguage))&&l.setAttribute("lang",h),l.setAttribute("dir",this.rtl?"rtl":"ltr"),p=c(o).find("PARAGRAPH[coords]").toArray(),v=p.map((function(t){var e=N.renderParagraph(t);return l.appendChild(e),e})),m=_(l,".BRparagraphElement"),b=0,w=y(B(p,v));try{for(w.s();!(k=w.n()).done;)x=d(k.value,2),S=x[0],E=x[1],j=c(S).attr("coords").split(",").map(parseFloat),L=m.get(E),P=d(j,4),O=P[0],C=P[2],A=P[3],T=this.rtl?L.right-C:O-L.left,R=A-(L.top+b),E.style[this.rtl?"marginRight":"marginLeft"]="".concat(T,"px"),E.style.marginTop="".concat(R,"px"),b+=R,l.appendChild(E)}catch(t){w.e(t)}finally{w.f()}a.append(l),this.textSelectionManager.stopPageFlip(a),this.br.trigger("textLayerRendered",{pageIndex:n,pageContainer:e});case 33:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"renderParagraph",value:function(t){var e=document.createElement("p");e.classList.add("BRparagraphElement"),t.getAttribute("x-role")&&(e.classList.add("ocr-role-header-footer"),e.ariaHidden="true");var n=d(c(t).attr("coords").split(",").map(parseFloat),4),r=n[0],a=n[1],o=n[2],i=n[3],u=[],l=c(t).find("LINE[coords]").toArray();if(!l.length)return e;var s,f=y(I(N(l,R)));try{for(f.s();!(s=f.n()).done;){var h=d(s.value,3),p=h[0],g=h[1],b=h[2],w=g.ocrElement==l[l.length-1],k=document.createElement("span");k.classList.add("BRlineElement");var x,S=y(g.words.entries());try{for(S.s();!(x=S.n()).done;){var E=d(x.value,2),j=E[0],L=E[1],P=d(c(L).attr("coords").split(",").map(parseFloat),4),O=P[1],C=P[2],A=P[3],T=O-A;if(u.push(T),0==j&&null!=p&&p.lastWord.textContent.trim().endsWith("-")){var z=d(c((b||p).firstWord).attr("coords").split(",").map(parseFloat),3)[0];c(L).attr("coords","".concat(z,",").concat(O,",").concat(C,",").concat(A))}var M=document.createElement("span");if(M.setAttribute("class","BRwordElement"),M.textContent=L.textContent.trim(),j>0){var G=document.createElement("span");G.classList.add("BRspace"),G.textContent=" ",k.append(G),k.appendChild(document.createTextNode(" "))}k.appendChild(M)}}catch(t){S.e(t)}finally{S.f()}var F=g.lastWord.textContent.trim().endsWith("-"),D=k.children[k.children.length-1];F&&!w&&(D.textContent=D.textContent.trim().slice(0,-1),D.classList.add("BRwordElement--hyphen")),e.appendChild(k),w||F||e.appendChild(document.createTextNode(" "))}}catch(t){f.e(t)}finally{f.f()}u.sort((function(t,e){return t-e}));var W=u[Math.floor(.85*u.length)]+4;e.style.left="".concat(r,"px"),e.style.top="".concat(i,"px"),e.style.width="".concat(o-r,"px"),e.style.height="".concat(a-i,"px"),e.style.fontSize="".concat(W,"px");var K,H=_(e,".BRwordElement"),U=y(B(c(t).find("WORD").toArray(),e.querySelectorAll(".BRwordElement")));try{for(U.s();!(K=U.n()).done;){var q=d(K.value,2),Y=q[0],X=q[1],$=H.get(X),V=d(c(Y).attr("coords").split(",").map(parseFloat),3),J=V[0],Z=V[2]-J;Y.textContent.endsWith(" ")&&(Z=Z*(Y.textContent.length-1)/Y.textContent.length);var Q=Z-$.width;X.style.letterSpacing="".concat(Q/(Y.textContent.length-1),"px")}}catch(t){U.e(t)}finally{U.f()}H=_(e,".BRwordElement");var tt,et,nt=_(e,".BRspace"),rt=c(t).find("LINE[coords]").toArray(),at=Array.from(e.querySelectorAll(".BRlineElement")),ot=i,it=y(B(rt,at));try{for(it.s();!(tt=it.n()).done;){var ut,lt=d(tt.value,2),ct=lt[0],st=lt[1],ft=c(ct).find("WORD").toArray(),ht=this.rtl?o:r,pt=y(B(ft,st.querySelectorAll(".BRwordElement")));try{for(pt.s();!(ut=pt.n()).done;){var dt=d(ut.value,2),yt=dt[0],vt=dt[1],mt=H.get(vt),gt=d(c(yt).attr("coords").split(",").map(parseFloat),3),bt=gt[0],wt=gt[2],kt=this.rtl?-(wt-ht):bt-ht;if(vt.previousElementSibling){var xt=vt.previousElementSibling;xt.style.letterSpacing="".concat(kt-nt.get(xt).width,"px")}else vt.style[this.rtl?"paddingRight":"paddingLeft"]="".concat(kt,"px");this.rtl?ht-=kt+mt.width:ht+=kt+mt.width}}catch(t){pt.e(t)}finally{pt.f()}var St=Math.min.apply(Math,function(t){if(Array.isArray(t))return m(t)}(et=ft.map((function(t){return parseFloat(c(t).attr("coords").split(",")[3])})))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(et)||v(et)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())-ot;st.previousElementSibling&&(st.previousElementSibling.style.lineHeight="".concat(St,"px"),ot+=St)}}catch(t){it.e(t)}finally{it.f()}return at[at.length-1].style.lineHeight="".concat(a-ot,"px"),e.appendChild(document.createElement("br")),e}}]);var n,a}(a.S);function _(t,e){var n={position:t.style.position,visibility:t.style.visibility,top:t.style.top,left:t.style.left,transform:t.style.transform};t.style.position="absolute",t.style.visibility="hidden",t.style.top="0",t.style.left="0",t.style.transform="none",document.body.appendChild(t);var r=new Map(Array.from(t.querySelectorAll(e)).map((function(t){var e=t.getBoundingClientRect();return[t,new M(e.left+window.scrollX,e.top+window.scrollY,e.width,e.height)]})));return document.body.removeChild(t),Object.assign(t.style,n),r}function R(t){var e=c(t).find("WORD").toArray();return{ocrElement:t,words:e,firstWord:e[0],lastWord:e[e.length-1]}}function N(t,e){var n,r,a;return g().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:n=y(t),o.prev=1,n.s();case 3:if((r=n.n()).done){o.next=9;break}return a=r.value,o.next=7,e(a);case 7:o.next=3;break;case 9:o.next=14;break;case 11:o.prev=11,o.t0=o.catch(1),n.e(o.t0);case 14:return o.prev=14,n.f(),o.finish(14);case 17:case"end":return o.stop()}}),f,null,[[1,11,14,17]])}function I(t){var e,n,r,a,o,i;return g().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:e=void 0,n=void 0,r=void 0,a=y(t),u.prev=4,a.s();case 6:if((o=a.n()).done){u.next=17;break}if(i=o.value,void 0===n){u.next=12;break}return r=i,u.next=12,[e,n,r];case 12:e=n,n=i,r=void 0;case 15:u.next=6;break;case 17:u.next=22;break;case 19:u.prev=19,u.t0=u.catch(4),a.e(u.t0);case 22:return u.prev=22,a.f(),u.finish(22);case 25:if(void 0===n){u.next=28;break}return u.next=28,[e,n,r];case 28:case"end":return u.stop()}}),h,null,[[4,19,22,25]])}function B(t,e){var n,r,a,o;return g().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:n=t[Symbol.iterator](),r=e[Symbol.iterator]();case 2:if(a=n.next(),o=r.next(),!a.done||!o.done){i.next=7;break}return i.abrupt("return");case 7:if(!a.done&&!o.done){i.next=9;break}throw new Error("zip: one of the iterators is done");case 9:return i.next=11,[a.value,o.value];case 11:i.next=2;break;case 13:case"end":return i.stop()}}),p)}function z(t){if(!c(t).attr("coords")&&t.children){var e=c(t).children().toArray();if(0!==e.length){var n,r=y(e);try{for(r.s();!(n=r.n()).done;)z(n.value)}catch(t){r.e(t)}finally{r.f()}var a,o=[],i=y(e);try{for(i.s();!(a=i.n()).done;){var u=a.value;c(u).attr("coords")&&o.push(c(u).attr("coords").split(",").map(parseFloat))}}catch(t){i.e(t)}finally{i.f()}var l=function(t){var e,n=1/0,r=-1/0,a=-1/0,o=1/0,i=y(t);try{for(i.s();!(e=i.n()).done;){var u=d(e.value,4),l=u[0],c=u[1],s=u[2],f=u[3];n=Math.min(n,l),r=Math.max(r,c),a=Math.max(a,s),o=Math.min(o,f)}}catch(t){i.e(t)}finally{i.f()}return[n,r,a,o]}(o);Math.abs(l[0])!=1/0&&c(t).attr("coords",l.join(","))}}}null==A||A.registerPlugin("textSelection",T);var M=function(){return S((function t(e,n,r,a){k(this,t),this.x=e,this.y=n,this.width=r,this.height=a}),[{key:"right",get:function(){return this.x+this.width}},{key:"bottom",get:function(){return this.y+this.height}},{key:"top",get:function(){return this.y}},{key:"left",get:function(){return this.x}}])}()},4160:function(t,e,n){n.d(e,{$x:function(){return v},EF:function(){return s},ND:function(){return y},m0:function(){return f},YH:function(){return p}}),n(2675),n(9463),n(6412),n(2259),n(8125),n(8706),n(3418),n(3792),n(2062),n(4490),n(4782),n(2010),n(4731),n(479),n(875),n(6099),n(3362),n(7495),n(8781),n(7764),n(1761),n(3500),n(2953);var r=[],a={},o={},i={};[["Serbian","српски језик","sr","srp","srp"],["Romanian, Moldavian, Moldovan","Română","ro","ron","rum"],["Sichuan Yi, Nuosu","ꆈꌠ꒿ Nuosuhxop","ii","iii","iii"],["Tahitian","Reo Tahiti","ty","tah","tah"],["Tagalog","Wikang Tagalog","tl","tgl","tgl"],["Yiddish","ייִדיש","yi","yid","yid"],["Akan","Akan","ak","aka","aka"],["Malay","Bahasa Melayu, بهاس ملايو","ms","msa","may"],["Arabic","العربية","ar","ara","ara"],["Norwegian","Norsk","no","nor","nor"],["Ojibwa","ᐊᓂᔑᓈᐯᒧᐎᓐ","oj","oji","oji"],["Fulah","Fulfulde, Pulaar, Pular","ff","ful","ful"],["Persian","فارسی","fa","fas","per"],["Albanian","Shqip","sq","sqi","alb"],["Aymara","aymar aru","ay","aym","aym"],["Azerbaijani","azərbaycan dili","az","aze","aze"],["Chinese","中文 (Zhōngwén), 汉语, 漢語","zh","zho","chi"],["Cree","ᓀᐦᐃᔭᐍᐏᐣ","cr","cre","cre"],["Estonian","eesti, eesti keel","et","est","est"],["Guaraní","Avañe'ẽ","gn","grn","grn"],["Inupiaq","Iñupiaq, Iñupiatun","ik","ipk","ipk"],["Inuktitut","ᐃᓄᒃᑎᑐᑦ","iu","iku","iku"],["Kanuri","Kanuri","kr","kau","kau"],["Komi","коми кыв","kv","kom","kom"],["Kongo","Kikongo","kg","kon","kon"],["Kurdish","Kurdî, أۇزبېك","ku","kur","kur"],["Latvian","latviešu valoda","lv","lav","lav"],["Malagasy","fiteny malagasy","mg","mlg","mlg"],["Mongolian","Монгол хэл","mn","mon","mon"],["Oromo","Afaan Oromoo","om","orm","orm"],["Pashto, Pushto","پښتو","ps","pus","pus"],["Quechua","Runa Simi, Kichwa","qu","que","que"],["Sardinian","sardu","sc","srd","srd"],["Swahili","Kiswahili","sw","swa","swa"],["Uzbek","Oʻzbek, Ўзбек, ","uz","uzb","uzb"],["Zhuang, Chuang","Saɯ cueŋƅ, Saw cuengh","za","zha","zha"],["Bislama","Bislama","bi","bis","bis"],["Norwegian Bokmål","Norsk Bokmål","nb","nob","nob"],["Norwegian Nynorsk","Norsk Nynorsk","nn","nno","nno"],["Indonesian","Bahasa Indonesia","id","ind","ind"],["Twi","Twi","tw","twi","twi"],["Esperanto","Esperanto","eo","epo","epo"],["Interlingua","Interlingua","ia","ina","ina"],["Interlingue","Originally called Occidental; then Interlingue after WWII","ie","ile","ile"],["Ido","Ido","io","ido","ido"],["Volapük","Volapük","vo","vol","vol"],["Bihari languages","भोजपुरी","bh","bih","bih"],["Hebrew (modern)","עברית","he","heb","heb"],["Sanskrit","संस्कृतम्","sa","san","san"],["Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian","ѩзыкъ словѣньскъ","cu","chu","chu"],["Pali","पाऴि","pi","pli","pli"],["Avestan","avesta","ae","ave","ave"],["Latin","latine, lingua latina","la","lat","lat"],["Armenian","Հայերեն","hy","hye","arm"],["Swati","SiSwati","ss","ssw","ssw"],["Tibetan","བོད་ཡིག","bo","bod","tib"],["South Ndebele","isiNdebele","nr","nbl","nbl"],["Slovene","Slovenski Jezik, Slovenščina","sl","slv","slv"],["Oriya","ଓଡ଼ିଆ","or","ori","ori"],["North Ndebele","isiNdebele","nd","nde","nde"],["Nauru","Dorerin Naoero","na","nau","nau"],["Maori","te reo Māori","mi","mri","mao"],["Marathi","मराठी","mr","mar","mar"],["Luba-Katanga","Kiluba","lu","lub","lub"],["Rundi","Ikirundi","rn","run","run"],["Central Khmer","ខ្មែរ, ខេមរភាសា, ភាសាខ្មែរ","km","khm","khm"],["Western Frisian","Frysk","fy","fry","fry"],["Bengali","বাংলা","bn","ben","ben"],["Avaric","авар мацӀ, магӀарул мацӀ","av","ava","ava"],["Abkhazian","аҧсуа бызшәа, аҧсшәа","ab","abk","abk"],["Afar","Afaraf","aa","aar","aar"],["Afrikaans","Afrikaans","af","afr","afr"],["Amharic","አማርኛ","am","amh","amh"],["Aragonese","aragonés","an","arg","arg"],["Assamese","অসমীয়া","as","asm","asm"],["Bambara","bamanankan","bm","bam","bam"],["Bashkir","башҡорт теле","ba","bak","bak"],["Basque","euskara, euskera","eu","eus","baq"],["Belarusian","беларуская мова","be","bel","bel"],["Bosnian","bosanski jezik","bs","bos","bos"],["Breton","brezhoneg","br","bre","bre"],["Bulgarian","български език","bg","bul","bul"],["Burmese","ဗမာစာ","my","mya","bur"],["Catalan, Valencian","català, valencià","ca","cat","cat"],["Chamorro","Chamoru","ch","cha","cha"],["Chechen","нохчийн мотт","ce","che","che"],["Chichewa, Chewa, Nyanja","chiCheŵa, chinyanja","ny","nya","nya"],["Chuvash","чӑваш чӗлхи","cv","chv","chv"],["Cornish","Kernewek","kw","cor","cor"],["Corsican","corsu, lingua corsa","co","cos","cos"],["Croatian","hrvatski jezik","hr","hrv","hrv"],["Czech","čeština, český jazyk","cs","ces","cze"],["Danish","dansk","da","dan","dan"],["Divehi, Dhivehi, Maldivian","ދިވެހި","dv","div","div"],["Dutch, Flemish","Nederlands, Vlaams","nl","nld","dut"],["Dzongkha","རྫོང་ཁ","dz","dzo","dzo"],["English","English","en","eng","eng"],["Ewe","Eʋegbe","ee","ewe","ewe"],["Faroese","føroyskt","fo","fao","fao"],["Fijian","vosa Vakaviti","fj","fij","fij"],["Finnish","suomi, suomen kieli","fi","fin","fin"],["French","français, langue française","fr","fra","fre"],["Galician","Galego","gl","glg","glg"],["Georgian","ქართული","ka","kat","geo"],["German","Deutsch","de","deu","ger"],["Greek (modern)","ελληνικά","el","ell","gre"],["Gujarati","ગુજરાતી","gu","guj","guj"],["Haitian, Haitian Creole","Kreyòl ayisyen","ht","hat","hat"],["Hausa","(Hausa) هَوُسَ","ha","hau","hau"],["Herero","Otjiherero","hz","her","her"],["Hindi","हिन्दी, हिंदी","hi","hin","hin"],["Hiri Motu","Hiri Motu","ho","hmo","hmo"],["Hungarian","magyar","hu","hun","hun"],["Irish","Gaeilge","ga","gle","gle"],["Igbo","Asụsụ Igbo","ig","ibo","ibo"],["Icelandic","Íslenska","is","isl","ice"],["Italian","Italiano","it","ita","ita"],["Japanese","日本語 (にほんご)","ja","jpn","jpn"],["Javanese","ꦧꦱꦗꦮ, Basa Jawa","jv","jav","jav"],["Kalaallisut, Greenlandic","kalaallisut, kalaallit oqaasii","kl","kal","kal"],["Kannada","ಕನ್ನಡ","kn","kan","kan"],["Kashmiri","कश्मीरी, كشميري","ks","kas","kas"],["Kazakh","қазақ тілі","kk","kaz","kaz"],["Kikuyu, Gikuyu","Gĩkũyũ","ki","kik","kik"],["Kinyarwanda","Ikinyarwanda","rw","kin","kin"],["Kirghiz, Kyrgyz","Кыргызча, Кыргыз тили","ky","kir","kir"],["Korean","한국어","ko","kor","kor"],["Kuanyama, Kwanyama","Kuanyama","kj","kua","kua"],["Luxembourgish, Letzeburgesch","Lëtzebuergesch","lb","ltz","ltz"],["Ganda","Luganda","lg","lug","lug"],["Limburgan, Limburger, Limburgish","Limburgs","li","lim","lim"],["Lingala","Lingála","ln","lin","lin"],["Lao","ພາສາລາວ","lo","lao","lao"],["Lithuanian","lietuvių kalba","lt","lit","lit"],["Manx","Gaelg, Gailck","gv","glv","glv"],["Macedonian","македонски јазик","mk","mkd","mac"],["Malayalam","മലയാളം","ml","mal","mal"],["Maltese","Malti","mt","mlt","mlt"],["Marshallese","Kajin M̧ajeļ","mh","mah","mah"],["Navajo, Navaho","Diné bizaad","nv","nav","nav"],["Nepali","नेपाली","ne","nep","nep"],["Ndonga","Owambo","ng","ndo","ndo"],["Occitan","occitan, lenga d'òc","oc","oci","oci"],["Ossetian, Ossetic","ирон æвзаг","os","oss","oss"],["Panjabi, Punjabi","ਪੰਜਾਬੀ","pa","pan","pan"],["Polish","język polski, polszczyzna","pl","pol","pol"],["Portuguese","Português","pt","por","por"],["Romansh","Rumantsch Grischun","rm","roh","roh"],["Russian","русский","ru","rus","rus"],["Sindhi","सिन्धी, سنڌي، سندھی","sd","snd","snd"],["Northern Sami","Davvisámegiella","se","sme","sme"],["Samoan","gagana fa'a Samoa","sm","smo","smo"],["Sango","yângâ tî sängö","sg","sag","sag"],["Gaelic, Scottish Gaelic","Gàidhlig","gd","gla","gla"],["Shona","chiShona","sn","sna","sna"],["Sinhala, Sinhalese","සිංහල","si","sin","sin"],["Slovak","Slovenčina, Slovenský Jazyk","sk","slk","slo"],["Somali","Soomaaliga, af Soomaali","so","som","som"],["Southern Sotho","Sesotho","st","sot","sot"],["Spanish, Castilian","Español","es","spa","spa"],["Sundanese","Basa Sunda","su","sun","sun"],["Swedish","Svenska","sv","swe","swe"],["Tamil","தமிழ்","ta","tam","tam"],["Telugu","తెలుగు","te","tel","tel"],["Tajik","тоҷикӣ, toçikī, تاجیکی","tg","tgk","tgk"],["Thai","ไทย","th","tha","tha"],["Tigrinya","ትግርኛ","ti","tir","tir"],["Turkmen","Türkmen, Түркмен","tk","tuk","tuk"],["Tswana","Setswana","tn","tsn","tsn"],["Tongan (Tonga Islands)","Faka Tonga","to","ton","ton"],["Turkish","Türkçe","tr","tur","tur"],["Tsonga","Xitsonga","ts","tso","tso"],["Tatar","татар теле, tatar tele","tt","tat","tat"],["Uighur, Uyghur","ئۇيغۇرچە, Uyghurche","ug","uig","uig"],["Ukrainian","Українська","uk","ukr","ukr"],["Urdu","اردو","ur","urd","urd"],["Venda","Tshivenḓa","ve","ven","ven"],["Vietnamese","Tiếng Việt","vi","vie","vie"],["Walloon","Walon","wa","wln","wln"],["Welsh","Cymraeg","cy","cym","wel"],["Wolof","Wollof","wo","wol","wol"],["Xhosa","isiXhosa","xh","xho","xho"],["Yoruba","Yorùbá","yo","yor","yor"],["Zulu","isiZulu","zu","zul","zul"]].forEach((t=>{var e={name:t[0],nativeName:t[1],iso639_1:t[2],iso639_2T:t[3],iso639_2B:t[4]};a[t[2]]=o[t[3]]=i[t[4]]=e,r.push(e)}));var u=r;function l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return c(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},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,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){u=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(u)throw o}}}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function s(t){var e=t.match(/\S+/g);return e?e.length:0}function f(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator.userAgent;return/android/i.test(t)}var h={"zh-hans":"中文 (Zhōngwén)"};function p(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t?d(t=t.toLowerCase(),["iso639_1"],e)||d(t,["iso639_2T"],e)||d(t,["iso639_2B","nativeName","name"],e):null}function d(t,e,n){var r,a=l(u);try{for(a.s();!(r=a.n()).done;){var o,i=r.value,c=l(e);try{for(c.s();!(o=c.n()).done;)if(-1!=i[o.value].split(", ").map((function(t){return t.toLowerCase()})).indexOf(t))return n?"".concat(i.nativeName.split(", ")[0]," (").concat(i.iso639_1,")"):i.iso639_1}catch(t){c.e(t)}finally{c.f()}}}catch(t){a.e(t)}finally{a.f()}return h[t]?"".concat(h[t]," (").concat(t,")"):null}function y(){try{return!!window.localStorage}catch(t){return!1}}var v=-1!=location.toString().indexOf("_debugReadAloud=true")},593:function(t,e,n){n.d(e,{bg:function(){return b}}),n(2675),n(9463),n(6412),n(2259),n(5700),n(8125),n(113),n(3418),n(3792),n(8598),n(4490),n(4782),n(9572),n(2010),n(4731),n(479),n(8130),n(875),n(6099),n(3362),n(7495),n(8781),n(7764),n(5440),n(3500),n(2953);var r=n(1669);function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,u(r.key),r)}}function i(t,e,n){return(e=u(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}var l=function(){return t=function t(e,n){var a=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),i(this,"selecting",!1),i(this,"startedInSelector",!1),i(this,"target",null),i(this,"_onSelectionChange",(function(){var t=window.getSelection();if(!a.selecting&&t.toString()){var e=r(t.anchorNode).closest(a.selector)[0];if(!e)return;a.target=e,a.selecting=!0,a.handler("started",a.target)}!a.selecting||!t.isCollapsed&&t.toString()&&r(t.anchorNode).closest(a.selector)[0]||(a.selecting=!1,a.handler("cleared",a.target))})),this.selector=e,this.handler=n},(e=[{key:"attach",value:function(){document.addEventListener("selectionchange",this._onSelectionChange)}},{key:"detach",value:function(){document.removeEventListener("selectionchange",this._onSelectionChange)}}])&&o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),c=n(1669);function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function f(){f=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),u=new _(r||[]);return a(i,"_invoke",{value:O(t,n,u)}),i}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",y="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function k(){}var x={};c(x,i,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(R([])));E&&E!==n&&r.call(E,i)&&(x=E);var j=k.prototype=b.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(a,o,i,u){var l=p(t[a],t,o);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==s(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,i,u)}),(function(t){n("throw",t,i,u)})):e.resolve(f).then((function(t){c.value=t,i(c)}),(function(t){return n("throw",t,i,u)}))}u(l.arg)}var o;a(this,"_invoke",{value:function(t,r){function a(){return new e((function(e,a){n(t,r,e,a)}))}return o=o?o.then(a,a):a()}})}function O(e,n,r){var a=d;return function(o,i){if(a===v)throw Error("Generator is already running");if(a===m){if("throw"===o)throw i;return{value:t,done:!0}}for(r.method=o,r.arg=i;;){var u=r.delegate;if(u){var l=C(u,r);if(l){if(l===g)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===d)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=v;var c=p(e,n,r);if("normal"===c.type){if(a=r.done?m:y,c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(a=m,r.method="throw",r.arg=c.arg)}}}function C(e,n){var r=n.method,a=e.iterator[r];if(a===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,C(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=p(a,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var i=o.arg;return i?i.done?(n[e.resultName]=i.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function R(e){if(e||""===e){var n=e[i];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function n(){for(;++a<e.length;)if(r.call(e,a))return n.value=e[a],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(s(e)+" is not iterable")}return w.prototype=k,a(j,"constructor",{value:k,configurable:!0}),a(k,"constructor",{value:w,configurable:!0}),w.displayName=c(k,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,k):(t.__proto__=k,c(t,l,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},L(P.prototype),c(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,n,r,a,o){void 0===o&&(o=Promise);var i=new P(h(t,n,r,a),o);return e.isGeneratorFunction(n)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(j),c(j,l,"Generator"),c(j,i,(function(){return this})),c(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=R,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function a(r,a){return u.type="throw",u.arg=e,n.next=r,a&&(n.method="next",n.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(t,e){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"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:R(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}var h=f().mark(w),p=f().mark(k);function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return y(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},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,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){u=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(u)throw o}}}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function v(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,g(r.key),r)}}function m(t,e,n){return(e=g(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function g(t){var e=function(t,e){if("object"!=s(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==s(e)?e:e+""}var b=function(){return t=function t(e,n,r,a){var o=this,i=r.selectionElement;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),m(this,"options",{maxProtectedWords:200}),m(this,"_onSelectionChange",(function(t,e){if("started"===t)o.textSelectingMode(e);else{if("cleared"!==t)throw new Error("Unknown type ".concat(t));o.defaultMode(e)}})),m(this,"_limitSelection",(function(){var t=window.getSelection();if(t.rangeCount){var e=t.getRangeAt(0),n=!!e.startContainer.parentElement.closest(".BRcontainer"),r=!!e.endContainer.parentElement.closest(".BRcontainer");if(n||r)if(n&&r){var a=function(t,e){var n,r=0,a=d(t);try{for(a.s();!(n=a.n()).done;){var o=n.value;if(r==e)return o;r++}}catch(t){a.e(t)}finally{a.f()}}(w(k(e.startContainer,e.endContainer),(function(t){var e;return null===(e=t.classList)||void 0===e?void 0:e.contains(o.selectionElement[0].replace(".",""))})),o.options.maxProtectedWords-1);if(a&&e.endContainer.parentNode!=a){var i=document.createRange();i.setStart(e.startContainer,e.startOffset),i.setEnd(a.firstChild,a.textContent.length),t.removeAllRanges(),t.addRange(i)}}else t.removeAllRanges()}})),this.layer=e,this.br=n,this.selectionElement=i,this.selectionObserver=new l(this.layer,this._onSelectionChange),this.options.maxProtectedWords=a||200},e=[{key:"init",value:function(){var t=this;this.attach(),new l(this.layer,(function(e){var n;"started"==e&&(null===(n=t.br.plugins.archiveAnalytics)||void 0===n||n.sendEvent("BookReader","SelectStart"),t.br.refs.$br.find(".BRpagecontainer--hasSelection").removeClass("BRpagecontainer--hasSelection"),c(window.getSelection().anchorNode).closest(".BRpagecontainer").addClass("BRpagecontainer--hasSelection"))})).attach()}},{key:"attach",value:function(){var t=this;this.selectionObserver.attach(),this.br.protected&&(document.addEventListener("selectionchange",this._limitSelection),c(document.body).on("contextmenu dragstart copy",(function(e){var n=document.getSelection();if(null!=n&&n.toString()&&c(t.layer).toArray().some((function(t){return n.containsNode(t,!0)})))return e.preventDefault(),!1})))}},{key:"detach",value:function(){this.selectionObserver.detach(),this.br.protected&&document.removeEventListener("selectionchange",this._limitSelection)}},{key:"interceptCopy",value:function(t){t[0].addEventListener("copy",(function(t){var e=document.getSelection();t.clipboardData.setData("text/plain",e.toString()),t.preventDefault()}))}},{key:"stopPageFlip",value:function(t){var e=this,n=t.find(this.layer);n.length&&(n.each((function(t,n){return e.defaultMode(n)})),this.br.protected||this.interceptCopy(t))}},{key:"defaultMode",value:function(t){var e=this,n=c(t).closest(".BRpagecontainer");t.style.pointerEvents="none",n.find("img").css("pointer-events","auto"),c(t).off(".textSelectPluginHandler");var r=this.mouseIsDown,a=this.mouseIsDown;r&&(t.style.pointerEvents="auto"),c(t).on("mousedown.textSelectPluginHandler",(function(t){e.mouseIsDown=!0,c(t.target).is(e.selectionElement.join(", "))&&t.stopPropagation()})),c(t).on("mouseup.textSelectPluginHandler",(function(n){e.mouseIsDown=!1,t.style.pointerEvents="none",a&&(a=!1,n.stopPropagation())}))}},{key:"textSelectingMode",value:function(t){var e=this,n=c(t).closest(".BRpagecontainer");t.style.pointerEvents="all",n.find("img").css("pointer-events","none"),c(t).off(".textSelectPluginHandler"),c(t).on("mousedown.textSelectPluginHandler",(function(t){e.mouseIsDown=!0,t.stopPropagation()})),c(t).on("mouseup.textSelectPluginHandler",(function(t){e.mouseIsDown=!1,t.stopPropagation()}))}}],e&&v(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function w(t,e){var n,r,a;return f().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:n=d(t),o.prev=1,n.s();case 3:if((r=n.n()).done){o.next=10;break}if(a=r.value,!e(a)){o.next=8;break}return o.next=8,a;case 8:o.next=3;break;case 10:o.next=15;break;case 12:o.prev=12,o.t0=o.catch(1),n.e(o.t0);case 15:return o.prev=15,n.f(),o.finish(15);case 18:case"end":return o.stop()}}),h,null,[[1,12,15,18]])}function k(t,e){var n,r;return f().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return r=function(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=a.children,i=void 0===o||o,u=a.parents,l=void 0===u||u,c=a.siblings,s=void 0===c||c;return f().mark((function a(){var o;return f().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(t!==e){a.next=5;break}return n=!0,a.next=4,t;case 4:return a.abrupt("return");case 5:return a.next=7,t;case 7:if(!i||!t.firstChild){a.next=11;break}return a.delegateYield(r(t.firstChild,{children:!0,parents:!1,siblings:!0}),"t0",9);case 9:if(!n){a.next=11;break}return a.abrupt("return");case 11:if(!s){a.next=20;break}o=t.nextSibling;case 13:if(!o){a.next=20;break}return a.delegateYield(r(o,{children:!0,parents:!1,siblings:!1}),"t1",15);case 15:if(!n){a.next=17;break}return a.abrupt("return");case 17:o=o.nextSibling,a.next=13;break;case 20:if(!l||!t.parentNode){a.next=24;break}return a.delegateYield(r(t.parentNode,{children:!1,parents:!0,siblings:!0}),"t2",22);case 22:if(!n){a.next=24;break}return a.abrupt("return");case 24:case"end":return a.stop()}}),a)}))()},n=!1,a.delegateYield(r(t),"t0",3);case 3:case"end":return a.stop()}}),p)}},4565:function(t,e,n){function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function o(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,"string");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}n.d(e,{l:function(){return i}}),n(2675),n(9463),n(2259),n(5700),n(3792),n(9572),n(8130),n(6099),n(7764),n(2953);var i=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maxSize=e,this.entries=[]},(e=[{key:"add",value:function(t){this.entries.length>=this.maxSize&&this.entries.shift(),this.entries.push(t)}}])&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},9073:function(t,e,n){function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function a(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o;return null==t?void 0:t.replace(/\{\{([^}]*?)\}\}/g,(function(t,o){if(!o)return t;var i,u=function(t){if(Array.isArray(t))return t}(i=o.split("|").map((function(t){return t.trim()})))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(i)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(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.")}(),l=u[0],c=u.slice(1);if(!(l in n)&&!(l in e))return t;var s=l in n?n[l]:l in e?e[l]:null;return c.map((function(t){return a[t]})).reduce((function(t,e){return e(t)}),s&&s.toString())}))}n.d(e,{g:function(){return a}}),n(2675),n(9463),n(2259),n(3418),n(3792),n(2062),n(2712),n(4782),n(2010),n(6099),n(7495),n(8781),n(7764),n(5440),n(2762),n(2953);var o={urlencode:encodeURIComponent}}},function(t){t(t.s=296)}]);
3
3
  //# sourceMappingURL=plugin.text_selection.js.map