@internetarchive/bookreader 5.0.0-90 → 5.0.0-91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/plugins/plugin.chapters.js +2 -2
- package/BookReader/plugins/plugin.chapters.js.map +1 -1
- package/BookReader/plugins/plugin.text_selection.js +1 -1
- package/BookReader/plugins/plugin.text_selection.js.map +1 -1
- package/BookReader/plugins/plugin.tts.js +1 -1
- package/BookReader/plugins/plugin.tts.js.map +1 -1
- package/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/src/BookReader/BookModel.js +5 -4
- package/src/BookReader/options.js +2 -0
- package/src/BookReader.js +18 -8
- package/src/plugins/plugin.chapters.js +220 -157
- package/src/plugins/plugin.text_selection.js +16 -0
- package/src/plugins/tts/WebTTSEngine.js +67 -41
- package/src/plugins/tts/plugin.tts.js +1 -3
- package/src/plugins/tts/utils.js +13 -0
- package/src/util/browserSniffing.js +11 -1
- package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +70 -0
- package/tests/jest/plugins/plugin.chapters.test.js +56 -58
- package/tests/jest/plugins/tts/WebTTSEngine.test.js +18 -12
- package/tests/jest/util/browserSniffing.test.js +9 -3
- package/tests/jest/utils.js +4 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"plugins/plugin.text_selection.js","mappings":";06BAMO,IAAMA,EAAgB,WAW3B,SAPA,SAAAA,EAAYC,gGAAIC,CAAA,KAAAF,GAEdG,KAAKF,GAAKA,EAEVE,KAAKC,OACP,KAEA,EAAAC,IAAA,QAAAC,MAIA,SAAMF,GACJD,KAAKC,QAAUG,OAAOC,OAAO,CAAC,EAAGL,KAAKC,QAASA,EACjD,GAEA,CAAAC,IAAA,OAAAC,MACA,WAAQ,GAER,CAAAD,IAAA,0BAAAC,MAKA,SAAwBG,GACxB,GAEA,CAAAJ,IAAA,0BAAAC,MACA,WAA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KAAI,SAAA9P,GAAC,OAAIiZ,EAAgBjZ,EAAE,IACxCyZ,QAAO,SAACC,EAAK5C,GAAG,OAAKA,EAAI4C,EAAI,GAAEnc,GAASA,EAAMc,WAC/D,GACF,iKAGO,IAAM6a,EAAgB,CAC3BS,UAAWC,yCChCb,IAAIC,EAAuB,cACvBC,EAAQ,EAAQ,MAChBC,EAAc,EAAQ,MAM1BC,EAAOC,QAAU,SAAUC,GACzB,OAAOJ,GAAM,WACX,QAASC,EAAYG,MANf,cAOGA,MACHL,GAAwBE,EAAYG,GAAa3Y,OAAS2Y,CAClE,GACF,wBCdA,IAAI3b,EAAI,EAAQ,MACZ4b,EAAQ,aAKZ5b,EAAE,CAAED,OAAQ,SAAU8b,OAAO,EAAMC,OAJN,EAAQ,IAIMC,CAAuB,SAAW,CAC3E1H,KAAM,WACJ,OAAOuH,EAAM/c,KACf","sources":["webpack://@internetarchive/bookreader/./src/BookReaderPlugin.js","webpack://@internetarchive/bookreader/./src/BookReader/utils/SelectionObserver.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.text_selection.js","webpack://@internetarchive/bookreader/./src/util/strings.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/string-trim-forced.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.trim.js"],"sourcesContent":["// @ts-check\n/** @typedef {import(\"./BookReader.js\").default} BookReader */\n\n/**\n * @template TOptions\n */\nexport class BookReaderPlugin {\n /**\n * @param {BookReader} br\n */\n constructor(br) {\n /** @type {BookReader} */\n this.br = br;\n /** @type {TOptions} */\n this.options;\n }\n\n /**\n * @abstract\n * @param {TOptions} options\n **/\n setup(options) {\n this.options = Object.assign({}, this.options, options);\n }\n\n /** @abstract */\n init() {}\n\n /**\n * @abstract\n * @protected\n * @param {import (\"./BookReader/PageContainer.js\").PageContainer} pageContainer\n */\n _configurePageContainer(pageContainer) {\n }\n\n /** @abstract @protected */\n _bindNavigationHandlers() {}\n\n /**\n * @param {JQuery<HTMLElement>} $navBar\n */\n extendNavBar($navBar) {}\n}\n","// @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","//@ts-check\nimport { createDIVPageLayer } from '../BookReader/PageContainer.js';\nimport { SelectionObserver } from '../BookReader/utils/SelectionObserver.js';\nimport { BookReaderPlugin } from '../BookReaderPlugin.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\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 extends BookReaderPlugin {\n 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\n /**@type {PromiseLike<JQuery<HTMLElement>|undefined>} */\n djvuPagesPromise = null;\n\n /** @type {Cache<{index: number, response: any}>} */\n 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 maxWordRendered = 2500;\n\n /**\n * @param {import('../BookReader.js').default} br\n */\n constructor(br) {\n super(br);\n // 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 /** Whether the book is right-to-left */\n this.rtl = this.br.pageProgression === 'rl';\n this.selectionObserver = new SelectionObserver('.BRtextLayer', this._onSelectionChange);\n }\n\n /** @override */\n init() {\n if (!this.options.enabled) return;\n\n this.loadData();\n\n this.selectionObserver.attach();\n new SelectionObserver('.BRtextLayer', (selectEvent) => {\n // Track how often selection is used\n if (selectEvent == 'started') {\n this.br._plugins.archiveAnalytics?.sendEvent('BookReader', 'SelectStart');\n\n // Set a class on the page to avoid hiding it when zooming/etc\n this.br.refs.$br.find('.BRpagecontainer--hasSelection').removeClass('BRpagecontainer--hasSelection');\n $(window.getSelection().anchorNode).closest('.BRpagecontainer').addClass('BRpagecontainer--hasSelection');\n }\n }).attach();\n }\n\n /**\n * @override\n * @param {PageContainer} pageContainer\n * @returns {PageContainer}\n */\n _configurePageContainer(pageContainer) {\n // Disable if thumb mode; it's too janky\n // .page can be null for \"pre-cover\" region\n if (this.br.mode !== this.br.constModeThumb && pageContainer.page) {\n this.createTextLayer(pageContainer);\n }\n return pageContainer;\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 loadData() {\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.br.options.vars),\n dataType: this.options.jsonp ? \"jsonp\" : \"html\",\n cache: true,\n xhrFields: {\n withCredentials: this.br.protected,\n },\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.br.options.vars, { pageIndex: index }),\n dataType: this.options.jsonp ? \"jsonp\" : \"html\",\n cache: true,\n xhrFields: {\n withCredentials: this.br.protected,\n },\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\nBookReader?.registerPlugin('textSelection', TextSelectionPlugin);\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","/**\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 * @returns {StringWithVars|string}\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","'use strict';\nvar 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","'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":["BookReaderPlugin","br","_classCallCheck","this","options","key","value","Object","assign","pageContainer","$navBar","SelectionObserver","selector","handler","_this","_defineProperty","sel","window","getSelection","selecting","toString","target","$","anchorNode","closest","isCollapsed","document","addEventListener","_onSelectionChange","removeEventListener","genMap","_marked2","_regeneratorRuntime","mark","lookAroundWindow","_marked3","zip","_slicedToArray","r","e","Array","isArray","_arrayWithHoles","l","t","Symbol","iterator","n","i","u","a","f","o","call","next","done","push","length","return","_iterableToArrayLimit","_unsupportedIterableToArray","TypeError","_nonIterableRest","_createForOfIteratorHelper","_n","F","s","_arrayLikeToArray","slice","constructor","name","from","test","prototype","hasOwnProperty","defineProperty","c","asyncIterator","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","h","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","_typeof","resolve","__await","then","callInvokeWithMethodAndArg","Error","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","resultName","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","isNaN","displayName","isGeneratorFunction","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","stop","rval","handle","complete","finish","catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_next","_throw","_callSuper","_getPrototypeOf","ReferenceError","_assertThisInitialized","_possibleConstructorReturn","_isNativeReflectConstruct","Reflect","construct","Boolean","valueOf","bind","_setPrototypeOf","_toPropertyKey","_defineProperties","_createClass","toPrimitive","String","_toPrimitive","BookReader","Cache","maxSize","undefined","entries","entry","shift","TextSelectionPlugin","_BookReaderPlugin","enabled","fullDjvuXmlUrl","singlePageDjvuXmlUrl","jsonp","textSelectingMode","concat","defaultMode","rtl","pageProgression","selectionObserver","_inherits","_this2","loadData","attach","selectEvent","_this2$br$_plugins$ar","_plugins","archiveAnalytics","sendEvent","refs","$br","find","removeClass","addClass","mode","constModeThumb","page","createTextLayer","djvuPagesPromise","ajax","url","applyVariables","vars","dataType","cache","xhrFields","withCredentials","protected","error","res","xmlMap","parseXML","_getPageText","_callee","index","cachedEntry","xmlDoc","result","XMLpagesArr","_context","pageTextCache","x","response","pageIndex","add","t0","_x","$container","event","selection","clipboardData","setData","preventDefault","textLayer","_this3","$pageContainer","style","pointerEvents","css","off","startedMouseDown","mouseIsDown","skipNextMouseup","on","is","stopPropagation","_this4","_this5","$textLayer","each","interceptCopy","_createTextLayer","_callee2","XMLpage","totalWords","ratioW","ratioH","ocrParagraphs","paragEls","paragraphRects","yAdded","_iterator","_step","_step$value","ocrParagraph","paragEl","ocrParagBounds","realRect","_ocrParagBounds","ocrLeft","ocrRight","ocrTop","newStartMargin","newTop","_this6","_context2","getPageText","recursivelyAddCoords","maxWordRendered","console","log","createDIVPageLayer","parseFloat","width","height","transform","setAttribute","toArray","map","el","renderParagraph","appendChild","determineRealRects","attr","split","get","right","left","top","marginTop","err","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","trim","endsWith","newLeft","firstWord","wordEl","space","createTextNode","hasHyphen","lastWordEl","children","sort","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","parentEl","initals","position","visibility","body","rects","Map","origRect","getBoundingClientRect","Rect","scrollX","scrollY","removeChild","gen","fn","_iterator7","_step7","_context3","_marked","cur","_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","registerPlugin","template","overrides","possibleFilters","APPLY_FILTERS","replace","$0","$1","_expression$split$map2","varName","filterNames","reduce","acc","urlencode","encodeURIComponent","PROPER_FUNCTION_NAME","fails","whitespaces","module","exports","METHOD_NAME","$trim","proto","forced","forcedStringTrimMethod"],"sourceRoot":""}
|
1
|
+
{"version":3,"file":"plugins/plugin.text_selection.js","mappings":";06BAMO,IAAMA,EAAgB,WAW3B,SAPA,SAAAA,EAAYC,gGAAIC,CAAA,KAAAF,GAEdG,KAAKF,GAAKA,EAEVE,KAAKC,OACP,KAEA,EAAAC,IAAA,QAAAC,MAIA,SAAMF,GACJD,KAAKC,QAAUG,OAAOC,OAAO,CAAC,EAAGL,KAAKC,QAASA,EACjD,GAEA,CAAAC,IAAA,OAAAC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D,IAAKA,EAAI,OAAOD,EAEhB,MAC0EE,8CADvDD,EAC0BhJ,MAAM,KAAKL,KAAI,SAAA/D,GAAC,OAAIA,EAAE4G,MAAM,6jBAAlE0G,EAAOD,EAAA,GAAKE,EAAWF,EAAAnY,MAAA,GAI9B,KAHgBoY,KAAWP,MAAaO,KAAWxO,GAGrC,OAAOqO,EAErB,IAAM/b,EAAQkc,KAAWP,EAAYA,EAAUO,GAC3CA,KAAWxO,EAAOA,EAAKwO,GAAW,KAEtC,OADgBC,EAAYxJ,KAAI,SAAAlQ,GAAC,OAAImZ,EAAgBnZ,EAAE,IACxC2Z,QAAO,SAACC,EAAK5C,GAAG,OAAKA,EAAI4C,EAAI,GAAErc,GAASA,EAAMc,WAC/D,GACF,iKAGO,IAAM+a,EAAgB,CAC3BS,UAAWC,yCChCb,IAAIC,EAAuB,cACvBC,EAAQ,EAAQ,MAChBC,EAAc,EAAQ,MAM1BC,EAAOC,QAAU,SAAUC,GACzB,OAAOJ,GAAM,WACX,QAASC,EAAYG,MANf,cAOGA,MACHL,GAAwBE,EAAYG,GAAa7Y,OAAS6Y,CAClE,GACF,wBCdA,IAAI7b,EAAI,EAAQ,MACZ8b,EAAQ,aAKZ9b,EAAE,CAAED,OAAQ,SAAUgc,OAAO,EAAMC,OAJN,EAAQ,IAIMC,CAAuB,SAAW,CAC3EzH,KAAM,WACJ,OAAOsH,EAAMjd,KACf","sources":["webpack://@internetarchive/bookreader/./src/BookReaderPlugin.js","webpack://@internetarchive/bookreader/./src/BookReader/utils/SelectionObserver.js","webpack://@internetarchive/bookreader/./src/plugins/plugin.text_selection.js","webpack://@internetarchive/bookreader/./src/util/strings.js","webpack://@internetarchive/bookreader/./node_modules/core-js/internals/string-trim-forced.js","webpack://@internetarchive/bookreader/./node_modules/core-js/modules/es.string.trim.js"],"sourcesContent":["// @ts-check\n/** @typedef {import(\"./BookReader.js\").default} BookReader */\n\n/**\n * @template TOptions\n */\nexport class BookReaderPlugin {\n /**\n * @param {BookReader} br\n */\n constructor(br) {\n /** @type {BookReader} */\n this.br = br;\n /** @type {TOptions} */\n this.options;\n }\n\n /**\n * @abstract\n * @param {TOptions} options\n **/\n setup(options) {\n this.options = Object.assign({}, this.options, options);\n }\n\n /** @abstract */\n init() {}\n\n /**\n * @abstract\n * @protected\n * @param {import (\"./BookReader/PageContainer.js\").PageContainer} pageContainer\n */\n _configurePageContainer(pageContainer) {\n }\n\n /** @abstract @protected */\n _bindNavigationHandlers() {}\n\n /**\n * @param {JQuery<HTMLElement>} $navBar\n */\n extendNavBar($navBar) {}\n}\n","// @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","//@ts-check\nimport { createDIVPageLayer } from '../BookReader/PageContainer.js';\nimport { SelectionObserver } from '../BookReader/utils/SelectionObserver.js';\nimport { BookReaderPlugin } from '../BookReaderPlugin.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\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 extends BookReaderPlugin {\n 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\n /**@type {PromiseLike<JQuery<HTMLElement>|undefined>} */\n djvuPagesPromise = null;\n\n /** @type {Cache<{index: number, response: any}>} */\n 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 maxWordRendered = 2500;\n\n /**\n * @param {import('../BookReader.js').default} br\n */\n constructor(br) {\n super(br);\n // 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 /** Whether the book is right-to-left */\n this.rtl = this.br.pageProgression === 'rl';\n this.selectionObserver = new SelectionObserver('.BRtextLayer', this._onSelectionChange);\n }\n\n /** @override */\n init() {\n if (!this.options.enabled) return;\n\n this.loadData();\n\n this.selectionObserver.attach();\n new SelectionObserver('.BRtextLayer', (selectEvent) => {\n // Track how often selection is used\n if (selectEvent == 'started') {\n this.br._plugins.archiveAnalytics?.sendEvent('BookReader', 'SelectStart');\n\n // Set a class on the page to avoid hiding it when zooming/etc\n this.br.refs.$br.find('.BRpagecontainer--hasSelection').removeClass('BRpagecontainer--hasSelection');\n $(window.getSelection().anchorNode).closest('.BRpagecontainer').addClass('BRpagecontainer--hasSelection');\n }\n }).attach();\n\n if (this.br.protected) {\n // Prevent right clicking when selected text\n $(document.body).on('contextmenu dragstart copy', (e) => {\n const selection = document.getSelection();\n if (selection?.toString()) {\n const intersectsTextLayer = $('.BRtextLayer')\n .toArray()\n .some(el => selection.containsNode(el, true));\n if (intersectsTextLayer) {\n e.preventDefault();\n return false;\n }\n }\n });\n }\n }\n\n /**\n * @override\n * @param {PageContainer} pageContainer\n * @returns {PageContainer}\n */\n _configurePageContainer(pageContainer) {\n // Disable if thumb mode; it's too janky\n // .page can be null for \"pre-cover\" region\n if (this.br.mode !== this.br.constModeThumb && pageContainer.page) {\n this.createTextLayer(pageContainer);\n }\n return pageContainer;\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 loadData() {\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.br.options.vars),\n dataType: this.options.jsonp ? \"jsonp\" : \"html\",\n cache: true,\n xhrFields: {\n withCredentials: this.br.protected,\n },\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.br.options.vars, { pageIndex: index }),\n dataType: this.options.jsonp ? \"jsonp\" : \"html\",\n cache: true,\n xhrFields: {\n withCredentials: this.br.protected,\n },\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\nBookReader?.registerPlugin('textSelection', TextSelectionPlugin);\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","/**\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 * @returns {StringWithVars|string}\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","'use strict';\nvar 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","'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":["BookReaderPlugin","br","_classCallCheck","this","options","key","value","Object","assign","pageContainer","$navBar","SelectionObserver","selector","handler","_this","_defineProperty","sel","window","getSelection","selecting","toString","target","$","anchorNode","closest","isCollapsed","document","addEventListener","_onSelectionChange","removeEventListener","genMap","_marked2","_regeneratorRuntime","mark","lookAroundWindow","_marked3","zip","_slicedToArray","r","e","Array","isArray","_arrayWithHoles","l","t","Symbol","iterator","n","i","u","a","f","o","call","next","done","push","length","return","_iterableToArrayLimit","_unsupportedIterableToArray","TypeError","_nonIterableRest","_createForOfIteratorHelper","_n","F","s","_arrayLikeToArray","slice","constructor","name","from","test","prototype","hasOwnProperty","defineProperty","c","asyncIterator","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","h","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","_typeof","resolve","__await","then","callInvokeWithMethodAndArg","Error","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","resultName","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","isNaN","displayName","isGeneratorFunction","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","stop","rval","handle","complete","finish","catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","arguments","apply","_next","_throw","_callSuper","_getPrototypeOf","ReferenceError","_assertThisInitialized","_possibleConstructorReturn","_isNativeReflectConstruct","Reflect","construct","Boolean","valueOf","bind","_setPrototypeOf","_toPropertyKey","_defineProperties","_createClass","toPrimitive","String","_toPrimitive","BookReader","Cache","maxSize","undefined","entries","entry","shift","TextSelectionPlugin","_BookReaderPlugin","enabled","fullDjvuXmlUrl","singlePageDjvuXmlUrl","jsonp","textSelectingMode","concat","defaultMode","rtl","pageProgression","selectionObserver","_inherits","_this2","loadData","attach","selectEvent","_this2$br$_plugins$ar","_plugins","archiveAnalytics","sendEvent","refs","$br","find","removeClass","addClass","protected","body","on","selection","toArray","some","el","containsNode","preventDefault","mode","constModeThumb","page","createTextLayer","djvuPagesPromise","ajax","url","applyVariables","vars","dataType","cache","xhrFields","withCredentials","error","res","xmlMap","parseXML","_getPageText","_callee","index","cachedEntry","xmlDoc","result","XMLpagesArr","_context","pageTextCache","x","response","pageIndex","add","t0","_x","$container","event","clipboardData","setData","textLayer","_this3","$pageContainer","style","pointerEvents","css","off","startedMouseDown","mouseIsDown","skipNextMouseup","is","stopPropagation","_this4","_this5","$textLayer","each","interceptCopy","_createTextLayer","_callee2","XMLpage","totalWords","ratioW","ratioH","ocrParagraphs","paragEls","paragraphRects","yAdded","_iterator","_step","_step$value","ocrParagraph","paragEl","ocrParagBounds","realRect","_ocrParagBounds","ocrLeft","ocrRight","ocrTop","newStartMargin","newTop","_this6","_context2","getPageText","recursivelyAddCoords","maxWordRendered","console","log","createDIVPageLayer","parseFloat","width","height","transform","setAttribute","map","renderParagraph","appendChild","determineRealRects","attr","split","get","right","left","top","marginTop","err","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","trim","endsWith","newLeft","firstWord","wordEl","space","createTextNode","hasHyphen","lastWordEl","children","sort","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","parentEl","initals","position","visibility","rects","Map","origRect","getBoundingClientRect","Rect","scrollX","scrollY","removeChild","gen","fn","_iterator7","_step7","_context3","_marked","cur","_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","registerPlugin","template","overrides","possibleFilters","APPLY_FILTERS","replace","$0","$1","_expression$split$map2","varName","filterNames","reduce","acc","urlencode","encodeURIComponent","PROPER_FUNCTION_NAME","fails","whitespaces","module","exports","METHOD_NAME","$trim","proto","forced","forcedStringTrimMethod"],"sourceRoot":""}
|