/** * @licstart The following is the entire license notice for the * Javascript code in this page * * Copyright 2018 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @licend The above is the entire license notice for the * Javascript code in this page */ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; ; var pdfjsWebApp, pdfjsWebAppOptions; { pdfjsWebApp = __webpack_require__(1); pdfjsWebAppOptions = __webpack_require__(12); } ; { __webpack_require__(37); } ; { __webpack_require__(42); } function getViewerConfiguration() { return { appContainer: document.body, mainContainer: document.getElementById('viewerContainer'), viewerContainer: document.getElementById('viewer'), eventBus: null, toolbar: { container: document.getElementById('toolbarViewer'), numPages: document.getElementById('numPages'), pageNumber: document.getElementById('pageNumber'), scaleSelectContainer: document.getElementById('scaleSelectContainer'), scaleSelect: document.getElementById('scaleSelect'), customScaleOption: document.getElementById('customScaleOption'), previous: document.getElementById('previous'), next: document.getElementById('next'), zoomIn: document.getElementById('zoomIn'), zoomOut: document.getElementById('zoomOut'), viewFind: document.getElementById('viewFind'), openFile: document.getElementById('openFile'), print: document.getElementById('print'), presentationModeButton: document.getElementById('presentationMode'), download: document.getElementById('download'), viewBookmark: document.getElementById('viewBookmark') }, secondaryToolbar: { toolbar: document.getElementById('secondaryToolbar'), toggleButton: document.getElementById('secondaryToolbarToggle'), toolbarButtonContainer: document.getElementById('secondaryToolbarButtonContainer'), presentationModeButton: document.getElementById('secondaryPresentationMode'), openFileButton: document.getElementById('secondaryOpenFile'), printButton: document.getElementById('secondaryPrint'), downloadButton: document.getElementById('secondaryDownload'), viewBookmarkButton: document.getElementById('secondaryViewBookmark'), firstPageButton: document.getElementById('firstPage'), lastPageButton: document.getElementById('lastPage'), pageRotateCwButton: document.getElementById('pageRotateCw'), pageRotateCcwButton: document.getElementById('pageRotateCcw'), cursorSelectToolButton: document.getElementById('cursorSelectTool'), cursorHandToolButton: document.getElementById('cursorHandTool'), scrollVerticalButton: document.getElementById('scrollVertical'), scrollHorizontalButton: document.getElementById('scrollHorizontal'), scrollWrappedButton: document.getElementById('scrollWrapped'), spreadNoneButton: document.getElementById('spreadNone'), spreadOddButton: document.getElementById('spreadOdd'), spreadEvenButton: document.getElementById('spreadEven'), documentPropertiesButton: document.getElementById('documentProperties') }, fullscreen: { contextFirstPage: document.getElementById('contextFirstPage'), contextLastPage: document.getElementById('contextLastPage'), contextPageRotateCw: document.getElementById('contextPageRotateCw'), contextPageRotateCcw: document.getElementById('contextPageRotateCcw') }, sidebar: { outerContainer: document.getElementById('outerContainer'), viewerContainer: document.getElementById('viewerContainer'), toggleButton: document.getElementById('sidebarToggle'), thumbnailButton: document.getElementById('viewThumbnail'), outlineButton: document.getElementById('viewOutline'), attachmentsButton: document.getElementById('viewAttachments'), thumbnailView: document.getElementById('thumbnailView'), outlineView: document.getElementById('outlineView'), attachmentsView: document.getElementById('attachmentsView') }, sidebarResizer: { outerContainer: document.getElementById('outerContainer'), resizer: document.getElementById('sidebarResizer') }, findBar: { bar: document.getElementById('findbar'), toggleButton: document.getElementById('viewFind'), findField: document.getElementById('findInput'), highlightAllCheckbox: document.getElementById('findHighlightAll'), caseSensitiveCheckbox: document.getElementById('findMatchCase'), entireWordCheckbox: document.getElementById('findEntireWord'), findMsg: document.getElementById('findMsg'), findResultsCount: document.getElementById('findResultsCount'), findPreviousButton: document.getElementById('findPrevious'), findNextButton: document.getElementById('findNext') }, passwordOverlay: { overlayName: 'passwordOverlay', container: document.getElementById('passwordOverlay'), label: document.getElementById('passwordText'), input: document.getElementById('password'), submitButton: document.getElementById('passwordSubmit'), cancelButton: document.getElementById('passwordCancel') }, documentProperties: { overlayName: 'documentPropertiesOverlay', container: document.getElementById('documentPropertiesOverlay'), closeButton: document.getElementById('documentPropertiesClose'), fields: { 'fileName': document.getElementById('fileNameField'), 'fileSize': document.getElementById('fileSizeField'), 'title': document.getElementById('titleField'), 'author': document.getElementById('authorField'), 'subject': document.getElementById('subjectField'), 'keywords': document.getElementById('keywordsField'), 'creationDate': document.getElementById('creationDateField'), 'modificationDate': document.getElementById('modificationDateField'), 'creator': document.getElementById('creatorField'), 'producer': document.getElementById('producerField'), 'version': document.getElementById('versionField'), 'pageCount': document.getElementById('pageCountField'), 'pageSize': document.getElementById('pageSizeField'), 'linearized': document.getElementById('linearizedField') } }, errorWrapper: { container: document.getElementById('errorWrapper'), errorMessage: document.getElementById('errorMessage'), closeButton: document.getElementById('errorClose'), errorMoreInfo: document.getElementById('errorMoreInfo'), moreInfoButton: document.getElementById('errorShowMore'), lessInfoButton: document.getElementById('errorShowLess') }, printContainer: document.getElementById('printContainer'), openFileInputName: 'fileInput', debuggerScriptPath: './debugger.js' }; } function webViewerLoad() { var config = getViewerConfiguration(); window.PDFViewerApplication = pdfjsWebApp.PDFViewerApplication; window.PDFViewerApplicationOptions = pdfjsWebAppOptions.AppOptions; var event = document.createEvent('CustomEvent'); event.initCustomEvent('webviewerloaded', true, true, {}); document.dispatchEvent(event); pdfjsWebApp.PDFViewerApplication.run(config); } if (document.readyState === 'interactive' || document.readyState === 'complete') { webViewerLoad(); } else { document.addEventListener('DOMContentLoaded', webViewerLoad, true); } /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDFPrintServiceFactory = exports.DefaultExternalServices = exports.PDFViewerApplication = void 0; var _regenerator = _interopRequireDefault(__webpack_require__(2)); var _ui_utils = __webpack_require__(6); var _pdfjsLib = __webpack_require__(7); var _pdf_cursor_tools = __webpack_require__(8); var _pdf_rendering_queue = __webpack_require__(10); var _pdf_sidebar = __webpack_require__(11); var _app_options = __webpack_require__(12); var _overlay_manager = __webpack_require__(14); var _password_prompt = __webpack_require__(15); var _pdf_attachment_viewer = __webpack_require__(16); var _pdf_document_properties = __webpack_require__(17); var _pdf_find_bar = __webpack_require__(18); var _pdf_find_controller = __webpack_require__(19); var _pdf_history = __webpack_require__(21); var _pdf_link_service = __webpack_require__(22); var _pdf_outline_viewer = __webpack_require__(23); var _pdf_presentation_mode = __webpack_require__(24); var _pdf_sidebar_resizer = __webpack_require__(25); var _pdf_thumbnail_viewer = __webpack_require__(26); var _pdf_viewer = __webpack_require__(28); var _secondary_toolbar = __webpack_require__(33); var _toolbar = __webpack_require__(35); var _view_history = __webpack_require__(36); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } var DEFAULT_SCALE_DELTA = 1.1; var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; var FORCE_PAGES_LOADED_TIMEOUT = 10000; var WHEEL_ZOOM_DISABLED_TIMEOUT = 1000; var ViewOnLoad = { UNKNOWN: -1, PREVIOUS: 0, INITIAL: 1 }; var DefaultExternalServices = { updateFindControlState: function updateFindControlState(data) {}, updateFindMatchesCount: function updateFindMatchesCount(data) {}, initPassiveLoading: function initPassiveLoading(callbacks) {}, fallback: function fallback(data, callback) {}, reportTelemetry: function reportTelemetry(data) {}, createDownloadManager: function createDownloadManager(options) { throw new Error('Not implemented: createDownloadManager'); }, createPreferences: function createPreferences() { throw new Error('Not implemented: createPreferences'); }, createL10n: function createL10n(options) { throw new Error('Not implemented: createL10n'); }, supportsIntegratedFind: false, supportsDocumentFonts: true, supportsDocumentColors: true, supportedMouseWheelZoomModifierKeys: { ctrlKey: true, metaKey: true } }; exports.DefaultExternalServices = DefaultExternalServices; var PDFViewerApplication = { initialBookmark: document.location.hash.substring(1), initialized: false, fellback: false, appConfig: null, pdfDocument: null, pdfLoadingTask: null, printService: null, pdfViewer: null, pdfThumbnailViewer: null, pdfRenderingQueue: null, pdfPresentationMode: null, pdfDocumentProperties: null, pdfLinkService: null, pdfHistory: null, pdfSidebar: null, pdfSidebarResizer: null, pdfOutlineViewer: null, pdfAttachmentViewer: null, pdfCursorTools: null, store: null, downloadManager: null, overlayManager: null, preferences: null, toolbar: null, secondaryToolbar: null, eventBus: null, l10n: null, isInitialViewSet: false, downloadComplete: false, isViewerEmbedded: window.parent !== window, url: '', baseUrl: '', externalServices: DefaultExternalServices, _boundEvents: {}, contentDispositionFilename: null, initialize: function () { var _initialize = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee(appConfig) { var _this = this; var appContainer; return _regenerator.default.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: this.preferences = this.externalServices.createPreferences(); this.appConfig = appConfig; _context.next = 4; return this._readPreferences(); case 4: _context.next = 6; return this._parseHashParameters(); case 6: _context.next = 8; return this._initializeL10n(); case 8: if (this.isViewerEmbedded && _app_options.AppOptions.get('externalLinkTarget') === _pdfjsLib.LinkTarget.NONE) { _app_options.AppOptions.set('externalLinkTarget', _pdfjsLib.LinkTarget.TOP); } _context.next = 11; return this._initializeViewerComponents(); case 11: this.bindEvents(); this.bindWindowEvents(); appContainer = appConfig.appContainer || document.documentElement; this.l10n.translate(appContainer).then(function () { _this.eventBus.dispatch('localized', { source: _this }); }); this.initialized = true; case 16: case "end": return _context.stop(); } } }, _callee, this); })); function initialize(_x) { return _initialize.apply(this, arguments); } return initialize; }(), _readPreferences: function () { var _readPreferences2 = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee2() { var prefs, name; return _regenerator.default.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: if (!(_app_options.AppOptions.get('disablePreferences') === true)) { _context2.next = 2; break; } return _context2.abrupt("return"); case 2: _context2.prev = 2; _context2.next = 5; return this.preferences.getAll(); case 5: prefs = _context2.sent; for (name in prefs) { _app_options.AppOptions.set(name, prefs[name]); } _context2.next = 11; break; case 9: _context2.prev = 9; _context2.t0 = _context2["catch"](2); case 11: case "end": return _context2.stop(); } } }, _callee2, this, [[2, 9]]); })); function _readPreferences() { return _readPreferences2.apply(this, arguments); } return _readPreferences; }(), _parseHashParameters: function () { var _parseHashParameters2 = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee3() { var waitOn, hash, hashParams, viewer, enabled; return _regenerator.default.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: if (_app_options.AppOptions.get('pdfBugEnabled')) { _context3.next = 2; break; } return _context3.abrupt("return"); case 2: waitOn = []; hash = document.location.hash.substring(1); hashParams = (0, _ui_utils.parseQueryString)(hash); if ('disableworker' in hashParams && hashParams['disableworker'] === 'true') { waitOn.push(loadFakeWorker()); } if ('disablerange' in hashParams) { _app_options.AppOptions.set('disableRange', hashParams['disablerange'] === 'true'); } if ('disablestream' in hashParams) { _app_options.AppOptions.set('disableStream', hashParams['disablestream'] === 'true'); } if ('disableautofetch' in hashParams) { _app_options.AppOptions.set('disableAutoFetch', hashParams['disableautofetch'] === 'true'); } if ('disablefontface' in hashParams) { _app_options.AppOptions.set('disableFontFace', hashParams['disablefontface'] === 'true'); } if ('disablehistory' in hashParams) { _app_options.AppOptions.set('disableHistory', hashParams['disablehistory'] === 'true'); } if ('webgl' in hashParams) { _app_options.AppOptions.set('enableWebGL', hashParams['webgl'] === 'true'); } if ('useonlycsszoom' in hashParams) { _app_options.AppOptions.set('useOnlyCssZoom', hashParams['useonlycsszoom'] === 'true'); } if ('verbosity' in hashParams) { _app_options.AppOptions.set('verbosity', hashParams['verbosity'] | 0); } if (!('textlayer' in hashParams)) { _context3.next = 23; break; } _context3.t0 = hashParams['textlayer']; _context3.next = _context3.t0 === 'off' ? 18 : _context3.t0 === 'visible' ? 20 : _context3.t0 === 'shadow' ? 20 : _context3.t0 === 'hover' ? 20 : 23; break; case 18: _app_options.AppOptions.set('textLayerMode', _ui_utils.TextLayerMode.DISABLE); return _context3.abrupt("break", 23); case 20: viewer = this.appConfig.viewerContainer; viewer.classList.add('textLayer-' + hashParams['textlayer']); return _context3.abrupt("break", 23); case 23: if ('pdfbug' in hashParams) { _app_options.AppOptions.set('pdfBug', true); enabled = hashParams['pdfbug'].split(','); waitOn.push(loadAndEnablePDFBug(enabled)); } if ('locale' in hashParams) { _app_options.AppOptions.set('locale', hashParams['locale']); } return _context3.abrupt("return", Promise.all(waitOn).catch(function (reason) { console.error("_parseHashParameters: \"".concat(reason.message, "\".")); })); case 26: case "end": return _context3.stop(); } } }, _callee3, this); })); function _parseHashParameters() { return _parseHashParameters2.apply(this, arguments); } return _parseHashParameters; }(), _initializeL10n: function () { var _initializeL10n2 = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee4() { var dir; return _regenerator.default.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: this.l10n = this.externalServices.createL10n({ locale: _app_options.AppOptions.get('locale') }); _context4.next = 3; return this.l10n.getDirection(); case 3: dir = _context4.sent; document.getElementsByTagName('html')[0].dir = dir; case 5: case "end": return _context4.stop(); } } }, _callee4, this); })); function _initializeL10n() { return _initializeL10n2.apply(this, arguments); } return _initializeL10n; }(), _initializeViewerComponents: function () { var _initializeViewerComponents2 = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee5() { var appConfig, dispatchToDOM, eventBus, pdfRenderingQueue, pdfLinkService, downloadManager, findController, container, viewer, thumbnailContainer, sidebarConfig; return _regenerator.default.wrap(function _callee5$(_context5) { while (1) { switch (_context5.prev = _context5.next) { case 0: appConfig = this.appConfig; this.overlayManager = new _overlay_manager.OverlayManager(); dispatchToDOM = _app_options.AppOptions.get('eventBusDispatchToDOM'); eventBus = appConfig.eventBus || (0, _ui_utils.getGlobalEventBus)(dispatchToDOM); this.eventBus = eventBus; pdfRenderingQueue = new _pdf_rendering_queue.PDFRenderingQueue(); pdfRenderingQueue.onIdle = this.cleanup.bind(this); this.pdfRenderingQueue = pdfRenderingQueue; pdfLinkService = new _pdf_link_service.PDFLinkService({ eventBus: eventBus, externalLinkTarget: _app_options.AppOptions.get('externalLinkTarget'), externalLinkRel: _app_options.AppOptions.get('externalLinkRel') }); this.pdfLinkService = pdfLinkService; downloadManager = this.externalServices.createDownloadManager({ disableCreateObjectURL: _app_options.AppOptions.get('disableCreateObjectURL') }); this.downloadManager = downloadManager; findController = new _pdf_find_controller.PDFFindController({ linkService: pdfLinkService, eventBus: eventBus }); this.findController = findController; container = appConfig.mainContainer; viewer = appConfig.viewerContainer; this.pdfViewer = new _pdf_viewer.PDFViewer({ container: container, viewer: viewer, eventBus: eventBus, renderingQueue: pdfRenderingQueue, linkService: pdfLinkService, downloadManager: downloadManager, findController: findController, renderer: _app_options.AppOptions.get('renderer'), enableWebGL: _app_options.AppOptions.get('enableWebGL'), l10n: this.l10n, textLayerMode: _app_options.AppOptions.get('textLayerMode'), imageResourcesPath: _app_options.AppOptions.get('imageResourcesPath'), renderInteractiveForms: _app_options.AppOptions.get('renderInteractiveForms'), enablePrintAutoRotate: _app_options.AppOptions.get('enablePrintAutoRotate'), useOnlyCssZoom: _app_options.AppOptions.get('useOnlyCssZoom'), maxCanvasPixels: _app_options.AppOptions.get('maxCanvasPixels') }); pdfRenderingQueue.setViewer(this.pdfViewer); pdfLinkService.setViewer(this.pdfViewer); thumbnailContainer = appConfig.sidebar.thumbnailView; this.pdfThumbnailViewer = new _pdf_thumbnail_viewer.PDFThumbnailViewer({ container: thumbnailContainer, renderingQueue: pdfRenderingQueue, linkService: pdfLinkService, l10n: this.l10n }); pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer); this.pdfHistory = new _pdf_history.PDFHistory({ linkService: pdfLinkService, eventBus: eventBus }); pdfLinkService.setHistory(this.pdfHistory); this.findBar = new _pdf_find_bar.PDFFindBar(appConfig.findBar, eventBus, this.l10n); this.pdfDocumentProperties = new _pdf_document_properties.PDFDocumentProperties(appConfig.documentProperties, this.overlayManager, eventBus, this.l10n); this.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({ container: container, eventBus: eventBus, cursorToolOnLoad: _app_options.AppOptions.get('cursorToolOnLoad') }); this.toolbar = new _toolbar.Toolbar(appConfig.toolbar, eventBus, this.l10n); this.secondaryToolbar = new _secondary_toolbar.SecondaryToolbar(appConfig.secondaryToolbar, container, eventBus); if (this.supportsFullscreen) { this.pdfPresentationMode = new _pdf_presentation_mode.PDFPresentationMode({ container: container, viewer: viewer, pdfViewer: this.pdfViewer, eventBus: eventBus, contextMenuItems: appConfig.fullscreen }); } this.passwordPrompt = new _password_prompt.PasswordPrompt(appConfig.passwordOverlay, this.overlayManager, this.l10n); this.pdfOutlineViewer = new _pdf_outline_viewer.PDFOutlineViewer({ container: appConfig.sidebar.outlineView, eventBus: eventBus, linkService: pdfLinkService }); this.pdfAttachmentViewer = new _pdf_attachment_viewer.PDFAttachmentViewer({ container: appConfig.sidebar.attachmentsView, eventBus: eventBus, downloadManager: downloadManager }); sidebarConfig = Object.create(appConfig.sidebar); sidebarConfig.pdfViewer = this.pdfViewer; sidebarConfig.pdfThumbnailViewer = this.pdfThumbnailViewer; this.pdfSidebar = new _pdf_sidebar.PDFSidebar(sidebarConfig, eventBus, this.l10n); this.pdfSidebar.onToggled = this.forceRendering.bind(this); this.pdfSidebarResizer = new _pdf_sidebar_resizer.PDFSidebarResizer(appConfig.sidebarResizer, eventBus, this.l10n); case 39: case "end": return _context5.stop(); } } }, _callee5, this); })); function _initializeViewerComponents() { return _initializeViewerComponents2.apply(this, arguments); } return _initializeViewerComponents; }(), run: function run(config) { this.initialize(config).then(webViewerInitialized); }, zoomIn: function zoomIn(ticks) { var newScale = this.pdfViewer.currentScale; do { newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2); newScale = Math.ceil(newScale * 10) / 10; newScale = Math.min(_ui_utils.MAX_SCALE, newScale); } while (--ticks > 0 && newScale < _ui_utils.MAX_SCALE); this.pdfViewer.currentScaleValue = newScale; }, zoomOut: function zoomOut(ticks) { var newScale = this.pdfViewer.currentScale; do { newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2); newScale = Math.floor(newScale * 10) / 10; newScale = Math.max(_ui_utils.MIN_SCALE, newScale); } while (--ticks > 0 && newScale > _ui_utils.MIN_SCALE); this.pdfViewer.currentScaleValue = newScale; }, get pagesCount() { return this.pdfDocument ? this.pdfDocument.numPages : 0; }, set page(val) { this.pdfViewer.currentPageNumber = val; }, get page() { return this.pdfViewer.currentPageNumber; }, get printing() { return !!this.printService; }, get supportsPrinting() { return PDFPrintServiceFactory.instance.supportsPrinting; }, get supportsFullscreen() { var support; var doc = document.documentElement; support = !!(doc.requestFullscreen || doc.mozRequestFullScreen || doc.webkitRequestFullScreen || doc.msRequestFullscreen); if (document.fullscreenEnabled === false || document.mozFullScreenEnabled === false || document.webkitFullscreenEnabled === false || document.msFullscreenEnabled === false) { support = false; } return (0, _pdfjsLib.shadow)(this, 'supportsFullscreen', support); }, get supportsIntegratedFind() { return this.externalServices.supportsIntegratedFind; }, get supportsDocumentFonts() { return this.externalServices.supportsDocumentFonts; }, get supportsDocumentColors() { return this.externalServices.supportsDocumentColors; }, get loadingBar() { var bar = new _ui_utils.ProgressBar('#loadingBar'); return (0, _pdfjsLib.shadow)(this, 'loadingBar', bar); }, get supportedMouseWheelZoomModifierKeys() { return this.externalServices.supportedMouseWheelZoomModifierKeys; }, initPassiveLoading: function initPassiveLoading() { throw new Error('Not implemented: initPassiveLoading'); }, setTitleUsingUrl: function setTitleUsingUrl() { var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; this.url = url; this.baseUrl = url.split('#')[0]; var title = (0, _ui_utils.getPDFFileNameFromURL)(url, ''); if (!title) { try { title = decodeURIComponent((0, _pdfjsLib.getFilenameFromUrl)(url)) || url; } catch (ex) { title = url; } } this.setTitle(title); }, setTitle: function setTitle(title) { if (this.isViewerEmbedded) { return; } document.title = title; }, close: function () { var _close = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee6() { var errorWrapper, promise; return _regenerator.default.wrap(function _callee6$(_context6) { while (1) { switch (_context6.prev = _context6.next) { case 0: errorWrapper = this.appConfig.errorWrapper.container; errorWrapper.setAttribute('hidden', 'true'); if (this.pdfLoadingTask) { _context6.next = 4; break; } return _context6.abrupt("return"); case 4: promise = this.pdfLoadingTask.destroy(); this.pdfLoadingTask = null; if (this.pdfDocument) { this.pdfDocument = null; this.pdfThumbnailViewer.setDocument(null); this.pdfViewer.setDocument(null); this.pdfLinkService.setDocument(null); this.pdfDocumentProperties.setDocument(null); } this.store = null; this.isInitialViewSet = false; this.downloadComplete = false; this.url = ''; this.baseUrl = ''; this.contentDispositionFilename = null; this.pdfSidebar.reset(); this.pdfOutlineViewer.reset(); this.pdfAttachmentViewer.reset(); this.findBar.reset(); this.toolbar.reset(); this.secondaryToolbar.reset(); if (typeof PDFBug !== 'undefined') { PDFBug.cleanup(); } return _context6.abrupt("return", promise); case 21: case "end": return _context6.stop(); } } }, _callee6, this); })); function close() { return _close.apply(this, arguments); } return close; }(), open: function () { var _open = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee7(file, args) { var _this2 = this; var workerParameters, key, parameters, apiParameters, _key, prop, loadingTask; return _regenerator.default.wrap(function _callee7$(_context7) { while (1) { switch (_context7.prev = _context7.next) { case 0: if (!this.pdfLoadingTask) { _context7.next = 3; break; } _context7.next = 3; return this.close(); case 3: workerParameters = _app_options.AppOptions.getAll('worker'); for (key in workerParameters) { _pdfjsLib.GlobalWorkerOptions[key] = workerParameters[key]; } parameters = Object.create(null); if (typeof file === 'string') { this.setTitleUsingUrl(file); parameters.url = file; } else if (file && 'byteLength' in file) { parameters.data = file; } else if (file.url && file.originalUrl) { this.setTitleUsingUrl(file.originalUrl); parameters.url = file.url; } apiParameters = _app_options.AppOptions.getAll('api'); for (_key in apiParameters) { parameters[_key] = apiParameters[_key]; } if (args) { for (prop in args) { if (prop === 'length') { this.pdfDocumentProperties.setFileSize(args[prop]); } parameters[prop] = args[prop]; } } loadingTask = (0, _pdfjsLib.getDocument)(parameters); this.pdfLoadingTask = loadingTask; loadingTask.onPassword = function (updateCallback, reason) { _this2.passwordPrompt.setUpdateCallback(updateCallback, reason); _this2.passwordPrompt.open(); }; loadingTask.onProgress = function (_ref) { var loaded = _ref.loaded, total = _ref.total; _this2.progress(loaded / total); }; loadingTask.onUnsupportedFeature = this.fallback.bind(this); return _context7.abrupt("return", loadingTask.promise.then(function (pdfDocument) { _this2.load(pdfDocument); }, function (exception) { if (loadingTask !== _this2.pdfLoadingTask) { return; } var message = exception && exception.message; var loadingErrorMessage; if (exception instanceof _pdfjsLib.InvalidPDFException) { loadingErrorMessage = _this2.l10n.get('invalid_file_error', null, 'Invalid or corrupted PDF file.'); } else if (exception instanceof _pdfjsLib.MissingPDFException) { loadingErrorMessage = _this2.l10n.get('missing_file_error', null, 'Missing PDF file.'); } else if (exception instanceof _pdfjsLib.UnexpectedResponseException) { loadingErrorMessage = _this2.l10n.get('unexpected_response_error', null, 'Unexpected server response.'); } else { loadingErrorMessage = _this2.l10n.get('loading_error', null, 'An error occurred while loading the PDF.'); } return loadingErrorMessage.then(function (msg) { _this2.error(msg, { message: message }); throw new Error(msg); }); })); case 16: case "end": return _context7.stop(); } } }, _callee7, this); })); function open(_x2, _x3) { return _open.apply(this, arguments); } return open; }(), download: function download() { var _this3 = this; function downloadByUrl() { downloadManager.downloadUrl(url, filename); } var url = this.baseUrl; var filename = this.contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url); var downloadManager = this.downloadManager; downloadManager.onerror = function (err) { _this3.error("PDF failed to download: ".concat(err)); }; if (!this.pdfDocument || !this.downloadComplete) { downloadByUrl(); return; } this.pdfDocument.getData().then(function (data) { var blob = new Blob([data], { type: 'application/pdf' }); downloadManager.download(blob, url, filename); }).catch(downloadByUrl); }, fallback: function fallback(featureId) {}, error: function error(message, moreInfo) { var moreInfoText = [this.l10n.get('error_version_info', { version: _pdfjsLib.version || '?', build: _pdfjsLib.build || '?' }, 'PDF.js v{{version}} (build: {{build}})')]; if (moreInfo) { moreInfoText.push(this.l10n.get('error_message', { message: moreInfo.message }, 'Message: {{message}}')); if (moreInfo.stack) { moreInfoText.push(this.l10n.get('error_stack', { stack: moreInfo.stack }, 'Stack: {{stack}}')); } else { if (moreInfo.filename) { moreInfoText.push(this.l10n.get('error_file', { file: moreInfo.filename }, 'File: {{file}}')); } if (moreInfo.lineNumber) { moreInfoText.push(this.l10n.get('error_line', { line: moreInfo.lineNumber }, 'Line: {{line}}')); } } } var errorWrapperConfig = this.appConfig.errorWrapper; var errorWrapper = errorWrapperConfig.container; errorWrapper.removeAttribute('hidden'); var errorMessage = errorWrapperConfig.errorMessage; errorMessage.textContent = message; var closeButton = errorWrapperConfig.closeButton; closeButton.onclick = function () { errorWrapper.setAttribute('hidden', 'true'); }; var errorMoreInfo = errorWrapperConfig.errorMoreInfo; var moreInfoButton = errorWrapperConfig.moreInfoButton; var lessInfoButton = errorWrapperConfig.lessInfoButton; moreInfoButton.onclick = function () { errorMoreInfo.removeAttribute('hidden'); moreInfoButton.setAttribute('hidden', 'true'); lessInfoButton.removeAttribute('hidden'); errorMoreInfo.style.height = errorMoreInfo.scrollHeight + 'px'; }; lessInfoButton.onclick = function () { errorMoreInfo.setAttribute('hidden', 'true'); moreInfoButton.removeAttribute('hidden'); lessInfoButton.setAttribute('hidden', 'true'); }; moreInfoButton.oncontextmenu = _ui_utils.noContextMenuHandler; lessInfoButton.oncontextmenu = _ui_utils.noContextMenuHandler; closeButton.oncontextmenu = _ui_utils.noContextMenuHandler; moreInfoButton.removeAttribute('hidden'); lessInfoButton.setAttribute('hidden', 'true'); Promise.all(moreInfoText).then(function (parts) { errorMoreInfo.value = parts.join('\n'); }); }, progress: function progress(level) { var _this4 = this; if (this.downloadComplete) { return; } var percent = Math.round(level * 100); if (percent > this.loadingBar.percent || isNaN(percent)) { this.loadingBar.percent = percent; var disableAutoFetch = this.pdfDocument ? this.pdfDocument.loadingParams['disableAutoFetch'] : _app_options.AppOptions.get('disableAutoFetch'); if (disableAutoFetch && percent) { if (this.disableAutoFetchLoadingBarTimeout) { clearTimeout(this.disableAutoFetchLoadingBarTimeout); this.disableAutoFetchLoadingBarTimeout = null; } this.loadingBar.show(); this.disableAutoFetchLoadingBarTimeout = setTimeout(function () { _this4.loadingBar.hide(); _this4.disableAutoFetchLoadingBarTimeout = null; }, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT); } } }, load: function load(pdfDocument) { var _this5 = this; this.pdfDocument = pdfDocument; pdfDocument.getDownloadInfo().then(function () { _this5.downloadComplete = true; _this5.loadingBar.hide(); firstPagePromise.then(function () { _this5.eventBus.dispatch('documentloaded', { source: _this5 }); }); }); var pageModePromise = pdfDocument.getPageMode().catch(function () {}); var openActionDestPromise = pdfDocument.getOpenActionDestination().catch(function () {}); this.toolbar.setPagesCount(pdfDocument.numPages, false); this.secondaryToolbar.setPagesCount(pdfDocument.numPages); var store = this.store = new _view_history.ViewHistory(pdfDocument.fingerprint); var baseDocumentUrl; baseDocumentUrl = null; this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl); this.pdfDocumentProperties.setDocument(pdfDocument, this.url); var pdfViewer = this.pdfViewer; pdfViewer.setDocument(pdfDocument); var firstPagePromise = pdfViewer.firstPagePromise; var pagesPromise = pdfViewer.pagesPromise; var onePageRendered = pdfViewer.onePageRendered; var pdfThumbnailViewer = this.pdfThumbnailViewer; pdfThumbnailViewer.setDocument(pdfDocument); firstPagePromise.then(function (pdfPage) { _this5.loadingBar.setWidth(_this5.appConfig.viewerContainer); var storePromise = store.getMultiple({ page: null, zoom: _ui_utils.DEFAULT_SCALE_VALUE, scrollLeft: '0', scrollTop: '0', rotation: null, sidebarView: _pdf_sidebar.SidebarView.UNKNOWN, scrollMode: _ui_utils.ScrollMode.UNKNOWN, spreadMode: _ui_utils.SpreadMode.UNKNOWN }).catch(function () {}); Promise.all([storePromise, pageModePromise, openActionDestPromise]).then( /*#__PURE__*/ function () { var _ref3 = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee8(_ref2) { var _ref4, _ref4$, values, pageMode, openActionDest, viewOnLoad, initialBookmark, zoom, hash, rotation, sidebarView, scrollMode, spreadMode; return _regenerator.default.wrap(function _callee8$(_context8) { while (1) { switch (_context8.prev = _context8.next) { case 0: _ref4 = _slicedToArray(_ref2, 3), _ref4$ = _ref4[0], values = _ref4$ === void 0 ? {} : _ref4$, pageMode = _ref4[1], openActionDest = _ref4[2]; viewOnLoad = _app_options.AppOptions.get('viewOnLoad'); _this5._initializePdfHistory({ fingerprint: pdfDocument.fingerprint, viewOnLoad: viewOnLoad, initialDest: openActionDest }); initialBookmark = _this5.initialBookmark; zoom = _app_options.AppOptions.get('defaultZoomValue'); hash = zoom ? "zoom=".concat(zoom) : null; rotation = null; sidebarView = _app_options.AppOptions.get('sidebarViewOnLoad'); scrollMode = _app_options.AppOptions.get('scrollModeOnLoad'); spreadMode = _app_options.AppOptions.get('spreadModeOnLoad'); if (values.page && viewOnLoad !== ViewOnLoad.INITIAL) { hash = "page=".concat(values.page, "&zoom=").concat(zoom || values.zoom, ",") + "".concat(values.scrollLeft, ",").concat(values.scrollTop); rotation = parseInt(values.rotation, 10); if (sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) { sidebarView = values.sidebarView | 0; } if (scrollMode === _ui_utils.ScrollMode.UNKNOWN) { scrollMode = values.scrollMode | 0; } if (spreadMode === _ui_utils.SpreadMode.UNKNOWN) { spreadMode = values.spreadMode | 0; } } if (pageMode && sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) { sidebarView = apiPageModeToSidebarView(pageMode); } _this5.setInitialView(hash, { rotation: rotation, sidebarView: sidebarView, scrollMode: scrollMode, spreadMode: spreadMode }); _this5.eventBus.dispatch('documentinit', { source: _this5 }); if (!_this5.isViewerEmbedded) { pdfViewer.focus(); } _context8.next = 17; return Promise.race([pagesPromise, new Promise(function (resolve) { setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT); })]); case 17: if (!(!initialBookmark && !hash)) { _context8.next = 19; break; } return _context8.abrupt("return"); case 19: if (!pdfViewer.hasEqualPageSizes) { _context8.next = 21; break; } return _context8.abrupt("return"); case 21: _this5.initialBookmark = initialBookmark; pdfViewer.currentScaleValue = pdfViewer.currentScaleValue; _this5.setInitialView(hash); case 24: case "end": return _context8.stop(); } } }, _callee8, this); })); return function (_x4) { return _ref3.apply(this, arguments); }; }()).catch(function () { _this5.setInitialView(); }).then(function () { pdfViewer.update(); }); }); pdfDocument.getPageLabels().then(function (labels) { if (!labels || _app_options.AppOptions.get('disablePageLabels')) { return; } var i = 0, numLabels = labels.length; if (numLabels !== _this5.pagesCount) { console.error('The number of Page Labels does not match ' + 'the number of pages in the document.'); return; } while (i < numLabels && labels[i] === (i + 1).toString()) { i++; } if (i === numLabels) { return; } pdfViewer.setPageLabels(labels); pdfThumbnailViewer.setPageLabels(labels); _this5.toolbar.setPagesCount(pdfDocument.numPages, true); _this5.toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel); }); pagesPromise.then(function () { if (!_this5.supportsPrinting) { return; } pdfDocument.getJavaScript().then(function (javaScript) { if (!javaScript) { return; } javaScript.some(function (js) { if (!js) { return false; } console.warn('Warning: JavaScript is not supported'); _this5.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.javaScript); return true; }); var regex = /\bprint\s*\(/; for (var i = 0, ii = javaScript.length; i < ii; i++) { var js = javaScript[i]; if (js && regex.test(js)) { setTimeout(function () { window.print(); }); return; } } }); }); Promise.all([onePageRendered, _ui_utils.animationStarted]).then(function () { pdfDocument.getOutline().then(function (outline) { _this5.pdfOutlineViewer.render({ outline: outline }); }); pdfDocument.getAttachments().then(function (attachments) { _this5.pdfAttachmentViewer.render({ attachments: attachments }); }); }); pdfDocument.getMetadata().then(function (_ref5) { var info = _ref5.info, metadata = _ref5.metadata, contentDispositionFilename = _ref5.contentDispositionFilename; _this5.documentInfo = info; _this5.metadata = metadata; _this5.contentDispositionFilename = contentDispositionFilename; console.log('PDF ' + pdfDocument.fingerprint + ' [' + info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() + ' / ' + (info.Creator || '-').trim() + ']' + ' (PDF.js: ' + (_pdfjsLib.version || '-') + (_app_options.AppOptions.get('enableWebGL') ? ' [WebGL]' : '') + ')'); var pdfTitle; if (metadata && metadata.has('dc:title')) { var title = metadata.get('dc:title'); if (title !== 'Untitled') { pdfTitle = title; } } if (!pdfTitle && info && info['Title']) { pdfTitle = info['Title']; } if (pdfTitle) { _this5.setTitle("".concat(pdfTitle, " - ").concat(contentDispositionFilename || document.title)); } else if (contentDispositionFilename) { _this5.setTitle(contentDispositionFilename); } if (info.IsAcroFormPresent) { console.warn('Warning: AcroForm/XFA is not supported'); _this5.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.forms); } }); }, _initializePdfHistory: function _initializePdfHistory(_ref6) { var fingerprint = _ref6.fingerprint, viewOnLoad = _ref6.viewOnLoad, _ref6$initialDest = _ref6.initialDest, initialDest = _ref6$initialDest === void 0 ? null : _ref6$initialDest; if (_app_options.AppOptions.get('disableHistory') || this.isViewerEmbedded) { return; } this.pdfHistory.initialize({ fingerprint: fingerprint, resetHistory: viewOnLoad === ViewOnLoad.INITIAL, updateUrl: _app_options.AppOptions.get('historyUpdateUrl') }); if (this.pdfHistory.initialBookmark) { this.initialBookmark = this.pdfHistory.initialBookmark; this.initialRotation = this.pdfHistory.initialRotation; } if (initialDest && !this.initialBookmark && viewOnLoad === ViewOnLoad.UNKNOWN) { this.initialBookmark = JSON.stringify(initialDest); this.pdfHistory.push({ explicitDest: initialDest, pageNumber: null }); } }, setInitialView: function setInitialView(storedHash) { var _this6 = this; var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, rotation = _ref7.rotation, sidebarView = _ref7.sidebarView, scrollMode = _ref7.scrollMode, spreadMode = _ref7.spreadMode; var setRotation = function setRotation(angle) { if ((0, _ui_utils.isValidRotation)(angle)) { _this6.pdfViewer.pagesRotation = angle; } }; var setViewerModes = function setViewerModes(scroll, spread) { if ((0, _ui_utils.isValidScrollMode)(scroll)) { _this6.pdfViewer.scrollMode = scroll; } if ((0, _ui_utils.isValidSpreadMode)(spread)) { _this6.pdfViewer.spreadMode = spread; } }; this.isInitialViewSet = true; this.pdfSidebar.setInitialView(sidebarView); setViewerModes(scrollMode, spreadMode); if (this.initialBookmark) { setRotation(this.initialRotation); delete this.initialRotation; this.pdfLinkService.setHash(this.initialBookmark); this.initialBookmark = null; } else if (storedHash) { setRotation(rotation); this.pdfLinkService.setHash(storedHash); } this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber, this.pdfViewer.currentPageLabel); this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber); if (!this.pdfViewer.currentScaleValue) { this.pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; } }, cleanup: function cleanup() { if (!this.pdfDocument) { return; } this.pdfViewer.cleanup(); this.pdfThumbnailViewer.cleanup(); if (this.pdfViewer.renderer !== _ui_utils.RendererType.SVG) { this.pdfDocument.cleanup(); } }, forceRendering: function forceRendering() { this.pdfRenderingQueue.printing = this.printing; this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar.isThumbnailViewVisible; this.pdfRenderingQueue.renderHighestPriority(); }, beforePrint: function beforePrint() { var _this7 = this; if (this.printService) { return; } if (!this.supportsPrinting) { this.l10n.get('printing_not_supported', null, 'Warning: Printing is not fully supported by ' + 'this browser.').then(function (printMessage) { _this7.error(printMessage); }); return; } if (!this.pdfViewer.pageViewsReady) { this.l10n.get('printing_not_ready', null, 'Warning: The PDF is not fully loaded for printing.').then(function (notReadyMessage) { window.alert(notReadyMessage); }); return; } var pagesOverview = this.pdfViewer.getPagesOverview(); var printContainer = this.appConfig.printContainer; var printService = PDFPrintServiceFactory.instance.createPrintService(this.pdfDocument, pagesOverview, printContainer, this.l10n); this.printService = printService; this.forceRendering(); printService.layout(); }, afterPrint: function pdfViewSetupAfterPrint() { if (this.printService) { this.printService.destroy(); this.printService = null; } this.forceRendering(); }, rotatePages: function rotatePages(delta) { if (!this.pdfDocument) { return; } var newRotation = (this.pdfViewer.pagesRotation + 360 + delta) % 360; this.pdfViewer.pagesRotation = newRotation; }, requestPresentationMode: function requestPresentationMode() { if (!this.pdfPresentationMode) { return; } this.pdfPresentationMode.request(); }, bindEvents: function bindEvents() { var eventBus = this.eventBus, _boundEvents = this._boundEvents; _boundEvents.beforePrint = this.beforePrint.bind(this); _boundEvents.afterPrint = this.afterPrint.bind(this); eventBus.on('resize', webViewerResize); eventBus.on('hashchange', webViewerHashchange); eventBus.on('beforeprint', _boundEvents.beforePrint); eventBus.on('afterprint', _boundEvents.afterPrint); eventBus.on('pagerendered', webViewerPageRendered); eventBus.on('textlayerrendered', webViewerTextLayerRendered); eventBus.on('updateviewarea', webViewerUpdateViewarea); eventBus.on('pagechanging', webViewerPageChanging); eventBus.on('scalechanging', webViewerScaleChanging); eventBus.on('rotationchanging', webViewerRotationChanging); eventBus.on('sidebarviewchanged', webViewerSidebarViewChanged); eventBus.on('pagemode', webViewerPageMode); eventBus.on('namedaction', webViewerNamedAction); eventBus.on('presentationmodechanged', webViewerPresentationModeChanged); eventBus.on('presentationmode', webViewerPresentationMode); eventBus.on('openfile', webViewerOpenFile); eventBus.on('print', webViewerPrint); eventBus.on('download', webViewerDownload); eventBus.on('firstpage', webViewerFirstPage); eventBus.on('lastpage', webViewerLastPage); eventBus.on('nextpage', webViewerNextPage); eventBus.on('previouspage', webViewerPreviousPage); eventBus.on('zoomin', webViewerZoomIn); eventBus.on('zoomout', webViewerZoomOut); eventBus.on('pagenumberchanged', webViewerPageNumberChanged); eventBus.on('scalechanged', webViewerScaleChanged); eventBus.on('rotatecw', webViewerRotateCw); eventBus.on('rotateccw', webViewerRotateCcw); eventBus.on('switchscrollmode', webViewerSwitchScrollMode); eventBus.on('scrollmodechanged', webViewerScrollModeChanged); eventBus.on('switchspreadmode', webViewerSwitchSpreadMode); eventBus.on('spreadmodechanged', webViewerSpreadModeChanged); eventBus.on('documentproperties', webViewerDocumentProperties); eventBus.on('find', webViewerFind); eventBus.on('findfromurlhash', webViewerFindFromUrlHash); eventBus.on('updatefindmatchescount', webViewerUpdateFindMatchesCount); eventBus.on('updatefindcontrolstate', webViewerUpdateFindControlState); eventBus.on('fileinputchange', webViewerFileInputChange); }, bindWindowEvents: function bindWindowEvents() { var eventBus = this.eventBus, _boundEvents = this._boundEvents; _boundEvents.windowResize = function () { eventBus.dispatch('resize', { source: window }); }; _boundEvents.windowHashChange = function () { eventBus.dispatch('hashchange', { source: window, hash: document.location.hash.substring(1) }); }; _boundEvents.windowBeforePrint = function () { eventBus.dispatch('beforeprint', { source: window }); }; _boundEvents.windowAfterPrint = function () { eventBus.dispatch('afterprint', { source: window }); }; window.addEventListener('visibilitychange', webViewerVisibilityChange); window.addEventListener('wheel', webViewerWheel); window.addEventListener('click', webViewerClick); window.addEventListener('keydown', webViewerKeyDown); window.addEventListener('resize', _boundEvents.windowResize); window.addEventListener('hashchange', _boundEvents.windowHashChange); window.addEventListener('beforeprint', _boundEvents.windowBeforePrint); window.addEventListener('afterprint', _boundEvents.windowAfterPrint); }, unbindEvents: function unbindEvents() { var eventBus = this.eventBus, _boundEvents = this._boundEvents; eventBus.off('resize', webViewerResize); eventBus.off('hashchange', webViewerHashchange); eventBus.off('beforeprint', _boundEvents.beforePrint); eventBus.off('afterprint', _boundEvents.afterPrint); eventBus.off('pagerendered', webViewerPageRendered); eventBus.off('textlayerrendered', webViewerTextLayerRendered); eventBus.off('updateviewarea', webViewerUpdateViewarea); eventBus.off('pagechanging', webViewerPageChanging); eventBus.off('scalechanging', webViewerScaleChanging); eventBus.off('rotationchanging', webViewerRotationChanging); eventBus.off('sidebarviewchanged', webViewerSidebarViewChanged); eventBus.off('pagemode', webViewerPageMode); eventBus.off('namedaction', webViewerNamedAction); eventBus.off('presentationmodechanged', webViewerPresentationModeChanged); eventBus.off('presentationmode', webViewerPresentationMode); eventBus.off('openfile', webViewerOpenFile); eventBus.off('print', webViewerPrint); eventBus.off('download', webViewerDownload); eventBus.off('firstpage', webViewerFirstPage); eventBus.off('lastpage', webViewerLastPage); eventBus.off('nextpage', webViewerNextPage); eventBus.off('previouspage', webViewerPreviousPage); eventBus.off('zoomin', webViewerZoomIn); eventBus.off('zoomout', webViewerZoomOut); eventBus.off('pagenumberchanged', webViewerPageNumberChanged); eventBus.off('scalechanged', webViewerScaleChanged); eventBus.off('rotatecw', webViewerRotateCw); eventBus.off('rotateccw', webViewerRotateCcw); eventBus.off('switchscrollmode', webViewerSwitchScrollMode); eventBus.off('scrollmodechanged', webViewerScrollModeChanged); eventBus.off('switchspreadmode', webViewerSwitchSpreadMode); eventBus.off('spreadmodechanged', webViewerSpreadModeChanged); eventBus.off('documentproperties', webViewerDocumentProperties); eventBus.off('find', webViewerFind); eventBus.off('findfromurlhash', webViewerFindFromUrlHash); eventBus.off('updatefindmatchescount', webViewerUpdateFindMatchesCount); eventBus.off('updatefindcontrolstate', webViewerUpdateFindControlState); eventBus.off('fileinputchange', webViewerFileInputChange); _boundEvents.beforePrint = null; _boundEvents.afterPrint = null; }, unbindWindowEvents: function unbindWindowEvents() { var _boundEvents = this._boundEvents; window.removeEventListener('visibilitychange', webViewerVisibilityChange); window.removeEventListener('wheel', webViewerWheel); window.removeEventListener('click', webViewerClick); window.removeEventListener('keydown', webViewerKeyDown); window.removeEventListener('resize', _boundEvents.windowResize); window.removeEventListener('hashchange', _boundEvents.windowHashChange); window.removeEventListener('beforeprint', _boundEvents.windowBeforePrint); window.removeEventListener('afterprint', _boundEvents.windowAfterPrint); _boundEvents.windowResize = null; _boundEvents.windowHashChange = null; _boundEvents.windowBeforePrint = null; _boundEvents.windowAfterPrint = null; } }; exports.PDFViewerApplication = PDFViewerApplication; var validateFileURL; { var HOSTED_VIEWER_ORIGINS = ['null', 'http://mozilla.github.io', 'https://mozilla.github.io']; validateFileURL = function validateFileURL(file) { if (file === undefined) { return; } try { var viewerOrigin = new _pdfjsLib.URL(window.location.href).origin || 'null'; if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) { return; } var _ref8 = new _pdfjsLib.URL(file, window.location.href), origin = _ref8.origin, protocol = _ref8.protocol; if (origin !== viewerOrigin && protocol !== 'blob:') { throw new Error('file origin does not match viewer\'s'); } } catch (ex) { var message = ex && ex.message; PDFViewerApplication.l10n.get('loading_error', null, 'An error occurred while loading the PDF.').then(function (loadingErrorMessage) { PDFViewerApplication.error(loadingErrorMessage, { message: message }); }); throw ex; } }; } function loadFakeWorker() { if (!_pdfjsLib.GlobalWorkerOptions.workerSrc) { _pdfjsLib.GlobalWorkerOptions.workerSrc = _app_options.AppOptions.get('workerSrc'); } return (0, _pdfjsLib.loadScript)(_pdfjsLib.PDFWorker.getWorkerSrc()); } function loadAndEnablePDFBug(enabledTabs) { var appConfig = PDFViewerApplication.appConfig; return (0, _pdfjsLib.loadScript)(appConfig.debuggerScriptPath).then(function () { PDFBug.enable(enabledTabs); PDFBug.init({ OPS: _pdfjsLib.OPS, createObjectURL: _pdfjsLib.createObjectURL }, appConfig.mainContainer); }); } function webViewerInitialized() { var appConfig = PDFViewerApplication.appConfig; var file; var queryString = document.location.search.substring(1); var params = (0, _ui_utils.parseQueryString)(queryString); file = 'file' in params ? params.file : _app_options.AppOptions.get('defaultUrl'); validateFileURL(file); var fileInput = document.createElement('input'); fileInput.id = appConfig.openFileInputName; fileInput.className = 'fileInput'; fileInput.setAttribute('type', 'file'); fileInput.oncontextmenu = _ui_utils.noContextMenuHandler; document.body.appendChild(fileInput); if (!window.File || !window.FileReader || !window.FileList || !window.Blob) { appConfig.toolbar.openFile.setAttribute('hidden', 'true'); appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true'); } else { fileInput.value = null; } fileInput.addEventListener('change', function (evt) { var files = evt.target.files; if (!files || files.length === 0) { return; } PDFViewerApplication.eventBus.dispatch('fileinputchange', { source: this, fileInput: evt.target }); }); appConfig.mainContainer.addEventListener('dragover', function (evt) { evt.preventDefault(); evt.dataTransfer.dropEffect = 'move'; }); appConfig.mainContainer.addEventListener('drop', function (evt) { evt.preventDefault(); var files = evt.dataTransfer.files; if (!files || files.length === 0) { return; } PDFViewerApplication.eventBus.dispatch('fileinputchange', { source: this, fileInput: evt.dataTransfer }); }); if (!PDFViewerApplication.supportsPrinting) { appConfig.toolbar.print.classList.add('hidden'); appConfig.secondaryToolbar.printButton.classList.add('hidden'); } if (!PDFViewerApplication.supportsFullscreen) { appConfig.toolbar.presentationModeButton.classList.add('hidden'); appConfig.secondaryToolbar.presentationModeButton.classList.add('hidden'); } if (PDFViewerApplication.supportsIntegratedFind) { appConfig.toolbar.viewFind.classList.add('hidden'); } appConfig.mainContainer.addEventListener('transitionend', function (evt) { if (evt.target === this) { PDFViewerApplication.eventBus.dispatch('resize', { source: this }); } }, true); appConfig.sidebar.toggleButton.addEventListener('click', function () { PDFViewerApplication.pdfSidebar.toggle(); }); try { webViewerOpenFileViaURL(file); } catch (reason) { PDFViewerApplication.l10n.get('loading_error', null, 'An error occurred while loading the PDF.').then(function (msg) { PDFViewerApplication.error(msg, reason); }); } } var webViewerOpenFileViaURL; { webViewerOpenFileViaURL = function webViewerOpenFileViaURL(file) { if (file && file.lastIndexOf('file:', 0) === 0) { PDFViewerApplication.setTitleUsingUrl(file); var xhr = new XMLHttpRequest(); xhr.onload = function () { PDFViewerApplication.open(new Uint8Array(xhr.response)); }; xhr.open('GET', file); xhr.responseType = 'arraybuffer'; xhr.send(); return; } if (file) { PDFViewerApplication.open(file); } }; } function webViewerPageRendered(evt) { var pageNumber = evt.pageNumber; var pageIndex = pageNumber - 1; var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex); if (pageNumber === PDFViewerApplication.page) { PDFViewerApplication.toolbar.updateLoadingIndicatorState(false); } if (!pageView) { return; } if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex); thumbnailView.setImage(pageView); } if (typeof Stats !== 'undefined' && Stats.enabled && pageView.stats) { Stats.add(pageNumber, pageView.stats); } if (pageView.error) { PDFViewerApplication.l10n.get('rendering_error', null, 'An error occurred while rendering the page.').then(function (msg) { PDFViewerApplication.error(msg, pageView.error); }); } } function webViewerTextLayerRendered(evt) {} function webViewerPageMode(evt) { var mode = evt.mode, view; switch (mode) { case 'thumbs': view = _pdf_sidebar.SidebarView.THUMBS; break; case 'bookmarks': case 'outline': view = _pdf_sidebar.SidebarView.OUTLINE; break; case 'attachments': view = _pdf_sidebar.SidebarView.ATTACHMENTS; break; case 'none': view = _pdf_sidebar.SidebarView.NONE; break; default: console.error('Invalid "pagemode" hash parameter: ' + mode); return; } PDFViewerApplication.pdfSidebar.switchView(view, true); } function webViewerNamedAction(evt) { var action = evt.action; switch (action) { case 'GoToPage': PDFViewerApplication.appConfig.toolbar.pageNumber.select(); break; case 'Find': if (!PDFViewerApplication.supportsIntegratedFind) { PDFViewerApplication.findBar.toggle(); } break; } } function webViewerPresentationModeChanged(evt) { var active = evt.active, switchInProgress = evt.switchInProgress; PDFViewerApplication.pdfViewer.presentationModeState = switchInProgress ? _ui_utils.PresentationModeState.CHANGING : active ? _ui_utils.PresentationModeState.FULLSCREEN : _ui_utils.PresentationModeState.NORMAL; } function webViewerSidebarViewChanged(evt) { PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled = PDFViewerApplication.pdfSidebar.isThumbnailViewVisible; var store = PDFViewerApplication.store; if (store && PDFViewerApplication.isInitialViewSet) { store.set('sidebarView', evt.view).catch(function () {}); } } function webViewerUpdateViewarea(evt) { var location = evt.location, store = PDFViewerApplication.store; if (store && PDFViewerApplication.isInitialViewSet) { store.setMultiple({ 'page': location.pageNumber, 'zoom': location.scale, 'scrollLeft': location.left, 'scrollTop': location.top, 'rotation': location.rotation }).catch(function () {}); } var href = PDFViewerApplication.pdfLinkService.getAnchorUrl(location.pdfOpenParams); PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href; PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href; var currentPage = PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page - 1); var loading = currentPage.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED; PDFViewerApplication.toolbar.updateLoadingIndicatorState(loading); } function webViewerScrollModeChanged(evt) { var store = PDFViewerApplication.store; if (store && PDFViewerApplication.isInitialViewSet) { store.set('scrollMode', evt.mode).catch(function () {}); } } function webViewerSpreadModeChanged(evt) { var store = PDFViewerApplication.store; if (store && PDFViewerApplication.isInitialViewSet) { store.set('spreadMode', evt.mode).catch(function () {}); } } function webViewerResize() { var pdfDocument = PDFViewerApplication.pdfDocument, pdfViewer = PDFViewerApplication.pdfViewer; if (!pdfDocument) { return; } var currentScaleValue = pdfViewer.currentScaleValue; if (currentScaleValue === 'auto' || currentScaleValue === 'page-fit' || currentScaleValue === 'page-width') { pdfViewer.currentScaleValue = currentScaleValue; } pdfViewer.update(); } function webViewerHashchange(evt) { var hash = evt.hash; if (!hash) { return; } if (!PDFViewerApplication.isInitialViewSet) { PDFViewerApplication.initialBookmark = hash; } else if (!PDFViewerApplication.pdfHistory.popStateInProgress) { PDFViewerApplication.pdfLinkService.setHash(hash); } } var webViewerFileInputChange; { webViewerFileInputChange = function webViewerFileInputChange(evt) { if (PDFViewerApplication.pdfViewer && PDFViewerApplication.pdfViewer.isInPresentationMode) { return; } var file = evt.fileInput.files[0]; if (_pdfjsLib.URL.createObjectURL && !_app_options.AppOptions.get('disableCreateObjectURL')) { var url = _pdfjsLib.URL.createObjectURL(file); if (file.name) { url = { url: url, originalUrl: file.name }; } PDFViewerApplication.open(url); } else { PDFViewerApplication.setTitleUsingUrl(file.name); var fileReader = new FileReader(); fileReader.onload = function webViewerChangeFileReaderOnload(evt) { var buffer = evt.target.result; PDFViewerApplication.open(new Uint8Array(buffer)); }; fileReader.readAsArrayBuffer(file); } var appConfig = PDFViewerApplication.appConfig; appConfig.toolbar.viewBookmark.setAttribute('hidden', 'true'); appConfig.secondaryToolbar.viewBookmarkButton.setAttribute('hidden', 'true'); appConfig.toolbar.download.setAttribute('hidden', 'true'); appConfig.secondaryToolbar.downloadButton.setAttribute('hidden', 'true'); }; } function webViewerPresentationMode() { PDFViewerApplication.requestPresentationMode(); } function webViewerOpenFile() { var openFileInputName = PDFViewerApplication.appConfig.openFileInputName; document.getElementById(openFileInputName).click(); } function webViewerPrint() { window.print(); } function webViewerDownload() { PDFViewerApplication.download(); } function webViewerFirstPage() { if (PDFViewerApplication.pdfDocument) { PDFViewerApplication.page = 1; } } function webViewerLastPage() { if (PDFViewerApplication.pdfDocument) { PDFViewerApplication.page = PDFViewerApplication.pagesCount; } } function webViewerNextPage() { PDFViewerApplication.page++; } function webViewerPreviousPage() { PDFViewerApplication.page--; } function webViewerZoomIn() { PDFViewerApplication.zoomIn(); } function webViewerZoomOut() { PDFViewerApplication.zoomOut(); } function webViewerPageNumberChanged(evt) { var pdfViewer = PDFViewerApplication.pdfViewer; if (evt.value !== '') { pdfViewer.currentPageLabel = evt.value; } if (evt.value !== pdfViewer.currentPageNumber.toString() && evt.value !== pdfViewer.currentPageLabel) { PDFViewerApplication.toolbar.setPageNumber(pdfViewer.currentPageNumber, pdfViewer.currentPageLabel); } } function webViewerScaleChanged(evt) { PDFViewerApplication.pdfViewer.currentScaleValue = evt.value; } function webViewerRotateCw() { PDFViewerApplication.rotatePages(90); } function webViewerRotateCcw() { PDFViewerApplication.rotatePages(-90); } function webViewerSwitchScrollMode(evt) { PDFViewerApplication.pdfViewer.scrollMode = evt.mode; } function webViewerSwitchSpreadMode(evt) { PDFViewerApplication.pdfViewer.spreadMode = evt.mode; } function webViewerDocumentProperties() { PDFViewerApplication.pdfDocumentProperties.open(); } function webViewerFind(evt) { PDFViewerApplication.findController.executeCommand('find' + evt.type, { query: evt.query, phraseSearch: evt.phraseSearch, caseSensitive: evt.caseSensitive, entireWord: evt.entireWord, highlightAll: evt.highlightAll, findPrevious: evt.findPrevious }); } function webViewerFindFromUrlHash(evt) { PDFViewerApplication.findController.executeCommand('find', { query: evt.query, phraseSearch: evt.phraseSearch, caseSensitive: false, entireWord: false, highlightAll: true, findPrevious: false }); } function webViewerUpdateFindMatchesCount(_ref9) { var matchesCount = _ref9.matchesCount; if (PDFViewerApplication.supportsIntegratedFind) { PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount); } else { PDFViewerApplication.findBar.updateResultsCount(matchesCount); } } function webViewerUpdateFindControlState(_ref10) { var state = _ref10.state, previous = _ref10.previous, matchesCount = _ref10.matchesCount; if (PDFViewerApplication.supportsIntegratedFind) { PDFViewerApplication.externalServices.updateFindControlState({ result: state, findPrevious: previous, matchesCount: matchesCount }); } else { PDFViewerApplication.findBar.updateUIState(state, previous, matchesCount); } } function webViewerScaleChanging(evt) { PDFViewerApplication.toolbar.setPageScale(evt.presetValue, evt.scale); PDFViewerApplication.pdfViewer.update(); } function webViewerRotationChanging(evt) { PDFViewerApplication.pdfThumbnailViewer.pagesRotation = evt.pagesRotation; PDFViewerApplication.forceRendering(); PDFViewerApplication.pdfViewer.currentPageNumber = evt.pageNumber; } function webViewerPageChanging(evt) { var page = evt.pageNumber; PDFViewerApplication.toolbar.setPageNumber(page, evt.pageLabel || null); PDFViewerApplication.secondaryToolbar.setPageNumber(page); if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page); } if (typeof Stats !== 'undefined' && Stats.enabled) { var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); if (pageView && pageView.stats) { Stats.add(page, pageView.stats); } } } function webViewerVisibilityChange(evt) { if (document.visibilityState === 'visible') { setZoomDisabledTimeout(); } } var zoomDisabledTimeout = null; function setZoomDisabledTimeout() { if (zoomDisabledTimeout) { clearTimeout(zoomDisabledTimeout); } zoomDisabledTimeout = setTimeout(function () { zoomDisabledTimeout = null; }, WHEEL_ZOOM_DISABLED_TIMEOUT); } function webViewerWheel(evt) { var pdfViewer = PDFViewerApplication.pdfViewer; if (pdfViewer.isInPresentationMode) { return; } if (evt.ctrlKey || evt.metaKey) { var support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys; if (evt.ctrlKey && !support.ctrlKey || evt.metaKey && !support.metaKey) { return; } evt.preventDefault(); if (zoomDisabledTimeout || document.visibilityState === 'hidden') { return; } var previousScale = pdfViewer.currentScale; var delta = (0, _ui_utils.normalizeWheelEventDelta)(evt); var MOUSE_WHEEL_DELTA_PER_PAGE_SCALE = 3.0; var ticks = delta * MOUSE_WHEEL_DELTA_PER_PAGE_SCALE; if (ticks < 0) { PDFViewerApplication.zoomOut(-ticks); } else { PDFViewerApplication.zoomIn(ticks); } var currentScale = pdfViewer.currentScale; if (previousScale !== currentScale) { var scaleCorrectionFactor = currentScale / previousScale - 1; var rect = pdfViewer.container.getBoundingClientRect(); var dx = evt.clientX - rect.left; var dy = evt.clientY - rect.top; pdfViewer.container.scrollLeft += dx * scaleCorrectionFactor; pdfViewer.container.scrollTop += dy * scaleCorrectionFactor; } } else { setZoomDisabledTimeout(); } } function webViewerClick(evt) { if (!PDFViewerApplication.secondaryToolbar.isOpen) { return; } var appConfig = PDFViewerApplication.appConfig; if (PDFViewerApplication.pdfViewer.containsElement(evt.target) || appConfig.toolbar.container.contains(evt.target) && evt.target !== appConfig.secondaryToolbar.toggleButton) { PDFViewerApplication.secondaryToolbar.close(); } } function webViewerKeyDown(evt) { if (PDFViewerApplication.overlayManager.active) { return; } var handled = false, ensureViewerFocused = false; var cmd = (evt.ctrlKey ? 1 : 0) | (evt.altKey ? 2 : 0) | (evt.shiftKey ? 4 : 0) | (evt.metaKey ? 8 : 0); var pdfViewer = PDFViewerApplication.pdfViewer; var isViewerInPresentationMode = pdfViewer && pdfViewer.isInPresentationMode; if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) { switch (evt.keyCode) { case 70: if (!PDFViewerApplication.supportsIntegratedFind) { PDFViewerApplication.findBar.open(); handled = true; } break; case 71: if (!PDFViewerApplication.supportsIntegratedFind) { var findState = PDFViewerApplication.findController.state; if (findState) { PDFViewerApplication.findController.executeCommand('findagain', { query: findState.query, phraseSearch: findState.phraseSearch, caseSensitive: findState.caseSensitive, entireWord: findState.entireWord, highlightAll: findState.highlightAll, findPrevious: cmd === 5 || cmd === 12 }); } handled = true; } break; case 61: case 107: case 187: case 171: if (!isViewerInPresentationMode) { PDFViewerApplication.zoomIn(); } handled = true; break; case 173: case 109: case 189: if (!isViewerInPresentationMode) { PDFViewerApplication.zoomOut(); } handled = true; break; case 48: case 96: if (!isViewerInPresentationMode) { setTimeout(function () { pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE; }); handled = false; } break; case 38: if (isViewerInPresentationMode || PDFViewerApplication.page > 1) { PDFViewerApplication.page = 1; handled = true; ensureViewerFocused = true; } break; case 40: if (isViewerInPresentationMode || PDFViewerApplication.page < PDFViewerApplication.pagesCount) { PDFViewerApplication.page = PDFViewerApplication.pagesCount; handled = true; ensureViewerFocused = true; } break; } } if (cmd === 1 || cmd === 8) { switch (evt.keyCode) { case 83: PDFViewerApplication.download(); handled = true; break; } } if (cmd === 3 || cmd === 10) { switch (evt.keyCode) { case 80: PDFViewerApplication.requestPresentationMode(); handled = true; break; case 71: PDFViewerApplication.appConfig.toolbar.pageNumber.select(); handled = true; break; } } if (handled) { if (ensureViewerFocused && !isViewerInPresentationMode) { pdfViewer.focus(); } evt.preventDefault(); return; } var curElement = document.activeElement || document.querySelector(':focus'); var curElementTagName = curElement && curElement.tagName.toUpperCase(); if (curElementTagName === 'INPUT' || curElementTagName === 'TEXTAREA' || curElementTagName === 'SELECT') { if (evt.keyCode !== 27) { return; } } if (cmd === 0) { var turnPage = 0, turnOnlyIfPageFit = false; switch (evt.keyCode) { case 38: case 33: if (pdfViewer.isVerticalScrollbarEnabled) { turnOnlyIfPageFit = true; } turnPage = -1; break; case 8: if (!isViewerInPresentationMode) { turnOnlyIfPageFit = true; } turnPage = -1; break; case 37: if (pdfViewer.isHorizontalScrollbarEnabled) { turnOnlyIfPageFit = true; } case 75: case 80: turnPage = -1; break; case 27: if (PDFViewerApplication.secondaryToolbar.isOpen) { PDFViewerApplication.secondaryToolbar.close(); handled = true; } if (!PDFViewerApplication.supportsIntegratedFind && PDFViewerApplication.findBar.opened) { PDFViewerApplication.findBar.close(); handled = true; } break; case 40: case 34: if (pdfViewer.isVerticalScrollbarEnabled) { turnOnlyIfPageFit = true; } turnPage = 1; break; case 13: case 32: if (!isViewerInPresentationMode) { turnOnlyIfPageFit = true; } turnPage = 1; break; case 39: if (pdfViewer.isHorizontalScrollbarEnabled) { turnOnlyIfPageFit = true; } case 74: case 78: turnPage = 1; break; case 36: if (isViewerInPresentationMode || PDFViewerApplication.page > 1) { PDFViewerApplication.page = 1; handled = true; ensureViewerFocused = true; } break; case 35: if (isViewerInPresentationMode || PDFViewerApplication.page < PDFViewerApplication.pagesCount) { PDFViewerApplication.page = PDFViewerApplication.pagesCount; handled = true; ensureViewerFocused = true; } break; case 83: PDFViewerApplication.pdfCursorTools.switchTool(_pdf_cursor_tools.CursorTool.SELECT); break; case 72: PDFViewerApplication.pdfCursorTools.switchTool(_pdf_cursor_tools.CursorTool.HAND); break; case 82: PDFViewerApplication.rotatePages(90); break; case 115: PDFViewerApplication.pdfSidebar.toggle(); break; } if (turnPage !== 0 && (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === 'page-fit')) { if (turnPage > 0) { if (PDFViewerApplication.page < PDFViewerApplication.pagesCount) { PDFViewerApplication.page++; } } else { if (PDFViewerApplication.page > 1) { PDFViewerApplication.page--; } } handled = true; } } if (cmd === 4) { switch (evt.keyCode) { case 13: case 32: if (!isViewerInPresentationMode && pdfViewer.currentScaleValue !== 'page-fit') { break; } if (PDFViewerApplication.page > 1) { PDFViewerApplication.page--; } handled = true; break; case 82: PDFViewerApplication.rotatePages(-90); break; } } if (!handled && !isViewerInPresentationMode) { if (evt.keyCode >= 33 && evt.keyCode <= 40 || evt.keyCode === 32 && curElementTagName !== 'BUTTON') { ensureViewerFocused = true; } } if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) { pdfViewer.focus(); } if (handled) { evt.preventDefault(); } } function apiPageModeToSidebarView(mode) { switch (mode) { case 'UseNone': return _pdf_sidebar.SidebarView.NONE; case 'UseThumbs': return _pdf_sidebar.SidebarView.THUMBS; case 'UseOutlines': return _pdf_sidebar.SidebarView.OUTLINE; case 'UseAttachments': return _pdf_sidebar.SidebarView.ATTACHMENTS; case 'UseOC': } return _pdf_sidebar.SidebarView.NONE; } var PDFPrintServiceFactory = { instance: { supportsPrinting: false, createPrintService: function createPrintService() { throw new Error('Not implemented: createPrintService'); } } }; exports.PDFPrintServiceFactory = PDFPrintServiceFactory; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = __webpack_require__(3); /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } var g = function () { return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; }() || Function("return this")(); var hadRuntime = g.regeneratorRuntime && Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0; var oldRuntime = hadRuntime && g.regeneratorRuntime; g.regeneratorRuntime = undefined; module.exports = __webpack_require__(4); if (hadRuntime) { g.regeneratorRuntime = oldRuntime; } else { try { delete g.regeneratorRuntime; } catch (e) { g.regeneratorRuntime = undefined; } } /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) { function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } !function (global) { "use strict"; var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var undefined; var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; var inModule = ( false ? undefined : _typeof(module)) === "object"; var runtime = global.regeneratorRuntime; if (runtime) { if (inModule) { module.exports = runtime; } return; } runtime = global.regeneratorRuntime = inModule ? module.exports : {}; function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; } runtime.wrap = wrap; function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; IteratorPrototype[iteratorSymbol] = function () { return this; }; var getProto = Object.getPrototypeOf; var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { IteratorPrototype = NativeIteratorPrototype; } var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; GeneratorFunctionPrototype.constructor = GeneratorFunction; GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { prototype[method] = function (arg) { return this._invoke(method, arg); }; }); } runtime.isGeneratorFunction = function (genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; runtime.mark = function (genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; if (!(toStringTagSymbol in genFun)) { genFun[toStringTagSymbol] = "GeneratorFunction"; } } genFun.prototype = Object.create(Gp); return genFun; }; runtime.awrap = function (arg) { return { __await: arg }; }; function AsyncIterator(generator) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) { return Promise.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }); } return Promise.resolve(value).then(function (unwrapped) { result.value = unwrapped; resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } } var previousPromise; function enqueue(method, arg) { function callInvokeWithMethodAndArg() { return new Promise(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } this._invoke = enqueue; } defineIteratorMethods(AsyncIterator.prototype); AsyncIterator.prototype[asyncIteratorSymbol] = function () { return this; }; runtime.AsyncIterator = AsyncIterator; runtime.async = function (innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList)); return runtime.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method === "throw") { throw arg; } return doneResult(); } context.method = method; context.arg = arg; while (true) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (context.method === "next") { context.sent = context._sent = context.arg; } else if (context.method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw context.arg; } context.dispatchException(context.arg); } else if (context.method === "return") { context.abrupt("return", context.arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self, context); if (record.type === "normal") { state = context.done ? GenStateCompleted : GenStateSuspendedYield; if (record.arg === ContinueSentinel) { continue; } return { value: record.arg, done: context.done }; } else if (record.type === "throw") { state = GenStateCompleted; context.method = "throw"; context.arg = record.arg; } } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (method === undefined) { context.delegate = null; if (context.method === "throw") { if (delegate.iterator.return) { context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); if (context.method === "throw") { return ContinueSentinel; } } context.method = "throw"; context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (record.type === "throw") { context.method = "throw"; context.arg = record.arg; context.delegate = null; return ContinueSentinel; } var info = record.arg; if (!info) { context.method = "throw"; context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; } if (info.done) { context[delegate.resultName] = info.value; context.next = delegate.nextLoc; if (context.method !== "return") { context.method = "next"; context.arg = undefined; } } else { return info; } context.delegate = null; return ContinueSentinel; } defineIteratorMethods(Gp); Gp[toStringTagSymbol] = "Generator"; Gp[iteratorSymbol] = function () { return this; }; Gp.toString = function () { return "[object Generator]"; }; function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } runtime.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } keys.reverse(); return function next() { while (keys.length) { var key = keys.pop(); if (key in object) { next.value = key; next.done = false; return next; } } next.done = true; return next; }; }; function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i = -1, next = function next() { while (++i < iterable.length) { if (hasOwn.call(iterable, i)) { next.value = iterable[i]; next.done = false; return next; } } next.value = undefined; next.done = true; return next; }; return next.next = next; } } return { next: doneResult }; } runtime.values = values; function doneResult() { return { value: undefined, done: true }; } Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { this.prev = 0; this.next = 0; this.sent = this._sent = undefined; this.done = false; this.delegate = null; this.method = "next"; this.arg = undefined; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined; } } } }, stop: function stop() { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; if (rootRecord.type === "throw") { throw rootRecord.arg; } return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) { throw exception; } var context = this; function handle(loc, caught) { record.type = "throw"; record.arg = exception; context.next = loc; if (caught) { context.method = "next"; context.arg = undefined; } return !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; if (entry.tryLoc === "root") { return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } return this.complete(record); }, complete: function complete(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = this.arg = record.arg; this.method = "return"; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } return ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }; if (this.method === "next") { this.arg = undefined; } return ContinueSentinel; } }; }(function () { return this || (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" && self; }() || Function("return this")()); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5)(module))) /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = function (module) { if (!module.webpackPolyfill) { module.deprecate = function () {}; module.paths = []; if (!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function get() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function get() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isValidRotation = isValidRotation; exports.isValidScrollMode = isValidScrollMode; exports.isValidSpreadMode = isValidSpreadMode; exports.isPortraitOrientation = isPortraitOrientation; exports.getGlobalEventBus = getGlobalEventBus; exports.getPDFFileNameFromURL = getPDFFileNameFromURL; exports.noContextMenuHandler = noContextMenuHandler; exports.parseQueryString = parseQueryString; exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements; exports.getVisibleElements = getVisibleElements; exports.roundToDivide = roundToDivide; exports.getPageSizeInches = getPageSizeInches; exports.approximateFraction = approximateFraction; exports.getOutputScale = getOutputScale; exports.scrollIntoView = scrollIntoView; exports.watchScroll = watchScroll; exports.binarySearchFirstItem = binarySearchFirstItem; exports.normalizeWheelEventDelta = normalizeWheelEventDelta; exports.waitOnEventOrTimeout = waitOnEventOrTimeout; exports.moveToEndOfArray = moveToEndOfArray; exports.WaitOnType = exports.animationStarted = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.SpreadMode = exports.ScrollMode = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = void 0; var _regenerator = _interopRequireDefault(__webpack_require__(2)); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } var CSS_UNITS = 96.0 / 72.0; exports.CSS_UNITS = CSS_UNITS; var DEFAULT_SCALE_VALUE = 'auto'; exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE; var DEFAULT_SCALE = 1.0; exports.DEFAULT_SCALE = DEFAULT_SCALE; var MIN_SCALE = 0.10; exports.MIN_SCALE = MIN_SCALE; var MAX_SCALE = 10.0; exports.MAX_SCALE = MAX_SCALE; var UNKNOWN_SCALE = 0; exports.UNKNOWN_SCALE = UNKNOWN_SCALE; var MAX_AUTO_SCALE = 1.25; exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE; var SCROLLBAR_PADDING = 40; exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING; var VERTICAL_PADDING = 5; exports.VERTICAL_PADDING = VERTICAL_PADDING; var PresentationModeState = { UNKNOWN: 0, NORMAL: 1, CHANGING: 2, FULLSCREEN: 3 }; exports.PresentationModeState = PresentationModeState; var RendererType = { CANVAS: 'canvas', SVG: 'svg' }; exports.RendererType = RendererType; var TextLayerMode = { DISABLE: 0, ENABLE: 1, ENABLE_ENHANCE: 2 }; exports.TextLayerMode = TextLayerMode; var ScrollMode = { UNKNOWN: -1, VERTICAL: 0, HORIZONTAL: 1, WRAPPED: 2 }; exports.ScrollMode = ScrollMode; var SpreadMode = { UNKNOWN: -1, NONE: 0, ODD: 1, EVEN: 2 }; exports.SpreadMode = SpreadMode; function formatL10nValue(text, args) { if (!args) { return text; } return text.replace(/\{\{\s*(\w+)\s*\}\}/g, function (all, name) { return name in args ? args[name] : '{{' + name + '}}'; }); } var NullL10n = { getLanguage: function () { var _getLanguage = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee() { return _regenerator.default.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: return _context.abrupt("return", 'en-us'); case 1: case "end": return _context.stop(); } } }, _callee, this); })); function getLanguage() { return _getLanguage.apply(this, arguments); } return getLanguage; }(), getDirection: function () { var _getDirection = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee2() { return _regenerator.default.wrap(function _callee2$(_context2) { while (1) { switch (_context2.prev = _context2.next) { case 0: return _context2.abrupt("return", 'ltr'); case 1: case "end": return _context2.stop(); } } }, _callee2, this); })); function getDirection() { return _getDirection.apply(this, arguments); } return getDirection; }(), get: function () { var _get = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee3(property, args, fallback) { return _regenerator.default.wrap(function _callee3$(_context3) { while (1) { switch (_context3.prev = _context3.next) { case 0: return _context3.abrupt("return", formatL10nValue(fallback, args)); case 1: case "end": return _context3.stop(); } } }, _callee3, this); })); function get(_x, _x2, _x3) { return _get.apply(this, arguments); } return get; }(), translate: function () { var _translate = _asyncToGenerator( /*#__PURE__*/ _regenerator.default.mark(function _callee4(element) { return _regenerator.default.wrap(function _callee4$(_context4) { while (1) { switch (_context4.prev = _context4.next) { case 0: case "end": return _context4.stop(); } } }, _callee4, this); })); function translate(_x4) { return _translate.apply(this, arguments); } return translate; }() }; exports.NullL10n = NullL10n; function getOutputScale(ctx) { var devicePixelRatio = window.devicePixelRatio || 1; var backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1; var pixelRatio = devicePixelRatio / backingStoreRatio; return { sx: pixelRatio, sy: pixelRatio, scaled: pixelRatio !== 1 }; } function scrollIntoView(element, spot) { var skipOverflowHiddenElements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var parent = element.offsetParent; if (!parent) { console.error('offsetParent is not set -- cannot scroll'); return; } var offsetY = element.offsetTop + element.clientTop; var offsetX = element.offsetLeft + element.clientLeft; while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || skipOverflowHiddenElements && getComputedStyle(parent).overflow === 'hidden') { if (parent.dataset._scaleY) { offsetY /= parent.dataset._scaleY; offsetX /= parent.dataset._scaleX; } offsetY += parent.offsetTop; offsetX += parent.offsetLeft; parent = parent.offsetParent; if (!parent) { return; } } if (spot) { if (spot.top !== undefined) { offsetY += spot.top; } if (spot.left !== undefined) { offsetX += spot.left; parent.scrollLeft = offsetX; } } parent.scrollTop = offsetY; } function watchScroll(viewAreaElement, callback) { var debounceScroll = function debounceScroll(evt) { if (rAF) { return; } rAF = window.requestAnimationFrame(function viewAreaElementScrolled() { rAF = null; var currentX = viewAreaElement.scrollLeft; var lastX = state.lastX; if (currentX !== lastX) { state.right = currentX > lastX; } state.lastX = currentX; var currentY = viewAreaElement.scrollTop; var lastY = state.lastY; if (currentY !== lastY) { state.down = currentY > lastY; } state.lastY = currentY; callback(state); }); }; var state = { right: true, down: true, lastX: viewAreaElement.scrollLeft, lastY: viewAreaElement.scrollTop, _eventHandler: debounceScroll }; var rAF = null; viewAreaElement.addEventListener('scroll', debounceScroll, true); return state; } function parseQueryString(query) { var parts = query.split('&'); var params = Object.create(null); for (var i = 0, ii = parts.length; i < ii; ++i) { var param = parts[i].split('='); var key = param[0].toLowerCase(); var value = param.length > 1 ? param[1] : null; params[decodeURIComponent(key)] = decodeURIComponent(value); } return params; } function binarySearchFirstItem(items, condition) { var minIndex = 0; var maxIndex = items.length - 1; if (items.length === 0 || !condition(items[maxIndex])) { return items.length; } if (condition(items[minIndex])) { return minIndex; } while (minIndex < maxIndex) { var currentIndex = minIndex + maxIndex >> 1; var currentItem = items[currentIndex]; if (condition(currentItem)) { maxIndex = currentIndex; } else { minIndex = currentIndex + 1; } } return minIndex; } function approximateFraction(x) { if (Math.floor(x) === x) { return [x, 1]; } var xinv = 1 / x; var limit = 8; if (xinv > limit) { return [1, limit]; } else if (Math.floor(xinv) === xinv) { return [1, xinv]; } var x_ = x > 1 ? xinv : x; var a = 0, b = 1, c = 1, d = 1; while (true) { var p = a + c, q = b + d; if (q > limit) { break; } if (x_ <= p / q) { c = p; d = q; } else { a = p; b = q; } } var result; if (x_ - a / b < c / d - x_) { result = x_ === x ? [a, b] : [b, a]; } else { result = x_ === x ? [c, d] : [d, c]; } return result; } function roundToDivide(x, div) { var r = x % div; return r === 0 ? x : Math.round(x - r + div); } function getPageSizeInches(_ref) { var view = _ref.view, userUnit = _ref.userUnit, rotate = _ref.rotate; var _view = _slicedToArray(view, 4), x1 = _view[0], y1 = _view[1], x2 = _view[2], y2 = _view[3]; var changeOrientation = rotate % 180 !== 0; var width = (x2 - x1) / 72 * userUnit; var height = (y2 - y1) / 72 * userUnit; return { width: changeOrientation ? height : width, height: changeOrientation ? width : height }; } function backtrackBeforeAllVisibleElements(index, views, top) { if (index < 2) { return index; } var elt = views[index].div; var pageTop = elt.offsetTop + elt.clientTop; if (pageTop >= top) { elt = views[index - 1].div; pageTop = elt.offsetTop + elt.clientTop; } for (var i = index - 2; i >= 0; --i) { elt = views[i].div; if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) { break; } index = i; } return index; } function getVisibleElements(scrollEl, views) { var sortByVisibility = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var horizontal = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; var top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight; var left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth; function isElementBottomAfterViewTop(view) { var element = view.div; var elementBottom = element.offsetTop + element.clientTop + element.clientHeight; return elementBottom > top; } function isElementRightAfterViewLeft(view) { var element = view.div; var elementRight = element.offsetLeft + element.clientLeft + element.clientWidth; return elementRight > left; } var visible = [], numViews = views.length; var firstVisibleElementInd = numViews === 0 ? 0 : binarySearchFirstItem(views, horizontal ? isElementRightAfterViewLeft : isElementBottomAfterViewTop); if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) { firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top); } var lastEdge = horizontal ? right : -1; for (var i = firstVisibleElementInd; i < numViews; i++) { var view = views[i], element = view.div; var currentWidth = element.offsetLeft + element.clientLeft; var currentHeight = element.offsetTop + element.clientTop; var viewWidth = element.clientWidth, viewHeight = element.clientHeight; var viewRight = currentWidth + viewWidth; var viewBottom = currentHeight + viewHeight; if (lastEdge === -1) { if (viewBottom >= bottom) { lastEdge = viewBottom; } } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) { break; } if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) { continue; } var hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom); var hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right); var percent = (viewHeight - hiddenHeight) * (viewWidth - hiddenWidth) * 100 / viewHeight / viewWidth | 0; visible.push({ id: view.id, x: currentWidth, y: currentHeight, view: view, percent: percent }); } var first = visible[0], last = visible[visible.length - 1]; if (sortByVisibility) { visible.sort(function (a, b) { var pc = a.percent - b.percent; if (Math.abs(pc) > 0.001) { return -pc; } return a.id - b.id; }); } return { first: first, last: last, views: visible }; } function noContextMenuHandler(evt) { evt.preventDefault(); } function isDataSchema(url) { var i = 0, ii = url.length; while (i < ii && url[i].trim() === '') { i++; } return url.substring(i, i + 5).toLowerCase() === 'data:'; } function getPDFFileNameFromURL(url) { var defaultFilename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'document.pdf'; if (typeof url !== 'string') { return defaultFilename; } if (isDataSchema(url)) { console.warn('getPDFFileNameFromURL: ' + 'ignoring "data:" URL for performance reasons.'); return defaultFilename; } var reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/; var reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i; var splitURI = reURI.exec(url); var suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]); if (suggestedFilename) { suggestedFilename = suggestedFilename[0]; if (suggestedFilename.includes('%')) { try { suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0]; } catch (ex) {} } } return suggestedFilename || defaultFilename; } function normalizeWheelEventDelta(evt) { var delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY); var angle = Math.atan2(evt.deltaY, evt.deltaX); if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) { delta = -delta; } var MOUSE_DOM_DELTA_PIXEL_MODE = 0; var MOUSE_DOM_DELTA_LINE_MODE = 1; var MOUSE_PIXELS_PER_LINE = 30; var MOUSE_LINES_PER_PAGE = 30; if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) { delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE; } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) { delta /= MOUSE_LINES_PER_PAGE; } return delta; } function isValidRotation(angle) { return Number.isInteger(angle) && angle % 90 === 0; } function isValidScrollMode(mode) { return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN; } function isValidSpreadMode(mode) { return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN; } function isPortraitOrientation(size) { return size.width <= size.height; } var WaitOnType = { EVENT: 'event', TIMEOUT: 'timeout' }; exports.WaitOnType = WaitOnType; function waitOnEventOrTimeout(_ref2) { var target = _ref2.target, name = _ref2.name, _ref2$delay = _ref2.delay, delay = _ref2$delay === void 0 ? 0 : _ref2$delay; return new Promise(function (resolve, reject) { if (_typeof(target) !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) { throw new Error('waitOnEventOrTimeout - invalid parameters.'); } function handler(type) { if (target instanceof EventBus) { target.off(name, eventHandler); } else { target.removeEventListener(name, eventHandler); } if (timeout) { clearTimeout(timeout); } resolve(type); } var eventHandler = handler.bind(null, WaitOnType.EVENT); if (target instanceof EventBus) { target.on(name, eventHandler); } else { target.addEventListener(name, eventHandler); } var timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT); var timeout = setTimeout(timeoutHandler, delay); }); } var animationStarted = new Promise(function (resolve) { window.requestAnimationFrame(resolve); }); exports.animationStarted = animationStarted; var EventBus = /*#__PURE__*/ function () { function EventBus() { var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref3$dispatchToDOM = _ref3.dispatchToDOM, dispatchToDOM = _ref3$dispatchToDOM === void 0 ? false : _ref3$dispatchToDOM; _classCallCheck(this, EventBus); this._listeners = Object.create(null); this._dispatchToDOM = dispatchToDOM === true; } _createClass(EventBus, [{ key: "on", value: function on(eventName, listener) { var eventListeners = this._listeners[eventName]; if (!eventListeners) { eventListeners = []; this._listeners[eventName] = eventListeners; } eventListeners.push(listener); } }, { key: "off", value: function off(eventName, listener) { var eventListeners = this._listeners[eventName]; var i; if (!eventListeners || (i = eventListeners.indexOf(listener)) < 0) { return; } eventListeners.splice(i, 1); } }, { key: "dispatch", value: function dispatch(eventName) { var eventListeners = this._listeners[eventName]; if (!eventListeners || eventListeners.length === 0) { if (this._dispatchToDOM) { var _args5 = Array.prototype.slice.call(arguments, 1); this._dispatchDOMEvent(eventName, _args5); } return; } var args = Array.prototype.slice.call(arguments, 1); eventListeners.slice(0).forEach(function (listener) { listener.apply(null, args); }); if (this._dispatchToDOM) { this._dispatchDOMEvent(eventName, args); } } }, { key: "_dispatchDOMEvent", value: function _dispatchDOMEvent(eventName) { var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var details = Object.create(null); if (args && args.length > 0) { var obj = args[0]; for (var key in obj) { var value = obj[key]; if (key === 'source') { if (value === window || value === document) { return; } continue; } details[key] = value; } } var event = document.createEvent('CustomEvent'); event.initCustomEvent(eventName, true, true, details); document.dispatchEvent(event); } }]); return EventBus; }(); exports.EventBus = EventBus; var globalEventBus = null; function getGlobalEventBus() { var dispatchToDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (!globalEventBus) { globalEventBus = new EventBus({ dispatchToDOM: dispatchToDOM }); } return globalEventBus; } function clamp(v, min, max) { return Math.min(Math.max(v, min), max); } var ProgressBar = /*#__PURE__*/ function () { function ProgressBar(id) { var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, height = _ref4.height, width = _ref4.width, units = _ref4.units; _classCallCheck(this, ProgressBar); this.visible = true; this.div = document.querySelector(id + ' .progress'); this.bar = this.div.parentNode; this.height = height || 100; this.width = width || 100; this.units = units || '%'; this.div.style.height = this.height + this.units; this.percent = 0; } _createClass(ProgressBar, [{ key: "_updateBar", value: function _updateBar() { if (this._indeterminate) { this.div.classList.add('indeterminate'); this.div.style.width = this.width + this.units; return; } this.div.classList.remove('indeterminate'); var progressSize = this.width * this._percent / 100; this.div.style.width = progressSize + this.units; } }, { key: "setWidth", value: function setWidth(viewer) { if (!viewer) { return; } var container = viewer.parentNode; var scrollbarWidth = container.offsetWidth - viewer.offsetWidth; if (scrollbarWidth > 0) { this.bar.setAttribute('style', 'width: calc(100% - ' + scrollbarWidth + 'px);'); } } }, { key: "hide", value: function hide() { if (!this.visible) { return; } this.visible = false; this.bar.classList.add('hidden'); document.body.classList.remove('loadingInProgress'); } }, { key: "show", value: function show() { if (this.visible) { return; } this.visible = true; document.body.classList.add('loadingInProgress'); this.bar.classList.remove('hidden'); } }, { key: "percent", get: function get() { return this._percent; }, set: function set(val) { this._indeterminate = isNaN(val); this._percent = clamp(val, 0, 100); this._updateBar(); } }]); return ProgressBar; }(); exports.ProgressBar = ProgressBar; function moveToEndOfArray(arr, condition) { var moved = [], len = arr.length; var write = 0; for (var read = 0; read < len; ++read) { if (condition(arr[read])) { moved.push(arr[read]); } else { arr[write] = arr[read]; ++write; } } for (var _read = 0; write < len; ++_read, ++write) { arr[write] = moved[_read]; } } /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var pdfjsLib; if (typeof window !== 'undefined' && window['pdfjs-dist/build/pdf']) { pdfjsLib = window['pdfjs-dist/build/pdf']; } else { pdfjsLib = require('../build/pdf.js'); } module.exports = pdfjsLib; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDFCursorTools = exports.CursorTool = void 0; var _grab_to_pan = __webpack_require__(9); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var CursorTool = { SELECT: 0, HAND: 1, ZOOM: 2 }; exports.CursorTool = CursorTool; var PDFCursorTools = /*#__PURE__*/ function () { function PDFCursorTools(_ref) { var _this = this; var container = _ref.container, eventBus = _ref.eventBus, _ref$cursorToolOnLoad = _ref.cursorToolOnLoad, cursorToolOnLoad = _ref$cursorToolOnLoad === void 0 ? CursorTool.SELECT : _ref$cursorToolOnLoad; _classCallCheck(this, PDFCursorTools); this.container = container; this.eventBus = eventBus; this.active = CursorTool.SELECT; this.activeBeforePresentationMode = null; this.handTool = new _grab_to_pan.GrabToPan({ element: this.container }); this._addEventListeners(); Promise.resolve().then(function () { _this.switchTool(cursorToolOnLoad); }); } _createClass(PDFCursorTools, [{ key: "switchTool", value: function switchTool(tool) { var _this2 = this; if (this.activeBeforePresentationMode !== null) { return; } if (tool === this.active) { return; } var disableActiveTool = function disableActiveTool() { switch (_this2.active) { case CursorTool.SELECT: break; case CursorTool.HAND: _this2.handTool.deactivate(); break; case CursorTool.ZOOM: } }; switch (tool) { case CursorTool.SELECT: disableActiveTool(); break; case CursorTool.HAND: disableActiveTool(); this.handTool.activate(); break; case CursorTool.ZOOM: default: console.error("switchTool: \"".concat(tool, "\" is an unsupported value.")); return; } this.active = tool; this._dispatchEvent(); } }, { key: "_dispatchEvent", value: function _dispatchEvent() { this.eventBus.dispatch('cursortoolchanged', { source: this, tool: this.active }); } }, { key: "_addEventListeners", value: function _addEventListeners() { var _this3 = this; this.eventBus.on('switchcursortool', function (evt) { _this3.switchTool(evt.tool); }); this.eventBus.on('presentationmodechanged', function (evt) { if (evt.switchInProgress) { return; } var previouslyActive; if (evt.active) { previouslyActive = _this3.active; _this3.switchTool(CursorTool.SELECT); _this3.activeBeforePresentationMode = previouslyActive; } else { previouslyActive = _this3.activeBeforePresentationMode; _this3.activeBeforePresentationMode = null; _this3.switchTool(previouslyActive); } }); } }, { key: "activeTool", get: function get() { return this.active; } }]); return PDFCursorTools; }(); exports.PDFCursorTools = PDFCursorTools; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GrabToPan = GrabToPan; function GrabToPan(options) { this.element = options.element; this.document = options.element.ownerDocument; if (typeof options.ignoreTarget === 'function') { this.ignoreTarget = options.ignoreTarget; } this.onActiveChanged = options.onActiveChanged; this.activate = this.activate.bind(this); this.deactivate = this.deactivate.bind(this); this.toggle = this.toggle.bind(this); this._onmousedown = this._onmousedown.bind(this); this._onmousemove = this._onmousemove.bind(this); this._endPan = this._endPan.bind(this); var overlay = this.overlay = document.createElement('div'); overlay.className = 'grab-to-pan-grabbing'; } GrabToPan.prototype = { CSS_CLASS_GRAB: 'grab-to-pan-grab', activate: function GrabToPan_activate() { if (!this.active) { this.active = true; this.element.addEventListener('mousedown', this._onmousedown, true); this.element.classList.add(this.CSS_CLASS_GRAB); if (this.onActiveChanged) { this.onActiveChanged(true); } } }, deactivate: function GrabToPan_deactivate() { if (this.active) { this.active = false; this.element.removeEventListener('mousedown', this._onmousedown, true); this._endPan(); this.element.classList.remove(this.CSS_CLASS_GRAB); if (this.onActiveChanged) { this.onActiveChanged(false); } } }, toggle: function GrabToPan_toggle() { if (this.active) { this.deactivate(); } else { this.activate(); } }, ignoreTarget: function GrabToPan_ignoreTarget(node) { return node[matchesSelector]('a[href], a[href] *, input, textarea, button, button *, select, option'); }, _onmousedown: function GrabToPan__onmousedown(event) { if (event.button !== 0 || this.ignoreTarget(event.target)) { return; } if (event.originalTarget) { try { event.originalTarget.tagName; } catch (e) { return; } } this.scrollLeftStart = this.element.scrollLeft; this.scrollTopStart = this.element.scrollTop; this.clientXStart = event.clientX; this.clientYStart = event.clientY; this.document.addEventListener('mousemove', this._onmousemove, true); this.document.addEventListener('mouseup', this._endPan, true); this.element.addEventListener('scroll', this._endPan, true); event.preventDefault(); event.stopPropagation(); var focusedElement = document.activeElement; if (focusedElement && !focusedElement.contains(event.target)) { focusedElement.blur(); } }, _onmousemove: function GrabToPan__onmousemove(event) { this.element.removeEventListener('scroll', this._endPan, true); if (isLeftMouseReleased(event)) { this._endPan(); return; } var xDiff = event.clientX - this.clientXStart; var yDiff = event.clientY - this.clientYStart; var scrollTop = this.scrollTopStart - yDiff; var scrollLeft = this.scrollLeftStart - xDiff; if (this.element.scrollTo) { this.element.scrollTo({ top: scrollTop, left: scrollLeft, behavior: 'instant' }); } else { this.element.scrollTop = scrollTop; this.element.scrollLeft = scrollLeft; } if (!this.overlay.parentNode) { document.body.appendChild(this.overlay); } }, _endPan: function GrabToPan__endPan() { this.element.removeEventListener('scroll', this._endPan, true); this.document.removeEventListener('mousemove', this._onmousemove, true); this.document.removeEventListener('mouseup', this._endPan, true); this.overlay.remove(); } }; var matchesSelector; ['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function (prefix) { var name = prefix + 'atches'; if (name in document.documentElement) { matchesSelector = name; } name += 'Selector'; if (name in document.documentElement) { matchesSelector = name; } return matchesSelector; }); var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9; var chrome = window.chrome; var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app); var isSafari6plus = /Apple/.test(navigator.vendor) && /Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent); function isLeftMouseReleased(event) { if ('buttons' in event && isNotIEorIsIE10plus) { return !(event.buttons & 1); } if (isChrome15OrOpera15plus || isSafari6plus) { return event.which === 0; } } /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDFRenderingQueue = exports.RenderingStates = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var CLEANUP_TIMEOUT = 30000; var RenderingStates = { INITIAL: 0, RUNNING: 1, PAUSED: 2, FINISHED: 3 }; exports.RenderingStates = RenderingStates; var PDFRenderingQueue = /*#__PURE__*/ function () { function PDFRenderingQueue() { _classCallCheck(this, PDFRenderingQueue); this.pdfViewer = null; this.pdfThumbnailViewer = null; this.onIdle = null; this.highestPriorityPage = null; this.idleTimeout = null; this.printing = false; this.isThumbnailViewEnabled = false; } _createClass(PDFRenderingQueue, [{ key: "setViewer", value: function setViewer(pdfViewer) { this.pdfViewer = pdfViewer; } }, { key: "setThumbnailViewer", value: function setThumbnailViewer(pdfThumbnailViewer) { this.pdfThumbnailViewer = pdfThumbnailViewer; } }, { key: "isHighestPriority", value: function isHighestPriority(view) { return this.highestPriorityPage === view.renderingId; } }, { key: "renderHighestPriority", value: function renderHighestPriority(currentlyVisiblePages) { if (this.idleTimeout) { clearTimeout(this.idleTimeout); this.idleTimeout = null; } if (this.pdfViewer.forceRendering(currentlyVisiblePages)) { return; } if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) { if (this.pdfThumbnailViewer.forceRendering()) { return; } } if (this.printing) { return; } if (this.onIdle) { this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT); } } }, { key: "getHighestPriority", value: function getHighestPriority(visible, views, scrolledDown) { var visibleViews = visible.views; var numVisible = visibleViews.length; if (numVisible === 0) { return false; } for (var i = 0; i < numVisible; ++i) { var view = visibleViews[i].view; if (!this.isViewFinished(view)) { return view; } } if (scrolledDown) { var nextPageIndex = visible.last.id; if (views[nextPageIndex] && !this.isViewFinished(views[nextPageIndex])) { return views[nextPageIndex]; } } else { var previousPageIndex = visible.first.id - 2; if (views[previousPageIndex] && !this.isViewFinished(views[previousPageIndex])) { return views[previousPageIndex]; } } return null; } }, { key: "isViewFinished", value: function isViewFinished(view) { return view.renderingState === RenderingStates.FINISHED; } }, { key: "renderView", value: function renderView(view) { var _this = this; switch (view.renderingState) { case RenderingStates.FINISHED: return false; case RenderingStates.PAUSED: this.highestPriorityPage = view.renderingId; view.resume(); break; case RenderingStates.RUNNING: this.highestPriorityPage = view.renderingId; break; case RenderingStates.INITIAL: this.highestPriorityPage = view.renderingId; var continueRendering = function continueRendering() { _this.renderHighestPriority(); }; view.draw().then(continueRendering, continueRendering); break; } return true; } }]); return PDFRenderingQueue; }(); exports.PDFRenderingQueue = PDFRenderingQueue; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDFSidebar = exports.SidebarView = void 0; var _ui_utils = __webpack_require__(6); var _pdf_rendering_queue = __webpack_require__(10); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var UI_NOTIFICATION_CLASS = 'pdfSidebarNotification'; var SidebarView = { UNKNOWN: -1, NONE: 0, THUMBS: 1, OUTLINE: 2, ATTACHMENTS: 3, LAYERS: 4 }; exports.SidebarView = SidebarView; var PDFSidebar = /*#__PURE__*/ function () { function PDFSidebar(options, eventBus) { var l10n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ui_utils.NullL10n; _classCallCheck(this, PDFSidebar); this.isOpen = false; this.active = SidebarView.THUMBS; this.isInitialViewSet = false; this.onToggled = null; this.pdfViewer = options.pdfViewer; this.pdfThumbnailViewer = options.pdfThumbnailViewer; this.outerContainer = options.outerContainer; this.viewerContainer = options.viewerContainer; this.toggleButton = options.toggleButton; this.thumbnailButton = options.thumbnailButton; this.outlineButton = options.outlineButton; this.attachmentsButton = options.attachmentsButton; this.thumbnailView = options.thumbnailView; this.outlineView = options.outlineView; this.attachmentsView = options.attachmentsView; this.disableNotification = options.disableNotification || false; this.eventBus = eventBus; this.l10n = l10n; this._addEventListeners(); } _createClass(PDFSidebar, [{ key: "reset", value: function reset() { this.isInitialViewSet = false; this._hideUINotification(null); this.switchView(SidebarView.THUMBS); this.outlineButton.disabled = false; this.attachmentsButton.disabled = false; } }, { key: "setInitialView", value: function setInitialView() { var view = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SidebarView.NONE; if (this.isInitialViewSet) { return; } this.isInitialViewSet = true; if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) { this._dispatchEvent(); return; } if (!this._switchView(view, true)) { this._dispatchEvent(); } } }, { key: "switchView", value: function switchView(view) { var forceOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; this._switchView(view, forceOpen); } }, { key: "_switchView", value: function _switchView(view) { var forceOpen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var isViewChanged = view !== this.active; var shouldForceRendering = false; switch (view) { case SidebarView.NONE: if (this.isOpen) { this.close(); return true; } return false; case SidebarView.THUMBS: if (this.isOpen && isViewChanged) { shouldForceRendering = true; } break; case SidebarView.OUTLINE: if (this.outlineButton.disabled) { return false; } break; case SidebarView.ATTACHMENTS: if (this.attachmentsButton.disabled) { return false; } break; default: console.error("PDFSidebar._switchView: \"".concat(view, "\" is not a valid view.")); return false; } this.active = view; this.thumbnailButton.classList.toggle('toggled', view === SidebarView.THUMBS); this.outlineButton.classList.toggle('toggled', view === SidebarView.OUTLINE); this.attachmentsButton.classList.toggle('toggled', view === SidebarView.ATTACHMENTS); this.thumbnailView.classList.toggle('hidden', view !== SidebarView.THUMBS); this.outlineView.classList.toggle('hidden', view !== SidebarView.OUTLINE); this.attachmentsView.classList.toggle('hidden', view !== SidebarView.ATTACHMENTS); if (forceOpen && !this.isOpen) { this.open(); return true; } if (shouldForceRendering) { this._updateThumbnailViewer(); this._forceRendering(); } if (isViewChanged) { this._dispatchEvent(); } this._hideUINotification(this.active); return isViewChanged; } }, { key: "open", value: function open() { if (this.isOpen) { return; } this.isOpen = true; this.toggleButton.classList.add('toggled'); this.outerContainer.classList.add('sidebarMoving', 'sidebarOpen'); if (this.active === SidebarView.THUMBS) { this._updateThumbnailViewer(); } this._forceRendering(); this._dispatchEvent(); this._hideUINotification(this.active); } }, { key: "close", value: function close() { if (!this.isOpen) { return; } this.isOpen = false; this.toggleButton.classList.remove('toggled'); this.outerContainer.classList.add('sidebarMoving'); this.outerContainer.classList.remove('sidebarOpen'); this._forceRendering(); this._dispatchEvent(); } }, { key: "toggle", value: function toggle() { if (this.isOpen) { this.close(); } else { this.open(); } } }, { key: "_dispatchEvent", value: function _dispatchEvent() { this.eventBus.dispatch('sidebarviewchanged', { source: this, view: this.visibleView }); } }, { key: "_forceRendering", value: function _forceRendering() { if (this.onToggled) { this.onToggled(); } else { this.pdfViewer.forceRendering(); this.pdfThumbnailViewer.forceRendering(); } } }, { key: "_updateThumbnailViewer", value: function _updateThumbnailViewer() { var pdfViewer = this.pdfViewer, pdfThumbnailViewer = this.pdfThumbnailViewer; var pagesCount = pdfViewer.pagesCount; for (var pageIndex = 0; pageIndex < pagesCount; pageIndex++) { var pageView = pdfViewer.getPageView(pageIndex); if (pageView && pageView.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) { var thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex); thumbnailView.setImage(pageView); } } pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber); } }, { key: "_showUINotification", value: function _showUINotification(view) { var _this = this; if (this.disableNotification) { return; } this.l10n.get('toggle_sidebar_notification.title', null, 'Toggle Sidebar (document contains outline/attachments)').then(function (msg) { _this.toggleButton.title = msg; }); if (!this.isOpen) { this.toggleButton.classList.add(UI_NOTIFICATION_CLASS); } else if (view === this.active) { return; } switch (view) { case SidebarView.OUTLINE: this.outlineButton.classList.add(UI_NOTIFICATION_CLASS); break; case SidebarView.ATTACHMENTS: this.attachmentsButton.classList.add(UI_NOTIFICATION_CLASS); break; } } }, { key: "_hideUINotification", value: function _hideUINotification(view) { var _this2 = this; if (this.disableNotification) { return; } var removeNotification = function removeNotification(view) { switch (view) { case SidebarView.OUTLINE: _this2.outlineButton.classList.remove(UI_NOTIFICATION_CLASS); break; case SidebarView.ATTACHMENTS: _this2.attachmentsButton.classList.remove(UI_NOTIFICATION_CLASS); break; } }; if (!this.isOpen && view !== null) { return; } this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS); if (view !== null) { removeNotification(view); return; } for (view in SidebarView) { removeNotification(SidebarView[view]); } this.l10n.get('toggle_sidebar.title', null, 'Toggle Sidebar').then(function (msg) { _this2.toggleButton.title = msg; }); } }, { key: "_addEventListeners", value: function _addEventListeners() { var _this3 = this; this.viewerContainer.addEventListener('transitionend', function (evt) { if (evt.target === _this3.viewerContainer) { _this3.outerContainer.classList.remove('sidebarMoving'); } }); this.thumbnailButton.addEventListener('click', function () { _this3.switchView(SidebarView.THUMBS); }); this.outlineButton.addEventListener('click', function () { _this3.switchView(SidebarView.OUTLINE); }); this.outlineButton.addEventListener('dblclick', function () { _this3.eventBus.dispatch('toggleoutlinetree', { source: _this3 }); }); this.attachmentsButton.addEventListener('click', function () { _this3.switchView(SidebarView.ATTACHMENTS); }); this.eventBus.on('outlineloaded', function (evt) { var outlineCount = evt.outlineCount; _this3.outlineButton.disabled = !outlineCount; if (outlineCount) { _this3._showUINotification(SidebarView.OUTLINE); } else if (_this3.active === SidebarView.OUTLINE) { _this3.switchView(SidebarView.THUMBS); } }); this.eventBus.on('attachmentsloaded', function (evt) { if (evt.attachmentsCount) { _this3.attachmentsButton.disabled = false; _this3._showUINotification(SidebarView.ATTACHMENTS); return; } Promise.resolve().then(function () { if (_this3.attachmentsView.hasChildNodes()) { return; } _this3.attachmentsButton.disabled = true; if (_this3.active === SidebarView.ATTACHMENTS) { _this3.switchView(SidebarView.THUMBS); } }); }); this.eventBus.on('presentationmodechanged', function (evt) { if (!evt.active && !evt.switchInProgress && _this3.isThumbnailViewVisible) { _this3._updateThumbnailViewer(); } }); } }, { key: "visibleView", get: function get() { return this.isOpen ? this.active : SidebarView.NONE; } }, { key: "isThumbnailViewVisible", get: function get() { return this.isOpen && this.active === SidebarView.THUMBS; } }, { key: "isOutlineViewVisible", get: function get() { return this.isOpen && this.active === SidebarView.OUTLINE; } }, { key: "isAttachmentsViewVisible", get: function get() { return this.isOpen && this.active === SidebarView.ATTACHMENTS; } }]); return PDFSidebar; }(); exports.PDFSidebar = PDFSidebar; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OptionKind = exports.AppOptions = void 0; var _pdfjsLib = __webpack_require__(7); var _viewer_compatibility = __webpack_require__(13); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var OptionKind = { VIEWER: 'viewer', API: 'api', WORKER: 'worker' }; exports.OptionKind = OptionKind; var defaultOptions = { cursorToolOnLoad: { value: 0, kind: OptionKind.VIEWER }, defaultUrl: { value: '