You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
214 KiB
1 lines
214 KiB
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 09b475804824f8ea6899","webpack:///web/pdfjs.js","webpack:///web/ui_utils.js","webpack:///web/dom_events.js","webpack:///web/pdf_link_service.js","webpack:///web/annotation_layer_builder.js","webpack:///web/pdf_page_view.js","webpack:///web/text_layer_builder.js","webpack:///web/pdf_rendering_queue.js","webpack:///web/download_manager.js","webpack:///web/pdf_find_controller.js","webpack:///web/pdf_history.js","webpack:///web/pdf_viewer.js","webpack:///web/pdf_viewer.component.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,cAAc;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;AChDA;;AAEoE;AAClE,MAAI;AAEJ,MAAI,OAAO,yBAAyB,aAAa;AAC/C,QAAI,OAAO,WAAW,eAAe,OAAO,yBAAyB;AACnE,iBAAW,OAAO;AADpB,eAEW,OAAO,YAAY,YAAY;AAItC,iBAAW,QAAQ;AAJhB,WAMA;AACL,YAAM,IAAI,MAAM;AAV6B;AAHiB;AAgBlE,SAAO,UAAU;;;;;;;;;;;;;;;ACnBG;;AAEtB,IAAI,YAAY,OAAO;AACvB,IAAI,sBAAsB;AAC1B,IAAI,gBAAgB;AACpB,IAAI,YAAY;AACh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BiB;QAw3Bf;QACA,sB;;;;;;;AC16BF;;AAEA,IAAI,WAAW,oBAAQ;AACvB,IAAI,oBAAoB,oBAAQ;AAChC,IAAI,sBAAsB,oBAAQ;AAClC,IAAI,yBAAyB,oBAAQ;AACrC,IAAI,2BAA2B,oBAAQ;AACvC,IAAI,iCAAiC,oBAAQ;AAC7C,IAAI,qBAAqB,oBAAQ;AACjC,IAAI,4BAA4B,oBAAQ;AACxC,IAAI,kBAAkB,oBAAQ;AAC9B,IAAI,0BAA0B,oBAAQ;AAEtC,IAAI,QAAQ,SAAS;AAErB,MAAM,YAAY,kBAAkB;AACpC,MAAM,cAAc,oBAAoB;AACxC,MAAM,iBAAiB,uBAAuB;AAC9C,MAAM,mBAAmB,yBAAyB;AAClD,MAAM,0BACJ,yBAAyB;AAC3B,MAAM,yBACJ,+BAA+B;AACjC,MAAM,gCACJ,+BAA+B;AACjC,MAAM,aAAa,mBAAmB;AACtC,MAAM,oBAAoB,0BAA0B;AACpD,MAAM,WAAW,gBAAgB;AAEjC,MAAM,kBAAkB,wBAAwB;AAChD,MAAM,cAAc,gBAAgB;AAEpC,QAAQ,QAAQ,M","file":"pdf_viewer.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"pdfjs-dist/web/pdf_viewer\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdfjs-dist/web/pdf_viewer\"] = factory();\n\telse\n\t\troot[\"pdfjs-dist/web/pdf_viewer\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __w_pdfjs_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__w_pdfjs_require__.m = modules;\n\n \t// expose the module cache\n \t__w_pdfjs_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__w_pdfjs_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__w_pdfjs_require__.d = function(exports, name, getter) {\n \t\tif(!__w_pdfjs_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__w_pdfjs_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__w_pdfjs_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__w_pdfjs_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __w_pdfjs_require__(__w_pdfjs_require__.s = 12);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 09b475804824f8ea6899","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals module, __pdfjsdev_webpack__ */\n\n'use strict';\n\nif (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('PRODUCTION')) {\n var pdfjsLib;\n // The if below protected by __pdfjsdev_webpack__ check from webpack parsing.\n if (typeof __pdfjsdev_webpack__ === 'undefined') {\n if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) {\n pdfjsLib = window['pdfjs-dist/build/pdf'];\n } else if (typeof require === 'function') {\n if (PDFJSDev.test('LIB')) {\n pdfjsLib = require('../pdf.js');\n } else {\n pdfjsLib = require('../build/pdf.js');\n }\n } else {\n throw new Error('Neither `require` nor `window` found');\n }\n }\n module.exports = pdfjsLib;\n} else {\n (function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n define('pdfjs-web/pdfjs', ['exports', 'pdfjs/main_loader'], factory);\n } else if (typeof exports !== 'undefined') {\n factory(exports, require('../src/main_loader.js'));\n } else {\n factory((root.pdfjsWebPDFJS = {}), root.pdfjsMainLoader);\n }\n }(this, function (exports, mainLoader) {\n // Re-export all mainLoader members.\n for (var i in mainLoader) {\n if (Object.prototype.hasOwnProperty.call(mainLoader, i)) {\n exports[i] = mainLoader[i];\n }\n }\n }));\n}\n\n\n\n// WEBPACK FOOTER //\n// web/pdfjs.js","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PDFJS } from './pdfjs';\n\nvar CSS_UNITS = 96.0 / 72.0;\nvar DEFAULT_SCALE_VALUE = 'auto';\nvar DEFAULT_SCALE = 1.0;\nvar MIN_SCALE = 0.25;\nvar MAX_SCALE = 10.0;\nvar UNKNOWN_SCALE = 0;\nvar MAX_AUTO_SCALE = 1.25;\nvar SCROLLBAR_PADDING = 40;\nvar VERTICAL_PADDING = 5;\n\nvar RendererType = {\n CANVAS: 'canvas',\n SVG: 'svg',\n};\n\nvar mozL10n = typeof document !== 'undefined' ?\n (document.mozL10n || document.webL10n) : undefined;\n\n/**\n * Disables fullscreen support, and by extension Presentation Mode,\n * in browsers which support the fullscreen API.\n * @var {boolean}\n */\nPDFJS.disableFullscreen = (PDFJS.disableFullscreen === undefined ?\n false : PDFJS.disableFullscreen);\n\n/**\n * Enables CSS only zooming.\n * @var {boolean}\n */\nPDFJS.useOnlyCssZoom = (PDFJS.useOnlyCssZoom === undefined ?\n false : PDFJS.useOnlyCssZoom);\n\n/**\n * The maximum supported canvas size in total pixels e.g. width * height.\n * The default value is 4096 * 4096. Use -1 for no limit.\n * @var {number}\n */\nPDFJS.maxCanvasPixels = (PDFJS.maxCanvasPixels === undefined ?\n 16777216 : PDFJS.maxCanvasPixels);\n\n/**\n * Disables saving of the last position of the viewed PDF.\n * @var {boolean}\n */\nPDFJS.disableHistory = (PDFJS.disableHistory === undefined ?\n false : PDFJS.disableHistory);\n\n/**\n * Disables creation of the text layer that used for text selection and search.\n * @var {boolean}\n */\nPDFJS.disableTextLayer = (PDFJS.disableTextLayer === undefined ?\n false : PDFJS.disableTextLayer);\n\n/**\n * Disables maintaining the current position in the document when zooming.\n */\nPDFJS.ignoreCurrentPositionOnZoom = (PDFJS.ignoreCurrentPositionOnZoom ===\n undefined ? false : PDFJS.ignoreCurrentPositionOnZoom);\n\nif (typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n /**\n * Interface locale settings.\n * @var {string}\n */\n PDFJS.locale =\n (PDFJS.locale === undefined && typeof navigator !== 'undefined' ?\n navigator.language : PDFJS.locale);\n}\n\n/**\n * Returns scale factor for the canvas. It makes sense for the HiDPI displays.\n * @return {Object} The object with horizontal (sx) and vertical (sy)\n scales. The scaled property is set to false if scaling is\n not required, true otherwise.\n */\nfunction getOutputScale(ctx) {\n var devicePixelRatio = window.devicePixelRatio || 1;\n var backingStoreRatio = ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio || 1;\n var pixelRatio = devicePixelRatio / backingStoreRatio;\n return {\n sx: pixelRatio,\n sy: pixelRatio,\n scaled: pixelRatio !== 1\n };\n}\n\n/**\n * Scrolls specified element into view of its parent.\n * @param {Object} element - The element to be visible.\n * @param {Object} spot - An object with optional top and left properties,\n * specifying the offset from the top left edge.\n * @param {boolean} skipOverflowHiddenElements - Ignore elements that have\n * the CSS rule `overflow: hidden;` set. The default is false.\n */\nfunction scrollIntoView(element, spot, skipOverflowHiddenElements) {\n // Assuming offsetParent is available (it's not available when viewer is in\n // hidden iframe or object). We have to scroll: if the offsetParent is not set\n // producing the error. See also animationStarted.\n var parent = element.offsetParent;\n if (!parent) {\n console.error('offsetParent is not set -- cannot scroll');\n return;\n }\n var checkOverflow = skipOverflowHiddenElements || false;\n var offsetY = element.offsetTop + element.clientTop;\n var offsetX = element.offsetLeft + element.clientLeft;\n while (parent.clientHeight === parent.scrollHeight ||\n (checkOverflow && getComputedStyle(parent).overflow === 'hidden')) {\n if (parent.dataset._scaleY) {\n offsetY /= parent.dataset._scaleY;\n offsetX /= parent.dataset._scaleX;\n }\n offsetY += parent.offsetTop;\n offsetX += parent.offsetLeft;\n parent = parent.offsetParent;\n if (!parent) {\n return; // no need to scroll\n }\n }\n if (spot) {\n if (spot.top !== undefined) {\n offsetY += spot.top;\n }\n if (spot.left !== undefined) {\n offsetX += spot.left;\n parent.scrollLeft = offsetX;\n }\n }\n parent.scrollTop = offsetY;\n}\n\n/**\n * Helper function to start monitoring the scroll event and converting them into\n * PDF.js friendly one: with scroll debounce and scroll direction.\n */\nfunction watchScroll(viewAreaElement, callback) {\n var debounceScroll = function debounceScroll(evt) {\n if (rAF) {\n return;\n }\n // schedule an invocation of scroll for next animation frame.\n rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {\n rAF = null;\n\n var currentY = viewAreaElement.scrollTop;\n var lastY = state.lastY;\n if (currentY !== lastY) {\n state.down = currentY > lastY;\n }\n state.lastY = currentY;\n callback(state);\n });\n };\n\n var state = {\n down: true,\n lastY: viewAreaElement.scrollTop,\n _eventHandler: debounceScroll\n };\n\n var rAF = null;\n viewAreaElement.addEventListener('scroll', debounceScroll, true);\n return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value&parm2=...).\n */\nfunction parseQueryString(query) {\n var parts = query.split('&');\n var params = {};\n for (var i = 0, ii = parts.length; i < ii; ++i) {\n var param = parts[i].split('=');\n var key = param[0].toLowerCase();\n var value = param.length > 1 ? param[1] : null;\n params[decodeURIComponent(key)] = decodeURIComponent(value);\n }\n return params;\n}\n\n/**\n * Use binary search to find the index of the first item in a given array which\n * passes a given condition. The items are expected to be sorted in the sense\n * that if the condition is true for one item in the array, then it is also true\n * for all following items.\n *\n * @returns {Number} Index of the first array element to pass the test,\n * or |items.length| if no such element exists.\n */\nfunction binarySearchFirstItem(items, condition) {\n var minIndex = 0;\n var maxIndex = items.length - 1;\n\n if (items.length === 0 || !condition(items[maxIndex])) {\n return items.length;\n }\n if (condition(items[minIndex])) {\n return minIndex;\n }\n\n while (minIndex < maxIndex) {\n var currentIndex = (minIndex + maxIndex) >> 1;\n var currentItem = items[currentIndex];\n if (condition(currentItem)) {\n maxIndex = currentIndex;\n } else {\n minIndex = currentIndex + 1;\n }\n }\n return minIndex; /* === maxIndex */\n}\n\n/**\n * Approximates float number as a fraction using Farey sequence (max order\n * of 8).\n * @param {number} x - Positive float number.\n * @returns {Array} Estimated fraction: the first array item is a numerator,\n * the second one is a denominator.\n */\nfunction approximateFraction(x) {\n // Fast paths for int numbers or their inversions.\n if (Math.floor(x) === x) {\n return [x, 1];\n }\n var xinv = 1 / x;\n var limit = 8;\n if (xinv > limit) {\n return [1, limit];\n } else if (Math.floor(xinv) === xinv) {\n return [1, xinv];\n }\n\n var x_ = x > 1 ? xinv : x;\n // a/b and c/d are neighbours in Farey sequence.\n var a = 0, b = 1, c = 1, d = 1;\n // Limiting search to order 8.\n while (true) {\n // Generating next term in sequence (order of q).\n var p = a + c, q = b + d;\n if (q > limit) {\n break;\n }\n if (x_ <= p / q) {\n c = p; d = q;\n } else {\n a = p; b = q;\n }\n }\n var result;\n // Select closest of the neighbours to x.\n if (x_ - a / b < c / d - x_) {\n result = x_ === x ? [a, b] : [b, a];\n } else {\n result = x_ === x ? [c, d] : [d, c];\n }\n return result;\n}\n\nfunction roundToDivide(x, div) {\n var r = x % div;\n return r === 0 ? x : Math.round(x - r + div);\n}\n\n/**\n * Generic helper to find out what elements are visible within a scroll pane.\n */\nfunction getVisibleElements(scrollEl, views, sortByVisibility) {\n var top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight;\n var left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth;\n\n function isElementBottomBelowViewTop(view) {\n var element = view.div;\n var elementBottom =\n element.offsetTop + element.clientTop + element.clientHeight;\n return elementBottom > top;\n }\n\n var visible = [], view, element;\n var currentHeight, viewHeight, hiddenHeight, percentHeight;\n var currentWidth, viewWidth;\n var firstVisibleElementInd = (views.length === 0) ? 0 :\n binarySearchFirstItem(views, isElementBottomBelowViewTop);\n\n for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) {\n view = views[i];\n element = view.div;\n currentHeight = element.offsetTop + element.clientTop;\n viewHeight = element.clientHeight;\n\n if (currentHeight > bottom) {\n break;\n }\n\n currentWidth = element.offsetLeft + element.clientLeft;\n viewWidth = element.clientWidth;\n if (currentWidth + viewWidth < left || currentWidth > right) {\n continue;\n }\n hiddenHeight = Math.max(0, top - currentHeight) +\n Math.max(0, currentHeight + viewHeight - bottom);\n percentHeight = ((viewHeight - hiddenHeight) * 100 / viewHeight) | 0;\n\n visible.push({\n id: view.id,\n x: currentWidth,\n y: currentHeight,\n view,\n percent: percentHeight\n });\n }\n\n var first = visible[0];\n var last = visible[visible.length - 1];\n\n if (sortByVisibility) {\n visible.sort(function(a, b) {\n var pc = a.percent - b.percent;\n if (Math.abs(pc) > 0.001) {\n return -pc;\n }\n return a.id - b.id; // ensure stability\n });\n }\n return { first, last, views: visible, };\n}\n\n/**\n * Event handler to suppress context menu.\n */\nfunction noContextMenuHandler(e) {\n e.preventDefault();\n}\n\nfunction isDataSchema(url) {\n var i = 0, ii = url.length;\n while (i < ii && url[i].trim() === '') {\n i++;\n }\n return url.substr(i, 5).toLowerCase() === 'data:';\n}\n\n/**\n * Returns the filename or guessed filename from the url (see issue 3455).\n * @param {string} url - The original PDF location.\n * @param {string} defaultFilename - The value returned if the filename is\n * unknown, or the protocol is unsupported.\n * @returns {string} Guessed PDF filename.\n */\nfunction getPDFFileNameFromURL(url, defaultFilename = 'document.pdf') {\n if (isDataSchema(url)) {\n console.warn('getPDFFileNameFromURL: ' +\n 'ignoring \"data:\" URL for performance reasons.');\n return defaultFilename;\n }\n var reURI = /^(?:(?:[^:]+:)?\\/\\/[^\\/]+)?([^?#]*)(\\?[^#]*)?(#.*)?$/;\n // SCHEME HOST 1.PATH 2.QUERY 3.REF\n // Pattern to get last matching NAME.pdf\n var reFilename = /[^\\/?#=]+\\.pdf\\b(?!.*\\.pdf\\b)/i;\n var splitURI = reURI.exec(url);\n var suggestedFilename = reFilename.exec(splitURI[1]) ||\n reFilename.exec(splitURI[2]) ||\n reFilename.exec(splitURI[3]);\n if (suggestedFilename) {\n suggestedFilename = suggestedFilename[0];\n if (suggestedFilename.indexOf('%') !== -1) {\n // URL-encoded %2Fpath%2Fto%2Ffile.pdf should be file.pdf\n try {\n suggestedFilename =\n reFilename.exec(decodeURIComponent(suggestedFilename))[0];\n } catch (e) { // Possible (extremely rare) errors:\n // URIError \"Malformed URI\", e.g. for \"%AA.pdf\"\n // TypeError \"null has no properties\", e.g. for \"%2F.pdf\"\n }\n }\n }\n return suggestedFilename || defaultFilename;\n}\n\nfunction normalizeWheelEventDelta(evt) {\n var delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY);\n var angle = Math.atan2(evt.deltaY, evt.deltaX);\n if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {\n // All that is left-up oriented has to change the sign.\n delta = -delta;\n }\n\n var MOUSE_DOM_DELTA_PIXEL_MODE = 0;\n var MOUSE_DOM_DELTA_LINE_MODE = 1;\n var MOUSE_PIXELS_PER_LINE = 30;\n var MOUSE_LINES_PER_PAGE = 30;\n\n // Converts delta to per-page units\n if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {\n delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;\n } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {\n delta /= MOUSE_LINES_PER_PAGE;\n }\n return delta;\n}\n\nfunction cloneObj(obj) {\n var result = {};\n for (var i in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, i)) {\n result[i] = obj[i];\n }\n }\n return result;\n}\n\n/**\n * Promise that is resolved when DOM window becomes visible.\n */\nvar animationStarted = new Promise(function (resolve) {\n window.requestAnimationFrame(resolve);\n});\n\n/**\n * Promise that is resolved when UI localization is finished.\n */\nvar localized = new Promise(function (resolve, reject) {\n if (!mozL10n) {\n // Resolve as localized even if mozL10n is not available.\n resolve();\n return;\n }\n if (mozL10n.getReadyState() !== 'loading') {\n resolve();\n return;\n }\n window.addEventListener('localized', function localized(evt) {\n resolve();\n });\n});\n\n/**\n * Simple event bus for an application. Listeners are attached using the\n * `on` and `off` methods. To raise an event, the `dispatch` method shall be\n * used.\n */\nvar EventBus = (function EventBusClosure() {\n function EventBus() {\n this._listeners = Object.create(null);\n }\n EventBus.prototype = {\n on: function EventBus_on(eventName, listener) {\n var eventListeners = this._listeners[eventName];\n if (!eventListeners) {\n eventListeners = [];\n this._listeners[eventName] = eventListeners;\n }\n eventListeners.push(listener);\n },\n off: function EventBus_on(eventName, listener) {\n var eventListeners = this._listeners[eventName];\n var i;\n if (!eventListeners || ((i = eventListeners.indexOf(listener)) < 0)) {\n return;\n }\n eventListeners.splice(i, 1);\n },\n dispatch: function EventBus_dispath(eventName) {\n var eventListeners = this._listeners[eventName];\n if (!eventListeners || eventListeners.length === 0) {\n return;\n }\n // Passing all arguments after the eventName to the listeners.\n var args = Array.prototype.slice.call(arguments, 1);\n // Making copy of the listeners array in case if it will be modified\n // during dispatch.\n eventListeners.slice(0).forEach(function (listener) {\n listener.apply(null, args);\n });\n }\n };\n return EventBus;\n})();\n\nvar ProgressBar = (function ProgressBarClosure() {\n\n function clamp(v, min, max) {\n return Math.min(Math.max(v, min), max);\n }\n\n function ProgressBar(id, opts) {\n this.visible = true;\n\n // Fetch the sub-elements for later.\n this.div = document.querySelector(id + ' .progress');\n\n // Get the loading bar element, so it can be resized to fit the viewer.\n this.bar = this.div.parentNode;\n\n // Get options, with sensible defaults.\n this.height = opts.height || 100;\n this.width = opts.width || 100;\n this.units = opts.units || '%';\n\n // Initialize heights.\n this.div.style.height = this.height + this.units;\n this.percent = 0;\n }\n\n ProgressBar.prototype = {\n\n updateBar: function ProgressBar_updateBar() {\n if (this._indeterminate) {\n this.div.classList.add('indeterminate');\n this.div.style.width = this.width + this.units;\n return;\n }\n\n this.div.classList.remove('indeterminate');\n var progressSize = this.width * this._percent / 100;\n this.div.style.width = progressSize + this.units;\n },\n\n get percent() {\n return this._percent;\n },\n\n set percent(val) {\n this._indeterminate = isNaN(val);\n this._percent = clamp(val, 0, 100);\n this.updateBar();\n },\n\n setWidth: function ProgressBar_setWidth(viewer) {\n if (viewer) {\n var container = viewer.parentNode;\n var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;\n if (scrollbarWidth > 0) {\n this.bar.setAttribute('style', 'width: calc(100% - ' +\n scrollbarWidth + 'px);');\n }\n }\n },\n\n hide: function ProgressBar_hide() {\n if (!this.visible) {\n return;\n }\n this.visible = false;\n this.bar.classList.add('hidden');\n document.body.classList.remove('loadingInProgress');\n },\n\n show: function ProgressBar_show() {\n if (this.visible) {\n return;\n }\n this.visible = true;\n document.body.classList.add('loadingInProgress');\n this.bar.classList.remove('hidden');\n }\n };\n\n return ProgressBar;\n})();\n\nexport {\n CSS_UNITS,\n DEFAULT_SCALE_VALUE,\n DEFAULT_SCALE,\n MIN_SCALE,\n MAX_SCALE,\n UNKNOWN_SCALE,\n MAX_AUTO_SCALE,\n SCROLLBAR_PADDING,\n VERTICAL_PADDING,\n cloneObj,\n RendererType,\n mozL10n,\n EventBus,\n ProgressBar,\n getPDFFileNameFromURL,\n noContextMenuHandler,\n parseQueryString,\n getVisibleElements,\n roundToDivide,\n approximateFraction,\n getOutputScale,\n scrollIntoView,\n watchScroll,\n binarySearchFirstItem,\n normalizeWheelEventDelta,\n animationStarted,\n localized,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/ui_utils.js","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { EventBus } from './ui_utils';\n\n// Attaching to the application event bus to dispatch events to the DOM for\n// backwards viewer API compatibility.\nfunction attachDOMEventsToEventBus(eventBus) {\n eventBus.on('documentload', function () {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('documentload', true, true, {});\n window.dispatchEvent(event);\n });\n eventBus.on('pagerendered', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('pagerendered', true, true, {\n pageNumber: e.pageNumber,\n cssTransform: e.cssTransform,\n });\n e.source.div.dispatchEvent(event);\n });\n eventBus.on('textlayerrendered', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('textlayerrendered', true, true, {\n pageNumber: e.pageNumber\n });\n e.source.textLayerDiv.dispatchEvent(event);\n });\n eventBus.on('pagechange', function (e) {\n var event = document.createEvent('UIEvents');\n event.initUIEvent('pagechange', true, true, window, 0);\n event.pageNumber = e.pageNumber;\n e.source.container.dispatchEvent(event);\n });\n eventBus.on('pagesinit', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('pagesinit', true, true, null);\n e.source.container.dispatchEvent(event);\n });\n eventBus.on('pagesloaded', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('pagesloaded', true, true, {\n pagesCount: e.pagesCount\n });\n e.source.container.dispatchEvent(event);\n });\n eventBus.on('scalechange', function (e) {\n var event = document.createEvent('UIEvents');\n event.initUIEvent('scalechange', true, true, window, 0);\n event.scale = e.scale;\n event.presetValue = e.presetValue;\n e.source.container.dispatchEvent(event);\n });\n eventBus.on('updateviewarea', function (e) {\n var event = document.createEvent('UIEvents');\n event.initUIEvent('updateviewarea', true, true, window, 0);\n event.location = e.location;\n e.source.container.dispatchEvent(event);\n });\n eventBus.on('find', function (e) {\n if (e.source === window) {\n return; // event comes from FirefoxCom, no need to replicate\n }\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('find' + e.type, true, true, {\n query: e.query,\n phraseSearch: e.phraseSearch,\n caseSensitive: e.caseSensitive,\n highlightAll: e.highlightAll,\n findPrevious: e.findPrevious\n });\n window.dispatchEvent(event);\n });\n eventBus.on('attachmentsloaded', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('attachmentsloaded', true, true, {\n attachmentsCount: e.attachmentsCount\n });\n e.source.container.dispatchEvent(event);\n });\n eventBus.on('sidebarviewchanged', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('sidebarviewchanged', true, true, {\n view: e.view,\n });\n e.source.outerContainer.dispatchEvent(event);\n });\n eventBus.on('pagemode', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('pagemode', true, true, {\n mode: e.mode,\n });\n e.source.pdfViewer.container.dispatchEvent(event);\n });\n eventBus.on('namedaction', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('namedaction', true, true, {\n action: e.action\n });\n e.source.pdfViewer.container.dispatchEvent(event);\n });\n eventBus.on('presentationmodechanged', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('presentationmodechanged', true, true, {\n active: e.active,\n switchInProgress: e.switchInProgress\n });\n window.dispatchEvent(event);\n });\n eventBus.on('outlineloaded', function (e) {\n var event = document.createEvent('CustomEvent');\n event.initCustomEvent('outlineloaded', true, true, {\n outlineCount: e.outlineCount\n });\n e.source.container.dispatchEvent(event);\n });\n}\n\nvar globalEventBus = null;\nfunction getGlobalEventBus() {\n if (globalEventBus) {\n return globalEventBus;\n }\n globalEventBus = new EventBus();\n attachDOMEventsToEventBus(globalEventBus);\n return globalEventBus;\n}\n\nexport {\n attachDOMEventsToEventBus,\n getGlobalEventBus,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/dom_events.js","/* Copyright 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getGlobalEventBus } from './dom_events';\nimport { parseQueryString } from './ui_utils';\n\nvar PageNumberRegExp = /^\\d+$/;\nfunction isPageNumber(str) {\n return PageNumberRegExp.test(str);\n}\n\n/**\n * @typedef {Object} PDFLinkServiceOptions\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * Performs navigation functions inside PDF, such as opening specified page,\n * or destination.\n * @class\n * @implements {IPDFLinkService}\n */\nvar PDFLinkService = (function PDFLinkServiceClosure() {\n /**\n * @constructs PDFLinkService\n * @param {PDFLinkServiceOptions} options\n */\n function PDFLinkService(options) {\n options = options || {};\n this.eventBus = options.eventBus || getGlobalEventBus();\n this.baseUrl = null;\n this.pdfDocument = null;\n this.pdfViewer = null;\n this.pdfHistory = null;\n\n this._pagesRefCache = null;\n }\n\n PDFLinkService.prototype = {\n setDocument: function PDFLinkService_setDocument(pdfDocument, baseUrl) {\n this.baseUrl = baseUrl;\n this.pdfDocument = pdfDocument;\n this._pagesRefCache = Object.create(null);\n },\n\n setViewer: function PDFLinkService_setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n },\n\n setHistory: function PDFLinkService_setHistory(pdfHistory) {\n this.pdfHistory = pdfHistory;\n },\n\n /**\n * @returns {number}\n */\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n },\n\n /**\n * @returns {number}\n */\n get page() {\n return this.pdfViewer.currentPageNumber;\n },\n\n /**\n * @param {number} value\n */\n set page(value) {\n this.pdfViewer.currentPageNumber = value;\n },\n\n /**\n * @param dest - The PDF destination object.\n */\n navigateTo: function PDFLinkService_navigateTo(dest) {\n var destString = '';\n var self = this;\n\n var goToDestination = function(destRef) {\n // dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n var pageNumber;\n if (destRef instanceof Object) {\n pageNumber = self._cachedPageNumber(destRef);\n } else if ((destRef | 0) === destRef) { // Integer\n pageNumber = destRef + 1;\n } else {\n console.error('PDFLinkService_navigateTo: \"' + destRef +\n '\" is not a valid destination reference.');\n return;\n }\n\n if (pageNumber) {\n if (pageNumber < 1 || pageNumber > self.pagesCount) {\n console.error('PDFLinkService_navigateTo: \"' + pageNumber +\n '\" is a non-existent page number.');\n return;\n }\n self.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: dest,\n });\n\n if (self.pdfHistory) {\n // Update the browsing history.\n self.pdfHistory.push({\n dest,\n hash: destString,\n page: pageNumber\n });\n }\n } else {\n self.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {\n self.cachePageRef(pageIndex + 1, destRef);\n goToDestination(destRef);\n }).catch(function () {\n console.error('PDFLinkService_navigateTo: \"' + destRef +\n '\" is not a valid page reference.');\n return;\n });\n }\n };\n\n var destinationPromise;\n if (typeof dest === 'string') {\n destString = dest;\n destinationPromise = this.pdfDocument.getDestination(dest);\n } else {\n destinationPromise = Promise.resolve(dest);\n }\n destinationPromise.then(function(destination) {\n dest = destination;\n if (!(destination instanceof Array)) {\n console.error('PDFLinkService_navigateTo: \"' + destination +\n '\" is not a valid destination array.');\n return;\n }\n goToDestination(destination[0]);\n });\n },\n\n /**\n * @param dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash: function PDFLinkService_getDestinationHash(dest) {\n if (typeof dest === 'string') {\n // In practice, a named destination may contain only a number.\n // If that happens, use the '#nameddest=' form to avoid the link\n // redirecting to a page, instead of the correct destination.\n return this.getAnchorUrl(\n '#' + (isPageNumber(dest) ? 'nameddest=' : '') + escape(dest));\n }\n if (dest instanceof Array) {\n var str = JSON.stringify(dest);\n return this.getAnchorUrl('#' + escape(str));\n }\n return this.getAnchorUrl('');\n },\n\n /**\n * Prefix the full url on anchor links to make sure that links are resolved\n * relative to the current URL instead of the one defined in <base href>.\n * @param {String} anchor The anchor hash, including the #.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl: function PDFLinkService_getAnchorUrl(anchor) {\n return (this.baseUrl || '') + anchor;\n },\n\n /**\n * @param {string} hash\n */\n setHash: function PDFLinkService_setHash(hash) {\n var pageNumber, dest;\n if (hash.indexOf('=') >= 0) {\n var params = parseQueryString(hash);\n if ('search' in params) {\n this.eventBus.dispatch('findfromurlhash', {\n source: this,\n query: params['search'].replace(/\"/g, ''),\n phraseSearch: (params['phrase'] === 'true')\n });\n }\n // borrowing syntax from \"Parameters for Opening PDF Files\"\n if ('nameddest' in params) {\n if (this.pdfHistory) {\n this.pdfHistory.updateNextHashParam(params.nameddest);\n }\n this.navigateTo(params.nameddest);\n return;\n }\n if ('page' in params) {\n pageNumber = (params.page | 0) || 1;\n }\n if ('zoom' in params) {\n // Build the destination array.\n var zoomArgs = params.zoom.split(','); // scale,left,top\n var zoomArg = zoomArgs[0];\n var zoomArgNumber = parseFloat(zoomArg);\n\n if (zoomArg.indexOf('Fit') === -1) {\n // If the zoomArg is a number, it has to get divided by 100. If it's\n // a string, it should stay as it is.\n dest = [null, { name: 'XYZ' },\n zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null,\n zoomArgs.length > 2 ? (zoomArgs[2] | 0) : null,\n (zoomArgNumber ? zoomArgNumber / 100 : zoomArg)];\n } else {\n if (zoomArg === 'Fit' || zoomArg === 'FitB') {\n dest = [null, { name: zoomArg }];\n } else if ((zoomArg === 'FitH' || zoomArg === 'FitBH') ||\n (zoomArg === 'FitV' || zoomArg === 'FitBV')) {\n dest = [null, { name: zoomArg },\n zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null];\n } else if (zoomArg === 'FitR') {\n if (zoomArgs.length !== 5) {\n console.error('PDFLinkService_setHash: ' +\n 'Not enough parameters for \\'FitR\\'.');\n } else {\n dest = [null, { name: zoomArg },\n (zoomArgs[1] | 0), (zoomArgs[2] | 0),\n (zoomArgs[3] | 0), (zoomArgs[4] | 0)];\n }\n } else {\n console.error('PDFLinkService_setHash: \\'' + zoomArg +\n '\\' is not a valid zoom value.');\n }\n }\n }\n if (dest) {\n this.pdfViewer.scrollPageIntoView({\n pageNumber: pageNumber || this.page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n } else if (pageNumber) {\n this.page = pageNumber; // simple page\n }\n if ('pagemode' in params) {\n this.eventBus.dispatch('pagemode', {\n source: this,\n mode: params.pagemode\n });\n }\n } else { // Named (or explicit) destination.\n if ((typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) &&\n isPageNumber(hash) && hash <= this.pagesCount) {\n console.warn('PDFLinkService_setHash: specifying a page number ' +\n 'directly after the hash symbol (#) is deprecated, ' +\n 'please use the \"#page=' + hash + '\" form instead.');\n this.page = hash | 0;\n }\n\n dest = unescape(hash);\n try {\n dest = JSON.parse(dest);\n\n if (!(dest instanceof Array)) {\n // Avoid incorrectly rejecting a valid named destination, such as\n // e.g. \"4.3\" or \"true\", because `JSON.parse` converted its type.\n dest = dest.toString();\n }\n } catch (ex) {}\n\n if (typeof dest === 'string' || isValidExplicitDestination(dest)) {\n if (this.pdfHistory) {\n this.pdfHistory.updateNextHashParam(dest);\n }\n this.navigateTo(dest);\n return;\n }\n console.error('PDFLinkService_setHash: \\'' + unescape(hash) +\n '\\' is not a valid destination.');\n }\n },\n\n /**\n * @param {string} action\n */\n executeNamedAction: function PDFLinkService_executeNamedAction(action) {\n // See PDF reference, table 8.45 - Named action\n switch (action) {\n case 'GoBack':\n if (this.pdfHistory) {\n this.pdfHistory.back();\n }\n break;\n\n case 'GoForward':\n if (this.pdfHistory) {\n this.pdfHistory.forward();\n }\n break;\n\n case 'NextPage':\n if (this.page < this.pagesCount) {\n this.page++;\n }\n break;\n\n case 'PrevPage':\n if (this.page > 1) {\n this.page--;\n }\n break;\n\n case 'LastPage':\n this.page = this.pagesCount;\n break;\n\n case 'FirstPage':\n this.page = 1;\n break;\n\n default:\n break; // No action according to spec\n }\n\n this.eventBus.dispatch('namedaction', {\n source: this,\n action,\n });\n },\n\n /**\n * @param {Object} params\n */\n onFileAttachmentAnnotation(params = {}) {\n this.eventBus.dispatch('fileattachmentannotation', {\n source: this,\n id: params.id,\n filename: params.filename,\n content: params.content,\n });\n },\n\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef: function PDFLinkService_cachePageRef(pageNum, pageRef) {\n var refStr = pageRef.num + ' ' + pageRef.gen + ' R';\n this._pagesRefCache[refStr] = pageNum;\n },\n\n _cachedPageNumber: function PDFLinkService_cachedPageNumber(pageRef) {\n var refStr = pageRef.num + ' ' + pageRef.gen + ' R';\n return (this._pagesRefCache && this._pagesRefCache[refStr]) || null;\n },\n };\n\n function isValidExplicitDestination(dest) {\n if (!(dest instanceof Array)) {\n return false;\n }\n var destLength = dest.length, allowNull = true;\n if (destLength < 2) {\n return false;\n }\n var page = dest[0];\n if (!(typeof page === 'object' &&\n typeof page.num === 'number' && (page.num | 0) === page.num &&\n typeof page.gen === 'number' && (page.gen | 0) === page.gen) &&\n !(typeof page === 'number' && (page | 0) === page && page >= 0)) {\n return false;\n }\n var zoom = dest[1];\n if (!(typeof zoom === 'object' && typeof zoom.name === 'string')) {\n return false;\n }\n switch (zoom.name) {\n case 'XYZ':\n if (destLength !== 5) {\n return false;\n }\n break;\n case 'Fit':\n case 'FitB':\n return destLength === 2;\n case 'FitH':\n case 'FitBH':\n case 'FitV':\n case 'FitBV':\n if (destLength !== 3) {\n return false;\n }\n break;\n case 'FitR':\n if (destLength !== 6) {\n return false;\n }\n allowNull = false;\n break;\n default:\n return false;\n }\n for (var i = 2; i < destLength; i++) {\n var param = dest[i];\n if (!(typeof param === 'number' || (allowNull && param === null))) {\n return false;\n }\n }\n return true;\n }\n\n return PDFLinkService;\n})();\n\nvar SimpleLinkService = (function SimpleLinkServiceClosure() {\n function SimpleLinkService() {}\n\n SimpleLinkService.prototype = {\n /**\n * @returns {number}\n */\n get page() {\n return 0;\n },\n /**\n * @param {number} value\n */\n set page(value) {},\n /**\n * @param dest - The PDF destination object.\n */\n navigateTo(dest) {},\n /**\n * @param dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n return '#';\n },\n /**\n * @param hash - The PDF parameters/hash.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(hash) {\n return '#';\n },\n /**\n * @param {string} hash\n */\n setHash(hash) {},\n /**\n * @param {string} action\n */\n executeNamedAction(action) {},\n /**\n * @param {Object} params\n */\n onFileAttachmentAnnotation(params) {},\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {}\n };\n return SimpleLinkService;\n})();\n\nexport {\n PDFLinkService,\n SimpleLinkService,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_link_service.js","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AnnotationLayer } from './pdfjs';\nimport { mozL10n } from './ui_utils';\nimport { SimpleLinkService } from './pdf_link_service';\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPage} pdfPage\n * @property {boolean} renderInteractiveForms\n * @property {IPDFLinkService} linkService\n * @property {DownloadManager} downloadManager\n */\n\nclass AnnotationLayerBuilder {\n /**\n * @param {AnnotationLayerBuilderOptions} options\n */\n constructor(options) {\n this.pageDiv = options.pageDiv;\n this.pdfPage = options.pdfPage;\n this.renderInteractiveForms = options.renderInteractiveForms;\n this.linkService = options.linkService;\n this.downloadManager = options.downloadManager;\n\n this.div = null;\n }\n\n /**\n * @param {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n */\n render(viewport, intent = 'display') {\n this.pdfPage.getAnnotations({ intent, }).then((annotations) => {\n var parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n annotations,\n page: this.pdfPage,\n renderInteractiveForms: this.renderInteractiveForms,\n linkService: this.linkService,\n downloadManager: this.downloadManager,\n };\n\n if (this.div) {\n // If an annotationLayer already exists, refresh its children's\n // transformation matrices.\n AnnotationLayer.update(parameters);\n } else {\n // Create an annotation layer div and render the annotations\n // if there is at least one annotation.\n if (annotations.length === 0) {\n return;\n }\n\n this.div = document.createElement('div');\n this.div.className = 'annotationLayer';\n this.pageDiv.appendChild(this.div);\n parameters.div = this.div;\n\n AnnotationLayer.render(parameters);\n if (typeof mozL10n !== 'undefined') {\n mozL10n.translate(this.div);\n }\n }\n });\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.setAttribute('hidden', 'true');\n }\n}\n\n/**\n * @implements IPDFAnnotationLayerFactory\n */\nclass DefaultAnnotationLayerFactory {\n /**\n * @param {HTMLDivElement} pageDiv\n * @param {PDFPage} pdfPage\n * @param {boolean} renderInteractiveForms\n * @returns {AnnotationLayerBuilder}\n */\n createAnnotationLayerBuilder(pageDiv, pdfPage,\n renderInteractiveForms = false) {\n return new AnnotationLayerBuilder({\n pageDiv,\n pdfPage,\n renderInteractiveForms,\n linkService: new SimpleLinkService(),\n });\n }\n}\n\nexport {\n AnnotationLayerBuilder,\n DefaultAnnotationLayerFactory,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/annotation_layer_builder.js","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n approximateFraction, CSS_UNITS, DEFAULT_SCALE, getOutputScale, RendererType,\n roundToDivide\n} from './ui_utils';\nimport {\n createPromiseCapability, CustomStyle, PDFJS, RenderingCancelledException,\n SVGGraphics\n} from './pdfjs';\nimport { getGlobalEventBus } from './dom_events';\nimport { RenderingStates } from './pdf_rendering_queue';\n\nvar TEXT_LAYER_RENDER_DELAY = 200; // ms\n\n/**\n * @typedef {Object} PDFPageViewOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} id - The page unique ID (normally its number).\n * @property {number} scale - The page scale display.\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {IPDFTextLayerFactory} textLayerFactory\n * @property {IPDFAnnotationLayerFactory} annotationLayerFactory\n * @property {boolean} enhanceTextSelection - Turns on the text selection\n * enhancement. The default is `false`.\n * @property {boolean} renderInteractiveForms - Turns on rendering of\n * interactive form elements. The default is `false`.\n * @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.\n */\n\n/**\n * @class\n * @implements {IRenderableView}\n */\nvar PDFPageView = (function PDFPageViewClosure() {\n /**\n * @constructs PDFPageView\n * @param {PDFPageViewOptions} options\n */\n function PDFPageView(options) {\n var container = options.container;\n var id = options.id;\n var scale = options.scale;\n var defaultViewport = options.defaultViewport;\n var renderingQueue = options.renderingQueue;\n var textLayerFactory = options.textLayerFactory;\n var annotationLayerFactory = options.annotationLayerFactory;\n var enhanceTextSelection = options.enhanceTextSelection || false;\n var renderInteractiveForms = options.renderInteractiveForms || false;\n\n this.id = id;\n this.renderingId = 'page' + id;\n this.pageLabel = null;\n\n this.rotation = 0;\n this.scale = scale || DEFAULT_SCALE;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this.hasRestrictedScaling = false;\n this.enhanceTextSelection = enhanceTextSelection;\n this.renderInteractiveForms = renderInteractiveForms;\n\n this.eventBus = options.eventBus || getGlobalEventBus();\n this.renderingQueue = renderingQueue;\n this.textLayerFactory = textLayerFactory;\n this.annotationLayerFactory = annotationLayerFactory;\n this.renderer = options.renderer || RendererType.CANVAS;\n\n this.paintTask = null;\n this.paintedViewportMap = new WeakMap();\n this.renderingState = RenderingStates.INITIAL;\n this.resume = null;\n this.error = null;\n\n this.onBeforeDraw = null;\n this.onAfterDraw = null;\n\n this.textLayer = null;\n\n this.zoomLayer = null;\n\n this.annotationLayer = null;\n\n var div = document.createElement('div');\n div.className = 'page';\n div.style.width = Math.floor(this.viewport.width) + 'px';\n div.style.height = Math.floor(this.viewport.height) + 'px';\n div.setAttribute('data-page-number', this.id);\n this.div = div;\n\n container.appendChild(div);\n }\n\n PDFPageView.prototype = {\n setPdfPage: function PDFPageView_setPdfPage(pdfPage) {\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\n var totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = pdfPage.getViewport(this.scale * CSS_UNITS,\n totalRotation);\n this.stats = pdfPage.stats;\n this.reset();\n },\n\n destroy: function PDFPageView_destroy() {\n this.reset();\n if (this.pdfPage) {\n this.pdfPage.cleanup();\n }\n },\n\n /**\n * @private\n */\n _resetZoomLayer(removeFromDOM = false) {\n if (!this.zoomLayer) {\n return;\n }\n var zoomLayerCanvas = this.zoomLayer.firstChild;\n this.paintedViewportMap.delete(zoomLayerCanvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n zoomLayerCanvas.width = 0;\n zoomLayerCanvas.height = 0;\n\n if (removeFromDOM) {\n // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n this.zoomLayer.remove();\n }\n this.zoomLayer = null;\n },\n\n reset: function PDFPageView_reset(keepZoomLayer, keepAnnotations) {\n this.cancelRendering();\n\n var div = this.div;\n div.style.width = Math.floor(this.viewport.width) + 'px';\n div.style.height = Math.floor(this.viewport.height) + 'px';\n\n var childNodes = div.childNodes;\n var currentZoomLayerNode = (keepZoomLayer && this.zoomLayer) || null;\n var currentAnnotationNode = (keepAnnotations && this.annotationLayer &&\n this.annotationLayer.div) || null;\n for (var i = childNodes.length - 1; i >= 0; i--) {\n var node = childNodes[i];\n if (currentZoomLayerNode === node || currentAnnotationNode === node) {\n continue;\n }\n div.removeChild(node);\n }\n div.removeAttribute('data-loaded');\n\n if (currentAnnotationNode) {\n // Hide annotationLayer until all elements are resized\n // so they are not displayed on the already-resized page\n this.annotationLayer.hide();\n } else {\n this.annotationLayer = null;\n }\n\n if (!currentZoomLayerNode) {\n if (this.canvas) {\n this.paintedViewportMap.delete(this.canvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n this.canvas.width = 0;\n this.canvas.height = 0;\n delete this.canvas;\n }\n this._resetZoomLayer();\n }\n if (this.svg) {\n this.paintedViewportMap.delete(this.svg);\n delete this.svg;\n }\n\n this.loadingIconDiv = document.createElement('div');\n this.loadingIconDiv.className = 'loadingIcon';\n div.appendChild(this.loadingIconDiv);\n },\n\n update: function PDFPageView_update(scale, rotation) {\n this.scale = scale || this.scale;\n\n if (typeof rotation !== 'undefined') {\n this.rotation = rotation;\n }\n\n var totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: this.scale * CSS_UNITS,\n rotation: totalRotation\n });\n\n if (this.svg) {\n this.cssTransform(this.svg, true);\n\n this.eventBus.dispatch('pagerendered', {\n source: this,\n pageNumber: this.id,\n cssTransform: true,\n });\n return;\n }\n\n var isScalingRestricted = false;\n if (this.canvas && PDFJS.maxCanvasPixels > 0) {\n var outputScale = this.outputScale;\n if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) *\n ((Math.floor(this.viewport.height) * outputScale.sy) | 0) >\n PDFJS.maxCanvasPixels) {\n isScalingRestricted = true;\n }\n }\n\n if (this.canvas) {\n if (PDFJS.useOnlyCssZoom ||\n (this.hasRestrictedScaling && isScalingRestricted)) {\n this.cssTransform(this.canvas, true);\n\n this.eventBus.dispatch('pagerendered', {\n source: this,\n pageNumber: this.id,\n cssTransform: true,\n });\n return;\n }\n if (!this.zoomLayer) {\n this.zoomLayer = this.canvas.parentNode;\n this.zoomLayer.style.position = 'absolute';\n }\n }\n if (this.zoomLayer) {\n this.cssTransform(this.zoomLayer.firstChild);\n }\n this.reset(/* keepZoomLayer = */ true, /* keepAnnotations = */ true);\n },\n\n cancelRendering: function PDFPageView_cancelRendering() {\n if (this.paintTask) {\n this.paintTask.cancel();\n this.paintTask = null;\n }\n this.renderingState = RenderingStates.INITIAL;\n this.resume = null;\n\n if (this.textLayer) {\n this.textLayer.cancel();\n this.textLayer = null;\n }\n },\n\n /**\n * Called when moved in the parent's container.\n */\n updatePosition: function PDFPageView_updatePosition() {\n if (this.textLayer) {\n this.textLayer.render(TEXT_LAYER_RENDER_DELAY);\n }\n },\n\n cssTransform: function PDFPageView_transform(target, redrawAnnotations) {\n // Scale target (canvas or svg), its wrapper, and page container.\n var width = this.viewport.width;\n var height = this.viewport.height;\n var div = this.div;\n target.style.width = target.parentNode.style.width = div.style.width =\n Math.floor(width) + 'px';\n target.style.height = target.parentNode.style.height = div.style.height =\n Math.floor(height) + 'px';\n // The canvas may have been originally rotated, rotate relative to that.\n var relativeRotation = this.viewport.rotation -\n this.paintedViewportMap.get(target).rotation;\n var absRotation = Math.abs(relativeRotation);\n var scaleX = 1, scaleY = 1;\n if (absRotation === 90 || absRotation === 270) {\n // Scale x and y because of the rotation.\n scaleX = height / width;\n scaleY = width / height;\n }\n var cssTransform = 'rotate(' + relativeRotation + 'deg) ' +\n 'scale(' + scaleX + ',' + scaleY + ')';\n CustomStyle.setProp('transform', target, cssTransform);\n\n if (this.textLayer) {\n // Rotating the text layer is more complicated since the divs inside the\n // the text layer are rotated.\n // TODO: This could probably be simplified by drawing the text layer in\n // one orientation then rotating overall.\n var textLayerViewport = this.textLayer.viewport;\n var textRelativeRotation = this.viewport.rotation -\n textLayerViewport.rotation;\n var textAbsRotation = Math.abs(textRelativeRotation);\n var scale = width / textLayerViewport.width;\n if (textAbsRotation === 90 || textAbsRotation === 270) {\n scale = width / textLayerViewport.height;\n }\n var textLayerDiv = this.textLayer.textLayerDiv;\n var transX, transY;\n switch (textAbsRotation) {\n case 0:\n transX = transY = 0;\n break;\n case 90:\n transX = 0;\n transY = '-' + textLayerDiv.style.height;\n break;\n case 180:\n transX = '-' + textLayerDiv.style.width;\n transY = '-' + textLayerDiv.style.height;\n break;\n case 270:\n transX = '-' + textLayerDiv.style.width;\n transY = 0;\n break;\n default:\n console.error('Bad rotation value.');\n break;\n }\n CustomStyle.setProp('transform', textLayerDiv,\n 'rotate(' + textAbsRotation + 'deg) ' +\n 'scale(' + scale + ', ' + scale + ') ' +\n 'translate(' + transX + ', ' + transY + ')');\n CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%');\n }\n\n if (redrawAnnotations && this.annotationLayer) {\n this.annotationLayer.render(this.viewport, 'display');\n }\n },\n\n get width() {\n return this.viewport.width;\n },\n\n get height() {\n return this.viewport.height;\n },\n\n getPagePoint: function PDFPageView_getPagePoint(x, y) {\n return this.viewport.convertToPdfPoint(x, y);\n },\n\n draw: function PDFPageView_draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error('Must be in new state before drawing');\n this.reset(); // Ensure that we reset all state to prevent issues.\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n var self = this;\n var pdfPage = this.pdfPage;\n var div = this.div;\n // Wrap the canvas so if it has a css transform for highdpi the overflow\n // will be hidden in FF.\n var canvasWrapper = document.createElement('div');\n canvasWrapper.style.width = div.style.width;\n canvasWrapper.style.height = div.style.height;\n canvasWrapper.classList.add('canvasWrapper');\n\n if (this.annotationLayer && this.annotationLayer.div) {\n // annotationLayer needs to stay on top\n div.insertBefore(canvasWrapper, this.annotationLayer.div);\n } else {\n div.appendChild(canvasWrapper);\n }\n\n var textLayerDiv = null;\n var textLayer = null;\n if (this.textLayerFactory) {\n textLayerDiv = document.createElement('div');\n textLayerDiv.className = 'textLayer';\n textLayerDiv.style.width = canvasWrapper.style.width;\n textLayerDiv.style.height = canvasWrapper.style.height;\n if (this.annotationLayer && this.annotationLayer.div) {\n // annotationLayer needs to stay on top\n div.insertBefore(textLayerDiv, this.annotationLayer.div);\n } else {\n div.appendChild(textLayerDiv);\n }\n\n textLayer = this.textLayerFactory.\n createTextLayerBuilder(textLayerDiv, this.id - 1, this.viewport,\n this.enhanceTextSelection);\n }\n this.textLayer = textLayer;\n\n var renderContinueCallback = null;\n if (this.renderingQueue) {\n renderContinueCallback = function renderContinueCallback(cont) {\n if (!self.renderingQueue.isHighestPriority(self)) {\n self.renderingState = RenderingStates.PAUSED;\n self.resume = function resumeCallback() {\n self.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n }\n\n var finishPaintTask = function finishPaintTask(error) {\n // The paintTask may have been replaced by a new one, so only remove\n // the reference to the paintTask if it matches the one that is\n // triggering this callback.\n if (paintTask === self.paintTask) {\n self.paintTask = null;\n }\n\n if (((typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('PDFJS_NEXT')) && error === 'cancelled') ||\n error instanceof RenderingCancelledException) {\n self.error = null;\n return Promise.resolve(undefined);\n }\n\n self.renderingState = RenderingStates.FINISHED;\n\n if (self.loadingIconDiv) {\n div.removeChild(self.loadingIconDiv);\n delete self.loadingIconDiv;\n }\n self._resetZoomLayer(/* removeFromDOM = */ true);\n\n self.error = error;\n self.stats = pdfPage.stats;\n if (self.onAfterDraw) {\n self.onAfterDraw();\n }\n self.eventBus.dispatch('pagerendered', {\n source: self,\n pageNumber: self.id,\n cssTransform: false,\n });\n\n if (error) {\n return Promise.reject(error);\n }\n return Promise.resolve(undefined);\n };\n\n var paintTask = this.renderer === RendererType.SVG ?\n this.paintOnSvg(canvasWrapper) :\n this.paintOnCanvas(canvasWrapper);\n paintTask.onRenderContinue = renderContinueCallback;\n this.paintTask = paintTask;\n\n var resultPromise = paintTask.promise.then(function () {\n return finishPaintTask(null).then(function () {\n if (textLayer) {\n pdfPage.getTextContent({\n normalizeWhitespace: true,\n }).then(function textContentResolved(textContent) {\n textLayer.setTextContent(textContent);\n textLayer.render(TEXT_LAYER_RENDER_DELAY);\n });\n }\n });\n }, function (reason) {\n return finishPaintTask(reason);\n });\n\n if (this.annotationLayerFactory) {\n if (!this.annotationLayer) {\n this.annotationLayer = this.annotationLayerFactory.\n createAnnotationLayerBuilder(div, pdfPage,\n this.renderInteractiveForms);\n }\n this.annotationLayer.render(this.viewport, 'display');\n }\n div.setAttribute('data-loaded', true);\n\n if (this.onBeforeDraw) {\n this.onBeforeDraw();\n }\n return resultPromise;\n },\n\n paintOnCanvas(canvasWrapper) {\n var renderCapability = createPromiseCapability();\n\n var result = {\n promise: renderCapability.promise,\n onRenderContinue(cont) {\n cont();\n },\n cancel() {\n renderTask.cancel();\n }\n };\n\n var viewport = this.viewport;\n var canvas = document.createElement('canvas');\n canvas.id = 'page' + this.id;\n // Keep the canvas hidden until the first draw callback, or until drawing\n // is complete when `!this.renderingQueue`, to prevent black flickering.\n canvas.setAttribute('hidden', 'hidden');\n var isCanvasHidden = true;\n var showCanvas = function () {\n if (isCanvasHidden) {\n canvas.removeAttribute('hidden');\n isCanvasHidden = false;\n }\n };\n\n canvasWrapper.appendChild(canvas);\n this.canvas = canvas;\n\n if (typeof PDFJSDev === 'undefined' ||\n PDFJSDev.test('MOZCENTRAL || FIREFOX || GENERIC')) {\n canvas.mozOpaque = true;\n }\n\n var ctx = canvas.getContext('2d', {alpha: false});\n var outputScale = getOutputScale(ctx);\n this.outputScale = outputScale;\n\n if (PDFJS.useOnlyCssZoom) {\n var actualSizeViewport = viewport.clone({scale: CSS_UNITS});\n // Use a scale that will make the canvas be the original intended size\n // of the page.\n outputScale.sx *= actualSizeViewport.width / viewport.width;\n outputScale.sy *= actualSizeViewport.height / viewport.height;\n outputScale.scaled = true;\n }\n\n if (PDFJS.maxCanvasPixels > 0) {\n var pixelsInViewport = viewport.width * viewport.height;\n var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);\n if (outputScale.sx > maxScale || outputScale.sy > maxScale) {\n outputScale.sx = maxScale;\n outputScale.sy = maxScale;\n outputScale.scaled = true;\n this.hasRestrictedScaling = true;\n } else {\n this.hasRestrictedScaling = false;\n }\n }\n\n var sfx = approximateFraction(outputScale.sx);\n var sfy = approximateFraction(outputScale.sy);\n canvas.width = roundToDivide(viewport.width * outputScale.sx, sfx[0]);\n canvas.height = roundToDivide(viewport.height * outputScale.sy, sfy[0]);\n canvas.style.width = roundToDivide(viewport.width, sfx[1]) + 'px';\n canvas.style.height = roundToDivide(viewport.height, sfy[1]) + 'px';\n // Add the viewport so it's known what it was originally drawn with.\n this.paintedViewportMap.set(canvas, viewport);\n\n // Rendering area\n var transform = !outputScale.scaled ? null :\n [outputScale.sx, 0, 0, outputScale.sy, 0, 0];\n var renderContext = {\n canvasContext: ctx,\n transform,\n viewport: this.viewport,\n renderInteractiveForms: this.renderInteractiveForms,\n // intent: 'default', // === 'display'\n };\n var renderTask = this.pdfPage.render(renderContext);\n renderTask.onContinue = function (cont) {\n showCanvas();\n if (result.onRenderContinue) {\n result.onRenderContinue(cont);\n } else {\n cont();\n }\n };\n\n renderTask.promise.then(\n function pdfPageRenderCallback() {\n showCanvas();\n renderCapability.resolve(undefined);\n },\n function pdfPageRenderError(error) {\n showCanvas();\n renderCapability.reject(error);\n }\n );\n\n return result;\n },\n\n paintOnSvg: function PDFPageView_paintOnSvg(wrapper) {\n if (typeof PDFJSDev !== 'undefined' &&\n PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {\n // Return a mock object, to prevent errors such as e.g.\n // \"TypeError: paintTask.promise is undefined\".\n return {\n promise: Promise.reject(new Error('SVG rendering is not supported.')),\n onRenderContinue(cont) { },\n cancel() { },\n };\n }\n\n var cancelled = false;\n var ensureNotCancelled = function () {\n if (cancelled) {\n if ((typeof PDFJSDev !== 'undefined' &&\n PDFJSDev.test('PDFJS_NEXT')) || PDFJS.pdfjsNext) {\n throw new RenderingCancelledException(\n 'Rendering cancelled, page ' + self.id, 'svg');\n } else {\n throw 'cancelled'; // eslint-disable-line no-throw-literal\n }\n }\n };\n\n var self = this;\n var pdfPage = this.pdfPage;\n var actualSizeViewport = this.viewport.clone({scale: CSS_UNITS});\n var promise = pdfPage.getOperatorList().then(function (opList) {\n ensureNotCancelled();\n var svgGfx = new SVGGraphics(pdfPage.commonObjs, pdfPage.objs);\n return svgGfx.getSVG(opList, actualSizeViewport).then(function (svg) {\n ensureNotCancelled();\n self.svg = svg;\n self.paintedViewportMap.set(svg, actualSizeViewport);\n\n svg.style.width = wrapper.style.width;\n svg.style.height = wrapper.style.height;\n self.renderingState = RenderingStates.FINISHED;\n wrapper.appendChild(svg);\n });\n });\n\n return {\n promise,\n onRenderContinue(cont) {\n cont();\n },\n cancel() {\n cancelled = true;\n }\n };\n },\n\n /**\n * @param {string|null} label\n */\n setPageLabel: function PDFView_setPageLabel(label) {\n this.pageLabel = (typeof label === 'string' ? label : null);\n\n if (this.pageLabel !== null) {\n this.div.setAttribute('data-page-label', this.pageLabel);\n } else {\n this.div.removeAttribute('data-page-label');\n }\n },\n };\n\n return PDFPageView;\n})();\n\nexport {\n PDFPageView,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_page_view.js","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getGlobalEventBus } from './dom_events';\nimport { renderTextLayer } from './pdfjs';\n\nvar EXPAND_DIVS_TIMEOUT = 300; // ms\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {HTMLDivElement} textLayerDiv - The text layer container.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} pageIndex - The page index.\n * @property {PageViewport} viewport - The viewport of the text layer.\n * @property {PDFFindController} findController\n * @property {boolean} enhanceTextSelection - Option to turn on improved\n * text selection.\n */\n\n/**\n * TextLayerBuilder provides text-selection functionality for the PDF.\n * It does this by creating overlay divs over the PDF text. These divs\n * contain text that matches the PDF text they are overlaying. This object\n * also provides a way to highlight text that is being searched for.\n * @class\n */\nvar TextLayerBuilder = (function TextLayerBuilderClosure() {\n function TextLayerBuilder(options) {\n this.textLayerDiv = options.textLayerDiv;\n this.eventBus = options.eventBus || getGlobalEventBus();\n this.textContent = null;\n this.renderingDone = false;\n this.pageIdx = options.pageIndex;\n this.pageNumber = this.pageIdx + 1;\n this.matches = [];\n this.viewport = options.viewport;\n this.textDivs = [];\n this.findController = options.findController || null;\n this.textLayerRenderTask = null;\n this.enhanceTextSelection = options.enhanceTextSelection;\n this._bindMouse();\n }\n\n TextLayerBuilder.prototype = {\n /**\n * @private\n */\n _finishRendering: function TextLayerBuilder_finishRendering() {\n this.renderingDone = true;\n\n if (!this.enhanceTextSelection) {\n var endOfContent = document.createElement('div');\n endOfContent.className = 'endOfContent';\n this.textLayerDiv.appendChild(endOfContent);\n }\n\n this.eventBus.dispatch('textlayerrendered', {\n source: this,\n pageNumber: this.pageNumber,\n numTextDivs: this.textDivs.length,\n });\n },\n\n /**\n * Renders the text layer.\n * @param {number} timeout (optional) if specified, the rendering waits\n * for specified amount of ms.\n */\n render: function TextLayerBuilder_render(timeout) {\n if (!this.textContent || this.renderingDone) {\n return;\n }\n this.cancel();\n\n this.textDivs = [];\n var textLayerFrag = document.createDocumentFragment();\n this.textLayerRenderTask = renderTextLayer({\n textContent: this.textContent,\n container: textLayerFrag,\n viewport: this.viewport,\n textDivs: this.textDivs,\n timeout,\n enhanceTextSelection: this.enhanceTextSelection,\n });\n this.textLayerRenderTask.promise.then(() => {\n this.textLayerDiv.appendChild(textLayerFrag);\n this._finishRendering();\n this.updateMatches();\n }, function (reason) {\n // cancelled or failed to render text layer -- skipping errors\n });\n },\n\n /**\n * Cancels rendering of the text layer.\n */\n cancel: function TextLayerBuilder_cancel() {\n if (this.textLayerRenderTask) {\n this.textLayerRenderTask.cancel();\n this.textLayerRenderTask = null;\n }\n },\n\n setTextContent: function TextLayerBuilder_setTextContent(textContent) {\n this.cancel();\n this.textContent = textContent;\n },\n\n convertMatches: function TextLayerBuilder_convertMatches(matches,\n matchesLength) {\n var i = 0;\n var iIndex = 0;\n var bidiTexts = this.textContent.items;\n var end = bidiTexts.length - 1;\n var queryLen = (this.findController === null ?\n 0 : this.findController.state.query.length);\n var ret = [];\n if (!matches) {\n return ret;\n }\n for (var m = 0, len = matches.length; m < len; m++) {\n // Calculate the start position.\n var matchIdx = matches[m];\n\n // Loop over the divIdxs.\n while (i !== end && matchIdx >= (iIndex + bidiTexts[i].str.length)) {\n iIndex += bidiTexts[i].str.length;\n i++;\n }\n\n if (i === bidiTexts.length) {\n console.error('Could not find a matching mapping');\n }\n\n var match = {\n begin: {\n divIdx: i,\n offset: matchIdx - iIndex\n }\n };\n\n // Calculate the end position.\n if (matchesLength) { // multiterm search\n matchIdx += matchesLength[m];\n } else { // phrase search\n matchIdx += queryLen;\n }\n\n // Somewhat the same array as above, but use > instead of >= to get\n // the end position right.\n while (i !== end && matchIdx > (iIndex + bidiTexts[i].str.length)) {\n iIndex += bidiTexts[i].str.length;\n i++;\n }\n\n match.end = {\n divIdx: i,\n offset: matchIdx - iIndex\n };\n ret.push(match);\n }\n\n return ret;\n },\n\n renderMatches: function TextLayerBuilder_renderMatches(matches) {\n // Early exit if there is nothing to render.\n if (matches.length === 0) {\n return;\n }\n\n var bidiTexts = this.textContent.items;\n var textDivs = this.textDivs;\n var prevEnd = null;\n var pageIdx = this.pageIdx;\n var isSelectedPage = (this.findController === null ?\n false : (pageIdx === this.findController.selected.pageIdx));\n var selectedMatchIdx = (this.findController === null ?\n -1 : this.findController.selected.matchIdx);\n var highlightAll = (this.findController === null ?\n false : this.findController.state.highlightAll);\n var infinity = {\n divIdx: -1,\n offset: undefined\n };\n\n function beginText(begin, className) {\n var divIdx = begin.divIdx;\n textDivs[divIdx].textContent = '';\n appendTextToDiv(divIdx, 0, begin.offset, className);\n }\n\n function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n var div = textDivs[divIdx];\n var content = bidiTexts[divIdx].str.substring(fromOffset, toOffset);\n var node = document.createTextNode(content);\n if (className) {\n var span = document.createElement('span');\n span.className = className;\n span.appendChild(node);\n div.appendChild(span);\n return;\n }\n div.appendChild(node);\n }\n\n var i0 = selectedMatchIdx, i1 = i0 + 1;\n if (highlightAll) {\n i0 = 0;\n i1 = matches.length;\n } else if (!isSelectedPage) {\n // Not highlighting all and this isn't the selected page, so do nothing.\n return;\n }\n\n for (var i = i0; i < i1; i++) {\n var match = matches[i];\n var begin = match.begin;\n var end = match.end;\n var isSelected = (isSelectedPage && i === selectedMatchIdx);\n var highlightSuffix = (isSelected ? ' selected' : '');\n\n if (this.findController) {\n this.findController.updateMatchPosition(pageIdx, i, textDivs,\n begin.divIdx);\n }\n\n // Match inside new div.\n if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {\n // If there was a previous div, then add the text at the end.\n if (prevEnd !== null) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n // Clear the divs and set the content until the starting point.\n beginText(begin);\n } else {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);\n }\n\n if (begin.divIdx === end.divIdx) {\n appendTextToDiv(begin.divIdx, begin.offset, end.offset,\n 'highlight' + highlightSuffix);\n } else {\n appendTextToDiv(begin.divIdx, begin.offset, infinity.offset,\n 'highlight begin' + highlightSuffix);\n for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {\n textDivs[n0].className = 'highlight middle' + highlightSuffix;\n }\n beginText(end, 'highlight end' + highlightSuffix);\n }\n prevEnd = end;\n }\n\n if (prevEnd) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n },\n\n updateMatches: function TextLayerBuilder_updateMatches() {\n // Only show matches when all rendering is done.\n if (!this.renderingDone) {\n return;\n }\n\n // Clear all matches.\n var matches = this.matches;\n var textDivs = this.textDivs;\n var bidiTexts = this.textContent.items;\n var clearedUntilDivIdx = -1;\n\n // Clear all current matches.\n for (var i = 0, len = matches.length; i < len; i++) {\n var match = matches[i];\n var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);\n for (var n = begin, end = match.end.divIdx; n <= end; n++) {\n var div = textDivs[n];\n div.textContent = bidiTexts[n].str;\n div.className = '';\n }\n clearedUntilDivIdx = match.end.divIdx + 1;\n }\n\n if (this.findController === null || !this.findController.active) {\n return;\n }\n\n // Convert the matches on the page controller into the match format\n // used for the textLayer.\n var pageMatches, pageMatchesLength;\n if (this.findController !== null) {\n pageMatches = this.findController.pageMatches[this.pageIdx] || null;\n pageMatchesLength = (this.findController.pageMatchesLength) ?\n this.findController.pageMatchesLength[this.pageIdx] || null : null;\n }\n\n this.matches = this.convertMatches(pageMatches, pageMatchesLength);\n this.renderMatches(this.matches);\n },\n\n /**\n * Fixes text selection: adds additional div where mouse was clicked.\n * This reduces flickering of the content if mouse slowly dragged down/up.\n * @private\n */\n _bindMouse: function TextLayerBuilder_bindMouse() {\n var div = this.textLayerDiv;\n var self = this;\n var expandDivsTimer = null;\n\n div.addEventListener('mousedown', function (e) {\n if (self.enhanceTextSelection && self.textLayerRenderTask) {\n self.textLayerRenderTask.expandTextDivs(true);\n if ((typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('FIREFOX || MOZCENTRAL')) &&\n expandDivsTimer) {\n clearTimeout(expandDivsTimer);\n expandDivsTimer = null;\n }\n return;\n }\n var end = div.querySelector('.endOfContent');\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n // On non-Firefox browsers, the selection will feel better if the height\n // of the endOfContent div will be adjusted to start at mouse click\n // location -- this will avoid flickering when selections moves up.\n // However it does not work when selection started on empty space.\n var adjustTop = e.target !== div;\n if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {\n adjustTop = adjustTop && window.getComputedStyle(end).\n getPropertyValue('-moz-user-select') !== 'none';\n }\n if (adjustTop) {\n var divBounds = div.getBoundingClientRect();\n var r = Math.max(0, (e.pageY - divBounds.top) / divBounds.height);\n end.style.top = (r * 100).toFixed(2) + '%';\n }\n }\n end.classList.add('active');\n });\n\n div.addEventListener('mouseup', function (e) {\n if (self.enhanceTextSelection && self.textLayerRenderTask) {\n if (typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n expandDivsTimer = setTimeout(function() {\n if (self.textLayerRenderTask) {\n self.textLayerRenderTask.expandTextDivs(false);\n }\n expandDivsTimer = null;\n }, EXPAND_DIVS_TIMEOUT);\n } else {\n self.textLayerRenderTask.expandTextDivs(false);\n }\n return;\n }\n var end = div.querySelector('.endOfContent');\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n end.style.top = '';\n }\n end.classList.remove('active');\n });\n },\n };\n return TextLayerBuilder;\n})();\n\n/**\n * @constructor\n * @implements IPDFTextLayerFactory\n */\nfunction DefaultTextLayerFactory() {}\nDefaultTextLayerFactory.prototype = {\n /**\n * @param {HTMLDivElement} textLayerDiv\n * @param {number} pageIndex\n * @param {PageViewport} viewport\n * @param {boolean} enhanceTextSelection\n * @returns {TextLayerBuilder}\n */\n createTextLayerBuilder(textLayerDiv, pageIndex, viewport,\n enhanceTextSelection = false) {\n return new TextLayerBuilder({\n textLayerDiv,\n pageIndex,\n viewport,\n enhanceTextSelection,\n });\n }\n};\n\nexport {\n TextLayerBuilder,\n DefaultTextLayerFactory,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/text_layer_builder.js","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst CLEANUP_TIMEOUT = 30000;\n\nconst RenderingStates = {\n INITIAL: 0,\n RUNNING: 1,\n PAUSED: 2,\n FINISHED: 3,\n};\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n constructor() {\n this.pdfViewer = null;\n this.pdfThumbnailViewer = null;\n this.onIdle = null;\n this.highestPriorityPage = null;\n this.idleTimeout = null;\n this.printing = false;\n this.isThumbnailViewEnabled = false;\n }\n\n /**\n * @param {PDFViewer} pdfViewer\n */\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n\n /**\n * @param {PDFThumbnailViewer} pdfThumbnailViewer\n */\n setThumbnailViewer(pdfThumbnailViewer) {\n this.pdfThumbnailViewer = pdfThumbnailViewer;\n }\n\n /**\n * @param {IRenderableView} view\n * @returns {boolean}\n */\n isHighestPriority(view) {\n return this.highestPriorityPage === view.renderingId;\n }\n\n /**\n * @param {Object} currentlyVisiblePages\n */\n renderHighestPriority(currentlyVisiblePages) {\n if (this.idleTimeout) {\n clearTimeout(this.idleTimeout);\n this.idleTimeout = null;\n }\n\n // Pages have a higher priority than thumbnails, so check them first.\n if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {\n return;\n }\n // No pages needed rendering, so check thumbnails.\n if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) {\n if (this.pdfThumbnailViewer.forceRendering()) {\n return;\n }\n }\n\n if (this.printing) {\n // If printing is currently ongoing do not reschedule cleanup.\n return;\n }\n\n if (this.onIdle) {\n this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);\n }\n }\n\n /**\n * @param {Object} visible\n * @param {Array} views\n * @param {boolean} scrolledDown\n */\n getHighestPriority(visible, views, scrolledDown) {\n /**\n * The state has changed. Figure out which page has the highest priority to\n * render next (if any).\n *\n * Priority:\n * 1. visible pages\n * 2. if last scrolled down, the page after the visible pages, or\n * if last scrolled up, the page before the visible pages\n */\n var visibleViews = visible.views;\n\n var numVisible = visibleViews.length;\n if (numVisible === 0) {\n return false;\n }\n for (var i = 0; i < numVisible; ++i) {\n var view = visibleViews[i].view;\n if (!this.isViewFinished(view)) {\n return view;\n }\n }\n\n // All the visible views have rendered; try to render next/previous pages.\n if (scrolledDown) {\n var nextPageIndex = visible.last.id;\n // IDs start at 1, so no need to add 1.\n if (views[nextPageIndex] && !this.isViewFinished(views[nextPageIndex])) {\n return views[nextPageIndex];\n }\n } else {\n var previousPageIndex = visible.first.id - 2;\n if (views[previousPageIndex] &&\n !this.isViewFinished(views[previousPageIndex])) {\n return views[previousPageIndex];\n }\n }\n // Everything that needs to be rendered has been.\n return null;\n }\n\n /**\n * @param {IRenderableView} view\n * @returns {boolean}\n */\n isViewFinished(view) {\n return view.renderingState === RenderingStates.FINISHED;\n }\n\n /**\n * Render a page or thumbnail view. This calls the appropriate function\n * based on the views state. If the view is already rendered it will return\n * `false`.\n *\n * @param {IRenderableView} view\n */\n renderView(view) {\n switch (view.renderingState) {\n case RenderingStates.FINISHED:\n return false;\n case RenderingStates.PAUSED:\n this.highestPriorityPage = view.renderingId;\n view.resume();\n break;\n case RenderingStates.RUNNING:\n this.highestPriorityPage = view.renderingId;\n break;\n case RenderingStates.INITIAL:\n this.highestPriorityPage = view.renderingId;\n var continueRendering = () => {\n this.renderHighestPriority();\n };\n view.draw().then(continueRendering, continueRendering);\n break;\n }\n return true;\n }\n}\n\nexport {\n RenderingStates,\n PDFRenderingQueue,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_rendering_queue.js","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createObjectURL, createValidAbsoluteUrl, PDFJS } from './pdfjs';\n\nif (typeof PDFJSDev !== 'undefined' && !PDFJSDev.test('CHROME || GENERIC')) {\n throw new Error('Module \"pdfjs-web/download_manager\" shall not be used ' +\n 'outside CHROME and GENERIC builds.');\n}\n\nfunction download(blobUrl, filename) {\n var a = document.createElement('a');\n if (a.click) {\n // Use a.click() if available. Otherwise, Chrome might show\n // \"Unsafe JavaScript attempt to initiate a navigation change\n // for frame with URL\" and not open the PDF at all.\n // Supported by (not mentioned = untested):\n // - Firefox 6 - 19 (4- does not support a.click, 5 ignores a.click)\n // - Chrome 19 - 26 (18- does not support a.click)\n // - Opera 9 - 12.15\n // - Internet Explorer 6 - 10\n // - Safari 6 (5.1- does not support a.click)\n a.href = blobUrl;\n a.target = '_parent';\n // Use a.download if available. This increases the likelihood that\n // the file is downloaded instead of opened by another PDF plugin.\n if ('download' in a) {\n a.download = filename;\n }\n // <a> must be in the document for IE and recent Firefox versions.\n // (otherwise .click() is ignored)\n (document.body || document.documentElement).appendChild(a);\n a.click();\n a.parentNode.removeChild(a);\n } else {\n if (window.top === window &&\n blobUrl.split('#')[0] === window.location.href.split('#')[0]) {\n // If _parent == self, then opening an identical URL with different\n // location hash will only cause a navigation, not a download.\n var padCharacter = blobUrl.indexOf('?') === -1 ? '?' : '&';\n blobUrl = blobUrl.replace(/#|$/, padCharacter + '$&');\n }\n window.open(blobUrl, '_parent');\n }\n}\n\nfunction DownloadManager() {}\n\nDownloadManager.prototype = {\n downloadUrl: function DownloadManager_downloadUrl(url, filename) {\n if (!createValidAbsoluteUrl(url, 'http://example.com')) {\n return; // restricted/invalid URL\n }\n download(url + '#pdfjs.action=download', filename);\n },\n\n downloadData: function DownloadManager_downloadData(data, filename,\n contentType) {\n if (navigator.msSaveBlob) { // IE10 and above\n return navigator.msSaveBlob(new Blob([data], { type: contentType }),\n filename);\n }\n\n var blobUrl = createObjectURL(data, contentType,\n PDFJS.disableCreateObjectURL);\n download(blobUrl, filename);\n },\n\n download: function DownloadManager_download(blob, url, filename) {\n if (navigator.msSaveBlob) {\n // IE10 / IE11\n if (!navigator.msSaveBlob(blob, filename)) {\n this.downloadUrl(url, filename);\n }\n return;\n }\n\n if (PDFJS.disableCreateObjectURL) {\n // URL.createObjectURL is not supported\n this.downloadUrl(url, filename);\n return;\n }\n\n var blobUrl = URL.createObjectURL(blob);\n download(blobUrl, filename);\n }\n};\n\nexport {\n DownloadManager,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/download_manager.js","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { scrollIntoView } from './ui_utils';\n\nvar FindStates = {\n FIND_FOUND: 0,\n FIND_NOTFOUND: 1,\n FIND_WRAPPED: 2,\n FIND_PENDING: 3\n};\n\nvar FIND_SCROLL_OFFSET_TOP = -50;\nvar FIND_SCROLL_OFFSET_LEFT = -400;\n\nvar CHARACTERS_TO_NORMALIZE = {\n '\\u2018': '\\'', // Left single quotation mark\n '\\u2019': '\\'', // Right single quotation mark\n '\\u201A': '\\'', // Single low-9 quotation mark\n '\\u201B': '\\'', // Single high-reversed-9 quotation mark\n '\\u201C': '\"', // Left double quotation mark\n '\\u201D': '\"', // Right double quotation mark\n '\\u201E': '\"', // Double low-9 quotation mark\n '\\u201F': '\"', // Double high-reversed-9 quotation mark\n '\\u00BC': '1/4', // Vulgar fraction one quarter\n '\\u00BD': '1/2', // Vulgar fraction one half\n '\\u00BE': '3/4', // Vulgar fraction three quarters\n};\n\n/**\n * Provides \"search\" or \"find\" functionality for the PDF.\n * This object actually performs the search for a given string.\n */\nvar PDFFindController = (function PDFFindControllerClosure() {\n function PDFFindController(options) {\n this.pdfViewer = options.pdfViewer || null;\n\n this.onUpdateResultsCount = null;\n this.onUpdateState = null;\n\n this.reset();\n\n // Compile the regular expression for text normalization once.\n var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join('');\n this.normalizationRegex = new RegExp('[' + replace + ']', 'g');\n }\n\n PDFFindController.prototype = {\n reset: function PDFFindController_reset() {\n this.startedTextExtraction = false;\n this.extractTextPromises = [];\n this.pendingFindMatches = Object.create(null);\n this.active = false; // If active, find results will be highlighted.\n this.pageContents = []; // Stores the text for each page.\n this.pageMatches = [];\n this.pageMatchesLength = null;\n this.matchCount = 0;\n this.selected = { // Currently selected match.\n pageIdx: -1,\n matchIdx: -1\n };\n this.offset = { // Where the find algorithm currently is in the document.\n pageIdx: null,\n matchIdx: null\n };\n this.pagesToSearch = null;\n this.resumePageIdx = null;\n this.state = null;\n this.dirtyMatch = false;\n this.findTimeout = null;\n\n this._firstPagePromise = new Promise((resolve) => {\n this.resolveFirstPage = resolve;\n });\n },\n\n normalize: function PDFFindController_normalize(text) {\n return text.replace(this.normalizationRegex, function (ch) {\n return CHARACTERS_TO_NORMALIZE[ch];\n });\n },\n\n // Helper for multiple search - fills matchesWithLength array\n // and takes into account cases when one search term\n // include another search term (for example, \"tamed tame\" or \"this is\").\n // Looking for intersecting terms in the 'matches' and\n // leave elements with a longer match-length.\n\n _prepareMatches: function PDFFindController_prepareMatches(\n matchesWithLength, matches, matchesLength) {\n\n function isSubTerm(matchesWithLength, currentIndex) {\n var currentElem, prevElem, nextElem;\n currentElem = matchesWithLength[currentIndex];\n nextElem = matchesWithLength[currentIndex + 1];\n // checking for cases like \"TAMEd TAME\"\n if (currentIndex < matchesWithLength.length - 1 &&\n currentElem.match === nextElem.match) {\n currentElem.skipped = true;\n return true;\n }\n // checking for cases like \"thIS IS\"\n for (var i = currentIndex - 1; i >= 0; i--) {\n prevElem = matchesWithLength[i];\n if (prevElem.skipped) {\n continue;\n }\n if (prevElem.match + prevElem.matchLength < currentElem.match) {\n break;\n }\n if (prevElem.match + prevElem.matchLength >=\n currentElem.match + currentElem.matchLength) {\n currentElem.skipped = true;\n return true;\n }\n }\n return false;\n }\n\n var i, len;\n // Sorting array of objects { match: <match>, matchLength: <matchLength> }\n // in increasing index first and then the lengths.\n matchesWithLength.sort(function(a, b) {\n return a.match === b.match ?\n a.matchLength - b.matchLength : a.match - b.match;\n });\n for (i = 0, len = matchesWithLength.length; i < len; i++) {\n if (isSubTerm(matchesWithLength, i)) {\n continue;\n }\n matches.push(matchesWithLength[i].match);\n matchesLength.push(matchesWithLength[i].matchLength);\n }\n },\n\n calcFindPhraseMatch: function PDFFindController_calcFindPhraseMatch(\n query, pageIndex, pageContent) {\n var matches = [];\n var queryLen = query.length;\n var matchIdx = -queryLen;\n while (true) {\n matchIdx = pageContent.indexOf(query, matchIdx + queryLen);\n if (matchIdx === -1) {\n break;\n }\n matches.push(matchIdx);\n }\n this.pageMatches[pageIndex] = matches;\n },\n\n calcFindWordMatch: function PDFFindController_calcFindWordMatch(\n query, pageIndex, pageContent) {\n var matchesWithLength = [];\n // Divide the query into pieces and search for text on each piece.\n var queryArray = query.match(/\\S+/g);\n var subquery, subqueryLen, matchIdx;\n for (var i = 0, len = queryArray.length; i < len; i++) {\n subquery = queryArray[i];\n subqueryLen = subquery.length;\n matchIdx = -subqueryLen;\n while (true) {\n matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen);\n if (matchIdx === -1) {\n break;\n }\n // Other searches do not, so we store the length.\n matchesWithLength.push({\n match: matchIdx,\n matchLength: subqueryLen,\n skipped: false\n });\n }\n }\n // Prepare arrays for store the matches.\n if (!this.pageMatchesLength) {\n this.pageMatchesLength = [];\n }\n this.pageMatchesLength[pageIndex] = [];\n this.pageMatches[pageIndex] = [];\n // Sort matchesWithLength, clean up intersecting terms\n // and put the result into the two arrays.\n this._prepareMatches(matchesWithLength, this.pageMatches[pageIndex],\n this.pageMatchesLength[pageIndex]);\n },\n\n calcFindMatch: function PDFFindController_calcFindMatch(pageIndex) {\n var pageContent = this.normalize(this.pageContents[pageIndex]);\n var query = this.normalize(this.state.query);\n var caseSensitive = this.state.caseSensitive;\n var phraseSearch = this.state.phraseSearch;\n var queryLen = query.length;\n\n if (queryLen === 0) {\n // Do nothing: the matches should be wiped out already.\n return;\n }\n\n if (!caseSensitive) {\n pageContent = pageContent.toLowerCase();\n query = query.toLowerCase();\n }\n\n if (phraseSearch) {\n this.calcFindPhraseMatch(query, pageIndex, pageContent);\n } else {\n this.calcFindWordMatch(query, pageIndex, pageContent);\n }\n\n this.updatePage(pageIndex);\n if (this.resumePageIdx === pageIndex) {\n this.resumePageIdx = null;\n this.nextPageMatch();\n }\n\n // Update the matches count\n if (this.pageMatches[pageIndex].length > 0) {\n this.matchCount += this.pageMatches[pageIndex].length;\n this.updateUIResultsCount();\n }\n },\n\n extractText: function PDFFindController_extractText() {\n if (this.startedTextExtraction) {\n return;\n }\n this.startedTextExtraction = true;\n\n this.pageContents = [];\n var extractTextPromisesResolves = [];\n var numPages = this.pdfViewer.pagesCount;\n for (var i = 0; i < numPages; i++) {\n this.extractTextPromises.push(new Promise(function (resolve) {\n extractTextPromisesResolves.push(resolve);\n }));\n }\n\n var self = this;\n function extractPageText(pageIndex) {\n self.pdfViewer.getPageTextContent(pageIndex).then(\n function textContentResolved(textContent) {\n var textItems = textContent.items;\n var str = [];\n\n for (var i = 0, len = textItems.length; i < len; i++) {\n str.push(textItems[i].str);\n }\n\n // Store the pageContent as a string.\n self.pageContents.push(str.join(''));\n\n extractTextPromisesResolves[pageIndex](pageIndex);\n if ((pageIndex + 1) < self.pdfViewer.pagesCount) {\n extractPageText(pageIndex + 1);\n }\n }\n );\n }\n extractPageText(0);\n },\n\n executeCommand: function PDFFindController_executeCommand(cmd, state) {\n if (this.state === null || cmd !== 'findagain') {\n this.dirtyMatch = true;\n }\n this.state = state;\n this.updateUIState(FindStates.FIND_PENDING);\n\n this._firstPagePromise.then(() => {\n this.extractText();\n\n clearTimeout(this.findTimeout);\n if (cmd === 'find') {\n // Only trigger the find action after 250ms of silence.\n this.findTimeout = setTimeout(this.nextMatch.bind(this), 250);\n } else {\n this.nextMatch();\n }\n });\n },\n\n updatePage: function PDFFindController_updatePage(index) {\n if (this.selected.pageIdx === index) {\n // If the page is selected, scroll the page into view, which triggers\n // rendering the page, which adds the textLayer. Once the textLayer is\n // build, it will scroll onto the selected match.\n this.pdfViewer.currentPageNumber = index + 1;\n }\n\n var page = this.pdfViewer.getPageView(index);\n if (page.textLayer) {\n page.textLayer.updateMatches();\n }\n },\n\n nextMatch: function PDFFindController_nextMatch() {\n var previous = this.state.findPrevious;\n var currentPageIndex = this.pdfViewer.currentPageNumber - 1;\n var numPages = this.pdfViewer.pagesCount;\n\n this.active = true;\n\n if (this.dirtyMatch) {\n // Need to recalculate the matches, reset everything.\n this.dirtyMatch = false;\n this.selected.pageIdx = this.selected.matchIdx = -1;\n this.offset.pageIdx = currentPageIndex;\n this.offset.matchIdx = null;\n this.hadMatch = false;\n this.resumePageIdx = null;\n this.pageMatches = [];\n this.matchCount = 0;\n this.pageMatchesLength = null;\n var self = this;\n\n for (var i = 0; i < numPages; i++) {\n // Wipe out any previous highlighted matches.\n this.updatePage(i);\n\n // As soon as the text is extracted start finding the matches.\n if (!(i in this.pendingFindMatches)) {\n this.pendingFindMatches[i] = true;\n this.extractTextPromises[i].then(function(pageIdx) {\n delete self.pendingFindMatches[pageIdx];\n self.calcFindMatch(pageIdx);\n });\n }\n }\n }\n\n // If there's no query there's no point in searching.\n if (this.state.query === '') {\n this.updateUIState(FindStates.FIND_FOUND);\n return;\n }\n\n // If we're waiting on a page, we return since we can't do anything else.\n if (this.resumePageIdx) {\n return;\n }\n\n var offset = this.offset;\n // Keep track of how many pages we should maximally iterate through.\n this.pagesToSearch = numPages;\n // If there's already a matchIdx that means we are iterating through a\n // page's matches.\n if (offset.matchIdx !== null) {\n var numPageMatches = this.pageMatches[offset.pageIdx].length;\n if ((!previous && offset.matchIdx + 1 < numPageMatches) ||\n (previous && offset.matchIdx > 0)) {\n // The simple case; we just have advance the matchIdx to select\n // the next match on the page.\n this.hadMatch = true;\n offset.matchIdx = (previous ? offset.matchIdx - 1 :\n offset.matchIdx + 1);\n this.updateMatch(true);\n return;\n }\n // We went beyond the current page's matches, so we advance to\n // the next page.\n this.advanceOffsetPage(previous);\n }\n // Start searching through the page.\n this.nextPageMatch();\n },\n\n matchesReady: function PDFFindController_matchesReady(matches) {\n var offset = this.offset;\n var numMatches = matches.length;\n var previous = this.state.findPrevious;\n\n if (numMatches) {\n // There were matches for the page, so initialize the matchIdx.\n this.hadMatch = true;\n offset.matchIdx = (previous ? numMatches - 1 : 0);\n this.updateMatch(true);\n return true;\n }\n // No matches, so attempt to search the next page.\n this.advanceOffsetPage(previous);\n if (offset.wrapped) {\n offset.matchIdx = null;\n if (this.pagesToSearch < 0) {\n // No point in wrapping again, there were no matches.\n this.updateMatch(false);\n // while matches were not found, searching for a page\n // with matches should nevertheless halt.\n return true;\n }\n }\n // Matches were not found (and searching is not done).\n return false;\n },\n\n /**\n * The method is called back from the text layer when match presentation\n * is updated.\n * @param {number} pageIndex - page index.\n * @param {number} index - match index.\n * @param {Array} elements - text layer div elements array.\n * @param {number} beginIdx - start index of the div array for the match.\n */\n updateMatchPosition: function PDFFindController_updateMatchPosition(\n pageIndex, index, elements, beginIdx) {\n if (this.selected.matchIdx === index &&\n this.selected.pageIdx === pageIndex) {\n var spot = {\n top: FIND_SCROLL_OFFSET_TOP,\n left: FIND_SCROLL_OFFSET_LEFT\n };\n scrollIntoView(elements[beginIdx], spot,\n /* skipOverflowHiddenElements = */ true);\n }\n },\n\n nextPageMatch: function PDFFindController_nextPageMatch() {\n if (this.resumePageIdx !== null) {\n console.error('There can only be one pending page.');\n }\n do {\n var pageIdx = this.offset.pageIdx;\n var matches = this.pageMatches[pageIdx];\n if (!matches) {\n // The matches don't exist yet for processing by \"matchesReady\",\n // so set a resume point for when they do exist.\n this.resumePageIdx = pageIdx;\n break;\n }\n } while (!this.matchesReady(matches));\n },\n\n advanceOffsetPage: function PDFFindController_advanceOffsetPage(previous) {\n var offset = this.offset;\n var numPages = this.extractTextPromises.length;\n offset.pageIdx = (previous ? offset.pageIdx - 1 : offset.pageIdx + 1);\n offset.matchIdx = null;\n\n this.pagesToSearch--;\n\n if (offset.pageIdx >= numPages || offset.pageIdx < 0) {\n offset.pageIdx = (previous ? numPages - 1 : 0);\n offset.wrapped = true;\n }\n },\n\n updateMatch: function PDFFindController_updateMatch(found) {\n var state = FindStates.FIND_NOTFOUND;\n var wrapped = this.offset.wrapped;\n this.offset.wrapped = false;\n\n if (found) {\n var previousPage = this.selected.pageIdx;\n this.selected.pageIdx = this.offset.pageIdx;\n this.selected.matchIdx = this.offset.matchIdx;\n state = (wrapped ? FindStates.FIND_WRAPPED : FindStates.FIND_FOUND);\n // Update the currently selected page to wipe out any selected matches.\n if (previousPage !== -1 && previousPage !== this.selected.pageIdx) {\n this.updatePage(previousPage);\n }\n }\n\n this.updateUIState(state, this.state.findPrevious);\n if (this.selected.pageIdx !== -1) {\n this.updatePage(this.selected.pageIdx);\n }\n },\n\n updateUIResultsCount:\n function PDFFindController_updateUIResultsCount() {\n if (this.onUpdateResultsCount) {\n this.onUpdateResultsCount(this.matchCount);\n }\n },\n\n updateUIState: function PDFFindController_updateUIState(state, previous) {\n if (this.onUpdateState) {\n this.onUpdateState(state, previous, this.matchCount);\n }\n }\n };\n return PDFFindController;\n})();\n\nexport {\n FindStates,\n PDFFindController,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_find_controller.js","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals chrome */\n\nimport { getGlobalEventBus } from './dom_events';\n\nfunction PDFHistory(options) {\n this.linkService = options.linkService;\n this.eventBus = options.eventBus || getGlobalEventBus();\n\n this.initialized = false;\n this.initialDestination = null;\n this.initialBookmark = null;\n}\n\nPDFHistory.prototype = {\n /**\n * @param {string} fingerprint\n */\n initialize: function pdfHistoryInitialize(fingerprint) {\n this.initialized = true;\n this.reInitialized = false;\n this.allowHashChange = true;\n this.historyUnlocked = true;\n this.isViewerInPresentationMode = false;\n\n this.previousHash = window.location.hash.substring(1);\n this.currentBookmark = '';\n this.currentPage = 0;\n this.updatePreviousBookmark = false;\n this.previousBookmark = '';\n this.previousPage = 0;\n this.nextHashParam = '';\n\n this.fingerprint = fingerprint;\n this.currentUid = this.uid = 0;\n this.current = {};\n\n var state = window.history.state;\n if (this._isStateObjectDefined(state)) {\n // This corresponds to navigating back to the document\n // from another page in the browser history.\n if (state.target.dest) {\n this.initialDestination = state.target.dest;\n } else {\n this.initialBookmark = state.target.hash;\n }\n this.currentUid = state.uid;\n this.uid = state.uid + 1;\n this.current = state.target;\n } else {\n // This corresponds to the loading of a new document.\n if (state && state.fingerprint &&\n this.fingerprint !== state.fingerprint) {\n // Reinitialize the browsing history when a new document\n // is opened in the web viewer.\n this.reInitialized = true;\n }\n this._pushOrReplaceState({fingerprint: this.fingerprint}, true);\n }\n\n var self = this;\n window.addEventListener('popstate', function pdfHistoryPopstate(evt) {\n if (!self.historyUnlocked) {\n return;\n }\n if (evt.state) {\n // Move back/forward in the history.\n self._goTo(evt.state);\n return;\n }\n\n // If the state is not set, then the user tried to navigate to a\n // different hash by manually editing the URL and pressing Enter, or by\n // clicking on an in-page link (e.g. the \"current view\" link).\n // Save the current view state to the browser history.\n\n // Note: In Firefox, history.null could also be null after an in-page\n // navigation to the same URL, and without dispatching the popstate\n // event: https://bugzilla.mozilla.org/show_bug.cgi?id=1183881\n\n if (self.uid === 0) {\n // Replace the previous state if it was not explicitly set.\n var previousParams = (self.previousHash && self.currentBookmark &&\n self.previousHash !== self.currentBookmark) ?\n {hash: self.currentBookmark, page: self.currentPage} :\n {page: 1};\n replacePreviousHistoryState(previousParams, function() {\n updateHistoryWithCurrentHash();\n });\n } else {\n updateHistoryWithCurrentHash();\n }\n });\n\n\n function updateHistoryWithCurrentHash() {\n self.previousHash = window.location.hash.slice(1);\n self._pushToHistory({hash: self.previousHash}, false, true);\n self._updatePreviousBookmark();\n }\n\n function replacePreviousHistoryState(params, callback) {\n // To modify the previous history entry, the following happens:\n // 1. history.back()\n // 2. _pushToHistory, which calls history.replaceState( ... )\n // 3. history.forward()\n // Because a navigation via the history API does not immediately update\n // the history state, the popstate event is used for synchronization.\n self.historyUnlocked = false;\n\n // Suppress the hashchange event to avoid side effects caused by\n // navigating back and forward.\n self.allowHashChange = false;\n window.addEventListener('popstate', rewriteHistoryAfterBack);\n history.back();\n\n function rewriteHistoryAfterBack() {\n window.removeEventListener('popstate', rewriteHistoryAfterBack);\n window.addEventListener('popstate', rewriteHistoryAfterForward);\n self._pushToHistory(params, false, true);\n history.forward();\n }\n function rewriteHistoryAfterForward() {\n window.removeEventListener('popstate', rewriteHistoryAfterForward);\n self.allowHashChange = true;\n self.historyUnlocked = true;\n callback();\n }\n }\n\n function pdfHistoryBeforeUnload() {\n var previousParams = self._getPreviousParams(null, true);\n if (previousParams) {\n var replacePrevious = (!self.current.dest &&\n self.current.hash !== self.previousHash);\n self._pushToHistory(previousParams, false, replacePrevious);\n self._updatePreviousBookmark();\n }\n // Remove the event listener when navigating away from the document,\n // since 'beforeunload' prevents Firefox from caching the document.\n window.removeEventListener('beforeunload', pdfHistoryBeforeUnload);\n }\n\n window.addEventListener('beforeunload', pdfHistoryBeforeUnload);\n\n window.addEventListener('pageshow', function pdfHistoryPageShow(evt) {\n // If the entire viewer (including the PDF file) is cached in\n // the browser, we need to reattach the 'beforeunload' event listener\n // since the 'DOMContentLoaded' event is not fired on 'pageshow'.\n window.addEventListener('beforeunload', pdfHistoryBeforeUnload);\n });\n\n self.eventBus.on('presentationmodechanged', function(e) {\n self.isViewerInPresentationMode = e.active;\n });\n },\n\n clearHistoryState: function pdfHistory_clearHistoryState() {\n this._pushOrReplaceState(null, true);\n },\n\n _isStateObjectDefined: function pdfHistory_isStateObjectDefined(state) {\n return (state && state.uid >= 0 &&\n state.fingerprint && this.fingerprint === state.fingerprint &&\n state.target && state.target.hash) ? true : false;\n },\n\n _pushOrReplaceState: function pdfHistory_pushOrReplaceState(stateObj,\n replace) {\n // history.state.chromecomState is managed by chromecom.js.\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') &&\n window.history.state && 'chromecomState' in window.history.state) {\n stateObj = stateObj || {};\n stateObj.chromecomState = window.history.state.chromecomState;\n }\n if (replace) {\n if (typeof PDFJSDev === 'undefined' ||\n PDFJSDev.test('GENERIC || CHROME')) {\n window.history.replaceState(stateObj, '', document.URL);\n } else {\n window.history.replaceState(stateObj, '');\n }\n } else {\n if (typeof PDFJSDev === 'undefined' ||\n PDFJSDev.test('GENERIC || CHROME')) {\n window.history.pushState(stateObj, '', document.URL);\n } else {\n window.history.pushState(stateObj, '');\n }\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') &&\n top === window) {\n chrome.runtime.sendMessage('showPageAction');\n }\n }\n },\n\n get isHashChangeUnlocked() {\n if (!this.initialized) {\n return true;\n }\n return this.allowHashChange;\n },\n\n _updatePreviousBookmark: function pdfHistory_updatePreviousBookmark() {\n if (this.updatePreviousBookmark &&\n this.currentBookmark && this.currentPage) {\n this.previousBookmark = this.currentBookmark;\n this.previousPage = this.currentPage;\n this.updatePreviousBookmark = false;\n }\n },\n\n updateCurrentBookmark: function pdfHistoryUpdateCurrentBookmark(bookmark,\n pageNum) {\n if (this.initialized) {\n this.currentBookmark = bookmark.substring(1);\n this.currentPage = pageNum | 0;\n this._updatePreviousBookmark();\n }\n },\n\n updateNextHashParam: function pdfHistoryUpdateNextHashParam(param) {\n if (this.initialized) {\n this.nextHashParam = param;\n }\n },\n\n push: function pdfHistoryPush(params, isInitialBookmark) {\n if (!(this.initialized && this.historyUnlocked)) {\n return;\n }\n if (params.dest && !params.hash) {\n params.hash = (this.current.hash && this.current.dest &&\n this.current.dest === params.dest) ?\n this.current.hash :\n this.linkService.getDestinationHash(params.dest).split('#')[1];\n }\n if (params.page) {\n params.page |= 0;\n }\n if (isInitialBookmark) {\n var target = window.history.state.target;\n if (!target) {\n // Invoked when the user specifies an initial bookmark,\n // thus setting initialBookmark, when the document is loaded.\n this._pushToHistory(params, false);\n this.previousHash = window.location.hash.substring(1);\n }\n this.updatePreviousBookmark = this.nextHashParam ? false : true;\n if (target) {\n // If the current document is reloaded,\n // avoid creating duplicate entries in the history.\n this._updatePreviousBookmark();\n }\n return;\n }\n if (this.nextHashParam) {\n if (this.nextHashParam === params.hash) {\n this.nextHashParam = null;\n this.updatePreviousBookmark = true;\n return;\n }\n this.nextHashParam = null;\n }\n\n if (params.hash) {\n if (this.current.hash) {\n if (this.current.hash !== params.hash) {\n this._pushToHistory(params, true);\n } else {\n if (!this.current.page && params.page) {\n this._pushToHistory(params, false, true);\n }\n this.updatePreviousBookmark = true;\n }\n } else {\n this._pushToHistory(params, true);\n }\n } else if (this.current.page && params.page &&\n this.current.page !== params.page) {\n this._pushToHistory(params, true);\n }\n },\n\n _getPreviousParams: function pdfHistory_getPreviousParams(onlyCheckPage,\n beforeUnload) {\n if (!(this.currentBookmark && this.currentPage)) {\n return null;\n } else if (this.updatePreviousBookmark) {\n this.updatePreviousBookmark = false;\n }\n if (this.uid > 0 && !(this.previousBookmark && this.previousPage)) {\n // Prevent the history from getting stuck in the current state,\n // effectively preventing the user from going back/forward in\n // the history.\n //\n // This happens if the current position in the document didn't change\n // when the history was previously updated. The reasons for this are\n // either:\n // 1. The current zoom value is such that the document does not need to,\n // or cannot, be scrolled to display the destination.\n // 2. The previous destination is broken, and doesn't actally point to a\n // position within the document.\n // (This is either due to a bad PDF generator, or the user making a\n // mistake when entering a destination in the hash parameters.)\n return null;\n }\n if ((!this.current.dest && !onlyCheckPage) || beforeUnload) {\n if (this.previousBookmark === this.currentBookmark) {\n return null;\n }\n } else if (this.current.page || onlyCheckPage) {\n if (this.previousPage === this.currentPage) {\n return null;\n }\n } else {\n return null;\n }\n var params = {hash: this.currentBookmark, page: this.currentPage};\n if (this.isViewerInPresentationMode) {\n params.hash = null;\n }\n return params;\n },\n\n _stateObj: function pdfHistory_stateObj(params) {\n return {fingerprint: this.fingerprint, uid: this.uid, target: params};\n },\n\n _pushToHistory: function pdfHistory_pushToHistory(params,\n addPrevious, overwrite) {\n if (!this.initialized) {\n return;\n }\n if (!params.hash && params.page) {\n params.hash = ('page=' + params.page);\n }\n if (addPrevious && !overwrite) {\n var previousParams = this._getPreviousParams();\n if (previousParams) {\n var replacePrevious = (!this.current.dest &&\n this.current.hash !== this.previousHash);\n this._pushToHistory(previousParams, false, replacePrevious);\n }\n }\n this._pushOrReplaceState(this._stateObj(params),\n (overwrite || this.uid === 0));\n this.currentUid = this.uid++;\n this.current = params;\n this.updatePreviousBookmark = true;\n },\n\n _goTo: function pdfHistory_goTo(state) {\n if (!(this.initialized && this.historyUnlocked &&\n this._isStateObjectDefined(state))) {\n return;\n }\n if (!this.reInitialized && state.uid < this.currentUid) {\n var previousParams = this._getPreviousParams(true);\n if (previousParams) {\n this._pushToHistory(this.current, false);\n this._pushToHistory(previousParams, false);\n this.currentUid = state.uid;\n window.history.back();\n return;\n }\n }\n this.historyUnlocked = false;\n\n if (state.target.dest) {\n this.linkService.navigateTo(state.target.dest);\n } else {\n this.linkService.setHash(state.target.hash);\n }\n this.currentUid = state.uid;\n if (state.uid > this.uid) {\n this.uid = state.uid;\n }\n this.current = state.target;\n this.updatePreviousBookmark = true;\n\n var currentHash = window.location.hash.substring(1);\n if (this.previousHash !== currentHash) {\n this.allowHashChange = false;\n }\n this.previousHash = currentHash;\n\n this.historyUnlocked = true;\n },\n\n back: function pdfHistoryBack() {\n this.go(-1);\n },\n\n forward: function pdfHistoryForward() {\n this.go(1);\n },\n\n go: function pdfHistoryGo(direction) {\n if (this.initialized && this.historyUnlocked) {\n var state = window.history.state;\n if (direction === -1 && state && state.uid > 0) {\n window.history.back();\n } else if (direction === 1 && state && state.uid < (this.uid - 1)) {\n window.history.forward();\n }\n }\n }\n};\n\nexport {\n PDFHistory,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_history.js","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createPromiseCapability, PDFJS } from './pdfjs';\nimport {\n CSS_UNITS, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, getVisibleElements,\n MAX_AUTO_SCALE, RendererType, SCROLLBAR_PADDING, scrollIntoView,\n UNKNOWN_SCALE, VERTICAL_PADDING, watchScroll\n} from './ui_utils';\nimport { PDFRenderingQueue, RenderingStates } from './pdf_rendering_queue';\nimport { AnnotationLayerBuilder } from './annotation_layer_builder';\nimport { getGlobalEventBus } from './dom_events';\nimport { PDFPageView } from './pdf_page_view';\nimport { SimpleLinkService } from './pdf_link_service';\nimport { TextLayerBuilder } from './text_layer_builder';\n\nvar PresentationModeState = {\n UNKNOWN: 0,\n NORMAL: 1,\n CHANGING: 2,\n FULLSCREEN: 3,\n};\n\nvar DEFAULT_CACHE_SIZE = 10;\n\n/**\n * @typedef {Object} PDFViewerOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {HTMLDivElement} viewer - (optional) The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {DownloadManager} downloadManager - (optional) The download\n * manager component.\n * @property {PDFRenderingQueue} renderingQueue - (optional) The rendering\n * queue object.\n * @property {boolean} removePageBorders - (optional) Removes the border shadow\n * around the pages. The default is false.\n * @property {boolean} enhanceTextSelection - (optional) Enables the improved\n * text selection behaviour. The default is `false`.\n * @property {boolean} renderInteractiveForms - (optional) Enables rendering of\n * interactive form elements. The default is `false`.\n * @property {boolean} enablePrintAutoRotate - (optional) Enables automatic\n * rotation of pages whose orientation differ from the first page upon\n * printing. The default is `false`.\n * @property {string} renderer - 'canvas' or 'svg'. The default is 'canvas'.\n */\n\n/**\n * Simple viewer control to display PDF content/pages.\n * @class\n * @implements {IRenderableView}\n */\nvar PDFViewer = (function pdfViewer() {\n function PDFPageViewBuffer(size) {\n var data = [];\n this.push = function cachePush(view) {\n var i = data.indexOf(view);\n if (i >= 0) {\n data.splice(i, 1);\n }\n data.push(view);\n if (data.length > size) {\n data.shift().destroy();\n }\n };\n this.resize = function (newSize) {\n size = newSize;\n while (data.length > size) {\n data.shift().destroy();\n }\n };\n }\n\n function isSameScale(oldScale, newScale) {\n if (newScale === oldScale) {\n return true;\n }\n if (Math.abs(newScale - oldScale) < 1e-15) {\n // Prevent unnecessary re-rendering of all pages when the scale\n // changes only because of limited numerical precision.\n return true;\n }\n return false;\n }\n\n function isPortraitOrientation(size) {\n return size.width <= size.height;\n }\n\n /**\n * @constructs PDFViewer\n * @param {PDFViewerOptions} options\n */\n function PDFViewer(options) {\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n this.eventBus = options.eventBus || getGlobalEventBus();\n this.linkService = options.linkService || new SimpleLinkService();\n this.downloadManager = options.downloadManager || null;\n this.removePageBorders = options.removePageBorders || false;\n this.enhanceTextSelection = options.enhanceTextSelection || false;\n this.renderInteractiveForms = options.renderInteractiveForms || false;\n this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;\n this.renderer = options.renderer || RendererType.CANVAS;\n\n this.defaultRenderingQueue = !options.renderingQueue;\n if (this.defaultRenderingQueue) {\n // Custom rendering queue is not specified, using default one\n this.renderingQueue = new PDFRenderingQueue();\n this.renderingQueue.setViewer(this);\n } else {\n this.renderingQueue = options.renderingQueue;\n }\n\n this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));\n this.presentationModeState = PresentationModeState.UNKNOWN;\n this._resetView();\n\n if (this.removePageBorders) {\n this.viewer.classList.add('removePageBorders');\n }\n }\n\n PDFViewer.prototype = /** @lends PDFViewer.prototype */{\n get pagesCount() {\n return this._pages.length;\n },\n\n getPageView(index) {\n return this._pages[index];\n },\n\n /**\n * @returns {boolean} true if all {PDFPageView} objects are initialized.\n */\n get pageViewsReady() {\n return this._pageViewsReady;\n },\n\n /**\n * @returns {number}\n */\n get currentPageNumber() {\n return this._currentPageNumber;\n },\n\n /**\n * @param {number} val - The page number.\n */\n set currentPageNumber(val) {\n if ((val | 0) !== val) { // Ensure that `val` is an integer.\n throw new Error('Invalid page number.');\n }\n if (!this.pdfDocument) {\n this._currentPageNumber = val;\n return;\n }\n // The intent can be to just reset a scroll position and/or scale.\n this._setCurrentPageNumber(val, /* resetCurrentPageView = */ true);\n },\n\n /**\n * @private\n */\n _setCurrentPageNumber:\n function PDFViewer_setCurrentPageNumber(val, resetCurrentPageView) {\n if (this._currentPageNumber === val) {\n if (resetCurrentPageView) {\n this._resetCurrentPageView();\n }\n return;\n }\n\n if (!(0 < val && val <= this.pagesCount)) {\n console.error('PDFViewer_setCurrentPageNumber: \"' + val +\n '\" is out of bounds.');\n return;\n }\n\n var arg = {\n source: this,\n pageNumber: val,\n pageLabel: this._pageLabels && this._pageLabels[val - 1],\n };\n this._currentPageNumber = val;\n this.eventBus.dispatch('pagechanging', arg);\n this.eventBus.dispatch('pagechange', arg);\n\n if (resetCurrentPageView) {\n this._resetCurrentPageView();\n }\n },\n\n /**\n * @returns {string|null} Returns the current page label,\n * or `null` if no page labels exist.\n */\n get currentPageLabel() {\n return this._pageLabels && this._pageLabels[this._currentPageNumber - 1];\n },\n\n /**\n * @param {string} val - The page label.\n */\n set currentPageLabel(val) {\n var pageNumber = val | 0; // Fallback page number.\n if (this._pageLabels) {\n var i = this._pageLabels.indexOf(val);\n if (i >= 0) {\n pageNumber = i + 1;\n }\n }\n this.currentPageNumber = pageNumber;\n },\n\n /**\n * @returns {number}\n */\n get currentScale() {\n return this._currentScale !== UNKNOWN_SCALE ? this._currentScale :\n DEFAULT_SCALE;\n },\n\n /**\n * @param {number} val - Scale of the pages in percents.\n */\n set currentScale(val) {\n if (isNaN(val)) {\n throw new Error('Invalid numeric scale');\n }\n if (!this.pdfDocument) {\n this._currentScale = val;\n this._currentScaleValue = val !== UNKNOWN_SCALE ? val.toString() : null;\n return;\n }\n this._setScale(val, false);\n },\n\n /**\n * @returns {string}\n */\n get currentScaleValue() {\n return this._currentScaleValue;\n },\n\n /**\n * @param val - The scale of the pages (in percent or predefined value).\n */\n set currentScaleValue(val) {\n if (!this.pdfDocument) {\n this._currentScale = isNaN(val) ? UNKNOWN_SCALE : val;\n this._currentScaleValue = val.toString();\n return;\n }\n this._setScale(val, false);\n },\n\n /**\n * @returns {number}\n */\n get pagesRotation() {\n return this._pagesRotation;\n },\n\n /**\n * @param {number} rotation - The rotation of the pages (0, 90, 180, 270).\n */\n set pagesRotation(rotation) {\n if (!(typeof rotation === 'number' && rotation % 90 === 0)) {\n throw new Error('Invalid pages rotation angle.');\n }\n this._pagesRotation = rotation;\n\n if (!this.pdfDocument) {\n return;\n }\n for (var i = 0, l = this._pages.length; i < l; i++) {\n var pageView = this._pages[i];\n pageView.update(pageView.scale, rotation);\n }\n\n this._setScale(this._currentScaleValue, true);\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n },\n\n /**\n * @param pdfDocument {PDFDocument}\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this._cancelRendering();\n this._resetView();\n }\n\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n var pagesCount = pdfDocument.numPages;\n\n var pagesCapability = createPromiseCapability();\n this.pagesPromise = pagesCapability.promise;\n\n pagesCapability.promise.then(() => {\n this._pageViewsReady = true;\n this.eventBus.dispatch('pagesloaded', {\n source: this,\n pagesCount,\n });\n });\n\n var isOnePageRenderedResolved = false;\n var onePageRenderedCapability = createPromiseCapability();\n this.onePageRendered = onePageRenderedCapability.promise;\n\n var bindOnAfterAndBeforeDraw = (pageView) => {\n pageView.onBeforeDraw = () => {\n // Add the page to the buffer at the start of drawing. That way it can\n // be evicted from the buffer and destroyed even if we pause its\n // rendering.\n this._buffer.push(pageView);\n };\n pageView.onAfterDraw = () => {\n if (!isOnePageRenderedResolved) {\n isOnePageRenderedResolved = true;\n onePageRenderedCapability.resolve();\n }\n };\n };\n\n var firstPagePromise = pdfDocument.getPage(1);\n this.firstPagePromise = firstPagePromise;\n\n // Fetch a single page so we can get a viewport that will be the default\n // viewport for all pages\n return firstPagePromise.then((pdfPage) => {\n var scale = this.currentScale;\n var viewport = pdfPage.getViewport(scale * CSS_UNITS);\n for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n var textLayerFactory = null;\n if (!PDFJS.disableTextLayer) {\n textLayerFactory = this;\n }\n var pageView = new PDFPageView({\n container: this.viewer,\n eventBus: this.eventBus,\n id: pageNum,\n scale,\n defaultViewport: viewport.clone(),\n renderingQueue: this.renderingQueue,\n textLayerFactory,\n annotationLayerFactory: this,\n enhanceTextSelection: this.enhanceTextSelection,\n renderInteractiveForms: this.renderInteractiveForms,\n renderer: this.renderer,\n });\n bindOnAfterAndBeforeDraw(pageView);\n this._pages.push(pageView);\n }\n\n // Fetch all the pages since the viewport is needed before printing\n // starts to create the correct size canvas. Wait until one page is\n // rendered so we don't tie up too many resources early on.\n onePageRenderedCapability.promise.then(() => {\n if (PDFJS.disableAutoFetch) {\n // XXX: Printing is semi-broken with auto fetch disabled.\n pagesCapability.resolve();\n return;\n }\n var getPagesLeft = pagesCount;\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n pdfDocument.getPage(pageNum).then((pdfPage) => {\n var pageView = this._pages[pageNum - 1];\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n this.linkService.cachePageRef(pageNum, pdfPage.ref);\n if (--getPagesLeft === 0) {\n pagesCapability.resolve();\n }\n });\n }\n });\n\n this.eventBus.dispatch('pagesinit', { source: this });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n\n if (this.findController) {\n this.findController.resolveFirstPage();\n }\n });\n },\n\n /**\n * @param {Array|null} labels\n */\n setPageLabels: function PDFViewer_setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (!(labels instanceof Array &&\n this.pdfDocument.numPages === labels.length)) {\n this._pageLabels = null;\n console.error('PDFViewer_setPageLabels: Invalid page labels.');\n } else {\n this._pageLabels = labels;\n }\n // Update all the `PDFPageView` instances.\n for (var i = 0, ii = this._pages.length; i < ii; i++) {\n var pageView = this._pages[i];\n var label = this._pageLabels && this._pageLabels[i];\n pageView.setPageLabel(label);\n }\n },\n\n _resetView() {\n this._pages = [];\n this._currentPageNumber = 1;\n this._currentScale = UNKNOWN_SCALE;\n this._currentScaleValue = null;\n this._pageLabels = null;\n this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);\n this._location = null;\n this._pagesRotation = 0;\n this._pagesRequests = [];\n this._pageViewsReady = false;\n\n // Remove the pages from the DOM.\n this.viewer.textContent = '';\n },\n\n _scrollUpdate: function PDFViewer_scrollUpdate() {\n if (this.pagesCount === 0) {\n return;\n }\n this.update();\n for (var i = 0, ii = this._pages.length; i < ii; i++) {\n this._pages[i].updatePosition();\n }\n },\n\n _setScaleDispatchEvent: function pdfViewer_setScaleDispatchEvent(\n newScale, newValue, preset) {\n var arg = {\n source: this,\n scale: newScale,\n presetValue: preset ? newValue : undefined\n };\n this.eventBus.dispatch('scalechanging', arg);\n this.eventBus.dispatch('scalechange', arg);\n },\n\n _setScaleUpdatePages: function pdfViewer_setScaleUpdatePages(\n newScale, newValue, noScroll, preset) {\n this._currentScaleValue = newValue.toString();\n\n if (isSameScale(this._currentScale, newScale)) {\n if (preset) {\n this._setScaleDispatchEvent(newScale, newValue, true);\n }\n return;\n }\n\n for (var i = 0, ii = this._pages.length; i < ii; i++) {\n this._pages[i].update(newScale);\n }\n this._currentScale = newScale;\n\n if (!noScroll) {\n var page = this._currentPageNumber, dest;\n if (this._location && !PDFJS.ignoreCurrentPositionOnZoom &&\n !(this.isInPresentationMode || this.isChangingPresentationMode)) {\n page = this._location.pageNumber;\n dest = [null, { name: 'XYZ' }, this._location.left,\n this._location.top, null];\n }\n this.scrollPageIntoView({\n pageNumber: page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n }\n\n this._setScaleDispatchEvent(newScale, newValue, preset);\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n },\n\n _setScale: function PDFViewer_setScale(value, noScroll) {\n var scale = parseFloat(value);\n\n if (scale > 0) {\n this._setScaleUpdatePages(scale, value, noScroll, false);\n } else {\n var currentPage = this._pages[this._currentPageNumber - 1];\n if (!currentPage) {\n return;\n }\n var hPadding = (this.isInPresentationMode || this.removePageBorders) ?\n 0 : SCROLLBAR_PADDING;\n var vPadding = (this.isInPresentationMode || this.removePageBorders) ?\n 0 : VERTICAL_PADDING;\n var pageWidthScale = (this.container.clientWidth - hPadding) /\n currentPage.width * currentPage.scale;\n var pageHeightScale = (this.container.clientHeight - vPadding) /\n currentPage.height * currentPage.scale;\n switch (value) {\n case 'page-actual':\n scale = 1;\n break;\n case 'page-width':\n scale = pageWidthScale;\n break;\n case 'page-height':\n scale = pageHeightScale;\n break;\n case 'page-fit':\n scale = Math.min(pageWidthScale, pageHeightScale);\n break;\n case 'auto':\n var isLandscape = (currentPage.width > currentPage.height);\n // For pages in landscape mode, fit the page height to the viewer\n // *unless* the page would thus become too wide to fit horizontally.\n var horizontalScale = isLandscape ?\n Math.min(pageHeightScale, pageWidthScale) : pageWidthScale;\n scale = Math.min(MAX_AUTO_SCALE, horizontalScale);\n break;\n default:\n console.error('PDFViewer_setScale: \"' + value +\n '\" is an unknown zoom value.');\n return;\n }\n this._setScaleUpdatePages(scale, value, noScroll, true);\n }\n },\n\n /**\n * Refreshes page view: scrolls to the current page and updates the scale.\n * @private\n */\n _resetCurrentPageView() {\n if (this.isInPresentationMode) {\n // Fixes the case when PDF has different page sizes.\n this._setScale(this._currentScaleValue, true);\n }\n\n var pageView = this._pages[this._currentPageNumber - 1];\n scrollIntoView(pageView.div);\n },\n\n /**\n * @typedef ScrollPageIntoViewParameters\n * @property {number} pageNumber - The page number.\n * @property {Array} destArray - (optional) The original PDF destination\n * array, in the format: <page-ref> </XYZ|/FitXXX> <args..>\n * @property {boolean} allowNegativeOffset - (optional) Allow negative page\n * offsets. The default value is `false`.\n */\n\n /**\n * Scrolls page into view.\n * @param {ScrollPageIntoViewParameters} params\n */\n scrollPageIntoView: function PDFViewer_scrollPageIntoView(params) {\n if (!this.pdfDocument) {\n return;\n }\n if ((typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) &&\n (arguments.length > 1 || typeof params === 'number')) {\n console.warn('Call of scrollPageIntoView() with obsolete signature.');\n var paramObj = {};\n if (typeof params === 'number') {\n paramObj.pageNumber = params; // pageNumber argument was found.\n }\n if (arguments[1] instanceof Array) {\n paramObj.destArray = arguments[1]; // destArray argument was found.\n }\n params = paramObj;\n }\n var pageNumber = params.pageNumber || 0;\n var dest = params.destArray || null;\n var allowNegativeOffset = params.allowNegativeOffset || false;\n\n if (this.isInPresentationMode || !dest) {\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView */ true);\n return;\n }\n\n var pageView = this._pages[pageNumber - 1];\n if (!pageView) {\n console.error('PDFViewer_scrollPageIntoView: ' +\n 'Invalid \"pageNumber\" parameter.');\n return;\n }\n var x = 0, y = 0;\n var width = 0, height = 0, widthScale, heightScale;\n var changeOrientation = (pageView.rotation % 180 === 0 ? false : true);\n var pageWidth = (changeOrientation ? pageView.height : pageView.width) /\n pageView.scale / CSS_UNITS;\n var pageHeight = (changeOrientation ? pageView.width : pageView.height) /\n pageView.scale / CSS_UNITS;\n var scale = 0;\n switch (dest[1].name) {\n case 'XYZ':\n x = dest[2];\n y = dest[3];\n scale = dest[4];\n // If x and/or y coordinates are not supplied, default to\n // _top_ left of the page (not the obvious bottom left,\n // since aligning the bottom of the intended page with the\n // top of the window is rarely helpful).\n x = x !== null ? x : 0;\n y = y !== null ? y : pageHeight;\n break;\n case 'Fit':\n case 'FitB':\n scale = 'page-fit';\n break;\n case 'FitH':\n case 'FitBH':\n y = dest[2];\n scale = 'page-width';\n // According to the PDF spec, section 12.3.2.2, a `null` value in the\n // parameter should maintain the position relative to the new page.\n if (y === null && this._location) {\n x = this._location.left;\n y = this._location.top;\n }\n break;\n case 'FitV':\n case 'FitBV':\n x = dest[2];\n width = pageWidth;\n height = pageHeight;\n scale = 'page-height';\n break;\n case 'FitR':\n x = dest[2];\n y = dest[3];\n width = dest[4] - x;\n height = dest[5] - y;\n var hPadding = this.removePageBorders ? 0 : SCROLLBAR_PADDING;\n var vPadding = this.removePageBorders ? 0 : VERTICAL_PADDING;\n\n widthScale = (this.container.clientWidth - hPadding) /\n width / CSS_UNITS;\n heightScale = (this.container.clientHeight - vPadding) /\n height / CSS_UNITS;\n scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));\n break;\n default:\n console.error('PDFViewer_scrollPageIntoView: \\'' + dest[1].name +\n '\\' is not a valid destination type.');\n return;\n }\n\n if (scale && scale !== this._currentScale) {\n this.currentScaleValue = scale;\n } else if (this._currentScale === UNKNOWN_SCALE) {\n this.currentScaleValue = DEFAULT_SCALE_VALUE;\n }\n\n if (scale === 'page-fit' && !dest[4]) {\n scrollIntoView(pageView.div);\n return;\n }\n\n var boundingRect = [\n pageView.viewport.convertToViewportPoint(x, y),\n pageView.viewport.convertToViewportPoint(x + width, y + height)\n ];\n var left = Math.min(boundingRect[0][0], boundingRect[1][0]);\n var top = Math.min(boundingRect[0][1], boundingRect[1][1]);\n\n if (!allowNegativeOffset) {\n // Some bad PDF generators will create destinations with e.g. top values\n // that exceeds the page height. Ensure that offsets are not negative,\n // to prevent a previous page from becoming visible (fixes bug 874482).\n left = Math.max(left, 0);\n top = Math.max(top, 0);\n }\n scrollIntoView(pageView.div, { left, top, });\n },\n\n _updateLocation(firstPage) {\n var currentScale = this._currentScale;\n var currentScaleValue = this._currentScaleValue;\n var normalizedScaleValue =\n parseFloat(currentScaleValue) === currentScale ?\n Math.round(currentScale * 10000) / 100 : currentScaleValue;\n\n var pageNumber = firstPage.id;\n var pdfOpenParams = '#page=' + pageNumber;\n pdfOpenParams += '&zoom=' + normalizedScaleValue;\n var currentPageView = this._pages[pageNumber - 1];\n var container = this.container;\n var topLeft = currentPageView.getPagePoint(\n (container.scrollLeft - firstPage.x),\n (container.scrollTop - firstPage.y));\n var intLeft = Math.round(topLeft[0]);\n var intTop = Math.round(topLeft[1]);\n pdfOpenParams += ',' + intLeft + ',' + intTop;\n\n this._location = {\n pageNumber,\n scale: normalizedScaleValue,\n top: intTop,\n left: intLeft,\n pdfOpenParams,\n };\n },\n\n update: function PDFViewer_update() {\n var visible = this._getVisiblePages();\n var visiblePages = visible.views;\n if (visiblePages.length === 0) {\n return;\n }\n\n var suggestedCacheSize = Math.max(DEFAULT_CACHE_SIZE,\n 2 * visiblePages.length + 1);\n this._buffer.resize(suggestedCacheSize);\n\n this.renderingQueue.renderHighestPriority(visible);\n\n var currentId = this._currentPageNumber;\n var firstPage = visible.first;\n\n for (var i = 0, ii = visiblePages.length, stillFullyVisible = false;\n i < ii; ++i) {\n var page = visiblePages[i];\n\n if (page.percent < 100) {\n break;\n }\n if (page.id === currentId) {\n stillFullyVisible = true;\n break;\n }\n }\n\n if (!stillFullyVisible) {\n currentId = visiblePages[0].id;\n }\n\n if (!this.isInPresentationMode) {\n this._setCurrentPageNumber(currentId);\n }\n\n this._updateLocation(firstPage);\n\n this.eventBus.dispatch('updateviewarea', {\n source: this,\n location: this._location\n });\n },\n\n containsElement(element) {\n return this.container.contains(element);\n },\n\n focus() {\n this.container.focus();\n },\n\n get isInPresentationMode() {\n return this.presentationModeState === PresentationModeState.FULLSCREEN;\n },\n\n get isChangingPresentationMode() {\n return this.presentationModeState === PresentationModeState.CHANGING;\n },\n\n get isHorizontalScrollbarEnabled() {\n return (this.isInPresentationMode ?\n false : (this.container.scrollWidth > this.container.clientWidth));\n },\n\n _getVisiblePages() {\n if (!this.isInPresentationMode) {\n return getVisibleElements(this.container, this._pages, true);\n }\n // The algorithm in getVisibleElements doesn't work in all browsers and\n // configurations when presentation mode is active.\n var visible = [];\n var currentPage = this._pages[this._currentPageNumber - 1];\n visible.push({ id: currentPage.id, view: currentPage });\n return { first: currentPage, last: currentPage, views: visible };\n },\n\n cleanup() {\n for (var i = 0, ii = this._pages.length; i < ii; i++) {\n if (this._pages[i] &&\n this._pages[i].renderingState !== RenderingStates.FINISHED) {\n this._pages[i].reset();\n }\n }\n },\n\n /**\n * @private\n */\n _cancelRendering: function PDFViewer_cancelRendering() {\n for (var i = 0, ii = this._pages.length; i < ii; i++) {\n if (this._pages[i]) {\n this._pages[i].cancelRendering();\n }\n }\n },\n\n /**\n * @param {PDFPageView} pageView\n * @returns {PDFPage}\n * @private\n */\n _ensurePdfPageLoaded(pageView) {\n if (pageView.pdfPage) {\n return Promise.resolve(pageView.pdfPage);\n }\n var pageNumber = pageView.id;\n if (this._pagesRequests[pageNumber]) {\n return this._pagesRequests[pageNumber];\n }\n var promise = this.pdfDocument.getPage(pageNumber).then((pdfPage) => {\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n this._pagesRequests[pageNumber] = null;\n return pdfPage;\n });\n this._pagesRequests[pageNumber] = promise;\n return promise;\n },\n\n forceRendering(currentlyVisiblePages) {\n var visiblePages = currentlyVisiblePages || this._getVisiblePages();\n var pageView = this.renderingQueue.getHighestPriority(visiblePages,\n this._pages,\n this.scroll.down);\n if (pageView) {\n this._ensurePdfPageLoaded(pageView).then(() => {\n this.renderingQueue.renderView(pageView);\n });\n return true;\n }\n return false;\n },\n\n getPageTextContent(pageIndex) {\n return this.pdfDocument.getPage(pageIndex + 1).then(function (page) {\n return page.getTextContent({\n normalizeWhitespace: true,\n });\n });\n },\n\n /**\n * @param {HTMLDivElement} textLayerDiv\n * @param {number} pageIndex\n * @param {PageViewport} viewport\n * @returns {TextLayerBuilder}\n */\n createTextLayerBuilder(textLayerDiv, pageIndex, viewport,\n enhanceTextSelection = false) {\n return new TextLayerBuilder({\n textLayerDiv,\n eventBus: this.eventBus,\n pageIndex,\n viewport,\n findController: this.isInPresentationMode ? null : this.findController,\n enhanceTextSelection: this.isInPresentationMode ? false :\n enhanceTextSelection,\n });\n },\n\n /**\n * @param {HTMLDivElement} pageDiv\n * @param {PDFPage} pdfPage\n * @param {boolean} renderInteractiveForms\n * @returns {AnnotationLayerBuilder}\n */\n createAnnotationLayerBuilder(pageDiv, pdfPage,\n renderInteractiveForms = false) {\n return new AnnotationLayerBuilder({\n pageDiv,\n pdfPage,\n renderInteractiveForms,\n linkService: this.linkService,\n downloadManager: this.downloadManager\n });\n },\n\n setFindController(findController) {\n this.findController = findController;\n },\n\n /**\n * Returns sizes of the pages.\n * @returns {Array} Array of objects with width/height/rotation fields.\n */\n getPagesOverview() {\n var pagesOverview = this._pages.map(function (pageView) {\n var viewport = pageView.pdfPage.getViewport(1);\n return {\n width: viewport.width,\n height: viewport.height,\n rotation: viewport.rotation,\n };\n });\n if (!this.enablePrintAutoRotate) {\n return pagesOverview;\n }\n var isFirstPagePortrait = isPortraitOrientation(pagesOverview[0]);\n return pagesOverview.map(function (size) {\n if (isFirstPagePortrait === isPortraitOrientation(size)) {\n return size;\n }\n return {\n width: size.height,\n height: size.width,\n rotation: (size.rotation + 90) % 360,\n };\n });\n },\n };\n\n return PDFViewer;\n})();\n\nexport {\n PresentationModeState,\n PDFViewer,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_viewer.js","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use strict';\n\nvar pdfjsLib = require('./pdfjs.js');\nvar pdfjsWebPDFViewer = require('./pdf_viewer.js');\nvar pdfjsWebPDFPageView = require('./pdf_page_view.js');\nvar pdfjsWebPDFLinkService = require('./pdf_link_service.js');\nvar pdfjsWebTextLayerBuilder = require('./text_layer_builder.js');\nvar pdfjsWebAnnotationLayerBuilder = require('./annotation_layer_builder.js');\nvar pdfjsWebPDFHistory = require('./pdf_history.js');\nvar pdfjsWebPDFFindController = require('./pdf_find_controller.js');\nvar pdfjsWebUIUtils = require('./ui_utils.js');\nvar pdfjsWebDownloadManager = require('./download_manager.js');\n\nvar PDFJS = pdfjsLib.PDFJS;\n\nPDFJS.PDFViewer = pdfjsWebPDFViewer.PDFViewer;\nPDFJS.PDFPageView = pdfjsWebPDFPageView.PDFPageView;\nPDFJS.PDFLinkService = pdfjsWebPDFLinkService.PDFLinkService;\nPDFJS.TextLayerBuilder = pdfjsWebTextLayerBuilder.TextLayerBuilder;\nPDFJS.DefaultTextLayerFactory =\n pdfjsWebTextLayerBuilder.DefaultTextLayerFactory;\nPDFJS.AnnotationLayerBuilder =\n pdfjsWebAnnotationLayerBuilder.AnnotationLayerBuilder;\nPDFJS.DefaultAnnotationLayerFactory =\n pdfjsWebAnnotationLayerBuilder.DefaultAnnotationLayerFactory;\nPDFJS.PDFHistory = pdfjsWebPDFHistory.PDFHistory;\nPDFJS.PDFFindController = pdfjsWebPDFFindController.PDFFindController;\nPDFJS.EventBus = pdfjsWebUIUtils.EventBus;\n\nPDFJS.DownloadManager = pdfjsWebDownloadManager.DownloadManager;\nPDFJS.ProgressBar = pdfjsWebUIUtils.ProgressBar;\n\nexports.PDFJS = PDFJS;\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_viewer.component.js"],"sourceRoot":""} |