@internetarchive/bookreader 5.0.0-71 → 5.0.0-72

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see plugin.text_selection.js.LICENSE.txt */
2
- (self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[423],{4742:function(t,e,r){"use strict";r(6992),r(1539),r(3948),r(9826),r(9714),r(2222),r(4678),r(8674),r(1249),r(2707),r(1038),r(8783),r(7852),r(3210),r(7042),r(9601),r(1532),r(2165),r(2526),r(1817),r(9600),r(6649),r(6078),r(9653),r(2443),r(3680),r(3706),r(2703),r(489),r(4747),r(8309),r(5069),r(4916),r(2419),r(4819),r(5003);var n=r(9860),o=r(5311);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,l(n.key),n)}}function c(t,e,r){return(e=l(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t){var e=function(t,e){if("object"!==i(t)||null===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:String(e)}var u=function(){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();!n.selecting&&t.toString()&&(n.selecting=!0,n.target=o(t.anchorNode).closest(n.selector)[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}var e,r;return e=t,(r=[{key:"attach",value:function(){document.addEventListener("selectionchange",this._onSelectionChange)}},{key:"detach",value:function(){document.removeEventListener("selectionchange",this._onSelectionChange)}}])&&a(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function f(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:h;return null==t?void 0:t.replace(/\{\{([^}]*?)\}\}/g,(function(t,o){if(!o)return t;var i,a=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 s(t,e);var r=Object.prototype.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)?s(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.")}(),c=a[0],l=a.slice(1);if(!(c in r)&&!(c in e))return t;var u=c in r?r[c]:c in e?e[c]:null;return l.map((function(t){return n[t]})).reduce((function(t,e){return e(t)}),u&&u.toString())}))}r(5306),r(5827);var h={urlencode:encodeURIComponent},p=r(5311);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=j().mark(N),v=j().mark(W),g=j().mark(G);function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=w(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},m.apply(this,arguments)}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function w(t){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},w(t)}function x(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=[],l=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(t,e)||E(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 S(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=E(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 E(t,e){if(t){if("string"==typeof t)return P(t,e);var r=Object.prototype.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)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function j(){j=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.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 u(t,e,r,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype),c=new O(o||[]);return n(a,"_invoke",{value:S(t,r,c)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function h(){}function p(){}function y(){}var v={};l(v,i,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(R([])));m&&m!==e&&r.call(m,i)&&(v=m);var b=y.prototype=h.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,i,a,c){var l=s(t[n],t,i);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==d(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(l.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function S(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=s(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function P(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function R(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,n(b,"constructor",{value:y,configurable:!0}),n(y,"constructor",{value:p,configurable:!0}),p.displayName=l(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),l(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),l(b,c,"Generator"),l(b,i,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),t.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}},t.values=R,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(c&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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,f):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),f},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),k(r),f}},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;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function k(t,e,r,n,o,i,a){try{var c=t[i](a),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}function O(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){k(i,n,o,a,c,"next",t)}function c(t){k(i,n,o,a,c,"throw",t)}a(void 0)}))}}function R(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(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,A(n.key),n)}}function C(t,e,r){return e&&L(t.prototype,e),r&&L(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function A(t){var e=function(t,e){if("object"!==d(t)||null===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:String(e)}var _=window.BookReader,B={enabled:!0,fullDjvuXmlUrl:null,singlePageDjvuXmlUrl:null,jsonp:!1},T=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;R(this,t),this.maxSize=e,this.entries=[]}return C(t,[{key:"add",value:function(t){this.entries.length>=this.maxSize&&this.entries.shift(),this.entries.push(t)}}]),t}(),I=function(){function t(){var e,r,n,o=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B,a=arguments.length>1?arguments[1]:void 0,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"lr";R(this,t),e=this,n=function(t,e){if("started"===t)o.textSelectingMode(e);else{if("cleared"!==t)throw new Error("Unknown type ".concat(t));o.defaultMode(e)}},(r=A(r="_onSelectionChange"))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,this.options=i,this.optionVariables=a,this.djvuPagesPromise=null,this.rtl="rl"===c,this.pageTextCache=new T,this.maxWordRendered=2500,this.selectionObserver=new u(".BRtextLayer",this._onSelectionChange)}var e,r;return C(t,[{key:"init",value:function(){this.selectionObserver.attach(),this.options.singlePageDjvuXmlUrl||(this.djvuPagesPromise=p.ajax({type:"GET",url:f(this.options.fullDjvuXmlUrl,this.optionVariables),dataType:this.options.jsonp?"jsonp":"html",cache:!0,error:function(t){}}).then((function(t){try{var e=p.parseXML(t);return e&&p(e).find("OBJECT")}catch(t){return}})))}},{key:"getPageText",value:(r=O(j().mark((function t(e){var r,n,o,i,a;return j().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,p.ajax({type:"GET",url:f(this.options.singlePageDjvuXmlUrl,this.optionVariables,{pageIndex:e}),dataType:this.options.jsonp?"jsonp":"html",cache:!0,error:function(t){}});case 6:return n=t.sent,t.prev=7,o=p.parseXML(n),i=o&&p(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 r.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=p(t).closest(".BRpagecontainer");t.style.pointerEvents="none",r.find("img").css("pointer-events","auto"),p(t).off(".textSelectPluginHandler");var n=this.mouseIsDown,o=this.mouseIsDown;n&&(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(r){e.mouseIsDown=!1,t.style.pointerEvents="none",o&&(o=!1,r.stopPropagation())}))}},{key:"textSelectingMode",value:function(t){var e=this,r=p(t).closest(".BRpagecontainer");t.style.pointerEvents="all",r.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,r=t.find(".BRtextLayer");r.length&&(r.each((function(t,r){return e.defaultMode(r)})),this.interceptCopy(t))}},{key:"createTextLayer",value:(e=O(j().mark((function t(e){var r,o,i,a,c,l,u,s,f,h,d,y,v,g,m,b,w,E,P,k,O,R,L,C,A=this;return j().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(U(i),!((a=p(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:c=(0,n.RS)(e.page,"BRtextLayer"),l=parseFloat(e.$container[0].style.width)/e.page.width,u=parseFloat(e.$container[0].style.height)/e.page.height,c.style.transform="scale(".concat(l,", ").concat(u,")"),c.setAttribute("dir",this.rtl?"rtl":"ltr"),s=p(i).find("PARAGRAPH[coords]").toArray(),f=s.map((function(t){var e=A.renderParagraph(t);return c.appendChild(e),e})),h=F(c,".BRparagraphElement"),d=0,y=S(G(s,f));try{for(y.s();!(v=y.n()).done;)g=x(v.value,2),m=g[0],b=g[1],w=p(m).attr("coords").split(",").map(parseFloat),E=h.get(b),P=x(w,4),k=P[0],O=P[2],R=P[3],L=this.rtl?E.right-O:k-E.left,C=R-(E.top+d),b.style[this.rtl?"marginRight":"marginLeft"]="".concat(L,"px"),b.style.marginTop="".concat(C,"px"),d+=C,c.appendChild(b)}catch(t){y.e(t)}finally{y.f()}o.append(c),this.stopPageFlip(o);case 28:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"renderParagraph",value:function(t){var e=document.createElement("p");e.classList.add("BRparagraphElement");var r=x(p(t).attr("coords").split(",").map(parseFloat),4),n=r[0],o=r[1],i=r[2],a=r[3],c=[],l=p(t).find("LINE[coords]").toArray();if(!l.length)return e;var u,s=S(W(N(l,M)));try{for(s.s();!(u=s.n()).done;){var f=x(u.value,3),h=f[0],d=f[1],y=f[2],v=d.ocrElement==l[l.length-1],g=document.createElement("span");g.classList.add("BRlineElement");var m,b=S(d.words.entries());try{for(b.s();!(m=b.n()).done;){var w=x(m.value,2),j=w[0],k=w[1],O=x(p(k).attr("coords").split(",").map(parseFloat),4),R=O[1],L=O[2],C=O[3],A=R-C;if(c.push(A),0==j&&null!=h&&h.lastWord.textContent.trim().endsWith("-")){var _=x(p((y||h).firstWord).attr("coords").split(",").map(parseFloat),3)[0];p(k).attr("coords","".concat(_,",").concat(R,",").concat(L,",").concat(C))}var B=document.createElement("span");if(B.setAttribute("class","BRwordElement"),B.textContent=k.textContent.trim(),j>0){var T=document.createElement("span");T.classList.add("BRspace"),T.textContent=" ",g.append(T),g.appendChild(document.createTextNode(" "))}g.appendChild(B)}}catch(t){b.e(t)}finally{b.f()}var I=d.lastWord.textContent.trim().endsWith("-"),D=g.children[g.children.length-1];I&&!v&&(D.textContent=D.textContent.trim().slice(0,-1),D.classList.add("BRwordElement--hyphen")),e.appendChild(g),v||I||e.appendChild(document.createTextNode(" "))}}catch(t){s.e(t)}finally{s.f()}c.sort((function(t,e){return t-e}));var U=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(U,"px");var H,X=F(e,".BRwordElement"),$=S(G(p(t).find("WORD").toArray(),e.querySelectorAll(".BRwordElement")));try{for($.s();!(H=$.n()).done;){var q=x(H.value,2),z=q[0],V=q[1],Y=X.get(V),J=x(p(z).attr("coords").split(",").map(parseFloat),3),K=J[0],Q=J[2]-K;z.textContent.endsWith(" ")&&(Q=Q*(z.textContent.length-1)/z.textContent.length);var Z=Q-Y.width;V.style.letterSpacing="".concat(Z/(z.textContent.length-1),"px")}}catch(t){$.e(t)}finally{$.f()}X=F(e,".BRwordElement");var tt,et,rt=F(e,".BRspace"),nt=p(t).find("LINE[coords]").toArray(),ot=Array.from(e.querySelectorAll(".BRlineElement")),it=a,at=S(G(nt,ot));try{for(at.s();!(tt=at.n()).done;){var ct,lt=x(tt.value,2),ut=lt[0],st=lt[1],ft=p(ut).find("WORD").toArray(),ht=this.rtl?i:n,pt=S(G(ft,st.querySelectorAll(".BRwordElement")));try{for(pt.s();!(ct=pt.n()).done;){var dt=x(ct.value,2),yt=dt[0],vt=dt[1],gt=X.get(vt),mt=x(p(yt).attr("coords").split(",").map(parseFloat),3),bt=mt[0],wt=mt[2],xt=this.rtl?-(wt-ht):bt-ht;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?ht-=xt+gt.width:ht+=xt+gt.width}}catch(t){pt.e(t)}finally{pt.f()}var Et=Math.min.apply(Math,function(t){if(Array.isArray(t))return P(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)||E(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(Et,"px"),it+=Et)}}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}}]),t}(),D=function(t){!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&&b(t,e)}(o,t);var e,r,n=(e=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=w(e);if(r){var o=w(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return 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)}(this,t)});function o(){return R(this,o),n.apply(this,arguments)}return C(o,[{key:"init",value:function(){var t=this,e=Object.assign({},B,this.options.plugins.textSelection);e.enabled&&(this.textSelectionPlugin=new I(e,this.options.vars,this.pageProgression),this.options.plugins.textSelection=e,this.textSelectionPlugin.init(),new u(".BRtextLayer",(function(e){var r;"started"==e&&(null===(r=t.archiveAnalyticsSendEvent)||void 0===r||r.call(t,"BookReader","SelectStart"),t.refs.$br.find(".BRpagecontainer--hasSelection").removeClass("BRpagecontainer--hasSelection"),p(window.getSelection().anchorNode).closest(".BRpagecontainer").addClass("BRpagecontainer--hasSelection"))})).attach()),m(w(o.prototype),"init",this).call(this)}},{key:"_createPageContainer",value:function(t){var e,r=m(w(o.prototype),"_createPageContainer",this).call(this,t);return this.mode!==this.constModeThumb&&r.page&&(null===(e=this.textSelectionPlugin)||void 0===e||e.createTextLayer(r)),r}}]),o}(_);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 H(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=p(t).find("WORD").toArray();return{ocrElement:t,words:e,firstWord:e[0],lastWord:e[e.length-1]}}function N(t,e){var r,n,o;return j().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:r=S(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()}}),y,null,[[1,11,14,17]])}function W(t){var e,r,n,o,i,a;return j().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:e=void 0,r=void 0,n=void 0,o=S(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()}}),v,null,[[4,19,22,25]])}function G(t,e){var r,n,o,i;return j().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 U(t){if(!p(t).attr("coords")&&t.children){var e=p(t).children().toArray();if(0!==e.length){var r,n=S(e);try{for(n.s();!(r=n.n()).done;)U(r.value)}catch(t){n.e(t)}finally{n.f()}var o,i=[],a=S(e);try{for(a.s();!(o=a.n()).done;){var c=o.value;p(c).attr("coords")&&i.push(p(c).attr("coords").split(",").map(parseFloat))}}catch(t){a.e(t)}finally{a.f()}var l=function(t){var e,r=1/0,n=-1/0,o=-1/0,i=1/0,a=S(t);try{for(a.s();!(e=a.n()).done;){var c=x(e.value,4),l=c[0],u=c[1],s=c[2],f=c[3];r=Math.min(r,l),n=Math.max(n,u),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(l[0])!=1/0&&p(t).attr("coords",l.join(","))}}}window.BookReader=D;var H=function(){function t(e,r,n,o){R(this,t),this.x=e,this.y=r,this.width=n,this.height=o}return C(t,[{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}}]),t}()},2814:function(t,e,r){var n=r(7854),o=r(7293),i=r(1702),a=r(1340),c=r(3111).trim,l=r(1361),u=i("".charAt),s=n.parseFloat,f=n.Symbol,h=f&&f.iterator,p=1/s(l+"-0")!=-1/0||h&&!o((function(){s(Object(h))}));t.exports=p?function(t){var e=c(a(t)),r=s(e);return 0===r&&"-"==u(e,0)?-0:r}:s},6091:function(t,e,r){var n=r(6530).PROPER,o=r(7293),i=r(1361);t.exports=function(t){return o((function(){return!!i[t]()||"​…᠎"!=="​…᠎"[t]()||n&&i[t].name!==t}))}},4678:function(t,e,r){var n=r(2109),o=r(2814);n({global:!0,forced:parseFloat!=o},{parseFloat:o})},3210:function(t,e,r){"use strict";var n=r(2109),o=r(3111).trim;n({target:"String",proto:!0,forced:r(6091)("trim")},{trim:function(){return o(this)}})}},function(t){t(t.s=4742)}]);
2
+ (self.webpackChunk_internetarchive_bookreader=self.webpackChunk_internetarchive_bookreader||[]).push([[423],{4742:function(t,e,r){"use strict";r(6992),r(1539),r(3948),r(9826),r(9714),r(2222),r(4678),r(8674),r(1249),r(2707),r(1038),r(8783),r(7852),r(3210),r(7042),r(9601),r(1532),r(2165),r(2526),r(1817),r(9600),r(6649),r(6078),r(9653),r(2443),r(3680),r(3706),r(2703),r(489),r(4747),r(8309),r(5069),r(4916),r(2419),r(4819),r(5003);var n=r(9860),o=r(5311);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,l(n.key),n)}}function c(t,e,r){return(e=l(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function l(t){var e=function(t,e){if("object"!==i(t)||null===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:String(e)}var u=function(){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}var e,r;return e=t,(r=[{key:"attach",value:function(){document.addEventListener("selectionchange",this._onSelectionChange)}},{key:"detach",value:function(){document.removeEventListener("selectionchange",this._onSelectionChange)}}])&&a(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function f(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:h;return null==t?void 0:t.replace(/\{\{([^}]*?)\}\}/g,(function(t,o){if(!o)return t;var i,a=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 s(t,e);var r=Object.prototype.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)?s(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.")}(),c=a[0],l=a.slice(1);if(!(c in r)&&!(c in e))return t;var u=c in r?r[c]:c in e?e[c]:null;return l.map((function(t){return n[t]})).reduce((function(t,e){return e(t)}),u&&u.toString())}))}r(5306),r(5827);var h={urlencode:encodeURIComponent},p=r(5311);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=j().mark(N),v=j().mark(W),g=j().mark(G);function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=w(t)););return t}(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},m.apply(this,arguments)}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function w(t){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},w(t)}function x(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=[],l=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);l=!0);}catch(t){u=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(t,e)||E(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 S(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=E(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 E(t,e){if(t){if("string"==typeof t)return P(t,e);var r=Object.prototype.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)?P(t,e):void 0}}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function j(){j=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.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 u(t,e,r,o){var i=e&&e.prototype instanceof h?e:h,a=Object.create(i.prototype),c=new O(o||[]);return n(a,"_invoke",{value:S(t,r,c)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function h(){}function p(){}function y(){}var v={};l(v,i,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(R([])));m&&m!==e&&r.call(m,i)&&(v=m);var b=y.prototype=h.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,i,a,c){var l=s(t[n],t,i);if("throw"!==l.type){var u=l.arg,f=u.value;return f&&"object"==d(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(l.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function S(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=E(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=s(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===f)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function E(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=s(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function P(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function R(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,n(b,"constructor",{value:y,configurable:!0}),n(y,"constructor",{value:p,configurable:!0}),p.displayName=l(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),l(x.prototype,a,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),l(b,c,"Generator"),l(b,i,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),t.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}},t.values=R,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(c&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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,f):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),f},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),k(r),f}},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;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:R(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function k(t,e,r,n,o,i,a){try{var c=t[i](a),l=c.value}catch(t){return void r(t)}c.done?e(l):Promise.resolve(l).then(n,o)}function O(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){k(i,n,o,a,c,"next",t)}function c(t){k(i,n,o,a,c,"throw",t)}a(void 0)}))}}function R(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function L(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,A(n.key),n)}}function C(t,e,r){return e&&L(t.prototype,e),r&&L(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function A(t){var e=function(t,e){if("object"!==d(t)||null===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:String(e)}var _=window.BookReader,B={enabled:!0,fullDjvuXmlUrl:null,singlePageDjvuXmlUrl:null,jsonp:!1},T=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;R(this,t),this.maxSize=e,this.entries=[]}return C(t,[{key:"add",value:function(t){this.entries.length>=this.maxSize&&this.entries.shift(),this.entries.push(t)}}]),t}(),I=function(){function t(){var e,r,n,o=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B,a=arguments.length>1?arguments[1]:void 0,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"lr";R(this,t),e=this,n=function(t,e){if("started"===t)o.textSelectingMode(e);else{if("cleared"!==t)throw new Error("Unknown type ".concat(t));o.defaultMode(e)}},(r=A(r="_onSelectionChange"))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,this.options=i,this.optionVariables=a,this.djvuPagesPromise=null,this.rtl="rl"===c,this.pageTextCache=new T,this.maxWordRendered=2500,this.selectionObserver=new u(".BRtextLayer",this._onSelectionChange)}var e,r;return C(t,[{key:"init",value:function(){this.selectionObserver.attach(),this.options.singlePageDjvuXmlUrl||(this.djvuPagesPromise=p.ajax({type:"GET",url:f(this.options.fullDjvuXmlUrl,this.optionVariables),dataType:this.options.jsonp?"jsonp":"html",cache:!0,error:function(t){}}).then((function(t){try{var e=p.parseXML(t);return e&&p(e).find("OBJECT")}catch(t){return}})))}},{key:"getPageText",value:(r=O(j().mark((function t(e){var r,n,o,i,a;return j().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,p.ajax({type:"GET",url:f(this.options.singlePageDjvuXmlUrl,this.optionVariables,{pageIndex:e}),dataType:this.options.jsonp?"jsonp":"html",cache:!0,error:function(t){}});case 6:return n=t.sent,t.prev=7,o=p.parseXML(n),i=o&&p(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 r.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=p(t).closest(".BRpagecontainer");t.style.pointerEvents="none",r.find("img").css("pointer-events","auto"),p(t).off(".textSelectPluginHandler");var n=this.mouseIsDown,o=this.mouseIsDown;n&&(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(r){e.mouseIsDown=!1,t.style.pointerEvents="none",o&&(o=!1,r.stopPropagation())}))}},{key:"textSelectingMode",value:function(t){var e=this,r=p(t).closest(".BRpagecontainer");t.style.pointerEvents="all",r.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,r=t.find(".BRtextLayer");r.length&&(r.each((function(t,r){return e.defaultMode(r)})),this.interceptCopy(t))}},{key:"createTextLayer",value:(e=O(j().mark((function t(e){var r,o,i,a,c,l,u,s,f,h,d,y,v,g,m,b,w,E,P,k,O,R,L,C,A=this;return j().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(U(i),!((a=p(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:c=(0,n.RS)(e.page,"BRtextLayer"),l=parseFloat(e.$container[0].style.width)/e.page.width,u=parseFloat(e.$container[0].style.height)/e.page.height,c.style.transform="scale(".concat(l,", ").concat(u,")"),c.setAttribute("dir",this.rtl?"rtl":"ltr"),s=p(i).find("PARAGRAPH[coords]").toArray(),f=s.map((function(t){var e=A.renderParagraph(t);return c.appendChild(e),e})),h=F(c,".BRparagraphElement"),d=0,y=S(G(s,f));try{for(y.s();!(v=y.n()).done;)g=x(v.value,2),m=g[0],b=g[1],w=p(m).attr("coords").split(",").map(parseFloat),E=h.get(b),P=x(w,4),k=P[0],O=P[2],R=P[3],L=this.rtl?E.right-O:k-E.left,C=R-(E.top+d),b.style[this.rtl?"marginRight":"marginLeft"]="".concat(L,"px"),b.style.marginTop="".concat(C,"px"),d+=C,c.appendChild(b)}catch(t){y.e(t)}finally{y.f()}o.append(c),this.stopPageFlip(o);case 28:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"renderParagraph",value:function(t){var e=document.createElement("p");e.classList.add("BRparagraphElement");var r=x(p(t).attr("coords").split(",").map(parseFloat),4),n=r[0],o=r[1],i=r[2],a=r[3],c=[],l=p(t).find("LINE[coords]").toArray();if(!l.length)return e;var u,s=S(W(N(l,M)));try{for(s.s();!(u=s.n()).done;){var f=x(u.value,3),h=f[0],d=f[1],y=f[2],v=d.ocrElement==l[l.length-1],g=document.createElement("span");g.classList.add("BRlineElement");var m,b=S(d.words.entries());try{for(b.s();!(m=b.n()).done;){var w=x(m.value,2),j=w[0],k=w[1],O=x(p(k).attr("coords").split(",").map(parseFloat),4),R=O[1],L=O[2],C=O[3],A=R-C;if(c.push(A),0==j&&null!=h&&h.lastWord.textContent.trim().endsWith("-")){var _=x(p((y||h).firstWord).attr("coords").split(",").map(parseFloat),3)[0];p(k).attr("coords","".concat(_,",").concat(R,",").concat(L,",").concat(C))}var B=document.createElement("span");if(B.setAttribute("class","BRwordElement"),B.textContent=k.textContent.trim(),j>0){var T=document.createElement("span");T.classList.add("BRspace"),T.textContent=" ",g.append(T),g.appendChild(document.createTextNode(" "))}g.appendChild(B)}}catch(t){b.e(t)}finally{b.f()}var I=d.lastWord.textContent.trim().endsWith("-"),D=g.children[g.children.length-1];I&&!v&&(D.textContent=D.textContent.trim().slice(0,-1),D.classList.add("BRwordElement--hyphen")),e.appendChild(g),v||I||e.appendChild(document.createTextNode(" "))}}catch(t){s.e(t)}finally{s.f()}c.sort((function(t,e){return t-e}));var U=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(U,"px");var H,X=F(e,".BRwordElement"),$=S(G(p(t).find("WORD").toArray(),e.querySelectorAll(".BRwordElement")));try{for($.s();!(H=$.n()).done;){var q=x(H.value,2),z=q[0],V=q[1],Y=X.get(V),J=x(p(z).attr("coords").split(",").map(parseFloat),3),K=J[0],Q=J[2]-K;z.textContent.endsWith(" ")&&(Q=Q*(z.textContent.length-1)/z.textContent.length);var Z=Q-Y.width;V.style.letterSpacing="".concat(Z/(z.textContent.length-1),"px")}}catch(t){$.e(t)}finally{$.f()}X=F(e,".BRwordElement");var tt,et,rt=F(e,".BRspace"),nt=p(t).find("LINE[coords]").toArray(),ot=Array.from(e.querySelectorAll(".BRlineElement")),it=a,at=S(G(nt,ot));try{for(at.s();!(tt=at.n()).done;){var ct,lt=x(tt.value,2),ut=lt[0],st=lt[1],ft=p(ut).find("WORD").toArray(),ht=this.rtl?i:n,pt=S(G(ft,st.querySelectorAll(".BRwordElement")));try{for(pt.s();!(ct=pt.n()).done;){var dt=x(ct.value,2),yt=dt[0],vt=dt[1],gt=X.get(vt),mt=x(p(yt).attr("coords").split(",").map(parseFloat),3),bt=mt[0],wt=mt[2],xt=this.rtl?-(wt-ht):bt-ht;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?ht-=xt+gt.width:ht+=xt+gt.width}}catch(t){pt.e(t)}finally{pt.f()}var Et=Math.min.apply(Math,function(t){if(Array.isArray(t))return P(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)||E(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(Et,"px"),it+=Et)}}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}}]),t}(),D=function(t){!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&&b(t,e)}(o,t);var e,r,n=(e=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=w(e);if(r){var o=w(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return 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)}(this,t)});function o(){return R(this,o),n.apply(this,arguments)}return C(o,[{key:"init",value:function(){var t=this,e=Object.assign({},B,this.options.plugins.textSelection);e.enabled&&(this.textSelectionPlugin=new I(e,this.options.vars,this.pageProgression),this.options.plugins.textSelection=e,this.textSelectionPlugin.init(),new u(".BRtextLayer",(function(e){var r;"started"==e&&(null===(r=t.archiveAnalyticsSendEvent)||void 0===r||r.call(t,"BookReader","SelectStart"),t.refs.$br.find(".BRpagecontainer--hasSelection").removeClass("BRpagecontainer--hasSelection"),p(window.getSelection().anchorNode).closest(".BRpagecontainer").addClass("BRpagecontainer--hasSelection"))})).attach()),m(w(o.prototype),"init",this).call(this)}},{key:"_createPageContainer",value:function(t){var e,r=m(w(o.prototype),"_createPageContainer",this).call(this,t);return this.mode!==this.constModeThumb&&r.page&&(null===(e=this.textSelectionPlugin)||void 0===e||e.createTextLayer(r)),r}}]),o}(_);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 H(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=p(t).find("WORD").toArray();return{ocrElement:t,words:e,firstWord:e[0],lastWord:e[e.length-1]}}function N(t,e){var r,n,o;return j().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:r=S(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()}}),y,null,[[1,11,14,17]])}function W(t){var e,r,n,o,i,a;return j().wrap((function(c){for(;;)switch(c.prev=c.next){case 0:e=void 0,r=void 0,n=void 0,o=S(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()}}),v,null,[[4,19,22,25]])}function G(t,e){var r,n,o,i;return j().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 U(t){if(!p(t).attr("coords")&&t.children){var e=p(t).children().toArray();if(0!==e.length){var r,n=S(e);try{for(n.s();!(r=n.n()).done;)U(r.value)}catch(t){n.e(t)}finally{n.f()}var o,i=[],a=S(e);try{for(a.s();!(o=a.n()).done;){var c=o.value;p(c).attr("coords")&&i.push(p(c).attr("coords").split(",").map(parseFloat))}}catch(t){a.e(t)}finally{a.f()}var l=function(t){var e,r=1/0,n=-1/0,o=-1/0,i=1/0,a=S(t);try{for(a.s();!(e=a.n()).done;){var c=x(e.value,4),l=c[0],u=c[1],s=c[2],f=c[3];r=Math.min(r,l),n=Math.max(n,u),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(l[0])!=1/0&&p(t).attr("coords",l.join(","))}}}window.BookReader=D;var H=function(){function t(e,r,n,o){R(this,t),this.x=e,this.y=r,this.width=n,this.height=o}return C(t,[{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}}]),t}()},2814:function(t,e,r){var n=r(7854),o=r(7293),i=r(1702),a=r(1340),c=r(3111).trim,l=r(1361),u=i("".charAt),s=n.parseFloat,f=n.Symbol,h=f&&f.iterator,p=1/s(l+"-0")!=-1/0||h&&!o((function(){s(Object(h))}));t.exports=p?function(t){var e=c(a(t)),r=s(e);return 0===r&&"-"==u(e,0)?-0:r}:s},6091:function(t,e,r){var n=r(6530).PROPER,o=r(7293),i=r(1361);t.exports=function(t){return o((function(){return!!i[t]()||"​…᠎"!=="​…᠎"[t]()||n&&i[t].name!==t}))}},4678:function(t,e,r){var n=r(2109),o=r(2814);n({global:!0,forced:parseFloat!=o},{parseFloat:o})},3210:function(t,e,r){"use strict";var n=r(2109),o=r(3111).trim;n({target:"String",proto:!0,forced:r(6091)("trim")},{trim:function(){return o(this)}})}},function(t){t(t.s=4742)}]);
3
3
  //# sourceMappingURL=plugin.text_selection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins/plugin.text_selection.js","mappings":";qvCACO,IAAMA,EAAiB,WAU5B,SAAAA,EAAYC,EAAUC,GAAS,IAAAC,EAAA,kGAAAC,CAAA,KAAAJ,GAAAK,EAAA,kBATnB,GAAKA,EAAA,0BACG,GACpBA,EAAA,cACS,MAAIA,EAAA,2BAuBQ,WACnB,IAAMC,EAAMC,OAAOC,gBAEdL,EAAKM,WAAaH,EAAII,aACzBP,EAAKM,WAAY,EACjBN,EAAKQ,OAASC,EAAEN,EAAIO,YAAYC,QAAQX,EAAKF,UAAU,GACvDE,EAAKD,QAAQ,UAAWC,EAAKQ,UAG3BR,EAAKM,YAAcH,EAAIS,aAAgBT,EAAII,YAAeE,EAAEN,EAAIO,YAAYC,QAAQX,EAAKF,UAAU,KACrGE,EAAKM,WAAY,EACjBN,EAAKD,QAA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AAOoU,EAAe,IAAa,EAAItX,CAChE,EAAIiX,wBCrBJ,IAAIM,EAAuB,eACvBT,EAAQ,EAAQ,MAChBE,EAAc,EAAQ,MAM1BI,EAAOra,QAAU,SAAUya,GACzB,OAAOV,GAAM,WACX,QAASE,EAAYQ,MANf,cAOGA,MACHD,GAAwBP,EAAYQ,GAAa9a,OAAS8a,CAClE,GACF,wBCdA,IAAIzhB,EAAI,EAAQ,MACZkhB,EAAc,EAAQ,MAI1BlhB,EAAE,CAAE8gB,QAAQ,EAAMY,OAAQhM,YAAcwL,GAAe,CACrDxL,WAAYwL,uCCLd,IAAIlhB,EAAI,EAAQ,MACZ2hB,EAAQ,aAKZ3hB,EAAE,CAAED,OAAQ,SAAU6hB,OAAO,EAAMF,OAJN,EAAQ,KAIMG,CAAuB,SAAW,CAC3ElgB,KAAM,WACJ,OAAOggB,EAAMvhB,KACf","sources":["webpack://@internetarchive/bookreader/./src/BookReader/utils/SelectionObserver.js","webpack://@internetarchive/bookreader/./src/util/strings.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.text_selection.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/number-parse-float.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/string-trim-forced.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.parse-float.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.trim.js"],"sourcesContent":["// @ts-check\nexport class SelectionObserver {\n selecting = false;\n startedInSelector = false;\n /** @type {HTMLElement} */\n target = null;\n\n /**\n * @param {string} selector\n * @param {function('started' | 'cleared', HTMLElement): any} handler\n */\n constructor(selector, handler) {\n this.selector = selector;\n this.handler = handler;\n }\n\n attach() {\n // We can't just use selectstart, because safari on iOS just\n // randomly decides when to fire it 😤\n // document.addEventListener(\"selectstart\", this._onSelectStart);\n // This has to be on document :/\n document.addEventListener(\"selectionchange\", this._onSelectionChange);\n }\n\n detach() {\n document.removeEventListener(\"selectionchange\", this._onSelectionChange);\n }\n\n _onSelectionChange = () => {\n const sel = window.getSelection();\n\n if (!this.selecting && sel.toString()) {\n this.selecting = true;\n this.target = $(sel.anchorNode).closest(this.selector)[0];\n this.handler('started', this.target);\n }\n\n if (this.selecting && (sel.isCollapsed || !sel.toString() || !$(sel.anchorNode).closest(this.selector)[0])) {\n this.selecting = false;\n this.handler('cleared', this.target);\n }\n };\n}\n","/**\n * @typedef {String} StringWithVars\n * A template string with {{foo}} style variables\n * Also supports filters, like {{bookPath|urlencode}} (See APPLY_FILTERS for the\n * supported list of filters)\n **/\n\n/**\n * @param {StringWithVars|String} template\n * @param { {[varName: string]: { toString: () => string} } } vars\n * @param { {[varName: string]: { toString: () => string} } } [overrides]\n */\nexport function applyVariables(template, vars, overrides = {}, possibleFilters = APPLY_FILTERS) {\n return template?.replace(/\\{\\{([^}]*?)\\}\\}/g, ($0, $1) => {\n if (!$1) return $0;\n /** @type {string} */\n const expression = $1;\n const [varName, ...filterNames] = expression.split('|').map(x => x.trim());\n const defined = varName in overrides || varName in vars;\n\n // If it's not defined, don't expand it at all\n if (!defined) return $0;\n\n const value = varName in overrides ? overrides[varName]\n : varName in vars ? vars[varName] : null;\n const filters = filterNames.map(n => possibleFilters[n]);\n return filters.reduce((acc, cur) => cur(acc), value && value.toString());\n });\n}\n\n/** @type { {[filterName: String]:( string => string)} } */\nexport const APPLY_FILTERS = {\n urlencode: encodeURIComponent,\n};\n","//@ts-check\nimport { createDIVPageLayer } from '../BookReader/PageContainer.js';\nimport { SelectionObserver } from '../BookReader/utils/SelectionObserver.js';\nimport { applyVariables } from '../util/strings.js';\n/** @typedef {import('../util/strings.js').StringWithVars} StringWithVars */\n/** @typedef {import('../BookReader/PageContainer.js').PageContainer} PageContainer */\n\nconst BookReader = /** @type {typeof import('../BookReader').default} */(window.BookReader);\n\nexport const DEFAULT_OPTIONS = {\n enabled: true,\n /** @type {StringWithVars} The URL to fetch the entire DJVU xml. Supports options.vars */\n fullDjvuXmlUrl: null,\n /** @type {StringWithVars} The URL to fetch a single page of the DJVU xml. Supports options.vars. Also has {{pageIndex}} */\n singlePageDjvuXmlUrl: null,\n /** Whether to fetch the XML as a jsonp */\n jsonp: false,\n};\n/** @typedef {typeof DEFAULT_OPTIONS} TextSelectionPluginOptions */\n\n/**\n * @template T\n */\nexport class Cache {\n constructor(maxSize = 10) {\n this.maxSize = maxSize;\n /** @type {T[]} */\n this.entries = [];\n }\n\n /**\n * @param {T} entry\n */\n add(entry) {\n if (this.entries.length >= this.maxSize) {\n this.entries.shift();\n }\n this.entries.push(entry);\n }\n}\n\nexport class TextSelectionPlugin {\n /**\n * @param {'lr' | 'rl'} pageProgression In the future this should be in the ocr file\n * since a book being right to left doesn't mean the ocr is right to left. But for\n * now we do make that assumption.\n */\n constructor(options = DEFAULT_OPTIONS, optionVariables, pageProgression = 'lr') {\n this.options = options;\n this.optionVariables = optionVariables;\n /**@type {PromiseLike<JQuery<HTMLElement>|undefined>} */\n this.djvuPagesPromise = null;\n /** Whether the book is right-to-left */\n this.rtl = pageProgression === 'rl';\n\n /** @type {Cache<{index: number, response: any}>} */\n this.pageTextCache = new Cache();\n\n /**\n * Sometimes there are too many words on a page, and the browser becomes near\n * unusable. For now don't render text layer for pages with too many words.\n */\n this.maxWordRendered = 2500;\n\n this.selectionObserver = new SelectionObserver('.BRtextLayer', this._onSelectionChange);\n }\n\n /**\n * @param {'started' | 'cleared'} type\n * @param {HTMLElement} target\n */\n _onSelectionChange = (type, target) => {\n if (type === 'started') {\n this.textSelectingMode(target);\n } else if (type === 'cleared') {\n this.defaultMode(target);\n } else {\n throw new Error(`Unknown type ${type}`);\n }\n }\n\n init() {\n this.selectionObserver.attach();\n\n // Only fetch the full djvu xml if the single page url isn't there\n if (this.options.singlePageDjvuXmlUrl) return;\n this.djvuPagesPromise = $.ajax({\n type: \"GET\",\n url: applyVariables(this.options.fullDjvuXmlUrl, this.optionVariables),\n dataType: this.options.jsonp ? \"jsonp\" : \"html\",\n cache: true,\n error: (e) => undefined\n }).then((res) => {\n try {\n const xmlMap = $.parseXML(res);\n return xmlMap && $(xmlMap).find(\"OBJECT\");\n } catch (e) {\n return undefined;\n }\n });\n }\n\n /**\n * @param {number} index\n * @returns {Promise<HTMLElement|undefined>}\n */\n async getPageText(index) {\n if (this.options.singlePageDjvuXmlUrl) {\n const cachedEntry = this.pageTextCache.entries.find(x => x.index == index);\n if (cachedEntry) {\n return cachedEntry.response;\n }\n const res = await $.ajax({\n type: \"GET\",\n url: applyVariables(this.options.singlePageDjvuXmlUrl, this.optionVariables, { pageIndex: index }),\n dataType: this.options.jsonp ? \"jsonp\" : \"html\",\n cache: true,\n error: (e) => undefined,\n });\n try {\n const xmlDoc = $.parseXML(res);\n const result = xmlDoc && $(xmlDoc).find(\"OBJECT\")[0];\n this.pageTextCache.add({ index, response: result });\n return result;\n } catch (e) {\n return undefined;\n }\n } else {\n const XMLpagesArr = await this.djvuPagesPromise;\n if (XMLpagesArr) return XMLpagesArr[index];\n }\n }\n\n /**\n * Intercept copied text to remove any styling applied to it\n * @param {JQuery} $container\n */\n interceptCopy($container) {\n $container[0].addEventListener('copy', (event) => {\n const selection = document.getSelection();\n event.clipboardData.setData('text/plain', selection.toString());\n event.preventDefault();\n });\n }\n\n /**\n * Applies mouse events when in default mode\n * @param {HTMLElement} textLayer\n */\n defaultMode(textLayer) {\n const $pageContainer = $(textLayer).closest('.BRpagecontainer');\n textLayer.style.pointerEvents = \"none\";\n $pageContainer.find(\"img\").css(\"pointer-events\", \"auto\");\n\n $(textLayer).off(\".textSelectPluginHandler\");\n const startedMouseDown = this.mouseIsDown;\n let skipNextMouseup = this.mouseIsDown;\n if (startedMouseDown) {\n textLayer.style.pointerEvents = \"auto\";\n }\n\n // Need to stop propagation to prevent DragScrollable from\n // blocking selection\n $(textLayer).on(\"mousedown.textSelectPluginHandler\", (event) => {\n this.mouseIsDown = true;\n if ($(event.target).is(\".BRwordElement, .BRspace\")) {\n event.stopPropagation();\n }\n });\n\n $(textLayer).on(\"mouseup.textSelectPluginHandler\", (event) => {\n this.mouseIsDown = false;\n textLayer.style.pointerEvents = \"none\";\n if (skipNextMouseup) {\n skipNextMouseup = false;\n event.stopPropagation();\n }\n });\n }\n\n /**\n * This mode is active while there is a selection on the given textLayer\n * @param {HTMLElement} textLayer\n */\n textSelectingMode(textLayer) {\n const $pageContainer = $(textLayer).closest('.BRpagecontainer');\n // Make text layer consume all events\n textLayer.style.pointerEvents = \"all\";\n // Block img from getting long-press to save while selecting\n $pageContainer.find(\"img\").css(\"pointer-events\", \"none\");\n\n $(textLayer).off(\".textSelectPluginHandler\");\n\n $(textLayer).on('mousedown.textSelectPluginHandler', (event) => {\n this.mouseIsDown = true;\n event.stopPropagation();\n });\n\n // Prevent page flip on click\n $(textLayer).on('mouseup.textSelectPluginHandler', (event) => {\n this.mouseIsDown = false;\n event.stopPropagation();\n });\n }\n\n /**\n * Initializes text selection modes if there is a text layer on the page\n * @param {JQuery} $container\n */\n stopPageFlip($container) {\n /** @type {JQuery<HTMLElement>} */\n const $textLayer = $container.find('.BRtextLayer');\n if (!$textLayer.length) return;\n $textLayer.each((i, s) => this.defaultMode(s));\n this.interceptCopy($container);\n }\n\n /**\n * @param {PageContainer} pageContainer\n */\n async createTextLayer(pageContainer) {\n const pageIndex = pageContainer.page.index;\n const $container = pageContainer.$container;\n const $textLayers = $container.find('.BRtextLayer');\n if ($textLayers.length) return;\n const XMLpage = await this.getPageText(pageIndex);\n if (!XMLpage) return;\n recursivelyAddCoords(XMLpage);\n\n const totalWords = $(XMLpage).find(\"WORD\").length;\n if (totalWords > this.maxWordRendered) {\n console.log(`Page ${pageIndex} has too many words (${totalWords} > ${this.maxWordRendered}). Not rendering text layer.`);\n return;\n }\n\n const textLayer = createDIVPageLayer(pageContainer.page, 'BRtextLayer');\n const ratioW = parseFloat(pageContainer.$container[0].style.width) / pageContainer.page.width;\n const ratioH = parseFloat(pageContainer.$container[0].style.height) / pageContainer.page.height;\n textLayer.style.transform = `scale(${ratioW}, ${ratioH})`;\n textLayer.setAttribute(\"dir\", this.rtl ? \"rtl\" : \"ltr\");\n\n const ocrParagraphs = $(XMLpage).find(\"PARAGRAPH[coords]\").toArray();\n const paragEls = ocrParagraphs.map(p => {\n const el = this.renderParagraph(p);\n textLayer.appendChild(el);\n return el;\n });\n\n // Fix up paragraph positions\n const paragraphRects = determineRealRects(textLayer, '.BRparagraphElement');\n let yAdded = 0;\n for (const [ocrParagraph, paragEl] of zip(ocrParagraphs, paragEls)) {\n const ocrParagBounds = $(ocrParagraph).attr(\"coords\").split(\",\").map(parseFloat);\n const realRect = paragraphRects.get(paragEl);\n const [ocrLeft, , ocrRight, ocrTop] = ocrParagBounds;\n const newStartMargin = this.rtl ? (realRect.right - ocrRight) : (ocrLeft - realRect.left);\n const newTop = ocrTop - (realRect.top + yAdded);\n\n paragEl.style[this.rtl ? 'marginRight' : 'marginLeft'] = `${newStartMargin}px`;\n paragEl.style.marginTop = `${newTop}px`;\n yAdded += newTop;\n textLayer.appendChild(paragEl);\n }\n $container.append(textLayer);\n this.stopPageFlip($container);\n }\n\n /**\n * @param {HTMLElement} ocrParagraph\n * @returns {HTMLParagraphElement}\n */\n renderParagraph(ocrParagraph) {\n const paragEl = document.createElement('p');\n paragEl.classList.add('BRparagraphElement');\n const [paragLeft, paragBottom, paragRight, paragTop] = $(ocrParagraph).attr(\"coords\").split(\",\").map(parseFloat);\n const wordHeightArr = [];\n const lines = $(ocrParagraph).find(\"LINE[coords]\").toArray();\n if (!lines.length) return paragEl;\n\n\n for (const [prevLine, line, nextLine] of lookAroundWindow(genMap(lines, augmentLine))) {\n const isLastLineOfParagraph = line.ocrElement == lines[lines.length - 1];\n const lineEl = document.createElement('span');\n lineEl.classList.add('BRlineElement');\n\n for (const [wordIndex, currWord] of line.words.entries()) {\n const [, bottom, right, top] = $(currWord).attr(\"coords\").split(',').map(parseFloat);\n const wordHeight = bottom - top;\n wordHeightArr.push(wordHeight);\n\n if (wordIndex == 0 && prevLine?.lastWord.textContent.trim().endsWith('-')) {\n // ideally prefer the next line to determine the left position,\n // since the previous line could be the first line of the paragraph\n // and hence have an incorrectly indented first word.\n // E.g. https://archive.org/details/driitaleofdaring00bachuoft/page/360/mode/2up\n const [newLeft, , , ] = $((nextLine || prevLine).firstWord).attr(\"coords\").split(',').map(parseFloat);\n $(currWord).attr(\"coords\", `${newLeft},${bottom},${right},${top}`);\n }\n\n const wordEl = document.createElement('span');\n wordEl.setAttribute(\"class\", \"BRwordElement\");\n wordEl.textContent = currWord.textContent.trim();\n\n if (wordIndex > 0) {\n const space = document.createElement('span');\n space.classList.add('BRspace');\n space.textContent = ' ';\n lineEl.append(space);\n\n // Edge ignores empty elements (like BRspace), so add another\n // space to ensure Edge's ReadAloud works correctly.\n lineEl.appendChild(document.createTextNode(' '));\n }\n\n lineEl.appendChild(wordEl);\n }\n\n const hasHyphen = line.lastWord.textContent.trim().endsWith('-');\n const lastWordEl = lineEl.children[lineEl.children.length - 1];\n if (hasHyphen && !isLastLineOfParagraph) {\n lastWordEl.textContent = lastWordEl.textContent.trim().slice(0, -1);\n lastWordEl.classList.add('BRwordElement--hyphen');\n }\n\n paragEl.appendChild(lineEl);\n if (!isLastLineOfParagraph && !hasHyphen) {\n // Edge does not correctly have spaces between the lines.\n paragEl.appendChild(document.createTextNode(' '));\n }\n }\n\n wordHeightArr.sort((a, b) => a - b);\n const paragWordHeight = wordHeightArr[Math.floor(wordHeightArr.length * 0.85)] + 4;\n paragEl.style.left = `${paragLeft}px`;\n paragEl.style.top = `${paragTop}px`;\n paragEl.style.width = `${paragRight - paragLeft}px`;\n paragEl.style.height = `${paragBottom - paragTop}px`;\n paragEl.style.fontSize = `${paragWordHeight}px`;\n\n // Fix up sizes - stretch/crush words as necessary using letter spacing\n let wordRects = determineRealRects(paragEl, '.BRwordElement');\n const ocrWords = $(ocrParagraph).find(\"WORD\").toArray();\n const wordEls = paragEl.querySelectorAll('.BRwordElement');\n for (const [ocrWord, wordEl] of zip(ocrWords, wordEls)) {\n const realRect = wordRects.get(wordEl);\n const [left, , right ] = $(ocrWord).attr(\"coords\").split(',').map(parseFloat);\n let ocrWidth = right - left;\n // Some books (eg theworksofplato01platiala) have a space _inside_ the <WORD>\n // element. That makes it impossible to determine the correct positining\n // of everything, but to avoid the BRspace's being width 0, which makes selection\n // janky on Chrome Android, assume the space is the same width as one of the\n // letters.\n if (ocrWord.textContent.endsWith(' ')) {\n ocrWidth = ocrWidth * (ocrWord.textContent.length - 1) / ocrWord.textContent.length;\n }\n const diff = ocrWidth - realRect.width;\n wordEl.style.letterSpacing = `${diff / (ocrWord.textContent.length - 1)}px`;\n }\n\n // Stretch/crush lines as necessary using line spacing\n // Recompute rects after letter spacing\n wordRects = determineRealRects(paragEl, '.BRwordElement');\n const spaceRects = determineRealRects(paragEl, '.BRspace');\n\n const ocrLines = $(ocrParagraph).find(\"LINE[coords]\").toArray();\n const lineEls = Array.from(paragEl.querySelectorAll('.BRlineElement'));\n\n let ySoFar = paragTop;\n for (const [ocrLine, lineEl] of zip(ocrLines, lineEls)) {\n // shift words using marginLeft to align with the correct x position\n const words = $(ocrLine).find(\"WORD\").toArray();\n // const ocrLineLeft = Math.min(...words.map(w => parseFloat($(w).attr(\"coords\").split(',')[0])));\n let xSoFar = this.rtl ? paragRight : paragLeft;\n for (const [ocrWord, wordEl] of zip(words, lineEl.querySelectorAll('.BRwordElement'))) {\n // start of line, need to compute the offset relative to the OCR words\n const wordRect = wordRects.get(wordEl);\n const [ocrLeft, , ocrRight ] = $(ocrWord).attr(\"coords\").split(',').map(parseFloat);\n const diff = (this.rtl ? -(ocrRight - xSoFar) : ocrLeft - xSoFar);\n\n if (wordEl.previousElementSibling) {\n const space = wordEl.previousElementSibling;\n space.style.letterSpacing = `${diff - spaceRects.get(space).width}px`;\n } else {\n wordEl.style[this.rtl ? 'paddingRight' : 'paddingLeft'] = `${diff}px`;\n }\n if (this.rtl) xSoFar -= diff + wordRect.width;\n else xSoFar += diff + wordRect.width;\n }\n // And also fix y position\n const ocrLineTop = Math.min(...words.map(w => parseFloat($(w).attr(\"coords\").split(',')[3])));\n const diff = ocrLineTop - ySoFar;\n if (lineEl.previousElementSibling) {\n lineEl.previousElementSibling.style.lineHeight = `${diff}px`;\n ySoFar += diff;\n }\n }\n\n // The last line will have a line height subtracting from the paragraph height\n lineEls[lineEls.length - 1].style.lineHeight = `${paragBottom - ySoFar}px`;\n\n // Edge does not include a newline for some reason when copying/pasting the <p> els\n paragEl.appendChild(document.createElement('br'));\n return paragEl;\n }\n}\n\nexport class BookreaderWithTextSelection extends BookReader {\n init() {\n const options = Object.assign({}, DEFAULT_OPTIONS, this.options.plugins.textSelection);\n if (options.enabled) {\n this.textSelectionPlugin = new TextSelectionPlugin(options, this.options.vars, this.pageProgression);\n // Write this back; this way the plugin is the source of truth, and BR just\n // contains a reference to it.\n this.options.plugins.textSelection = options;\n this.textSelectionPlugin.init();\n\n new SelectionObserver('.BRtextLayer', (selectEvent) => {\n // Track how often selection is used\n if (selectEvent == 'started') {\n this.archiveAnalyticsSendEvent?.('BookReader', 'SelectStart');\n\n // Set a class on the page to avoid hiding it when zooming/etc\n this.refs.$br.find('.BRpagecontainer--hasSelection').removeClass('BRpagecontainer--hasSelection');\n $(window.getSelection().anchorNode).closest('.BRpagecontainer').addClass('BRpagecontainer--hasSelection');\n }\n }).attach();\n }\n\n super.init();\n }\n\n /**\n * @param {number} index\n */\n _createPageContainer(index) {\n const pageContainer = super._createPageContainer(index);\n // Disable if thumb mode; it's too janky\n // .page can be null for \"pre-cover\" region\n if (this.mode !== this.constModeThumb && pageContainer.page) {\n this.textSelectionPlugin?.createTextLayer(pageContainer);\n }\n return pageContainer;\n }\n}\nwindow.BookReader = BookreaderWithTextSelection;\nexport default BookreaderWithTextSelection;\n\n\n/**\n * @param {HTMLElement} parentEl\n * @param {string} selector\n * @returns {Map<Element, Rect>}\n */\nfunction determineRealRects(parentEl, selector) {\n const initals = {\n position: parentEl.style.position,\n visibility: parentEl.style.visibility,\n top: parentEl.style.top,\n left: parentEl.style.left,\n transform: parentEl.style.transform,\n };\n parentEl.style.position = 'absolute';\n parentEl.style.visibility = 'hidden';\n parentEl.style.top = '0';\n parentEl.style.left = '0';\n parentEl.style.transform = 'none';\n document.body.appendChild(parentEl);\n const rects = new Map(\n Array.from(parentEl.querySelectorAll(selector))\n .map(wordEl => {\n const origRect = wordEl.getBoundingClientRect();\n return [wordEl, new Rect(\n origRect.left + window.scrollX,\n origRect.top + window.scrollY,\n origRect.width,\n origRect.height,\n )];\n })\n );\n document.body.removeChild(parentEl);\n Object.assign(parentEl.style, initals);\n return rects;\n}\n\n/**\n * @param {HTMLElement} line\n */\nfunction augmentLine(line) {\n const words = $(line).find(\"WORD\").toArray();\n return {\n ocrElement: line,\n words,\n firstWord: words[0],\n lastWord: words[words.length - 1],\n };\n}\n\n/**\n * @template TFrom, TTo\n * Generator version of map\n * @param {Iterable<TFrom>} gen\n * @param {function(TFrom): TTo} fn\n * @returns {Iterable<TTo>}\n */\nexport function* genMap(gen, fn) {\n for (const x of gen) yield fn(x);\n}\n\n/**\n * @template T\n * Generator that provides a sliding window of 3 elements,\n * prev, current, and next.\n * @param {Iterable<T>} gen\n * @returns {Iterable<[T | undefined, T, T | undefined]>}\n */\nexport function* lookAroundWindow(gen) {\n let prev = undefined;\n let cur = undefined;\n let next = undefined;\n for (const x of gen) {\n if (typeof cur !== 'undefined') {\n next = x;\n yield [prev, cur, next];\n }\n prev = cur;\n cur = x;\n next = undefined;\n }\n\n if (typeof cur !== 'undefined') {\n yield [prev, cur, next];\n }\n}\n\n/**\n * @template T1, T2\n * Lazy zip implementation to avoid importing lodash\n * Expects iterators to be of the same length\n * @param {Iterable<T1>} gen1\n * @param {Iterable<T2>} gen2\n * @returns {Iterable<[T1, T2]>}\n */\nexport function* zip(gen1, gen2) {\n const it1 = gen1[Symbol.iterator]();\n const it2 = gen2[Symbol.iterator]();\n while (true) {\n const r1 = it1.next();\n const r2 = it2.next();\n if (r1.done && r2.done) {\n return;\n }\n if (r1.done || r2.done) {\n throw new Error('zip: one of the iterators is done');\n }\n yield [r1.value, r2.value];\n }\n}\n\n/**\n * [left, bottom, right, top]\n * @param {Array<[number, number, number, number]>} bounds\n * @returns {[number, number, number, number]}\n */\nfunction determineBounds(bounds) {\n let leftMost = Infinity;\n let bottomMost = -Infinity;\n let rightMost = -Infinity;\n let topMost = Infinity;\n\n for (const [left, bottom, right, top] of bounds) {\n leftMost = Math.min(leftMost, left);\n bottomMost = Math.max(bottomMost, bottom);\n rightMost = Math.max(rightMost, right);\n topMost = Math.min(topMost, top);\n }\n\n return [leftMost, bottomMost, rightMost, topMost];\n}\n\n/**\n * Recursively traverses the XML tree and adds coords\n * which are the bounding box of all child coords\n * @param {Element} xmlEl\n */\nfunction recursivelyAddCoords(xmlEl) {\n if ($(xmlEl).attr('coords') || !xmlEl.children) {\n return;\n }\n\n const children = $(xmlEl).children().toArray();\n if (children.length === 0) {\n return;\n }\n\n for (const child of children) {\n recursivelyAddCoords(child);\n }\n\n const childCoords = [];\n\n for (const child of children) {\n if (!$(child).attr('coords')) continue;\n childCoords.push($(child).attr('coords').split(',').map(parseFloat));\n }\n\n const boundingCoords = determineBounds(childCoords);\n if (Math.abs(boundingCoords[0]) != Infinity) {\n $(xmlEl).attr('coords', boundingCoords.join(','));\n }\n}\n\n/**\n * Basically a polyfill for the native DOMRect class\n */\nclass Rect {\n /**\n * @param {number} x\n * @param {number} y\n * @param {number} width\n * @param {number} height\n */\n constructor(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n\n get right() { return this.x + this.width; }\n get bottom() { return this.y + this.height; }\n get top() { return this.y; }\n get left() { return this.x; }\n}\n","var global = require('../internals/global');\nvar fails = require('../internals/fails');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toString = require('../internals/to-string');\nvar trim = require('../internals/string-trim').trim;\nvar whitespaces = require('../internals/whitespaces');\n\nvar charAt = uncurryThis(''.charAt);\nvar $parseFloat = global.parseFloat;\nvar Symbol = global.Symbol;\nvar ITERATOR = Symbol && Symbol.iterator;\nvar FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity\n // MS Edge 18- broken with boxed symbols\n || (ITERATOR && !fails(function () { $parseFloat(Object(ITERATOR)); }));\n\n// `parseFloat` method\n// https://tc39.es/ecma262/#sec-parsefloat-string\nmodule.exports = FORCED ? function parseFloat(string) {\n var trimmedString = trim(toString(string));\n var result = $parseFloat(trimmedString);\n return result === 0 && charAt(trimmedString, 0) == '-' ? -0 : result;\n} : $parseFloat;\n","var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;\nvar fails = require('../internals/fails');\nvar whitespaces = require('../internals/whitespaces');\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]()\n || non[METHOD_NAME]() !== non\n || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);\n });\n};\n","var $ = require('../internals/export');\nvar $parseFloat = require('../internals/number-parse-float');\n\n// `parseFloat` method\n// https://tc39.es/ecma262/#sec-parsefloat-string\n$({ global: true, forced: parseFloat != $parseFloat }, {\n parseFloat: $parseFloat\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $trim = require('../internals/string-trim').trim;\nvar forcedStringTrimMethod = require('../internals/string-trim-forced');\n\n// `String.prototype.trim` method\n// https://tc39.es/ecma262/#sec-string.prototype.trim\n$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n"],"names":["SelectionObserver","selector","handler","_this","_classCallCheck","_defineProperty","sel","window","getSelection","selecting","toString","target","$","anchorNode","closest","isCollapsed","this","key","value","document","addEventListener","_onSelectionChange","removeEventListener","applyVariables","template","vars","overrides","arguments","length","undefined","possibleFilters","APPLY_FILTERS","replace","$0","$1","_expression$split$map2","split","map","x","trim","varName","filterNames","slice","n","reduce","acc","cur","urlencode","encodeURIComponent","genMap","_marked2","_regeneratorRuntime","mark","lookAroundWindow","_marked3","zip","_get","Reflect","get","bind","property","receiver","base","object","Object","prototype","hasOwnProperty","call","_getPrototypeOf","_superPropBase","desc","getOwnPropertyDescriptor","apply","_setPrototypeOf","o","p","setPrototypeOf","__proto__","getPrototypeOf","_slicedToArray","arr","i","Array","isArray","_arrayWithHoles","_i","Symbol","iterator","_s","_e","_x","_r","_arr","_n","_d","next","done","push","err","return","_iterableToArrayLimit","_unsupportedIterableToArray","TypeError","_nonIterableRest","_createForOfIteratorHelper","allowArrayLike","it","F","s","e","_e2","f","normalCompletion","didErr","step","_e3","minLen","_arrayLikeToArray","constructor","name","from","test","len","arr2","exports","Op","hasOwn","defineProperty","obj","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","methodName","info","resultName","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","doneResult","displayName","isGeneratorFunction","genFun","ctor","awrap","async","Promise","iter","keys","val","reverse","pop","skipTempReset","prev","charAt","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","instance","Constructor","_defineProperties","props","descriptor","_toPropertyKey","_createClass","protoProps","staticProps","input","hint","prim","toPrimitive","res","String","_toPrimitive","BookReader","DEFAULT_OPTIONS","enabled","fullDjvuXmlUrl","singlePageDjvuXmlUrl","jsonp","Cache","maxSize","entries","shift","TextSelectionPlugin","options","optionVariables","pageProgression","textSelectingMode","concat","defaultMode","djvuPagesPromise","rtl","pageTextCache","maxWordRendered","selectionObserver","_createTextLayer","_getPageText","attach","ajax","url","dataType","cache","xmlMap","parseXML","find","_callee","index","cachedEntry","xmlDoc","XMLpagesArr","_context","response","pageIndex","add","t0","$container","event","selection","clipboardData","setData","preventDefault","textLayer","_this2","$pageContainer","style","pointerEvents","css","off","startedMouseDown","mouseIsDown","skipNextMouseup","on","is","stopPropagation","_this3","_this4","$textLayer","each","interceptCopy","_callee2","pageContainer","XMLpage","totalWords","ratioW","ratioH","ocrParagraphs","paragEls","paragraphRects","yAdded","_iterator","_step","_step$value","ocrParagraph","paragEl","ocrParagBounds","realRect","_ocrParagBounds","ocrLeft","ocrRight","ocrTop","newStartMargin","newTop","_this5","_context2","page","getPageText","recursivelyAddCoords","console","log","createDIVPageLayer","parseFloat","width","height","transform","setAttribute","toArray","el","renderParagraph","appendChild","determineRealRects","attr","right","left","top","marginTop","append","stopPageFlip","_x2","createElement","classList","_$$attr$split$map2","paragLeft","paragBottom","paragRight","paragTop","wordHeightArr","lines","_step2","_iterator2","augmentLine","_step2$value","prevLine","line","nextLine","isLastLineOfParagraph","ocrElement","lineEl","_step5","_iterator5","words","_step5$value","wordIndex","currWord","_$$attr$split$map4","bottom","wordHeight","lastWord","textContent","endsWith","newLeft","firstWord","wordEl","space","createTextNode","hasHyphen","lastWordEl","children","sort","a","b","paragWordHeight","Math","floor","fontSize","_step3","wordRects","_iterator3","querySelectorAll","_step3$value","ocrWord","_$$attr$split$map8","ocrWidth","diff","letterSpacing","_step4","spaceRects","ocrLines","lineEls","ySoFar","_iterator4","_step6","_step4$value","ocrLine","xSoFar","_iterator6","_step6$value","wordRect","_$$attr$split$map10","previousElementSibling","min","_arrayWithoutHoles","w","_iterableToArray","_nonIterableSpread","lineHeight","BookreaderWithTextSelection","_BookReader","subClass","superClass","_inherits","Derived","hasNativeReflectConstruct","_super","construct","sham","Proxy","Boolean","valueOf","_isNativeReflectConstruct","Super","NewTarget","ReferenceError","_assertThisInitialized","_possibleConstructorReturn","_this6","assign","plugins","textSelection","textSelectionPlugin","init","selectEvent","_this6$archiveAnalyti","archiveAnalyticsSendEvent","refs","$br","removeClass","addClass","_this$textSelectionPl","mode","constModeThumb","createTextLayer","parentEl","initals","position","visibility","body","rects","Map","origRect","getBoundingClientRect","Rect","scrollX","scrollY","removeChild","_iterator7","_step7","_context3","_marked","_iterator8","_step8","_context4","gen1","gen2","it1","it2","r1","r2","_context5","xmlEl","_step10","_iterator10","_step11","childCoords","_iterator11","child","boundingCoords","bounds","_step9","leftMost","Infinity","bottomMost","rightMost","topMost","_iterator9","_step9$value","max","determineBounds","abs","join","y","global","fails","uncurryThis","whitespaces","$parseFloat","ITERATOR","FORCED","module","string","trimmedString","PROPER_FUNCTION_NAME","METHOD_NAME","forced","$trim","proto","forcedStringTrimMethod"],"sourceRoot":""}
1
+ {"version":3,"file":"plugins/plugin.text_selection.js","mappings":";qvCACO,IAAMA,EAAiB,WAU5B,SAAAA,EAAYC,EAAUC,GAAS,IAAAC,EAAA,kGAAAC,CAAA,KAAAJ,GAAAK,EAAA,kBATnB,GAAKA,EAAA,0BACG,GACpBA,EAAA,cACS,MAAIA,EAAA,2BAuBQ,WACnB,IAAMC,EAAMC,OAAOC,eAEnB,IAAKL,EAAKM,WAAaH,EAAII,WAAY,CACrC,IAAMC,EAASC,EAAEN,EAAIO,YAAYC,QAAQX,EAAKF,UAAU,GACxD,IAAKU,EAAQ,OACbR,EAAKQ,OAASA,EACdR,EAAKM,WAAY,EACjBN,EAAKD,QAAQ,UAAWC,EAAKQ,OAC/B,EAEIR,EAAKM,YAAcH,EAAIS,aAAgBT,EAAII,YAAeE,EAAEN,EAAIO,YAAYC,QAAQX,EAAKF,UAAU,KACrGE,EAAK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IAAXtX,GAA4C,KAA5BkD,EAAOoU,EAAe,IAAa,EAAItX,CAChE,EAAIiX,wBCrBJ,IAAIM,EAAuB,eACvBT,EAAQ,EAAQ,MAChBE,EAAc,EAAQ,MAM1BI,EAAOra,QAAU,SAAUya,GACzB,OAAOV,GAAM,WACX,QAASE,EAAYQ,MANf,cAOGA,MACHD,GAAwBP,EAAYQ,GAAa9a,OAAS8a,CAClE,GACF,wBCdA,IAAIzhB,EAAI,EAAQ,MACZkhB,EAAc,EAAQ,MAI1BlhB,EAAE,CAAE8gB,QAAQ,EAAMY,OAAQhM,YAAcwL,GAAe,CACrDxL,WAAYwL,uCCLd,IAAIlhB,EAAI,EAAQ,MACZ2hB,EAAQ,aAKZ3hB,EAAE,CAAED,OAAQ,SAAU6hB,OAAO,EAAMF,OAJN,EAAQ,KAIMG,CAAuB,SAAW,CAC3ElgB,KAAM,WACJ,OAAOggB,EAAMvhB,KACf","sources":["webpack://@internetarchive/bookreader/./src/BookReader/utils/SelectionObserver.js","webpack://@internetarchive/bookreader/./src/util/strings.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.text_selection.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/number-parse-float.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/string-trim-forced.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.parse-float.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.trim.js"],"sourcesContent":["// @ts-check\nexport class SelectionObserver {\n selecting = false;\n startedInSelector = false;\n /** @type {HTMLElement} */\n target = null;\n\n /**\n * @param {string} selector\n * @param {function('started' | 'cleared', HTMLElement): any} handler\n */\n constructor(selector, handler) {\n this.selector = selector;\n this.handler = handler;\n }\n\n attach() {\n // We can't just use selectstart, because safari on iOS just\n // randomly decides when to fire it 😤\n // document.addEventListener(\"selectstart\", this._onSelectStart);\n // This has to be on document :/\n document.addEventListener(\"selectionchange\", this._onSelectionChange);\n }\n\n detach() {\n document.removeEventListener(\"selectionchange\", this._onSelectionChange);\n }\n\n _onSelectionChange = () => {\n const sel = window.getSelection();\n\n if (!this.selecting && sel.toString()) {\n const target = $(sel.anchorNode).closest(this.selector)[0];\n if (!target) return;\n this.target = target;\n this.selecting = true;\n this.handler('started', this.target);\n }\n\n if (this.selecting && (sel.isCollapsed || !sel.toString() || !$(sel.anchorNode).closest(this.selector)[0])) {\n this.selecting = false;\n this.handler('cleared', this.target);\n }\n };\n}\n","/**\n * @typedef {String} StringWithVars\n * A template string with {{foo}} style variables\n * Also supports filters, like {{bookPath|urlencode}} (See APPLY_FILTERS for the\n * supported list of filters)\n **/\n\n/**\n * @param {StringWithVars|String} template\n * @param { {[varName: string]: { toString: () => string} } } vars\n * @param { {[varName: string]: { toString: () => string} } } [overrides]\n */\nexport function applyVariables(template, vars, overrides = {}, possibleFilters = APPLY_FILTERS) {\n return template?.replace(/\\{\\{([^}]*?)\\}\\}/g, ($0, $1) => {\n if (!$1) return $0;\n /** @type {string} */\n const expression = $1;\n const [varName, ...filterNames] = expression.split('|').map(x => x.trim());\n const defined = varName in overrides || varName in vars;\n\n // If it's not defined, don't expand it at all\n if (!defined) return $0;\n\n const value = varName in overrides ? overrides[varName]\n : varName in vars ? vars[varName] : null;\n const filters = filterNames.map(n => possibleFilters[n]);\n return filters.reduce((acc, cur) => cur(acc), value && value.toString());\n });\n}\n\n/** @type { {[filterName: String]:( string => string)} } */\nexport const APPLY_FILTERS = {\n urlencode: encodeURIComponent,\n};\n","//@ts-check\nimport { createDIVPageLayer } from '../BookReader/PageContainer.js';\nimport { SelectionObserver } from '../BookReader/utils/SelectionObserver.js';\nimport { applyVariables } from '../util/strings.js';\n/** @typedef {import('../util/strings.js').StringWithVars} StringWithVars */\n/** @typedef {import('../BookReader/PageContainer.js').PageContainer} PageContainer */\n\nconst BookReader = /** @type {typeof import('../BookReader').default} */(window.BookReader);\n\nexport const DEFAULT_OPTIONS = {\n enabled: true,\n /** @type {StringWithVars} The URL to fetch the entire DJVU xml. Supports options.vars */\n fullDjvuXmlUrl: null,\n /** @type {StringWithVars} The URL to fetch a single page of the DJVU xml. Supports options.vars. Also has {{pageIndex}} */\n singlePageDjvuXmlUrl: null,\n /** Whether to fetch the XML as a jsonp */\n jsonp: false,\n};\n/** @typedef {typeof DEFAULT_OPTIONS} TextSelectionPluginOptions */\n\n/**\n * @template T\n */\nexport class Cache {\n constructor(maxSize = 10) {\n this.maxSize = maxSize;\n /** @type {T[]} */\n this.entries = [];\n }\n\n /**\n * @param {T} entry\n */\n add(entry) {\n if (this.entries.length >= this.maxSize) {\n this.entries.shift();\n }\n this.entries.push(entry);\n }\n}\n\nexport class TextSelectionPlugin {\n /**\n * @param {'lr' | 'rl'} pageProgression In the future this should be in the ocr file\n * since a book being right to left doesn't mean the ocr is right to left. But for\n * now we do make that assumption.\n */\n constructor(options = DEFAULT_OPTIONS, optionVariables, pageProgression = 'lr') {\n this.options = options;\n this.optionVariables = optionVariables;\n /**@type {PromiseLike<JQuery<HTMLElement>|undefined>} */\n this.djvuPagesPromise = null;\n /** Whether the book is right-to-left */\n this.rtl = pageProgression === 'rl';\n\n /** @type {Cache<{index: number, response: any}>} */\n this.pageTextCache = new Cache();\n\n /**\n * Sometimes there are too many words on a page, and the browser becomes near\n * unusable. For now don't render text layer for pages with too many words.\n */\n this.maxWordRendered = 2500;\n\n this.selectionObserver = new SelectionObserver('.BRtextLayer', this._onSelectionChange);\n }\n\n /**\n * @param {'started' | 'cleared'} type\n * @param {HTMLElement} target\n */\n _onSelectionChange = (type, target) => {\n if (type === 'started') {\n this.textSelectingMode(target);\n } else if (type === 'cleared') {\n this.defaultMode(target);\n } else {\n throw new Error(`Unknown type ${type}`);\n }\n }\n\n init() {\n this.selectionObserver.attach();\n\n // Only fetch the full djvu xml if the single page url isn't there\n if (this.options.singlePageDjvuXmlUrl) return;\n this.djvuPagesPromise = $.ajax({\n type: \"GET\",\n url: applyVariables(this.options.fullDjvuXmlUrl, this.optionVariables),\n dataType: this.options.jsonp ? \"jsonp\" : \"html\",\n cache: true,\n error: (e) => undefined\n }).then((res) => {\n try {\n const xmlMap = $.parseXML(res);\n return xmlMap && $(xmlMap).find(\"OBJECT\");\n } catch (e) {\n return undefined;\n }\n });\n }\n\n /**\n * @param {number} index\n * @returns {Promise<HTMLElement|undefined>}\n */\n async getPageText(index) {\n if (this.options.singlePageDjvuXmlUrl) {\n const cachedEntry = this.pageTextCache.entries.find(x => x.index == index);\n if (cachedEntry) {\n return cachedEntry.response;\n }\n const res = await $.ajax({\n type: \"GET\",\n url: applyVariables(this.options.singlePageDjvuXmlUrl, this.optionVariables, { pageIndex: index }),\n dataType: this.options.jsonp ? \"jsonp\" : \"html\",\n cache: true,\n error: (e) => undefined,\n });\n try {\n const xmlDoc = $.parseXML(res);\n const result = xmlDoc && $(xmlDoc).find(\"OBJECT\")[0];\n this.pageTextCache.add({ index, response: result });\n return result;\n } catch (e) {\n return undefined;\n }\n } else {\n const XMLpagesArr = await this.djvuPagesPromise;\n if (XMLpagesArr) return XMLpagesArr[index];\n }\n }\n\n /**\n * Intercept copied text to remove any styling applied to it\n * @param {JQuery} $container\n */\n interceptCopy($container) {\n $container[0].addEventListener('copy', (event) => {\n const selection = document.getSelection();\n event.clipboardData.setData('text/plain', selection.toString());\n event.preventDefault();\n });\n }\n\n /**\n * Applies mouse events when in default mode\n * @param {HTMLElement} textLayer\n */\n defaultMode(textLayer) {\n const $pageContainer = $(textLayer).closest('.BRpagecontainer');\n textLayer.style.pointerEvents = \"none\";\n $pageContainer.find(\"img\").css(\"pointer-events\", \"auto\");\n\n $(textLayer).off(\".textSelectPluginHandler\");\n const startedMouseDown = this.mouseIsDown;\n let skipNextMouseup = this.mouseIsDown;\n if (startedMouseDown) {\n textLayer.style.pointerEvents = \"auto\";\n }\n\n // Need to stop propagation to prevent DragScrollable from\n // blocking selection\n $(textLayer).on(\"mousedown.textSelectPluginHandler\", (event) => {\n this.mouseIsDown = true;\n if ($(event.target).is(\".BRwordElement, .BRspace\")) {\n event.stopPropagation();\n }\n });\n\n $(textLayer).on(\"mouseup.textSelectPluginHandler\", (event) => {\n this.mouseIsDown = false;\n textLayer.style.pointerEvents = \"none\";\n if (skipNextMouseup) {\n skipNextMouseup = false;\n event.stopPropagation();\n }\n });\n }\n\n /**\n * This mode is active while there is a selection on the given textLayer\n * @param {HTMLElement} textLayer\n */\n textSelectingMode(textLayer) {\n const $pageContainer = $(textLayer).closest('.BRpagecontainer');\n // Make text layer consume all events\n textLayer.style.pointerEvents = \"all\";\n // Block img from getting long-press to save while selecting\n $pageContainer.find(\"img\").css(\"pointer-events\", \"none\");\n\n $(textLayer).off(\".textSelectPluginHandler\");\n\n $(textLayer).on('mousedown.textSelectPluginHandler', (event) => {\n this.mouseIsDown = true;\n event.stopPropagation();\n });\n\n // Prevent page flip on click\n $(textLayer).on('mouseup.textSelectPluginHandler', (event) => {\n this.mouseIsDown = false;\n event.stopPropagation();\n });\n }\n\n /**\n * Initializes text selection modes if there is a text layer on the page\n * @param {JQuery} $container\n */\n stopPageFlip($container) {\n /** @type {JQuery<HTMLElement>} */\n const $textLayer = $container.find('.BRtextLayer');\n if (!$textLayer.length) return;\n $textLayer.each((i, s) => this.defaultMode(s));\n this.interceptCopy($container);\n }\n\n /**\n * @param {PageContainer} pageContainer\n */\n async createTextLayer(pageContainer) {\n const pageIndex = pageContainer.page.index;\n const $container = pageContainer.$container;\n const $textLayers = $container.find('.BRtextLayer');\n if ($textLayers.length) return;\n const XMLpage = await this.getPageText(pageIndex);\n if (!XMLpage) return;\n recursivelyAddCoords(XMLpage);\n\n const totalWords = $(XMLpage).find(\"WORD\").length;\n if (totalWords > this.maxWordRendered) {\n console.log(`Page ${pageIndex} has too many words (${totalWords} > ${this.maxWordRendered}). Not rendering text layer.`);\n return;\n }\n\n const textLayer = createDIVPageLayer(pageContainer.page, 'BRtextLayer');\n const ratioW = parseFloat(pageContainer.$container[0].style.width) / pageContainer.page.width;\n const ratioH = parseFloat(pageContainer.$container[0].style.height) / pageContainer.page.height;\n textLayer.style.transform = `scale(${ratioW}, ${ratioH})`;\n textLayer.setAttribute(\"dir\", this.rtl ? \"rtl\" : \"ltr\");\n\n const ocrParagraphs = $(XMLpage).find(\"PARAGRAPH[coords]\").toArray();\n const paragEls = ocrParagraphs.map(p => {\n const el = this.renderParagraph(p);\n textLayer.appendChild(el);\n return el;\n });\n\n // Fix up paragraph positions\n const paragraphRects = determineRealRects(textLayer, '.BRparagraphElement');\n let yAdded = 0;\n for (const [ocrParagraph, paragEl] of zip(ocrParagraphs, paragEls)) {\n const ocrParagBounds = $(ocrParagraph).attr(\"coords\").split(\",\").map(parseFloat);\n const realRect = paragraphRects.get(paragEl);\n const [ocrLeft, , ocrRight, ocrTop] = ocrParagBounds;\n const newStartMargin = this.rtl ? (realRect.right - ocrRight) : (ocrLeft - realRect.left);\n const newTop = ocrTop - (realRect.top + yAdded);\n\n paragEl.style[this.rtl ? 'marginRight' : 'marginLeft'] = `${newStartMargin}px`;\n paragEl.style.marginTop = `${newTop}px`;\n yAdded += newTop;\n textLayer.appendChild(paragEl);\n }\n $container.append(textLayer);\n this.stopPageFlip($container);\n }\n\n /**\n * @param {HTMLElement} ocrParagraph\n * @returns {HTMLParagraphElement}\n */\n renderParagraph(ocrParagraph) {\n const paragEl = document.createElement('p');\n paragEl.classList.add('BRparagraphElement');\n const [paragLeft, paragBottom, paragRight, paragTop] = $(ocrParagraph).attr(\"coords\").split(\",\").map(parseFloat);\n const wordHeightArr = [];\n const lines = $(ocrParagraph).find(\"LINE[coords]\").toArray();\n if (!lines.length) return paragEl;\n\n\n for (const [prevLine, line, nextLine] of lookAroundWindow(genMap(lines, augmentLine))) {\n const isLastLineOfParagraph = line.ocrElement == lines[lines.length - 1];\n const lineEl = document.createElement('span');\n lineEl.classList.add('BRlineElement');\n\n for (const [wordIndex, currWord] of line.words.entries()) {\n const [, bottom, right, top] = $(currWord).attr(\"coords\").split(',').map(parseFloat);\n const wordHeight = bottom - top;\n wordHeightArr.push(wordHeight);\n\n if (wordIndex == 0 && prevLine?.lastWord.textContent.trim().endsWith('-')) {\n // ideally prefer the next line to determine the left position,\n // since the previous line could be the first line of the paragraph\n // and hence have an incorrectly indented first word.\n // E.g. https://archive.org/details/driitaleofdaring00bachuoft/page/360/mode/2up\n const [newLeft, , , ] = $((nextLine || prevLine).firstWord).attr(\"coords\").split(',').map(parseFloat);\n $(currWord).attr(\"coords\", `${newLeft},${bottom},${right},${top}`);\n }\n\n const wordEl = document.createElement('span');\n wordEl.setAttribute(\"class\", \"BRwordElement\");\n wordEl.textContent = currWord.textContent.trim();\n\n if (wordIndex > 0) {\n const space = document.createElement('span');\n space.classList.add('BRspace');\n space.textContent = ' ';\n lineEl.append(space);\n\n // Edge ignores empty elements (like BRspace), so add another\n // space to ensure Edge's ReadAloud works correctly.\n lineEl.appendChild(document.createTextNode(' '));\n }\n\n lineEl.appendChild(wordEl);\n }\n\n const hasHyphen = line.lastWord.textContent.trim().endsWith('-');\n const lastWordEl = lineEl.children[lineEl.children.length - 1];\n if (hasHyphen && !isLastLineOfParagraph) {\n lastWordEl.textContent = lastWordEl.textContent.trim().slice(0, -1);\n lastWordEl.classList.add('BRwordElement--hyphen');\n }\n\n paragEl.appendChild(lineEl);\n if (!isLastLineOfParagraph && !hasHyphen) {\n // Edge does not correctly have spaces between the lines.\n paragEl.appendChild(document.createTextNode(' '));\n }\n }\n\n wordHeightArr.sort((a, b) => a - b);\n const paragWordHeight = wordHeightArr[Math.floor(wordHeightArr.length * 0.85)] + 4;\n paragEl.style.left = `${paragLeft}px`;\n paragEl.style.top = `${paragTop}px`;\n paragEl.style.width = `${paragRight - paragLeft}px`;\n paragEl.style.height = `${paragBottom - paragTop}px`;\n paragEl.style.fontSize = `${paragWordHeight}px`;\n\n // Fix up sizes - stretch/crush words as necessary using letter spacing\n let wordRects = determineRealRects(paragEl, '.BRwordElement');\n const ocrWords = $(ocrParagraph).find(\"WORD\").toArray();\n const wordEls = paragEl.querySelectorAll('.BRwordElement');\n for (const [ocrWord, wordEl] of zip(ocrWords, wordEls)) {\n const realRect = wordRects.get(wordEl);\n const [left, , right ] = $(ocrWord).attr(\"coords\").split(',').map(parseFloat);\n let ocrWidth = right - left;\n // Some books (eg theworksofplato01platiala) have a space _inside_ the <WORD>\n // element. That makes it impossible to determine the correct positining\n // of everything, but to avoid the BRspace's being width 0, which makes selection\n // janky on Chrome Android, assume the space is the same width as one of the\n // letters.\n if (ocrWord.textContent.endsWith(' ')) {\n ocrWidth = ocrWidth * (ocrWord.textContent.length - 1) / ocrWord.textContent.length;\n }\n const diff = ocrWidth - realRect.width;\n wordEl.style.letterSpacing = `${diff / (ocrWord.textContent.length - 1)}px`;\n }\n\n // Stretch/crush lines as necessary using line spacing\n // Recompute rects after letter spacing\n wordRects = determineRealRects(paragEl, '.BRwordElement');\n const spaceRects = determineRealRects(paragEl, '.BRspace');\n\n const ocrLines = $(ocrParagraph).find(\"LINE[coords]\").toArray();\n const lineEls = Array.from(paragEl.querySelectorAll('.BRlineElement'));\n\n let ySoFar = paragTop;\n for (const [ocrLine, lineEl] of zip(ocrLines, lineEls)) {\n // shift words using marginLeft to align with the correct x position\n const words = $(ocrLine).find(\"WORD\").toArray();\n // const ocrLineLeft = Math.min(...words.map(w => parseFloat($(w).attr(\"coords\").split(',')[0])));\n let xSoFar = this.rtl ? paragRight : paragLeft;\n for (const [ocrWord, wordEl] of zip(words, lineEl.querySelectorAll('.BRwordElement'))) {\n // start of line, need to compute the offset relative to the OCR words\n const wordRect = wordRects.get(wordEl);\n const [ocrLeft, , ocrRight ] = $(ocrWord).attr(\"coords\").split(',').map(parseFloat);\n const diff = (this.rtl ? -(ocrRight - xSoFar) : ocrLeft - xSoFar);\n\n if (wordEl.previousElementSibling) {\n const space = wordEl.previousElementSibling;\n space.style.letterSpacing = `${diff - spaceRects.get(space).width}px`;\n } else {\n wordEl.style[this.rtl ? 'paddingRight' : 'paddingLeft'] = `${diff}px`;\n }\n if (this.rtl) xSoFar -= diff + wordRect.width;\n else xSoFar += diff + wordRect.width;\n }\n // And also fix y position\n const ocrLineTop = Math.min(...words.map(w => parseFloat($(w).attr(\"coords\").split(',')[3])));\n const diff = ocrLineTop - ySoFar;\n if (lineEl.previousElementSibling) {\n lineEl.previousElementSibling.style.lineHeight = `${diff}px`;\n ySoFar += diff;\n }\n }\n\n // The last line will have a line height subtracting from the paragraph height\n lineEls[lineEls.length - 1].style.lineHeight = `${paragBottom - ySoFar}px`;\n\n // Edge does not include a newline for some reason when copying/pasting the <p> els\n paragEl.appendChild(document.createElement('br'));\n return paragEl;\n }\n}\n\nexport class BookreaderWithTextSelection extends BookReader {\n init() {\n const options = Object.assign({}, DEFAULT_OPTIONS, this.options.plugins.textSelection);\n if (options.enabled) {\n this.textSelectionPlugin = new TextSelectionPlugin(options, this.options.vars, this.pageProgression);\n // Write this back; this way the plugin is the source of truth, and BR just\n // contains a reference to it.\n this.options.plugins.textSelection = options;\n this.textSelectionPlugin.init();\n\n new SelectionObserver('.BRtextLayer', (selectEvent) => {\n // Track how often selection is used\n if (selectEvent == 'started') {\n this.archiveAnalyticsSendEvent?.('BookReader', 'SelectStart');\n\n // Set a class on the page to avoid hiding it when zooming/etc\n this.refs.$br.find('.BRpagecontainer--hasSelection').removeClass('BRpagecontainer--hasSelection');\n $(window.getSelection().anchorNode).closest('.BRpagecontainer').addClass('BRpagecontainer--hasSelection');\n }\n }).attach();\n }\n\n super.init();\n }\n\n /**\n * @param {number} index\n */\n _createPageContainer(index) {\n const pageContainer = super._createPageContainer(index);\n // Disable if thumb mode; it's too janky\n // .page can be null for \"pre-cover\" region\n if (this.mode !== this.constModeThumb && pageContainer.page) {\n this.textSelectionPlugin?.createTextLayer(pageContainer);\n }\n return pageContainer;\n }\n}\nwindow.BookReader = BookreaderWithTextSelection;\nexport default BookreaderWithTextSelection;\n\n\n/**\n * @param {HTMLElement} parentEl\n * @param {string} selector\n * @returns {Map<Element, Rect>}\n */\nfunction determineRealRects(parentEl, selector) {\n const initals = {\n position: parentEl.style.position,\n visibility: parentEl.style.visibility,\n top: parentEl.style.top,\n left: parentEl.style.left,\n transform: parentEl.style.transform,\n };\n parentEl.style.position = 'absolute';\n parentEl.style.visibility = 'hidden';\n parentEl.style.top = '0';\n parentEl.style.left = '0';\n parentEl.style.transform = 'none';\n document.body.appendChild(parentEl);\n const rects = new Map(\n Array.from(parentEl.querySelectorAll(selector))\n .map(wordEl => {\n const origRect = wordEl.getBoundingClientRect();\n return [wordEl, new Rect(\n origRect.left + window.scrollX,\n origRect.top + window.scrollY,\n origRect.width,\n origRect.height,\n )];\n })\n );\n document.body.removeChild(parentEl);\n Object.assign(parentEl.style, initals);\n return rects;\n}\n\n/**\n * @param {HTMLElement} line\n */\nfunction augmentLine(line) {\n const words = $(line).find(\"WORD\").toArray();\n return {\n ocrElement: line,\n words,\n firstWord: words[0],\n lastWord: words[words.length - 1],\n };\n}\n\n/**\n * @template TFrom, TTo\n * Generator version of map\n * @param {Iterable<TFrom>} gen\n * @param {function(TFrom): TTo} fn\n * @returns {Iterable<TTo>}\n */\nexport function* genMap(gen, fn) {\n for (const x of gen) yield fn(x);\n}\n\n/**\n * @template T\n * Generator that provides a sliding window of 3 elements,\n * prev, current, and next.\n * @param {Iterable<T>} gen\n * @returns {Iterable<[T | undefined, T, T | undefined]>}\n */\nexport function* lookAroundWindow(gen) {\n let prev = undefined;\n let cur = undefined;\n let next = undefined;\n for (const x of gen) {\n if (typeof cur !== 'undefined') {\n next = x;\n yield [prev, cur, next];\n }\n prev = cur;\n cur = x;\n next = undefined;\n }\n\n if (typeof cur !== 'undefined') {\n yield [prev, cur, next];\n }\n}\n\n/**\n * @template T1, T2\n * Lazy zip implementation to avoid importing lodash\n * Expects iterators to be of the same length\n * @param {Iterable<T1>} gen1\n * @param {Iterable<T2>} gen2\n * @returns {Iterable<[T1, T2]>}\n */\nexport function* zip(gen1, gen2) {\n const it1 = gen1[Symbol.iterator]();\n const it2 = gen2[Symbol.iterator]();\n while (true) {\n const r1 = it1.next();\n const r2 = it2.next();\n if (r1.done && r2.done) {\n return;\n }\n if (r1.done || r2.done) {\n throw new Error('zip: one of the iterators is done');\n }\n yield [r1.value, r2.value];\n }\n}\n\n/**\n * [left, bottom, right, top]\n * @param {Array<[number, number, number, number]>} bounds\n * @returns {[number, number, number, number]}\n */\nfunction determineBounds(bounds) {\n let leftMost = Infinity;\n let bottomMost = -Infinity;\n let rightMost = -Infinity;\n let topMost = Infinity;\n\n for (const [left, bottom, right, top] of bounds) {\n leftMost = Math.min(leftMost, left);\n bottomMost = Math.max(bottomMost, bottom);\n rightMost = Math.max(rightMost, right);\n topMost = Math.min(topMost, top);\n }\n\n return [leftMost, bottomMost, rightMost, topMost];\n}\n\n/**\n * Recursively traverses the XML tree and adds coords\n * which are the bounding box of all child coords\n * @param {Element} xmlEl\n */\nfunction recursivelyAddCoords(xmlEl) {\n if ($(xmlEl).attr('coords') || !xmlEl.children) {\n return;\n }\n\n const children = $(xmlEl).children().toArray();\n if (children.length === 0) {\n return;\n }\n\n for (const child of children) {\n recursivelyAddCoords(child);\n }\n\n const childCoords = [];\n\n for (const child of children) {\n if (!$(child).attr('coords')) continue;\n childCoords.push($(child).attr('coords').split(',').map(parseFloat));\n }\n\n const boundingCoords = determineBounds(childCoords);\n if (Math.abs(boundingCoords[0]) != Infinity) {\n $(xmlEl).attr('coords', boundingCoords.join(','));\n }\n}\n\n/**\n * Basically a polyfill for the native DOMRect class\n */\nclass Rect {\n /**\n * @param {number} x\n * @param {number} y\n * @param {number} width\n * @param {number} height\n */\n constructor(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n\n get right() { return this.x + this.width; }\n get bottom() { return this.y + this.height; }\n get top() { return this.y; }\n get left() { return this.x; }\n}\n","var global = require('../internals/global');\nvar fails = require('../internals/fails');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toString = require('../internals/to-string');\nvar trim = require('../internals/string-trim').trim;\nvar whitespaces = require('../internals/whitespaces');\n\nvar charAt = uncurryThis(''.charAt);\nvar $parseFloat = global.parseFloat;\nvar Symbol = global.Symbol;\nvar ITERATOR = Symbol && Symbol.iterator;\nvar FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity\n // MS Edge 18- broken with boxed symbols\n || (ITERATOR && !fails(function () { $parseFloat(Object(ITERATOR)); }));\n\n// `parseFloat` method\n// https://tc39.es/ecma262/#sec-parsefloat-string\nmodule.exports = FORCED ? function parseFloat(string) {\n var trimmedString = trim(toString(string));\n var result = $parseFloat(trimmedString);\n return result === 0 && charAt(trimmedString, 0) == '-' ? -0 : result;\n} : $parseFloat;\n","var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;\nvar fails = require('../internals/fails');\nvar whitespaces = require('../internals/whitespaces');\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]()\n || non[METHOD_NAME]() !== non\n || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);\n });\n};\n","var $ = require('../internals/export');\nvar $parseFloat = require('../internals/number-parse-float');\n\n// `parseFloat` method\n// https://tc39.es/ecma262/#sec-parsefloat-string\n$({ global: true, forced: parseFloat != $parseFloat }, {\n parseFloat: $parseFloat\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar $trim = require('../internals/string-trim').trim;\nvar forcedStringTrimMethod = require('../internals/string-trim-forced');\n\n// `String.prototype.trim` method\n// https://tc39.es/ecma262/#sec-string.prototype.trim\n$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n"],"names":["SelectionObserver","selector","handler","_this","_classCallCheck","_defineProperty","sel","window","getSelection","selecting","toString","target","$","anchorNode","closest","isCollapsed","this","key","value","document","addEventListener","_onSelectionChange","removeEventListener","applyVariables","template","vars","overrides","arguments","length","undefined","possibleFilters","APPLY_FILTERS","replace","$0","$1","_expression$split$map2","split","map","x","trim","varName","filterNames","slice","n","reduce","acc","cur","urlencode","encodeURIComponent","genMap","_marked2","_regeneratorRuntime","mark","lookAroundWindow","_marked3","zip","_get","Reflect","get","bind","property","receiver","base","object","Object","prototype","hasOwnProperty","call","_getPrototypeOf","_superPropBase","desc","getOwnPropertyDescriptor","apply","_setPrototypeOf","o","p","setPrototypeOf","__proto__","getPrototypeOf","_slicedToArray","arr","i","Array","isArray","_arrayWithHoles","_i","Symbol","iterator","_s","_e","_x","_r","_arr","_n","_d","next","done","push","err","return","_iterableToArrayLimit","_unsupportedIterableToArray","TypeError","_nonIterableRest","_createForOfIteratorHelper","allowArrayLike","it","F","s","e","_e2","f","normalCompletion","didErr","step","_e3","minLen","_arrayLikeToArray","constructor","name","from","test","len","arr2","exports","Op","hasOwn","defineProperty","obj","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","enumerable","configurable","writable","wrap","innerFn","outerFn","self","tryLocsList","protoGenerator","Generator","generator","create","context","Context","makeInvokeMethod","tryCatch","fn","arg","type","ContinueSentinel","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","method","_invoke","AsyncIterator","PromiseImpl","invoke","resolve","reject","record","result","_typeof","__await","then","unwrapped","error","previousPromise","callInvokeWithMethodAndArg","state","Error","delegate","delegateResult","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","methodName","info","resultName","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","doneResult","displayName","isGeneratorFunction","genFun","ctor","awrap","async","Promise","iter","keys","val","reverse","pop","skipTempReset","prev","charAt","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","asyncGeneratorStep","gen","_next","_throw","_asyncToGenerator","args","instance","Constructor","_defineProperties","props","descriptor","_toPropertyKey","_createClass","protoProps","staticProps","input","hint","prim","toPrimitive","res","String","_toPrimitive","BookReader","DEFAULT_OPTIONS","enabled","fullDjvuXmlUrl","singlePageDjvuXmlUrl","jsonp","Cache","maxSize","entries","shift","TextSelectionPlugin","options","optionVariables","pageProgression","textSelectingMode","concat","defaultMode","djvuPagesPromise","rtl","pageTextCache","maxWordRendered","selectionObserver","_createTextLayer","_getPageText","attach","ajax","url","dataType","cache","xmlMap","parseXML","find","_callee","index","cachedEntry","xmlDoc","XMLpagesArr","_context","response","pageIndex","add","t0","$container","event","selection","clipboardData","setData","preventDefault","textLayer","_this2","$pageContainer","style","pointerEvents","css","off","startedMouseDown","mouseIsDown","skipNextMouseup","on","is","stopPropagation","_this3","_this4","$textLayer","each","interceptCopy","_callee2","pageContainer","XMLpage","totalWords","ratioW","ratioH","ocrParagraphs","paragEls","paragraphRects","yAdded","_iterator","_step","_step$value","ocrParagraph","paragEl","ocrParagBounds","realRect","_ocrParagBounds","ocrLeft","ocrRight","ocrTop","newStartMargin","newTop","_this5","_context2","page","getPageText","recursivelyAddCoords","console","log","createDIVPageLayer","parseFloat","width","height","transform","setAttribute","toArray","el","renderParagraph","appendChild","determineRealRects","attr","right","left","top","marginTop","append","stopPageFlip","_x2","createElement","classList","_$$attr$split$map2","paragLeft","paragBottom","paragRight","paragTop","wordHeightArr","lines","_step2","_iterator2","augmentLine","_step2$value","prevLine","line","nextLine","isLastLineOfParagraph","ocrElement","lineEl","_step5","_iterator5","words","_step5$value","wordIndex","currWord","_$$attr$split$map4","bottom","wordHeight","lastWord","textContent","endsWith","newLeft","firstWord","wordEl","space","createTextNode","hasHyphen","lastWordEl","children","sort","a","b","paragWordHeight","Math","floor","fontSize","_step3","wordRects","_iterator3","querySelectorAll","_step3$value","ocrWord","_$$attr$split$map8","ocrWidth","diff","letterSpacing","_step4","spaceRects","ocrLines","lineEls","ySoFar","_iterator4","_step6","_step4$value","ocrLine","xSoFar","_iterator6","_step6$value","wordRect","_$$attr$split$map10","previousElementSibling","min","_arrayWithoutHoles","w","_iterableToArray","_nonIterableSpread","lineHeight","BookreaderWithTextSelection","_BookReader","subClass","superClass","_inherits","Derived","hasNativeReflectConstruct","_super","construct","sham","Proxy","Boolean","valueOf","_isNativeReflectConstruct","Super","NewTarget","ReferenceError","_assertThisInitialized","_possibleConstructorReturn","_this6","assign","plugins","textSelection","textSelectionPlugin","init","selectEvent","_this6$archiveAnalyti","archiveAnalyticsSendEvent","refs","$br","removeClass","addClass","_this$textSelectionPl","mode","constModeThumb","createTextLayer","parentEl","initals","position","visibility","body","rects","Map","origRect","getBoundingClientRect","Rect","scrollX","scrollY","removeChild","_iterator7","_step7","_context3","_marked","_iterator8","_step8","_context4","gen1","gen2","it1","it2","r1","r2","_context5","xmlEl","_step10","_iterator10","_step11","childCoords","_iterator11","child","boundingCoords","bounds","_step9","leftMost","Infinity","bottomMost","rightMost","topMost","_iterator9","_step9$value","max","determineBounds","abs","join","y","global","fails","uncurryThis","whitespaces","$parseFloat","ITERATOR","FORCED","module","string","trimmedString","PROPER_FUNCTION_NAME","METHOD_NAME","forced","$trim","proto","forcedStringTrimMethod"],"sourceRoot":""}