{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap c93ed04e2713791d6945","webpack:///web/pdfjs.js","webpack:///web/ui_utils.js","webpack:///web/dom_events.js","webpack:///web/pdf_link_service.js","webpack:///web/pdf_rendering_queue.js","webpack:///web/annotation_layer_builder.js","webpack:///web/pdf_page_view.js","webpack:///web/text_layer_builder.js","webpack:///web/pdf_viewer.component.js","webpack:///web/pdf_viewer.js","webpack:///web/pdf_history.js","webpack:///web/pdf_find_controller.js","webpack:///web/download_manager.js","webpack:///web/genericl10n.js","webpack:///external/webL10n/l10n.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;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;;;;;;;;AC7CA;;AAEA,IAAI;AACJ,IAAI,OAAO,WAAW,eAAe,OAAO,yBAAyB;AACnE,aAAW,OAAO;AADpB,OAEO;AACL,aAAW,QAAwB;AAtBrC;AAwBA,OAAO,UAAU,S;;;;;;;;;;;;;;;;;;ACT8B;;;;AAE/C,IAAM,YAAY,OAAO;AACzB,IAAM,sBAAsB;AAC5B,IAAM,gBAAgB;AACtB,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,gBAAgB;AACtB,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;AAC1B,IAAM,mBAAmB;AAEzB,IAAM;AACJ,UAAQ;AACR,OAAK;AAFc;AAMrB,SAAS,gBAAgB,MAAM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N,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,aAAO;AACP,aAAO;AACP,aAAO;AACP,aAAO;AACP,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,aAAO;AACP,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,aAAO;AACP,aAAO;AACP,aAAO;AACP,YAAM;AACN,aAAO;AACP,aAAO;AACP,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,aAAO;AACP,aAAO;AACP,aAAO;AACP,aAAO;AACP,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;AACN,YAAM;AACN,aAAO;AACP,YAAM;AACN,YAAM;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AARsB;AAhDrB;AAAA;AAz6BU,CAAC,CAw+BhB,QAAQ,U","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// 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 = 8);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap c93ed04e2713791d6945","/* 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, __non_webpack_require__ */\n\n'use strict';\n\nvar pdfjsLib;\nif (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) {\n pdfjsLib = window['pdfjs-dist/build/pdf'];\n} else {\n pdfjsLib = __non_webpack_require__('../build/pdf.js');\n}\nmodule.exports = pdfjsLib;\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 { createPromiseCapability, PDFJS } from 'pdfjs-lib';\n\nconst CSS_UNITS = 96.0 / 72.0;\nconst DEFAULT_SCALE_VALUE = 'auto';\nconst DEFAULT_SCALE = 1.0;\nconst MIN_SCALE = 0.25;\nconst MAX_SCALE = 10.0;\nconst UNKNOWN_SCALE = 0;\nconst MAX_AUTO_SCALE = 1.25;\nconst SCROLLBAR_PADDING = 40;\nconst VERTICAL_PADDING = 5;\n\nconst RendererType = {\n CANVAS: 'canvas',\n SVG: 'svg',\n};\n\n// Replaces {{arguments}} with their values.\nfunction formatL10nValue(text, args) {\n if (!args) {\n return text;\n }\n return text.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (all, name) => {\n return (name in args ? args[name] : '{{' + name + '}}');\n });\n}\n\n/**\n * No-op implemetation of the localization service.\n * @implements {IL10n}\n */\nlet NullL10n = {\n get(property, args, fallback) {\n return Promise.resolve(formatL10nValue(fallback, args));\n },\n\n translate(element) {\n return Promise.resolve();\n },\n};\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 let devicePixelRatio = window.devicePixelRatio || 1;\n let backingStoreRatio = ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio || 1;\n let 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 = false) {\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 let parent = element.offsetParent;\n if (!parent) {\n console.error('offsetParent is not set -- cannot scroll');\n return;\n }\n let offsetY = element.offsetTop + element.clientTop;\n let offsetX = element.offsetLeft + element.clientLeft;\n while (parent.clientHeight === parent.scrollHeight ||\n (skipOverflowHiddenElements &&\n 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 let debounceScroll = function(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 let currentY = viewAreaElement.scrollTop;\n let lastY = state.lastY;\n if (currentY !== lastY) {\n state.down = currentY > lastY;\n }\n state.lastY = currentY;\n callback(state);\n });\n };\n\n let state = {\n down: true,\n lastY: viewAreaElement.scrollTop,\n _eventHandler: debounceScroll,\n };\n\n let 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 let parts = query.split('&');\n let params = Object.create(null);\n for (let i = 0, ii = parts.length; i < ii; ++i) {\n let param = parts[i].split('=');\n let key = param[0].toLowerCase();\n let 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 let minIndex = 0;\n let 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 let currentIndex = (minIndex + maxIndex) >> 1;\n let 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 let xinv = 1 / x;\n let limit = 8;\n if (xinv > limit) {\n return [1, limit];\n } else if (Math.floor(xinv) === xinv) {\n return [1, xinv];\n }\n\n let x_ = x > 1 ? xinv : x;\n // a/b and c/d are neighbours in Farey sequence.\n let 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 let 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 let 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 let 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 = false) {\n let top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight;\n let left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth;\n\n function isElementBottomBelowViewTop(view) {\n let element = view.div;\n let elementBottom =\n element.offsetTop + element.clientTop + element.clientHeight;\n return elementBottom > top;\n }\n\n let visible = [], view, element;\n let currentHeight, viewHeight, hiddenHeight, percentHeight;\n let currentWidth, viewWidth;\n let firstVisibleElementInd = views.length === 0 ? 0 :\n binarySearchFirstItem(views, isElementBottomBelowViewTop);\n\n for (let 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 let first = visible[0];\n let last = visible[visible.length - 1];\n\n if (sortByVisibility) {\n visible.sort(function(a, b) {\n let 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(evt) {\n evt.preventDefault();\n}\n\nfunction isDataSchema(url) {\n let 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 const reURI = /^(?:(?:[^:]+:)?\\/\\/[^\\/]+)?([^?#]*)(\\?[^#]*)?(#.*)?$/;\n // SCHEME HOST 1.PATH 2.QUERY 3.REF\n // Pattern to get last matching NAME.pdf\n const reFilename = /[^\\/?#=]+\\.pdf\\b(?!.*\\.pdf\\b)/i;\n let splitURI = reURI.exec(url);\n let 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 (ex) { // 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 let delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY);\n let 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 const MOUSE_DOM_DELTA_PIXEL_MODE = 0;\n const MOUSE_DOM_DELTA_LINE_MODE = 1;\n const MOUSE_PIXELS_PER_LINE = 30;\n const 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 isValidRotation(angle) {\n return Number.isInteger(angle) && angle % 90 === 0;\n}\n\nfunction cloneObj(obj) {\n let result = Object.create(null);\n for (let i in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, i)) {\n result[i] = obj[i];\n }\n }\n return result;\n}\n\nconst WaitOnType = {\n EVENT: 'event',\n TIMEOUT: 'timeout',\n};\n\n/**\n * @typedef {Object} WaitOnEventOrTimeoutParameters\n * @property {Object} target - The event target, can for example be:\n * `window`, `document`, a DOM element, or an {EventBus} instance.\n * @property {string} name - The name of the event.\n * @property {number} delay - The delay, in milliseconds, after which the\n * timeout occurs (if the event wasn't already dispatched).\n */\n\n/**\n * Allows waiting for an event or a timeout, whichever occurs first.\n * Can be used to ensure that an action always occurs, even when an event\n * arrives late or not at all.\n *\n * @param {WaitOnEventOrTimeoutParameters}\n * @returns {Promise} A promise that is resolved with a {WaitOnType} value.\n */\nfunction waitOnEventOrTimeout({ target, name, delay = 0, }) {\n if (typeof target !== 'object' || !(name && typeof name === 'string') ||\n !(Number.isInteger(delay) && delay >= 0)) {\n return Promise.reject(\n new Error('waitOnEventOrTimeout - invalid paramaters.'));\n }\n let capability = createPromiseCapability();\n\n function handler(type) {\n if (target instanceof EventBus) {\n target.off(name, eventHandler);\n } else {\n target.removeEventListener(name, eventHandler);\n }\n\n if (timeout) {\n clearTimeout(timeout);\n }\n capability.resolve(type);\n }\n\n let eventHandler = handler.bind(null, WaitOnType.EVENT);\n if (target instanceof EventBus) {\n target.on(name, eventHandler);\n } else {\n target.addEventListener(name, eventHandler);\n }\n\n let timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);\n let timeout = setTimeout(timeoutHandler, delay);\n\n return capability.promise;\n}\n\n/**\n * Promise that is resolved when DOM window becomes visible.\n */\nlet animationStarted = new Promise(function (resolve) {\n window.requestAnimationFrame(resolve);\n});\n\n/**\n * (deprecated) External localization service.\n */\nlet mozL10n;\n\n/**\n * (deprecated) Promise that is resolved when UI localization is finished.\n */\nlet localized = Promise.resolve();\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 */\nclass EventBus {\n constructor() {\n this._listeners = Object.create(null);\n }\n\n on(eventName, listener) {\n let eventListeners = this._listeners[eventName];\n if (!eventListeners) {\n eventListeners = [];\n this._listeners[eventName] = eventListeners;\n }\n eventListeners.push(listener);\n }\n\n off(eventName, listener) {\n let eventListeners = this._listeners[eventName];\n let i;\n if (!eventListeners || ((i = eventListeners.indexOf(listener)) < 0)) {\n return;\n }\n eventListeners.splice(i, 1);\n }\n\n dispatch(eventName) {\n let eventListeners = this._listeners[eventName];\n if (!eventListeners || eventListeners.length === 0) {\n return;\n }\n // Passing all arguments after the eventName to the listeners.\n let 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\nfunction clamp(v, min, max) {\n return Math.min(Math.max(v, min), max);\n}\n\nclass ProgressBar {\n constructor(id, { height, width, units, } = {}) {\n this.visible = true;\n\n // Fetch the sub-elements for later.\n this.div = document.querySelector(id + ' .progress');\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 = height || 100;\n this.width = width || 100;\n this.units = units || '%';\n\n // Initialize heights.\n this.div.style.height = this.height + this.units;\n this.percent = 0;\n }\n\n _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 let 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(viewer) {\n if (!viewer) {\n return;\n }\n let container = viewer.parentNode;\n let scrollbarWidth = container.offsetWidth - viewer.offsetWidth;\n if (scrollbarWidth > 0) {\n this.bar.setAttribute('style', 'width: calc(100% - ' +\n scrollbarWidth + 'px);');\n }\n }\n\n 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() {\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\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 isValidRotation,\n cloneObj,\n RendererType,\n mozL10n,\n NullL10n,\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 WaitOnType,\n waitOnEventOrTimeout,\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 let event = document.createEvent('CustomEvent');\n event.initCustomEvent('documentload', true, true, {});\n window.dispatchEvent(event);\n });\n eventBus.on('pagerendered', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('pagerendered', true, true, {\n pageNumber: evt.pageNumber,\n cssTransform: evt.cssTransform,\n });\n evt.source.div.dispatchEvent(event);\n });\n eventBus.on('textlayerrendered', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('textlayerrendered', true, true, {\n pageNumber: evt.pageNumber,\n });\n evt.source.textLayerDiv.dispatchEvent(event);\n });\n eventBus.on('pagechange', function(evt) {\n let event = document.createEvent('UIEvents');\n event.initUIEvent('pagechange', true, true, window, 0);\n event.pageNumber = evt.pageNumber;\n evt.source.container.dispatchEvent(event);\n });\n eventBus.on('pagesinit', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('pagesinit', true, true, null);\n evt.source.container.dispatchEvent(event);\n });\n eventBus.on('pagesloaded', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('pagesloaded', true, true, {\n pagesCount: evt.pagesCount,\n });\n evt.source.container.dispatchEvent(event);\n });\n eventBus.on('scalechange', function(evt) {\n let event = document.createEvent('UIEvents');\n event.initUIEvent('scalechange', true, true, window, 0);\n event.scale = evt.scale;\n event.presetValue = evt.presetValue;\n evt.source.container.dispatchEvent(event);\n });\n eventBus.on('updateviewarea', function(evt) {\n let event = document.createEvent('UIEvents');\n event.initUIEvent('updateviewarea', true, true, window, 0);\n event.location = evt.location;\n evt.source.container.dispatchEvent(event);\n });\n eventBus.on('find', function(evt) {\n if (evt.source === window) {\n return; // event comes from FirefoxCom, no need to replicate\n }\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('find' + evt.type, true, true, {\n query: evt.query,\n phraseSearch: evt.phraseSearch,\n caseSensitive: evt.caseSensitive,\n highlightAll: evt.highlightAll,\n findPrevious: evt.findPrevious,\n });\n window.dispatchEvent(event);\n });\n eventBus.on('attachmentsloaded', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('attachmentsloaded', true, true, {\n attachmentsCount: evt.attachmentsCount,\n });\n evt.source.container.dispatchEvent(event);\n });\n eventBus.on('sidebarviewchanged', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('sidebarviewchanged', true, true, {\n view: evt.view,\n });\n evt.source.outerContainer.dispatchEvent(event);\n });\n eventBus.on('pagemode', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('pagemode', true, true, {\n mode: evt.mode,\n });\n evt.source.pdfViewer.container.dispatchEvent(event);\n });\n eventBus.on('namedaction', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('namedaction', true, true, {\n action: evt.action,\n });\n evt.source.pdfViewer.container.dispatchEvent(event);\n });\n eventBus.on('presentationmodechanged', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('presentationmodechanged', true, true, {\n active: evt.active,\n switchInProgress: evt.switchInProgress,\n });\n window.dispatchEvent(event);\n });\n eventBus.on('outlineloaded', function(evt) {\n let event = document.createEvent('CustomEvent');\n event.initCustomEvent('outlineloaded', true, true, {\n outlineCount: evt.outlineCount,\n });\n evt.source.container.dispatchEvent(event);\n });\n}\n\nlet 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\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 * @implements {IPDFLinkService}\n */\nclass PDFLinkService {\n /**\n * @param {PDFLinkServiceOptions} options\n */\n constructor({ eventBus, } = {}) {\n this.eventBus = 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 setDocument(pdfDocument, baseUrl) {\n this.baseUrl = baseUrl;\n this.pdfDocument = pdfDocument;\n this._pagesRefCache = Object.create(null);\n }\n\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n\n 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 * @returns {number}\n */\n get rotation() {\n return this.pdfViewer.pagesRotation;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {\n this.pdfViewer.pagesRotation = value;\n }\n\n /**\n * @param {string|Array} dest - The named, or explicit, PDF destination.\n */\n navigateTo(dest) {\n let goToDestination = ({ namedDest, explicitDest, }) => {\n // Dest array looks like that: \n let destRef = explicitDest[0], pageNumber;\n\n if (destRef instanceof Object) {\n pageNumber = this._cachedPageNumber(destRef);\n\n if (pageNumber === null) {\n // Fetch the page reference if it's not yet available. This could\n // only occur during loading, before all pages have been resolved.\n this.pdfDocument.getPageIndex(destRef).then((pageIndex) => {\n this.cachePageRef(pageIndex + 1, destRef);\n goToDestination({ namedDest, explicitDest, });\n }).catch(() => {\n console.error(`PDFLinkService.navigateTo: \"${destRef}\" is not ` +\n `a valid page reference, for dest=\"${dest}\".`);\n });\n return;\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n } else {\n console.error(`PDFLinkService.navigateTo: \"${destRef}\" is not ` +\n `a valid destination reference, for dest=\"${dest}\".`);\n return;\n }\n if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n console.error(`PDFLinkService.navigateTo: \"${pageNumber}\" is not ` +\n `a valid page number, for dest=\"${dest}\".`);\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new destination into\n // view, to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.push({ namedDest, explicitDest, pageNumber, });\n }\n\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: explicitDest,\n });\n };\n\n new Promise((resolve, reject) => {\n if (typeof dest === 'string') {\n this.pdfDocument.getDestination(dest).then((destArray) => {\n resolve({\n namedDest: dest,\n explicitDest: destArray,\n });\n });\n return;\n }\n resolve({\n namedDest: '',\n explicitDest: dest,\n });\n }).then((data) => {\n if (!(data.explicitDest instanceof Array)) {\n console.error(`PDFLinkService.navigateTo: \"${data.explicitDest}\" is` +\n ` not a valid destination array, for dest=\"${dest}\".`);\n return;\n }\n goToDestination(data);\n });\n }\n\n /**\n * @param {string|Array} dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n if (typeof dest === 'string') {\n return this.getAnchorUrl('#' + escape(dest));\n }\n if (dest instanceof Array) {\n let 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 .\n * @param {String} anchor The anchor hash, including the #.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(anchor) {\n return (this.baseUrl || '') + anchor;\n }\n\n /**\n * @param {string} hash\n */\n setHash(hash) {\n let pageNumber, dest;\n if (hash.indexOf('=') >= 0) {\n let 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 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 let zoomArgs = params.zoom.split(','); // scale,left,top\n let zoomArg = zoomArgs[0];\n let 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(\n 'PDFLinkService.setHash: 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}\" is not ` +\n '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 /^\\d+$/.test(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 this.navigateTo(dest);\n return;\n }\n console.error(`PDFLinkService.setHash: \"${unescape(hash)}\" is not ` +\n 'a valid destination.');\n }\n }\n\n /**\n * @param {string} action\n */\n 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({ id, filename, content, }) {\n this.eventBus.dispatch('fileattachmentannotation', {\n source: this,\n id,\n filename,\n content,\n });\n }\n\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {\n let refStr = pageRef.num + ' ' + pageRef.gen + ' R';\n this._pagesRefCache[refStr] = pageNum;\n }\n\n _cachedPageNumber(pageRef) {\n let refStr = pageRef.num + ' ' + pageRef.gen + ' R';\n return (this._pagesRefCache && this._pagesRefCache[refStr]) || null;\n }\n}\n\nfunction isValidExplicitDestination(dest) {\n if (!(dest instanceof Array)) {\n return false;\n }\n let destLength = dest.length, allowNull = true;\n if (destLength < 2) {\n return false;\n }\n let page = dest[0];\n if (!(typeof page === 'object' &&\n Number.isInteger(page.num) && Number.isInteger(page.gen)) &&\n !(Number.isInteger(page) && page >= 0)) {\n return false;\n }\n let 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 (let i = 2; i < destLength; i++) {\n let param = dest[i];\n if (!(typeof param === 'number' || (allowNull && param === null))) {\n return false;\n }\n }\n return true;\n}\n\nclass SimpleLinkService {\n /**\n * @returns {number}\n */\n get page() {\n return 0;\n }\n /**\n * @param {number} value\n */\n set page(value) {}\n /**\n * @returns {number}\n */\n get rotation() {\n return 0;\n }\n /**\n * @param {number} value\n */\n set rotation(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({ id, filename, content, }) {}\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {}\n}\n\nexport {\n PDFLinkService,\n SimpleLinkService,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_link_service.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 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-lib';\nimport { NullL10n } 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 * @property {IL10n} l10n - Localization service.\n */\n\nclass AnnotationLayerBuilder {\n /**\n * @param {AnnotationLayerBuilderOptions} options\n */\n constructor({ pageDiv, pdfPage, linkService, downloadManager,\n renderInteractiveForms = false, l10n = NullL10n, }) {\n this.pageDiv = pageDiv;\n this.pdfPage = pdfPage;\n this.linkService = linkService;\n this.downloadManager = downloadManager;\n this.renderInteractiveForms = renderInteractiveForms;\n this.l10n = l10n;\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 let 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 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 this.l10n.translate(this.div);\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 * @param {IL10n} l10n\n * @returns {AnnotationLayerBuilder}\n */\n createAnnotationLayerBuilder(pageDiv, pdfPage, renderInteractiveForms = false,\n l10n = NullL10n) {\n return new AnnotationLayerBuilder({\n pageDiv,\n pdfPage,\n renderInteractiveForms,\n linkService: new SimpleLinkService(),\n l10n,\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, NullL10n,\n RendererType, roundToDivide\n} from './ui_utils';\nimport {\n createPromiseCapability, CustomStyle, PDFJS, RenderingCancelledException,\n SVGGraphics\n} from 'pdfjs-lib';\nimport { getGlobalEventBus } from './dom_events';\nimport { RenderingStates } from './pdf_rendering_queue';\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 * @property {IL10n} l10n - Localization service.\n */\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFPageView {\n /**\n * @param {PDFPageViewOptions} options\n */\n constructor(options) {\n let container = options.container;\n let defaultViewport = options.defaultViewport;\n\n this.id = options.id;\n this.renderingId = 'page' + this.id;\n\n this.pdfPage = null;\n this.pageLabel = null;\n this.rotation = 0;\n this.scale = options.scale || DEFAULT_SCALE;\n this.viewport = defaultViewport;\n this.pdfPageRotate = defaultViewport.rotation;\n this.hasRestrictedScaling = false;\n this.enhanceTextSelection = options.enhanceTextSelection || false;\n this.renderInteractiveForms = options.renderInteractiveForms || false;\n\n this.eventBus = options.eventBus || getGlobalEventBus();\n this.renderingQueue = options.renderingQueue;\n this.textLayerFactory = options.textLayerFactory;\n this.annotationLayerFactory = options.annotationLayerFactory;\n this.renderer = options.renderer || RendererType.CANVAS;\n this.l10n = options.l10n || NullL10n;\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.annotationLayer = null;\n this.textLayer = null;\n this.zoomLayer = null;\n\n let 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 setPdfPage(pdfPage) {\n this.pdfPage = pdfPage;\n this.pdfPageRotate = pdfPage.rotate;\n\n let 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() {\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 let 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 parent node is undefined.\n this.zoomLayer.remove();\n }\n this.zoomLayer = null;\n }\n\n reset(keepZoomLayer = false, keepAnnotations = false) {\n this.cancelRendering();\n\n let 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 let childNodes = div.childNodes;\n let currentZoomLayerNode = (keepZoomLayer && this.zoomLayer) || null;\n let currentAnnotationNode = (keepAnnotations && this.annotationLayer &&\n this.annotationLayer.div) || null;\n for (let i = childNodes.length - 1; i >= 0; i--) {\n let 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 the annotation layer 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(scale, rotation) {\n this.scale = scale || this.scale;\n if (typeof rotation !== 'undefined') { // The rotation may be zero.\n this.rotation = rotation;\n }\n\n let 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 let isScalingRestricted = false;\n if (this.canvas && PDFJS.maxCanvasPixels > 0) {\n let 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 && !this.canvas.hasAttribute('hidden')) {\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() {\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 cssTransform(target, redrawAnnotations = false) {\n // Scale target (canvas or svg), its wrapper and page container.\n let width = this.viewport.width;\n let height = this.viewport.height;\n let 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 let relativeRotation = this.viewport.rotation -\n this.paintedViewportMap.get(target).rotation;\n let absRotation = Math.abs(relativeRotation);\n let 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 let 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 and then rotating overall.\n let textLayerViewport = this.textLayer.viewport;\n let textRelativeRotation = this.viewport.rotation -\n textLayerViewport.rotation;\n let textAbsRotation = Math.abs(textRelativeRotation);\n let scale = width / textLayerViewport.width;\n if (textAbsRotation === 90 || textAbsRotation === 270) {\n scale = width / textLayerViewport.height;\n }\n let textLayerDiv = this.textLayer.textLayerDiv;\n let 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(x, y) {\n return this.viewport.convertToPdfPoint(x, y);\n }\n\n 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 if (!this.pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n return Promise.reject(new Error('Page is not loaded'));\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n let pdfPage = this.pdfPage;\n let div = this.div;\n // Wrap the canvas so that if it has a CSS transform for high DPI the\n // overflow will be hidden in Firefox.\n let 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 // The annotation layer needs to stay on top.\n div.insertBefore(canvasWrapper, this.annotationLayer.div);\n } else {\n div.appendChild(canvasWrapper);\n }\n\n let textLayer = null;\n if (this.textLayerFactory) {\n let 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 // The annotation layer 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 let renderContinueCallback = null;\n if (this.renderingQueue) {\n renderContinueCallback = (cont) => {\n if (!this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n }\n\n let 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 === this.paintTask) {\n this.paintTask = null;\n }\n\n if (((typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('PDFJS_NEXT')) && error === 'cancelled') ||\n error instanceof RenderingCancelledException) {\n this.error = null;\n return Promise.resolve(undefined);\n }\n\n this.renderingState = RenderingStates.FINISHED;\n\n if (this.loadingIconDiv) {\n div.removeChild(this.loadingIconDiv);\n delete this.loadingIconDiv;\n }\n this._resetZoomLayer(/* removeFromDOM = */ true);\n\n this.error = error;\n this.stats = pdfPage.stats;\n if (this.onAfterDraw) {\n this.onAfterDraw();\n }\n this.eventBus.dispatch('pagerendered', {\n source: this,\n pageNumber: this.id,\n cssTransform: false,\n });\n\n if (error) {\n return Promise.reject(error);\n }\n return Promise.resolve(undefined);\n };\n\n let paintTask = this.renderer === RendererType.SVG ?\n this.paintOnSvg(canvasWrapper) :\n this.paintOnCanvas(canvasWrapper);\n paintTask.onRenderContinue = renderContinueCallback;\n this.paintTask = paintTask;\n\n let resultPromise = paintTask.promise.then(function() {\n return finishPaintTask(null).then(function () {\n if (textLayer) {\n let readableStream = pdfPage.streamTextContent({\n normalizeWhitespace: true,\n });\n textLayer.setTextContentStream(readableStream);\n textLayer.render();\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, this.l10n);\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 let renderCapability = createPromiseCapability();\n let result = {\n promise: renderCapability.promise,\n onRenderContinue(cont) {\n cont();\n },\n cancel() {\n renderTask.cancel();\n },\n };\n\n let viewport = this.viewport;\n let canvas = document.createElement('canvas');\n canvas.id = this.renderingId;\n\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 let isCanvasHidden = true;\n let 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 let ctx = canvas.getContext('2d', { alpha: false, });\n let outputScale = getOutputScale(ctx);\n this.outputScale = outputScale;\n\n if (PDFJS.useOnlyCssZoom) {\n let actualSizeViewport = viewport.clone({ scale: CSS_UNITS, });\n // Use a scale that makes the canvas have the originally 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 let pixelsInViewport = viewport.width * viewport.height;\n let 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 let sfx = approximateFraction(outputScale.sx);\n let 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 let transform = !outputScale.scaled ? null :\n [outputScale.sx, 0, 0, outputScale.sy, 0, 0];\n let renderContext = {\n canvasContext: ctx,\n transform,\n viewport: this.viewport,\n renderInteractiveForms: this.renderInteractiveForms,\n };\n let 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(function() {\n showCanvas();\n renderCapability.resolve(undefined);\n }, function(error) {\n showCanvas();\n renderCapability.reject(error);\n });\n return result;\n }\n\n 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 let cancelled = false;\n let ensureNotCancelled = () => {\n if (cancelled) {\n if ((typeof PDFJSDev !== 'undefined' &&\n PDFJSDev.test('PDFJS_NEXT')) || PDFJS.pdfjsNext) {\n throw new RenderingCancelledException(\n 'Rendering cancelled, page ' + this.id, 'svg');\n } else {\n throw 'cancelled'; // eslint-disable-line no-throw-literal\n }\n }\n };\n\n let pdfPage = this.pdfPage;\n let actualSizeViewport = this.viewport.clone({ scale: CSS_UNITS, });\n let promise = pdfPage.getOperatorList().then((opList) => {\n ensureNotCancelled();\n let svgGfx = new SVGGraphics(pdfPage.commonObjs, pdfPage.objs);\n return svgGfx.getSVG(opList, actualSizeViewport).then((svg) => {\n ensureNotCancelled();\n this.svg = svg;\n this.paintedViewportMap.set(svg, actualSizeViewport);\n\n svg.style.width = wrapper.style.width;\n svg.style.height = wrapper.style.height;\n this.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(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\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-lib';\n\nconst 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 * The text layer builder provides text selection functionality for the PDF.\n * It does this by creating overlay divs over the PDF's 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 */\nclass TextLayerBuilder {\n constructor({ textLayerDiv, eventBus, pageIndex, viewport,\n findController = null, enhanceTextSelection = false, }) {\n this.textLayerDiv = textLayerDiv;\n this.eventBus = eventBus || getGlobalEventBus();\n this.textContent = null;\n this.textContentItemsStr = [];\n this.textContentStream = null;\n this.renderingDone = false;\n this.pageIdx = pageIndex;\n this.pageNumber = this.pageIdx + 1;\n this.matches = [];\n this.viewport = viewport;\n this.textDivs = [];\n this.findController = findController;\n this.textLayerRenderTask = null;\n this.enhanceTextSelection = enhanceTextSelection;\n\n this._bindMouse();\n }\n\n /**\n * @private\n */\n _finishRendering() {\n this.renderingDone = true;\n\n if (!this.enhanceTextSelection) {\n let 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 *\n * @param {number} timeout - (optional) wait for a specified amount of\n * milliseconds before rendering\n */\n render(timeout = 0) {\n if (!(this.textContent || this.textContentStream) || this.renderingDone) {\n return;\n }\n this.cancel();\n\n this.textDivs = [];\n let textLayerFrag = document.createDocumentFragment();\n this.textLayerRenderTask = renderTextLayer({\n textContent: this.textContent,\n textContentStream: this.textContentStream,\n container: textLayerFrag,\n viewport: this.viewport,\n textDivs: this.textDivs,\n textContentItemsStr: this.textContentItemsStr,\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 * Cancel rendering of the text layer.\n */\n cancel() {\n if (this.textLayerRenderTask) {\n this.textLayerRenderTask.cancel();\n this.textLayerRenderTask = null;\n }\n }\n\n setTextContentStream(readableStream) {\n this.cancel();\n this.textContentStream = readableStream;\n }\n\n setTextContent(textContent) {\n this.cancel();\n this.textContent = textContent;\n }\n\n convertMatches(matches, matchesLength) {\n let i = 0;\n let iIndex = 0;\n let textContentItemsStr = this.textContentItemsStr;\n let end = textContentItemsStr.length - 1;\n let queryLen = (this.findController === null ?\n 0 : this.findController.state.query.length);\n let ret = [];\n if (!matches) {\n return ret;\n }\n for (let m = 0, len = matches.length; m < len; m++) {\n // Calculate the start position.\n let matchIdx = matches[m];\n\n // Loop over the divIdxs.\n while (i !== end && matchIdx >=\n (iIndex + textContentItemsStr[i].length)) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n if (i === textContentItemsStr.length) {\n console.error('Could not find a matching mapping');\n }\n\n let 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 >\n (iIndex + textContentItemsStr[i].length)) {\n iIndex += textContentItemsStr[i].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(matches) {\n // Early exit if there is nothing to render.\n if (matches.length === 0) {\n return;\n }\n\n let textContentItemsStr = this.textContentItemsStr;\n let textDivs = this.textDivs;\n let prevEnd = null;\n let pageIdx = this.pageIdx;\n let isSelectedPage = (this.findController === null ?\n false : (pageIdx === this.findController.selected.pageIdx));\n let selectedMatchIdx = (this.findController === null ?\n -1 : this.findController.selected.matchIdx);\n let highlightAll = (this.findController === null ?\n false : this.findController.state.highlightAll);\n let infinity = {\n divIdx: -1,\n offset: undefined,\n };\n\n function beginText(begin, className) {\n let divIdx = begin.divIdx;\n textDivs[divIdx].textContent = '';\n appendTextToDiv(divIdx, 0, begin.offset, className);\n }\n\n function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n let div = textDivs[divIdx];\n let content = textContentItemsStr[divIdx].substring(fromOffset, toOffset);\n let node = document.createTextNode(content);\n if (className) {\n let 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 let 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 (let i = i0; i < i1; i++) {\n let match = matches[i];\n let begin = match.begin;\n let end = match.end;\n let isSelected = (isSelectedPage && i === selectedMatchIdx);\n let 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 (let 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() {\n // Only show matches when all rendering is done.\n if (!this.renderingDone) {\n return;\n }\n\n // Clear all matches.\n let matches = this.matches;\n let textDivs = this.textDivs;\n let textContentItemsStr = this.textContentItemsStr;\n let clearedUntilDivIdx = -1;\n\n // Clear all current matches.\n for (let i = 0, len = matches.length; i < len; i++) {\n let match = matches[i];\n let begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);\n for (let n = begin, end = match.end.divIdx; n <= end; n++) {\n let div = textDivs[n];\n div.textContent = textContentItemsStr[n];\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 let 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 * Improves text selection by adding an additional div where the mouse was\n * clicked. This reduces flickering of the content if the mouse is slowly\n * dragged up or down.\n *\n * @private\n */\n _bindMouse() {\n let div = this.textLayerDiv;\n let expandDivsTimer = null;\n\n div.addEventListener('mousedown', (evt) => {\n if (this.enhanceTextSelection && this.textLayerRenderTask) {\n this.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\n let 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 is adjusted to start at mouse click\n // location. This avoids flickering when the selection moves up.\n // However it does not work when selection is started on empty space.\n let adjustTop = evt.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 let divBounds = div.getBoundingClientRect();\n let r = Math.max(0, (evt.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', () => {\n if (this.enhanceTextSelection && this.textLayerRenderTask) {\n if (typeof PDFJSDev === 'undefined' ||\n !PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n expandDivsTimer = setTimeout(() => {\n if (this.textLayerRenderTask) {\n this.textLayerRenderTask.expandTextDivs(false);\n }\n expandDivsTimer = null;\n }, EXPAND_DIVS_TIMEOUT);\n } else {\n this.textLayerRenderTask.expandTextDivs(false);\n }\n return;\n }\n\n let 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\n/**\n * @implements IPDFTextLayerFactory\n */\nclass DefaultTextLayerFactory {\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 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');\nvar pdfjsWebGenericL10n = require('./genericl10n.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;\nPDFJS.GenericL10n = pdfjsWebGenericL10n.GenericL10n;\nPDFJS.NullL10n = pdfjsWebUIUtils.NullL10n;\n\nexports.PDFJS = PDFJS;\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_viewer.component.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-lib';\nimport {\n CSS_UNITS, DEFAULT_SCALE, DEFAULT_SCALE_VALUE, getVisibleElements,\n isValidRotation, MAX_AUTO_SCALE, NullL10n, RendererType, SCROLLBAR_PADDING,\n scrollIntoView, 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\nconst PresentationModeState = {\n UNKNOWN: 0,\n NORMAL: 1,\n CHANGING: 2,\n FULLSCREEN: 3,\n};\n\nconst 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 * @property {IL10n} l10n - Localization service.\n */\n\nfunction PDFPageViewBuffer(size) {\n let data = [];\n this.push = function cachePush(view) {\n let 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\nfunction 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\nfunction isPortraitOrientation(size) {\n return size.width <= size.height;\n}\n\n/**\n * Simple viewer control to display PDF content/pages.\n * @implements {IRenderableView}\n */\nclass PDFViewer {\n /**\n * @param {PDFViewerOptions} options\n */\n constructor(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 this.l10n = options.l10n || NullL10n;\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 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 (!Number.isInteger(val)) {\n throw new Error('Invalid page number.');\n }\n if (!this.pdfDocument) {\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(val, resetCurrentPageView = false) {\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(\n `PDFViewer._setCurrentPageNumber: \"${val}\" is out of bounds.`);\n return;\n }\n\n let 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 let pageNumber = val | 0; // Fallback page number.\n if (this._pageLabels) {\n let 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 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 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 (!isValidRotation(rotation)) {\n throw new Error('Invalid pages rotation angle.');\n }\n if (!this.pdfDocument) {\n return;\n }\n if (this._pagesRotation === rotation) {\n return; // The rotation didn't change.\n }\n this._pagesRotation = rotation;\n\n let pageNumber = this._currentPageNumber;\n\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n let pageView = this._pages[i];\n pageView.update(pageView.scale, rotation);\n }\n // Prevent errors in case the rotation changes *before* the scale has been\n // set to a non-default value.\n if (this._currentScaleValue) {\n this._setScale(this._currentScaleValue, true);\n }\n\n this.eventBus.dispatch('rotationchanging', {\n source: this,\n pagesRotation: rotation,\n pageNumber,\n });\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 let pagesCount = pdfDocument.numPages;\n\n let 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 let isOnePageRenderedResolved = false;\n let onePageRenderedCapability = createPromiseCapability();\n this.onePageRendered = onePageRenderedCapability.promise;\n\n let 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 let 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 firstPagePromise.then((pdfPage) => {\n let scale = this.currentScale;\n let viewport = pdfPage.getViewport(scale * CSS_UNITS);\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n let textLayerFactory = null;\n if (!PDFJS.disableTextLayer) {\n textLayerFactory = this;\n }\n let 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 l10n: this.l10n,\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 let getPagesLeft = pagesCount;\n for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n pdfDocument.getPage(pageNum).then((pdfPage) => {\n let 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 }, (reason) => {\n console.error(`Unable to get page ${pageNum} to initialize viewer`,\n reason);\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 }).catch((reason) => {\n console.error('Unable to initialize viewer', reason);\n });\n }\n\n /**\n * @param {Array|null} labels\n */\n 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 (let i = 0, ii = this._pages.length; i < ii; i++) {\n let pageView = this._pages[i];\n let 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() {\n if (this.pagesCount === 0) {\n return;\n }\n this.update();\n }\n\n _setScaleDispatchEvent(newScale, newValue, preset = false) {\n let 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(newScale, newValue, noScroll = false, preset = false) {\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 (let 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 let 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(value, noScroll = false) {\n let scale = parseFloat(value);\n\n if (scale > 0) {\n this._setScaleUpdatePages(scale, value, noScroll, /* preset = */ false);\n } else {\n let currentPage = this._pages[this._currentPageNumber - 1];\n if (!currentPage) {\n return;\n }\n let hPadding = (this.isInPresentationMode || this.removePageBorders) ?\n 0 : SCROLLBAR_PADDING;\n let vPadding = (this.isInPresentationMode || this.removePageBorders) ?\n 0 : VERTICAL_PADDING;\n let pageWidthScale = (this.container.clientWidth - hPadding) /\n currentPage.width * currentPage.scale;\n let 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 let 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 let horizontalScale = isLandscape ?\n Math.min(pageHeightScale, pageWidthScale) : pageWidthScale;\n scale = Math.min(MAX_AUTO_SCALE, horizontalScale);\n break;\n default:\n console.error(\n `PDFViewer._setScale: \"${value}\" is an unknown zoom value.`);\n return;\n }\n this._setScaleUpdatePages(scale, value, noScroll, /* preset = */ 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 let 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: \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(params) {\n if ((typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) &&\n (arguments.length > 1 || typeof params === 'number')) {\n console.error('Call of scrollPageIntoView() with obsolete signature.');\n return;\n }\n if (!this.pdfDocument) {\n return;\n }\n let pageNumber = params.pageNumber || 0;\n let dest = params.destArray || null;\n let allowNegativeOffset = params.allowNegativeOffset || false;\n\n if (this.isInPresentationMode || !dest) {\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n return;\n }\n\n let pageView = this._pages[pageNumber - 1];\n if (!pageView) {\n console.error(\n 'PDFViewer.scrollPageIntoView: Invalid \"pageNumber\" parameter.');\n return;\n }\n let x = 0, y = 0;\n let width = 0, height = 0, widthScale, heightScale;\n let changeOrientation = (pageView.rotation % 180 === 0 ? false : true);\n let pageWidth = (changeOrientation ? pageView.height : pageView.width) /\n pageView.scale / CSS_UNITS;\n let pageHeight = (changeOrientation ? pageView.width : pageView.height) /\n pageView.scale / CSS_UNITS;\n let 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 let hPadding = this.removePageBorders ? 0 : SCROLLBAR_PADDING;\n let 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 let boundingRect = [\n pageView.viewport.convertToViewportPoint(x, y),\n pageView.viewport.convertToViewportPoint(x + width, y + height)\n ];\n let left = Math.min(boundingRect[0][0], boundingRect[1][0]);\n let 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 let currentScale = this._currentScale;\n let currentScaleValue = this._currentScaleValue;\n let normalizedScaleValue =\n parseFloat(currentScaleValue) === currentScale ?\n Math.round(currentScale * 10000) / 100 : currentScaleValue;\n\n let pageNumber = firstPage.id;\n let pdfOpenParams = '#page=' + pageNumber;\n pdfOpenParams += '&zoom=' + normalizedScaleValue;\n let currentPageView = this._pages[pageNumber - 1];\n let container = this.container;\n let topLeft = currentPageView.getPagePoint(\n (container.scrollLeft - firstPage.x),\n (container.scrollTop - firstPage.y));\n let intLeft = Math.round(topLeft[0]);\n let 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 rotation: this._pagesRotation,\n pdfOpenParams,\n };\n }\n\n update() {\n let visible = this._getVisiblePages();\n let visiblePages = visible.views;\n if (visiblePages.length === 0) {\n return;\n }\n\n let suggestedCacheSize = Math.max(DEFAULT_CACHE_SIZE,\n 2 * visiblePages.length + 1);\n this._buffer.resize(suggestedCacheSize);\n\n this.renderingQueue.renderHighestPriority(visible);\n\n let currentId = this._currentPageNumber;\n let firstPage = visible.first;\n let stillFullyVisible = false;\n\n for (let i = 0, ii = visiblePages.length; i < ii; ++i) {\n let 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 let visible = [];\n let 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 (let 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() {\n for (let 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 {Promise} Returns a promise containing a {PDFPageProxy} object.\n * @private\n */\n _ensurePdfPageLoaded(pageView) {\n if (pageView.pdfPage) {\n return Promise.resolve(pageView.pdfPage);\n }\n let pageNumber = pageView.id;\n if (this._pagesRequests[pageNumber]) {\n return this._pagesRequests[pageNumber];\n }\n let 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 }).catch((reason) => {\n console.error('Unable to get page for page view', reason);\n // Page error -- there is nothing can be done.\n this._pagesRequests[pageNumber] = null;\n });\n this._pagesRequests[pageNumber] = promise;\n return promise;\n }\n\n forceRendering(currentlyVisiblePages) {\n let visiblePages = currentlyVisiblePages || this._getVisiblePages();\n let 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 * @param {IL10n} l10n\n * @returns {AnnotationLayerBuilder}\n */\n createAnnotationLayerBuilder(pageDiv, pdfPage, renderInteractiveForms = false,\n l10n = NullL10n) {\n return new AnnotationLayerBuilder({\n pageDiv,\n pdfPage,\n renderInteractiveForms,\n linkService: this.linkService,\n downloadManager: this.downloadManager,\n l10n,\n });\n }\n\n setFindController(findController) {\n this.findController = findController;\n }\n\n /**\n * @returns {boolean} Whether all pages of the PDF document have identical\n * widths and heights.\n */\n get hasEqualPageSizes() {\n let firstPageView = this._pages[0];\n for (let i = 1, ii = this._pages.length; i < ii; ++i) {\n let pageView = this._pages[i];\n if (pageView.width !== firstPageView.width ||\n pageView.height !== firstPageView.height) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Returns sizes of the pages.\n * @returns {Array} Array of objects with width/height/rotation fields.\n */\n getPagesOverview() {\n let pagesOverview = this._pages.map(function(pageView) {\n let 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 let 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\nexport {\n PresentationModeState,\n PDFViewer,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_viewer.js","/* Copyright 2017 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 cloneObj, isValidRotation, parseQueryString, waitOnEventOrTimeout\n} from './ui_utils';\nimport { getGlobalEventBus } from './dom_events';\n\n// Heuristic value used when force-resetting `this._blockHashChange`.\nconst HASH_CHANGE_TIMEOUT = 1000; // milliseconds\n// Heuristic value used when adding the current position to the browser history.\nconst POSITION_UPDATED_THRESHOLD = 50;\n// Heuristic value used when adding a temporary position to the browser history.\nconst UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds\n\n/**\n * @typedef {Object} PDFHistoryOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} namedDest - (optional) The named destination. If absent,\n * a stringified version of `explicitDest` is used.\n * @property {Array} explicitDest - The explicit destination array.\n * @property {number} pageNumber - The page to which the destination points.\n */\n\nfunction getCurrentHash() {\n return document.location.hash;\n}\n\nfunction parseCurrentHash(linkService) {\n let hash = unescape(getCurrentHash()).substring(1);\n let params = parseQueryString(hash);\n\n let page = params.page | 0;\n if (!(Number.isInteger(page) && page > 0 && page <= linkService.pagesCount)) {\n page = null;\n }\n return { hash, page, rotation: linkService.rotation, };\n}\n\nclass PDFHistory {\n /**\n * @param {PDFHistoryOptions} options\n */\n constructor({ linkService, eventBus, }) {\n this.linkService = linkService;\n this.eventBus = eventBus || getGlobalEventBus();\n\n this.initialized = false;\n this.initialBookmark = null;\n this.initialRotation = null;\n\n this._boundEvents = Object.create(null);\n this._isViewerInPresentationMode = false;\n this._isPagesLoaded = false;\n\n // Ensure that we don't miss either a 'presentationmodechanged' or a\n // 'pagesloaded' event, by registering the listeners immediately.\n this.eventBus.on('presentationmodechanged', (evt) => {\n this._isViewerInPresentationMode = evt.active || evt.switchInProgress;\n });\n this.eventBus.on('pagesloaded', (evt) => {\n this._isPagesLoaded = !!evt.pagesCount;\n });\n }\n\n /**\n * Initialize the history for the PDF document, using either the current\n * browser history entry or the document hash, whichever is present.\n * @param {string} fingerprint - The PDF document's unique fingerprint.\n * @param {boolean} resetHistory - (optional) Reset the browsing history.\n */\n initialize(fingerprint, resetHistory = false) {\n if (!fingerprint || typeof fingerprint !== 'string') {\n console.error(\n 'PDFHistory.initialize: The \"fingerprint\" must be a non-empty string.');\n return;\n }\n let reInitialized = this.initialized && this.fingerprint !== fingerprint;\n this.fingerprint = fingerprint;\n\n if (!this.initialized) {\n this._bindEvents();\n }\n let state = window.history.state;\n\n this.initialized = true;\n this.initialBookmark = null;\n this.initialRotation = null;\n\n this._popStateInProgress = false;\n this._blockHashChange = 0;\n this._currentHash = getCurrentHash();\n this._numPositionUpdates = 0;\n\n this._currentUid = this._uid = 0;\n this._destination = null;\n this._position = null;\n\n if (!this._isValidState(state) || resetHistory) {\n let { hash, page, rotation, } = parseCurrentHash(this.linkService);\n\n if (!hash || reInitialized || resetHistory) {\n // Ensure that the browser history is reset on PDF document load.\n this._pushOrReplaceState(null, /* forceReplace = */ true);\n return;\n }\n // Ensure that the browser history is initialized correctly when\n // the document hash is present on PDF document load.\n this._pushOrReplaceState({ hash, page, rotation, },\n /* forceReplace = */ true);\n return;\n }\n\n // The browser history contains a valid entry, ensure that the history is\n // initialized correctly on PDF document load.\n let destination = state.destination;\n this._updateInternalState(destination, state.uid,\n /* removeTemporary = */ true);\n\n if (destination.rotation !== undefined) {\n this.initialRotation = destination.rotation;\n }\n if (destination.dest) {\n this.initialBookmark = JSON.stringify(destination.dest);\n\n // If the history is updated, e.g. through the user changing the hash,\n // before the initial destination has become visible, then we do *not*\n // want to potentially add `this._position` to the browser history.\n this._destination.page = null;\n } else if (destination.hash) {\n this.initialBookmark = destination.hash;\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this.initialBookmark = `page=${destination.page}`;\n }\n }\n\n /**\n * Push an internal destination to the browser history.\n * @param {PushParameters}\n */\n push({ namedDest, explicitDest, pageNumber, }) {\n if (!this.initialized) {\n return;\n }\n if ((namedDest && typeof namedDest !== 'string') ||\n !(explicitDest instanceof Array) ||\n !(Number.isInteger(pageNumber) &&\n pageNumber > 0 && pageNumber <= this.linkService.pagesCount)) {\n console.error('PDFHistory.push: Invalid parameters.');\n return;\n }\n\n let hash = namedDest || JSON.stringify(explicitDest);\n if (!hash) {\n // The hash *should* never be undefined, but if that were to occur,\n // avoid any possible issues by not updating the browser history.\n return;\n }\n\n let forceReplace = false;\n if (this._destination &&\n (this._destination.hash === hash ||\n isDestsEqual(this._destination.dest, explicitDest))) {\n // When the new destination is identical to `this._destination`, and\n // its `page` is undefined, replace the current browser history entry.\n // NOTE: This can only occur if `this._destination` was set either:\n // - through the document hash being specified on load.\n // - through the user changing the hash of the document.\n if (this._destination.page) {\n return;\n }\n forceReplace = true;\n }\n if (this._popStateInProgress && !forceReplace) {\n return;\n }\n\n this._pushOrReplaceState({\n dest: explicitDest,\n hash,\n page: pageNumber,\n rotation: this.linkService.rotation,\n }, forceReplace);\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new destination is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occuring when the new destination is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push the current position to the browser history.\n */\n pushCurrentPosition() {\n if (!this.initialized || this._popStateInProgress) {\n return;\n }\n this._tryPushCurrentPosition();\n }\n\n /**\n * Go back one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n back() {\n if (!this.initialized || this._popStateInProgress) {\n return;\n }\n let state = window.history.state;\n if (this._isValidState(state) && state.uid > 0) {\n window.history.back();\n }\n }\n\n /**\n * Go forward one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n forward() {\n if (!this.initialized || this._popStateInProgress) {\n return;\n }\n let state = window.history.state;\n if (this._isValidState(state) && state.uid < (this._uid - 1)) {\n window.history.forward();\n }\n }\n\n /**\n * @returns {boolean} Indicating if the user is currently moving through the\n * browser history, useful e.g. for skipping the next 'hashchange' event.\n */\n get popStateInProgress() {\n return this.initialized &&\n (this._popStateInProgress || this._blockHashChange > 0);\n }\n\n /**\n * @private\n */\n _pushOrReplaceState(destination, forceReplace = false) {\n let shouldReplace = forceReplace || !this._destination;\n let newState = {\n fingerprint: this.fingerprint,\n uid: shouldReplace ? this._currentUid : this._uid,\n destination,\n };\n\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') &&\n window.history.state && window.history.state.chromecomState) {\n // history.state.chromecomState is managed by chromecom.js.\n newState.chromecomState = window.history.state.chromecomState;\n }\n this._updateInternalState(destination, newState.uid);\n\n if (shouldReplace) {\n if (typeof PDFJSDev !== 'undefined' &&\n PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n // Providing the third argument causes a SecurityError for file:// URLs.\n window.history.replaceState(newState, '');\n } else {\n window.history.replaceState(newState, '', document.URL);\n }\n } else {\n if (typeof PDFJSDev !== 'undefined' &&\n PDFJSDev.test('FIREFOX || MOZCENTRAL')) {\n // Providing the third argument causes a SecurityError for file:// URLs.\n window.history.pushState(newState, '');\n } else {\n window.history.pushState(newState, '', document.URL);\n }\n }\n\n if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') &&\n top === window) {\n // eslint-disable-next-line no-undef\n chrome.runtime.sendMessage('showPageAction');\n }\n }\n\n /**\n * @private\n */\n _tryPushCurrentPosition(temporary = false) {\n if (!this._position) {\n return;\n }\n let position = this._position;\n if (temporary) {\n position = cloneObj(this._position);\n position.temporary = true;\n }\n\n if (!this._destination) {\n this._pushOrReplaceState(position);\n return;\n }\n if (this._destination.temporary) {\n // Always replace a previous *temporary* position.\n this._pushOrReplaceState(position, /* forceReplace = */ true);\n return;\n }\n if (this._destination.hash === position.hash) {\n return; // The current document position has not changed.\n }\n if (!this._destination.page &&\n (POSITION_UPDATED_THRESHOLD <= 0 ||\n this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) {\n // `this._destination` was set through the user changing the hash of\n // the document. Do not add `this._position` to the browser history,\n // to avoid \"flooding\" it with lots of (nearly) identical entries,\n // since we cannot ensure that the document position has changed.\n return;\n }\n\n let forceReplace = false;\n if (this._destination.page === position.first ||\n this._destination.page === position.page) {\n // When the `page` of `this._destination` is still visible, do not\n // update the browsing history when `this._destination` either:\n // - contains an internal destination, since in this case we\n // cannot ensure that the document position has actually changed.\n // - was set through the user changing the hash of the document.\n if (this._destination.dest || !this._destination.first) {\n return;\n }\n // To avoid \"flooding\" the browser history, replace the current entry.\n forceReplace = true;\n }\n this._pushOrReplaceState(position, forceReplace);\n }\n\n /**\n * @private\n */\n _isValidState(state) {\n if (!state) {\n return false;\n }\n if (state.fingerprint !== this.fingerprint) {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return false;\n }\n if (!Number.isInteger(state.uid) || state.uid < 0) {\n return false;\n }\n if (state.destination === null || typeof state.destination !== 'object') {\n return false;\n }\n return true;\n }\n\n /**\n * @private\n */\n _updateInternalState(destination, uid, removeTemporary = false) {\n if (this._updateViewareaTimeout) {\n // When updating `this._destination`, make sure that we always wait for\n // the next 'updateviewarea' event before (potentially) attempting to\n // push the current position to the browser history.\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n if (removeTemporary && destination && destination.temporary) {\n // When the `destination` comes from the browser history,\n // we no longer treat it as a *temporary* position.\n delete destination.temporary;\n }\n this._destination = destination;\n this._currentUid = uid;\n this._uid = this._currentUid + 1;\n // This should always be reset when `this._destination` is updated.\n this._numPositionUpdates = 0;\n }\n\n /**\n * @private\n */\n _updateViewarea({ location, }) {\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n\n this._position = {\n hash: this._isViewerInPresentationMode ?\n `page=${location.pageNumber}` : location.pdfOpenParams.substring(1),\n page: this.linkService.page,\n first: location.pageNumber,\n rotation: location.rotation,\n };\n\n if (this._popStateInProgress) {\n return;\n }\n\n if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded &&\n this._destination && !this._destination.page) {\n // If the current destination was set through the user changing the hash\n // of the document, we will usually not try to push the current position\n // to the browser history; see `this._tryPushCurrentPosition()`.\n //\n // To prevent `this._tryPushCurrentPosition()` from effectively being\n // reduced to a no-op in this case, we will assume that the position\n // *did* in fact change if the 'updateviewarea' event was dispatched\n // more than `POSITION_UPDATED_THRESHOLD` times.\n this._numPositionUpdates++;\n }\n\n if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n // When closing the browser, a 'pagehide' event will be dispatched which\n // *should* allow us to push the current position to the browser history.\n // In practice, it seems that the event is arriving too late in order for\n // the session history to be successfully updated.\n // (For additional details, please refer to the discussion in\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1153393.)\n //\n // To workaround this we attempt to *temporarily* add the current position\n // to the browser history only when the viewer is *idle*,\n // i.e. when scrolling and/or zooming does not occur.\n //\n // PLEASE NOTE: It's absolutely imperative that the browser history is\n // *not* updated too often, since that would render the viewer more or\n // less unusable. Hence the use of a timeout to delay the update until\n // the viewer has been idle for `UPDATE_VIEWAREA_TIMEOUT` milliseconds.\n this._updateViewareaTimeout = setTimeout(() => {\n if (!this._popStateInProgress) {\n this._tryPushCurrentPosition(/* temporary = */ true);\n }\n this._updateViewareaTimeout = null;\n }, UPDATE_VIEWAREA_TIMEOUT);\n }\n }\n\n /**\n * @private\n */\n _popState({ state, }) {\n let newHash = getCurrentHash(), hashChanged = this._currentHash !== newHash;\n this._currentHash = newHash;\n\n if (!state ||\n (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('CHROME') &&\n state.chromecomState && !this._isValidState(state))) {\n // This case corresponds to the user changing the hash of the document.\n this._currentUid = this._uid;\n\n let { hash, page, rotation, } = parseCurrentHash(this.linkService);\n this._pushOrReplaceState({ hash, page, rotation, },\n /* forceReplace = */ true);\n return;\n }\n if (!this._isValidState(state)) {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return;\n }\n\n // Prevent the browser history from updating until the new destination,\n // as stored in the browser history, has been scrolled into view.\n this._popStateInProgress = true;\n\n if (hashChanged) {\n // When the hash changed, implying that the 'popstate' event will be\n // followed by a 'hashchange' event, then we do *not* want to update the\n // browser history when handling the 'hashchange' event (in web/app.js)\n // since that would *overwrite* the new destination navigated to below.\n //\n // To avoid accidentally disabling all future user-initiated hash changes,\n // if there's e.g. another 'hashchange' listener that stops the event\n // propagation, we make sure to always force-reset `this._blockHashChange`\n // after `HASH_CHANGE_TIMEOUT` milliseconds have passed.\n this._blockHashChange++;\n waitOnEventOrTimeout({\n target: window,\n name: 'hashchange',\n delay: HASH_CHANGE_TIMEOUT,\n }).then(() => {\n this._blockHashChange--;\n });\n }\n\n // Navigate to the new destination.\n let destination = state.destination;\n this._updateInternalState(destination, state.uid,\n /* removeTemporary = */ true);\n\n if (isValidRotation(destination.rotation)) {\n this.linkService.rotation = destination.rotation;\n }\n if (destination.dest) {\n this.linkService.navigateTo(destination.dest);\n } else if (destination.hash) {\n this.linkService.setHash(destination.hash);\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this.linkService.page = destination.page;\n }\n\n // Since `PDFLinkService.navigateTo` is asynchronous, we thus defer the\n // resetting of `this._popStateInProgress` slightly.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n\n /**\n * @private\n */\n _bindEvents() {\n let { _boundEvents, eventBus, } = this;\n\n _boundEvents.updateViewarea = this._updateViewarea.bind(this);\n _boundEvents.popState = this._popState.bind(this);\n _boundEvents.pageHide = (evt) => {\n // Attempt to push the `this._position` into the browser history when\n // navigating away from the document. This is *only* done if the history\n // is currently empty, since otherwise an existing browser history entry\n // will end up being overwritten (given that new entries cannot be pushed\n // into the browser history when the 'unload' event has already fired).\n if (!this._destination) {\n this._tryPushCurrentPosition();\n }\n };\n\n eventBus.on('updateviewarea', _boundEvents.updateViewarea);\n window.addEventListener('popstate', _boundEvents.popState);\n window.addEventListener('pagehide', _boundEvents.pageHide);\n }\n}\n\nfunction isDestsEqual(firstDest, secondDest) {\n function isEntryEqual(first, second) {\n if (typeof first !== typeof second) {\n return false;\n }\n if (first instanceof Array || second instanceof Array) {\n return false;\n }\n if (first !== null && typeof first === 'object' && second !== null) {\n if (Object.keys(first).length !== Object.keys(second).length) {\n return false;\n }\n for (var key in first) {\n if (!isEntryEqual(first[key], second[key])) {\n return false;\n }\n }\n return true;\n }\n return first === second || (Number.isNaN(first) && Number.isNaN(second));\n }\n\n if (!(firstDest instanceof Array && secondDest instanceof Array)) {\n return false;\n }\n if (firstDest.length !== secondDest.length) {\n return false;\n }\n for (let i = 0, ii = firstDest.length; i < ii; i++) {\n if (!isEntryEqual(firstDest[i], secondDest[i])) {\n return false;\n }\n }\n return true;\n}\n\nexport {\n PDFHistory,\n isDestsEqual,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_history.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 { createPromiseCapability } from 'pdfjs-lib';\nimport { scrollIntoView } from './ui_utils';\n\nconst FindState = {\n FOUND: 0,\n NOT_FOUND: 1,\n WRAPPED: 2,\n PENDING: 3,\n};\n\nconst FIND_SCROLL_OFFSET_TOP = -50;\nconst FIND_SCROLL_OFFSET_LEFT = -400;\nconst FIND_TIMEOUT = 250; // ms\n\nconst 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 functionality to find a given string in a PDF document.\n */\nclass PDFFindController {\n constructor({ pdfViewer, }) {\n this.pdfViewer = pdfViewer;\n\n this.onUpdateResultsCount = null;\n this.onUpdateState = null;\n\n this.reset();\n\n // Compile the regular expression for text normalization once.\n let replace = Object.keys(CHARACTERS_TO_NORMALIZE).join('');\n this.normalizationRegex = new RegExp('[' + replace + ']', 'g');\n }\n\n 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(text) {\n return text.replace(this.normalizationRegex, function (ch) {\n return CHARACTERS_TO_NORMALIZE[ch];\n });\n }\n\n /**\n * Helper for multi-term search that fills the `matchesWithLength` array\n * and handles cases where one search term includes another search term (for\n * example, \"tamed tame\" or \"this is\"). It looks for intersecting terms in\n * the `matches` and keeps elements with a longer match length.\n */\n _prepareMatches(matchesWithLength, matches, matchesLength) {\n function isSubTerm(matchesWithLength, currentIndex) {\n let currentElem = matchesWithLength[currentIndex];\n let nextElem = matchesWithLength[currentIndex + 1];\n\n // Check 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\n // Check for cases like \"thIS IS\".\n for (let i = currentIndex - 1; i >= 0; i--) {\n let 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 // Sort the array of `{ match: , matchLength: }`\n // objects on increasing index first and on the length otherwise.\n matchesWithLength.sort(function(a, b) {\n return a.match === b.match ? a.matchLength - b.matchLength :\n a.match - b.match;\n });\n for (let 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(query, pageIndex, pageContent) {\n let matches = [];\n let queryLen = query.length;\n let 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(query, pageIndex, pageContent) {\n let matchesWithLength = [];\n // Divide the query into pieces and search for text in each piece.\n let queryArray = query.match(/\\S+/g);\n for (let i = 0, len = queryArray.length; i < len; i++) {\n let subquery = queryArray[i];\n let subqueryLen = subquery.length;\n let 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\n // Prepare arrays for storing the matches.\n if (!this.pageMatchesLength) {\n this.pageMatchesLength = [];\n }\n this.pageMatchesLength[pageIndex] = [];\n this.pageMatches[pageIndex] = [];\n\n // Sort `matchesWithLength`, remove intersecting terms and put the result\n // into the two arrays.\n this._prepareMatches(matchesWithLength, this.pageMatches[pageIndex],\n this.pageMatchesLength[pageIndex]);\n }\n\n calcFindMatch(pageIndex) {\n let pageContent = this.normalize(this.pageContents[pageIndex]);\n let query = this.normalize(this.state.query);\n let caseSensitive = this.state.caseSensitive;\n let phraseSearch = this.state.phraseSearch;\n let 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 match count.\n if (this.pageMatches[pageIndex].length > 0) {\n this.matchCount += this.pageMatches[pageIndex].length;\n this.updateUIResultsCount();\n }\n }\n\n extractText() {\n if (this.startedTextExtraction) {\n return;\n }\n this.startedTextExtraction = true;\n this.pageContents.length = 0;\n\n let promise = Promise.resolve();\n for (let i = 0, ii = this.pdfViewer.pagesCount; i < ii; i++) {\n let extractTextCapability = createPromiseCapability();\n this.extractTextPromises[i] = extractTextCapability.promise;\n\n promise = promise.then(() => {\n return this.pdfViewer.getPageTextContent(i).then((textContent) => {\n let textItems = textContent.items;\n let strBuf = [];\n\n for (let j = 0, jj = textItems.length; j < jj; j++) {\n strBuf.push(textItems[j].str);\n }\n // Store the pageContent as a string.\n this.pageContents[i] = strBuf.join('');\n extractTextCapability.resolve(i);\n }, (reason) => {\n console.error(`Unable to get page ${i + 1} text content`, reason);\n // Page error -- assuming no text content.\n this.pageContents[i] = '';\n extractTextCapability.resolve(i);\n });\n });\n }\n }\n\n executeCommand(cmd, state) {\n if (this.state === null || cmd !== 'findagain') {\n this.dirtyMatch = true;\n }\n this.state = state;\n this.updateUIState(FindState.PENDING);\n\n this._firstPagePromise.then(() => {\n this.extractText();\n\n clearTimeout(this.findTimeout);\n if (cmd === 'find') {\n // Trigger the find action with a small delay to avoid starting the\n // search when the user is still typing (saving resources).\n this.findTimeout = setTimeout(this.nextMatch.bind(this), FIND_TIMEOUT);\n } else {\n this.nextMatch();\n }\n });\n }\n\n 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 let page = this.pdfViewer.getPageView(index);\n if (page.textLayer) {\n page.textLayer.updateMatches();\n }\n }\n\n nextMatch() {\n let previous = this.state.findPrevious;\n let currentPageIndex = this.pdfViewer.currentPageNumber - 1;\n let 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\n for (let i = 0; i < numPages; i++) {\n // Wipe out any previously highlighted matches.\n this.updatePage(i);\n\n // Start finding the matches as soon as the text is extracted.\n if (!(i in this.pendingFindMatches)) {\n this.pendingFindMatches[i] = true;\n this.extractTextPromises[i].then((pageIdx) => {\n delete this.pendingFindMatches[pageIdx];\n this.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(FindState.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 let 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 let 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(matches) {\n let offset = this.offset;\n let numMatches = matches.length;\n let previous = this.state.findPrevious;\n\n if (numMatches) {\n // There were matches for the page, so initialize `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 * Called from the text layer when match presentation is updated.\n *\n * @param {number} pageIndex - The index of the page.\n * @param {number} matchIndex - The index of the match.\n * @param {Array} elements - Text layer `div` elements.\n * @param {number} beginIdx - Start index of the `div` array for the match.\n */\n updateMatchPosition(pageIndex, matchIndex, elements, beginIdx) {\n if (this.selected.matchIdx === matchIndex &&\n this.selected.pageIdx === pageIndex) {\n let 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() {\n if (this.resumePageIdx !== null) {\n console.error('There can only be one pending page.');\n }\n\n let matches = null;\n do {\n let pageIdx = this.offset.pageIdx;\n 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(previous) {\n let offset = this.offset;\n let 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(found = false) {\n let state = FindState.NOT_FOUND;\n let wrapped = this.offset.wrapped;\n this.offset.wrapped = false;\n\n if (found) {\n let previousPage = this.selected.pageIdx;\n this.selected.pageIdx = this.offset.pageIdx;\n this.selected.matchIdx = this.offset.matchIdx;\n state = (wrapped ? FindState.WRAPPED : FindState.FOUND);\n\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 if (this.onUpdateResultsCount) {\n this.onUpdateResultsCount(this.matchCount);\n }\n }\n\n updateUIState(state, previous) {\n if (this.onUpdateState) {\n this.onUpdateState(state, previous, this.matchCount);\n }\n }\n}\n\nexport {\n FindState,\n PDFFindController,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/pdf_find_controller.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-lib';\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 let 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 // 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 let padCharacter = blobUrl.indexOf('?') === -1 ? '?' : '&';\n blobUrl = blobUrl.replace(/#|$/, padCharacter + '$&');\n }\n window.open(blobUrl, '_parent');\n }\n}\n\nclass DownloadManager {\n 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(data, filename, contentType) {\n if (navigator.msSaveBlob) { // IE10 and above\n return navigator.msSaveBlob(new Blob([data], { type: contentType, }),\n filename);\n }\n let blobUrl = createObjectURL(data, contentType,\n PDFJS.disableCreateObjectURL);\n download(blobUrl, filename);\n }\n\n 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 let 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 2017 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 '../external/webL10n/l10n';\n\nvar webL10n = document.webL10n;\n\nclass GenericL10n {\n constructor(lang) {\n this._lang = lang;\n this._ready = new Promise((resolve, reject) => {\n webL10n.setLanguage(lang, () => {\n resolve(webL10n);\n });\n });\n }\n\n getDirection() {\n return this._ready.then((l10n) => {\n return l10n.getDirection();\n });\n }\n\n get(property, args, fallback) {\n return this._ready.then((l10n) => {\n return l10n.get(property, args, fallback);\n });\n }\n\n translate(element) {\n return this._ready.then((l10n) => {\n return l10n.translate(element);\n });\n }\n}\n\nexport {\n GenericL10n,\n};\n\n\n\n// WEBPACK FOOTER //\n// web/genericl10n.js","/**\n * Copyright (c) 2011-2013 Fabien Cazenave, Mozilla.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/*\n Additional modifications for PDF.js project:\n - Disables language initialization on page loading.\n - Disables document translation on page loading.\n - Removes consoleWarn and consoleLog and use console.log/warn directly.\n - Removes window._ assignment.\n - Remove compatibility code for OldIE.\n*/\n\n/*jshint browser: true, devel: true, es5: true, globalstrict: true */\n'use strict';\n\ndocument.webL10n = (function(window, document, undefined) {\n var gL10nData = {};\n var gTextData = '';\n var gTextProp = 'textContent';\n var gLanguage = '';\n var gMacros = {};\n var gReadyState = 'loading';\n\n\n /**\n * Synchronously loading l10n resources significantly minimizes flickering\n * from displaying the app with non-localized strings and then updating the\n * strings. Although this will block all script execution on this page, we\n * expect that the l10n resources are available locally on flash-storage.\n *\n * As synchronous XHR is generally considered as a bad idea, we're still\n * loading l10n resources asynchronously -- but we keep this in a setting,\n * just in case... and applications using this library should hide their\n * content until the `localized' event happens.\n */\n\n var gAsyncResourceLoading = true; // read-only\n\n\n /**\n * DOM helpers for the so-called \"HTML API\".\n *\n * These functions are written for modern browsers. For old versions of IE,\n * they're overridden in the 'startup' section at the end of this file.\n */\n\n function getL10nResourceLinks() {\n return document.querySelectorAll('link[type=\"application/l10n\"]');\n }\n\n function getL10nDictionary() {\n var script = document.querySelector('script[type=\"application/l10n\"]');\n // TODO: support multiple and external JSON dictionaries\n return script ? JSON.parse(script.innerHTML) : null;\n }\n\n function getTranslatableChildren(element) {\n return element ? element.querySelectorAll('*[data-l10n-id]') : [];\n }\n\n function getL10nAttributes(element) {\n if (!element)\n return {};\n\n var l10nId = element.getAttribute('data-l10n-id');\n var l10nArgs = element.getAttribute('data-l10n-args');\n var args = {};\n if (l10nArgs) {\n try {\n args = JSON.parse(l10nArgs);\n } catch (e) {\n console.warn('could not parse arguments for #' + l10nId);\n }\n }\n return { id: l10nId, args: args };\n }\n\n function fireL10nReadyEvent(lang) {\n var evtObject = document.createEvent('Event');\n evtObject.initEvent('localized', true, false);\n evtObject.language = lang;\n document.dispatchEvent(evtObject);\n }\n\n function xhrLoadText(url, onSuccess, onFailure) {\n onSuccess = onSuccess || function _onSuccess(data) {};\n onFailure = onFailure || function _onFailure() {};\n\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, gAsyncResourceLoading);\n if (xhr.overrideMimeType) {\n xhr.overrideMimeType('text/plain; charset=utf-8');\n }\n xhr.onreadystatechange = function() {\n if (xhr.readyState == 4) {\n if (xhr.status == 200 || xhr.status === 0) {\n onSuccess(xhr.responseText);\n } else {\n onFailure();\n }\n }\n };\n xhr.onerror = onFailure;\n xhr.ontimeout = onFailure;\n\n // in Firefox OS with the app:// protocol, trying to XHR a non-existing\n // URL will raise an exception here -- hence this ugly try...catch.\n try {\n xhr.send(null);\n } catch (e) {\n onFailure();\n }\n }\n\n\n /**\n * l10n resource parser:\n * - reads (async XHR) the l10n resource matching `lang';\n * - imports linked resources (synchronously) when specified;\n * - parses the text data (fills `gL10nData' and `gTextData');\n * - triggers success/failure callbacks when done.\n *\n * @param {string} href\n * URL of the l10n resource to parse.\n *\n * @param {string} lang\n * locale (language) to parse. Must be a lowercase string.\n *\n * @param {Function} successCallback\n * triggered when the l10n resource has been successully parsed.\n *\n * @param {Function} failureCallback\n * triggered when the an error has occured.\n *\n * @return {void}\n * uses the following global variables: gL10nData, gTextData, gTextProp.\n */\n\n function parseResource(href, lang, successCallback, failureCallback) {\n var baseURL = href.replace(/[^\\/]*$/, '') || './';\n\n // handle escaped characters (backslashes) in a string\n function evalString(text) {\n if (text.lastIndexOf('\\\\') < 0)\n return text;\n return text.replace(/\\\\\\\\/g, '\\\\')\n .replace(/\\\\n/g, '\\n')\n .replace(/\\\\r/g, '\\r')\n .replace(/\\\\t/g, '\\t')\n .replace(/\\\\b/g, '\\b')\n .replace(/\\\\f/g, '\\f')\n .replace(/\\\\{/g, '{')\n .replace(/\\\\}/g, '}')\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\'/g, \"'\");\n }\n\n // parse *.properties text data into an l10n dictionary\n // If gAsyncResourceLoading is false, then the callback will be called\n // synchronously. Otherwise it is called asynchronously.\n function parseProperties(text, parsedPropertiesCallback) {\n var dictionary = {};\n\n // token expressions\n var reBlank = /^\\s*|\\s*$/;\n var reComment = /^\\s*#|^\\s*$/;\n var reSection = /^\\s*\\[(.*)\\]\\s*$/;\n var reImport = /^\\s*@import\\s+url\\((.*)\\)\\s*$/i;\n var reSplit = /^([^=\\s]*)\\s*=\\s*(.+)$/; // TODO: escape EOLs with '\\'\n\n // parse the *.properties file into an associative array\n function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {\n var entries = rawText.replace(reBlank, '').split(/[\\r\\n]+/);\n var currentLang = '*';\n var genericLang = lang.split('-', 1)[0];\n var skipLang = false;\n var match = '';\n\n function nextEntry() {\n // Use infinite loop instead of recursion to avoid reaching the\n // maximum recursion limit for content with many lines.\n while (true) {\n if (!entries.length) {\n parsedRawLinesCallback();\n return;\n }\n var line = entries.shift();\n\n // comment or blank line?\n if (reComment.test(line))\n continue;\n\n // the extended syntax supports [lang] sections and @import rules\n if (extendedSyntax) {\n match = reSection.exec(line);\n if (match) { // section start?\n // RFC 4646, section 4.4, \"All comparisons MUST be performed\n // in a case-insensitive manner.\"\n\n currentLang = match[1].toLowerCase();\n skipLang = (currentLang !== '*') &&\n (currentLang !== lang) && (currentLang !== genericLang);\n continue;\n } else if (skipLang) {\n continue;\n }\n match = reImport.exec(line);\n if (match) { // @import rule?\n loadImport(baseURL + match[1], nextEntry);\n return;\n }\n }\n\n // key-value pair\n var tmp = line.match(reSplit);\n if (tmp && tmp.length == 3) {\n dictionary[tmp[1]] = evalString(tmp[2]);\n }\n }\n }\n nextEntry();\n }\n\n // import another *.properties file\n function loadImport(url, callback) {\n xhrLoadText(url, function(content) {\n parseRawLines(content, false, callback); // don't allow recursive imports\n }, function () {\n console.warn(url + ' not found.');\n callback();\n });\n }\n\n // fill the dictionary\n parseRawLines(text, true, function() {\n parsedPropertiesCallback(dictionary);\n });\n }\n\n // load and parse l10n data (warning: global variables are used here)\n xhrLoadText(href, function(response) {\n gTextData += response; // mostly for debug\n\n // parse *.properties text data into an l10n dictionary\n parseProperties(response, function(data) {\n\n // find attribute descriptions, if any\n for (var key in data) {\n var id, prop, index = key.lastIndexOf('.');\n if (index > 0) { // an attribute has been specified\n id = key.substring(0, index);\n prop = key.substr(index + 1);\n } else { // no attribute: assuming text content by default\n id = key;\n prop = gTextProp;\n }\n if (!gL10nData[id]) {\n gL10nData[id] = {};\n }\n gL10nData[id][prop] = data[key];\n }\n\n // trigger callback\n if (successCallback) {\n successCallback();\n }\n });\n }, failureCallback);\n }\n\n // load and parse all resources for the specified locale\n function loadLocale(lang, callback) {\n // RFC 4646, section 2.1 states that language tags have to be treated as\n // case-insensitive. Convert to lowercase for case-insensitive comparisons.\n if (lang) {\n lang = lang.toLowerCase();\n }\n\n callback = callback || function _callback() {};\n\n clear();\n gLanguage = lang;\n\n // check all nodes\n // and load the resource files\n var langLinks = getL10nResourceLinks();\n var langCount = langLinks.length;\n if (langCount === 0) {\n // we might have a pre-compiled dictionary instead\n var dict = getL10nDictionary();\n if (dict && dict.locales && dict.default_locale) {\n console.log('using the embedded JSON directory, early way out');\n gL10nData = dict.locales[lang];\n if (!gL10nData) {\n var defaultLocale = dict.default_locale.toLowerCase();\n for (var anyCaseLang in dict.locales) {\n anyCaseLang = anyCaseLang.toLowerCase();\n if (anyCaseLang === lang) {\n gL10nData = dict.locales[lang];\n break;\n } else if (anyCaseLang === defaultLocale) {\n gL10nData = dict.locales[defaultLocale];\n }\n }\n }\n callback();\n } else {\n console.log('no resource to load, early way out');\n }\n // early way out\n fireL10nReadyEvent(lang);\n gReadyState = 'complete';\n return;\n }\n\n // start the callback when all resources are loaded\n var onResourceLoaded = null;\n var gResourceCount = 0;\n onResourceLoaded = function() {\n gResourceCount++;\n if (gResourceCount >= langCount) {\n callback();\n fireL10nReadyEvent(lang);\n gReadyState = 'complete';\n }\n };\n\n // load all resource files\n function L10nResourceLink(link) {\n var href = link.href;\n // Note: If |gAsyncResourceLoading| is false, then the following callbacks\n // are synchronously called.\n this.load = function(lang, callback) {\n parseResource(href, lang, callback, function() {\n console.warn(href + ' not found.');\n // lang not found, used default resource instead\n console.warn('\"' + lang + '\" resource not found');\n gLanguage = '';\n // Resource not loaded, but we still need to call the callback.\n callback();\n });\n };\n }\n\n for (var i = 0; i < langCount; i++) {\n var resource = new L10nResourceLink(langLinks[i]);\n resource.load(lang, onResourceLoaded);\n }\n }\n\n // clear all l10n data\n function clear() {\n gL10nData = {};\n gTextData = '';\n gLanguage = '';\n // TODO: clear all non predefined macros.\n // There's no such macro /yet/ but we're planning to have some...\n }\n\n\n /**\n * Get rules for plural forms (shared with JetPack), see:\n * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html\n * https://github.com/mozilla/addon-sdk/blob/master/python-lib/plural-rules-generator.p\n *\n * @param {string} lang\n * locale (language) used.\n *\n * @return {Function}\n * returns a function that gives the plural form name for a given integer:\n * var fun = getPluralRules('en');\n * fun(1) -> 'one'\n * fun(0) -> 'other'\n * fun(1000) -> 'other'.\n */\n\n function getPluralRules(lang) {\n var locales2rules = {\n 'af': 3,\n 'ak': 4,\n 'am': 4,\n 'ar': 1,\n 'asa': 3,\n 'az': 0,\n 'be': 11,\n 'bem': 3,\n 'bez': 3,\n 'bg': 3,\n 'bh': 4,\n 'bm': 0,\n 'bn': 3,\n 'bo': 0,\n 'br': 20,\n 'brx': 3,\n 'bs': 11,\n 'ca': 3,\n 'cgg': 3,\n 'chr': 3,\n 'cs': 12,\n 'cy': 17,\n 'da': 3,\n 'de': 3,\n 'dv': 3,\n 'dz': 0,\n 'ee': 3,\n 'el': 3,\n 'en': 3,\n 'eo': 3,\n 'es': 3,\n 'et': 3,\n 'eu': 3,\n 'fa': 0,\n 'ff': 5,\n 'fi': 3,\n 'fil': 4,\n 'fo': 3,\n 'fr': 5,\n 'fur': 3,\n 'fy': 3,\n 'ga': 8,\n 'gd': 24,\n 'gl': 3,\n 'gsw': 3,\n 'gu': 3,\n 'guw': 4,\n 'gv': 23,\n 'ha': 3,\n 'haw': 3,\n 'he': 2,\n 'hi': 4,\n 'hr': 11,\n 'hu': 0,\n 'id': 0,\n 'ig': 0,\n 'ii': 0,\n 'is': 3,\n 'it': 3,\n 'iu': 7,\n 'ja': 0,\n 'jmc': 3,\n 'jv': 0,\n 'ka': 0,\n 'kab': 5,\n 'kaj': 3,\n 'kcg': 3,\n 'kde': 0,\n 'kea': 0,\n 'kk': 3,\n 'kl': 3,\n 'km': 0,\n 'kn': 0,\n 'ko': 0,\n 'ksb': 3,\n 'ksh': 21,\n 'ku': 3,\n 'kw': 7,\n 'lag': 18,\n 'lb': 3,\n 'lg': 3,\n 'ln': 4,\n 'lo': 0,\n 'lt': 10,\n 'lv': 6,\n 'mas': 3,\n 'mg': 4,\n 'mk': 16,\n 'ml': 3,\n 'mn': 3,\n 'mo': 9,\n 'mr': 3,\n 'ms': 0,\n 'mt': 15,\n 'my': 0,\n 'nah': 3,\n 'naq': 7,\n 'nb': 3,\n 'nd': 3,\n 'ne': 3,\n 'nl': 3,\n 'nn': 3,\n 'no': 3,\n 'nr': 3,\n 'nso': 4,\n 'ny': 3,\n 'nyn': 3,\n 'om': 3,\n 'or': 3,\n 'pa': 3,\n 'pap': 3,\n 'pl': 13,\n 'ps': 3,\n 'pt': 3,\n 'rm': 3,\n 'ro': 9,\n 'rof': 3,\n 'ru': 11,\n 'rwk': 3,\n 'sah': 0,\n 'saq': 3,\n 'se': 7,\n 'seh': 3,\n 'ses': 0,\n 'sg': 0,\n 'sh': 11,\n 'shi': 19,\n 'sk': 12,\n 'sl': 14,\n 'sma': 7,\n 'smi': 7,\n 'smj': 7,\n 'smn': 7,\n 'sms': 7,\n 'sn': 3,\n 'so': 3,\n 'sq': 3,\n 'sr': 11,\n 'ss': 3,\n 'ssy': 3,\n 'st': 3,\n 'sv': 3,\n 'sw': 3,\n 'syr': 3,\n 'ta': 3,\n 'te': 3,\n 'teo': 3,\n 'th': 0,\n 'ti': 4,\n 'tig': 3,\n 'tk': 3,\n 'tl': 4,\n 'tn': 3,\n 'to': 0,\n 'tr': 0,\n 'ts': 3,\n 'tzm': 22,\n 'uk': 11,\n 'ur': 3,\n 've': 3,\n 'vi': 0,\n 'vun': 3,\n 'wa': 4,\n 'wae': 3,\n 'wo': 0,\n 'xh': 3,\n 'xog': 3,\n 'yo': 0,\n 'zh': 0,\n 'zu': 3\n };\n\n // utility functions for plural rules methods\n function isIn(n, list) {\n return list.indexOf(n) !== -1;\n }\n function isBetween(n, start, end) {\n return start <= n && n <= end;\n }\n\n // list of all plural rules methods:\n // map an integer to the plural form name to use\n var pluralRules = {\n '0': function(n) {\n return 'other';\n },\n '1': function(n) {\n if ((isBetween((n % 100), 3, 10)))\n return 'few';\n if (n === 0)\n return 'zero';\n if ((isBetween((n % 100), 11, 99)))\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '2': function(n) {\n if (n !== 0 && (n % 10) === 0)\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '3': function(n) {\n if (n == 1)\n return 'one';\n return 'other';\n },\n '4': function(n) {\n if ((isBetween(n, 0, 1)))\n return 'one';\n return 'other';\n },\n '5': function(n) {\n if ((isBetween(n, 0, 2)) && n != 2)\n return 'one';\n return 'other';\n },\n '6': function(n) {\n if (n === 0)\n return 'zero';\n if ((n % 10) == 1 && (n % 100) != 11)\n return 'one';\n return 'other';\n },\n '7': function(n) {\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '8': function(n) {\n if ((isBetween(n, 3, 6)))\n return 'few';\n if ((isBetween(n, 7, 10)))\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '9': function(n) {\n if (n === 0 || n != 1 && (isBetween((n % 100), 1, 19)))\n return 'few';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '10': function(n) {\n if ((isBetween((n % 10), 2, 9)) && !(isBetween((n % 100), 11, 19)))\n return 'few';\n if ((n % 10) == 1 && !(isBetween((n % 100), 11, 19)))\n return 'one';\n return 'other';\n },\n '11': function(n) {\n if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14)))\n return 'few';\n if ((n % 10) === 0 ||\n (isBetween((n % 10), 5, 9)) ||\n (isBetween((n % 100), 11, 14)))\n return 'many';\n if ((n % 10) == 1 && (n % 100) != 11)\n return 'one';\n return 'other';\n },\n '12': function(n) {\n if ((isBetween(n, 2, 4)))\n return 'few';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '13': function(n) {\n if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14)))\n return 'few';\n if (n != 1 && (isBetween((n % 10), 0, 1)) ||\n (isBetween((n % 10), 5, 9)) ||\n (isBetween((n % 100), 12, 14)))\n return 'many';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '14': function(n) {\n if ((isBetween((n % 100), 3, 4)))\n return 'few';\n if ((n % 100) == 2)\n return 'two';\n if ((n % 100) == 1)\n return 'one';\n return 'other';\n },\n '15': function(n) {\n if (n === 0 || (isBetween((n % 100), 2, 10)))\n return 'few';\n if ((isBetween((n % 100), 11, 19)))\n return 'many';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '16': function(n) {\n if ((n % 10) == 1 && n != 11)\n return 'one';\n return 'other';\n },\n '17': function(n) {\n if (n == 3)\n return 'few';\n if (n === 0)\n return 'zero';\n if (n == 6)\n return 'many';\n if (n == 2)\n return 'two';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '18': function(n) {\n if (n === 0)\n return 'zero';\n if ((isBetween(n, 0, 2)) && n !== 0 && n != 2)\n return 'one';\n return 'other';\n },\n '19': function(n) {\n if ((isBetween(n, 2, 10)))\n return 'few';\n if ((isBetween(n, 0, 1)))\n return 'one';\n return 'other';\n },\n '20': function(n) {\n if ((isBetween((n % 10), 3, 4) || ((n % 10) == 9)) && !(\n isBetween((n % 100), 10, 19) ||\n isBetween((n % 100), 70, 79) ||\n isBetween((n % 100), 90, 99)\n ))\n return 'few';\n if ((n % 1000000) === 0 && n !== 0)\n return 'many';\n if ((n % 10) == 2 && !isIn((n % 100), [12, 72, 92]))\n return 'two';\n if ((n % 10) == 1 && !isIn((n % 100), [11, 71, 91]))\n return 'one';\n return 'other';\n },\n '21': function(n) {\n if (n === 0)\n return 'zero';\n if (n == 1)\n return 'one';\n return 'other';\n },\n '22': function(n) {\n if ((isBetween(n, 0, 1)) || (isBetween(n, 11, 99)))\n return 'one';\n return 'other';\n },\n '23': function(n) {\n if ((isBetween((n % 10), 1, 2)) || (n % 20) === 0)\n return 'one';\n return 'other';\n },\n '24': function(n) {\n if ((isBetween(n, 3, 10) || isBetween(n, 13, 19)))\n return 'few';\n if (isIn(n, [2, 12]))\n return 'two';\n if (isIn(n, [1, 11]))\n return 'one';\n return 'other';\n }\n };\n\n // return a function that gives the plural form name for a given integer\n var index = locales2rules[lang.replace(/-.*$/, '')];\n if (!(index in pluralRules)) {\n console.warn('plural form unknown for [' + lang + ']');\n return function() { return 'other'; };\n }\n return pluralRules[index];\n }\n\n // pre-defined 'plural' macro\n gMacros.plural = function(str, param, key, prop) {\n var n = parseFloat(param);\n if (isNaN(n))\n return str;\n\n // TODO: support other properties (l20n still doesn't...)\n if (prop != gTextProp)\n return str;\n\n // initialize _pluralRules\n if (!gMacros._pluralRules) {\n gMacros._pluralRules = getPluralRules(gLanguage);\n }\n var index = '[' + gMacros._pluralRules(n) + ']';\n\n // try to find a [zero|one|two] key if it's defined\n if (n === 0 && (key + '[zero]') in gL10nData) {\n str = gL10nData[key + '[zero]'][prop];\n } else if (n == 1 && (key + '[one]') in gL10nData) {\n str = gL10nData[key + '[one]'][prop];\n } else if (n == 2 && (key + '[two]') in gL10nData) {\n str = gL10nData[key + '[two]'][prop];\n } else if ((key + index) in gL10nData) {\n str = gL10nData[key + index][prop];\n } else if ((key + '[other]') in gL10nData) {\n str = gL10nData[key + '[other]'][prop];\n }\n\n return str;\n };\n\n\n /**\n * l10n dictionary functions\n */\n\n // fetch an l10n object, warn if not found, apply `args' if possible\n function getL10nData(key, args, fallback) {\n var data = gL10nData[key];\n if (!data) {\n console.warn('#' + key + ' is undefined.');\n if (!fallback) {\n return null;\n }\n data = fallback;\n }\n\n /** This is where l10n expressions should be processed.\n * The plan is to support C-style expressions from the l20n project;\n * until then, only two kinds of simple expressions are supported:\n * {[ index ]} and {{ arguments }}.\n */\n var rv = {};\n for (var prop in data) {\n var str = data[prop];\n str = substIndexes(str, args, key, prop);\n str = substArguments(str, args, key);\n rv[prop] = str;\n }\n return rv;\n }\n\n // replace {[macros]} with their values\n function substIndexes(str, args, key, prop) {\n var reIndex = /\\{\\[\\s*([a-zA-Z]+)\\(([a-zA-Z]+)\\)\\s*\\]\\}/;\n var reMatch = reIndex.exec(str);\n if (!reMatch || !reMatch.length)\n return str;\n\n // an index/macro has been found\n // Note: at the moment, only one parameter is supported\n var macroName = reMatch[1];\n var paramName = reMatch[2];\n var param;\n if (args && paramName in args) {\n param = args[paramName];\n } else if (paramName in gL10nData) {\n param = gL10nData[paramName];\n }\n\n // there's no macro parser yet: it has to be defined in gMacros\n if (macroName in gMacros) {\n var macro = gMacros[macroName];\n str = macro(str, param, key, prop);\n }\n return str;\n }\n\n // replace {{arguments}} with their values\n function substArguments(str, args, key) {\n var reArgs = /\\{\\{\\s*(.+?)\\s*\\}\\}/g;\n return str.replace(reArgs, function(matched_text, arg) {\n if (args && arg in args) {\n return args[arg];\n }\n if (arg in gL10nData) {\n return gL10nData[arg];\n }\n console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');\n return matched_text;\n });\n }\n\n // translate an HTML element\n function translateElement(element) {\n var l10n = getL10nAttributes(element);\n if (!l10n.id)\n return;\n\n // get the related l10n object\n var data = getL10nData(l10n.id, l10n.args);\n if (!data) {\n console.warn('#' + l10n.id + ' is undefined.');\n return;\n }\n\n // translate element (TODO: security checks?)\n if (data[gTextProp]) { // XXX\n if (getChildElementCount(element) === 0) {\n element[gTextProp] = data[gTextProp];\n } else {\n // this element has element children: replace the content of the first\n // (non-empty) child textNode and clear other child textNodes\n var children = element.childNodes;\n var found = false;\n for (var i = 0, l = children.length; i < l; i++) {\n if (children[i].nodeType === 3 && /\\S/.test(children[i].nodeValue)) {\n if (found) {\n children[i].nodeValue = '';\n } else {\n children[i].nodeValue = data[gTextProp];\n found = true;\n }\n }\n }\n // if no (non-empty) textNode is found, insert a textNode before the\n // first element child.\n if (!found) {\n var textNode = document.createTextNode(data[gTextProp]);\n element.insertBefore(textNode, element.firstChild);\n }\n }\n delete data[gTextProp];\n }\n\n for (var k in data) {\n element[k] = data[k];\n }\n }\n\n // webkit browsers don't currently support 'children' on SVG elements...\n function getChildElementCount(element) {\n if (element.children) {\n return element.children.length;\n }\n if (typeof element.childElementCount !== 'undefined') {\n return element.childElementCount;\n }\n var count = 0;\n for (var i = 0; i < element.childNodes.length; i++) {\n count += element.nodeType === 1 ? 1 : 0;\n }\n return count;\n }\n\n // translate an HTML subtree\n function translateFragment(element) {\n element = element || document.documentElement;\n\n // check all translatable children (= w/ a `data-l10n-id' attribute)\n var children = getTranslatableChildren(element);\n var elementCount = children.length;\n for (var i = 0; i < elementCount; i++) {\n translateElement(children[i]);\n }\n\n // translate element itself if necessary\n translateElement(element);\n }\n\n return {\n // get a localized string\n get: function(key, args, fallbackString) {\n var index = key.lastIndexOf('.');\n var prop = gTextProp;\n if (index > 0) { // An attribute has been specified\n prop = key.substr(index + 1);\n key = key.substring(0, index);\n }\n var fallback;\n if (fallbackString) {\n fallback = {};\n fallback[prop] = fallbackString;\n }\n var data = getL10nData(key, args, fallback);\n if (data && prop in data) {\n return data[prop];\n }\n return '{{' + key + '}}';\n },\n\n // debug\n getData: function() { return gL10nData; },\n getText: function() { return gTextData; },\n\n // get|set the document language\n getLanguage: function() { return gLanguage; },\n setLanguage: function(lang, callback) {\n loadLocale(lang, function() {\n if (callback)\n callback();\n });\n },\n\n // get the direction (ltr|rtl) of the current language\n getDirection: function() {\n // http://www.w3.org/International/questions/qa-scripts\n // Arabic, Hebrew, Farsi, Pashto, Urdu\n var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];\n var shortCode = gLanguage.split('-', 1)[0];\n return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';\n },\n\n // translate an element or document fragment\n translate: translateFragment,\n\n // this can be used to prevent race conditions\n getReadyState: function() { return gReadyState; },\n ready: function(callback) {\n if (!callback) {\n return;\n } else if (gReadyState == 'complete' || gReadyState == 'interactive') {\n window.setTimeout(function() {\n callback();\n });\n } else if (document.addEventListener) {\n document.addEventListener('localized', function once() {\n document.removeEventListener('localized', once);\n callback();\n });\n }\n }\n };\n}) (window, document);\n\n\n\n// WEBPACK FOOTER //\n// external/webL10n/l10n.js"],"sourceRoot":""}