@internetarchive/bookreader 5.0.0-97 → 5.0.0-98
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.
- package/BookReader/BookReader.css +8 -9
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/bergamot-translator-worker.js +1 -1
- package/BookReader/plugins/plugin.text_selection.js +1 -1
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.translate.js +1 -1
- package/BookReader/plugins/plugin.translate.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/BookReader/silence.mp3 +0 -0
- package/package.json +2 -2
- package/src/BookReader/options.js +12 -8
- package/src/BookReader.js +45 -1
- package/src/assets/silence.mp3 +0 -0
- package/src/css/_BRsearch.scss +1 -0
- package/src/css/_TextSelection.scss +7 -9
- package/src/plugins/plugin.text_selection.js +9 -0
- package/src/plugins/translate/TranslationManager.js +6 -3
- package/src/plugins/translate/plugin.translate.js +133 -58
- package/src/plugins/tts/AbstractTTSEngine.js +3 -4
- package/src/plugins/tts/PageChunk.js +28 -9
- package/src/plugins/tts/WebTTSEngine.js +5 -7
- package/src/plugins/tts/plugin.tts.js +40 -4
- package/src/plugins/tts/utils.js +15 -5
|
@@ -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,r){var n=r(350).PROPER,o=r(9039),i=r(7452);t.exports=function(t){return o((function(){return!!i[t]()||"
"!=="
"[t]()||n&&i[t].name!==t}))}},2762:function(t,e,r){var n=r(6518),o=r(3802).trim;n({target:"String",proto:!0,forced:r(706)("trim")},{trim:function(){return o(this)}})},1041:function(t,e,r){function n(t){return n="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},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}r.d(e,{S:function(){return a}}),r(2675),r(9463),r(2259),r(5700),r(3792),r(9572),r(8130),r(9085),r(6099),r(7764),r(2953);var a=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){}}])&&o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},2763:function(t,e,r){r(2675),r(9463),r(6412),r(2259),r(5700),r(8125),r(8706),r(113),r(3418),r(3792),r(8598),r(2062),r(4490),r(4782),r(6910),r(9572),r(2010),r(4731),r(6033),r(479),r(8130),r(9085),r(875),r(6099),r(8459),r(3362),r(825),r(7495),r(8781),r(9449),r(7764),r(2762),r(3500),r(2953);var n=r(4907),o=r(1669);function i(t){return i="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},i(t)}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function c(t,e,r){return(e=u(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:e+""}var l=function(){return t=function t(e,r){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),c(this,"selecting",!1),c(this,"startedInSelector",!1),c(this,"target",null),c(this,"_onSelectionChange",(function(){var t=window.getSelection();if(!n.selecting&&t.toString()){var e=o(t.anchorNode).closest(n.selector)[0];if(!e)return;n.target=e,n.selecting=!0,n.handler("started",n.target)}!n.selecting||!t.isCollapsed&&t.toString()&&o(t.anchorNode).closest(n.selector)[0]||(n.selecting=!1,n.handler("cleared",n.target))})),this.selector=e,this.handler=r},(e=[{key:"attach",value:function(){document.addEventListener("selectionchange",this._onSelectionChange)}},{key:"detach",value:function(){document.removeEventListener("selectionchange",this._onSelectionChange)}}])&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),s=r(1041),f=r(9073),p=r(4565),h=r(1669);function d(t){return d="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},d(t)}var y=E().mark(W),v=E().mark(G),m=E().mark(H),g=E().mark(U),b=E().mark($);function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return c}}(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 r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=S(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function S(t,e){if(t){if("string"==typeof t)return k(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(t,e):void 0}}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function E(){E=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:R(t,r,c)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var p="suspendedStart",h="suspendedYield",y="executing",v="completed",m={};function g(){}function b(){}function w(){}var x={};l(x,a,(function(){return this}));var S=Object.getPrototypeOf,k=S&&S(S(_([])));k&&k!==r&&n.call(k,a)&&(x=k);var P=w.prototype=g.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==d(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(s).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function R(e,r,n){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=O(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=f(e,r,n);if("normal"===l.type){if(o=n.done?v:h,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function O(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,O(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function L(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 A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function _(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(d(e)+" is not iterable")}return b.prototype=w,o(P,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,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,w):(t.__proto__=w,l(t,u,"GeneratorFunction")),t.prototype=Object.create(P),t},e.awrap=function(t){return{__await:t}},j(C.prototype),l(C.prototype,c,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new C(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(P),l(P,u,"Generator"),l(P,a,(function(){return this})),l(P,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=_,T.prototype={constructor:T,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(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=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 r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(u&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},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 r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:_(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function P(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function j(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){P(i,n,o,a,c,"next",t)}function c(t){P(i,n,o,a,c,"throw",t)}a(void 0)}))}}function C(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function R(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,I(n.key),n)}}function O(t,e,r){return e&&R(t.prototype,e),r&&R(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function L(t,e,r){return e=T(e),function(t,e){if(e&&("object"==d(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,A()?Reflect.construct(e,r||[],T(t).constructor):e.apply(t,r))}function A(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(A=function(){return!!t})()}function T(t){return T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},T(t)}function _(t,e){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_(t,e)}function B(t,e,r){return(e=I(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function I(t){var e=function(t,e){if("object"!=d(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==d(e)?e:e+""}var D=window.BookReader,N=function(t){function e(t){var r;return C(this,e),B(r=L(this,e,[t]),"options",{enabled:!0,fullDjvuXmlUrl:null,singlePageDjvuXmlUrl:null,jsonp:!1,maxProtectedWords:200}),B(r,"djvuPagesPromise",null),B(r,"pageTextCache",new p.l),B(r,"maxWordRendered",2500),B(r,"_limitSelection",(function(){var t=window.getSelection();if(t.rangeCount){var e=t.getRangeAt(0),n=!!e.startContainer.parentElement.closest(".BRcontainer"),o=!!e.endContainer.parentElement.closest(".BRcontainer");if(n||o)if(n&&o){var i=function(t,e){var r,n=0,o=x(t);try{for(o.s();!(r=o.n()).done;){var i=r.value;if(n==e)return i;n++}}catch(t){o.e(t)}finally{o.f()}}(W($(e.startContainer,e.endContainer),(function(t){var e;return null===(e=t.classList)||void 0===e?void 0:e.contains("BRwordElement")})),r.options.maxProtectedWords-1);if(i&&e.endContainer.parentNode!=i){var a=document.createRange();a.setStart(e.startContainer,e.startOffset),a.setEnd(i.firstChild,i.textContent.length),t.removeAllRanges(),t.addRange(a)}}else t.removeAllRanges()}})),B(r,"_onSelectionChange",(function(t,e){if("started"===t)r.textSelectingMode(e);else{if("cleared"!==t)throw new Error("Unknown type ".concat(t));r.defaultMode(e)}})),r.rtl="rl"===r.br.pageProgression,r.selectionObserver=new l(".BRtextLayer",r._onSelectionChange),r}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&&_(t,e)}(e,t),O(e,[{key:"init",value:function(){var t=this;this.options.enabled&&(this.loadData(),this.selectionObserver.attach(),new l(".BRtextLayer",(function(e){var r;"started"==e&&(null===(r=t.br.plugins.archiveAnalytics)||void 0===r||r.sendEvent("BookReader","SelectStart"),t.br.refs.$br.find(".BRpagecontainer--hasSelection").removeClass("BRpagecontainer--hasSelection"),h(window.getSelection().anchorNode).closest(".BRpagecontainer").addClass("BRpagecontainer--hasSelection"))})).attach(),this.br.protected&&(document.addEventListener("selectionchange",this._limitSelection),h(document.body).on("contextmenu dragstart copy",(function(t){var e=document.getSelection();if(null!=e&&e.toString()&&h(".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=h.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=h.parseXML(t);return e&&h(e).find("OBJECT")}catch(t){return}})))}},{key:"getPageText",value:(o=j(E().mark((function t(e){var r,n,o,i,a;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.options.singlePageDjvuXmlUrl){t.next=19;break}if(!(r=this.pageTextCache.entries.find((function(t){return t.index==e})))){t.next=4;break}return t.abrupt("return",r.response);case 4:return t.next=6,h.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 n=t.sent,t.prev=7,o=h.parseXML(n),i=o&&h(o).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(!(a=t.sent)){t.next=24;break}return t.abrupt("return",a[e]);case 24:case"end":return t.stop()}}),t,this,[[7,14]])}))),function(t){return o.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,r=h(t).closest(".BRpagecontainer");t.style.pointerEvents="none",r.find("img").css("pointer-events","auto"),h(t).off(".textSelectPluginHandler");var n=this.mouseIsDown,o=this.mouseIsDown;n&&(t.style.pointerEvents="auto"),h(t).on("mousedown.textSelectPluginHandler",(function(t){e.mouseIsDown=!0,h(t.target).is(".BRwordElement, .BRspace")&&t.stopPropagation()})),h(t).on("mouseup.textSelectPluginHandler",(function(r){e.mouseIsDown=!1,t.style.pointerEvents="none",o&&(o=!1,r.stopPropagation())}))}},{key:"textSelectingMode",value:function(t){var e=this,r=h(t).closest(".BRpagecontainer");t.style.pointerEvents="all",r.find("img").css("pointer-events","none"),h(t).off(".textSelectPluginHandler"),h(t).on("mousedown.textSelectPluginHandler",(function(t){e.mouseIsDown=!0,t.stopPropagation()})),h(t).on("mouseup.textSelectPluginHandler",(function(t){e.mouseIsDown=!1,t.stopPropagation()}))}},{key:"stopPageFlip",value:function(t){var e=this,r=t.find(".BRtextLayer");r.length&&(r.each((function(t,r){return e.defaultMode(r)})),this.br.protected||this.interceptCopy(t))}},{key:"createTextLayer",value:(r=j(E().mark((function t(e){var r,o,i,a,c,u,l,s,f,p,d,y,v,m,g,b,S,k,P,j,C,R,O,L,A=this;return E().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.page.index,!(o=e.$container).find(".BRtextLayer").length){t.next=5;break}return t.abrupt("return");case 5:return t.next=7,this.getPageText(r);case 7:if(i=t.sent){t.next=10;break}return t.abrupt("return");case 10:if(X(i),!((a=h(i).find("WORD").length)>this.maxWordRendered)){t.next=15;break}return console.log("Page ".concat(r," has too many words (").concat(a," > ").concat(this.maxWordRendered,"). Not rendering text layer.")),t.abrupt("return");case 15:return c=(0,n.Ql)(e.page,"BRtextLayer"),t.next=18,Promise.resolve();case 18:u=parseFloat(e.$container[0].style.width)/e.page.width,l=parseFloat(e.$container[0].style.height)/e.page.height,c.style.transform="scale(".concat(u,", ").concat(l,")"),c.setAttribute("dir",this.rtl?"rtl":"ltr"),s=h(i).find("PARAGRAPH[coords]").toArray(),f=s.map((function(t){var e=A.renderParagraph(t);return c.appendChild(e),e})),p=F(c,".BRparagraphElement"),d=0,y=x(U(s,f));try{for(y.s();!(v=y.n()).done;)m=w(v.value,2),g=m[0],b=m[1],S=h(g).attr("coords").split(",").map(parseFloat),k=p.get(b),P=w(S,4),j=P[0],C=P[2],R=P[3],O=this.rtl?k.right-C:j-k.left,L=R-(k.top+d),b.style[this.rtl?"marginRight":"marginLeft"]="".concat(O,"px"),b.style.marginTop="".concat(L,"px"),d+=L,c.appendChild(b)}catch(t){y.e(t)}finally{y.f()}o.append(c),this.stopPageFlip(o),this.br.trigger("textLayerRendered",{pageIndex:r,pageContainer:e});case 31:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"renderParagraph",value:function(t){var e=document.createElement("p");e.classList.add("BRparagraphElement");var r=w(h(t).attr("coords").split(",").map(parseFloat),4),n=r[0],o=r[1],i=r[2],a=r[3],c=[],u=h(t).find("LINE[coords]").toArray();if(!u.length)return e;var l,s=x(H(G(u,M)));try{for(s.s();!(l=s.n()).done;){var f=w(l.value,3),p=f[0],d=f[1],y=f[2],v=d.ocrElement==u[u.length-1],m=document.createElement("span");m.classList.add("BRlineElement");var g,b=x(d.words.entries());try{for(b.s();!(g=b.n()).done;){var E=w(g.value,2),P=E[0],j=E[1],C=w(h(j).attr("coords").split(",").map(parseFloat),4),R=C[1],O=C[2],L=C[3],A=R-L;if(c.push(A),0==P&&null!=p&&p.lastWord.textContent.trim().endsWith("-")){var T=w(h((y||p).firstWord).attr("coords").split(",").map(parseFloat),3)[0];h(j).attr("coords","".concat(T,",").concat(R,",").concat(O,",").concat(L))}var _=document.createElement("span");if(_.setAttribute("class","BRwordElement"),_.textContent=j.textContent.trim(),P>0){var B=document.createElement("span");B.classList.add("BRspace"),B.textContent=" ",m.append(B),m.appendChild(document.createTextNode(" "))}m.appendChild(_)}}catch(t){b.e(t)}finally{b.f()}var I=d.lastWord.textContent.trim().endsWith("-"),D=m.children[m.children.length-1];I&&!v&&(D.textContent=D.textContent.trim().slice(0,-1),D.classList.add("BRwordElement--hyphen")),e.appendChild(m),v||I||e.appendChild(document.createTextNode(" "))}}catch(t){s.e(t)}finally{s.f()}c.sort((function(t,e){return t-e}));var N=c[Math.floor(.85*c.length)]+4;e.style.left="".concat(n,"px"),e.style.top="".concat(a,"px"),e.style.width="".concat(i-n,"px"),e.style.height="".concat(o-a,"px"),e.style.fontSize="".concat(N,"px");var W,X=F(e,".BRwordElement"),Y=x(U(h(t).find("WORD").toArray(),e.querySelectorAll(".BRwordElement")));try{for(Y.s();!(W=Y.n()).done;){var $=w(W.value,2),q=$[0],z=$[1],J=X.get(z),Q=w(h(q).attr("coords").split(",").map(parseFloat),3),K=Q[0],V=Q[2]-K;q.textContent.endsWith(" ")&&(V=V*(q.textContent.length-1)/q.textContent.length);var Z=V-J.width;z.style.letterSpacing="".concat(Z/(q.textContent.length-1),"px")}}catch(t){Y.e(t)}finally{Y.f()}X=F(e,".BRwordElement");var tt,et,rt=F(e,".BRspace"),nt=h(t).find("LINE[coords]").toArray(),ot=Array.from(e.querySelectorAll(".BRlineElement")),it=a,at=x(U(nt,ot));try{for(at.s();!(tt=at.n()).done;){var ct,ut=w(tt.value,2),lt=ut[0],st=ut[1],ft=h(lt).find("WORD").toArray(),pt=this.rtl?i:n,ht=x(U(ft,st.querySelectorAll(".BRwordElement")));try{for(ht.s();!(ct=ht.n()).done;){var dt=w(ct.value,2),yt=dt[0],vt=dt[1],mt=X.get(vt),gt=w(h(yt).attr("coords").split(",").map(parseFloat),3),bt=gt[0],wt=gt[2],xt=this.rtl?-(wt-pt):bt-pt;if(vt.previousElementSibling){var St=vt.previousElementSibling;St.style.letterSpacing="".concat(xt-rt.get(St).width,"px")}else vt.style[this.rtl?"paddingRight":"paddingLeft"]="".concat(xt,"px");this.rtl?pt-=xt+mt.width:pt+=xt+mt.width}}catch(t){ht.e(t)}finally{ht.f()}var kt=Math.min.apply(Math,function(t){if(Array.isArray(t))return k(t)}(et=ft.map((function(t){return parseFloat(h(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.")}())-it;st.previousElementSibling&&(st.previousElementSibling.style.lineHeight="".concat(kt,"px"),it+=kt)}}catch(t){at.e(t)}finally{at.f()}return ot[ot.length-1].style.lineHeight="".concat(o-it,"px"),e.appendChild(document.createElement("br")),e}}]);var r,o}(s.S);function F(t,e){var r={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 n=new Map(Array.from(t.querySelectorAll(e)).map((function(t){var e=t.getBoundingClientRect();return[t,new Y(e.left+window.scrollX,e.top+window.scrollY,e.width,e.height)]})));return document.body.removeChild(t),Object.assign(t.style,r),n}function M(t){var e=h(t).find("WORD").toArray();return{ocrElement:t,words:e,firstWord:e[0],lastWord:e[e.length-1]}}function W(t,e){var r,n,o;return E().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:r=x(t),i.prev=1,r.s();case 3:if((n=r.n()).done){i.next=10;break}if(o=n.value,!e(o)){i.next=8;break}return i.next=8,o;case 8:i.next=3;break;case 10:i.next=15;break;case 12:i.prev=12,i.t0=i.catch(1),r.e(i.t0);case 15:return i.prev=15,r.f(),i.finish(15);case 18:case"end":return i.stop()}}),y,null,[[1,12,15,18]])}function G(t,e){var r,n,o;return E().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:r=x(t),i.prev=1,r.s();case 3:if((n=r.n()).done){i.next=9;break}return o=n.value,i.next=7,e(o);case 7:i.next=3;break;case 9:i.next=14;break;case 11:i.prev=11,i.t0=i.catch(1),r.e(i.t0);case 14:return i.prev=14,r.f(),i.finish(14);case 17:case"end":return i.stop()}}),v,null,[[1,11,14,17]])}function H(t){var e,r,n,o,i,a;return E().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:e=void 0,r=void 0,n=void 0,o=x(t),c.prev=4,o.s();case 6:if((i=o.n()).done){c.next=17;break}if(a=i.value,void 0===r){c.next=12;break}return n=a,c.next=12,[e,r,n];case 12:e=r,r=a,n=void 0;case 15:c.next=6;break;case 17:c.next=22;break;case 19:c.prev=19,c.t0=c.catch(4),o.e(c.t0);case 22:return c.prev=22,o.f(),c.finish(22);case 25:if(void 0===r){c.next=28;break}return c.next=28,[e,r,n];case 28:case"end":return c.stop()}}),m,null,[[4,19,22,25]])}function U(t,e){var r,n,o,i;return E().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:r=t[Symbol.iterator](),n=e[Symbol.iterator]();case 2:if(o=r.next(),i=n.next(),!o.done||!i.done){a.next=7;break}return a.abrupt("return");case 7:if(!o.done&&!i.done){a.next=9;break}throw new Error("zip: one of the iterators is done");case 9:return a.next=11,[o.value,i.value];case 11:a.next=2;break;case 13:case"end":return a.stop()}}),g)}function X(t){if(!h(t).attr("coords")&&t.children){var e=h(t).children().toArray();if(0!==e.length){var r,n=x(e);try{for(n.s();!(r=n.n()).done;)X(r.value)}catch(t){n.e(t)}finally{n.f()}var o,i=[],a=x(e);try{for(a.s();!(o=a.n()).done;){var c=o.value;h(c).attr("coords")&&i.push(h(c).attr("coords").split(",").map(parseFloat))}}catch(t){a.e(t)}finally{a.f()}var u=function(t){var e,r=1/0,n=-1/0,o=-1/0,i=1/0,a=x(t);try{for(a.s();!(e=a.n()).done;){var c=w(e.value,4),u=c[0],l=c[1],s=c[2],f=c[3];r=Math.min(r,u),n=Math.max(n,l),o=Math.max(o,s),i=Math.min(i,f)}}catch(t){a.e(t)}finally{a.f()}return[r,n,o,i]}(i);Math.abs(u[0])!=1/0&&h(t).attr("coords",u.join(","))}}}null==D||D.registerPlugin("textSelection",N);var Y=function(){return O((function t(e,r,n,o){C(this,t),this.x=e,this.y=r,this.width=n,this.height=o}),[{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 $(t,e){var r,n;return E().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return n=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.children,a=void 0===i||i,c=o.parents,u=void 0===c||c,l=o.siblings,s=void 0===l||l;return E().mark((function o(){var i;return E().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(t!==e){o.next=5;break}return r=!0,o.next=4,t;case 4:return o.abrupt("return");case 5:return o.next=7,t;case 7:if(!a||!t.firstChild){o.next=11;break}return o.delegateYield(n(t.firstChild,{children:!0,parents:!1,siblings:!0}),"t0",9);case 9:if(!r){o.next=11;break}return o.abrupt("return");case 11:if(!s){o.next=20;break}i=t.nextSibling;case 13:if(!i){o.next=20;break}return o.delegateYield(n(i,{children:!0,parents:!1,siblings:!1}),"t1",15);case 15:if(!r){o.next=17;break}return o.abrupt("return");case 17:i=i.nextSibling,o.next=13;break;case 20:if(!u||!t.parentNode){o.next=24;break}return o.delegateYield(n(t.parentNode,{children:!1,parents:!0,siblings:!0}),"t2",22);case 22:if(!r){o.next=24;break}return o.abrupt("return");case 24:case"end":return o.stop()}}),o)}))()},r=!1,o.delegateYield(n(t),"t0",3);case 3:case"end":return o.stop()}}),b)}},4565:function(t,e,r){function n(t){return n="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},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function i(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}r.d(e,{l:function(){return a}}),r(2675),r(9463),r(2259),r(5700),r(3792),r(9572),r(8130),r(6099),r(7764),r(2953);var a=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)}}])&&o(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},9073:function(t,e,r){function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function o(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i;return null==t?void 0:t.replace(/\{\{([^}]*?)\}\}/g,(function(t,i){if(!i)return t;var a,c=function(t){if(Array.isArray(t))return t}(a=i.split("|").map((function(t){return t.trim()})))||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(a)||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=c[0],l=c.slice(1);if(!(u in r)&&!(u in e))return t;var s=u in r?r[u]:u in e?e[u]:null;return l.map((function(t){return o[t]})).reduce((function(t,e){return e(t)}),s&&s.toString())}))}r.d(e,{g:function(){return o}}),r(2675),r(9463),r(2259),r(3418),r(3792),r(2062),r(2712),r(4782),r(2010),r(6099),r(7495),r(8781),r(7764),r(5440),r(2762),r(2953);var i={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}()},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)}]);
|
|
3
3
|
//# sourceMappingURL=plugin.text_selection.js.map
|