diff --git a/migration/i8.2z/oracle/202106181300_IDEMPIERE-4838.sql b/migration/i8.2z/oracle/202106181300_IDEMPIERE-4838.sql new file mode 100644 index 0000000000..b7ad859758 --- /dev/null +++ b/migration/i8.2z/oracle/202106181300_IDEMPIERE-4838.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Jun 18, 2021, 1:46:29 PM MYT +UPDATE AD_SysConfig SET Value='Y',Updated=TO_DATE('2021-06-18 13:46:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200163 +; + +SELECT Register_Migration_Script ('202106181300_IDEMPIERE-4838.sql') FROM DUAL +; + diff --git a/migration/i8.2z/postgresql/202106181300_IDEMPIERE-4838.sql b/migration/i8.2z/postgresql/202106181300_IDEMPIERE-4838.sql new file mode 100644 index 0000000000..cf4e411e3e --- /dev/null +++ b/migration/i8.2z/postgresql/202106181300_IDEMPIERE-4838.sql @@ -0,0 +1,7 @@ +-- Jun 18, 2021, 1:46:29 PM MYT +UPDATE AD_SysConfig SET Value='Y',Updated=TO_TIMESTAMP('2021-06-18 13:46:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200163 +; + +SELECT Register_Migration_Script ('202106181300_IDEMPIERE-4838.sql') FROM DUAL +; + diff --git a/org.adempiere.ui.zk/pdf.js/build/pdf.js b/org.adempiere.ui.zk/pdf.js/build/pdf.js index a2ee957dde..33b6253f26 100644 --- a/org.adempiere.ui.zk/pdf.js/build/pdf.js +++ b/org.adempiere.ui.zk/pdf.js/build/pdf.js @@ -2,7 +2,7 @@ * @licstart The following is the entire license notice for the * Javascript code in this page * - * Copyright 2020 Mozilla Foundation + * Copyright 2021 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,360 +30,28 @@ else root["pdfjs-dist/build/pdf"] = root.pdfjsLib = factory(); })(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __w_pdfjs_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, __w_pdfjs_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __w_pdfjs_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __w_pdfjs_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __w_pdfjs_require__.d = function(exports, name, getter) { -/******/ if(!__w_pdfjs_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __w_pdfjs_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 -/******/ __w_pdfjs_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __w_pdfjs_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __w_pdfjs_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __w_pdfjs_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __w_pdfjs_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __w_pdfjs_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "addLinkAttributes", { - enumerable: true, - get: function () { - return _display_utils.addLinkAttributes; - } -}); -Object.defineProperty(exports, "getFilenameFromUrl", { - enumerable: true, - get: function () { - return _display_utils.getFilenameFromUrl; - } -}); -Object.defineProperty(exports, "LinkTarget", { - enumerable: true, - get: function () { - return _display_utils.LinkTarget; - } -}); -Object.defineProperty(exports, "loadScript", { - enumerable: true, - get: function () { - return _display_utils.loadScript; - } -}); -Object.defineProperty(exports, "PDFDateString", { - enumerable: true, - get: function () { - return _display_utils.PDFDateString; - } -}); -Object.defineProperty(exports, "RenderingCancelledException", { - enumerable: true, - get: function () { - return _display_utils.RenderingCancelledException; - } -}); -Object.defineProperty(exports, "build", { - enumerable: true, - get: function () { - return _api.build; - } -}); -Object.defineProperty(exports, "getDocument", { - enumerable: true, - get: function () { - return _api.getDocument; - } -}); -Object.defineProperty(exports, "LoopbackPort", { - enumerable: true, - get: function () { - return _api.LoopbackPort; - } -}); -Object.defineProperty(exports, "PDFDataRangeTransport", { - enumerable: true, - get: function () { - return _api.PDFDataRangeTransport; - } -}); -Object.defineProperty(exports, "PDFWorker", { - enumerable: true, - get: function () { - return _api.PDFWorker; - } -}); -Object.defineProperty(exports, "version", { - enumerable: true, - get: function () { - return _api.version; - } -}); -Object.defineProperty(exports, "CMapCompressionType", { - enumerable: true, - get: function () { - return _util.CMapCompressionType; - } -}); -Object.defineProperty(exports, "createObjectURL", { - enumerable: true, - get: function () { - return _util.createObjectURL; - } -}); -Object.defineProperty(exports, "createPromiseCapability", { - enumerable: true, - get: function () { - return _util.createPromiseCapability; - } -}); -Object.defineProperty(exports, "createValidAbsoluteUrl", { - enumerable: true, - get: function () { - return _util.createValidAbsoluteUrl; - } -}); -Object.defineProperty(exports, "InvalidPDFException", { - enumerable: true, - get: function () { - return _util.InvalidPDFException; - } -}); -Object.defineProperty(exports, "MissingPDFException", { - enumerable: true, - get: function () { - return _util.MissingPDFException; - } -}); -Object.defineProperty(exports, "OPS", { - enumerable: true, - get: function () { - return _util.OPS; - } -}); -Object.defineProperty(exports, "PasswordResponses", { - enumerable: true, - get: function () { - return _util.PasswordResponses; - } -}); -Object.defineProperty(exports, "PermissionFlag", { - enumerable: true, - get: function () { - return _util.PermissionFlag; - } -}); -Object.defineProperty(exports, "removeNullCharacters", { - enumerable: true, - get: function () { - return _util.removeNullCharacters; - } -}); -Object.defineProperty(exports, "shadow", { - enumerable: true, - get: function () { - return _util.shadow; - } -}); -Object.defineProperty(exports, "UnexpectedResponseException", { - enumerable: true, - get: function () { - return _util.UnexpectedResponseException; - } -}); -Object.defineProperty(exports, "UNSUPPORTED_FEATURES", { - enumerable: true, - get: function () { - return _util.UNSUPPORTED_FEATURES; - } -}); -Object.defineProperty(exports, "Util", { - enumerable: true, - get: function () { - return _util.Util; - } -}); -Object.defineProperty(exports, "VerbosityLevel", { - enumerable: true, - get: function () { - return _util.VerbosityLevel; - } -}); -Object.defineProperty(exports, "AnnotationLayer", { - enumerable: true, - get: function () { - return _annotation_layer.AnnotationLayer; - } -}); -Object.defineProperty(exports, "apiCompatibilityParams", { - enumerable: true, - get: function () { - return _api_compatibility.apiCompatibilityParams; - } -}); -Object.defineProperty(exports, "GlobalWorkerOptions", { - enumerable: true, - get: function () { - return _worker_options.GlobalWorkerOptions; - } -}); -Object.defineProperty(exports, "renderTextLayer", { - enumerable: true, - get: function () { - return _text_layer.renderTextLayer; - } -}); -Object.defineProperty(exports, "SVGGraphics", { - enumerable: true, - get: function () { - return _svg.SVGGraphics; - } -}); - -var _display_utils = __w_pdfjs_require__(1); - -var _api = __w_pdfjs_require__(5); - -var _util = __w_pdfjs_require__(2); - -var _annotation_layer = __w_pdfjs_require__(16); - -var _api_compatibility = __w_pdfjs_require__(7); - -var _worker_options = __w_pdfjs_require__(10); - -var _text_layer = __w_pdfjs_require__(17); - -var _svg = __w_pdfjs_require__(18); - -const pdfjsVersion = '2.5.207'; -const pdfjsBuild = '0974d6052'; -{ - const { - isNodeJS - } = __w_pdfjs_require__(4); - - if (isNodeJS) { - const PDFNodeStream = __w_pdfjs_require__(19).PDFNodeStream; - - (0, _api.setPDFNetworkStreamFactory)(params => { - return new PDFNodeStream(params); - }); - } else { - const PDFNetworkStream = __w_pdfjs_require__(22).PDFNetworkStream; - - let PDFFetchStream; - - if ((0, _display_utils.isFetchSupported)()) { - PDFFetchStream = __w_pdfjs_require__(23).PDFFetchStream; - } - - (0, _api.setPDFNetworkStreamFactory)(params => { - if (PDFFetchStream && (0, _display_utils.isValidFetchUrl)(params.url)) { - return new PDFFetchStream(params); - } - - return new PDFNetworkStream(params); - }); - } -} - -/***/ }), +return /******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ([ +/* 0 */, /* 1 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.addLinkAttributes = addLinkAttributes; +exports.deprecated = deprecated; exports.getFilenameFromUrl = getFilenameFromUrl; +exports.getPdfFilenameFromUrl = getPdfFilenameFromUrl; +exports.isDataScheme = isDataScheme; exports.isFetchSupported = isFetchSupported; +exports.isPdfFile = isPdfFile; exports.isValidFetchUrl = isValidFetchUrl; exports.loadScript = loadScript; -exports.deprecated = deprecated; -exports.PDFDateString = exports.StatTimer = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.LinkTarget = exports.RenderingCancelledException = exports.PageViewport = void 0; +exports.StatTimer = exports.RenderingCancelledException = exports.PDFDateString = exports.PageViewport = exports.LinkTarget = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.BaseCMapReaderFactory = exports.BaseCanvasFactory = void 0; var _util = __w_pdfjs_require__(2); @@ -391,20 +59,15 @@ const DEFAULT_LINK_REL = "noopener noreferrer nofollow"; exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL; const SVG_NS = "http://www.w3.org/2000/svg"; -class DOMCanvasFactory { - create(width, height) { - if (width <= 0 || height <= 0) { - throw new Error("Invalid canvas size"); +class BaseCanvasFactory { + constructor() { + if (this.constructor === BaseCanvasFactory) { + (0, _util.unreachable)("Cannot initialize BaseCanvasFactory."); } + } - const canvas = document.createElement("canvas"); - const context = canvas.getContext("2d"); - canvas.width = width; - canvas.height = height; - return { - canvas, - context - }; + create(width, height) { + (0, _util.unreachable)("Abstract method `create` called."); } reset(canvasAndContext, width, height) { @@ -433,13 +96,45 @@ class DOMCanvasFactory { } +exports.BaseCanvasFactory = BaseCanvasFactory; + +class DOMCanvasFactory extends BaseCanvasFactory { + constructor({ + ownerDocument = globalThis.document + } = {}) { + super(); + this._document = ownerDocument; + } + + create(width, height) { + if (width <= 0 || height <= 0) { + throw new Error("Invalid canvas size"); + } + + const canvas = this._document.createElement("canvas"); + + const context = canvas.getContext("2d"); + canvas.width = width; + canvas.height = height; + return { + canvas, + context + }; + } + +} + exports.DOMCanvasFactory = DOMCanvasFactory; -class DOMCMapReaderFactory { +class BaseCMapReaderFactory { constructor({ baseUrl = null, isCompressed = false }) { + if (this.constructor === BaseCMapReaderFactory) { + (0, _util.unreachable)("Cannot initialize BaseCMapReaderFactory."); + } + this.baseUrl = baseUrl; this.isCompressed = isCompressed; } @@ -457,7 +152,21 @@ class DOMCMapReaderFactory { const url = this.baseUrl + name + (this.isCompressed ? ".bcmap" : ""); const compressionType = this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE; + return this._fetchData(url, compressionType).catch(reason => { + throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}CMap at: ${url}`); + }); + } + _fetchData(url, compressionType) { + (0, _util.unreachable)("Abstract method `_fetchData` called."); + } + +} + +exports.BaseCMapReaderFactory = BaseCMapReaderFactory; + +class DOMCMapReaderFactory extends BaseCMapReaderFactory { + _fetchData(url, compressionType) { if (isFetchSupported() && isValidFetchUrl(url, document.baseURI)) { return fetch(url).then(async response => { if (!response.ok) { @@ -476,8 +185,6 @@ class DOMCMapReaderFactory { cMapData, compressionType }; - }).catch(reason => { - throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}` + `CMap at: ${url}`); }); } @@ -516,8 +223,6 @@ class DOMCMapReaderFactory { }; request.send(null); - }).catch(reason => { - throw new Error(`Unable to load ${this.isCompressed ? "binary " : ""}` + `CMap at: ${url}`); }); } @@ -563,8 +268,11 @@ class PageViewport { const centerX = (viewBox[2] + viewBox[0]) / 2; const centerY = (viewBox[3] + viewBox[1]) / 2; let rotateA, rotateB, rotateC, rotateD; - rotation = rotation % 360; - rotation = rotation < 0 ? rotation + 360 : rotation; + rotation %= 360; + + if (rotation < 0) { + rotation += 360; + } switch (rotation) { case 180: @@ -726,6 +434,21 @@ function addLinkAttributes(link, { link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL; } +function isDataScheme(url) { + const ii = url.length; + let i = 0; + + while (i < ii && url[i].trim() === "") { + i++; + } + + return url.substring(i, i + 5).toLowerCase() === "data:"; +} + +function isPdfFile(filename) { + return typeof filename === "string" && /\.pdf$/i.test(filename); +} + function getFilenameFromUrl(url) { const anchor = url.indexOf("#"); const query = url.indexOf("?"); @@ -733,6 +456,34 @@ function getFilenameFromUrl(url) { return url.substring(url.lastIndexOf("/", end) + 1, end); } +function getPdfFilenameFromUrl(url, defaultFilename = "document.pdf") { + if (typeof url !== "string") { + return defaultFilename; + } + + if (isDataScheme(url)) { + (0, _util.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'); + return defaultFilename; + } + + const reURI = /^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/; + const reFilename = /[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i; + const splitURI = reURI.exec(url); + let 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; +} + class StatTimer { constructor() { this.started = Object.create(null); @@ -799,11 +550,18 @@ function isValidFetchUrl(url, baseUrl) { } } -function loadScript(src) { +function loadScript(src, removeScriptElement = false) { return new Promise((resolve, reject) => { const script = document.createElement("script"); script.src = src; - script.onload = resolve; + + script.onload = function (evt) { + if (removeScriptElement) { + script.remove(); + } + + resolve(evt); + }; script.onerror = function () { reject(new Error(`Cannot load script at: ${script.src}`)); @@ -869,40 +627,45 @@ exports.PDFDateString = PDFDateString; /***/ }), /* 2 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.arrayByteLength = arrayByteLength; exports.arraysToBytes = arraysToBytes; exports.assert = assert; exports.bytesToString = bytesToString; +exports.createObjectURL = createObjectURL; exports.createPromiseCapability = createPromiseCapability; +exports.createValidAbsoluteUrl = createValidAbsoluteUrl; +exports.escapeString = escapeString; +exports.getModificationDate = getModificationDate; exports.getVerbosityLevel = getVerbosityLevel; exports.info = info; exports.isArrayBuffer = isArrayBuffer; exports.isArrayEqual = isArrayEqual; +exports.isAscii = isAscii; exports.isBool = isBool; -exports.isEmptyObj = isEmptyObj; exports.isNum = isNum; -exports.isString = isString; exports.isSameOrigin = isSameOrigin; -exports.createValidAbsoluteUrl = createValidAbsoluteUrl; +exports.isString = isString; +exports.objectFromMap = objectFromMap; +exports.objectSize = objectSize; exports.removeNullCharacters = removeNullCharacters; exports.setVerbosityLevel = setVerbosityLevel; exports.shadow = shadow; exports.string32 = string32; exports.stringToBytes = stringToBytes; exports.stringToPDFString = stringToPDFString; +exports.stringToUTF16BEString = stringToUTF16BEString; exports.stringToUTF8String = stringToUTF8String; +exports.unreachable = unreachable; exports.utf8StringToString = utf8StringToString; exports.warn = warn; -exports.unreachable = unreachable; -exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0; +exports.VerbosityLevel = exports.Util = exports.UNSUPPORTED_FEATURES = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.IsLittleEndianCached = exports.IsEvalSupportedCached = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0; __w_pdfjs_require__(3); @@ -1035,6 +798,36 @@ const AnnotationBorderStyleType = { UNDERLINE: 5 }; exports.AnnotationBorderStyleType = AnnotationBorderStyleType; +const AnnotationActionEventType = { + E: "Mouse Enter", + X: "Mouse Exit", + D: "Mouse Down", + U: "Mouse Up", + Fo: "Focus", + Bl: "Blur", + PO: "PageOpen", + PC: "PageClose", + PV: "PageVisible", + PI: "PageInvisible", + K: "Keystroke", + F: "Format", + V: "Validate", + C: "Calculate" +}; +exports.AnnotationActionEventType = AnnotationActionEventType; +const DocumentActionEventType = { + WC: "WillClose", + WS: "WillSave", + DS: "DidSave", + WP: "WillPrint", + DP: "DidPrint" +}; +exports.DocumentActionEventType = DocumentActionEventType; +const PageActionEventType = { + O: "PageOpen", + C: "PageClose" +}; +exports.PageActionEventType = PageActionEventType; const StreamType = { UNKNOWN: "UNKNOWN", FLATE: "FLATE", @@ -1172,6 +965,7 @@ const UNSUPPORTED_FEATURES = { unknown: "unknown", forms: "forms", javaScript: "javaScript", + signatures: "signatures", smask: "smask", shadingPattern: "shadingPattern", font: "font", @@ -1186,7 +980,9 @@ const UNSUPPORTED_FEATURES = { errorOperatorList: "errorOperatorList", errorFontToUnicode: "errorFontToUnicode", errorFontLoadNative: "errorFontLoadNative", - errorFontGetPath: "errorFontGetPath" + errorFontBuildPath: "errorFontBuildPath", + errorFontGetPath: "errorFontGetPath", + errorMarkedContent: "errorMarkedContent" }; exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; const PasswordResponses = { @@ -1442,6 +1238,20 @@ function string32(value) { return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); } +function objectSize(obj) { + return Object.keys(obj).length; +} + +function objectFromMap(map) { + const obj = Object.create(null); + + for (const [key, value] of map) { + obj[key] = value; + } + + return obj; +} + function isLittleEndian() { const buffer8 = new Uint8Array(4); buffer8[0] = 1; @@ -1473,14 +1283,11 @@ const IsEvalSupportedCached = { }; exports.IsEvalSupportedCached = IsEvalSupportedCached; -const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"]; +const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0")); class Util { - static makeCssRgb(r, g, b) { - rgbBuf[1] = r; - rgbBuf[3] = g; - rgbBuf[5] = b; - return rgbBuf.join(""); + static makeHexColor(r, g, b) { + return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`; } static transform(m1, m2) { @@ -1524,7 +1331,7 @@ class Util { const c = m[2] * transpose[0] + m[3] * transpose[2]; const d = m[2] * transpose[1] + m[3] * transpose[3]; const first = (a + d) / 2; - const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; + const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2; const sx = first + second || 1; const sy = first - second || 1; return [Math.sqrt(sx), Math.sqrt(sy)]; @@ -1577,7 +1384,7 @@ class Util { } exports.Util = Util; -const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC]; +const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac]; function stringToPDFString(str) { const length = str.length, @@ -1601,6 +1408,33 @@ function stringToPDFString(str) { return strBuf.join(""); } +function escapeString(str) { + return str.replace(/([()\\\n\r])/g, match => { + if (match === "\n") { + return "\\n"; + } else if (match === "\r") { + return "\\r"; + } + + return `\\${match}`; + }); +} + +function isAscii(str) { + return /^[\x00-\x7F]*$/.test(str); +} + +function stringToUTF16BEString(str) { + const buf = ["\xFE\xFF"]; + + for (let i = 0, ii = str.length; i < ii; i++) { + const char = str.charCodeAt(i); + buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff)); + } + + return buf.join(""); +} + function stringToUTF8String(str) { return decodeURIComponent(escape(str)); } @@ -1609,14 +1443,6 @@ function utf8StringToString(str) { return unescape(encodeURIComponent(str)); } -function isEmptyObj(obj) { - for (const key in obj) { - return false; - } - - return true; -} - function isBool(v) { return typeof v === "boolean"; } @@ -1638,9 +1464,18 @@ function isArrayEqual(arr1, arr2) { return false; } - return arr1.every(function (element, index) { - return element === arr2[index]; - }); + for (let i = 0, ii = arr1.length; i < ii; i++) { + if (arr1[i] !== arr2[i]) { + return false; + } + } + + return true; +} + +function getModificationDate(date = new Date()) { + const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")]; + return buffer.join(""); } function createPromiseCapability() { @@ -1666,40 +1501,34 @@ function createPromiseCapability() { return capability; } -const createObjectURL = function createObjectURLClosure() { +function createObjectURL(data, contentType = "", forceDataSchema = false) { + if (URL.createObjectURL && !forceDataSchema) { + return URL.createObjectURL(new Blob([data], { + type: contentType + })); + } + const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - return function createObjectURL(data, contentType, forceDataSchema = false) { - if (!forceDataSchema && URL.createObjectURL) { - const blob = new Blob([data], { - type: contentType - }); - return URL.createObjectURL(blob); - } + let buffer = `data:${contentType};base64,`; - let buffer = `data:${contentType};base64,`; + for (let i = 0, ii = data.length; i < ii; i += 3) { + const b1 = data[i] & 0xff; + const b2 = data[i + 1] & 0xff; + const b3 = data[i + 2] & 0xff; + const d1 = b1 >> 2, + d2 = (b1 & 3) << 4 | b2 >> 4; + const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64; + const d4 = i + 2 < ii ? b3 & 0x3f : 64; + buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; + } - for (let i = 0, ii = data.length; i < ii; i += 3) { - const b1 = data[i] & 0xff; - const b2 = data[i + 1] & 0xff; - const b3 = data[i + 2] & 0xff; - const d1 = b1 >> 2, - d2 = (b1 & 3) << 4 | b2 >> 4; - const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64; - const d4 = i + 2 < ii ? b3 & 0x3f : 64; - buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; - } - - return buffer; - }; -}(); - -exports.createObjectURL = createObjectURL; + return buffer; +} /***/ }), /* 3 */ -/***/ (function(module, exports, __w_pdfjs_require__) { +/***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => { -"use strict"; var _is_node = __w_pdfjs_require__(4); @@ -1708,31 +1537,29 @@ var _is_node = __w_pdfjs_require__(4); /***/ }), /* 4 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.isNodeJS = void 0; -const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !process.versions.electron; +const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser"); exports.isNodeJS = isNodeJS; /***/ }), /* 5 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.getDocument = getDocument; exports.setPDFNetworkStreamFactory = setPDFNetworkStreamFactory; -exports.build = exports.version = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = void 0; +exports.version = exports.PDFWorker = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.DefaultCMapReaderFactory = exports.DefaultCanvasFactory = exports.build = void 0; var _util = __w_pdfjs_require__(2); @@ -1740,24 +1567,32 @@ var _display_utils = __w_pdfjs_require__(1); var _font_loader = __w_pdfjs_require__(6); -var _api_compatibility = __w_pdfjs_require__(7); +var _node_utils = __w_pdfjs_require__(7); -var _canvas = __w_pdfjs_require__(8); +var _annotation_storage = __w_pdfjs_require__(8); -var _worker_options = __w_pdfjs_require__(10); +var _api_compatibility = __w_pdfjs_require__(9); + +var _canvas = __w_pdfjs_require__(10); + +var _worker_options = __w_pdfjs_require__(12); var _is_node = __w_pdfjs_require__(4); -var _message_handler = __w_pdfjs_require__(11); +var _message_handler = __w_pdfjs_require__(13); -var _metadata = __w_pdfjs_require__(12); +var _metadata = __w_pdfjs_require__(14); -var _transport_stream = __w_pdfjs_require__(14); +var _optional_content_config = __w_pdfjs_require__(15); -var _webgl = __w_pdfjs_require__(15); +var _transport_stream = __w_pdfjs_require__(16); const DEFAULT_RANGE_CHUNK_SIZE = 65536; const RENDERING_CANCELLED_TIMEOUT = 100; +const DefaultCanvasFactory = _is_node.isNodeJS ? _node_utils.NodeCanvasFactory : _display_utils.DOMCanvasFactory; +exports.DefaultCanvasFactory = DefaultCanvasFactory; +const DefaultCMapReaderFactory = _is_node.isNodeJS ? _node_utils.NodeCMapReaderFactory : _display_utils.DOMCMapReaderFactory; +exports.DefaultCMapReaderFactory = DefaultCMapReaderFactory; let createPDFNetworkStream; function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) { @@ -1768,7 +1603,7 @@ function getDocument(src) { const task = new PDFDocumentLoadingTask(); let source; - if (typeof src === "string") { + if (typeof src === "string" || src instanceof URL) { source = { url: src }; @@ -1782,7 +1617,7 @@ function getDocument(src) { }; } else { if (typeof src !== "object") { - throw new Error("Invalid parameter in getDocument, " + "need either Uint8Array, string or a parameter object"); + throw new Error("Invalid parameter in getDocument, " + "need either string, URL, Uint8Array, or parameter object."); } if (!src.url && !src.data && !src.range) { @@ -1797,39 +1632,63 @@ function getDocument(src) { worker = null; for (const key in source) { - if (key === "url" && typeof window !== "undefined") { - params[key] = new URL(source[key], window.location).href; - continue; - } else if (key === "range") { - rangeTransport = source[key]; - continue; - } else if (key === "worker") { - worker = source[key]; - continue; - } else if (key === "data" && !(source[key] instanceof Uint8Array)) { - const pdfBytes = source[key]; + const value = source[key]; - if (typeof pdfBytes === "string") { - params[key] = (0, _util.stringToBytes)(pdfBytes); - } else if (typeof pdfBytes === "object" && pdfBytes !== null && !isNaN(pdfBytes.length)) { - params[key] = new Uint8Array(pdfBytes); - } else if ((0, _util.isArrayBuffer)(pdfBytes)) { - params[key] = new Uint8Array(pdfBytes); - } else { - throw new Error("Invalid PDF binary data: either typed array, " + "string or array-like object is expected in the " + "data property."); - } + switch (key) { + case "url": + if (typeof window !== "undefined") { + try { + params[key] = new URL(value, window.location).href; + continue; + } catch (ex) { + (0, _util.warn)(`Cannot create valid URL: "${ex}".`); + } + } else if (typeof value === "string" || value instanceof URL) { + params[key] = value.toString(); + continue; + } - continue; + throw new Error("Invalid PDF url data: " + "either string or URL-object is expected in the url property."); + + case "range": + rangeTransport = value; + continue; + + case "worker": + worker = value; + continue; + + case "data": + if (_is_node.isNodeJS && typeof Buffer !== "undefined" && value instanceof Buffer) { + params[key] = new Uint8Array(value); + } else if (value instanceof Uint8Array) { + break; + } else if (typeof value === "string") { + params[key] = (0, _util.stringToBytes)(value); + } else if (typeof value === "object" && value !== null && !isNaN(value.length)) { + params[key] = new Uint8Array(value); + } else if ((0, _util.isArrayBuffer)(value)) { + params[key] = new Uint8Array(value); + } else { + throw new Error("Invalid PDF binary data: either typed array, " + "string, or array-like object is expected in the data property."); + } + + continue; } - params[key] = source[key]; + params[key] = value; } params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; - params.CMapReaderFactory = params.CMapReaderFactory || _display_utils.DOMCMapReaderFactory; + params.CMapReaderFactory = params.CMapReaderFactory || DefaultCMapReaderFactory; params.ignoreErrors = params.stopAtErrors !== true; params.fontExtraProperties = params.fontExtraProperties === true; params.pdfBug = params.pdfBug === true; + params.enableXfa = params.enableXfa === true; + + if (typeof params.docBaseUrl !== "string" || (0, _display_utils.isDataScheme)(params.docBaseUrl)) { + params.docBaseUrl = null; + } if (!Number.isInteger(params.maxImageSize)) { params.maxImageSize = -1; @@ -1843,6 +1702,10 @@ function getDocument(src) { params.disableFontFace = _api_compatibility.apiCompatibilityParams.disableFontFace || false; } + if (typeof params.ownerDocument === "undefined") { + params.ownerDocument = globalThis.document; + } + if (typeof params.disableRange !== "boolean") { params.disableRange = false; } @@ -1882,6 +1745,7 @@ function getDocument(src) { length: params.length, initialData: params.initialData, progressiveDone: params.progressiveDone, + contentDispositionFilename: params.contentDispositionFilename, disableRange: params.disableRange, disableStream: params.disableStream }, rangeTransport); @@ -1923,11 +1787,12 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { source.length = pdfDataRangeTransport.length; source.initialData = pdfDataRangeTransport.initialData; source.progressiveDone = pdfDataRangeTransport.progressiveDone; + source.contentDispositionFilename = pdfDataRangeTransport.contentDispositionFilename; } return worker.messageHandler.sendWithPromise("GetDocRequest", { docId, - apiVersion: '2.5.207', + apiVersion: '2.9.359', source: { data: source.data, url: source.url, @@ -1942,7 +1807,8 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { docBaseUrl: source.docBaseUrl, ignoreErrors: source.ignoreErrors, isEvalSupported: source.isEvalSupported, - fontExtraProperties: source.fontExtraProperties + fontExtraProperties: source.fontExtraProperties, + enableXfa: source.enableXfa }).then(function (workerId) { if (worker.destroyed) { throw new Error("Worker was destroyed"); @@ -1991,10 +1857,11 @@ const PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() { }(); class PDFDataRangeTransport { - constructor(length, initialData, progressiveDone = false) { + constructor(length, initialData, progressiveDone = false, contentDispositionFilename = null) { this.length = length; this.initialData = initialData; this.progressiveDone = progressiveDone; + this.contentDispositionFilename = contentDispositionFilename; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; @@ -2068,6 +1935,10 @@ class PDFDocumentProxy { this._transport = transport; } + get annotationStorage() { + return this._transport.annotationStorage; + } + get numPages() { return this._pdfInfo.numPages; } @@ -2076,6 +1947,10 @@ class PDFDocumentProxy { return this._pdfInfo.fingerprint; } + get isPureXfa() { + return this._pdfInfo.isPureXfa; + } + getPage(pageNumber) { return this._transport.getPage(pageNumber); } @@ -2112,13 +1987,6 @@ class PDFDocumentProxy { return this._transport.getOpenAction(); } - getOpenActionDestination() { - (0, _display_utils.deprecated)("getOpenActionDestination, use getOpenAction instead."); - return this.getOpenAction().then(function (openAction) { - return openAction && openAction.dest ? openAction.dest : null; - }); - } - getAttachments() { return this._transport.getAttachments(); } @@ -2127,10 +1995,18 @@ class PDFDocumentProxy { return this._transport.getJavaScript(); } + getJSActions() { + return this._transport.getDocJSActions(); + } + getOutline() { return this._transport.getOutline(); } + getOptionalContentConfig() { + return this._transport.getOptionalContentConfig(); + } + getPermissions() { return this._transport.getPermissions(); } @@ -2139,6 +2015,10 @@ class PDFDocumentProxy { return this._transport.getMetadata(); } + getMarkInfo() { + return this._transport.getMarkInfo(); + } + getData() { return this._transport.getData(); } @@ -2151,8 +2031,8 @@ class PDFDocumentProxy { return this._transport.getStats(); } - cleanup() { - return this._transport.startCleanup(); + cleanup(keepLoadedFonts = false) { + return this._transport.startCleanup(keepLoadedFonts || this.isPureXfa); } destroy() { @@ -2167,14 +2047,39 @@ class PDFDocumentProxy { return this._transport.loadingTask; } + saveDocument() { + if (arguments.length > 0) { + (0, _display_utils.deprecated)("saveDocument no longer accepts any options."); + } + + if (this._transport.annotationStorage.size <= 0) { + (0, _display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, " + "please use the getData-method instead."); + } + + return this._transport.saveDocument(); + } + + getFieldObjects() { + return this._transport.getFieldObjects(); + } + + hasJSActions() { + return this._transport.hasJSActions(); + } + + getCalculationOrderIds() { + return this._transport.getCalculationOrderIds(); + } + } exports.PDFDocumentProxy = PDFDocumentProxy; class PDFPageProxy { - constructor(pageIndex, pageInfo, transport, pdfBug = false) { + constructor(pageIndex, pageInfo, transport, ownerDocument, pdfBug = false) { this._pageIndex = pageIndex; this._pageInfo = pageInfo; + this._ownerDocument = ownerDocument; this._transport = transport; this._stats = pdfBug ? new _display_utils.StatTimer() : null; this._pdfBug = pdfBug; @@ -2182,7 +2087,7 @@ class PDFPageProxy { this.objs = new PDFObjects(); this.cleanupAfterRender = false; this.pendingCleanup = false; - this.intentStates = Object.create(null); + this._intentStates = new Map(); this.destroyed = false; } @@ -2226,25 +2131,41 @@ class PDFPageProxy { getAnnotations({ intent = null } = {}) { - if (!this.annotationsPromise || this.annotationsIntent !== intent) { - this.annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent); - this.annotationsIntent = intent; + if (!this._annotationsPromise || this._annotationsIntent !== intent) { + this._annotationsPromise = this._transport.getAnnotations(this._pageIndex, intent); + this._annotationsIntent = intent; } - return this.annotationsPromise; + return this._annotationsPromise; + } + + getJSActions() { + return this._jsActionsPromise || (this._jsActionsPromise = this._transport.getPageJSActions(this._pageIndex)); + } + + getXfa() { + return this._xfaPromise || (this._xfaPromise = this._transport.getPageXfa(this._pageIndex)); } render({ canvasContext, viewport, intent = "display", - enableWebGL = false, renderInteractiveForms = false, transform = null, imageLayer = null, canvasFactory = null, - background = null + background = null, + includeAnnotationStorage = false, + optionalContentConfigPromise = null }) { + var _intentState; + + if (arguments[0]?.annotationStorage !== undefined) { + (0, _display_utils.deprecated)("render no longer accepts an `annotationStorage` option, " + "please use the `includeAnnotationStorage`-boolean instead."); + includeAnnotationStorage || (includeAnnotationStorage = !!arguments[0].annotationStorage); + } + if (this._stats) { this._stats.time("Overall"); } @@ -2252,21 +2173,27 @@ class PDFPageProxy { const renderingIntent = intent === "print" ? "print" : "display"; this.pendingCleanup = false; - if (!this.intentStates[renderingIntent]) { - this.intentStates[renderingIntent] = Object.create(null); + if (!optionalContentConfigPromise) { + optionalContentConfigPromise = this._transport.getOptionalContentConfig(); } - const intentState = this.intentStates[renderingIntent]; + let intentState = this._intentStates.get(renderingIntent); + + if (!intentState) { + intentState = Object.create(null); + + this._intentStates.set(renderingIntent, intentState); + } if (intentState.streamReaderCancelTimeout) { clearTimeout(intentState.streamReaderCancelTimeout); intentState.streamReaderCancelTimeout = null; } - const canvasFactoryInstance = canvasFactory || new _display_utils.DOMCanvasFactory(); - const webGLContext = new _webgl.WebGLContext({ - enable: enableWebGL + const canvasFactoryInstance = canvasFactory || new DefaultCanvasFactory({ + ownerDocument: this._ownerDocument }); + const annotationStorage = includeAnnotationStorage ? this._transport.annotationStorage.serializable : null; if (!intentState.displayReadyCapability) { intentState.displayReadyCapability = (0, _util.createPromiseCapability)(); @@ -2283,16 +2210,13 @@ class PDFPageProxy { this._pumpOperatorList({ pageIndex: this._pageIndex, intent: renderingIntent, - renderInteractiveForms: renderInteractiveForms === true + renderInteractiveForms: renderInteractiveForms === true, + annotationStorage }); } const complete = error => { - const i = intentState.renderTasks.indexOf(internalRenderTask); - - if (i >= 0) { - intentState.renderTasks.splice(i, 1); - } + intentState.renderTasks.delete(internalRenderTask); if (this.cleanupAfterRender || renderingIntent === "print") { this.pendingCleanup = true; @@ -2332,18 +2256,12 @@ class PDFPageProxy { operatorList: intentState.operatorList, pageIndex: this._pageIndex, canvasFactory: canvasFactoryInstance, - webGLContext, useRequestAnimationFrame: renderingIntent !== "print", pdfBug: this._pdfBug }); - - if (!intentState.renderTasks) { - intentState.renderTasks = []; - } - - intentState.renderTasks.push(internalRenderTask); + ((_intentState = intentState).renderTasks || (_intentState.renderTasks = new Set())).add(internalRenderTask); const renderTask = internalRenderTask.task; - intentState.displayReadyCapability.promise.then(transparency => { + Promise.all([intentState.displayReadyCapability.promise, optionalContentConfigPromise]).then(([transparency, optionalContentConfig]) => { if (this.pendingCleanup) { complete(); return; @@ -2353,7 +2271,10 @@ class PDFPageProxy { this._stats.time("Rendering"); } - internalRenderTask.initializeGraphics(transparency); + internalRenderTask.initializeGraphics({ + transparency, + optionalContentConfig + }); internalRenderTask.operatorListChanged(); }).catch(complete); return renderTask; @@ -2363,29 +2284,29 @@ class PDFPageProxy { function operatorListChanged() { if (intentState.operatorList.lastChunk) { intentState.opListReadCapability.resolve(intentState.operatorList); - const i = intentState.renderTasks.indexOf(opListTask); - - if (i >= 0) { - intentState.renderTasks.splice(i, 1); - } + intentState.renderTasks.delete(opListTask); } } const renderingIntent = "oplist"; - if (!this.intentStates[renderingIntent]) { - this.intentStates[renderingIntent] = Object.create(null); + let intentState = this._intentStates.get(renderingIntent); + + if (!intentState) { + intentState = Object.create(null); + + this._intentStates.set(renderingIntent, intentState); } - const intentState = this.intentStates[renderingIntent]; let opListTask; if (!intentState.opListReadCapability) { - opListTask = {}; + var _intentState2; + + opListTask = Object.create(null); opListTask.operatorListChanged = operatorListChanged; intentState.opListReadCapability = (0, _util.createPromiseCapability)(); - intentState.renderTasks = []; - intentState.renderTasks.push(opListTask); + ((_intentState2 = intentState).renderTasks || (_intentState2.renderTasks = new Set())).add(opListTask); intentState.operatorList = { fnArray: [], argsArray: [], @@ -2407,13 +2328,15 @@ class PDFPageProxy { streamTextContent({ normalizeWhitespace = false, - disableCombineTextItems = false + disableCombineTextItems = false, + includeMarkedContent = false } = {}) { const TEXT_CONTENT_CHUNK_SIZE = 100; return this._transport.messageHandler.sendWithStream("GetTextContent", { pageIndex: this._pageIndex, normalizeWhitespace: normalizeWhitespace === true, - combineTextItems: disableCombineTextItems !== true + combineTextItems: disableCombineTextItems !== true, + includeMarkedContent: includeMarkedContent === true }, { highWaterMark: TEXT_CONTENT_CHUNK_SIZE, @@ -2452,13 +2375,16 @@ class PDFPageProxy { }); } + getStructTree() { + return this._structTreePromise || (this._structTreePromise = this._transport.getStructTree(this._pageIndex)); + } + _destroy() { this.destroyed = true; this._transport.pageCache[this._pageIndex] = null; const waitOn = []; - Object.keys(this.intentStates).forEach(intent => { - const intentState = this.intentStates[intent]; + for (const [intent, intentState] of this._intentStates) { this._abortOperatorList({ intentState, reason: new Error("Page was destroyed."), @@ -2466,17 +2392,20 @@ class PDFPageProxy { }); if (intent === "oplist") { - return; + continue; } - intentState.renderTasks.forEach(function (renderTask) { - const renderCompleted = renderTask.capability.promise.catch(function () {}); - waitOn.push(renderCompleted); - renderTask.cancel(); - }); - }); + for (const internalRenderTask of intentState.renderTasks) { + waitOn.push(internalRenderTask.completed); + internalRenderTask.cancel(); + } + } + this.objs.clear(); - this.annotationsPromise = null; + this._annotationsPromise = null; + this._jsActionsPromise = null; + this._xfaPromise = null; + this._structTreePromise = null; this.pendingCleanup = false; return Promise.all(waitOn); } @@ -2487,18 +2416,26 @@ class PDFPageProxy { } _tryCleanup(resetStats = false) { - if (!this.pendingCleanup || Object.keys(this.intentStates).some(intent => { - const intentState = this.intentStates[intent]; - return intentState.renderTasks.length !== 0 || !intentState.operatorList.lastChunk; - })) { + if (!this.pendingCleanup) { return false; } - Object.keys(this.intentStates).forEach(intent => { - delete this.intentStates[intent]; - }); + for (const { + renderTasks, + operatorList + } of this._intentStates.values()) { + if (renderTasks.size > 0 || !operatorList.lastChunk) { + return false; + } + } + + this._intentStates.clear(); + this.objs.clear(); - this.annotationsPromise = null; + this._annotationsPromise = null; + this._jsActionsPromise = null; + this._xfaPromise = null; + this._structTreePromise = null; if (resetStats && this._stats) { this._stats = new _display_utils.StatTimer(); @@ -2509,7 +2446,7 @@ class PDFPageProxy { } _startRenderPage(transparency, intent) { - const intentState = this.intentStates[intent]; + const intentState = this._intentStates.get(intent); if (!intentState) { return; @@ -2532,8 +2469,8 @@ class PDFPageProxy { intentState.operatorList.lastChunk = operatorListChunk.lastChunk; - for (let i = 0; i < intentState.renderTasks.length; i++) { - intentState.renderTasks[i].operatorListChanged(); + for (const internalRenderTask of intentState.renderTasks) { + internalRenderTask.operatorListChanged(); } if (operatorListChunk.lastChunk) { @@ -2547,7 +2484,9 @@ class PDFPageProxy { const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", args); const reader = readableStream.getReader(); - const intentState = this.intentStates[args.intent]; + + const intentState = this._intentStates.get(args.intent); + intentState.streamReader = reader; const pump = () => { @@ -2577,8 +2516,8 @@ class PDFPageProxy { if (intentState.operatorList) { intentState.operatorList.lastChunk = true; - for (let i = 0; i < intentState.renderTasks.length; i++) { - intentState.renderTasks[i].operatorListChanged(); + for (const internalRenderTask of intentState.renderTasks) { + internalRenderTask.operatorListChanged(); } this._tryCleanup(); @@ -2609,7 +2548,7 @@ class PDFPageProxy { } if (!force) { - if (intentState.renderTasks.length !== 0) { + if (intentState.renderTasks.size > 0) { return; } @@ -2627,21 +2566,21 @@ class PDFPageProxy { } } - intentState.streamReader.cancel(new _util.AbortException(reason && reason.message)); + intentState.streamReader.cancel(new _util.AbortException(reason?.message)); intentState.streamReader = null; if (this._transport.destroyed) { return; } - Object.keys(this.intentStates).some(intent => { - if (this.intentStates[intent] === intentState) { - delete this.intentStates[intent]; - return true; - } + for (const [intent, curIntentState] of this._intentStates) { + if (curIntentState === intentState) { + this._intentStates.delete(intent); + + break; + } + } - return false; - }); this.cleanup(); } @@ -2654,9 +2593,8 @@ class PDFPageProxy { exports.PDFPageProxy = PDFPageProxy; class LoopbackPort { - constructor(defer = true) { + constructor() { this._listeners = []; - this._defer = defer; this._deferred = Promise.resolve(undefined); } @@ -2673,9 +2611,7 @@ class LoopbackPort { let buffer, result; if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) { - const transferable = transfers && transfers.includes(buffer); - - if (transferable) { + if (transfers?.includes(buffer)) { result = new value.constructor(buffer, value.byteOffset, value.byteLength); } else { result = new value.constructor(value); @@ -2685,7 +2621,33 @@ class LoopbackPort { return result; } - result = Array.isArray(value) ? [] : {}; + if (value instanceof Map) { + result = new Map(); + cloned.set(value, result); + + for (const [key, val] of value) { + result.set(key, cloneValue(val)); + } + + return result; + } + + if (value instanceof Set) { + result = new Set(); + cloned.set(value, result); + + for (const val of value) { + result.add(cloneValue(val)); + } + + return result; + } + + if (value instanceof URL) { + throw new Error(`LoopbackPort.postMessage - cannot clone: ${value}`); + } + + result = Array.isArray(value) ? [] : Object.create(null); cloned.set(value, result); for (const i in value) { @@ -2701,7 +2663,7 @@ class LoopbackPort { } if (typeof desc.value === "function") { - if (value.hasOwnProperty && value.hasOwnProperty(i)) { + if (value.hasOwnProperty?.(i)) { throw new Error(`LoopbackPort.postMessage - cannot clone: ${value[i]}`); } @@ -2714,25 +2676,15 @@ class LoopbackPort { return result; } - if (!this._defer) { - this._listeners.forEach(listener => { - listener.call(this, { - data: obj - }); - }); - - return; - } - const cloned = new WeakMap(); - const e = { + const event = { data: cloneValue(obj) }; this._deferred.then(() => { - this._listeners.forEach(listener => { - listener.call(this, e); - }); + for (const listener of this._listeners) { + listener.call(this, event); + } }); } @@ -2765,7 +2717,7 @@ const PDFWorker = function PDFWorkerClosure() { isWorkerDisabled = true; fallbackWorkerSrc = "./pdf.worker.js"; } else if (typeof document === "object" && "currentScript" in document) { - const pdfjsFilePath = document.currentScript && document.currentScript.src; + const pdfjsFilePath = document.currentScript?.src; if (pdfjsFilePath) { fallbackWorkerSrc = pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, ".worker$1$2"); @@ -2792,7 +2744,7 @@ const PDFWorker = function PDFWorkerClosure() { let mainWorkerMessageHandler; try { - mainWorkerMessageHandler = globalThis.pdfjsWorker && globalThis.pdfjsWorker.WorkerMessageHandler; + mainWorkerMessageHandler = globalThis.pdfjsWorker?.WorkerMessageHandler; } catch (ex) {} return mainWorkerMessageHandler || null; @@ -3058,7 +3010,8 @@ class WorkerTransport { this.commonObjs = new PDFObjects(); this.fontLoader = new _font_loader.FontLoader({ docId: loadingTask.docId, - onUnsupportedFeature: this._onUnsupportedFeature.bind(this) + onUnsupportedFeature: this._onUnsupportedFeature.bind(this), + ownerDocument: params.ownerDocument }); this._params = params; this.CMapReaderFactory = new params.CMapReaderFactory({ @@ -3077,6 +3030,10 @@ class WorkerTransport { this.setupMessageHandler(); } + get annotationStorage() { + return (0, _util.shadow)(this, "annotationStorage", new _annotation_storage.AnnotationStorage()); + } + destroy() { if (this.destroyCapability) { return this.destroyCapability.promise; @@ -3090,17 +3047,26 @@ class WorkerTransport { } const waitOn = []; - this.pageCache.forEach(function (page) { + + for (const page of this.pageCache) { if (page) { waitOn.push(page._destroy()); } - }); + } + this.pageCache.length = 0; this.pagePromises.length = 0; + + if (this.hasOwnProperty("annotationStorage")) { + this.annotationStorage.resetModified(); + } + const terminated = this.messageHandler.sendWithPromise("Terminate", null); waitOn.push(terminated); Promise.all(waitOn).then(() => { + this.commonObjs.clear(); this.fontLoader.clear(); + this._hasJSActionsPromise = null; if (this._networkStream) { this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")); @@ -3151,6 +3117,14 @@ class WorkerTransport { sink.onCancel = reason => { this._fullReader.cancel(reason); + + sink.ready.catch(readyReason => { + if (this.destroyed) { + return; + } + + throw readyReason; + }); }; }); messageHandler.on("ReaderHeadersReady", data => { @@ -3209,6 +3183,13 @@ class WorkerTransport { sink.onCancel = reason => { rangeReader.cancel(reason); + sink.ready.catch(readyReason => { + if (this.destroyed) { + return; + } + + throw readyReason; + }); }; }); messageHandler.on("GetDoc", ({ @@ -3243,6 +3224,11 @@ class WorkerTransport { break; } + if (!(reason instanceof Error)) { + const msg = "DocException - expected a valid Error."; + (0, _util.warn)(msg); + } + loadingTask._capability.reject(reason); }); messageHandler.on("PasswordRequest", exception => { @@ -3309,7 +3295,7 @@ class WorkerTransport { let fontRegistry = null; - if (params.pdfBug && globalThis.FontInspector && globalThis.FontInspector.enabled) { + if (params.pdfBug && globalThis.FontInspector?.enabled) { fontRegistry = { registerFont(font, url) { globalThis.FontInspector.fontAdded(font, url); @@ -3339,7 +3325,6 @@ class WorkerTransport { break; case "FontPath": - case "FontType3Res": case "Image": this.commonObjs.resolve(id, exportedData); break; @@ -3365,7 +3350,7 @@ class WorkerTransport { pageProxy.objs.resolve(id, imageData); const MAX_IMAGE_SIZE_TO_STORE = 8000000; - if (imageData && "data" in imageData && imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) { + if (imageData?.data?.length > MAX_IMAGE_SIZE_TO_STORE) { pageProxy.cleanupAfterRender = true; } @@ -3448,7 +3433,7 @@ class WorkerTransport { throw new Error("Transport destroyed"); } - const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.pdfBug); + const page = new PDFPageProxy(pageIndex, pageInfo, this, this._params.ownerDocument, this._params.pdfBug); this.pageCache[pageIndex] = page; return page; }); @@ -3471,6 +3456,28 @@ class WorkerTransport { }); } + saveDocument() { + return this.messageHandler.sendWithPromise("SaveDocument", { + numPages: this._numPages, + annotationStorage: this.annotationStorage.serializable, + filename: this._fullReader?.filename ?? null + }).finally(() => { + this.annotationStorage.resetModified(); + }); + } + + getFieldObjects() { + return this.messageHandler.sendWithPromise("GetFieldObjects", null); + } + + hasJSActions() { + return this._hasJSActionsPromise || (this._hasJSActionsPromise = this.messageHandler.sendWithPromise("HasJSActions", null)); + } + + getCalculationOrderIds() { + return this.messageHandler.sendWithPromise("GetCalculationOrderIds", null); + } + getDestinations() { return this.messageHandler.sendWithPromise("GetDestinations", null); } @@ -3513,10 +3520,38 @@ class WorkerTransport { return this.messageHandler.sendWithPromise("GetJavaScript", null); } + getDocJSActions() { + return this.messageHandler.sendWithPromise("GetDocJSActions", null); + } + + getPageJSActions(pageIndex) { + return this.messageHandler.sendWithPromise("GetPageJSActions", { + pageIndex + }); + } + + getPageXfa(pageIndex) { + return this.messageHandler.sendWithPromise("GetPageXfa", { + pageIndex + }); + } + + getStructTree(pageIndex) { + return this.messageHandler.sendWithPromise("GetStructTree", { + pageIndex + }); + } + getOutline() { return this.messageHandler.sendWithPromise("GetOutline", null); } + getOptionalContentConfig() { + return this.messageHandler.sendWithPromise("GetOptionalContentConfig", null).then(results => { + return new _optional_content_config.OptionalContentConfig(results); + }); + } + getPermissions() { return this.messageHandler.sendWithPromise("GetPermissions", null); } @@ -3526,32 +3561,48 @@ class WorkerTransport { return { info: results[0], metadata: results[1] ? new _metadata.Metadata(results[1]) : null, - contentDispositionFilename: this._fullReader ? this._fullReader.filename : null + contentDispositionFilename: this._fullReader?.filename ?? null, + contentLength: this._fullReader?.contentLength ?? null }; }); } + getMarkInfo() { + return this.messageHandler.sendWithPromise("GetMarkInfo", null); + } + getStats() { return this.messageHandler.sendWithPromise("GetStats", null); } - startCleanup() { - return this.messageHandler.sendWithPromise("Cleanup", null).then(() => { - for (let i = 0, ii = this.pageCache.length; i < ii; i++) { - const page = this.pageCache[i]; + async startCleanup(keepLoadedFonts = false) { + await this.messageHandler.sendWithPromise("Cleanup", null); - if (page) { - const cleanupSuccessful = page.cleanup(); + if (this.destroyed) { + return; + } - if (!cleanupSuccessful) { - throw new Error(`startCleanup: Page ${i + 1} is currently rendering.`); - } - } + for (let i = 0, ii = this.pageCache.length; i < ii; i++) { + const page = this.pageCache[i]; + + if (!page) { + continue; } - this.commonObjs.clear(); + const cleanupSuccessful = page.cleanup(); + + if (!cleanupSuccessful) { + throw new Error(`startCleanup: Page ${i + 1} is currently rendering.`); + } + } + + this.commonObjs.clear(); + + if (!keepLoadedFonts) { this.fontLoader.clear(); - }); + } + + this._hasJSActionsPromise = null; } get loadingParams() { @@ -3599,7 +3650,7 @@ class PDFObjects { has(objId) { const obj = this._objs[objId]; - return obj ? obj.resolved : false; + return obj?.resolved || false; } resolve(objId, data) { @@ -3644,7 +3695,6 @@ const InternalRenderTask = function InternalRenderTaskClosure() { operatorList, pageIndex, canvasFactory, - webGLContext, useRequestAnimationFrame = false, pdfBug = false }) { @@ -3656,7 +3706,6 @@ const InternalRenderTask = function InternalRenderTaskClosure() { this.operatorList = operatorList; this._pageIndex = pageIndex; this.canvasFactory = canvasFactory; - this.webGLContext = webGLContext; this._pdfBug = pdfBug; this.running = false; this.graphicsReadyCallback = null; @@ -3665,13 +3714,21 @@ const InternalRenderTask = function InternalRenderTaskClosure() { this.cancelled = false; this.capability = (0, _util.createPromiseCapability)(); this.task = new RenderTask(this); + this._cancelBound = this.cancel.bind(this); this._continueBound = this._continue.bind(this); this._scheduleNextBound = this._scheduleNext.bind(this); this._nextBound = this._next.bind(this); this._canvas = params.canvasContext.canvas; } - initializeGraphics(transparency = false) { + get completed() { + return this.capability.promise.catch(function () {}); + } + + initializeGraphics({ + transparency = false, + optionalContentConfig + }) { if (this.cancelled) { return; } @@ -3684,7 +3741,7 @@ const InternalRenderTask = function InternalRenderTaskClosure() { canvasInRendering.add(this._canvas); } - if (this._pdfBug && globalThis.StepperManager && globalThis.StepperManager.enabled) { + if (this._pdfBug && globalThis.StepperManager?.enabled) { this.stepper = globalThis.StepperManager.create(this._pageIndex); this.stepper.init(this.operatorList); this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); @@ -3697,7 +3754,7 @@ const InternalRenderTask = function InternalRenderTaskClosure() { imageLayer, background } = this.params; - this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext, imageLayer); + this.gfx = new _canvas.CanvasGraphics(canvasContext, this.commonObjs, this.objs, this.canvasFactory, imageLayer, optionalContentConfig); this.gfx.beginDrawing({ transform, viewport, @@ -3764,10 +3821,10 @@ const InternalRenderTask = function InternalRenderTaskClosure() { _scheduleNext() { if (this._useRequestAnimationFrame) { window.requestAnimationFrame(() => { - this._nextBound().catch(this.cancel.bind(this)); + this._nextBound().catch(this._cancelBound); }); } else { - Promise.resolve().then(this._nextBound).catch(this.cancel.bind(this)); + Promise.resolve().then(this._nextBound).catch(this._cancelBound); } } @@ -3798,21 +3855,20 @@ const InternalRenderTask = function InternalRenderTaskClosure() { return InternalRenderTask; }(); -const version = '2.5.207'; +const version = '2.9.359'; exports.version = version; -const build = '0974d6052'; +const build = 'e667c8cbc'; exports.build = build; /***/ }), /* 6 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.FontLoader = exports.FontFaceObject = void 0; var _util = __w_pdfjs_require__(2); @@ -3820,7 +3876,8 @@ var _util = __w_pdfjs_require__(2); class BaseFontLoader { constructor({ docId, - onUnsupportedFeature + onUnsupportedFeature, + ownerDocument = globalThis.document }) { if (this.constructor === BaseFontLoader) { (0, _util.unreachable)("Cannot initialize BaseFontLoader."); @@ -3828,22 +3885,25 @@ class BaseFontLoader { this.docId = docId; this._onUnsupportedFeature = onUnsupportedFeature; + this._document = ownerDocument; this.nativeFontFaces = []; this.styleElement = null; } addNativeFontFace(nativeFontFace) { this.nativeFontFaces.push(nativeFontFace); - document.fonts.add(nativeFontFace); + + this._document.fonts.add(nativeFontFace); } insertRule(rule) { let styleElement = this.styleElement; if (!styleElement) { - styleElement = this.styleElement = document.createElement("style"); + styleElement = this.styleElement = this._document.createElement("style"); styleElement.id = `PDFJS_FONT_STYLE_TAG_${this.docId}`; - document.documentElement.getElementsByTagName("head")[0].appendChild(styleElement); + + this._document.documentElement.getElementsByTagName("head")[0].appendChild(styleElement); } const styleSheet = styleElement.sheet; @@ -3851,9 +3911,10 @@ class BaseFontLoader { } clear() { - this.nativeFontFaces.forEach(function (nativeFontFace) { - document.fonts.delete(nativeFontFace); - }); + for (const nativeFontFace of this.nativeFontFaces) { + this._document.fonts.delete(nativeFontFace); + } + this.nativeFontFaces.length = 0; if (this.styleElement) { @@ -3913,8 +3974,7 @@ class BaseFontLoader { } get isFontLoadingAPISupported() { - const supported = typeof document !== "undefined" && !!document.fonts; - return (0, _util.shadow)(this, "isFontLoadingAPISupported", supported); + return (0, _util.shadow)(this, "isFontLoadingAPISupported", !!this._document?.fonts); } get isSyncFontLoadingSupported() { @@ -3935,8 +3995,8 @@ let FontLoader; exports.FontLoader = FontLoader; { exports.FontLoader = FontLoader = class GenericFontLoader extends BaseFontLoader { - constructor(docId) { - super(docId); + constructor(params) { + super(params); this.loadingContext = { requests: [], nextRequestId: 0 @@ -3952,7 +4012,7 @@ exports.FontLoader = FontLoader; } else { const m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent); - if (m && m[1] >= 14) { + if (m?.[1] >= 14) { supported = true; } } @@ -4002,7 +4062,9 @@ exports.FontLoader = FontLoader; } let i, ii; - const canvas = document.createElement("canvas"); + + const canvas = this._document.createElement("canvas"); + canvas.width = 1; canvas.height = 1; const ctx = canvas.getContext("2d"); @@ -4051,27 +4113,32 @@ exports.FontLoader = FontLoader; this.insertRule(rule); const names = []; - for (i = 0, ii = fonts.length; i < ii; i++) { - names.push(fonts[i].loadedName); + for (const font of fonts) { + names.push(font.loadedName); } names.push(loadTestFontId); - const div = document.createElement("div"); + + const div = this._document.createElement("div"); + div.style.visibility = "hidden"; div.style.width = div.style.height = "10px"; div.style.position = "absolute"; div.style.top = div.style.left = "0px"; - for (i = 0, ii = names.length; i < ii; ++i) { - const span = document.createElement("span"); + for (const name of names) { + const span = this._document.createElement("span"); + span.textContent = "Hi"; - span.style.fontFamily = names[i]; + span.style.fontFamily = name; div.appendChild(span); } - document.body.appendChild(div); - isFontReady(loadTestFontId, function () { - document.body.removeChild(div); + this._document.body.appendChild(div); + + isFontReady(loadTestFontId, () => { + this._document.body.removeChild(div); + request.complete(); }); } @@ -4084,7 +4151,7 @@ class FontFaceObject { isEvalSupported = true, disableFontFace = false, ignoreErrors = false, - onUnsupportedFeature = null, + onUnsupportedFeature, fontRegistry = null }) { this.compiledGlyphs = Object.create(null); @@ -4105,7 +4172,21 @@ class FontFaceObject { return null; } - const nativeFontFace = new FontFace(this.loadedName, this.data, {}); + let nativeFontFace; + + if (!this.cssFontInfo) { + nativeFontFace = new FontFace(this.loadedName, this.data, {}); + } else { + const css = { + weight: this.cssFontInfo.fontWeight + }; + + if (this.cssFontInfo.italicAngle) { + css.style = `oblique ${this.cssFontInfo.italicAngle}deg`; + } + + nativeFontFace = new FontFace(this.cssFontInfo.fontFamily, this.data, css); + } if (this.fontRegistry) { this.fontRegistry.registerFont(this); @@ -4119,9 +4200,21 @@ class FontFaceObject { return null; } - const data = (0, _util.bytesToString)(new Uint8Array(this.data)); + const data = (0, _util.bytesToString)(this.data); const url = `url(data:${this.mimetype};base64,${btoa(data)});`; - const rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`; + let rule; + + if (!this.cssFontInfo) { + rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`; + } else { + let css = `font-weight: ${this.cssFontInfo.fontWeight};`; + + if (this.cssFontInfo.italicAngle) { + css += `font-style: oblique ${this.cssFontInfo.italicAngle}deg;`; + } + + rule = `@font-face {font-family:"${this.cssFontInfo.fontFamily}";${css}src:${url}}`; + } if (this.fontRegistry) { this.fontRegistry.registerFont(this, url); @@ -4135,7 +4228,7 @@ class FontFaceObject { return this.compiledGlyphs[character]; } - let cmds, current; + let cmds; try { cmds = objs.get(this.loadedName + "_path_" + character); @@ -4144,39 +4237,27 @@ class FontFaceObject { throw ex; } - if (this._onUnsupportedFeature) { - this._onUnsupportedFeature({ - featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath - }); - } + this._onUnsupportedFeature({ + featureId: _util.UNSUPPORTED_FEATURES.errorFontGetPath + }); (0, _util.warn)(`getPathGenerator - ignoring character: "${ex}".`); return this.compiledGlyphs[character] = function (c, size) {}; } if (this.isEvalSupported && _util.IsEvalSupportedCached.value) { - let args, - js = ""; + const jsBuf = []; - for (let i = 0, ii = cmds.length; i < ii; i++) { - current = cmds[i]; - - if (current.args !== undefined) { - args = current.args.join(","); - } else { - args = ""; - } - - js += "c." + current.cmd + "(" + args + ");\n"; + for (const current of cmds) { + const args = current.args !== undefined ? current.args.join(",") : ""; + jsBuf.push("c.", current.cmd, "(", args, ");\n"); } - return this.compiledGlyphs[character] = new Function("c", "size", js); + return this.compiledGlyphs[character] = new Function("c", "size", jsBuf.join("")); } return this.compiledGlyphs[character] = function (c, size) { - for (let i = 0, ii = cmds.length; i < ii; i++) { - current = cmds[i]; - + for (const current of cmds) { if (current.cmd === "scale") { current.args = [size, -size]; } @@ -4192,14 +4273,170 @@ exports.FontFaceObject = FontFaceObject; /***/ }), /* 7 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.NodeCMapReaderFactory = exports.NodeCanvasFactory = void 0; + +var _display_utils = __w_pdfjs_require__(1); + +var _is_node = __w_pdfjs_require__(4); + +var _util = __w_pdfjs_require__(2); + +let NodeCanvasFactory = class { + constructor() { + (0, _util.unreachable)("Not implemented: NodeCanvasFactory"); + } + +}; +exports.NodeCanvasFactory = NodeCanvasFactory; +let NodeCMapReaderFactory = class { + constructor() { + (0, _util.unreachable)("Not implemented: NodeCMapReaderFactory"); + } + +}; +exports.NodeCMapReaderFactory = NodeCMapReaderFactory; + +if (_is_node.isNodeJS) { + exports.NodeCanvasFactory = NodeCanvasFactory = class extends _display_utils.BaseCanvasFactory { + create(width, height) { + if (width <= 0 || height <= 0) { + throw new Error("Invalid canvas size"); + } + + const Canvas = require("canvas"); + + const canvas = Canvas.createCanvas(width, height); + return { + canvas, + context: canvas.getContext("2d") + }; + } + + }; + exports.NodeCMapReaderFactory = NodeCMapReaderFactory = class extends _display_utils.BaseCMapReaderFactory { + _fetchData(url, compressionType) { + return new Promise((resolve, reject) => { + const fs = require("fs"); + + fs.readFile(url, (error, data) => { + if (error || !data) { + reject(new Error(error)); + return; + } + + resolve({ + cMapData: new Uint8Array(data), + compressionType + }); + }); + }); + } + + }; +} + +/***/ }), +/* 8 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.AnnotationStorage = void 0; + +var _util = __w_pdfjs_require__(2); + +class AnnotationStorage { + constructor() { + this._storage = new Map(); + this._modified = false; + this.onSetModified = null; + this.onResetModified = null; + } + + getValue(key, defaultValue) { + const obj = this._storage.get(key); + + return obj !== undefined ? obj : defaultValue; + } + + setValue(key, value) { + const obj = this._storage.get(key); + + let modified = false; + + if (obj !== undefined) { + for (const [entry, val] of Object.entries(value)) { + if (obj[entry] !== val) { + modified = true; + obj[entry] = val; + } + } + } else { + this._storage.set(key, value); + + modified = true; + } + + if (modified) { + this._setModified(); + } + } + + getAll() { + return this._storage.size > 0 ? (0, _util.objectFromMap)(this._storage) : null; + } + + get size() { + return this._storage.size; + } + + _setModified() { + if (!this._modified) { + this._modified = true; + + if (typeof this.onSetModified === "function") { + this.onSetModified(); + } + } + } + + resetModified() { + if (this._modified) { + this._modified = false; + + if (typeof this.onResetModified === "function") { + this.onResetModified(); + } + } + } + + get serializable() { + return this._storage.size > 0 ? this._storage : null; + } + +} + +exports.AnnotationStorage = AnnotationStorage; + +/***/ }), +/* 9 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); exports.apiCompatibilityParams = void 0; var _is_node = __w_pdfjs_require__(4); @@ -4216,179 +4453,190 @@ const apiCompatibilityParams = Object.freeze(compatibilityParams); exports.apiCompatibilityParams = apiCompatibilityParams; /***/ }), -/* 8 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 10 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.CanvasGraphics = void 0; var _util = __w_pdfjs_require__(2); -var _pattern_helper = __w_pdfjs_require__(9); +var _pattern_helper = __w_pdfjs_require__(11); -var MIN_FONT_SIZE = 16; -var MAX_FONT_SIZE = 100; -var MAX_GROUP_SIZE = 4096; -var MIN_WIDTH_FACTOR = 0.65; -var COMPILE_TYPE3_GLYPHS = true; -var MAX_SIZE_TO_COMPILE = 1000; -var FULL_CHUNK_HEIGHT = 16; +const MIN_FONT_SIZE = 16; +const MAX_FONT_SIZE = 100; +const MAX_GROUP_SIZE = 4096; +const COMPILE_TYPE3_GLYPHS = true; +const MAX_SIZE_TO_COMPILE = 1000; +const FULL_CHUNK_HEIGHT = 16; +const LINEWIDTH_SCALE_FACTOR = 1.000001; function addContextCurrentTransform(ctx) { - if (!ctx.mozCurrentTransform) { - ctx._originalSave = ctx.save; - ctx._originalRestore = ctx.restore; - ctx._originalRotate = ctx.rotate; - ctx._originalScale = ctx.scale; - ctx._originalTranslate = ctx.translate; - ctx._originalTransform = ctx.transform; - ctx._originalSetTransform = ctx.setTransform; - ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; - ctx._transformStack = []; - Object.defineProperty(ctx, "mozCurrentTransform", { - get: function getCurrentTransform() { - return this._transformMatrix; - } - }); - Object.defineProperty(ctx, "mozCurrentTransformInverse", { - get: function getCurrentTransformInverse() { - var m = this._transformMatrix; - var a = m[0], - b = m[1], - c = m[2], - d = m[3], - e = m[4], - f = m[5]; - var ad_bc = a * d - b * c; - var bc_ad = b * c - a * d; - return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc]; - } - }); - - ctx.save = function ctxSave() { - var old = this._transformMatrix; - - this._transformStack.push(old); - - this._transformMatrix = old.slice(0, 6); - - this._originalSave(); - }; - - ctx.restore = function ctxRestore() { - var prev = this._transformStack.pop(); - - if (prev) { - this._transformMatrix = prev; - - this._originalRestore(); - } - }; - - ctx.translate = function ctxTranslate(x, y) { - var m = this._transformMatrix; - m[4] = m[0] * x + m[2] * y + m[4]; - m[5] = m[1] * x + m[3] * y + m[5]; - - this._originalTranslate(x, y); - }; - - ctx.scale = function ctxScale(x, y) { - var m = this._transformMatrix; - m[0] = m[0] * x; - m[1] = m[1] * x; - m[2] = m[2] * y; - m[3] = m[3] * y; - - this._originalScale(x, y); - }; - - ctx.transform = function ctxTransform(a, b, c, d, e, f) { - var m = this._transformMatrix; - this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]]; - - ctx._originalTransform(a, b, c, d, e, f); - }; - - ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) { - this._transformMatrix = [a, b, c, d, e, f]; - - ctx._originalSetTransform(a, b, c, d, e, f); - }; - - ctx.rotate = function ctxRotate(angle) { - var cosValue = Math.cos(angle); - var sinValue = Math.sin(angle); - var m = this._transformMatrix; - this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]]; - - this._originalRotate(angle); - }; + if (ctx.mozCurrentTransform) { + return; } + + ctx._originalSave = ctx.save; + ctx._originalRestore = ctx.restore; + ctx._originalRotate = ctx.rotate; + ctx._originalScale = ctx.scale; + ctx._originalTranslate = ctx.translate; + ctx._originalTransform = ctx.transform; + ctx._originalSetTransform = ctx.setTransform; + ctx._originalResetTransform = ctx.resetTransform; + ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; + ctx._transformStack = []; + + try { + const desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(ctx), "lineWidth"); + ctx._setLineWidth = desc.set; + ctx._getLineWidth = desc.get; + Object.defineProperty(ctx, "lineWidth", { + set: function setLineWidth(width) { + this._setLineWidth(width * LINEWIDTH_SCALE_FACTOR); + }, + get: function getLineWidth() { + return this._getLineWidth(); + } + }); + } catch (_) {} + + Object.defineProperty(ctx, "mozCurrentTransform", { + get: function getCurrentTransform() { + return this._transformMatrix; + } + }); + Object.defineProperty(ctx, "mozCurrentTransformInverse", { + get: function getCurrentTransformInverse() { + const [a, b, c, d, e, f] = this._transformMatrix; + const ad_bc = a * d - b * c; + const bc_ad = b * c - a * d; + return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc]; + } + }); + + ctx.save = function ctxSave() { + const old = this._transformMatrix; + + this._transformStack.push(old); + + this._transformMatrix = old.slice(0, 6); + + this._originalSave(); + }; + + ctx.restore = function ctxRestore() { + const prev = this._transformStack.pop(); + + if (prev) { + this._transformMatrix = prev; + + this._originalRestore(); + } + }; + + ctx.translate = function ctxTranslate(x, y) { + const m = this._transformMatrix; + m[4] = m[0] * x + m[2] * y + m[4]; + m[5] = m[1] * x + m[3] * y + m[5]; + + this._originalTranslate(x, y); + }; + + ctx.scale = function ctxScale(x, y) { + const m = this._transformMatrix; + m[0] = m[0] * x; + m[1] = m[1] * x; + m[2] = m[2] * y; + m[3] = m[3] * y; + + this._originalScale(x, y); + }; + + ctx.transform = function ctxTransform(a, b, c, d, e, f) { + const m = this._transformMatrix; + this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]]; + + ctx._originalTransform(a, b, c, d, e, f); + }; + + ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) { + this._transformMatrix = [a, b, c, d, e, f]; + + ctx._originalSetTransform(a, b, c, d, e, f); + }; + + ctx.resetTransform = function ctxResetTransform() { + this._transformMatrix = [1, 0, 0, 1, 0, 0]; + + ctx._originalResetTransform(); + }; + + ctx.rotate = function ctxRotate(angle) { + const cosValue = Math.cos(angle); + const sinValue = Math.sin(angle); + const m = this._transformMatrix; + this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]]; + + this._originalRotate(angle); + }; } -var CachedCanvases = function CachedCanvasesClosure() { - function CachedCanvases(canvasFactory) { +class CachedCanvases { + constructor(canvasFactory) { this.canvasFactory = canvasFactory; this.cache = Object.create(null); } - CachedCanvases.prototype = { - getCanvas: function CachedCanvases_getCanvas(id, width, height, trackTransform) { - var canvasEntry; + getCanvas(id, width, height, trackTransform) { + let canvasEntry; - if (this.cache[id] !== undefined) { - canvasEntry = this.cache[id]; - this.canvasFactory.reset(canvasEntry, width, height); - canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); - } else { - canvasEntry = this.canvasFactory.create(width, height); - this.cache[id] = canvasEntry; - } - - if (trackTransform) { - addContextCurrentTransform(canvasEntry.context); - } - - return canvasEntry; - }, - - clear() { - for (var id in this.cache) { - var canvasEntry = this.cache[id]; - this.canvasFactory.destroy(canvasEntry); - delete this.cache[id]; - } + if (this.cache[id] !== undefined) { + canvasEntry = this.cache[id]; + this.canvasFactory.reset(canvasEntry, width, height); + canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); + } else { + canvasEntry = this.canvasFactory.create(width, height); + this.cache[id] = canvasEntry; } - }; - return CachedCanvases; -}(); + if (trackTransform) { + addContextCurrentTransform(canvasEntry.context); + } + + return canvasEntry; + } + + clear() { + for (const id in this.cache) { + const canvasEntry = this.cache[id]; + this.canvasFactory.destroy(canvasEntry); + delete this.cache[id]; + } + } + +} function compileType3Glyph(imgData) { - var POINT_TO_PROCESS_LIMIT = 1000; - var width = imgData.width, - height = imgData.height; - var i, - j, - j0, - width1 = width + 1; - var points = new Uint8Array(width1 * (height + 1)); - var POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); - var lineSize = width + 7 & ~7, - data0 = imgData.data; - var data = new Uint8Array(lineSize * height), - pos = 0, - ii; + const POINT_TO_PROCESS_LIMIT = 1000; + const POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); + const width = imgData.width, + height = imgData.height, + width1 = width + 1; + let i, ii, j, j0; + const points = new Uint8Array(width1 * (height + 1)); + const lineSize = width + 7 & ~7, + data0 = imgData.data; + const data = new Uint8Array(lineSize * height); + let pos = 0; for (i = 0, ii = data0.length; i < ii; i++) { - var mask = 128, - elem = data0[i]; + const elem = data0[i]; + let mask = 128; while (mask > 0) { data[pos++] = elem & mask ? 0 : 255; @@ -4396,7 +4644,7 @@ function compileType3Glyph(imgData) { } } - var count = 0; + let count = 0; pos = 0; if (data[pos] !== 0) { @@ -4427,7 +4675,7 @@ function compileType3Glyph(imgData) { ++count; } - var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0); + let sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0); for (j = 1; j < width; j++) { sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0); @@ -4476,12 +4724,12 @@ function compileType3Glyph(imgData) { return null; } - var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); - var outlines = []; + const steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); + const outlines = []; for (i = 0; count && i <= height; i++) { - var p = i * width1; - var end = p + width; + let p = i * width1; + const end = p + width; while (p < end && !points[p]) { p++; @@ -4491,19 +4739,18 @@ function compileType3Glyph(imgData) { continue; } - var coords = [p % width1, i]; - var type = points[p], - p0 = p, - pp; + const coords = [p % width1, i]; + const p0 = p; + let type = points[p]; do { - var step = steps[type]; + const step = steps[type]; do { p += step; } while (!points[p]); - pp = points[p]; + const pp = points[p]; if (pp !== 5 && pp !== 10) { type = pp; @@ -4513,8 +4760,7 @@ function compileType3Glyph(imgData) { points[p] &= type >> 2 | type << 2; } - coords.push(p % width1); - coords.push(p / width1 | 0); + coords.push(p % width1, p / width1 | 0); if (!points[p]) { --count; @@ -4525,14 +4771,14 @@ function compileType3Glyph(imgData) { --i; } - var drawOutline = function (c) { + const drawOutline = function (c) { c.save(); c.scale(1 / width, -1 / height); c.translate(0, -height); c.beginPath(); for (let k = 0, kk = outlines.length; k < kk; k++) { - var o = outlines[k]; + const o = outlines[k]; c.moveTo(o[0], o[1]); for (let l = 2, ll = o.length; l < ll; l += 2) { @@ -4548,8 +4794,8 @@ function compileType3Glyph(imgData) { return drawOutline; } -var CanvasExtraState = function CanvasExtraStateClosure() { - function CanvasExtraState() { +class CanvasExtraState { + constructor() { this.alphaIsShape = false; this.fontSize = 0; this.fontSizeScale = 1; @@ -4574,91 +4820,86 @@ var CanvasExtraState = function CanvasExtraStateClosure() { this.lineWidth = 1; this.activeSMask = null; this.resumeSMaskCtx = null; + this.transferMaps = null; } - CanvasExtraState.prototype = { - clone: function CanvasExtraState_clone() { - return Object.create(this); - }, - setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) { - this.x = x; - this.y = y; - } - }; - return CanvasExtraState; -}(); - -var CanvasGraphics = function CanvasGraphicsClosure() { - var EXECUTION_TIME = 15; - var EXECUTION_STEPS = 10; - - function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, webGLContext, imageLayer) { - this.ctx = canvasCtx; - this.current = new CanvasExtraState(); - this.stateStack = []; - this.pendingClip = null; - this.pendingEOFill = false; - this.res = null; - this.xobjs = null; - this.commonObjs = commonObjs; - this.objs = objs; - this.canvasFactory = canvasFactory; - this.webGLContext = webGLContext; - this.imageLayer = imageLayer; - this.groupStack = []; - this.processingType3 = null; - this.baseTransform = null; - this.baseTransformStack = []; - this.groupLevel = 0; - this.smaskStack = []; - this.smaskCounter = 0; - this.tempSMask = null; - this.cachedCanvases = new CachedCanvases(this.canvasFactory); - - if (canvasCtx) { - addContextCurrentTransform(canvasCtx); - } - - this._cachedGetSinglePixelWidth = null; + clone() { + return Object.create(this); } - function putBinaryImageData(ctx, imgData) { + setCurrentPoint(x, y) { + this.x = x; + this.y = y; + } + +} + +const CanvasGraphics = function CanvasGraphicsClosure() { + const EXECUTION_TIME = 15; + const EXECUTION_STEPS = 10; + + function putBinaryImageData(ctx, imgData, transferMaps = null) { if (typeof ImageData !== "undefined" && imgData instanceof ImageData) { ctx.putImageData(imgData, 0, 0); return; } - var height = imgData.height, - width = imgData.width; - var partialChunkHeight = height % FULL_CHUNK_HEIGHT; - var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; - var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; - var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); - var srcPos = 0, + const height = imgData.height, + width = imgData.width; + const partialChunkHeight = height % FULL_CHUNK_HEIGHT; + const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; + const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; + const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); + let srcPos = 0, destPos; - var src = imgData.data; - var dest = chunkImgData.data; - var i, j, thisChunkHeight, elemsInThisChunk; + const src = imgData.data; + const dest = chunkImgData.data; + let i, j, thisChunkHeight, elemsInThisChunk; + let transferMapRed, transferMapGreen, transferMapBlue, transferMapGray; + + if (transferMaps) { + switch (transferMaps.length) { + case 1: + transferMapRed = transferMaps[0]; + transferMapGreen = transferMaps[0]; + transferMapBlue = transferMaps[0]; + transferMapGray = transferMaps[0]; + break; + + case 4: + transferMapRed = transferMaps[0]; + transferMapGreen = transferMaps[1]; + transferMapBlue = transferMaps[2]; + transferMapGray = transferMaps[3]; + break; + } + } if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) { - var srcLength = src.byteLength; - var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2); - var dest32DataLength = dest32.length; - var fullSrcDiff = width + 7 >> 3; - var white = 0xffffffff; - var black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff; + const srcLength = src.byteLength; + const dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2); + const dest32DataLength = dest32.length; + const fullSrcDiff = width + 7 >> 3; + let white = 0xffffffff; + let black = _util.IsLittleEndianCached.value ? 0xff000000 : 0x000000ff; + + if (transferMapGray) { + if (transferMapGray[0] === 0xff && transferMapGray[0xff] === 0) { + [white, black] = [black, white]; + } + } for (i = 0; i < totalChunks; i++) { thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; destPos = 0; for (j = 0; j < thisChunkHeight; j++) { - var srcDiff = srcLength - srcPos; - var k = 0; - var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7; - var kEndUnrolled = kEnd & ~7; - var mask = 0; - var srcByte = 0; + const srcDiff = srcLength - srcPos; + let k = 0; + const kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7; + const kEndUnrolled = kEnd & ~7; + let mask = 0; + let srcByte = 0; for (; k < kEndUnrolled; k += 8) { srcByte = src[srcPos++]; @@ -4690,12 +4931,30 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); } } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) { + const hasTransferMaps = !!(transferMapRed || transferMapGreen || transferMapBlue); j = 0; elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4; for (i = 0; i < fullChunks; i++) { dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); srcPos += elemsInThisChunk; + + if (hasTransferMaps) { + for (let k = 0; k < elemsInThisChunk; k += 4) { + if (transferMapRed) { + dest[k + 0] = transferMapRed[dest[k + 0]]; + } + + if (transferMapGreen) { + dest[k + 1] = transferMapGreen[dest[k + 1]]; + } + + if (transferMapBlue) { + dest[k + 2] = transferMapBlue[dest[k + 2]]; + } + } + } + ctx.putImageData(chunkImgData, 0, j); j += FULL_CHUNK_HEIGHT; } @@ -4703,9 +4962,27 @@ var CanvasGraphics = function CanvasGraphicsClosure() { if (i < totalChunks) { elemsInThisChunk = width * partialChunkHeight * 4; dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); + + if (hasTransferMaps) { + for (let k = 0; k < elemsInThisChunk; k += 4) { + if (transferMapRed) { + dest[k + 0] = transferMapRed[dest[k + 0]]; + } + + if (transferMapGreen) { + dest[k + 1] = transferMapGreen[dest[k + 1]]; + } + + if (transferMapBlue) { + dest[k + 2] = transferMapBlue[dest[k + 2]]; + } + } + } + ctx.putImageData(chunkImgData, 0, j); } } else if (imgData.kind === _util.ImageKind.RGB_24BPP) { + const hasTransferMaps = !!(transferMapRed || transferMapGreen || transferMapBlue); thisChunkHeight = FULL_CHUNK_HEIGHT; elemsInThisChunk = width * thisChunkHeight; @@ -4724,6 +5001,22 @@ var CanvasGraphics = function CanvasGraphicsClosure() { dest[destPos++] = 255; } + if (hasTransferMaps) { + for (let k = 0; k < destPos; k += 4) { + if (transferMapRed) { + dest[k + 0] = transferMapRed[dest[k + 0]]; + } + + if (transferMapGreen) { + dest[k + 1] = transferMapGreen[dest[k + 1]]; + } + + if (transferMapBlue) { + dest[k + 2] = transferMapBlue[dest[k + 2]]; + } + } + } + ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); } } else { @@ -4732,26 +5025,27 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } function putBinaryImageMask(ctx, imgData) { - var height = imgData.height, - width = imgData.width; - var partialChunkHeight = height % FULL_CHUNK_HEIGHT; - var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; - var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; - var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); - var srcPos = 0; - var src = imgData.data; - var dest = chunkImgData.data; + const height = imgData.height, + width = imgData.width; + const partialChunkHeight = height % FULL_CHUNK_HEIGHT; + const fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; + const totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; + const chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); + let srcPos = 0; + const src = imgData.data; + const dest = chunkImgData.data; - for (var i = 0; i < totalChunks; i++) { - var thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; - var destPos = 3; + for (let i = 0; i < totalChunks; i++) { + const thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; + let destPos = 3; - for (var j = 0; j < thisChunkHeight; j++) { - var mask = 0; + for (let j = 0; j < thisChunkHeight; j++) { + let elem, + mask = 0; - for (var k = 0; k < width; k++) { + for (let k = 0; k < width; k++) { if (!mask) { - var elem = src[srcPos++]; + elem = src[srcPos++]; mask = 128; } @@ -4766,10 +5060,10 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } function copyCtxState(sourceCtx, destCtx) { - var properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font"]; + const properties = ["strokeStyle", "fillStyle", "fillRule", "globalAlpha", "lineWidth", "lineCap", "lineJoin", "miterLimit", "globalCompositeOperation", "font"]; - for (var i = 0, ii = properties.length; i < ii; i++) { - var property = properties[i]; + for (let i = 0, ii = properties.length; i < ii; i++) { + const property = properties[i]; if (sourceCtx[property] !== undefined) { destCtx[property] = sourceCtx[property]; @@ -4801,17 +5095,17 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } function composeSMaskBackdrop(bytes, r0, g0, b0) { - var length = bytes.length; + const length = bytes.length; - for (var i = 3; i < length; i += 4) { - var alpha = bytes[i]; + for (let i = 3; i < length; i += 4) { + const alpha = bytes[i]; if (alpha === 0) { bytes[i - 3] = r0; bytes[i - 2] = g0; bytes[i - 1] = b0; } else if (alpha < 255) { - var alpha_ = 255 - alpha; + const alpha_ = 255 - alpha; bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8; bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8; bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8; @@ -4820,30 +5114,30 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } function composeSMaskAlpha(maskData, layerData, transferMap) { - var length = maskData.length; - var scale = 1 / 255; + const length = maskData.length; + const scale = 1 / 255; - for (var i = 3; i < length; i += 4) { - var alpha = transferMap ? transferMap[maskData[i]] : maskData[i]; + for (let i = 3; i < length; i += 4) { + const alpha = transferMap ? transferMap[maskData[i]] : maskData[i]; layerData[i] = layerData[i] * alpha * scale | 0; } } function composeSMaskLuminosity(maskData, layerData, transferMap) { - var length = maskData.length; + const length = maskData.length; - for (var i = 3; i < length; i += 4) { - var y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28; + for (let i = 3; i < length; i += 4) { + const y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28; layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16; } } function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap) { - var hasBackdrop = !!backdrop; - var r0 = hasBackdrop ? backdrop[0] : 0; - var g0 = hasBackdrop ? backdrop[1] : 0; - var b0 = hasBackdrop ? backdrop[2] : 0; - var composeFn; + const hasBackdrop = !!backdrop; + const r0 = hasBackdrop ? backdrop[0] : 0; + const g0 = hasBackdrop ? backdrop[1] : 0; + const b0 = hasBackdrop ? backdrop[2] : 0; + let composeFn; if (subtype === "Luminosity") { composeFn = composeSMaskLuminosity; @@ -4851,13 +5145,13 @@ var CanvasGraphics = function CanvasGraphicsClosure() { composeFn = composeSMaskAlpha; } - var PIXELS_TO_PROCESS = 1048576; - var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width)); + const PIXELS_TO_PROCESS = 1048576; + const chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width)); - for (var row = 0; row < height; row += chunkSize) { - var chunkHeight = Math.min(chunkSize, height - row); - var maskData = maskCtx.getImageData(0, row, width, chunkHeight); - var layerData = layerCtx.getImageData(0, row, width, chunkHeight); + for (let row = 0; row < height; row += chunkSize) { + const chunkHeight = Math.min(chunkSize, height - row); + const maskData = maskCtx.getImageData(0, row, width, chunkHeight); + const layerData = layerCtx.getImageData(0, row, width, chunkHeight); if (hasBackdrop) { composeSMaskBackdrop(maskData.data, r0, g0, b0); @@ -4868,50 +5162,67 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } } - function composeSMask(ctx, smask, layerCtx, webGLContext) { - var mask = smask.canvas; - var maskCtx = smask.context; + function composeSMask(ctx, smask, layerCtx) { + const mask = smask.canvas; + const maskCtx = smask.context; ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, smask.offsetX, smask.offsetY); - var backdrop = smask.backdrop || null; - - if (!smask.transferMap && webGLContext.isEnabled) { - const composed = webGLContext.composeSMask({ - layer: layerCtx.canvas, - mask, - properties: { - subtype: smask.subtype, - backdrop - } - }); - ctx.setTransform(1, 0, 0, 1, 0, 0); - ctx.drawImage(composed, smask.offsetX, smask.offsetY); - return; - } - - genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, backdrop, smask.transferMap); + genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, smask.backdrop, smask.transferMap); ctx.drawImage(mask, 0, 0); } - var LINE_CAP_STYLES = ["butt", "round", "square"]; - var LINE_JOIN_STYLES = ["miter", "round", "bevel"]; - var NORMAL_CLIP = {}; - var EO_CLIP = {}; - CanvasGraphics.prototype = { + const LINE_CAP_STYLES = ["butt", "round", "square"]; + const LINE_JOIN_STYLES = ["miter", "round", "bevel"]; + const NORMAL_CLIP = {}; + const EO_CLIP = {}; + + class CanvasGraphics { + constructor(canvasCtx, commonObjs, objs, canvasFactory, imageLayer, optionalContentConfig) { + this.ctx = canvasCtx; + this.current = new CanvasExtraState(); + this.stateStack = []; + this.pendingClip = null; + this.pendingEOFill = false; + this.res = null; + this.xobjs = null; + this.commonObjs = commonObjs; + this.objs = objs; + this.canvasFactory = canvasFactory; + this.imageLayer = imageLayer; + this.groupStack = []; + this.processingType3 = null; + this.baseTransform = null; + this.baseTransformStack = []; + this.groupLevel = 0; + this.smaskStack = []; + this.smaskCounter = 0; + this.tempSMask = null; + this.contentVisible = true; + this.markedContentStack = []; + this.optionalContentConfig = optionalContentConfig; + this.cachedCanvases = new CachedCanvases(this.canvasFactory); + + if (canvasCtx) { + addContextCurrentTransform(canvasCtx); + } + + this._cachedGetSinglePixelWidth = null; + } + beginDrawing({ transform, viewport, transparency = false, background = null }) { - var width = this.ctx.canvas.width; - var height = this.ctx.canvas.height; + const width = this.ctx.canvas.width; + const height = this.ctx.canvas.height; this.ctx.save(); this.ctx.fillStyle = background || "rgb(255, 255, 255)"; this.ctx.fillRect(0, 0, width, height); this.ctx.restore(); if (transparency) { - var transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height, true); + const transparentCanvas = this.cachedCanvases.getCanvas("transparent", width, height, true); this.compositeCtx = this.ctx; this.transparentCanvas = transparentCanvas.canvas; this.ctx = transparentCanvas.context; @@ -4928,28 +5239,29 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.ctx.transform.apply(this.ctx, viewport.transform); this.baseTransform = this.ctx.mozCurrentTransform.slice(); + this._combinedScaleFactor = Math.hypot(this.baseTransform[0], this.baseTransform[2]); if (this.imageLayer) { this.imageLayer.beginLayout(); } - }, + } - executeOperatorList: function CanvasGraphics_executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) { - var argsArray = operatorList.argsArray; - var fnArray = operatorList.fnArray; - var i = executionStartIdx || 0; - var argsArrayLen = argsArray.length; + executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) { + const argsArray = operatorList.argsArray; + const fnArray = operatorList.fnArray; + let i = executionStartIdx || 0; + const argsArrayLen = argsArray.length; if (argsArrayLen === i) { return i; } - var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function"; - var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0; - var steps = 0; - var commonObjs = this.commonObjs; - var objs = this.objs; - var fnId; + const chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === "function"; + const endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0; + let steps = 0; + const commonObjs = this.commonObjs; + const objs = this.objs; + let fnId; while (true) { if (stepper !== undefined && i === stepper.nextBreakPoint) { @@ -4987,10 +5299,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() { steps = 0; } } - }, - endDrawing: function CanvasGraphics_endDrawing() { - if (this.current.activeSMask !== null) { - this.endSMaskGroup(); + } + + endDrawing() { + while (this.stateStack.length || this.current.activeSMask !== null) { + this.restore(); } this.ctx.restore(); @@ -5005,43 +5318,47 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } this.cachedCanvases.clear(); - this.webGLContext.clear(); if (this.imageLayer) { this.imageLayer.endLayout(); } - }, - setLineWidth: function CanvasGraphics_setLineWidth(width) { + } + + setLineWidth(width) { this.current.lineWidth = width; this.ctx.lineWidth = width; - }, - setLineCap: function CanvasGraphics_setLineCap(style) { + } + + setLineCap(style) { this.ctx.lineCap = LINE_CAP_STYLES[style]; - }, - setLineJoin: function CanvasGraphics_setLineJoin(style) { + } + + setLineJoin(style) { this.ctx.lineJoin = LINE_JOIN_STYLES[style]; - }, - setMiterLimit: function CanvasGraphics_setMiterLimit(limit) { + } + + setMiterLimit(limit) { this.ctx.miterLimit = limit; - }, - setDash: function CanvasGraphics_setDash(dashArray, dashPhase) { - var ctx = this.ctx; + } + + setDash(dashArray, dashPhase) { + const ctx = this.ctx; if (ctx.setLineDash !== undefined) { ctx.setLineDash(dashArray); ctx.lineDashOffset = dashPhase; } - }, + } - setRenderingIntent(intent) {}, + setRenderingIntent(intent) {} - setFlatness(flatness) {}, + setFlatness(flatness) {} - setGState: function CanvasGraphics_setGState(states) { - for (var i = 0, ii = states.length; i < ii; i++) { - var state = states[i]; - var key = state[0]; - var value = state[1]; + setGState(states) { + for (let i = 0, ii = states.length; i < ii; i++) { + const state = states[i]; + const key = state[0]; + const value = state[1]; switch (key) { case "LW": @@ -5106,19 +5423,23 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.tempSMask = null; break; + + case "TR": + this.current.transferMaps = value; } } - }, - beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() { - var activeSMask = this.current.activeSMask; - var drawnWidth = activeSMask.canvas.width; - var drawnHeight = activeSMask.canvas.height; - var cacheId = "smaskGroupAt" + this.groupLevel; - var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); - var currentCtx = this.ctx; - var currentTransform = currentCtx.mozCurrentTransform; + } + + beginSMaskGroup() { + const activeSMask = this.current.activeSMask; + const drawnWidth = activeSMask.canvas.width; + const drawnHeight = activeSMask.canvas.height; + const cacheId = "smaskGroupAt" + this.groupLevel; + const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); + const currentCtx = this.ctx; + const currentTransform = currentCtx.mozCurrentTransform; this.ctx.save(); - var groupCtx = scratchCanvas.context; + const groupCtx = scratchCanvas.context; groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY); groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY); groupCtx.transform.apply(groupCtx, currentTransform); @@ -5128,52 +5449,57 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.setGState([["BM", "source-over"], ["ca", 1], ["CA", 1]]); this.groupStack.push(currentCtx); this.groupLevel++; - }, - suspendSMaskGroup: function CanvasGraphics_endSMaskGroup() { - var groupCtx = this.ctx; + } + + suspendSMaskGroup() { + const groupCtx = this.ctx; this.groupLevel--; this.ctx = this.groupStack.pop(); - composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext); + composeSMask(this.ctx, this.current.activeSMask, groupCtx); this.ctx.restore(); this.ctx.save(); copyCtxState(groupCtx, this.ctx); this.current.resumeSMaskCtx = groupCtx; - var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); + const deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); this.ctx.transform.apply(this.ctx, deltaTransform); groupCtx.save(); groupCtx.setTransform(1, 0, 0, 1, 0, 0); groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height); groupCtx.restore(); - }, - resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() { - var groupCtx = this.current.resumeSMaskCtx; - var currentCtx = this.ctx; + } + + resumeSMaskGroup() { + const groupCtx = this.current.resumeSMaskCtx; + const currentCtx = this.ctx; this.ctx = groupCtx; this.groupStack.push(currentCtx); this.groupLevel++; - }, - endSMaskGroup: function CanvasGraphics_endSMaskGroup() { - var groupCtx = this.ctx; + } + + endSMaskGroup() { + const groupCtx = this.ctx; this.groupLevel--; this.ctx = this.groupStack.pop(); - composeSMask(this.ctx, this.current.activeSMask, groupCtx, this.webGLContext); + composeSMask(this.ctx, this.current.activeSMask, groupCtx); this.ctx.restore(); copyCtxState(groupCtx, this.ctx); - var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); + const deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); this.ctx.transform.apply(this.ctx, deltaTransform); - }, - save: function CanvasGraphics_save() { + } + + save() { this.ctx.save(); - var old = this.current; + const old = this.current; this.stateStack.push(old); this.current = old.clone(); this.current.resumeSMaskCtx = null; - }, - restore: function CanvasGraphics_restore() { + } + + restore() { if (this.current.resumeSMaskCtx) { this.resumeSMaskGroup(); } @@ -5187,42 +5513,42 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.ctx.restore(); this.pendingClip = null; this._cachedGetSinglePixelWidth = null; + } else { + this.current.activeSMask = null; } - }, - transform: function CanvasGraphics_transform(a, b, c, d, e, f) { + } + + transform(a, b, c, d, e, f) { this.ctx.transform(a, b, c, d, e, f); this._cachedGetSinglePixelWidth = null; - }, - constructPath: function CanvasGraphics_constructPath(ops, args) { - var ctx = this.ctx; - var current = this.current; - var x = current.x, + } + + constructPath(ops, args) { + const ctx = this.ctx; + const current = this.current; + let x = current.x, y = current.y; - for (var i = 0, j = 0, ii = ops.length; i < ii; i++) { + for (let i = 0, j = 0, ii = ops.length; i < ii; i++) { switch (ops[i] | 0) { case _util.OPS.rectangle: x = args[j++]; y = args[j++]; - var width = args[j++]; - var height = args[j++]; + const width = args[j++]; + const height = args[j++]; + const xw = x + width; + const yh = y + height; + ctx.moveTo(x, y); - if (width === 0) { - width = this.getSinglePixelWidth(); + if (width === 0 || height === 0) { + ctx.lineTo(xw, yh); + } else { + ctx.lineTo(xw, y); + ctx.lineTo(xw, yh); + ctx.lineTo(x, yh); } - if (height === 0) { - height = this.getSinglePixelWidth(); - } - - var xw = x + width; - var yh = y + height; - this.ctx.moveTo(x, y); - this.ctx.lineTo(xw, y); - this.ctx.lineTo(xw, yh); - this.ctx.lineTo(x, yh); - this.ctx.lineTo(x, y); - this.ctx.closePath(); + ctx.closePath(); break; case _util.OPS.moveTo: @@ -5265,29 +5591,40 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } current.setCurrentPoint(x, y); - }, - closePath: function CanvasGraphics_closePath() { + } + + closePath() { this.ctx.closePath(); - }, - stroke: function CanvasGraphics_stroke(consumePath) { + } + + stroke(consumePath) { consumePath = typeof consumePath !== "undefined" ? consumePath : true; - var ctx = this.ctx; - var strokeColor = this.current.strokeColor; + const ctx = this.ctx; + const strokeColor = this.current.strokeColor; ctx.globalAlpha = this.current.strokeAlpha; - if (strokeColor && strokeColor.hasOwnProperty("type") && strokeColor.type === "Pattern") { - ctx.save(); - const transform = ctx.mozCurrentTransform; + if (this.contentVisible) { + if (typeof strokeColor === "object" && strokeColor?.getPattern) { + const lineWidth = this.getSinglePixelWidth(); + ctx.save(); + ctx.strokeStyle = strokeColor.getPattern(ctx, this); + ctx.lineWidth = Math.max(lineWidth, this.current.lineWidth); + ctx.stroke(); + ctx.restore(); + } else { + const lineWidth = this.getSinglePixelWidth(); - const scale = _util.Util.singularValueDecompose2dScale(transform)[0]; - - ctx.strokeStyle = strokeColor.getPattern(ctx, this); - ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth * scale); - ctx.stroke(); - ctx.restore(); - } else { - ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth); - ctx.stroke(); + if (lineWidth < 0 && -lineWidth >= this.current.lineWidth) { + ctx.save(); + ctx.resetTransform(); + ctx.lineWidth = Math.round(this._combinedScaleFactor); + ctx.stroke(); + ctx.restore(); + } else { + ctx.lineWidth = Math.max(lineWidth, this.current.lineWidth); + ctx.stroke(); + } + } } if (consumePath) { @@ -5295,34 +5632,33 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } ctx.globalAlpha = this.current.fillAlpha; - }, - closeStroke: function CanvasGraphics_closeStroke() { + } + + closeStroke() { this.closePath(); this.stroke(); - }, - fill: function CanvasGraphics_fill(consumePath) { + } + + fill(consumePath) { consumePath = typeof consumePath !== "undefined" ? consumePath : true; - var ctx = this.ctx; - var fillColor = this.current.fillColor; - var isPatternFill = this.current.patternFill; - var needRestore = false; + const ctx = this.ctx; + const fillColor = this.current.fillColor; + const isPatternFill = this.current.patternFill; + let needRestore = false; if (isPatternFill) { ctx.save(); - - if (this.baseTransform) { - ctx.setTransform.apply(ctx, this.baseTransform); - } - ctx.fillStyle = fillColor.getPattern(ctx, this); needRestore = true; } - if (this.pendingEOFill) { - ctx.fill("evenodd"); - this.pendingEOFill = false; - } else { - ctx.fill(); + if (this.contentVisible) { + if (this.pendingEOFill) { + ctx.fill("evenodd"); + this.pendingEOFill = false; + } else { + ctx.fill(); + } } if (needRestore) { @@ -5332,47 +5668,57 @@ var CanvasGraphics = function CanvasGraphicsClosure() { if (consumePath) { this.consumePath(); } - }, - eoFill: function CanvasGraphics_eoFill() { + } + + eoFill() { this.pendingEOFill = true; this.fill(); - }, - fillStroke: function CanvasGraphics_fillStroke() { + } + + fillStroke() { this.fill(false); this.stroke(false); this.consumePath(); - }, - eoFillStroke: function CanvasGraphics_eoFillStroke() { + } + + eoFillStroke() { this.pendingEOFill = true; this.fillStroke(); - }, - closeFillStroke: function CanvasGraphics_closeFillStroke() { + } + + closeFillStroke() { this.closePath(); this.fillStroke(); - }, - closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() { + } + + closeEOFillStroke() { this.pendingEOFill = true; this.closePath(); this.fillStroke(); - }, - endPath: function CanvasGraphics_endPath() { + } + + endPath() { this.consumePath(); - }, - clip: function CanvasGraphics_clip() { + } + + clip() { this.pendingClip = NORMAL_CLIP; - }, - eoClip: function CanvasGraphics_eoClip() { + } + + eoClip() { this.pendingClip = EO_CLIP; - }, - beginText: function CanvasGraphics_beginText() { + } + + beginText() { this.current.textMatrix = _util.IDENTITY_MATRIX; this.current.textMatrixScale = 1; this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; - }, - endText: function CanvasGraphics_endText() { - var paths = this.pendingTextPaths; - var ctx = this.ctx; + } + + endText() { + const paths = this.pendingTextPaths; + const ctx = this.ctx; if (paths === undefined) { ctx.beginPath(); @@ -5382,8 +5728,8 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.save(); ctx.beginPath(); - for (var i = 0; i < paths.length; i++) { - var path = paths[i]; + for (let i = 0; i < paths.length; i++) { + const path = paths[i]; ctx.setTransform.apply(ctx, path.transform); ctx.translate(path.x, path.y); path.addToPath(ctx, path.fontSize); @@ -5393,28 +5739,33 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.clip(); ctx.beginPath(); delete this.pendingTextPaths; - }, - setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) { + } + + setCharSpacing(spacing) { this.current.charSpacing = spacing; - }, - setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) { + } + + setWordSpacing(spacing) { this.current.wordSpacing = spacing; - }, - setHScale: function CanvasGraphics_setHScale(scale) { + } + + setHScale(scale) { this.current.textHScale = scale / 100; - }, - setLeading: function CanvasGraphics_setLeading(leading) { + } + + setLeading(leading) { this.current.leading = -leading; - }, - setFont: function CanvasGraphics_setFont(fontRefName, size) { - var fontObj = this.commonObjs.get(fontRefName); - var current = this.current; + } + + setFont(fontRefName, size) { + const fontObj = this.commonObjs.get(fontRefName); + const current = this.current; if (!fontObj) { throw new Error(`Can't find font for ${fontRefName}`); } - current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; + current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX; if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) { (0, _util.warn)("Invalid font matrix for font " + fontRefName); @@ -5434,7 +5785,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { return; } - var name = fontObj.loadedName || "sans-serif"; + const name = fontObj.loadedName || "sans-serif"; let bold = "normal"; if (fontObj.black) { @@ -5443,8 +5794,8 @@ var CanvasGraphics = function CanvasGraphicsClosure() { bold = "bold"; } - var italic = fontObj.italic ? "italic" : "normal"; - var typeface = `"${name}", ${fontObj.fallbackName}`; + const italic = fontObj.italic ? "italic" : "normal"; + const typeface = `"${name}", ${fontObj.fallbackName}`; let browserFontSize = size; if (size < MIN_FONT_SIZE) { @@ -5455,41 +5806,47 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.current.fontSizeScale = size / browserFontSize; this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`; - }, - setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) { + } + + setTextRenderingMode(mode) { this.current.textRenderingMode = mode; - }, - setTextRise: function CanvasGraphics_setTextRise(rise) { + } + + setTextRise(rise) { this.current.textRise = rise; - }, - moveText: function CanvasGraphics_moveText(x, y) { + } + + moveText(x, y) { this.current.x = this.current.lineX += x; this.current.y = this.current.lineY += y; - }, - setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) { + } + + setLeadingMoveText(x, y) { this.setLeading(-y); this.moveText(x, y); - }, - setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) { + } + + setTextMatrix(a, b, c, d, e, f) { this.current.textMatrix = [a, b, c, d, e, f]; - this.current.textMatrixScale = Math.sqrt(a * a + b * b); + this.current.textMatrixScale = Math.hypot(a, b); this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; - }, - nextLine: function CanvasGraphics_nextLine() { - this.moveText(0, this.current.leading); - }, + } - paintChar(character, x, y, patternTransform) { - var ctx = this.ctx; - var current = this.current; - var font = current.font; - var textRenderingMode = current.textRenderingMode; - var fontSize = current.fontSize / current.fontSizeScale; - var fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; - var isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); + nextLine() { + this.moveText(0, this.current.leading); + } + + paintChar(character, x, y, patternTransform, resetLineWidthToOne) { + const ctx = this.ctx; + const current = this.current; + const font = current.font; + const textRenderingMode = current.textRenderingMode; + const fontSize = current.fontSize / current.fontSizeScale; + const fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; + const isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); const patternFill = current.patternFill && !font.missingFile; - var addToPath; + let addToPath; if (font.disableFontFace || isAddToPathSet || patternFill) { addToPath = font.getPathGenerator(this.commonObjs, character); @@ -5510,6 +5867,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { + if (resetLineWidthToOne) { + ctx.resetTransform(); + ctx.lineWidth = Math.round(this._combinedScaleFactor); + } + ctx.stroke(); } @@ -5520,12 +5882,21 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { - ctx.strokeText(character, x, y); + if (resetLineWidthToOne) { + ctx.save(); + ctx.moveTo(x, y); + ctx.resetTransform(); + ctx.lineWidth = Math.round(this._combinedScaleFactor); + ctx.strokeText(character, 0, 0); + ctx.restore(); + } else { + ctx.strokeText(character, x, y); + } } } if (isAddToPathSet) { - var paths = this.pendingTextPaths || (this.pendingTextPaths = []); + const paths = this.pendingTextPaths || (this.pendingTextPaths = []); paths.push({ transform: ctx.mozCurrentTransform, x, @@ -5534,7 +5905,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { addToPath }); } - }, + } get isFontSubpixelAAEnabled() { const { @@ -5542,10 +5913,10 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } = this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled", 10, 10); ctx.scale(1.5, 1); ctx.fillText("I", 0, 10); - var data = ctx.getImageData(0, 0, 10, 10).data; - var enabled = false; + const data = ctx.getImageData(0, 0, 10, 10).data; + let enabled = false; - for (var i = 3; i < data.length; i += 4) { + for (let i = 3; i < data.length; i += 4) { if (data[i] > 0 && data[i] < 255) { enabled = true; break; @@ -5553,34 +5924,34 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } return (0, _util.shadow)(this, "isFontSubpixelAAEnabled", enabled); - }, + } - showText: function CanvasGraphics_showText(glyphs) { - var current = this.current; - var font = current.font; + showText(glyphs) { + const current = this.current; + const font = current.font; if (font.isType3Font) { return this.showType3Text(glyphs); } - var fontSize = current.fontSize; + const fontSize = current.fontSize; if (fontSize === 0) { return undefined; } - var ctx = this.ctx; - var fontSizeScale = current.fontSizeScale; - var charSpacing = current.charSpacing; - var wordSpacing = current.wordSpacing; - var fontDirection = current.fontDirection; - var textHScale = current.textHScale * fontDirection; - var glyphsLength = glyphs.length; - var vertical = font.vertical; - var spacingDir = vertical ? 1 : -1; - var defaultVMetrics = font.defaultVMetrics; - var widthAdvanceScale = fontSize * current.fontMatrix[0]; - var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill; + const ctx = this.ctx; + const fontSizeScale = current.fontSizeScale; + const charSpacing = current.charSpacing; + const wordSpacing = current.wordSpacing; + const fontDirection = current.fontDirection; + const textHScale = current.textHScale * fontDirection; + const glyphsLength = glyphs.length; + const vertical = font.vertical; + const spacingDir = vertical ? 1 : -1; + const defaultVMetrics = font.defaultVMetrics; + const widthAdvanceScale = fontSize * current.fontMatrix[0]; + const simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace && !current.patternFill; ctx.save(); let patternTransform; @@ -5601,15 +5972,17 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.scale(textHScale, 1); } - var lineWidth = current.lineWidth; - var scale = current.textMatrixScale; + let lineWidth = current.lineWidth; + let resetLineWidthToOne = false; + const scale = current.textMatrixScale; if (scale === 0 || lineWidth === 0) { - var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; + const fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { this._cachedGetSinglePixelWidth = null; - lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR; + lineWidth = this.getSinglePixelWidth(); + resetLineWidthToOne = lineWidth < 0; } } else { lineWidth /= scale; @@ -5621,30 +5994,28 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } ctx.lineWidth = lineWidth; - var x = 0, + let x = 0, i; for (i = 0; i < glyphsLength; ++i) { - var glyph = glyphs[i]; + const glyph = glyphs[i]; if ((0, _util.isNum)(glyph)) { x += spacingDir * glyph * fontSize / 1000; continue; } - var restoreNeeded = false; - var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; - var character = glyph.fontChar; - var accent = glyph.accent; - var scaledX, scaledY, scaledAccentX, scaledAccentY; - var width = glyph.width; + let restoreNeeded = false; + const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; + const character = glyph.fontChar; + const accent = glyph.accent; + let scaledX, scaledY; + let width = glyph.width; if (vertical) { - var vmetric, vx, vy; - vmetric = glyph.vmetric || defaultVMetrics; - vx = glyph.vmetric ? vmetric[1] : width * 0.5; - vx = -vx * widthAdvanceScale; - vy = vmetric[2] * widthAdvanceScale; + const vmetric = glyph.vmetric || defaultVMetrics; + const vx = -(glyph.vmetric ? vmetric[1] : width * 0.5) * widthAdvanceScale; + const vy = vmetric[2] * widthAdvanceScale; width = vmetric ? -vmetric[0] : width; scaledX = vx / fontSizeScale; scaledY = (x + vy) / fontSizeScale; @@ -5654,10 +6025,10 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } if (font.remeasure && width > 0) { - var measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale; + const measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale; if (width < measuredWidth && this.isFontSubpixelAAEnabled) { - var characterScaleX = width / measuredWidth; + const characterScaleX = width / measuredWidth; restoreNeeded = true; ctx.save(); ctx.scale(characterScaleX, 1); @@ -5667,21 +6038,21 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } } - if (glyph.isInFont || font.missingFile) { + if (this.contentVisible && (glyph.isInFont || font.missingFile)) { if (simpleFillText && !accent) { ctx.fillText(character, scaledX, scaledY); } else { - this.paintChar(character, scaledX, scaledY, patternTransform); + this.paintChar(character, scaledX, scaledY, patternTransform, resetLineWidthToOne); if (accent) { - scaledAccentX = scaledX + accent.offset.x / fontSizeScale; - scaledAccentY = scaledY - accent.offset.y / fontSizeScale; - this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform); + const scaledAccentX = scaledX + fontSize * accent.offset.x / fontSizeScale; + const scaledAccentY = scaledY - fontSize * accent.offset.y / fontSizeScale; + this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY, patternTransform, resetLineWidthToOne); } } } - var charWidth; + let charWidth; if (vertical) { charWidth = width * widthAdvanceScale - spacing * fontDirection; @@ -5703,21 +6074,23 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } ctx.restore(); - }, - showType3Text: function CanvasGraphics_showType3Text(glyphs) { - var ctx = this.ctx; - var current = this.current; - var font = current.font; - var fontSize = current.fontSize; - var fontDirection = current.fontDirection; - var spacingDir = font.vertical ? 1 : -1; - var charSpacing = current.charSpacing; - var wordSpacing = current.wordSpacing; - var textHScale = current.textHScale * fontDirection; - var fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX; - var glyphsLength = glyphs.length; - var isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE; - var i, glyph, width, spacingLength; + return undefined; + } + + showType3Text(glyphs) { + const ctx = this.ctx; + const current = this.current; + const font = current.font; + const fontSize = current.fontSize; + const fontDirection = current.fontDirection; + const spacingDir = font.vertical ? 1 : -1; + const charSpacing = current.charSpacing; + const wordSpacing = current.wordSpacing; + const textHScale = current.textHScale * fontDirection; + const fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX; + const glyphsLength = glyphs.length; + const isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE; + let i, glyph, width, spacingLength; if (isTextInvisible || fontSize === 0) { return; @@ -5739,22 +6112,24 @@ var CanvasGraphics = function CanvasGraphicsClosure() { continue; } - var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; - var operatorList = font.charProcOperatorList[glyph.operatorListId]; + const spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; + const operatorList = font.charProcOperatorList[glyph.operatorListId]; if (!operatorList) { (0, _util.warn)(`Type3 character "${glyph.operatorListId}" is not available.`); continue; } - this.processingType3 = glyph; - this.save(); - ctx.scale(fontSize, fontSize); - ctx.transform.apply(ctx, fontMatrix); - this.executeOperatorList(operatorList); - this.restore(); + if (this.contentVisible) { + this.processingType3 = glyph; + this.save(); + ctx.scale(fontSize, fontSize); + ctx.transform.apply(ctx, fontMatrix); + this.executeOperatorList(operatorList); + this.restore(); + } - var transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix); + const transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix); width = transformed[0] * fontSize + spacing; ctx.translate(width, 0); @@ -5763,89 +6138,108 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.restore(); this.processingType3 = null; - }, - setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {}, - setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) { + } + + setCharWidth(xWidth, yWidth) {} + + setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) { this.ctx.rect(llx, lly, urx - llx, ury - lly); this.clip(); this.endPath(); - }, - getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) { - var pattern; + } + + getColorN_Pattern(IR) { + let pattern; if (IR[0] === "TilingPattern") { - var color = IR[1]; - var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice(); - var canvasGraphicsFactory = { + const color = IR[1]; + const baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice(); + const canvasGraphicsFactory = { createCanvasGraphics: ctx => { - return new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory, this.webGLContext); + return new CanvasGraphics(ctx, this.commonObjs, this.objs, this.canvasFactory); } }; pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform); } else { - pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR); + pattern = (0, _pattern_helper.getShadingPattern)(IR); } return pattern; - }, - setStrokeColorN: function CanvasGraphics_setStrokeColorN() { + } + + setStrokeColorN() { this.current.strokeColor = this.getColorN_Pattern(arguments); - }, - setFillColorN: function CanvasGraphics_setFillColorN() { + } + + setFillColorN() { this.current.fillColor = this.getColorN_Pattern(arguments); this.current.patternFill = true; - }, - setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) { - var color = _util.Util.makeCssRgb(r, g, b); + } + + setStrokeRGBColor(r, g, b) { + const color = _util.Util.makeHexColor(r, g, b); this.ctx.strokeStyle = color; this.current.strokeColor = color; - }, - setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) { - var color = _util.Util.makeCssRgb(r, g, b); + } + + setFillRGBColor(r, g, b) { + const color = _util.Util.makeHexColor(r, g, b); this.ctx.fillStyle = color; this.current.fillColor = color; this.current.patternFill = false; - }, - shadingFill: function CanvasGraphics_shadingFill(patternIR) { - var ctx = this.ctx; + } + + shadingFill(patternIR) { + if (!this.contentVisible) { + return; + } + + const ctx = this.ctx; this.save(); - var pattern = (0, _pattern_helper.getShadingPatternFromIR)(patternIR); + const pattern = (0, _pattern_helper.getShadingPattern)(patternIR); ctx.fillStyle = pattern.getPattern(ctx, this, true); - var inv = ctx.mozCurrentTransformInverse; + const inv = ctx.mozCurrentTransformInverse; if (inv) { - var canvas = ctx.canvas; - var width = canvas.width; - var height = canvas.height; + const canvas = ctx.canvas; + const width = canvas.width; + const height = canvas.height; - var bl = _util.Util.applyTransform([0, 0], inv); + const bl = _util.Util.applyTransform([0, 0], inv); - var br = _util.Util.applyTransform([0, height], inv); + const br = _util.Util.applyTransform([0, height], inv); - var ul = _util.Util.applyTransform([width, 0], inv); + const ul = _util.Util.applyTransform([width, 0], inv); - var ur = _util.Util.applyTransform([width, height], inv); + const ur = _util.Util.applyTransform([width, height], inv); - var x0 = Math.min(bl[0], br[0], ul[0], ur[0]); - var y0 = Math.min(bl[1], br[1], ul[1], ur[1]); - var x1 = Math.max(bl[0], br[0], ul[0], ur[0]); - var y1 = Math.max(bl[1], br[1], ul[1], ur[1]); + const x0 = Math.min(bl[0], br[0], ul[0], ur[0]); + const y0 = Math.min(bl[1], br[1], ul[1], ur[1]); + const x1 = Math.max(bl[0], br[0], ul[0], ur[0]); + const y1 = Math.max(bl[1], br[1], ul[1], ur[1]); this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0); } else { this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); } this.restore(); - }, - beginInlineImage: function CanvasGraphics_beginInlineImage() { + } + + beginInlineImage() { (0, _util.unreachable)("Should not call beginInlineImage"); - }, - beginImageData: function CanvasGraphics_beginImageData() { + } + + beginImageData() { (0, _util.unreachable)("Should not call beginImageData"); - }, - paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, bbox) { + } + + paintFormXObjectBegin(matrix, bbox) { + if (!this.contentVisible) { + return; + } + this.save(); this.baseTransformStack.push(this.baseTransform); @@ -5856,20 +6250,30 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.baseTransform = this.ctx.mozCurrentTransform; if (bbox) { - var width = bbox[2] - bbox[0]; - var height = bbox[3] - bbox[1]; + const width = bbox[2] - bbox[0]; + const height = bbox[3] - bbox[1]; this.ctx.rect(bbox[0], bbox[1], width, height); this.clip(); this.endPath(); } - }, - paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() { + } + + paintFormXObjectEnd() { + if (!this.contentVisible) { + return; + } + this.restore(); this.baseTransform = this.baseTransformStack.pop(); - }, - beginGroup: function CanvasGraphics_beginGroup(group) { + } + + beginGroup(group) { + if (!this.contentVisible) { + return; + } + this.save(); - var currentCtx = this.ctx; + const currentCtx = this.ctx; if (!group.isolated) { (0, _util.info)("TODO: Support non-isolated groups."); @@ -5879,7 +6283,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { (0, _util.warn)("Knockout groups not supported."); } - var currentTransform = currentCtx.mozCurrentTransform; + const currentTransform = currentCtx.mozCurrentTransform; if (group.matrix) { currentCtx.transform.apply(currentCtx, group.matrix); @@ -5889,15 +6293,15 @@ var CanvasGraphics = function CanvasGraphicsClosure() { throw new Error("Bounding box is required."); } - var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform); + let bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform); - var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height]; + const canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height]; bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0]; - var offsetX = Math.floor(bounds[0]); - var offsetY = Math.floor(bounds[1]); - var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1); - var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1); - var scaleX = 1, + const offsetX = Math.floor(bounds[0]); + const offsetY = Math.floor(bounds[1]); + let drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1); + let drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1); + let scaleX = 1, scaleY = 1; if (drawnWidth > MAX_GROUP_SIZE) { @@ -5910,14 +6314,14 @@ var CanvasGraphics = function CanvasGraphicsClosure() { drawnHeight = MAX_GROUP_SIZE; } - var cacheId = "groupAt" + this.groupLevel; + let cacheId = "groupAt" + this.groupLevel; if (group.smask) { cacheId += "_smask_" + this.smaskCounter++ % 2; } - var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); - var groupCtx = scratchCanvas.context; + const scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); + const groupCtx = scratchCanvas.context; groupCtx.scale(1 / scaleX, 1 / scaleY); groupCtx.translate(-offsetX, -offsetY); groupCtx.transform.apply(groupCtx, currentTransform); @@ -5947,10 +6351,15 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.groupStack.push(currentCtx); this.groupLevel++; this.current.activeSMask = null; - }, - endGroup: function CanvasGraphics_endGroup(group) { + } + + endGroup(group) { + if (!this.contentVisible) { + return; + } + this.groupLevel--; - var groupCtx = this.ctx; + const groupCtx = this.ctx; this.ctx = this.groupStack.pop(); if (this.ctx.imageSmoothingEnabled !== undefined) { @@ -5966,25 +6375,28 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } this.restore(); - }, - beginAnnotations: function CanvasGraphics_beginAnnotations() { + } + + beginAnnotations() { this.save(); if (this.baseTransform) { this.ctx.setTransform.apply(this.ctx, this.baseTransform); } - }, - endAnnotations: function CanvasGraphics_endAnnotations() { + } + + endAnnotations() { this.restore(); - }, - beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, matrix) { + } + + beginAnnotation(rect, transform, matrix) { this.save(); resetCtxToDefault(this.ctx); this.current = new CanvasExtraState(); if (Array.isArray(rect) && rect.length === 4) { - var width = rect[2] - rect[0]; - var height = rect[3] - rect[1]; + const width = rect[2] - rect[0]; + const height = rect[3] - rect[1]; this.ctx.rect(rect[0], rect[1], width, height); this.clip(); this.endPath(); @@ -5992,17 +6404,23 @@ var CanvasGraphics = function CanvasGraphicsClosure() { this.transform.apply(this, transform); this.transform.apply(this, matrix); - }, - endAnnotation: function CanvasGraphics_endAnnotation() { + } + + endAnnotation() { this.restore(); - }, - paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) { - var ctx = this.ctx; - var width = img.width, - height = img.height; - var fillColor = this.current.fillColor; - var isPatternFill = this.current.patternFill; - var glyph = this.processingType3; + } + + paintImageMaskXObject(img) { + if (!this.contentVisible) { + return; + } + + const ctx = this.ctx; + const width = img.width, + height = img.height; + const fillColor = this.current.fillColor; + const isPatternFill = this.current.patternFill; + const glyph = this.processingType3; if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) { if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) { @@ -6016,13 +6434,13 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } } - if (glyph && glyph.compiled) { + if (glyph?.compiled) { glyph.compiled(ctx); return; } - var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); - var maskCtx = maskCanvas.context; + const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); + const maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, img); maskCtx.globalCompositeOperation = "source-in"; @@ -6030,41 +6448,51 @@ var CanvasGraphics = function CanvasGraphicsClosure() { maskCtx.fillRect(0, 0, width, height); maskCtx.restore(); this.paintInlineImageXObject(maskCanvas.canvas); - }, - paintImageMaskXObjectRepeat: function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, scaleY, positions) { - var width = imgData.width; - var height = imgData.height; - var fillColor = this.current.fillColor; - var isPatternFill = this.current.patternFill; - var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); - var maskCtx = maskCanvas.context; + } + + paintImageMaskXObjectRepeat(imgData, scaleX, skewX = 0, skewY = 0, scaleY, positions) { + if (!this.contentVisible) { + return; + } + + const width = imgData.width; + const height = imgData.height; + const fillColor = this.current.fillColor; + const isPatternFill = this.current.patternFill; + const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); + const maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, imgData); maskCtx.globalCompositeOperation = "source-in"; maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; maskCtx.fillRect(0, 0, width, height); maskCtx.restore(); - var ctx = this.ctx; + const ctx = this.ctx; - for (var i = 0, ii = positions.length; i < ii; i += 2) { + for (let i = 0, ii = positions.length; i < ii; i += 2) { ctx.save(); - ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]); + ctx.transform(scaleX, skewX, skewY, scaleY, positions[i], positions[i + 1]); ctx.scale(1, -1); ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); ctx.restore(); } - }, - paintImageMaskXObjectGroup: function CanvasGraphics_paintImageMaskXObjectGroup(images) { - var ctx = this.ctx; - var fillColor = this.current.fillColor; - var isPatternFill = this.current.patternFill; + } - for (var i = 0, ii = images.length; i < ii; i++) { - var image = images[i]; - var width = image.width, - height = image.height; - var maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); - var maskCtx = maskCanvas.context; + paintImageMaskXObjectGroup(images) { + if (!this.contentVisible) { + return; + } + + const ctx = this.ctx; + const fillColor = this.current.fillColor; + const isPatternFill = this.current.patternFill; + + for (let i = 0, ii = images.length; i < ii; i++) { + const image = images[i]; + const width = image.width, + height = image.height; + const maskCanvas = this.cachedCanvases.getCanvas("maskCanvas", width, height); + const maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, image); maskCtx.globalCompositeOperation = "source-in"; @@ -6077,8 +6505,13 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); ctx.restore(); } - }, - paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { + } + + paintImageXObject(objId) { + if (!this.contentVisible) { + return; + } + const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId); if (!imgData) { @@ -6087,8 +6520,13 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } this.paintInlineImageXObject(imgData); - }, - paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) { + } + + paintImageXObjectRepeat(objId, scaleX, scaleY, positions) { + if (!this.contentVisible) { + return; + } + const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId); if (!imgData) { @@ -6096,11 +6534,11 @@ var CanvasGraphics = function CanvasGraphicsClosure() { return; } - var width = imgData.width; - var height = imgData.height; - var map = []; + const width = imgData.width; + const height = imgData.height; + const map = []; - for (var i = 0, ii = positions.length; i < ii; i += 2) { + for (let i = 0, ii = positions.length; i < ii; i += 2) { map.push({ transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]], x: 0, @@ -6111,37 +6549,38 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } this.paintInlineImageXObjectGroup(imgData, map); - }, - paintInlineImageXObject: function CanvasGraphics_paintInlineImageXObject(imgData) { - var width = imgData.width; - var height = imgData.height; - var ctx = this.ctx; + } + + paintInlineImageXObject(imgData) { + if (!this.contentVisible) { + return; + } + + const width = imgData.width; + const height = imgData.height; + const ctx = this.ctx; this.save(); ctx.scale(1 / width, -1 / height); - var currentTransform = ctx.mozCurrentTransformInverse; - var a = currentTransform[0], - b = currentTransform[1]; - var widthScale = Math.max(Math.sqrt(a * a + b * b), 1); - var c = currentTransform[2], - d = currentTransform[3]; - var heightScale = Math.max(Math.sqrt(c * c + d * d), 1); - var imgToPaint, tmpCanvas; + const currentTransform = ctx.mozCurrentTransformInverse; + let widthScale = Math.max(Math.hypot(currentTransform[0], currentTransform[1]), 1); + let heightScale = Math.max(Math.hypot(currentTransform[2], currentTransform[3]), 1); + let imgToPaint, tmpCanvas, tmpCtx; if (typeof HTMLElement === "function" && imgData instanceof HTMLElement || !imgData.data) { imgToPaint = imgData; } else { tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", width, height); - var tmpCtx = tmpCanvas.context; - putBinaryImageData(tmpCtx, imgData); + tmpCtx = tmpCanvas.context; + putBinaryImageData(tmpCtx, imgData, this.current.transferMaps); imgToPaint = tmpCanvas.canvas; } - var paintWidth = width, + let paintWidth = width, paintHeight = height; - var tmpCanvasId = "prescale1"; + let tmpCanvasId = "prescale1"; while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) { - var newWidth = paintWidth, + let newWidth = paintWidth, newHeight = paintHeight; if (widthScale > 2 && paintWidth > 1) { @@ -6167,7 +6606,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, -height, width, height); if (this.imageLayer) { - var position = this.getCanvasPosition(0, -height); + const position = this.getCanvasPosition(0, -height); this.imageLayer.appendImage({ imgData, left: position[0], @@ -6178,24 +6617,29 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } this.restore(); - }, - paintInlineImageXObjectGroup: function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) { - var ctx = this.ctx; - var w = imgData.width; - var h = imgData.height; - var tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h); - var tmpCtx = tmpCanvas.context; - putBinaryImageData(tmpCtx, imgData); + } - for (var i = 0, ii = map.length; i < ii; i++) { - var entry = map[i]; + paintInlineImageXObjectGroup(imgData, map) { + if (!this.contentVisible) { + return; + } + + const ctx = this.ctx; + const w = imgData.width; + const h = imgData.height; + const tmpCanvas = this.cachedCanvases.getCanvas("inlineImage", w, h); + const tmpCtx = tmpCanvas.context; + putBinaryImageData(tmpCtx, imgData, this.current.transferMaps); + + for (let i = 0, ii = map.length; i < ii; i++) { + const entry = map[i]; ctx.save(); ctx.transform.apply(ctx, entry.transform); ctx.scale(1, -1); ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1); if (this.imageLayer) { - var position = this.getCanvasPosition(entry.x, entry.y); + const position = this.getCanvasPosition(entry.x, entry.y); this.imageLayer.appendImage({ imgData, left: position[0], @@ -6207,22 +6651,51 @@ var CanvasGraphics = function CanvasGraphicsClosure() { ctx.restore(); } - }, - paintSolidColorImageMask: function CanvasGraphics_paintSolidColorImageMask() { + } + + paintSolidColorImageMask() { + if (!this.contentVisible) { + return; + } + this.ctx.fillRect(0, 0, 1, 1); - }, - paintXObject: function CanvasGraphics_paintXObject() { - (0, _util.warn)("Unsupported 'paintXObject' command."); - }, - markPoint: function CanvasGraphics_markPoint(tag) {}, - markPointProps: function CanvasGraphics_markPointProps(tag, properties) {}, - beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {}, - beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(tag, properties) {}, - endMarkedContent: function CanvasGraphics_endMarkedContent() {}, - beginCompat: function CanvasGraphics_beginCompat() {}, - endCompat: function CanvasGraphics_endCompat() {}, - consumePath: function CanvasGraphics_consumePath() { - var ctx = this.ctx; + } + + markPoint(tag) {} + + markPointProps(tag, properties) {} + + beginMarkedContent(tag) { + this.markedContentStack.push({ + visible: true + }); + } + + beginMarkedContentProps(tag, properties) { + if (tag === "OC") { + this.markedContentStack.push({ + visible: this.optionalContentConfig.isVisible(properties) + }); + } else { + this.markedContentStack.push({ + visible: true + }); + } + + this.contentVisible = this.isContentVisible(); + } + + endMarkedContent() { + this.markedContentStack.pop(); + this.contentVisible = this.isContentVisible(); + } + + beginCompat() {} + + endCompat() {} + + consumePath() { + const ctx = this.ctx; if (this.pendingClip) { if (this.pendingClip === EO_CLIP) { @@ -6235,24 +6708,46 @@ var CanvasGraphics = function CanvasGraphicsClosure() { } ctx.beginPath(); - }, + } - getSinglePixelWidth(scale) { + getSinglePixelWidth() { if (this._cachedGetSinglePixelWidth === null) { - const inverse = this.ctx.mozCurrentTransformInverse; - this._cachedGetSinglePixelWidth = Math.sqrt(Math.max(inverse[0] * inverse[0] + inverse[1] * inverse[1], inverse[2] * inverse[2] + inverse[3] * inverse[3])); + const m = this.ctx.mozCurrentTransform; + const absDet = Math.abs(m[0] * m[3] - m[2] * m[1]); + const sqNorm1 = m[0] ** 2 + m[2] ** 2; + const sqNorm2 = m[1] ** 2 + m[3] ** 2; + const pixelHeight = Math.sqrt(Math.max(sqNorm1, sqNorm2)) / absDet; + + if (sqNorm1 !== sqNorm2 && this._combinedScaleFactor * pixelHeight > 1) { + this._cachedGetSinglePixelWidth = -(this._combinedScaleFactor * pixelHeight); + } else if (absDet > Number.EPSILON) { + this._cachedGetSinglePixelWidth = pixelHeight; + } else { + this._cachedGetSinglePixelWidth = 1; + } } return this._cachedGetSinglePixelWidth; - }, + } - getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { - var transform = this.ctx.mozCurrentTransform; + getCanvasPosition(x, y) { + const transform = this.ctx.mozCurrentTransform; return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]]; } - }; - for (var op in _util.OPS) { + isContentVisible() { + for (let i = this.markedContentStack.length - 1; i >= 0; i--) { + if (!this.markedContentStack[i].visible) { + return false; + } + } + + return true; + } + + } + + for (const op in _util.OPS) { CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op]; } @@ -6262,21 +6757,32 @@ var CanvasGraphics = function CanvasGraphicsClosure() { exports.CanvasGraphics = CanvasGraphics; /***/ }), -/* 9 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 11 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.getShadingPatternFromIR = getShadingPatternFromIR; +})); +exports.getShadingPattern = getShadingPattern; exports.TilingPattern = void 0; var _util = __w_pdfjs_require__(2); -var ShadingIRs = {}; +let svgElement; + +function createMatrix(matrix) { + if (typeof DOMMatrix !== "undefined") { + return new DOMMatrix(matrix); + } + + if (!svgElement) { + svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + } + + return svgElement.createSVGMatrix(matrix); +} function applyBoundingBox(ctx, bbox) { if (!bbox || typeof Path2D === "undefined") { @@ -6290,259 +6796,287 @@ function applyBoundingBox(ctx, bbox) { ctx.clip(region); } -ShadingIRs.RadialAxial = { - fromIR: function RadialAxial_fromIR(raw) { - var type = raw[1]; - var bbox = raw[2]; - var colorStops = raw[3]; - var p0 = raw[4]; - var p1 = raw[5]; - var r0 = raw[6]; - var r1 = raw[7]; - return { - type: "Pattern", - getPattern: function RadialAxial_getPattern(ctx) { - applyBoundingBox(ctx, bbox); - var grad; - - if (type === "axial") { - grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]); - } else if (type === "radial") { - grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1); - } - - for (var i = 0, ii = colorStops.length; i < ii; ++i) { - var c = colorStops[i]; - grad.addColorStop(c[0], c[1]); - } - - return grad; - } - }; +class BaseShadingPattern { + constructor() { + if (this.constructor === BaseShadingPattern) { + (0, _util.unreachable)("Cannot initialize BaseShadingPattern."); + } } -}; -var createMeshCanvas = function createMeshCanvasClosure() { - function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { - var coords = context.coords, + getPattern() { + (0, _util.unreachable)("Abstract method `getPattern` called."); + } + +} + +class RadialAxialShadingPattern extends BaseShadingPattern { + constructor(IR) { + super(); + this._type = IR[1]; + this._bbox = IR[2]; + this._colorStops = IR[3]; + this._p0 = IR[4]; + this._p1 = IR[5]; + this._r0 = IR[6]; + this._r1 = IR[7]; + this._matrix = IR[8]; + } + + getPattern(ctx, owner, shadingFill) { + const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", ctx.canvas.width, ctx.canvas.height, true); + const tmpCtx = tmpCanvas.context; + tmpCtx.clearRect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height); + tmpCtx.beginPath(); + tmpCtx.rect(0, 0, tmpCtx.canvas.width, tmpCtx.canvas.height); + + if (!shadingFill) { + tmpCtx.setTransform.apply(tmpCtx, owner.baseTransform); + + if (this._matrix) { + tmpCtx.transform.apply(tmpCtx, this._matrix); + } + } else { + tmpCtx.setTransform.apply(tmpCtx, ctx.mozCurrentTransform); + } + + applyBoundingBox(tmpCtx, this._bbox); + let grad; + + if (this._type === "axial") { + grad = tmpCtx.createLinearGradient(this._p0[0], this._p0[1], this._p1[0], this._p1[1]); + } else if (this._type === "radial") { + grad = tmpCtx.createRadialGradient(this._p0[0], this._p0[1], this._r0, this._p1[0], this._p1[1], this._r1); + } + + for (const colorStop of this._colorStops) { + grad.addColorStop(colorStop[0], colorStop[1]); + } + + tmpCtx.fillStyle = grad; + tmpCtx.fill(); + const pattern = ctx.createPattern(tmpCanvas.canvas, "repeat"); + pattern.setTransform(createMatrix(ctx.mozCurrentTransformInverse)); + return pattern; + } + +} + +function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { + const coords = context.coords, colors = context.colors; - var bytes = data.data, + const bytes = data.data, rowSize = data.width * 4; - var tmp; + let tmp; - if (coords[p1 + 1] > coords[p2 + 1]) { - tmp = p1; - p1 = p2; - p2 = tmp; - tmp = c1; - c1 = c2; - c2 = tmp; - } + if (coords[p1 + 1] > coords[p2 + 1]) { + tmp = p1; + p1 = p2; + p2 = tmp; + tmp = c1; + c1 = c2; + c2 = tmp; + } - if (coords[p2 + 1] > coords[p3 + 1]) { - tmp = p2; - p2 = p3; - p3 = tmp; - tmp = c2; - c2 = c3; - c3 = tmp; - } + if (coords[p2 + 1] > coords[p3 + 1]) { + tmp = p2; + p2 = p3; + p3 = tmp; + tmp = c2; + c2 = c3; + c3 = tmp; + } - if (coords[p1 + 1] > coords[p2 + 1]) { - tmp = p1; - p1 = p2; - p2 = tmp; - tmp = c1; - c1 = c2; - c2 = tmp; - } + if (coords[p1 + 1] > coords[p2 + 1]) { + tmp = p1; + p1 = p2; + p2 = tmp; + tmp = c1; + c1 = c2; + c2 = tmp; + } - var x1 = (coords[p1] + context.offsetX) * context.scaleX; - var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY; - var x2 = (coords[p2] + context.offsetX) * context.scaleX; - var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY; - var x3 = (coords[p3] + context.offsetX) * context.scaleX; - var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY; + const x1 = (coords[p1] + context.offsetX) * context.scaleX; + const y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY; + const x2 = (coords[p2] + context.offsetX) * context.scaleX; + const y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY; + const x3 = (coords[p3] + context.offsetX) * context.scaleX; + const y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY; - if (y1 >= y3) { - return; - } + if (y1 >= y3) { + return; + } - var c1r = colors[c1], + const c1r = colors[c1], c1g = colors[c1 + 1], c1b = colors[c1 + 2]; - var c2r = colors[c2], + const c2r = colors[c2], c2g = colors[c2 + 1], c2b = colors[c2 + 2]; - var c3r = colors[c3], + const c3r = colors[c3], c3g = colors[c3 + 1], c3b = colors[c3 + 2]; - var minY = Math.round(y1), + const minY = Math.round(y1), maxY = Math.round(y3); - var xa, car, cag, cab; - var xb, cbr, cbg, cbb; - - for (var y = minY; y <= maxY; y++) { - if (y < y2) { - let k; - - if (y < y1) { - k = 0; - } else if (y1 === y2) { - k = 1; - } else { - k = (y1 - y) / (y1 - y2); - } - - xa = x1 - (x1 - x2) * k; - car = c1r - (c1r - c2r) * k; - cag = c1g - (c1g - c2g) * k; - cab = c1b - (c1b - c2b) * k; - } else { - let k; - - if (y > y3) { - k = 1; - } else if (y2 === y3) { - k = 0; - } else { - k = (y2 - y) / (y2 - y3); - } - - xa = x2 - (x2 - x3) * k; - car = c2r - (c2r - c3r) * k; - cag = c2g - (c2g - c3g) * k; - cab = c2b - (c2b - c3b) * k; - } + let xa, car, cag, cab; + let xb, cbr, cbg, cbb; + for (let y = minY; y <= maxY; y++) { + if (y < y2) { let k; if (y < y1) { k = 0; - } else if (y > y3) { + } else if (y1 === y2) { k = 1; } else { - k = (y1 - y) / (y1 - y3); + k = (y1 - y) / (y1 - y2); } - xb = x1 - (x1 - x3) * k; - cbr = c1r - (c1r - c3r) * k; - cbg = c1g - (c1g - c3g) * k; - cbb = c1b - (c1b - c3b) * k; - var x1_ = Math.round(Math.min(xa, xb)); - var x2_ = Math.round(Math.max(xa, xb)); - var j = rowSize * y + x1_ * 4; + xa = x1 - (x1 - x2) * k; + car = c1r - (c1r - c2r) * k; + cag = c1g - (c1g - c2g) * k; + cab = c1b - (c1b - c2b) * k; + } else { + let k; - for (var x = x1_; x <= x2_; x++) { - k = (xa - x) / (xa - xb); - - if (k < 0) { - k = 0; - } else if (k > 1) { - k = 1; - } - - bytes[j++] = car - (car - cbr) * k | 0; - bytes[j++] = cag - (cag - cbg) * k | 0; - bytes[j++] = cab - (cab - cbb) * k | 0; - bytes[j++] = 255; + if (y > y3) { + k = 1; + } else if (y2 === y3) { + k = 0; + } else { + k = (y2 - y) / (y2 - y3); } + + xa = x2 - (x2 - x3) * k; + car = c2r - (c2r - c3r) * k; + cag = c2g - (c2g - c3g) * k; + cab = c2b - (c2b - c3b) * k; + } + + let k; + + if (y < y1) { + k = 0; + } else if (y > y3) { + k = 1; + } else { + k = (y1 - y) / (y1 - y3); + } + + xb = x1 - (x1 - x3) * k; + cbr = c1r - (c1r - c3r) * k; + cbg = c1g - (c1g - c3g) * k; + cbb = c1b - (c1b - c3b) * k; + const x1_ = Math.round(Math.min(xa, xb)); + const x2_ = Math.round(Math.max(xa, xb)); + let j = rowSize * y + x1_ * 4; + + for (let x = x1_; x <= x2_; x++) { + k = (xa - x) / (xa - xb); + + if (k < 0) { + k = 0; + } else if (k > 1) { + k = 1; + } + + bytes[j++] = car - (car - cbr) * k | 0; + bytes[j++] = cag - (cag - cbg) * k | 0; + bytes[j++] = cab - (cab - cbb) * k | 0; + bytes[j++] = 255; } } +} - function drawFigure(data, figure, context) { - var ps = figure.coords; - var cs = figure.colors; - var i, ii; +function drawFigure(data, figure, context) { + const ps = figure.coords; + const cs = figure.colors; + let i, ii; - switch (figure.type) { - case "lattice": - var verticesPerRow = figure.verticesPerRow; - var rows = Math.floor(ps.length / verticesPerRow) - 1; - var cols = verticesPerRow - 1; + switch (figure.type) { + case "lattice": + const verticesPerRow = figure.verticesPerRow; + const rows = Math.floor(ps.length / verticesPerRow) - 1; + const cols = verticesPerRow - 1; - for (i = 0; i < rows; i++) { - var q = i * verticesPerRow; + for (i = 0; i < rows; i++) { + let q = i * verticesPerRow; - for (var j = 0; j < cols; j++, q++) { - drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]); - drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]); - } + for (let j = 0; j < cols; j++, q++) { + drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]); + drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]); } + } - break; + break; - case "triangles": - for (i = 0, ii = ps.length; i < ii; i += 3) { - drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]); - } + case "triangles": + for (i = 0, ii = ps.length; i < ii; i += 3) { + drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]); + } - break; + break; - default: - throw new Error("illegal figure"); - } + default: + throw new Error("illegal figure"); + } +} + +class MeshShadingPattern extends BaseShadingPattern { + constructor(IR) { + super(); + this._coords = IR[2]; + this._colors = IR[3]; + this._figures = IR[4]; + this._bounds = IR[5]; + this._matrix = IR[6]; + this._bbox = IR[7]; + this._background = IR[8]; } - function createMeshCanvas(bounds, combinesScale, coords, colors, figures, backgroundColor, cachedCanvases, webGLContext) { - var EXPECTED_SCALE = 1.1; - var MAX_PATTERN_SIZE = 3000; - var BORDER_SIZE = 2; - var offsetX = Math.floor(bounds[0]); - var offsetY = Math.floor(bounds[1]); - var boundsWidth = Math.ceil(bounds[2]) - offsetX; - var boundsHeight = Math.ceil(bounds[3]) - offsetY; - var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); - var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); - var scaleX = boundsWidth / width; - var scaleY = boundsHeight / height; - var context = { - coords, - colors, + _createMeshCanvas(combinedScale, backgroundColor, cachedCanvases) { + const EXPECTED_SCALE = 1.1; + const MAX_PATTERN_SIZE = 3000; + const BORDER_SIZE = 2; + const offsetX = Math.floor(this._bounds[0]); + const offsetY = Math.floor(this._bounds[1]); + const boundsWidth = Math.ceil(this._bounds[2]) - offsetX; + const boundsHeight = Math.ceil(this._bounds[3]) - offsetY; + const width = Math.min(Math.ceil(Math.abs(boundsWidth * combinedScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); + const height = Math.min(Math.ceil(Math.abs(boundsHeight * combinedScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); + const scaleX = boundsWidth / width; + const scaleY = boundsHeight / height; + const context = { + coords: this._coords, + colors: this._colors, offsetX: -offsetX, offsetY: -offsetY, scaleX: 1 / scaleX, scaleY: 1 / scaleY }; - var paddedWidth = width + BORDER_SIZE * 2; - var paddedHeight = height + BORDER_SIZE * 2; - var canvas, tmpCanvas, i, ii; + const paddedWidth = width + BORDER_SIZE * 2; + const paddedHeight = height + BORDER_SIZE * 2; + const tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); + const tmpCtx = tmpCanvas.context; + const data = tmpCtx.createImageData(width, height); - if (webGLContext.isEnabled) { - canvas = webGLContext.drawFigures({ - width, - height, - backgroundColor, - figures, - context - }); - tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); - tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE); - canvas = tmpCanvas.canvas; - } else { - tmpCanvas = cachedCanvases.getCanvas("mesh", paddedWidth, paddedHeight, false); - var tmpCtx = tmpCanvas.context; - var data = tmpCtx.createImageData(width, height); + if (backgroundColor) { + const bytes = data.data; - if (backgroundColor) { - var bytes = data.data; - - for (i = 0, ii = bytes.length; i < ii; i += 4) { - bytes[i] = backgroundColor[0]; - bytes[i + 1] = backgroundColor[1]; - bytes[i + 2] = backgroundColor[2]; - bytes[i + 3] = 255; - } + for (let i = 0, ii = bytes.length; i < ii; i += 4) { + bytes[i] = backgroundColor[0]; + bytes[i + 1] = backgroundColor[1]; + bytes[i + 2] = backgroundColor[2]; + bytes[i + 3] = 255; } - - for (i = 0; i < figures.length; i++) { - drawFigure(data, figures[i], context); - } - - tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE); - canvas = tmpCanvas.canvas; } + for (const figure of this._figures) { + drawFigure(data, figure, context); + } + + tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE); + const canvas = tmpCanvas.canvas; return { canvas, offsetX: offsetX - BORDER_SIZE * scaleX, @@ -6552,82 +7086,72 @@ var createMeshCanvas = function createMeshCanvasClosure() { }; } - return createMeshCanvas; -}(); + getPattern(ctx, owner, shadingFill) { + applyBoundingBox(ctx, this._bbox); + let scale; -ShadingIRs.Mesh = { - fromIR: function Mesh_fromIR(raw) { - var coords = raw[2]; - var colors = raw[3]; - var figures = raw[4]; - var bounds = raw[5]; - var matrix = raw[6]; - var bbox = raw[7]; - var background = raw[8]; - return { - type: "Pattern", - getPattern: function Mesh_getPattern(ctx, owner, shadingFill) { - applyBoundingBox(ctx, bbox); - var scale; + if (shadingFill) { + scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); + } else { + scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform); - if (shadingFill) { - scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); - } else { - scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform); + if (this._matrix) { + const matrixScale = _util.Util.singularValueDecompose2dScale(this._matrix); - if (matrix) { - var matrixScale = _util.Util.singularValueDecompose2dScale(matrix); - - scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]]; - } - } - - var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, colors, figures, shadingFill ? null : background, owner.cachedCanvases, owner.webGLContext); - - if (!shadingFill) { - ctx.setTransform.apply(ctx, owner.baseTransform); - - if (matrix) { - ctx.transform.apply(ctx, matrix); - } - } - - ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY); - ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY); - return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat"); + scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]]; } - }; - } -}; -ShadingIRs.Dummy = { - fromIR: function Dummy_fromIR() { - return { - type: "Pattern", - getPattern: function Dummy_fromIR_getPattern() { - return "hotpink"; + } + + const temporaryPatternCanvas = this._createMeshCanvas(scale, shadingFill ? null : this._background, owner.cachedCanvases); + + if (!shadingFill) { + ctx.setTransform.apply(ctx, owner.baseTransform); + + if (this._matrix) { + ctx.transform.apply(ctx, this._matrix); } - }; - } -}; + } -function getShadingPatternFromIR(raw) { - var shadingIR = ShadingIRs[raw[0]]; - - if (!shadingIR) { - throw new Error(`Unknown IR type: ${raw[0]}`); + ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY); + ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY); + return ctx.createPattern(temporaryPatternCanvas.canvas, "no-repeat"); } - return shadingIR.fromIR(raw); } -var TilingPattern = function TilingPatternClosure() { - var PaintType = { - COLORED: 1, - UNCOLORED: 2 - }; - var MAX_PATTERN_SIZE = 3000; +class DummyShadingPattern extends BaseShadingPattern { + getPattern() { + return "hotpink"; + } - function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) { +} + +function getShadingPattern(IR) { + switch (IR[0]) { + case "RadialAxial": + return new RadialAxialShadingPattern(IR); + + case "Mesh": + return new MeshShadingPattern(IR); + + case "Dummy": + return new DummyShadingPattern(); + } + + throw new Error(`Unknown IR type: ${IR[0]}`); +} + +const PaintType = { + COLORED: 1, + UNCOLORED: 2 +}; + +class TilingPattern { + static get MAX_PATTERN_SIZE() { + return (0, _util.shadow)(this, "MAX_PATTERN_SIZE", 3000); + } + + constructor(IR, color, ctx, canvasGraphicsFactory, baseTransform) { this.operatorList = IR[2]; this.matrix = IR[3] || [1, 0, 0, 1, 0, 0]; this.bbox = IR[4]; @@ -6636,122 +7160,137 @@ var TilingPattern = function TilingPatternClosure() { this.paintType = IR[7]; this.tilingType = IR[8]; this.color = color; + this.ctx = ctx; this.canvasGraphicsFactory = canvasGraphicsFactory; this.baseTransform = baseTransform; - this.type = "Pattern"; - this.ctx = ctx; } - TilingPattern.prototype = { - createPatternCanvas: function TilinPattern_createPatternCanvas(owner) { - var operatorList = this.operatorList; - var bbox = this.bbox; - var xstep = this.xstep; - var ystep = this.ystep; - var paintType = this.paintType; - var tilingType = this.tilingType; - var color = this.color; - var canvasGraphicsFactory = this.canvasGraphicsFactory; - (0, _util.info)("TilingType: " + tilingType); - var x0 = bbox[0], + createPatternCanvas(owner) { + const operatorList = this.operatorList; + const bbox = this.bbox; + const xstep = this.xstep; + const ystep = this.ystep; + const paintType = this.paintType; + const tilingType = this.tilingType; + const color = this.color; + const canvasGraphicsFactory = this.canvasGraphicsFactory; + (0, _util.info)("TilingType: " + tilingType); + const x0 = bbox[0], y0 = bbox[1], x1 = bbox[2], y1 = bbox[3]; - var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix); + const matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix); - var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform); + const curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform); - var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]]; - var dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]); - var dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]); - var tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true); - var tmpCtx = tmpCanvas.context; - var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx); - graphics.groupLevel = owner.groupLevel; - this.setFillAndStrokeStyleToContext(graphics, paintType, color); - graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0); - graphics.transform(1, 0, 0, 1, -x0, -y0); - this.clipBbox(graphics, bbox, x0, y0, x1, y1); - graphics.executeOperatorList(operatorList); - this.ctx.transform(1, 0, 0, 1, x0, y0); - this.ctx.scale(1 / dimx.scale, 1 / dimy.scale); - return tmpCanvas.canvas; - }, - getSizeAndScale: function TilingPattern_getSizeAndScale(step, realOutputSize, scale) { - step = Math.abs(step); - var maxSize = Math.max(MAX_PATTERN_SIZE, realOutputSize); - var size = Math.ceil(step * scale); + const combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]]; + const dimx = this.getSizeAndScale(xstep, this.ctx.canvas.width, combinedScale[0]); + const dimy = this.getSizeAndScale(ystep, this.ctx.canvas.height, combinedScale[1]); + const tmpCanvas = owner.cachedCanvases.getCanvas("pattern", dimx.size, dimy.size, true); + const tmpCtx = tmpCanvas.context; + const graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx); + graphics.groupLevel = owner.groupLevel; + this.setFillAndStrokeStyleToContext(graphics, paintType, color); + graphics.transform(dimx.scale, 0, 0, dimy.scale, 0, 0); + this.clipBbox(graphics, bbox, x0, y0, x1, y1); + graphics.baseTransform = graphics.ctx.mozCurrentTransform.slice(); + graphics.executeOperatorList(operatorList); + graphics.endDrawing(); + return { + canvas: tmpCanvas.canvas, + scaleX: dimx.scale, + scaleY: dimy.scale + }; + } - if (size >= maxSize) { - size = maxSize; - } else { - scale = size / step; - } + getSizeAndScale(step, realOutputSize, scale) { + step = Math.abs(step); + const maxSize = Math.max(TilingPattern.MAX_PATTERN_SIZE, realOutputSize); + let size = Math.ceil(step * scale); - return { - scale, - size - }; - }, - clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) { - if (Array.isArray(bbox) && bbox.length === 4) { - var bboxWidth = x1 - x0; - var bboxHeight = y1 - y0; - graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight); - graphics.clip(); - graphics.endPath(); - } - }, - setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(graphics, paintType, color) { - const context = graphics.ctx, - current = graphics.current; - - switch (paintType) { - case PaintType.COLORED: - var ctx = this.ctx; - context.fillStyle = ctx.fillStyle; - context.strokeStyle = ctx.strokeStyle; - current.fillColor = ctx.fillStyle; - current.strokeColor = ctx.strokeStyle; - break; - - case PaintType.UNCOLORED: - var cssColor = _util.Util.makeCssRgb(color[0], color[1], color[2]); - - context.fillStyle = cssColor; - context.strokeStyle = cssColor; - current.fillColor = cssColor; - current.strokeColor = cssColor; - break; - - default: - throw new _util.FormatError(`Unsupported paint type: ${paintType}`); - } - }, - getPattern: function TilingPattern_getPattern(ctx, owner) { - ctx = this.ctx; - ctx.setTransform.apply(ctx, this.baseTransform); - ctx.transform.apply(ctx, this.matrix); - var temporaryPatternCanvas = this.createPatternCanvas(owner); - return ctx.createPattern(temporaryPatternCanvas, "repeat"); + if (size >= maxSize) { + size = maxSize; + } else { + scale = size / step; } - }; - return TilingPattern; -}(); + + return { + scale, + size + }; + } + + clipBbox(graphics, bbox, x0, y0, x1, y1) { + if (Array.isArray(bbox) && bbox.length === 4) { + const bboxWidth = x1 - x0; + const bboxHeight = y1 - y0; + graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight); + graphics.clip(); + graphics.endPath(); + } + } + + setFillAndStrokeStyleToContext(graphics, paintType, color) { + const context = graphics.ctx, + current = graphics.current; + + switch (paintType) { + case PaintType.COLORED: + const ctx = this.ctx; + context.fillStyle = ctx.fillStyle; + context.strokeStyle = ctx.strokeStyle; + current.fillColor = ctx.fillStyle; + current.strokeColor = ctx.strokeStyle; + break; + + case PaintType.UNCOLORED: + const cssColor = _util.Util.makeHexColor(color[0], color[1], color[2]); + + context.fillStyle = cssColor; + context.strokeStyle = cssColor; + current.fillColor = cssColor; + current.strokeColor = cssColor; + break; + + default: + throw new _util.FormatError(`Unsupported paint type: ${paintType}`); + } + } + + getPattern(ctx, owner, shadingFill) { + ctx = this.ctx; + let matrix = ctx.mozCurrentTransformInverse; + + if (!shadingFill) { + matrix = _util.Util.transform(matrix, owner.baseTransform); + + if (this.matrix) { + matrix = _util.Util.transform(matrix, this.matrix); + } + } + + const temporaryPatternCanvas = this.createPatternCanvas(owner); + let domMatrix = createMatrix(matrix); + domMatrix = domMatrix.scale(1 / temporaryPatternCanvas.scaleX, 1 / temporaryPatternCanvas.scaleY); + const pattern = ctx.createPattern(temporaryPatternCanvas.canvas, "repeat"); + pattern.setTransform(domMatrix); + return pattern; + } + +} exports.TilingPattern = TilingPattern; /***/ }), -/* 10 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 12 */ +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.GlobalWorkerOptions = void 0; const GlobalWorkerOptions = Object.create(null); exports.GlobalWorkerOptions = GlobalWorkerOptions; @@ -6759,15 +7298,14 @@ GlobalWorkerOptions.workerPort = GlobalWorkerOptions.workerPort === undefined ? GlobalWorkerOptions.workerSrc = GlobalWorkerOptions.workerSrc === undefined ? "" : GlobalWorkerOptions.workerSrc; /***/ }), -/* 11 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 13 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.MessageHandler = void 0; var _util = __w_pdfjs_require__(2); @@ -7260,123 +7798,37 @@ class MessageHandler { exports.MessageHandler = MessageHandler; /***/ }), -/* 12 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 14 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.Metadata = void 0; var _util = __w_pdfjs_require__(2); -var _xml_parser = __w_pdfjs_require__(13); - class Metadata { - constructor(data) { - (0, _util.assert)(typeof data === "string", "Metadata: input is not a string"); - data = this._repair(data); - const parser = new _xml_parser.SimpleXMLParser(); - const xmlDocument = parser.parseFromString(data); - this._metadataMap = new Map(); - - if (xmlDocument) { - this._parse(xmlDocument); - } + constructor({ + parsedData, + rawData + }) { + this._metadataMap = parsedData; + this._data = rawData; } - _repair(data) { - return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) { - const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { - return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); - }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) { - switch (name) { - case "amp": - return "&"; - - case "apos": - return "'"; - - case "gt": - return ">"; - - case "lt": - return "<"; - - case "quot": - return '"'; - } - - throw new Error(`_repair: ${name} isn't defined.`); - }); - let chars = ""; - - for (let i = 0, ii = bytes.length; i < ii; i += 2) { - const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); - - if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { - chars += String.fromCharCode(code); - } else { - chars += "&#x" + (0x10000 + code).toString(16).substring(1) + ";"; - } - } - - return ">" + chars; - }); - } - - _parse(xmlDocument) { - let rdf = xmlDocument.documentElement; - - if (rdf.nodeName.toLowerCase() !== "rdf:rdf") { - rdf = rdf.firstChild; - - while (rdf && rdf.nodeName.toLowerCase() !== "rdf:rdf") { - rdf = rdf.nextSibling; - } - } - - const nodeName = rdf ? rdf.nodeName.toLowerCase() : null; - - if (!rdf || nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) { - return; - } - - const children = rdf.childNodes; - - for (let i = 0, ii = children.length; i < ii; i++) { - const desc = children[i]; - - if (desc.nodeName.toLowerCase() !== "rdf:description") { - continue; - } - - for (let j = 0, jj = desc.childNodes.length; j < jj; j++) { - if (desc.childNodes[j].nodeName.toLowerCase() !== "#text") { - const entry = desc.childNodes[j]; - const name = entry.nodeName.toLowerCase(); - - this._metadataMap.set(name, entry.textContent.trim()); - } - } - } + getRaw() { + return this._data; } get(name) { - return this._metadataMap.has(name) ? this._metadataMap.get(name) : null; + return this._metadataMap.get(name) ?? null; } getAll() { - const obj = Object.create(null); - - for (const [key, value] of this._metadataMap) { - obj[key] = value; - } - - return obj; + return (0, _util.objectFromMap)(this._metadataMap); } has(name) { @@ -7388,470 +7840,241 @@ class Metadata { exports.Metadata = Metadata; /***/ }), -/* 13 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 15 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.SimpleXMLParser = void 0; -const XMLParserErrorCode = { - NoError: 0, - EndOfDocument: -1, - UnterminatedCdat: -2, - UnterminatedXmlDeclaration: -3, - UnterminatedDoctypeDeclaration: -4, - UnterminatedComment: -5, - MalformedElement: -6, - OutOfMemory: -7, - UnterminatedAttributeValue: -8, - UnterminatedElement: -9, - ElementNeverBegun: -10 -}; +})); +exports.OptionalContentConfig = void 0; + +var _util = __w_pdfjs_require__(2); + +class OptionalContentGroup { + constructor(name, intent) { + this.visible = true; + this.name = name; + this.intent = intent; + } -function isWhitespace(s, index) { - const ch = s[index]; - return ch === " " || ch === "\n" || ch === "\r" || ch === "\t"; } -function isWhitespaceString(s) { - for (let i = 0, ii = s.length; i < ii; i++) { - if (!isWhitespace(s, i)) { - return false; +class OptionalContentConfig { + constructor(data) { + this.name = null; + this.creator = null; + this._order = null; + this._groups = new Map(); + + if (data === null) { + return; + } + + this.name = data.name; + this.creator = data.creator; + this._order = data.order; + + for (const group of data.groups) { + this._groups.set(group.id, new OptionalContentGroup(group.name, group.intent)); + } + + if (data.baseState === "OFF") { + for (const group of this._groups) { + group.visible = false; + } + } + + for (const on of data.on) { + this._groups.get(on).visible = true; + } + + for (const off of data.off) { + this._groups.get(off).visible = false; } } - return true; -} + _evaluateVisibilityExpression(array) { + const length = array.length; -class XMLParserBase { - _resolveEntities(s) { - return s.replace(/&([^;]+);/g, (all, entity) => { - if (entity.substring(0, 2) === "#x") { - return String.fromCharCode(parseInt(entity.substring(2), 16)); - } else if (entity.substring(0, 1) === "#") { - return String.fromCharCode(parseInt(entity.substring(1), 10)); - } - - switch (entity) { - case "lt": - return "<"; - - case "gt": - return ">"; - - case "amp": - return "&"; - - case "quot": - return '"'; - } - - return this.onResolveEntity(entity); - }); - } - - _parseContent(s, start) { - const attributes = []; - let pos = start; - - function skipWs() { - while (pos < s.length && isWhitespace(s, pos)) { - ++pos; - } + if (length < 2) { + return true; } - while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { - ++pos; - } + const operator = array[0]; - const name = s.substring(start, pos); - skipWs(); + for (let i = 1; i < length; i++) { + const element = array[i]; + let state; - while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") { - skipWs(); - let attrName = "", - attrValue = ""; - - while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") { - attrName += s[pos]; - ++pos; - } - - skipWs(); - - if (s[pos] !== "=") { - return null; - } - - ++pos; - skipWs(); - const attrEndChar = s[pos]; - - if (attrEndChar !== '"' && attrEndChar !== "'") { - return null; - } - - const attrEndIndex = s.indexOf(attrEndChar, ++pos); - - if (attrEndIndex < 0) { - return null; - } - - attrValue = s.substring(pos, attrEndIndex); - attributes.push({ - name: attrName, - value: this._resolveEntities(attrValue) - }); - pos = attrEndIndex + 1; - skipWs(); - } - - return { - name, - attributes, - parsed: pos - start - }; - } - - _parseProcessingInstruction(s, start) { - let pos = start; - - function skipWs() { - while (pos < s.length && isWhitespace(s, pos)) { - ++pos; - } - } - - while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") { - ++pos; - } - - const name = s.substring(start, pos); - skipWs(); - const attrStart = pos; - - while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) { - ++pos; - } - - const value = s.substring(attrStart, pos); - return { - name, - value, - parsed: pos - start - }; - } - - parseXml(s) { - let i = 0; - - while (i < s.length) { - const ch = s[i]; - let j = i; - - if (ch === "<") { - ++j; - const ch2 = s[j]; - let q; - - switch (ch2) { - case "/": - ++j; - q = s.indexOf(">", j); - - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedElement); - return; - } - - this.onEndElement(s.substring(j, q)); - j = q + 1; - break; - - case "?": - ++j; - - const pi = this._parseProcessingInstruction(s, j); - - if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") { - this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration); - return; - } - - this.onPi(pi.name, pi.value); - j += pi.parsed + 2; - break; - - case "!": - if (s.substring(j + 1, j + 3) === "--") { - q = s.indexOf("-->", j + 3); - - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedComment); - return; - } - - this.onComment(s.substring(j + 3, q)); - j = q + 3; - } else if (s.substring(j + 1, j + 8) === "[CDATA[") { - q = s.indexOf("]]>", j + 8); - - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedCdat); - return; - } - - this.onCdata(s.substring(j + 8, q)); - j = q + 3; - } else if (s.substring(j + 1, j + 8) === "DOCTYPE") { - const q2 = s.indexOf("[", j + 8); - let complexDoctype = false; - q = s.indexOf(">", j + 8); - - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); - return; - } - - if (q2 > 0 && q > q2) { - q = s.indexOf("]>", j + 8); - - if (q < 0) { - this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration); - return; - } - - complexDoctype = true; - } - - const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0)); - this.onDoctype(doctypeContent); - j = q + (complexDoctype ? 2 : 1); - } else { - this.onError(XMLParserErrorCode.MalformedElement); - return; - } - - break; - - default: - const content = this._parseContent(s, j); - - if (content === null) { - this.onError(XMLParserErrorCode.MalformedElement); - return; - } - - let isClosed = false; - - if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") { - isClosed = true; - } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") { - this.onError(XMLParserErrorCode.UnterminatedElement); - return; - } - - this.onBeginElement(content.name, content.attributes, isClosed); - j += content.parsed + (isClosed ? 2 : 1); - break; - } + if (Array.isArray(element)) { + state = this._evaluateVisibilityExpression(element); + } else if (this._groups.has(element)) { + state = this._groups.get(element).visible; } else { - while (j < s.length && s[j] !== "<") { - j++; - } - - const text = s.substring(i, j); - this.onText(this._resolveEntities(text)); + (0, _util.warn)(`Optional content group not found: ${element}`); + return true; } - i = j; - } - } + switch (operator) { + case "And": + if (!state) { + return false; + } - onResolveEntity(name) { - return `&${name};`; - } + break; - onPi(name, value) {} + case "Or": + if (state) { + return true; + } - onComment(text) {} + break; - onCdata(text) {} + case "Not": + return !state; - onDoctype(doctypeContent) {} - - onText(text) {} - - onBeginElement(name, attributes, isEmpty) {} - - onEndElement(name) {} - - onError(code) {} - -} - -class SimpleDOMNode { - constructor(nodeName, nodeValue) { - this.nodeName = nodeName; - this.nodeValue = nodeValue; - Object.defineProperty(this, "parentNode", { - value: null, - writable: true - }); - } - - get firstChild() { - return this.childNodes && this.childNodes[0]; - } - - get nextSibling() { - const childNodes = this.parentNode.childNodes; - - if (!childNodes) { - return undefined; + default: + return true; + } } - const index = childNodes.indexOf(this); - - if (index === -1) { - return undefined; - } - - return childNodes[index + 1]; + return operator === "And"; } - get textContent() { - if (!this.childNodes) { - return this.nodeValue || ""; + isVisible(group) { + if (group.type === "OCG") { + if (!this._groups.has(group.id)) { + (0, _util.warn)(`Optional content group not found: ${group.id}`); + return true; + } + + return this._groups.get(group.id).visible; + } else if (group.type === "OCMD") { + if (group.expression) { + return this._evaluateVisibilityExpression(group.expression); + } + + if (!group.policy || group.policy === "AnyOn") { + for (const id of group.ids) { + if (!this._groups.has(id)) { + (0, _util.warn)(`Optional content group not found: ${id}`); + return true; + } + + if (this._groups.get(id).visible) { + return true; + } + } + + return false; + } else if (group.policy === "AllOn") { + for (const id of group.ids) { + if (!this._groups.has(id)) { + (0, _util.warn)(`Optional content group not found: ${id}`); + return true; + } + + if (!this._groups.get(id).visible) { + return false; + } + } + + return true; + } else if (group.policy === "AnyOff") { + for (const id of group.ids) { + if (!this._groups.has(id)) { + (0, _util.warn)(`Optional content group not found: ${id}`); + return true; + } + + if (!this._groups.get(id).visible) { + return true; + } + } + + return false; + } else if (group.policy === "AllOff") { + for (const id of group.ids) { + if (!this._groups.has(id)) { + (0, _util.warn)(`Optional content group not found: ${id}`); + return true; + } + + if (this._groups.get(id).visible) { + return false; + } + } + + return true; + } + + (0, _util.warn)(`Unknown optional content policy ${group.policy}.`); + return true; } - return this.childNodes.map(function (child) { - return child.textContent; - }).join(""); + (0, _util.warn)(`Unknown group type ${group.type}.`); + return true; } - hasChildNodes() { - return this.childNodes && this.childNodes.length > 0; + setVisibility(id, visible = true) { + if (!this._groups.has(id)) { + (0, _util.warn)(`Optional content group not found: ${id}`); + return; + } + + this._groups.get(id).visible = !!visible; + } + + getOrder() { + if (!this._groups.size) { + return null; + } + + if (this._order) { + return this._order.slice(); + } + + return Array.from(this._groups.keys()); + } + + getGroups() { + return this._groups.size > 0 ? (0, _util.objectFromMap)(this._groups) : null; + } + + getGroup(id) { + return this._groups.get(id) || null; } } -class SimpleXMLParser extends XMLParserBase { - constructor() { - super(); - this._currentFragment = null; - this._stack = null; - this._errorCode = XMLParserErrorCode.NoError; - } - - parseFromString(data) { - this._currentFragment = []; - this._stack = []; - this._errorCode = XMLParserErrorCode.NoError; - this.parseXml(data); - - if (this._errorCode !== XMLParserErrorCode.NoError) { - return undefined; - } - - const [documentElement] = this._currentFragment; - - if (!documentElement) { - return undefined; - } - - return { - documentElement - }; - } - - onResolveEntity(name) { - switch (name) { - case "apos": - return "'"; - } - - return super.onResolveEntity(name); - } - - onText(text) { - if (isWhitespaceString(text)) { - return; - } - - const node = new SimpleDOMNode("#text", text); - - this._currentFragment.push(node); - } - - onCdata(text) { - const node = new SimpleDOMNode("#text", text); - - this._currentFragment.push(node); - } - - onBeginElement(name, attributes, isEmpty) { - const node = new SimpleDOMNode(name); - node.childNodes = []; - - this._currentFragment.push(node); - - if (isEmpty) { - return; - } - - this._stack.push(this._currentFragment); - - this._currentFragment = node.childNodes; - } - - onEndElement(name) { - this._currentFragment = this._stack.pop() || []; - const lastElement = this._currentFragment[this._currentFragment.length - 1]; - - if (!lastElement) { - return; - } - - for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) { - lastElement.childNodes[i].parentNode = lastElement; - } - } - - onError(code) { - this._errorCode = code; - } - -} - -exports.SimpleXMLParser = SimpleXMLParser; +exports.OptionalContentConfig = OptionalContentConfig; /***/ }), -/* 14 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 16 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFDataTransportStream = void 0; var _util = __w_pdfjs_require__(2); +var _display_utils = __w_pdfjs_require__(1); + class PDFDataTransportStream { constructor(params, pdfDataRangeTransport) { (0, _util.assert)(pdfDataRangeTransport, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'); this._queuedChunks = []; this._progressiveDone = params.progressiveDone || false; + this._contentDispositionFilename = params.contentDispositionFilename || null; const initialData = params.initialData; - if (initialData && initialData.length > 0) { + if (initialData?.length > 0) { const buffer = new Uint8Array(initialData).buffer; this._queuedChunks.push(buffer); @@ -7916,14 +8139,14 @@ class PDFDataTransportStream { } get _progressiveDataLength() { - return this._fullRequestReader ? this._fullRequestReader._loaded : 0; + return this._fullRequestReader?._loaded ?? 0; } _onProgress(evt) { if (evt.total === undefined) { const firstReader = this._rangeReaders[0]; - if (firstReader && firstReader.onProgress) { + if (firstReader?.onProgress) { firstReader.onProgress({ loaded: evt.loaded }); @@ -7931,7 +8154,7 @@ class PDFDataTransportStream { } else { const fullReader = this._fullRequestReader; - if (fullReader && fullReader.onProgress) { + if (fullReader?.onProgress) { fullReader.onProgress({ loaded: evt.loaded, total: evt.total @@ -7960,7 +8183,7 @@ class PDFDataTransportStream { (0, _util.assert)(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once."); const queuedChunks = this._queuedChunks; this._queuedChunks = null; - return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone); + return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone, this._contentDispositionFilename); } getRangeReader(begin, end) { @@ -7982,11 +8205,9 @@ class PDFDataTransportStream { this._fullRequestReader.cancel(reason); } - const readers = this._rangeReaders.slice(0); - - readers.forEach(function (rangeReader) { - rangeReader.cancel(reason); - }); + for (const reader of this._rangeReaders.slice(0)) { + reader.cancel(reason); + } this._pdfDataRangeTransport.abort(); } @@ -7996,10 +8217,10 @@ class PDFDataTransportStream { exports.PDFDataTransportStream = PDFDataTransportStream; class PDFDataTransportStreamReader { - constructor(stream, queuedChunks, progressiveDone = false) { + constructor(stream, queuedChunks, progressiveDone = false, contentDispositionFilename = null) { this._stream = stream; this._done = progressiveDone || false; - this._filename = null; + this._filename = (0, _display_utils.isPdfFile)(contentDispositionFilename) ? contentDispositionFilename : null; this._queuedChunks = queuedChunks || []; this._loaded = 0; @@ -8079,14 +8300,14 @@ class PDFDataTransportStreamReader { cancel(reason) { this._done = true; - this._requests.forEach(function (requestCapability) { + for (const requestCapability of this._requests) { requestCapability.resolve({ value: undefined, done: true }); - }); + } - this._requests = []; + this._requests.length = 0; } progressiveDone() { @@ -8125,14 +8346,14 @@ class PDFDataTransportStreamRangeReader { done: false }); - this._requests.forEach(function (requestCapability) { + for (const requestCapability of this._requests) { requestCapability.resolve({ value: undefined, done: true }); - }); + } - this._requests = []; + this._requests.length = 0; } this._done = true; @@ -8171,14 +8392,14 @@ class PDFDataTransportStreamRangeReader { cancel(reason) { this._done = true; - this._requests.forEach(function (requestCapability) { + for (const requestCapability of this._requests) { requestCapability.resolve({ value: undefined, done: true }); - }); + } - this._requests = []; + this._requests.length = 0; this._stream._removeRangeReader(this); } @@ -8186,468 +8407,24 @@ class PDFDataTransportStreamRangeReader { } /***/ }), -/* 15 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 17 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.WebGLContext = void 0; - -var _util = __w_pdfjs_require__(2); - -class WebGLContext { - constructor({ - enable = false - }) { - this._enabled = enable === true; - } - - get isEnabled() { - let enabled = this._enabled; - - if (enabled) { - enabled = WebGLUtils.tryInitGL(); - } - - return (0, _util.shadow)(this, "isEnabled", enabled); - } - - composeSMask({ - layer, - mask, - properties - }) { - return WebGLUtils.composeSMask(layer, mask, properties); - } - - drawFigures({ - width, - height, - backgroundColor, - figures, - context - }) { - return WebGLUtils.drawFigures(width, height, backgroundColor, figures, context); - } - - clear() { - WebGLUtils.cleanup(); - } - -} - -exports.WebGLContext = WebGLContext; - -var WebGLUtils = function WebGLUtilsClosure() { - function loadShader(gl, code, shaderType) { - var shader = gl.createShader(shaderType); - gl.shaderSource(shader, code); - gl.compileShader(shader); - var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS); - - if (!compiled) { - var errorMsg = gl.getShaderInfoLog(shader); - throw new Error("Error during shader compilation: " + errorMsg); - } - - return shader; - } - - function createVertexShader(gl, code) { - return loadShader(gl, code, gl.VERTEX_SHADER); - } - - function createFragmentShader(gl, code) { - return loadShader(gl, code, gl.FRAGMENT_SHADER); - } - - function createProgram(gl, shaders) { - var program = gl.createProgram(); - - for (var i = 0, ii = shaders.length; i < ii; ++i) { - gl.attachShader(program, shaders[i]); - } - - gl.linkProgram(program); - var linked = gl.getProgramParameter(program, gl.LINK_STATUS); - - if (!linked) { - var errorMsg = gl.getProgramInfoLog(program); - throw new Error("Error during program linking: " + errorMsg); - } - - return program; - } - - function createTexture(gl, image, textureId) { - gl.activeTexture(textureId); - var texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - return texture; - } - - var currentGL, currentCanvas; - - function generateGL() { - if (currentGL) { - return; - } - - currentCanvas = document.createElement("canvas"); - currentGL = currentCanvas.getContext("webgl", { - premultipliedalpha: false - }); - } - - var smaskVertexShaderCode = "\ - attribute vec2 a_position; \ - attribute vec2 a_texCoord; \ - \ - uniform vec2 u_resolution; \ - \ - varying vec2 v_texCoord; \ - \ - void main() { \ - vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \ - gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ - \ - v_texCoord = a_texCoord; \ - } "; - var smaskFragmentShaderCode = "\ - precision mediump float; \ - \ - uniform vec4 u_backdrop; \ - uniform int u_subtype; \ - uniform sampler2D u_image; \ - uniform sampler2D u_mask; \ - \ - varying vec2 v_texCoord; \ - \ - void main() { \ - vec4 imageColor = texture2D(u_image, v_texCoord); \ - vec4 maskColor = texture2D(u_mask, v_texCoord); \ - if (u_backdrop.a > 0.0) { \ - maskColor.rgb = maskColor.rgb * maskColor.a + \ - u_backdrop.rgb * (1.0 - maskColor.a); \ - } \ - float lum; \ - if (u_subtype == 0) { \ - lum = maskColor.a; \ - } else { \ - lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \ - maskColor.b * 0.11; \ - } \ - imageColor.a *= lum; \ - imageColor.rgb *= imageColor.a; \ - gl_FragColor = imageColor; \ - } "; - var smaskCache = null; - - function initSmaskGL() { - var canvas, gl; - generateGL(); - canvas = currentCanvas; - currentCanvas = null; - gl = currentGL; - currentGL = null; - var vertexShader = createVertexShader(gl, smaskVertexShaderCode); - var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode); - var program = createProgram(gl, [vertexShader, fragmentShader]); - gl.useProgram(program); - var cache = {}; - cache.gl = gl; - cache.canvas = canvas; - cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution"); - cache.positionLocation = gl.getAttribLocation(program, "a_position"); - cache.backdropLocation = gl.getUniformLocation(program, "u_backdrop"); - cache.subtypeLocation = gl.getUniformLocation(program, "u_subtype"); - var texCoordLocation = gl.getAttribLocation(program, "a_texCoord"); - var texLayerLocation = gl.getUniformLocation(program, "u_image"); - var texMaskLocation = gl.getUniformLocation(program, "u_mask"); - var texCoordBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0]), gl.STATIC_DRAW); - gl.enableVertexAttribArray(texCoordLocation); - gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0); - gl.uniform1i(texLayerLocation, 0); - gl.uniform1i(texMaskLocation, 1); - smaskCache = cache; - } - - function composeSMask(layer, mask, properties) { - var width = layer.width, - height = layer.height; - - if (!smaskCache) { - initSmaskGL(); - } - - var cache = smaskCache, - canvas = cache.canvas, - gl = cache.gl; - canvas.width = width; - canvas.height = height; - gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); - gl.uniform2f(cache.resolutionLocation, width, height); - - if (properties.backdrop) { - gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], properties.backdrop[1], properties.backdrop[2], 1); - } else { - gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0); - } - - gl.uniform1i(cache.subtypeLocation, properties.subtype === "Luminosity" ? 1 : 0); - var texture = createTexture(gl, layer, gl.TEXTURE0); - var maskTexture = createTexture(gl, mask, gl.TEXTURE1); - var buffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, width, 0, 0, height, 0, height, width, 0, width, height]), gl.STATIC_DRAW); - gl.enableVertexAttribArray(cache.positionLocation); - gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); - gl.clearColor(0, 0, 0, 0); - gl.enable(gl.BLEND); - gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.clear(gl.COLOR_BUFFER_BIT); - gl.drawArrays(gl.TRIANGLES, 0, 6); - gl.flush(); - gl.deleteTexture(texture); - gl.deleteTexture(maskTexture); - gl.deleteBuffer(buffer); - return canvas; - } - - var figuresVertexShaderCode = "\ - attribute vec2 a_position; \ - attribute vec3 a_color; \ - \ - uniform vec2 u_resolution; \ - uniform vec2 u_scale; \ - uniform vec2 u_offset; \ - \ - varying vec4 v_color; \ - \ - void main() { \ - vec2 position = (a_position + u_offset) * u_scale; \ - vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \ - gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ - \ - v_color = vec4(a_color / 255.0, 1.0); \ - } "; - var figuresFragmentShaderCode = "\ - precision mediump float; \ - \ - varying vec4 v_color; \ - \ - void main() { \ - gl_FragColor = v_color; \ - } "; - var figuresCache = null; - - function initFiguresGL() { - var canvas, gl; - generateGL(); - canvas = currentCanvas; - currentCanvas = null; - gl = currentGL; - currentGL = null; - var vertexShader = createVertexShader(gl, figuresVertexShaderCode); - var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode); - var program = createProgram(gl, [vertexShader, fragmentShader]); - gl.useProgram(program); - var cache = {}; - cache.gl = gl; - cache.canvas = canvas; - cache.resolutionLocation = gl.getUniformLocation(program, "u_resolution"); - cache.scaleLocation = gl.getUniformLocation(program, "u_scale"); - cache.offsetLocation = gl.getUniformLocation(program, "u_offset"); - cache.positionLocation = gl.getAttribLocation(program, "a_position"); - cache.colorLocation = gl.getAttribLocation(program, "a_color"); - figuresCache = cache; - } - - function drawFigures(width, height, backgroundColor, figures, context) { - if (!figuresCache) { - initFiguresGL(); - } - - var cache = figuresCache, - canvas = cache.canvas, - gl = cache.gl; - canvas.width = width; - canvas.height = height; - gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); - gl.uniform2f(cache.resolutionLocation, width, height); - var count = 0; - var i, ii, rows; - - for (i = 0, ii = figures.length; i < ii; i++) { - switch (figures[i].type) { - case "lattice": - rows = figures[i].coords.length / figures[i].verticesPerRow | 0; - count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6; - break; - - case "triangles": - count += figures[i].coords.length; - break; - } - } - - var coords = new Float32Array(count * 2); - var colors = new Uint8Array(count * 3); - var coordsMap = context.coords, - colorsMap = context.colors; - var pIndex = 0, - cIndex = 0; - - for (i = 0, ii = figures.length; i < ii; i++) { - var figure = figures[i], - ps = figure.coords, - cs = figure.colors; - - switch (figure.type) { - case "lattice": - var cols = figure.verticesPerRow; - rows = ps.length / cols | 0; - - for (var row = 1; row < rows; row++) { - var offset = row * cols + 1; - - for (var col = 1; col < cols; col++, offset++) { - coords[pIndex] = coordsMap[ps[offset - cols - 1]]; - coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1]; - coords[pIndex + 2] = coordsMap[ps[offset - cols]]; - coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1]; - coords[pIndex + 4] = coordsMap[ps[offset - 1]]; - coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1]; - colors[cIndex] = colorsMap[cs[offset - cols - 1]]; - colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1]; - colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2]; - colors[cIndex + 3] = colorsMap[cs[offset - cols]]; - colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1]; - colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2]; - colors[cIndex + 6] = colorsMap[cs[offset - 1]]; - colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1]; - colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2]; - coords[pIndex + 6] = coords[pIndex + 2]; - coords[pIndex + 7] = coords[pIndex + 3]; - coords[pIndex + 8] = coords[pIndex + 4]; - coords[pIndex + 9] = coords[pIndex + 5]; - coords[pIndex + 10] = coordsMap[ps[offset]]; - coords[pIndex + 11] = coordsMap[ps[offset] + 1]; - colors[cIndex + 9] = colors[cIndex + 3]; - colors[cIndex + 10] = colors[cIndex + 4]; - colors[cIndex + 11] = colors[cIndex + 5]; - colors[cIndex + 12] = colors[cIndex + 6]; - colors[cIndex + 13] = colors[cIndex + 7]; - colors[cIndex + 14] = colors[cIndex + 8]; - colors[cIndex + 15] = colorsMap[cs[offset]]; - colors[cIndex + 16] = colorsMap[cs[offset] + 1]; - colors[cIndex + 17] = colorsMap[cs[offset] + 2]; - pIndex += 12; - cIndex += 18; - } - } - - break; - - case "triangles": - for (var j = 0, jj = ps.length; j < jj; j++) { - coords[pIndex] = coordsMap[ps[j]]; - coords[pIndex + 1] = coordsMap[ps[j] + 1]; - colors[cIndex] = colorsMap[cs[j]]; - colors[cIndex + 1] = colorsMap[cs[j] + 1]; - colors[cIndex + 2] = colorsMap[cs[j] + 2]; - pIndex += 2; - cIndex += 3; - } - - break; - } - } - - if (backgroundColor) { - gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, backgroundColor[2] / 255, 1.0); - } else { - gl.clearColor(0, 0, 0, 0); - } - - gl.clear(gl.COLOR_BUFFER_BIT); - var coordsBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer); - gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW); - gl.enableVertexAttribArray(cache.positionLocation); - gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); - var colorsBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer); - gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW); - gl.enableVertexAttribArray(cache.colorLocation); - gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, 0, 0); - gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY); - gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY); - gl.drawArrays(gl.TRIANGLES, 0, count); - gl.flush(); - gl.deleteBuffer(coordsBuffer); - gl.deleteBuffer(colorsBuffer); - return canvas; - } - - return { - tryInitGL() { - try { - generateGL(); - return !!currentGL; - } catch (ex) {} - - return false; - }, - - composeSMask, - drawFigures, - - cleanup() { - if (smaskCache && smaskCache.canvas) { - smaskCache.canvas.width = 0; - smaskCache.canvas.height = 0; - } - - if (figuresCache && figuresCache.canvas) { - figuresCache.canvas.width = 0; - figuresCache.canvas.height = 0; - } - - smaskCache = null; - figuresCache = null; - } - - }; -}(); - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); +})); exports.AnnotationLayer = void 0; var _display_utils = __w_pdfjs_require__(1); var _util = __w_pdfjs_require__(2); +var _annotation_storage = __w_pdfjs_require__(8); + +var _scripting_utils = __w_pdfjs_require__(18); + class AnnotationElementFactory { static create(parameters) { const subtype = parameters.data.annotationType; @@ -8734,7 +8511,11 @@ class AnnotationElementFactory { } class AnnotationElement { - constructor(parameters, isRenderable = false, ignoreBorder = false) { + constructor(parameters, { + isRenderable = false, + ignoreBorder = false, + createQuadrilaterals = false + } = {}) { this.isRenderable = isRenderable; this.data = parameters.data; this.layer = parameters.layer; @@ -8745,10 +8526,18 @@ class AnnotationElement { this.imageResourcesPath = parameters.imageResourcesPath; this.renderInteractiveForms = parameters.renderInteractiveForms; this.svgFactory = parameters.svgFactory; + this.annotationStorage = parameters.annotationStorage; + this.enableScripting = parameters.enableScripting; + this.hasJSActions = parameters.hasJSActions; + this._mouseState = parameters.mouseState; if (isRenderable) { this.container = this._createContainer(ignoreBorder); } + + if (createQuadrilaterals) { + this.quadrilaterals = this._createQuadrilaterals(ignoreBorder); + } } _createContainer(ignoreBorder = false) { @@ -8763,7 +8552,7 @@ class AnnotationElement { const rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]); container.style.transform = `matrix(${viewport.transform.join(",")})`; - container.style.transformOrigin = `-${rect[0]}px -${rect[1]}px`; + container.style.transformOrigin = `${-rect[0]}px ${-rect[1]}px`; if (!ignoreBorder && data.borderStyle.width > 0) { container.style.borderWidth = `${data.borderStyle.width}px`; @@ -8807,7 +8596,7 @@ class AnnotationElement { } if (data.color) { - container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0); + container.style.borderColor = _util.Util.makeHexColor(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0); } else { container.style.borderWidth = 0; } @@ -8820,7 +8609,31 @@ class AnnotationElement { return container; } - _createPopup(container, trigger, data) { + _createQuadrilaterals(ignoreBorder = false) { + if (!this.data.quadPoints) { + return null; + } + + const quadrilaterals = []; + const savedRect = this.data.rect; + + for (const quadPoint of this.data.quadPoints) { + this.data.rect = [quadPoint[2].x, quadPoint[2].y, quadPoint[1].x, quadPoint[1].y]; + quadrilaterals.push(this._createContainer(ignoreBorder)); + } + + this.data.rect = savedRect; + return quadrilaterals; + } + + _createPopup(trigger, data) { + let container = this.container; + + if (this.quadrilaterals) { + trigger = trigger || this.quadrilaterals; + container = this.quadrilaterals[0]; + } + if (!trigger) { trigger = document.createElement("div"); trigger.style.height = container.style.height; @@ -8842,6 +8655,14 @@ class AnnotationElement { container.appendChild(popup); } + _renderQuadrilaterals(className) { + for (const quadrilateral of this.quadrilaterals) { + quadrilateral.className = className; + } + + return this.quadrilaterals; + } + render() { (0, _util.unreachable)("Abstract method `AnnotationElement.render` called"); } @@ -8850,12 +8671,14 @@ class AnnotationElement { class LinkAnnotationElement extends AnnotationElement { constructor(parameters) { - const isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action); - super(parameters, isRenderable); + const isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action || parameters.data.isTooltipOnly || parameters.data.actions && (parameters.data.actions.Action || parameters.data.actions["Mouse Up"] || parameters.data.actions["Mouse Down"])); + super(parameters, { + isRenderable, + createQuadrilaterals: true + }); } render() { - this.container.className = "linkAnnotation"; const { data, linkService @@ -8871,10 +8694,23 @@ class LinkAnnotationElement extends AnnotationElement { }); } else if (data.action) { this._bindNamedAction(link, data.action); - } else { + } else if (data.dest) { this._bindLink(link, data.dest); + } else if (data.actions && (data.actions.Action || data.actions["Mouse Up"] || data.actions["Mouse Down"]) && this.enableScripting && this.hasJSActions) { + this._bindJSAction(link, data); + } else { + this._bindLink(link, ""); } + if (this.quadrilaterals) { + return this._renderQuadrilaterals("linkAnnotation").map((quadrilateral, index) => { + const linkElement = index === 0 ? link : link.cloneNode(); + quadrilateral.appendChild(linkElement); + return quadrilateral; + }); + } + + this.container.className = "linkAnnotation"; this.container.appendChild(link); return this.container; } @@ -8884,13 +8720,13 @@ class LinkAnnotationElement extends AnnotationElement { link.onclick = () => { if (destination) { - this.linkService.navigateTo(destination); + this.linkService.goToDestination(destination); } return false; }; - if (destination) { + if (destination || destination === "") { link.className = "internalLink"; } } @@ -8906,12 +8742,40 @@ class LinkAnnotationElement extends AnnotationElement { link.className = "internalLink"; } + _bindJSAction(link, data) { + link.href = this.linkService.getAnchorUrl(""); + const map = new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]); + + for (const name of Object.keys(data.actions)) { + const jsName = map.get(name); + + if (!jsName) { + continue; + } + + link[jsName] = () => { + this.linkService.eventBus?.dispatch("dispatcheventinsandbox", { + source: this, + detail: { + id: data.id, + name + } + }); + return false; + }; + } + + link.className = "internalLink"; + } + } class TextAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable); + super(parameters, { + isRenderable + }); } render() { @@ -8927,7 +8791,7 @@ class TextAnnotationElement extends AnnotationElement { }); if (!this.data.hasPopup) { - this._createPopup(this.container, image, this.data); + this._createPopup(image, this.data); } this.container.appendChild(image); @@ -8938,30 +8802,335 @@ class TextAnnotationElement extends AnnotationElement { class WidgetAnnotationElement extends AnnotationElement { render() { + if (this.data.alternativeText) { + this.container.title = this.data.alternativeText; + } + return this.container; } + _getKeyModifier(event) { + return navigator.platform.includes("Win") && event.ctrlKey || navigator.platform.includes("Mac") && event.metaKey; + } + + _setEventListener(element, baseName, eventName, valueGetter) { + if (baseName.includes("mouse")) { + element.addEventListener(baseName, event => { + this.linkService.eventBus?.dispatch("dispatcheventinsandbox", { + source: this, + detail: { + id: this.data.id, + name: eventName, + value: valueGetter(event), + shift: event.shiftKey, + modifier: this._getKeyModifier(event) + } + }); + }); + } else { + element.addEventListener(baseName, event => { + this.linkService.eventBus?.dispatch("dispatcheventinsandbox", { + source: this, + detail: { + id: this.data.id, + name: eventName, + value: event.target.checked + } + }); + }); + } + } + + _setEventListeners(element, names, getter) { + for (const [baseName, eventName] of names) { + if (eventName === "Action" || this.data.actions?.[eventName]) { + this._setEventListener(element, baseName, eventName, getter); + } + } + } + + _dispatchEventFromSandbox(actions, jsEvent) { + const setColor = (jsName, styleName, event) => { + const color = event.detail[jsName]; + event.target.style[styleName] = _scripting_utils.ColorConverters[`${color[0]}_HTML`](color.slice(1)); + }; + + const commonActions = { + display: event => { + const hidden = event.detail.display % 2 === 1; + event.target.style.visibility = hidden ? "hidden" : "visible"; + this.annotationStorage.setValue(this.data.id, { + hidden, + print: event.detail.display === 0 || event.detail.display === 3 + }); + }, + print: event => { + this.annotationStorage.setValue(this.data.id, { + print: event.detail.print + }); + }, + hidden: event => { + event.target.style.visibility = event.detail.hidden ? "hidden" : "visible"; + this.annotationStorage.setValue(this.data.id, { + hidden: event.detail.hidden + }); + }, + focus: event => { + setTimeout(() => event.target.focus({ + preventScroll: false + }), 0); + }, + userName: event => { + event.target.title = event.detail.userName; + }, + readonly: event => { + if (event.detail.readonly) { + event.target.setAttribute("readonly", ""); + } else { + event.target.removeAttribute("readonly"); + } + }, + required: event => { + if (event.detail.required) { + event.target.setAttribute("required", ""); + } else { + event.target.removeAttribute("required"); + } + }, + bgColor: event => { + setColor("bgColor", "backgroundColor", event); + }, + fillColor: event => { + setColor("fillColor", "backgroundColor", event); + }, + fgColor: event => { + setColor("fgColor", "color", event); + }, + textColor: event => { + setColor("textColor", "color", event); + }, + borderColor: event => { + setColor("borderColor", "borderColor", event); + }, + strokeColor: event => { + setColor("strokeColor", "borderColor", event); + } + }; + + for (const name of Object.keys(jsEvent.detail)) { + const action = actions[name] || commonActions[name]; + + if (action) { + action(jsEvent); + } + } + } + } class TextWidgetAnnotationElement extends WidgetAnnotationElement { constructor(parameters) { const isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue; - super(parameters, isRenderable); + super(parameters, { + isRenderable + }); + } + + setPropertyOnSiblings(base, key, value, keyInStorage) { + const storage = this.annotationStorage; + + for (const element of document.getElementsByName(base.name)) { + if (element !== base) { + element[key] = value; + const data = Object.create(null); + data[keyInStorage] = value; + storage.setValue(element.getAttribute("id"), data); + } + } } render() { - const TEXT_ALIGNMENT = ["left", "center", "right"]; + const storage = this.annotationStorage; + const id = this.data.id; this.container.className = "textWidgetAnnotation"; let element = null; if (this.renderInteractiveForms) { + const storedData = storage.getValue(id, { + value: this.data.fieldValue, + valueAsString: this.data.fieldValue + }); + const textContent = storedData.valueAsString || storedData.value || ""; + const elementData = { + userValue: null, + formattedValue: null, + beforeInputSelectionRange: null, + beforeInputValue: null + }; + if (this.data.multiLine) { element = document.createElement("textarea"); - element.textContent = this.data.fieldValue; + element.textContent = textContent; } else { element = document.createElement("input"); element.type = "text"; - element.setAttribute("value", this.data.fieldValue); + element.setAttribute("value", textContent); + } + + elementData.userValue = textContent; + element.setAttribute("id", id); + element.addEventListener("input", event => { + storage.setValue(id, { + value: event.target.value + }); + this.setPropertyOnSiblings(element, "value", event.target.value, "value"); + }); + + let blurListener = event => { + if (elementData.formattedValue) { + event.target.value = elementData.formattedValue; + } + + event.target.scrollLeft = 0; + elementData.beforeInputSelectionRange = null; + }; + + if (this.enableScripting && this.hasJSActions) { + element.addEventListener("focus", event => { + if (elementData.userValue) { + event.target.value = elementData.userValue; + } + }); + element.addEventListener("updatefromsandbox", jsEvent => { + const actions = { + value(event) { + elementData.userValue = event.detail.value || ""; + storage.setValue(id, { + value: elementData.userValue.toString() + }); + + if (!elementData.formattedValue) { + event.target.value = elementData.userValue; + } + }, + + valueAsString(event) { + elementData.formattedValue = event.detail.valueAsString || ""; + + if (event.target !== document.activeElement) { + event.target.value = elementData.formattedValue; + } + + storage.setValue(id, { + formattedValue: elementData.formattedValue + }); + }, + + selRange(event) { + const [selStart, selEnd] = event.detail.selRange; + + if (selStart >= 0 && selEnd < event.target.value.length) { + event.target.setSelectionRange(selStart, selEnd); + } + } + + }; + + this._dispatchEventFromSandbox(actions, jsEvent); + }); + element.addEventListener("keydown", event => { + elementData.beforeInputValue = event.target.value; + let commitKey = -1; + + if (event.key === "Escape") { + commitKey = 0; + } else if (event.key === "Enter") { + commitKey = 2; + } else if (event.key === "Tab") { + commitKey = 3; + } + + if (commitKey === -1) { + return; + } + + elementData.userValue = event.target.value; + this.linkService.eventBus?.dispatch("dispatcheventinsandbox", { + source: this, + detail: { + id, + name: "Keystroke", + value: event.target.value, + willCommit: true, + commitKey, + selStart: event.target.selectionStart, + selEnd: event.target.selectionEnd + } + }); + }); + const _blurListener = blurListener; + blurListener = null; + element.addEventListener("blur", event => { + if (this._mouseState.isDown) { + elementData.userValue = event.target.value; + this.linkService.eventBus?.dispatch("dispatcheventinsandbox", { + source: this, + detail: { + id, + name: "Keystroke", + value: event.target.value, + willCommit: true, + commitKey: 1, + selStart: event.target.selectionStart, + selEnd: event.target.selectionEnd + } + }); + } + + _blurListener(event); + }); + element.addEventListener("mousedown", event => { + elementData.beforeInputValue = event.target.value; + elementData.beforeInputSelectionRange = null; + }); + element.addEventListener("keyup", event => { + if (event.target.selectionStart === event.target.selectionEnd) { + elementData.beforeInputSelectionRange = null; + } + }); + element.addEventListener("select", event => { + elementData.beforeInputSelectionRange = [event.target.selectionStart, event.target.selectionEnd]; + }); + + if (this.data.actions?.Keystroke) { + element.addEventListener("input", event => { + let selStart = -1; + let selEnd = -1; + + if (elementData.beforeInputSelectionRange) { + [selStart, selEnd] = elementData.beforeInputSelectionRange; + } + + this.linkService.eventBus?.dispatch("dispatcheventinsandbox", { + source: this, + detail: { + id, + name: "Keystroke", + value: elementData.beforeInputValue, + change: event.data, + willCommit: false, + selStart, + selEnd + } + }); + }); + } + + this._setEventListeners(element, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.value); + } + + if (blurListener) { + element.addEventListener("blur", blurListener); } element.disabled = this.data.readOnly; @@ -8982,65 +9151,103 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { element.textContent = this.data.fieldValue; element.style.verticalAlign = "middle"; element.style.display = "table-cell"; - let font = null; - - if (this.data.fontRefName && this.page.commonObjs.has(this.data.fontRefName)) { - font = this.page.commonObjs.get(this.data.fontRefName); - } - - this._setTextStyle(element, font); } - if (this.data.textAlignment !== null) { - element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment]; - } + this._setTextStyle(element); this.container.appendChild(element); return this.container; } - _setTextStyle(element, font) { + _setTextStyle(element) { + const TEXT_ALIGNMENT = ["left", "center", "right"]; + const { + fontSize, + fontColor + } = this.data.defaultAppearanceData; const style = element.style; - style.fontSize = `${this.data.fontSize}px`; - style.direction = this.data.fontDirection < 0 ? "rtl" : "ltr"; - if (!font) { - return; + if (fontSize) { + style.fontSize = `${fontSize}px`; } - let bold = "normal"; + style.color = _util.Util.makeHexColor(fontColor[0], fontColor[1], fontColor[2]); - if (font.black) { - bold = "900"; - } else if (font.bold) { - bold = "bold"; + if (this.data.textAlignment !== null) { + style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment]; } - - style.fontWeight = bold; - style.fontStyle = font.italic ? "italic" : "normal"; - const fontFamily = font.loadedName ? `"${font.loadedName}", ` : ""; - const fallbackName = font.fallbackName || "Helvetica, sans-serif"; - style.fontFamily = fontFamily + fallbackName; } } class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement { constructor(parameters) { - super(parameters, parameters.renderInteractiveForms); + super(parameters, { + isRenderable: parameters.renderInteractiveForms + }); } render() { + const storage = this.annotationStorage; + const data = this.data; + const id = data.id; + let value = storage.getValue(id, { + value: data.fieldValue && (data.exportValue && data.exportValue === data.fieldValue || !data.exportValue && data.fieldValue !== "Off") + }).value; + + if (typeof value === "string") { + value = value !== "Off"; + storage.setValue(id, { + value + }); + } + this.container.className = "buttonWidgetAnnotation checkBox"; const element = document.createElement("input"); - element.disabled = this.data.readOnly; + element.disabled = data.readOnly; element.type = "checkbox"; element.name = this.data.fieldName; - if (this.data.fieldValue && this.data.fieldValue !== "Off") { + if (value) { element.setAttribute("checked", true); } + element.setAttribute("id", id); + element.addEventListener("change", function (event) { + const name = event.target.name; + + for (const checkbox of document.getElementsByName(name)) { + if (checkbox !== event.target) { + checkbox.checked = false; + storage.setValue(checkbox.parentNode.getAttribute("data-annotation-id"), { + value: false + }); + } + } + + storage.setValue(id, { + value: event.target.checked + }); + }); + + if (this.enableScripting && this.hasJSActions) { + element.addEventListener("updatefromsandbox", jsEvent => { + const actions = { + value(event) { + event.target.checked = event.detail.value !== "Off"; + storage.setValue(id, { + value: event.target.checked + }); + } + + }; + + this._dispatchEventFromSandbox(actions, jsEvent); + }); + + this._setEventListeners(element, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.checked); + } + this.container.appendChild(element); return this.container; } @@ -9049,20 +9256,79 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement { class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement { constructor(parameters) { - super(parameters, parameters.renderInteractiveForms); + super(parameters, { + isRenderable: parameters.renderInteractiveForms + }); } render() { this.container.className = "buttonWidgetAnnotation radioButton"; - const element = document.createElement("input"); - element.disabled = this.data.readOnly; - element.type = "radio"; - element.name = this.data.fieldName; + const storage = this.annotationStorage; + const data = this.data; + const id = data.id; + let value = storage.getValue(id, { + value: data.fieldValue === data.buttonValue + }).value; - if (this.data.fieldValue === this.data.buttonValue) { + if (typeof value === "string") { + value = value !== data.buttonValue; + storage.setValue(id, { + value + }); + } + + const element = document.createElement("input"); + element.disabled = data.readOnly; + element.type = "radio"; + element.name = data.fieldName; + + if (value) { element.setAttribute("checked", true); } + element.setAttribute("id", id); + element.addEventListener("change", function (event) { + const { + target + } = event; + + for (const radio of document.getElementsByName(target.name)) { + if (radio !== target) { + storage.setValue(radio.getAttribute("id"), { + value: false + }); + } + } + + storage.setValue(id, { + value: target.checked + }); + }); + + if (this.enableScripting && this.hasJSActions) { + const pdfButtonValue = data.buttonValue; + element.addEventListener("updatefromsandbox", jsEvent => { + const actions = { + value(event) { + const checked = pdfButtonValue === event.detail.value; + + for (const radio of document.getElementsByName(event.target.name)) { + const radioId = radio.getAttribute("id"); + radio.checked = radioId === id && checked; + storage.setValue(radioId, { + value: radio.checked + }); + } + } + + }; + + this._dispatchEventFromSandbox(actions, jsEvent); + }); + + this._setEventListeners(element, [["change", "Validate"], ["change", "Action"], ["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"]], event => event.target.checked); + } + this.container.appendChild(element); return this.container; } @@ -9073,6 +9339,11 @@ class PushButtonWidgetAnnotationElement extends LinkAnnotationElement { render() { const container = super.render(); container.className = "buttonWidgetAnnotation pushButton"; + + if (this.data.alternativeText) { + container.title = this.data.alternativeText; + } + return container; } @@ -9080,14 +9351,22 @@ class PushButtonWidgetAnnotationElement extends LinkAnnotationElement { class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement { constructor(parameters) { - super(parameters, parameters.renderInteractiveForms); + super(parameters, { + isRenderable: parameters.renderInteractiveForms + }); } render() { this.container.className = "choiceWidgetAnnotation"; + const storage = this.annotationStorage; + const id = this.data.id; + storage.getValue(id, { + value: this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : undefined + }); const selectElement = document.createElement("select"); selectElement.disabled = this.data.readOnly; selectElement.name = this.data.fieldName; + selectElement.setAttribute("id", id); if (!this.data.combo) { selectElement.size = this.data.options.length; @@ -9102,13 +9381,178 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement { optionElement.textContent = option.displayValue; optionElement.value = option.exportValue; - if (this.data.fieldValue.includes(option.displayValue)) { + if (this.data.fieldValue.includes(option.exportValue)) { optionElement.setAttribute("selected", true); } selectElement.appendChild(optionElement); } + const getValue = (event, isExport) => { + const name = isExport ? "value" : "textContent"; + const options = event.target.options; + + if (!event.target.multiple) { + return options.selectedIndex === -1 ? null : options[options.selectedIndex][name]; + } + + return Array.prototype.filter.call(options, option => option.selected).map(option => option[name]); + }; + + const getItems = event => { + const options = event.target.options; + return Array.prototype.map.call(options, option => { + return { + displayValue: option.textContent, + exportValue: option.value + }; + }); + }; + + if (this.enableScripting && this.hasJSActions) { + selectElement.addEventListener("updatefromsandbox", jsEvent => { + const actions = { + value(event) { + const options = selectElement.options; + const value = event.detail.value; + const values = new Set(Array.isArray(value) ? value : [value]); + Array.prototype.forEach.call(options, option => { + option.selected = values.has(option.value); + }); + storage.setValue(id, { + value: getValue(event, true) + }); + }, + + multipleSelection(event) { + selectElement.multiple = true; + }, + + remove(event) { + const options = selectElement.options; + const index = event.detail.remove; + options[index].selected = false; + selectElement.remove(index); + + if (options.length > 0) { + const i = Array.prototype.findIndex.call(options, option => option.selected); + + if (i === -1) { + options[0].selected = true; + } + } + + storage.setValue(id, { + value: getValue(event, true), + items: getItems(event) + }); + }, + + clear(event) { + while (selectElement.length !== 0) { + selectElement.remove(0); + } + + storage.setValue(id, { + value: null, + items: [] + }); + }, + + insert(event) { + const { + index, + displayValue, + exportValue + } = event.detail.insert; + const optionElement = document.createElement("option"); + optionElement.textContent = displayValue; + optionElement.value = exportValue; + selectElement.insertBefore(optionElement, selectElement.children[index]); + storage.setValue(id, { + value: getValue(event, true), + items: getItems(event) + }); + }, + + items(event) { + const { + items + } = event.detail; + + while (selectElement.length !== 0) { + selectElement.remove(0); + } + + for (const item of items) { + const { + displayValue, + exportValue + } = item; + const optionElement = document.createElement("option"); + optionElement.textContent = displayValue; + optionElement.value = exportValue; + selectElement.appendChild(optionElement); + } + + if (selectElement.options.length > 0) { + selectElement.options[0].selected = true; + } + + storage.setValue(id, { + value: getValue(event, true), + items: getItems(event) + }); + }, + + indices(event) { + const indices = new Set(event.detail.indices); + const options = event.target.options; + Array.prototype.forEach.call(options, (option, i) => { + option.selected = indices.has(i); + }); + storage.setValue(id, { + value: getValue(event, true) + }); + }, + + editable(event) { + event.target.disabled = !event.detail.editable; + } + + }; + + this._dispatchEventFromSandbox(actions, jsEvent); + }); + selectElement.addEventListener("input", event => { + const exportValue = getValue(event, true); + const value = getValue(event, false); + storage.setValue(id, { + value: exportValue + }); + this.linkService.eventBus?.dispatch("dispatcheventinsandbox", { + source: this, + detail: { + id, + name: "Keystroke", + value, + changeEx: exportValue, + willCommit: true, + commitKey: 1, + keyDown: false + } + }); + }); + + this._setEventListeners(selectElement, [["focus", "Focus"], ["blur", "Blur"], ["mousedown", "Mouse Down"], ["mouseenter", "Mouse Enter"], ["mouseleave", "Mouse Exit"], ["mouseup", "Mouse Up"], ["input", "Action"]], event => event.target.checked); + } else { + selectElement.addEventListener("input", function (event) { + storage.setValue(id, { + value: getValue(event) + }); + }); + } + this.container.appendChild(selectElement); return this.container; } @@ -9118,7 +9562,9 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement { class PopupAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.title || parameters.data.contents); - super(parameters, isRenderable); + super(parameters, { + isRenderable + }); } render() { @@ -9130,24 +9576,29 @@ class PopupAnnotationElement extends AnnotationElement { } const selector = `[data-annotation-id="${this.data.parentId}"]`; - const parentElement = this.layer.querySelector(selector); + const parentElements = this.layer.querySelectorAll(selector); - if (!parentElement) { + if (parentElements.length === 0) { return this.container; } const popup = new PopupElement({ container: this.container, - trigger: parentElement, + trigger: Array.from(parentElements), color: this.data.color, title: this.data.title, modificationDate: this.data.modificationDate, contents: this.data.contents }); - const parentLeft = parseFloat(parentElement.style.left); - const parentWidth = parseFloat(parentElement.style.width); - this.container.style.transformOrigin = `-${parentLeft + parentWidth}px -${parentElement.style.top}`; - this.container.style.left = `${parentLeft + parentWidth}px`; + const page = this.page; + + const rect = _util.Util.normalizeRect([this.data.parentRect[0], page.view[3] - this.data.parentRect[1] + page.view[1], this.data.parentRect[2], page.view[3] - this.data.parentRect[3] + page.view[1]]); + + const popupLeft = rect[0] + this.data.parentRect[2] - this.data.parentRect[0]; + const popupTop = rect[1]; + this.container.style.transformOrigin = `${-popupLeft}px ${-popupTop}px`; + this.container.style.left = `${popupLeft}px`; + this.container.style.top = `${popupTop}px`; this.container.appendChild(popup.render()); return this.container; } @@ -9171,7 +9622,7 @@ class PopupElement { const wrapper = document.createElement("div"); wrapper.className = "popupWrapper"; this.hideElement = this.hideWrapper ? wrapper : this.container; - this.hideElement.setAttribute("hidden", true); + this.hideElement.hidden = true; const popup = document.createElement("div"); popup.className = "popup"; const color = this.color; @@ -9180,7 +9631,7 @@ class PopupElement { const r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0]; const g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1]; const b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2]; - popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0); + popup.style.backgroundColor = _util.Util.makeHexColor(r | 0, g | 0, b | 0); } const title = document.createElement("h1"); @@ -9203,9 +9654,17 @@ class PopupElement { const contents = this._formatContents(this.contents); popup.appendChild(contents); - this.trigger.addEventListener("click", this._toggle.bind(this)); - this.trigger.addEventListener("mouseover", this._show.bind(this, false)); - this.trigger.addEventListener("mouseout", this._hide.bind(this, false)); + + if (!Array.isArray(this.trigger)) { + this.trigger = [this.trigger]; + } + + for (const element of this.trigger) { + element.addEventListener("click", this._toggle.bind(this)); + element.addEventListener("mouseover", this._show.bind(this, false)); + element.addEventListener("mouseout", this._hide.bind(this, false)); + } + popup.addEventListener("click", this._hide.bind(this, true)); wrapper.appendChild(popup); return wrapper; @@ -9240,8 +9699,8 @@ class PopupElement { this.pinned = true; } - if (this.hideElement.hasAttribute("hidden")) { - this.hideElement.removeAttribute("hidden"); + if (this.hideElement.hidden) { + this.hideElement.hidden = false; this.container.style.zIndex += 1; } } @@ -9251,8 +9710,8 @@ class PopupElement { this.pinned = false; } - if (!this.hideElement.hasAttribute("hidden") && !this.pinned) { - this.hideElement.setAttribute("hidden", true); + if (!this.hideElement.hidden && !this.pinned) { + this.hideElement.hidden = true; this.container.style.zIndex -= 1; } } @@ -9262,14 +9721,17 @@ class PopupElement { class FreeTextAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true + }); } render() { this.container.className = "freeTextAnnotation"; if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); + this._createPopup(null, this.data); } return this.container; @@ -9280,7 +9742,10 @@ class FreeTextAnnotationElement extends AnnotationElement { class LineAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true + }); } render() { @@ -9299,7 +9764,7 @@ class LineAnnotationElement extends AnnotationElement { svg.appendChild(line); this.container.append(svg); - this._createPopup(this.container, line, data); + this._createPopup(line, data); return this.container; } @@ -9309,7 +9774,10 @@ class LineAnnotationElement extends AnnotationElement { class SquareAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true + }); } render() { @@ -9330,7 +9798,7 @@ class SquareAnnotationElement extends AnnotationElement { svg.appendChild(square); this.container.append(svg); - this._createPopup(this.container, square, data); + this._createPopup(square, data); return this.container; } @@ -9340,7 +9808,10 @@ class SquareAnnotationElement extends AnnotationElement { class CircleAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true + }); } render() { @@ -9361,7 +9832,7 @@ class CircleAnnotationElement extends AnnotationElement { svg.appendChild(circle); this.container.append(svg); - this._createPopup(this.container, circle, data); + this._createPopup(circle, data); return this.container; } @@ -9371,7 +9842,10 @@ class CircleAnnotationElement extends AnnotationElement { class PolylineAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true + }); this.containerClassName = "polylineAnnotation"; this.svgElementName = "svg:polyline"; } @@ -9399,7 +9873,7 @@ class PolylineAnnotationElement extends AnnotationElement { svg.appendChild(polyline); this.container.append(svg); - this._createPopup(this.container, polyline, data); + this._createPopup(polyline, data); return this.container; } @@ -9418,14 +9892,17 @@ class PolygonAnnotationElement extends PolylineAnnotationElement { class CaretAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true + }); } render() { this.container.className = "caretAnnotation"; if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); + this._createPopup(null, this.data); } return this.container; @@ -9436,7 +9913,10 @@ class CaretAnnotationElement extends AnnotationElement { class InkAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true + }); this.containerClassName = "inkAnnotation"; this.svgElementName = "svg:polyline"; } @@ -9464,7 +9944,7 @@ class InkAnnotationElement extends AnnotationElement { polyline.setAttribute("stroke", "transparent"); polyline.setAttribute("fill", "none"); - this._createPopup(this.container, polyline, data); + this._createPopup(polyline, data); svg.appendChild(polyline); } @@ -9478,16 +9958,23 @@ class InkAnnotationElement extends AnnotationElement { class HighlightAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true, + createQuadrilaterals: true + }); } render() { - this.container.className = "highlightAnnotation"; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); + this._createPopup(null, this.data); } + if (this.quadrilaterals) { + return this._renderQuadrilaterals("highlightAnnotation"); + } + + this.container.className = "highlightAnnotation"; return this.container; } @@ -9496,16 +9983,23 @@ class HighlightAnnotationElement extends AnnotationElement { class UnderlineAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true, + createQuadrilaterals: true + }); } render() { - this.container.className = "underlineAnnotation"; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); + this._createPopup(null, this.data); } + if (this.quadrilaterals) { + return this._renderQuadrilaterals("underlineAnnotation"); + } + + this.container.className = "underlineAnnotation"; return this.container; } @@ -9514,16 +10008,23 @@ class UnderlineAnnotationElement extends AnnotationElement { class SquigglyAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true, + createQuadrilaterals: true + }); } render() { - this.container.className = "squigglyAnnotation"; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); + this._createPopup(null, this.data); } + if (this.quadrilaterals) { + return this._renderQuadrilaterals("squigglyAnnotation"); + } + + this.container.className = "squigglyAnnotation"; return this.container; } @@ -9532,16 +10033,23 @@ class SquigglyAnnotationElement extends AnnotationElement { class StrikeOutAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true, + createQuadrilaterals: true + }); } render() { - this.container.className = "strikeoutAnnotation"; - if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); + this._createPopup(null, this.data); } + if (this.quadrilaterals) { + return this._renderQuadrilaterals("strikeoutAnnotation"); + } + + this.container.className = "strikeoutAnnotation"; return this.container; } @@ -9550,14 +10058,17 @@ class StrikeOutAnnotationElement extends AnnotationElement { class StampAnnotationElement extends AnnotationElement { constructor(parameters) { const isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); - super(parameters, isRenderable, true); + super(parameters, { + isRenderable, + ignoreBorder: true + }); } render() { this.container.className = "stampAnnotation"; if (!this.data.hasPopup) { - this._createPopup(this.container, null, this.data); + this._createPopup(null, this.data); } return this.container; @@ -9567,22 +10078,21 @@ class StampAnnotationElement extends AnnotationElement { class FileAttachmentAnnotationElement extends AnnotationElement { constructor(parameters) { - super(parameters, true); + super(parameters, { + isRenderable: true + }); const { filename, content } = this.data.file; this.filename = (0, _display_utils.getFilenameFromUrl)(filename); this.content = content; - - if (this.linkService.eventBus) { - this.linkService.eventBus.dispatch("fileattachmentannotation", { - source: this, - id: (0, _util.stringToPDFString)(filename), - filename, - content - }); - } + this.linkService.eventBus?.dispatch("fileattachmentannotation", { + source: this, + id: (0, _util.stringToPDFString)(filename), + filename, + content + }); } render() { @@ -9593,7 +10103,7 @@ class FileAttachmentAnnotationElement extends AnnotationElement { trigger.addEventListener("dblclick", this._download.bind(this)); if (!this.data.hasPopup && (this.data.title || this.data.contents)) { - this._createPopup(this.container, trigger, this.data); + this._createPopup(trigger, this.data); } this.container.appendChild(trigger); @@ -9601,12 +10111,7 @@ class FileAttachmentAnnotationElement extends AnnotationElement { } _download() { - if (!this.downloadManager) { - (0, _util.warn)("Download cannot be started due to unavailable download manager"); - return; - } - - this.downloadManager.downloadData(this.content, this.filename, ""); + this.downloadManager?.openOrDownloadData(this.container, this.content, this.filename); } } @@ -9642,26 +10147,52 @@ class AnnotationLayer { linkService: parameters.linkService, downloadManager: parameters.downloadManager, imageResourcesPath: parameters.imageResourcesPath || "", - renderInteractiveForms: parameters.renderInteractiveForms || false, - svgFactory: new _display_utils.DOMSVGFactory() + renderInteractiveForms: parameters.renderInteractiveForms !== false, + svgFactory: new _display_utils.DOMSVGFactory(), + annotationStorage: parameters.annotationStorage || new _annotation_storage.AnnotationStorage(), + enableScripting: parameters.enableScripting, + hasJSActions: parameters.hasJSActions, + mouseState: parameters.mouseState || { + isDown: false + } }); if (element.isRenderable) { - parameters.div.appendChild(element.render()); + const rendered = element.render(); + + if (data.hidden) { + rendered.style.visibility = "hidden"; + } + + if (Array.isArray(rendered)) { + for (const renderedElement of rendered) { + parameters.div.appendChild(renderedElement); + } + } else { + if (element instanceof PopupAnnotationElement) { + parameters.div.prepend(rendered); + } else { + parameters.div.appendChild(rendered); + } + } } } } static update(parameters) { - for (const data of parameters.annotations) { - const element = parameters.div.querySelector(`[data-annotation-id="${data.id}"]`); + const transform = `matrix(${parameters.viewport.transform.join(",")})`; - if (element) { - element.style.transform = `matrix(${parameters.viewport.transform.join(",")})`; + for (const data of parameters.annotations) { + const elements = parameters.div.querySelectorAll(`[data-annotation-id="${data.id}"]`); + + if (elements) { + for (const element of elements) { + element.style.transform = transform; + } } } - parameters.div.removeAttribute("hidden"); + parameters.div.hidden = false; } } @@ -9669,442 +10200,561 @@ class AnnotationLayer { exports.AnnotationLayer = AnnotationLayer; /***/ }), -/* 17 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 18 */ +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.renderTextLayer = void 0; +})); +exports.ColorConverters = void 0; + +function makeColorComp(n) { + return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0"); +} + +class ColorConverters { + static CMYK_G([c, y, m, k]) { + return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)]; + } + + static G_CMYK([g]) { + return ["CMYK", 0, 0, 0, 1 - g]; + } + + static G_RGB([g]) { + return ["RGB", g, g, g]; + } + + static G_HTML([g]) { + const G = makeColorComp(g); + return `#${G}${G}${G}`; + } + + static RGB_G([r, g, b]) { + return ["G", 0.3 * r + 0.59 * g + 0.11 * b]; + } + + static RGB_HTML([r, g, b]) { + const R = makeColorComp(r); + const G = makeColorComp(g); + const B = makeColorComp(b); + return `#${R}${G}${B}`; + } + + static T_HTML() { + return "#00000000"; + } + + static CMYK_RGB([c, y, m, k]) { + return ["RGB", 1 - Math.min(1, c + k), 1 - Math.min(1, m + k), 1 - Math.min(1, y + k)]; + } + + static CMYK_HTML(components) { + return this.RGB_HTML(this.CMYK_RGB(components)); + } + + static RGB_CMYK([r, g, b]) { + const c = 1 - r; + const m = 1 - g; + const y = 1 - b; + const k = Math.min(c, m, y); + return ["CMYK", c, m, y, k]; + } + +} + +exports.ColorConverters = ColorConverters; + +/***/ }), +/* 19 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.renderTextLayer = renderTextLayer; var _util = __w_pdfjs_require__(2); -var renderTextLayer = function renderTextLayerClosure() { - var MAX_TEXT_DIVS_TO_RENDER = 100000; - var NonWhitespaceRegexp = /\S/; +const MAX_TEXT_DIVS_TO_RENDER = 100000; +const DEFAULT_FONT_SIZE = 30; +const DEFAULT_FONT_ASCENT = 0.8; +const ascentCache = new Map(); +const AllWhitespaceRegexp = /^\s+$/g; - function isAllWhitespace(str) { - return !NonWhitespaceRegexp.test(str); +function getAscent(fontFamily, ctx) { + const cachedAscent = ascentCache.get(fontFamily); + + if (cachedAscent) { + return cachedAscent; } - function appendText(task, geom, styles) { - var textDiv = document.createElement("span"); - var textDivProperties = { - angle: 0, - canvasWidth: 0, - isWhitespace: false, - originalTransform: null, - paddingBottom: 0, - paddingLeft: 0, - paddingRight: 0, - paddingTop: 0, - scale: 1 - }; + ctx.save(); + ctx.font = `${DEFAULT_FONT_SIZE}px ${fontFamily}`; + const metrics = ctx.measureText(""); + let ascent = metrics.fontBoundingBoxAscent; + let descent = Math.abs(metrics.fontBoundingBoxDescent); - task._textDivs.push(textDiv); + if (ascent) { + ctx.restore(); + const ratio = ascent / (ascent + descent); + ascentCache.set(fontFamily, ratio); + return ratio; + } - if (isAllWhitespace(geom.str)) { - textDivProperties.isWhitespace = true; + ctx.strokeStyle = "red"; + ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE); + ctx.strokeText("g", 0, 0); + let pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data; + descent = 0; - task._textDivProperties.set(textDiv, textDivProperties); - - return; + for (let i = pixels.length - 1 - 3; i >= 0; i -= 4) { + if (pixels[i] > 0) { + descent = Math.ceil(i / 4 / DEFAULT_FONT_SIZE); + break; } + } - var tx = _util.Util.transform(task._viewport.transform, geom.transform); + ctx.clearRect(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE); + ctx.strokeText("A", 0, DEFAULT_FONT_SIZE); + pixels = ctx.getImageData(0, 0, DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE).data; + ascent = 0; - var angle = Math.atan2(tx[1], tx[0]); - var style = styles[geom.fontName]; + for (let i = 0, ii = pixels.length; i < ii; i += 4) { + if (pixels[i] > 0) { + ascent = DEFAULT_FONT_SIZE - Math.floor(i / 4 / DEFAULT_FONT_SIZE); + break; + } + } + ctx.restore(); + + if (ascent) { + const ratio = ascent / (ascent + descent); + ascentCache.set(fontFamily, ratio); + return ratio; + } + + ascentCache.set(fontFamily, DEFAULT_FONT_ASCENT); + return DEFAULT_FONT_ASCENT; +} + +function appendText(task, geom, styles, ctx) { + const textDiv = document.createElement("span"); + const textDivProperties = { + angle: 0, + canvasWidth: 0, + hasText: geom.str !== "", + hasEOL: geom.hasEOL, + originalTransform: null, + paddingBottom: 0, + paddingLeft: 0, + paddingRight: 0, + paddingTop: 0, + scale: 1 + }; + + task._textDivs.push(textDiv); + + const tx = _util.Util.transform(task._viewport.transform, geom.transform); + + let angle = Math.atan2(tx[1], tx[0]); + const style = styles[geom.fontName]; + + if (style.vertical) { + angle += Math.PI / 2; + } + + const fontHeight = Math.hypot(tx[2], tx[3]); + const fontAscent = fontHeight * getAscent(style.fontFamily, ctx); + let left, top; + + if (angle === 0) { + left = tx[4]; + top = tx[5] - fontAscent; + } else { + left = tx[4] + fontAscent * Math.sin(angle); + top = tx[5] - fontAscent * Math.cos(angle); + } + + textDiv.style.left = `${left}px`; + textDiv.style.top = `${top}px`; + textDiv.style.fontSize = `${fontHeight}px`; + textDiv.style.fontFamily = style.fontFamily; + textDiv.setAttribute("role", "presentation"); + textDiv.textContent = geom.str; + textDiv.dir = geom.dir; + + if (task._fontInspectorEnabled) { + textDiv.dataset.fontName = geom.fontName; + } + + if (angle !== 0) { + textDivProperties.angle = angle * (180 / Math.PI); + } + + let shouldScaleText = false; + + if (geom.str.length > 1 || task._enhanceTextSelection && AllWhitespaceRegexp.test(geom.str)) { + shouldScaleText = true; + } else if (geom.transform[0] !== geom.transform[3]) { + const absScaleX = Math.abs(geom.transform[0]), + absScaleY = Math.abs(geom.transform[3]); + + if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) { + shouldScaleText = true; + } + } + + if (shouldScaleText) { if (style.vertical) { - angle += Math.PI / 2; - } - - var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]); - var fontAscent = fontHeight; - - if (style.ascent) { - fontAscent = style.ascent * fontAscent; - } else if (style.descent) { - fontAscent = (1 + style.descent) * fontAscent; - } - - let left, top; - - if (angle === 0) { - left = tx[4]; - top = tx[5] - fontAscent; + textDivProperties.canvasWidth = geom.height * task._viewport.scale; } else { - left = tx[4] + fontAscent * Math.sin(angle); - top = tx[5] - fontAscent * Math.cos(angle); + textDivProperties.canvasWidth = geom.width * task._viewport.scale; } + } - textDiv.style.left = `${left}px`; - textDiv.style.top = `${top}px`; - textDiv.style.fontSize = `${fontHeight}px`; - textDiv.style.fontFamily = style.fontFamily; - textDiv.textContent = geom.str; + task._textDivProperties.set(textDiv, textDivProperties); - if (task._fontInspectorEnabled) { - textDiv.dataset.fontName = geom.fontName; - } + if (task._textContentStream) { + task._layoutText(textDiv); + } + + if (task._enhanceTextSelection && textDivProperties.hasText) { + let angleCos = 1, + angleSin = 0; if (angle !== 0) { - textDivProperties.angle = angle * (180 / Math.PI); + angleCos = Math.cos(angle); + angleSin = Math.sin(angle); } - let shouldScaleText = false; + const divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; + const divHeight = fontHeight; + let m, b; - if (geom.str.length > 1) { - shouldScaleText = true; - } else if (geom.transform[0] !== geom.transform[3]) { - const absScaleX = Math.abs(geom.transform[0]), - absScaleY = Math.abs(geom.transform[3]); - - if (absScaleX !== absScaleY && Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5) { - shouldScaleText = true; - } + if (angle !== 0) { + m = [angleCos, angleSin, -angleSin, angleCos, left, top]; + b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); + } else { + b = [left, top, left + divWidth, top + divHeight]; } - if (shouldScaleText) { - if (style.vertical) { - textDivProperties.canvasWidth = geom.height * task._viewport.scale; - } else { - textDivProperties.canvasWidth = geom.width * task._viewport.scale; - } - } + task._bounds.push({ + left: b[0], + top: b[1], + right: b[2], + bottom: b[3], + div: textDiv, + size: [divWidth, divHeight], + m + }); + } +} - task._textDivProperties.set(textDiv, textDivProperties); - - if (task._textContentStream) { - task._layoutText(textDiv); - } - - if (task._enhanceTextSelection) { - var angleCos = 1, - angleSin = 0; - - if (angle !== 0) { - angleCos = Math.cos(angle); - angleSin = Math.sin(angle); - } - - var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; - var divHeight = fontHeight; - var m, b; - - if (angle !== 0) { - m = [angleCos, angleSin, -angleSin, angleCos, left, top]; - b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); - } else { - b = [left, top, left + divWidth, top + divHeight]; - } - - task._bounds.push({ - left: b[0], - top: b[1], - right: b[2], - bottom: b[3], - div: textDiv, - size: [divWidth, divHeight], - m - }); - } +function render(task) { + if (task._canceled) { + return; } - function render(task) { - if (task._canceled) { - return; - } - - var textDivs = task._textDivs; - var capability = task._capability; - var textDivsLength = textDivs.length; - - if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { - task._renderingDone = true; - capability.resolve(); - return; - } - - if (!task._textContentStream) { - for (var i = 0; i < textDivsLength; i++) { - task._layoutText(textDivs[i]); - } - } + const textDivs = task._textDivs; + const capability = task._capability; + const textDivsLength = textDivs.length; + if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { task._renderingDone = true; capability.resolve(); + return; } - function findPositiveMin(ts, offset, count) { - let result = 0; + if (!task._textContentStream) { + for (let i = 0; i < textDivsLength; i++) { + task._layoutText(textDivs[i]); + } + } - for (let i = 0; i < count; i++) { - const t = ts[offset++]; + task._renderingDone = true; + capability.resolve(); +} - if (t > 0) { - result = result ? Math.min(t, result) : t; +function findPositiveMin(ts, offset, count) { + let result = 0; + + for (let i = 0; i < count; i++) { + const t = ts[offset++]; + + if (t > 0) { + result = result ? Math.min(t, result) : t; + } + } + + return result; +} + +function expand(task) { + const bounds = task._bounds; + const viewport = task._viewport; + const expanded = expandBounds(viewport.width, viewport.height, bounds); + + for (let i = 0; i < expanded.length; i++) { + const div = bounds[i].div; + + const divProperties = task._textDivProperties.get(div); + + if (divProperties.angle === 0) { + divProperties.paddingLeft = bounds[i].left - expanded[i].left; + divProperties.paddingTop = bounds[i].top - expanded[i].top; + divProperties.paddingRight = expanded[i].right - bounds[i].right; + divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom; + + task._textDivProperties.set(div, divProperties); + + continue; + } + + const e = expanded[i], + b = bounds[i]; + const m = b.m, + c = m[0], + s = m[1]; + const points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size]; + const ts = new Float64Array(64); + + for (let j = 0, jj = points.length; j < jj; j++) { + const t = _util.Util.applyTransform(points[j], m); + + ts[j + 0] = c && (e.left - t[0]) / c; + ts[j + 4] = s && (e.top - t[1]) / s; + ts[j + 8] = c && (e.right - t[0]) / c; + ts[j + 12] = s && (e.bottom - t[1]) / s; + ts[j + 16] = s && (e.left - t[0]) / -s; + ts[j + 20] = c && (e.top - t[1]) / c; + ts[j + 24] = s && (e.right - t[0]) / -s; + ts[j + 28] = c && (e.bottom - t[1]) / c; + ts[j + 32] = c && (e.left - t[0]) / -c; + ts[j + 36] = s && (e.top - t[1]) / -s; + ts[j + 40] = c && (e.right - t[0]) / -c; + ts[j + 44] = s && (e.bottom - t[1]) / -s; + ts[j + 48] = s && (e.left - t[0]) / s; + ts[j + 52] = c && (e.top - t[1]) / -c; + ts[j + 56] = s && (e.right - t[0]) / s; + ts[j + 60] = c && (e.bottom - t[1]) / -c; + } + + const boxScale = 1 + Math.min(Math.abs(c), Math.abs(s)); + divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale; + divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale; + divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale; + divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale; + + task._textDivProperties.set(div, divProperties); + } +} + +function expandBounds(width, height, boxes) { + const bounds = boxes.map(function (box, i) { + return { + x1: box.left, + y1: box.top, + x2: box.right, + y2: box.bottom, + index: i, + x1New: undefined, + x2New: undefined + }; + }); + expandBoundsLTR(width, bounds); + const expanded = new Array(boxes.length); + + for (const b of bounds) { + const i = b.index; + expanded[i] = { + left: b.x1New, + top: 0, + right: b.x2New, + bottom: 0 + }; + } + + boxes.map(function (box, i) { + const e = expanded[i], + b = bounds[i]; + b.x1 = box.top; + b.y1 = width - e.right; + b.x2 = box.bottom; + b.y2 = width - e.left; + b.index = i; + b.x1New = undefined; + b.x2New = undefined; + }); + expandBoundsLTR(height, bounds); + + for (const b of bounds) { + const i = b.index; + expanded[i].top = b.x1New; + expanded[i].bottom = b.x2New; + } + + return expanded; +} + +function expandBoundsLTR(width, bounds) { + bounds.sort(function (a, b) { + return a.x1 - b.x1 || a.index - b.index; + }); + const fakeBoundary = { + x1: -Infinity, + y1: -Infinity, + x2: 0, + y2: Infinity, + index: -1, + x1New: 0, + x2New: 0 + }; + const horizon = [{ + start: -Infinity, + end: Infinity, + boundary: fakeBoundary + }]; + + for (const boundary of bounds) { + let i = 0; + + while (i < horizon.length && horizon[i].end <= boundary.y1) { + i++; + } + + let j = horizon.length - 1; + + while (j >= 0 && horizon[j].start >= boundary.y2) { + j--; + } + + let horizonPart, affectedBoundary; + let q, + k, + maxXNew = -Infinity; + + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; + let xNew; + + if (affectedBoundary.x2 > boundary.x1) { + xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1; + } else if (affectedBoundary.x2New === undefined) { + xNew = (affectedBoundary.x2 + boundary.x1) / 2; + } else { + xNew = affectedBoundary.x2New; + } + + if (xNew > maxXNew) { + maxXNew = xNew; } } - return result; - } + boundary.x1New = maxXNew; - function expand(task) { - var bounds = task._bounds; - var viewport = task._viewport; - var expanded = expandBounds(viewport.width, viewport.height, bounds); + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; - for (var i = 0; i < expanded.length; i++) { - var div = bounds[i].div; + if (affectedBoundary.x2New === undefined) { + if (affectedBoundary.x2 > boundary.x1) { + if (affectedBoundary.index > boundary.index) { + affectedBoundary.x2New = affectedBoundary.x2; + } + } else { + affectedBoundary.x2New = maxXNew; + } + } else if (affectedBoundary.x2New > maxXNew) { + affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); + } + } - var divProperties = task._textDivProperties.get(div); + const changedHorizon = []; + let lastBoundary = null; - if (divProperties.angle === 0) { - divProperties.paddingLeft = bounds[i].left - expanded[i].left; - divProperties.paddingTop = bounds[i].top - expanded[i].top; - divProperties.paddingRight = expanded[i].right - bounds[i].right; - divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom; + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; + const useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary; - task._textDivProperties.set(div, divProperties); + if (lastBoundary === useBoundary) { + changedHorizon[changedHorizon.length - 1].end = horizonPart.end; + } else { + changedHorizon.push({ + start: horizonPart.start, + end: horizonPart.end, + boundary: useBoundary + }); + lastBoundary = useBoundary; + } + } + if (horizon[i].start < boundary.y1) { + changedHorizon[0].start = boundary.y1; + changedHorizon.unshift({ + start: horizon[i].start, + end: boundary.y1, + boundary: horizon[i].boundary + }); + } + + if (boundary.y2 < horizon[j].end) { + changedHorizon[changedHorizon.length - 1].end = boundary.y2; + changedHorizon.push({ + start: boundary.y2, + end: horizon[j].end, + boundary: horizon[j].boundary + }); + } + + for (q = i; q <= j; q++) { + horizonPart = horizon[q]; + affectedBoundary = horizonPart.boundary; + + if (affectedBoundary.x2New !== undefined) { continue; } - var e = expanded[i], - b = bounds[i]; - var m = b.m, - c = m[0], - s = m[1]; - var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size]; - var ts = new Float64Array(64); - points.forEach(function (p, j) { - var t = _util.Util.applyTransform(p, m); + let used = false; - ts[j + 0] = c && (e.left - t[0]) / c; - ts[j + 4] = s && (e.top - t[1]) / s; - ts[j + 8] = c && (e.right - t[0]) / c; - ts[j + 12] = s && (e.bottom - t[1]) / s; - ts[j + 16] = s && (e.left - t[0]) / -s; - ts[j + 20] = c && (e.top - t[1]) / c; - ts[j + 24] = s && (e.right - t[0]) / -s; - ts[j + 28] = c && (e.bottom - t[1]) / c; - ts[j + 32] = c && (e.left - t[0]) / -c; - ts[j + 36] = s && (e.top - t[1]) / -s; - ts[j + 40] = c && (e.right - t[0]) / -c; - ts[j + 44] = s && (e.bottom - t[1]) / -s; - ts[j + 48] = s && (e.left - t[0]) / s; - ts[j + 52] = c && (e.top - t[1]) / -c; - ts[j + 56] = s && (e.right - t[0]) / s; - ts[j + 60] = c && (e.bottom - t[1]) / -c; - }); - var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s)); - divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale; - divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale; - divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale; - divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale; + for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) { + used = horizon[k].boundary === affectedBoundary; + } - task._textDivProperties.set(div, divProperties); + for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { + used = horizon[k].boundary === affectedBoundary; + } + + for (k = 0; !used && k < changedHorizon.length; k++) { + used = changedHorizon[k].boundary === affectedBoundary; + } + + if (!used) { + affectedBoundary.x2New = maxXNew; + } + } + + Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon)); + } + + for (const horizonPart of horizon) { + const affectedBoundary = horizonPart.boundary; + + if (affectedBoundary.x2New === undefined) { + affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); } } +} - function expandBounds(width, height, boxes) { - var bounds = boxes.map(function (box, i) { - return { - x1: box.left, - y1: box.top, - x2: box.right, - y2: box.bottom, - index: i, - x1New: undefined, - x2New: undefined - }; - }); - expandBoundsLTR(width, bounds); - var expanded = new Array(boxes.length); - bounds.forEach(function (b) { - var i = b.index; - expanded[i] = { - left: b.x1New, - top: 0, - right: b.x2New, - bottom: 0 - }; - }); - boxes.map(function (box, i) { - var e = expanded[i], - b = bounds[i]; - b.x1 = box.top; - b.y1 = width - e.right; - b.x2 = box.bottom; - b.y2 = width - e.left; - b.index = i; - b.x1New = undefined; - b.x2New = undefined; - }); - expandBoundsLTR(height, bounds); - bounds.forEach(function (b) { - var i = b.index; - expanded[i].top = b.x1New; - expanded[i].bottom = b.x2New; - }); - return expanded; - } - - function expandBoundsLTR(width, bounds) { - bounds.sort(function (a, b) { - return a.x1 - b.x1 || a.index - b.index; - }); - var fakeBoundary = { - x1: -Infinity, - y1: -Infinity, - x2: 0, - y2: Infinity, - index: -1, - x1New: 0, - x2New: 0 - }; - var horizon = [{ - start: -Infinity, - end: Infinity, - boundary: fakeBoundary - }]; - bounds.forEach(function (boundary) { - var i = 0; - - while (i < horizon.length && horizon[i].end <= boundary.y1) { - i++; - } - - var j = horizon.length - 1; - - while (j >= 0 && horizon[j].start >= boundary.y2) { - j--; - } - - var horizonPart, affectedBoundary; - var q, - k, - maxXNew = -Infinity; - - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - var xNew; - - if (affectedBoundary.x2 > boundary.x1) { - xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1; - } else if (affectedBoundary.x2New === undefined) { - xNew = (affectedBoundary.x2 + boundary.x1) / 2; - } else { - xNew = affectedBoundary.x2New; - } - - if (xNew > maxXNew) { - maxXNew = xNew; - } - } - - boundary.x1New = maxXNew; - - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - - if (affectedBoundary.x2New === undefined) { - if (affectedBoundary.x2 > boundary.x1) { - if (affectedBoundary.index > boundary.index) { - affectedBoundary.x2New = affectedBoundary.x2; - } - } else { - affectedBoundary.x2New = maxXNew; - } - } else if (affectedBoundary.x2New > maxXNew) { - affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); - } - } - - var changedHorizon = [], - lastBoundary = null; - - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - var useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary; - - if (lastBoundary === useBoundary) { - changedHorizon[changedHorizon.length - 1].end = horizonPart.end; - } else { - changedHorizon.push({ - start: horizonPart.start, - end: horizonPart.end, - boundary: useBoundary - }); - lastBoundary = useBoundary; - } - } - - if (horizon[i].start < boundary.y1) { - changedHorizon[0].start = boundary.y1; - changedHorizon.unshift({ - start: horizon[i].start, - end: boundary.y1, - boundary: horizon[i].boundary - }); - } - - if (boundary.y2 < horizon[j].end) { - changedHorizon[changedHorizon.length - 1].end = boundary.y2; - changedHorizon.push({ - start: boundary.y2, - end: horizon[j].end, - boundary: horizon[j].boundary - }); - } - - for (q = i; q <= j; q++) { - horizonPart = horizon[q]; - affectedBoundary = horizonPart.boundary; - - if (affectedBoundary.x2New !== undefined) { - continue; - } - - var used = false; - - for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) { - used = horizon[k].boundary === affectedBoundary; - } - - for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { - used = horizon[k].boundary === affectedBoundary; - } - - for (k = 0; !used && k < changedHorizon.length; k++) { - used = changedHorizon[k].boundary === affectedBoundary; - } - - if (!used) { - affectedBoundary.x2New = maxXNew; - } - } - - Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon)); - }); - horizon.forEach(function (horizonPart) { - var affectedBoundary = horizonPart.boundary; - - if (affectedBoundary.x2New === undefined) { - affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); - } - }); - } - - function TextLayerRenderTask({ +class TextLayerRenderTask { + constructor({ textContent, textContentStream, container, @@ -10116,11 +10766,12 @@ var renderTextLayer = function renderTextLayerClosure() { this._textContent = textContent; this._textContentStream = textContentStream; this._container = container; + this._document = container.ownerDocument; this._viewport = viewport; this._textDivs = textDivs || []; this._textContentItemsStr = textContentItemsStr || []; this._enhanceTextSelection = !!enhanceTextSelection; - this._fontInspectorEnabled = !!(globalThis.FontInspector && globalThis.FontInspector.enabled); + this._fontInspectorEnabled = !!globalThis.FontInspector?.enabled; this._reader = null; this._layoutTextLastFontSize = null; this._layoutTextLastFontFamily = null; @@ -10141,238 +10792,258 @@ var renderTextLayer = function renderTextLayerClosure() { }).catch(() => {}); } - TextLayerRenderTask.prototype = { - get promise() { - return this._capability.promise; - }, - - cancel: function TextLayer_cancel() { - this._canceled = true; - - if (this._reader) { - this._reader.cancel(new _util.AbortException("TextLayer task cancelled.")); - - this._reader = null; - } - - if (this._renderTimer !== null) { - clearTimeout(this._renderTimer); - this._renderTimer = null; - } - - this._capability.reject(new Error("TextLayer task cancelled.")); - }, - - _processItems(items, styleCache) { - for (let i = 0, len = items.length; i < len; i++) { - this._textContentItemsStr.push(items[i].str); - - appendText(this, items[i], styleCache); - } - }, - - _layoutText(textDiv) { - const textDivProperties = this._textDivProperties.get(textDiv); - - if (textDivProperties.isWhitespace) { - return; - } - - let transform = ""; - - if (textDivProperties.canvasWidth !== 0) { - const { - fontSize, - fontFamily - } = textDiv.style; - - if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) { - this._layoutTextCtx.font = `${fontSize} ${fontFamily}`; - this._layoutTextLastFontSize = fontSize; - this._layoutTextLastFontFamily = fontFamily; - } - - const { - width - } = this._layoutTextCtx.measureText(textDiv.textContent); - - if (width > 0) { - textDivProperties.scale = textDivProperties.canvasWidth / width; - transform = `scaleX(${textDivProperties.scale})`; - } - } - - if (textDivProperties.angle !== 0) { - transform = `rotate(${textDivProperties.angle}deg) ${transform}`; - } - - if (transform.length > 0) { - if (this._enhanceTextSelection) { - textDivProperties.originalTransform = transform; - } - - textDiv.style.transform = transform; - } - - this._textDivProperties.set(textDiv, textDivProperties); - - this._container.appendChild(textDiv); - }, - - _render: function TextLayer_render(timeout) { - const capability = (0, _util.createPromiseCapability)(); - let styleCache = Object.create(null); - const canvas = document.createElement("canvas"); - canvas.mozOpaque = true; - this._layoutTextCtx = canvas.getContext("2d", { - alpha: false - }); - - if (this._textContent) { - const textItems = this._textContent.items; - const textStyles = this._textContent.styles; - - this._processItems(textItems, textStyles); - - capability.resolve(); - } else if (this._textContentStream) { - const pump = () => { - this._reader.read().then(({ - value, - done - }) => { - if (done) { - capability.resolve(); - return; - } - - Object.assign(styleCache, value.styles); - - this._processItems(value.items, styleCache); - - pump(); - }, capability.reject); - }; - - this._reader = this._textContentStream.getReader(); - pump(); - } else { - throw new Error('Neither "textContent" nor "textContentStream"' + " parameters specified."); - } - - capability.promise.then(() => { - styleCache = null; - - if (!timeout) { - render(this); - } else { - this._renderTimer = setTimeout(() => { - render(this); - this._renderTimer = null; - }, timeout); - } - }, this._capability.reject); - }, - expandTextDivs: function TextLayer_expandTextDivs(expandDivs) { - if (!this._enhanceTextSelection || !this._renderingDone) { - return; - } - - if (this._bounds !== null) { - expand(this); - this._bounds = null; - } - - const transformBuf = [], - paddingBuf = []; - - for (var i = 0, ii = this._textDivs.length; i < ii; i++) { - const div = this._textDivs[i]; - - const divProps = this._textDivProperties.get(div); - - if (divProps.isWhitespace) { - continue; - } - - if (expandDivs) { - transformBuf.length = 0; - paddingBuf.length = 0; - - if (divProps.originalTransform) { - transformBuf.push(divProps.originalTransform); - } - - if (divProps.paddingTop > 0) { - paddingBuf.push(`${divProps.paddingTop}px`); - transformBuf.push(`translateY(${-divProps.paddingTop}px)`); - } else { - paddingBuf.push(0); - } - - if (divProps.paddingRight > 0) { - paddingBuf.push(`${divProps.paddingRight / divProps.scale}px`); - } else { - paddingBuf.push(0); - } - - if (divProps.paddingBottom > 0) { - paddingBuf.push(`${divProps.paddingBottom}px`); - } else { - paddingBuf.push(0); - } - - if (divProps.paddingLeft > 0) { - paddingBuf.push(`${divProps.paddingLeft / divProps.scale}px`); - transformBuf.push(`translateX(${-divProps.paddingLeft / divProps.scale}px)`); - } else { - paddingBuf.push(0); - } - - div.style.padding = paddingBuf.join(" "); - - if (transformBuf.length) { - div.style.transform = transformBuf.join(" "); - } - } else { - div.style.padding = null; - div.style.transform = divProps.originalTransform; - } - } - } - }; - - function renderTextLayer(renderParameters) { - var task = new TextLayerRenderTask({ - textContent: renderParameters.textContent, - textContentStream: renderParameters.textContentStream, - container: renderParameters.container, - viewport: renderParameters.viewport, - textDivs: renderParameters.textDivs, - textContentItemsStr: renderParameters.textContentItemsStr, - enhanceTextSelection: renderParameters.enhanceTextSelection - }); - - task._render(renderParameters.timeout); - - return task; + get promise() { + return this._capability.promise; } - return renderTextLayer; -}(); + cancel() { + this._canceled = true; -exports.renderTextLayer = renderTextLayer; + if (this._reader) { + this._reader.cancel(new _util.AbortException("TextLayer task cancelled.")); + + this._reader = null; + } + + if (this._renderTimer !== null) { + clearTimeout(this._renderTimer); + this._renderTimer = null; + } + + this._capability.reject(new Error("TextLayer task cancelled.")); + } + + _processItems(items, styleCache) { + for (let i = 0, len = items.length; i < len; i++) { + if (items[i].str === undefined) { + if (items[i].type === "beginMarkedContentProps" || items[i].type === "beginMarkedContent") { + const parent = this._container; + this._container = document.createElement("span"); + + this._container.classList.add("markedContent"); + + if (items[i].id !== null) { + this._container.setAttribute("id", `${items[i].id}`); + } + + parent.appendChild(this._container); + } else if (items[i].type === "endMarkedContent") { + this._container = this._container.parentNode; + } + + continue; + } + + this._textContentItemsStr.push(items[i].str); + + appendText(this, items[i], styleCache, this._layoutTextCtx); + } + } + + _layoutText(textDiv) { + const textDivProperties = this._textDivProperties.get(textDiv); + + let transform = ""; + + if (textDivProperties.canvasWidth !== 0 && textDivProperties.hasText) { + const { + fontSize, + fontFamily + } = textDiv.style; + + if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) { + this._layoutTextCtx.font = `${fontSize} ${fontFamily}`; + this._layoutTextLastFontSize = fontSize; + this._layoutTextLastFontFamily = fontFamily; + } + + const { + width + } = this._layoutTextCtx.measureText(textDiv.textContent); + + if (width > 0) { + textDivProperties.scale = textDivProperties.canvasWidth / width; + transform = `scaleX(${textDivProperties.scale})`; + } + } + + if (textDivProperties.angle !== 0) { + transform = `rotate(${textDivProperties.angle}deg) ${transform}`; + } + + if (transform.length > 0) { + if (this._enhanceTextSelection) { + textDivProperties.originalTransform = transform; + } + + textDiv.style.transform = transform; + } + + if (textDivProperties.hasText) { + this._container.appendChild(textDiv); + } + + if (textDivProperties.hasEOL) { + const br = document.createElement("br"); + br.setAttribute("role", "presentation"); + + this._container.appendChild(br); + } + } + + _render(timeout = 0) { + const capability = (0, _util.createPromiseCapability)(); + let styleCache = Object.create(null); + + const canvas = this._document.createElement("canvas"); + + canvas.height = canvas.width = DEFAULT_FONT_SIZE; + canvas.mozOpaque = true; + this._layoutTextCtx = canvas.getContext("2d", { + alpha: false + }); + + if (this._textContent) { + const textItems = this._textContent.items; + const textStyles = this._textContent.styles; + + this._processItems(textItems, textStyles); + + capability.resolve(); + } else if (this._textContentStream) { + const pump = () => { + this._reader.read().then(({ + value, + done + }) => { + if (done) { + capability.resolve(); + return; + } + + Object.assign(styleCache, value.styles); + + this._processItems(value.items, styleCache); + + pump(); + }, capability.reject); + }; + + this._reader = this._textContentStream.getReader(); + pump(); + } else { + throw new Error('Neither "textContent" nor "textContentStream"' + " parameters specified."); + } + + capability.promise.then(() => { + styleCache = null; + + if (!timeout) { + render(this); + } else { + this._renderTimer = setTimeout(() => { + render(this); + this._renderTimer = null; + }, timeout); + } + }, this._capability.reject); + } + + expandTextDivs(expandDivs = false) { + if (!this._enhanceTextSelection || !this._renderingDone) { + return; + } + + if (this._bounds !== null) { + expand(this); + this._bounds = null; + } + + const transformBuf = [], + paddingBuf = []; + + for (let i = 0, ii = this._textDivs.length; i < ii; i++) { + const div = this._textDivs[i]; + + const divProps = this._textDivProperties.get(div); + + if (!divProps.hasText) { + continue; + } + + if (expandDivs) { + transformBuf.length = 0; + paddingBuf.length = 0; + + if (divProps.originalTransform) { + transformBuf.push(divProps.originalTransform); + } + + if (divProps.paddingTop > 0) { + paddingBuf.push(`${divProps.paddingTop}px`); + transformBuf.push(`translateY(${-divProps.paddingTop}px)`); + } else { + paddingBuf.push(0); + } + + if (divProps.paddingRight > 0) { + paddingBuf.push(`${divProps.paddingRight / divProps.scale}px`); + } else { + paddingBuf.push(0); + } + + if (divProps.paddingBottom > 0) { + paddingBuf.push(`${divProps.paddingBottom}px`); + } else { + paddingBuf.push(0); + } + + if (divProps.paddingLeft > 0) { + paddingBuf.push(`${divProps.paddingLeft / divProps.scale}px`); + transformBuf.push(`translateX(${-divProps.paddingLeft / divProps.scale}px)`); + } else { + paddingBuf.push(0); + } + + div.style.padding = paddingBuf.join(" "); + + if (transformBuf.length) { + div.style.transform = transformBuf.join(" "); + } + } else { + div.style.padding = null; + div.style.transform = divProps.originalTransform; + } + } + } + +} + +function renderTextLayer(renderParameters) { + const task = new TextLayerRenderTask({ + textContent: renderParameters.textContent, + textContentStream: renderParameters.textContentStream, + container: renderParameters.container, + viewport: renderParameters.viewport, + textDivs: renderParameters.textDivs, + textContentItemsStr: renderParameters.textContentItemsStr, + enhanceTextSelection: renderParameters.enhanceTextSelection + }); + + task._render(renderParameters.timeout); + + return task; +} /***/ }), -/* 18 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 20 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.SVGGraphics = void 0; var _util = __w_pdfjs_require__(2); @@ -10381,10 +11052,12 @@ var _display_utils = __w_pdfjs_require__(1); var _is_node = __w_pdfjs_require__(4); -let SVGGraphics = function () { - throw new Error("Not implemented: SVGGraphics"); -}; +let SVGGraphics = class { + constructor() { + (0, _util.unreachable)("Not implemented: SVGGraphics"); + } +}; exports.SVGGraphics = SVGGraphics; { const SVG_DEFAULTS = { @@ -10714,7 +11387,7 @@ exports.SVGGraphics = SVGGraphics; let clipCount = 0; let maskCount = 0; let shadingCount = 0; - exports.SVGGraphics = SVGGraphics = class SVGGraphics { + exports.SVGGraphics = SVGGraphics = class { constructor(commonObjs, objs, forceDataSchema = false) { this.svgFactory = new _display_utils.DOMSVGFactory(); this.current = new SVGExtraState(); @@ -11041,7 +11714,7 @@ exports.SVGGraphics = SVGGraphics; setTextMatrix(a, b, c, d, e, f) { const current = this.current; current.textMatrix = current.lineMatrix = [a, b, c, d, e, f]; - current.textMatrixScale = Math.sqrt(a * a + b * b); + current.textMatrixScale = Math.hypot(a, b); current.x = current.lineX = 0; current.y = current.lineY = 0; current.xcoords = []; @@ -11242,7 +11915,7 @@ exports.SVGGraphics = SVGGraphics; this.embeddedFonts[fontObj.loadedName] = fontObj; } - current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; + current.fontMatrix = fontObj.fontMatrix || _util.FONT_IDENTITY_MATRIX; let bold = "normal"; if (fontObj.black) { @@ -11273,7 +11946,7 @@ exports.SVGGraphics = SVGGraphics; endText() { const current = this.current; - if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement && current.txtElement.hasChildNodes()) { + if (current.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG && current.txtElement?.hasChildNodes()) { current.element = current.txtElement; this.clip("nonzero"); this.endPath(); @@ -11303,7 +11976,7 @@ exports.SVGGraphics = SVGGraphics; } setStrokeRGBColor(r, g, b) { - this.current.strokeColor = _util.Util.makeCssRgb(r, g, b); + this.current.strokeColor = _util.Util.makeHexColor(r, g, b); } setFillAlpha(fillAlpha) { @@ -11311,7 +11984,7 @@ exports.SVGGraphics = SVGGraphics; } setFillRGBColor(r, g, b) { - this.current.fillColor = _util.Util.makeCssRgb(r, g, b); + this.current.fillColor = _util.Util.makeHexColor(r, g, b); this.current.tspan = this.svgFactory.createElement("svg:tspan"); this.current.xcoords = []; this.current.ycoords = []; @@ -11399,7 +12072,7 @@ exports.SVGGraphics = SVGGraphics; this.transformMatrix = matrix; if (paintType === 2) { - const cssColor = _util.Util.makeCssRgb(...color); + const cssColor = _util.Util.makeHexColor(...color); this.current.fillColor = cssColor; this.current.strokeColor = cssColor; @@ -11587,9 +12260,11 @@ exports.SVGGraphics = SVGGraphics; if (current.activeClipUrl) { current.clipGroup = null; - this.extraStack.forEach(function (prev) { + + for (const prev of this.extraStack) { prev.clipGroup = null; - }); + } + clipPath.setAttributeNS(null, "clip-path", current.activeClipUrl); } @@ -11769,7 +12444,7 @@ exports.SVGGraphics = SVGGraphics; } paintImageXObject(objId) { - const imgData = this.objs.get(objId); + const imgData = objId.startsWith("g_") ? this.commonObjs.get(objId) : this.objs.get(objId); if (!imgData) { (0, _util.warn)(`Dependent image with object ID ${objId} is not ready yet`); @@ -11890,20 +12565,190 @@ exports.SVGGraphics = SVGGraphics; } /***/ }), -/* 19 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 21 */ +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.XfaLayer = void 0; + +class XfaLayer { + static setupStorage(html, fieldId, element, storage) { + const storedData = storage.getValue(fieldId, { + value: null + }); + + switch (element.name) { + case "textarea": + html.textContent = storedData.value !== null ? storedData.value : ""; + html.addEventListener("input", event => { + storage.setValue(fieldId, { + value: event.target.value + }); + }); + break; + + case "input": + if (storedData.value !== null) { + html.setAttribute("value", storedData.value); + } + + if (element.attributes.type === "radio") { + html.addEventListener("change", event => { + const { + target + } = event; + + for (const radio of document.getElementsByName(target.name)) { + if (radio !== target) { + const id = radio.id; + storage.setValue(id.split("-")[0], { + value: false + }); + } + } + + storage.setValue(fieldId, { + value: target.checked + }); + }); + } else { + html.addEventListener("input", event => { + storage.setValue(fieldId, { + value: event.target.value + }); + }); + } + + break; + + case "select": + if (storedData.value !== null) { + for (const option of element.children) { + if (option.attributes.value === storedData.value) { + option.attributes.selected = true; + } + } + } + + html.addEventListener("input", event => { + const options = event.target.options; + const value = options.selectedIndex === -1 ? null : options[options.selectedIndex].value; + storage.setValue(fieldId, { + value + }); + }); + break; + } + } + + static setAttributes(html, element, storage) { + const { + attributes + } = element; + + for (const [key, value] of Object.entries(attributes)) { + if (value === null || value === undefined || key === "fieldId") { + continue; + } + + if (key !== "style") { + if (key === "textContent") { + html.textContent = value; + } else { + html.setAttribute(key, value); + } + } else { + Object.assign(html.style, value); + } + } + + if (storage && attributes.fieldId !== undefined) { + this.setupStorage(html, attributes.fieldId, element, storage); + } + } + + static render(parameters) { + const storage = parameters.annotationStorage; + const root = parameters.xfa; + const rootHtml = document.createElement(root.name); + + if (root.attributes) { + this.setAttributes(rootHtml, root); + } + + const stack = [[root, -1, rootHtml]]; + const rootDiv = parameters.div; + rootDiv.appendChild(rootHtml); + const coeffs = parameters.viewport.transform.join(","); + rootDiv.style.transform = `matrix(${coeffs})`; + rootDiv.setAttribute("class", "xfaLayer xfaFont"); + + while (stack.length > 0) { + const [parent, i, html] = stack[stack.length - 1]; + + if (i + 1 === parent.children.length) { + stack.pop(); + continue; + } + + const child = parent.children[++stack[stack.length - 1][1]]; + + if (child === null) { + continue; + } + + const { + name + } = child; + + if (name === "#text") { + html.appendChild(document.createTextNode(child.value)); + continue; + } + + const childHtml = document.createElement(name); + html.appendChild(childHtml); + + if (child.attributes) { + this.setAttributes(childHtml, child, storage); + } + + if (child.children && child.children.length > 0) { + stack.push([child, -1, childHtml]); + } else if (child.value) { + childHtml.appendChild(document.createTextNode(child.value)); + } + } + } + + static update(parameters) { + const transform = `matrix(${parameters.viewport.transform.join(",")})`; + parameters.div.style.transform = transform; + parameters.div.hidden = false; + } + +} + +exports.XfaLayer = XfaLayer; + +/***/ }), +/* 22 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); exports.PDFNodeStream = void 0; var _util = __w_pdfjs_require__(2); -var _network_utils = __w_pdfjs_require__(20); +var _network_utils = __w_pdfjs_require__(23); ; @@ -11947,7 +12792,7 @@ class PDFNodeStream { } get _progressiveDataLength() { - return this._fullRequestReader ? this._fullRequestReader._loaded : 0; + return this._fullRequestReader?._loaded ?? 0; } getFullReader() { @@ -11973,11 +12818,9 @@ class PDFNodeStream { this._fullRequestReader.cancel(reason); } - const readers = this._rangeRequestReaders.slice(0); - - readers.forEach(function (reader) { + for (const reader of this._rangeRequestReaders.slice(0)) { reader.cancel(reason); - }); + } } } @@ -12359,15 +13202,14 @@ class PDFNodeStreamFsRangeReader extends BaseRangeReader { } /***/ }), -/* 20 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 23 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.createResponseStatusError = createResponseStatusError; exports.extractFilenameFromHeader = extractFilenameFromHeader; exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities; @@ -12375,7 +13217,9 @@ exports.validateResponseStatus = validateResponseStatus; var _util = __w_pdfjs_require__(2); -var _content_disposition = __w_pdfjs_require__(21); +var _content_disposition = __w_pdfjs_require__(24); + +var _display_utils = __w_pdfjs_require__(1); function validateRangeRequestCapabilities({ getResponseHeader, @@ -12430,7 +13274,7 @@ function extractFilenameFromHeader(getResponseHeader) { } catch (ex) {} } - if (/\.pdf$/i.test(filename)) { + if ((0, _display_utils.isPdfFile)(filename)) { return filename; } } @@ -12443,7 +13287,7 @@ function createResponseStatusError(status, url) { return new _util.MissingPDFException('Missing PDF "' + url + '".'); } - return new _util.UnexpectedResponseException("Unexpected server response (" + status + ') while retrieving PDF "' + url + '".', status); + return new _util.UnexpectedResponseException(`Unexpected server response (${status}) while retrieving PDF "${url}".`, status); } function validateResponseStatus(status) { @@ -12451,17 +13295,18 @@ function validateResponseStatus(status) { } /***/ }), -/* 21 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 24 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.getFilenameFromContentDispositionHeader = getFilenameFromContentDispositionHeader; +var _util = __w_pdfjs_require__(2); + function getFilenameFromContentDispositionHeader(contentDisposition) { let needsEncodingFixup = true; let tmp = toParamRegExp("filename\\*", "i").exec(contentDisposition); @@ -12505,10 +13350,8 @@ function getFilenameFromContentDispositionHeader(contentDisposition) { const decoder = new TextDecoder(encoding, { fatal: true }); - const bytes = Array.from(value, function (ch) { - return ch.charCodeAt(0) & 0xff; - }); - value = decoder.decode(new Uint8Array(bytes)); + const buffer = (0, _util.stringToBytes)(value); + value = decoder.decode(buffer); needsEncodingFixup = false; } catch (e) { if (/^utf-?8$/i.test(encoding)) { @@ -12639,20 +13482,19 @@ function getFilenameFromContentDispositionHeader(contentDisposition) { } /***/ }), -/* 22 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 25 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFNetworkStream = void 0; var _util = __w_pdfjs_require__(2); -var _network_utils = __w_pdfjs_require__(20); +var _network_utils = __w_pdfjs_require__(23); ; const OK_RESPONSE = 200; @@ -12820,14 +13662,6 @@ class NetworkManager { } } - hasPendingRequests() { - for (const xhrId in this.pendingRequests) { - return true; - } - - return false; - } - getRequestXhr(xhrId) { return this.pendingRequests[xhrId].xhr; } @@ -12836,12 +13670,6 @@ class NetworkManager { return xhrId in this.pendingRequests; } - abortAllRequests() { - for (const xhrId in this.pendingRequests) { - this.abortRequest(xhrId | 0); - } - } - abortRequest(xhrId) { const xhr = this.pendingRequests[xhrId].xhr; delete this.pendingRequests[xhrId]; @@ -12890,11 +13718,9 @@ class PDFNetworkStream { this._fullRequestReader.cancel(reason); } - const readers = this._rangeRequestReaders.slice(0); - - readers.forEach(function (reader) { + for (const reader of this._rangeRequestReaders.slice(0)) { reader.cancel(reason); - }); + } } } @@ -12984,14 +13810,14 @@ class PDFNetworkStreamFullRequestReader { return; } - this._requests.forEach(function (requestCapability) { + for (const requestCapability of this._requests) { requestCapability.resolve({ value: undefined, done: true }); - }); + } - this._requests = []; + this._requests.length = 0; } _onError(status) { @@ -13001,12 +13827,12 @@ class PDFNetworkStreamFullRequestReader { this._headersReceivedCapability.reject(exception); - this._requests.forEach(function (requestCapability) { + for (const requestCapability of this._requests) { requestCapability.reject(exception); - }); + } - this._requests = []; - this._cachedChunks = []; + this._requests.length = 0; + this._cachedChunks.length = 0; } _onProgress(data) { @@ -13071,14 +13897,14 @@ class PDFNetworkStreamFullRequestReader { this._headersReceivedCapability.reject(reason); - this._requests.forEach(function (requestCapability) { + for (const requestCapability of this._requests) { requestCapability.resolve({ value: undefined, done: true }); - }); + } - this._requests = []; + this._requests.length = 0; if (this._manager.isPendingRequest(this._fullRequestId)) { this._manager.abortRequest(this._fullRequestId); @@ -13126,14 +13952,14 @@ class PDFNetworkStreamRangeRequestReader { this._done = true; - this._requests.forEach(function (requestCapability) { + for (const requestCapability of this._requests) { requestCapability.resolve({ value: undefined, done: true }); - }); + } - this._requests = []; + this._requests.length = 0; this._close(); } @@ -13177,14 +14003,14 @@ class PDFNetworkStreamRangeRequestReader { cancel(reason) { this._done = true; - this._requests.forEach(function (requestCapability) { + for (const requestCapability of this._requests) { requestCapability.resolve({ value: undefined, done: true }); - }); + } - this._requests = []; + this._requests.length = 0; if (this._manager.isPendingRequest(this._requestId)) { this._manager.abortRequest(this._requestId); @@ -13196,20 +14022,19 @@ class PDFNetworkStreamRangeRequestReader { } /***/ }), -/* 23 */ -/***/ (function(module, exports, __w_pdfjs_require__) { - -"use strict"; +/* 26 */ +/***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFFetchStream = void 0; var _util = __w_pdfjs_require__(2); -var _network_utils = __w_pdfjs_require__(20); +var _network_utils = __w_pdfjs_require__(23); ; @@ -13217,7 +14042,7 @@ function createFetchOptions(headers, withCredentials, abortController) { return { method: "GET", headers, - signal: abortController && abortController.signal, + signal: abortController?.signal, mode: "cors", credentials: withCredentials ? "include" : "same-origin", redirect: "follow" @@ -13250,7 +14075,7 @@ class PDFFetchStream { } get _progressiveDataLength() { - return this._fullRequestReader ? this._fullRequestReader._loaded : 0; + return this._fullRequestReader?._loaded ?? 0; } getFullReader() { @@ -13276,11 +14101,9 @@ class PDFFetchStream { this._fullRequestReader.cancel(reason); } - const readers = this._rangeRequestReaders.slice(0); - - readers.forEach(function (reader) { + for (const reader of this._rangeRequestReaders.slice(0)) { reader.cancel(reason); - }); + } } } @@ -13434,6 +14257,12 @@ class PDFFetchStreamRangeReader { this._readCapability.resolve(); this._reader = response.body.getReader(); + }).catch(reason => { + if (reason?.name === "AbortError") { + return; + } + + throw reason; }); this.onProgress = null; } @@ -13484,6 +14313,306 @@ class PDFFetchStreamRangeReader { } /***/ }) -/******/ ]); +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __w_pdfjs_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +var exports = __webpack_exports__; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "addLinkAttributes", ({ + enumerable: true, + get: function () { + return _display_utils.addLinkAttributes; + } +})); +Object.defineProperty(exports, "getFilenameFromUrl", ({ + enumerable: true, + get: function () { + return _display_utils.getFilenameFromUrl; + } +})); +Object.defineProperty(exports, "getPdfFilenameFromUrl", ({ + enumerable: true, + get: function () { + return _display_utils.getPdfFilenameFromUrl; + } +})); +Object.defineProperty(exports, "isPdfFile", ({ + enumerable: true, + get: function () { + return _display_utils.isPdfFile; + } +})); +Object.defineProperty(exports, "LinkTarget", ({ + enumerable: true, + get: function () { + return _display_utils.LinkTarget; + } +})); +Object.defineProperty(exports, "loadScript", ({ + enumerable: true, + get: function () { + return _display_utils.loadScript; + } +})); +Object.defineProperty(exports, "PDFDateString", ({ + enumerable: true, + get: function () { + return _display_utils.PDFDateString; + } +})); +Object.defineProperty(exports, "RenderingCancelledException", ({ + enumerable: true, + get: function () { + return _display_utils.RenderingCancelledException; + } +})); +Object.defineProperty(exports, "build", ({ + enumerable: true, + get: function () { + return _api.build; + } +})); +Object.defineProperty(exports, "getDocument", ({ + enumerable: true, + get: function () { + return _api.getDocument; + } +})); +Object.defineProperty(exports, "LoopbackPort", ({ + enumerable: true, + get: function () { + return _api.LoopbackPort; + } +})); +Object.defineProperty(exports, "PDFDataRangeTransport", ({ + enumerable: true, + get: function () { + return _api.PDFDataRangeTransport; + } +})); +Object.defineProperty(exports, "PDFWorker", ({ + enumerable: true, + get: function () { + return _api.PDFWorker; + } +})); +Object.defineProperty(exports, "version", ({ + enumerable: true, + get: function () { + return _api.version; + } +})); +Object.defineProperty(exports, "CMapCompressionType", ({ + enumerable: true, + get: function () { + return _util.CMapCompressionType; + } +})); +Object.defineProperty(exports, "createObjectURL", ({ + enumerable: true, + get: function () { + return _util.createObjectURL; + } +})); +Object.defineProperty(exports, "createPromiseCapability", ({ + enumerable: true, + get: function () { + return _util.createPromiseCapability; + } +})); +Object.defineProperty(exports, "createValidAbsoluteUrl", ({ + enumerable: true, + get: function () { + return _util.createValidAbsoluteUrl; + } +})); +Object.defineProperty(exports, "InvalidPDFException", ({ + enumerable: true, + get: function () { + return _util.InvalidPDFException; + } +})); +Object.defineProperty(exports, "MissingPDFException", ({ + enumerable: true, + get: function () { + return _util.MissingPDFException; + } +})); +Object.defineProperty(exports, "OPS", ({ + enumerable: true, + get: function () { + return _util.OPS; + } +})); +Object.defineProperty(exports, "PasswordResponses", ({ + enumerable: true, + get: function () { + return _util.PasswordResponses; + } +})); +Object.defineProperty(exports, "PermissionFlag", ({ + enumerable: true, + get: function () { + return _util.PermissionFlag; + } +})); +Object.defineProperty(exports, "removeNullCharacters", ({ + enumerable: true, + get: function () { + return _util.removeNullCharacters; + } +})); +Object.defineProperty(exports, "shadow", ({ + enumerable: true, + get: function () { + return _util.shadow; + } +})); +Object.defineProperty(exports, "UnexpectedResponseException", ({ + enumerable: true, + get: function () { + return _util.UnexpectedResponseException; + } +})); +Object.defineProperty(exports, "UNSUPPORTED_FEATURES", ({ + enumerable: true, + get: function () { + return _util.UNSUPPORTED_FEATURES; + } +})); +Object.defineProperty(exports, "Util", ({ + enumerable: true, + get: function () { + return _util.Util; + } +})); +Object.defineProperty(exports, "VerbosityLevel", ({ + enumerable: true, + get: function () { + return _util.VerbosityLevel; + } +})); +Object.defineProperty(exports, "AnnotationLayer", ({ + enumerable: true, + get: function () { + return _annotation_layer.AnnotationLayer; + } +})); +Object.defineProperty(exports, "apiCompatibilityParams", ({ + enumerable: true, + get: function () { + return _api_compatibility.apiCompatibilityParams; + } +})); +Object.defineProperty(exports, "GlobalWorkerOptions", ({ + enumerable: true, + get: function () { + return _worker_options.GlobalWorkerOptions; + } +})); +Object.defineProperty(exports, "renderTextLayer", ({ + enumerable: true, + get: function () { + return _text_layer.renderTextLayer; + } +})); +Object.defineProperty(exports, "SVGGraphics", ({ + enumerable: true, + get: function () { + return _svg.SVGGraphics; + } +})); +Object.defineProperty(exports, "XfaLayer", ({ + enumerable: true, + get: function () { + return _xfa_layer.XfaLayer; + } +})); + +var _display_utils = __w_pdfjs_require__(1); + +var _api = __w_pdfjs_require__(5); + +var _util = __w_pdfjs_require__(2); + +var _annotation_layer = __w_pdfjs_require__(17); + +var _api_compatibility = __w_pdfjs_require__(9); + +var _worker_options = __w_pdfjs_require__(12); + +var _text_layer = __w_pdfjs_require__(19); + +var _svg = __w_pdfjs_require__(20); + +var _xfa_layer = __w_pdfjs_require__(21); + +const pdfjsVersion = '2.9.359'; +const pdfjsBuild = 'e667c8cbc'; +{ + const { + isNodeJS + } = __w_pdfjs_require__(4); + + if (isNodeJS) { + const PDFNodeStream = __w_pdfjs_require__(22).PDFNodeStream; + + (0, _api.setPDFNetworkStreamFactory)(params => { + return new PDFNodeStream(params); + }); + } else { + const PDFNetworkStream = __w_pdfjs_require__(25).PDFNetworkStream; + + let PDFFetchStream; + + if ((0, _display_utils.isFetchSupported)()) { + PDFFetchStream = __w_pdfjs_require__(26).PDFFetchStream; + } + + (0, _api.setPDFNetworkStreamFactory)(params => { + if (PDFFetchStream && (0, _display_utils.isValidFetchUrl)(params.url)) { + return new PDFFetchStream(params); + } + + return new PDFNetworkStream(params); + }); + } +} +})(); + +/******/ return __webpack_exports__; +/******/ })() +; }); //# sourceMappingURL=pdf.js.map \ No newline at end of file diff --git a/org.adempiere.ui.zk/pdf.js/build/pdf.js.map b/org.adempiere.ui.zk/pdf.js/build/pdf.js.map index 4d5d9bbadb..3b7015151a 100644 --- a/org.adempiere.ui.zk/pdf.js/build/pdf.js.map +++ b/org.adempiere.ui.zk/pdf.js/build/pdf.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://pdfjs-dist/build/pdf/webpack/universalModuleDefinition","webpack://pdfjs-dist/build/pdf/webpack/bootstrap","webpack://pdfjs-dist/build/pdf/src/pdf.js","webpack://pdfjs-dist/build/pdf/src/display/display_utils.js","webpack://pdfjs-dist/build/pdf/src/shared/util.js","webpack://pdfjs-dist/build/pdf/src/shared/compatibility.js","webpack://pdfjs-dist/build/pdf/src/shared/is_node.js","webpack://pdfjs-dist/build/pdf/src/display/api.js","webpack://pdfjs-dist/build/pdf/src/display/font_loader.js","webpack://pdfjs-dist/build/pdf/src/display/api_compatibility.js","webpack://pdfjs-dist/build/pdf/src/display/canvas.js","webpack://pdfjs-dist/build/pdf/src/display/pattern_helper.js","webpack://pdfjs-dist/build/pdf/src/display/worker_options.js","webpack://pdfjs-dist/build/pdf/src/shared/message_handler.js","webpack://pdfjs-dist/build/pdf/src/display/metadata.js","webpack://pdfjs-dist/build/pdf/src/display/xml_parser.js","webpack://pdfjs-dist/build/pdf/src/display/transport_stream.js","webpack://pdfjs-dist/build/pdf/src/display/webgl.js","webpack://pdfjs-dist/build/pdf/src/display/annotation_layer.js","webpack://pdfjs-dist/build/pdf/src/display/text_layer.js","webpack://pdfjs-dist/build/pdf/src/display/svg.js","webpack://pdfjs-dist/build/pdf/src/display/node_stream.js","webpack://pdfjs-dist/build/pdf/src/display/network_utils.js","webpack://pdfjs-dist/build/pdf/src/display/content_disposition.js","webpack://pdfjs-dist/build/pdf/src/display/network.js","webpack://pdfjs-dist/build/pdf/src/display/fetch_stream.js"],"names":["pdfjsVersion","pdfjsBuild","require","PDFNodeStream","setPDFNetworkStreamFactory","params","PDFNetworkStream","PDFFetchStream","isValidFetchUrl","DEFAULT_LINK_REL","SVG_NS","create","width","height","canvas","document","context","reset","canvasAndContext","destroy","constructor","baseUrl","isCompressed","url","compressionType","CMapCompressionType","isFetchSupported","response","cMapData","stringToBytes","reason","request","XMLHttpRequest","resolve","reject","assert","svg","createElement","offsetX","offsetY","dontFlip","centerX","viewBox","centerY","rotation","rotateA","rotateB","rotateC","rotateD","offsetCanvasX","Math","offsetCanvasY","clone","scale","convertToViewportPoint","convertToViewportRectangle","topLeft","rect","bottomRight","convertToPdfPoint","LinkTarget","NONE","SELF","BLANK","PARENT","TOP","enabled","urlNullRemoved","removeNullCharacters","link","targetStr","anchor","query","end","Object","time","name","warn","Date","timeEnd","start","toString","outBuf","longest","duration","Response","protocol","script","console","isString","pdfDateStringRegex","matches","year","parseInt","month","day","hour","minute","second","universalTimeRelation","offsetHour","offsetMinute","IDENTITY_MATRIX","FONT_IDENTITY_MATRIX","PermissionFlag","PRINT","MODIFY_CONTENTS","COPY","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","COPY_FOR_ACCESSIBILITY","ASSEMBLE","PRINT_HIGH_QUALITY","TextRenderingMode","FILL","STROKE","FILL_STROKE","INVISIBLE","FILL_ADD_TO_PATH","STROKE_ADD_TO_PATH","FILL_STROKE_ADD_TO_PATH","ADD_TO_PATH","FILL_STROKE_MASK","ADD_TO_PATH_FLAG","ImageKind","GRAYSCALE_1BPP","RGB_24BPP","RGBA_32BPP","AnnotationType","TEXT","LINK","FREETEXT","LINE","SQUARE","CIRCLE","POLYGON","POLYLINE","HIGHLIGHT","UNDERLINE","SQUIGGLY","STRIKEOUT","STAMP","CARET","INK","POPUP","FILEATTACHMENT","SOUND","MOVIE","WIDGET","SCREEN","PRINTERMARK","TRAPNET","WATERMARK","THREED","REDACT","AnnotationStateModelType","MARKED","REVIEW","AnnotationMarkedState","UNMARKED","AnnotationReviewState","ACCEPTED","REJECTED","CANCELLED","COMPLETED","AnnotationReplyType","GROUP","REPLY","AnnotationFlag","HIDDEN","NOZOOM","NOROTATE","NOVIEW","READONLY","LOCKED","TOGGLENOVIEW","LOCKEDCONTENTS","AnnotationFieldFlag","REQUIRED","NOEXPORT","MULTILINE","PASSWORD","NOTOGGLETOOFF","RADIO","PUSHBUTTON","COMBO","EDIT","SORT","FILESELECT","MULTISELECT","DONOTSPELLCHECK","DONOTSCROLL","COMB","RICHTEXT","RADIOSINUNISON","COMMITONSELCHANGE","AnnotationBorderStyleType","SOLID","DASHED","BEVELED","INSET","StreamType","UNKNOWN","FLATE","LZW","DCT","JPX","JBIG","A85","AHX","CCF","RLX","FontType","TYPE1","TYPE1C","CIDFONTTYPE0","CIDFONTTYPE0C","TRUETYPE","CIDFONTTYPE2","TYPE3","OPENTYPE","TYPE0","MMTYPE1","VerbosityLevel","ERRORS","WARNINGS","INFOS","BINARY","STREAM","OPS","dependency","setLineWidth","setLineCap","setLineJoin","setMiterLimit","setDash","setRenderingIntent","setFlatness","setGState","save","restore","transform","moveTo","lineTo","curveTo","curveTo2","curveTo3","closePath","rectangle","stroke","closeStroke","fill","eoFill","fillStroke","eoFillStroke","closeFillStroke","closeEOFillStroke","endPath","clip","eoClip","beginText","endText","setCharSpacing","setWordSpacing","setHScale","setLeading","setFont","setTextRenderingMode","setTextRise","moveText","setLeadingMoveText","setTextMatrix","nextLine","showText","showSpacedText","nextLineShowText","nextLineSetSpacingShowText","setCharWidth","setCharWidthAndBounds","setStrokeColorSpace","setFillColorSpace","setStrokeColor","setStrokeColorN","setFillColor","setFillColorN","setStrokeGray","setFillGray","setStrokeRGBColor","setFillRGBColor","setStrokeCMYKColor","setFillCMYKColor","shadingFill","beginInlineImage","beginImageData","endInlineImage","paintXObject","markPoint","markPointProps","beginMarkedContent","beginMarkedContentProps","endMarkedContent","beginCompat","endCompat","paintFormXObjectBegin","paintFormXObjectEnd","beginGroup","endGroup","beginAnnotations","endAnnotations","beginAnnotation","endAnnotation","paintJpegXObject","paintImageMaskXObject","paintImageMaskXObjectGroup","paintImageXObject","paintInlineImageXObject","paintInlineImageXObjectGroup","paintImageXObjectRepeat","paintImageMaskXObjectRepeat","paintSolidColorImageMask","constructPath","UNSUPPORTED_FEATURES","unknown","forms","javaScript","smask","shadingPattern","font","errorTilingPattern","errorExtGState","errorXObject","errorFontLoadType3","errorFontState","errorFontMissing","errorFontTranslate","errorColorSpace","errorOperatorList","errorFontToUnicode","errorFontLoadNative","errorFontGetPath","PasswordResponses","NEED_PASSWORD","INCORRECT_PASSWORD","verbosity","Number","unreachable","base","other","absoluteUrl","_isValidProtocol","enumerable","configurable","writable","BaseException","NullCharactersRegExp","str","bytes","length","MAX_ARGUMENT_COUNT","String","strBuf","i","chunkEnd","chunk","arr","resultLength","arrayByteLength","pos","data","item","itemLength","value","buffer8","view32","IsLittleEndianCached","shadow","isLittleEndian","IsEvalSupportedCached","isEvalSupported","rgbBuf","m1","m2","xt","p","m","yt","d","p1","Util","p2","r","p3","p4","v","transpose","a","b","c","first","sx","sy","orderedX","rect1","rect2","orderedY","result","PDFStringTranslateTable","code","decodeURIComponent","escape","unescape","encodeURIComponent","arr1","arr2","element","capability","isSettled","get","createObjectURL","digits","forceDataSchema","URL","blob","type","buffer","ii","b1","b2","b3","d1","d2","d3","d4","isNodeJS","process","DEFAULT_RANGE_CHUNK_SIZE","RENDERING_CANCELLED_TIMEOUT","createPDFNetworkStream","task","source","isArrayBuffer","src","range","rangeTransport","worker","key","window","pdfBytes","isNaN","apiCompatibilityParams","setVerbosityLevel","workerParams","port","GlobalWorkerOptions","PDFWorker","docId","workerIdPromise","_fetchDocument","networkStreamPromise","networkStream","initialData","progressiveDone","disableRange","disableStream","httpHeaders","withCredentials","rangeChunkSize","messageHandler","transport","Promise","pdfDataRangeTransport","apiVersion","password","disableAutoFetch","maxImageSize","disableFontFace","postMessageTransfers","docBaseUrl","ignoreErrors","fontExtraProperties","PDFDocumentLoadingTask","nextDocumentId","transportDestroyed","addRangeListener","addProgressListener","addProgressiveReadListener","addProgressiveDoneListener","onDataRange","listener","onDataProgress","onDataProgressiveRead","onDataProgressiveDone","transportReady","requestDataRange","abort","getPage","getPageIndex","getDestinations","getDestination","getPageLabels","getPageLayout","getPageMode","getViewerPreferences","getOpenAction","getOpenActionDestination","deprecated","openAction","getAttachments","getJavaScript","getOutline","getPermissions","getMetadata","getData","getDownloadInfo","getStats","cleanup","pdfBug","getViewport","getAnnotations","intent","render","enableWebGL","renderInteractiveForms","imageLayer","canvasFactory","background","renderingIntent","intentState","clearTimeout","canvasFactoryInstance","webGLContext","enable","fnArray","argsArray","lastChunk","pageIndex","complete","error","internalRenderTask","callback","objs","commonObjs","operatorList","useRequestAnimationFrame","renderTask","transparency","getOperatorList","opListTask","streamTextContent","normalizeWhitespace","disableCombineTextItems","TEXT_CONTENT_CHUNK_SIZE","combineTextItems","highWaterMark","size","textContent","getTextContent","readableStream","reader","pump","items","styles","_destroy","waitOn","force","renderCompleted","resetStats","_tryCleanup","_startRenderPage","_renderPageChunk","operatorListChunk","_pumpOperatorList","args","_abortOperatorList","defer","postMessage","cloned","transferable","transfers","Array","desc","cloneValue","e","addEventListener","removeEventListener","terminate","pdfWorkerPorts","isWorkerDisabled","nextFakeWorkerId","fallbackWorkerSrc","pdfjsFilePath","mainWorkerMessageHandler","globalThis","fakeWorkerCapability","loader","getMainThreadWorkerMessageHandler","eval","getWorkerSrc","loadScript","wrapper","_initializeFromPort","_initialize","workerSrc","isSameOrigin","createCDNWrapper","terminateEarly","onWorkerError","sendTest","testObj","info","_setupFakeWorker","setupFakeWorkerGlobal","WorkerMessageHandler","id","workerHandler","loadingTask","onUnsupportedFeature","page","terminated","setupMessageHandler","evt","loaded","total","sink","headersCapability","fullReader","isStreamingSupported","isRangeSupported","contentLength","rangeReader","pdfInfo","ex","exception","updatePassword","exportedError","exportedData","fontRegistry","registerFont","pageProxy","MAX_IMAGE_SIZE_TO_STORE","imageData","fetched","builtInCMap","_onUnsupportedFeature","pageNumber","promise","pageInfo","results","metadata","contentDispositionFilename","startCleanup","cleanupSuccessful","_ensureObj","resolved","obj","has","clear","cancel","InternalRenderTask","canvasInRendering","initializeGraphics","operatorListChanged","_continue","_scheduleNext","version","build","addNativeFontFace","insertRule","styleElement","styleSheet","nativeFontFace","featureId","rule","_queueLoadingCallback","supported","_prepareFontLoadEvent","FontLoader","requests","nextRequestId","navigator","otherRequest","setTimeout","done","getLoadTestFont","atob","offset","chunk1","s","chunk2","ctx","called","isFontReady","loadTestFontId","COMMENT_OFFSET","spliceString","CFF_CHECKSUM_OFFSET","XXXX_VALUE","checksum","int32","string32","btoa","names","fonts","div","span","translatedData","createNativeFontFace","createFontFaceRule","bytesToString","getPathGenerator","cmds","js","current","compatibilityParams","MIN_FONT_SIZE","MAX_FONT_SIZE","MAX_GROUP_SIZE","MIN_WIDTH_FACTOR","COMPILE_TYPE3_GLYPHS","MAX_SIZE_TO_COMPILE","FULL_CHUNK_HEIGHT","f","ad_bc","bc_ad","old","prev","cosValue","sinValue","CachedCanvases","getCanvas","canvasEntry","addContextCurrentTransform","POINT_TO_PROCESS_LIMIT","imgData","width1","points","POINT_TYPES","lineSize","data0","mask","elem","count","j","j0","sum","steps","outlines","coords","p0","step","pp","drawOutline","k","kk","o","l","ll","CanvasExtraState","setCurrentPoint","CanvasGraphics","EXECUTION_TIME","EXECUTION_STEPS","partialChunkHeight","fullChunks","totalChunks","chunkImgData","srcPos","dest","srcLength","dest32","dest32DataLength","fullSrcDiff","white","black","thisChunkHeight","destPos","srcDiff","kEnd","kEndUnrolled","srcByte","elemsInThisChunk","properties","property","sourceCtx","destCtx","alpha","alpha_","r0","g0","b0","maskData","transferMap","layerData","y","hasBackdrop","backdrop","subtype","composeFn","PIXELS_TO_PROCESS","chunkSize","row","chunkHeight","maskCtx","layerCtx","composeSMaskBackdrop","composed","layer","genericComposeSMask","LINE_CAP_STYLES","LINE_JOIN_STYLES","NORMAL_CLIP","EO_CLIP","beginDrawing","transparentCanvas","resetCtxToDefault","viewport","executeOperatorList","executionStartIdx","argsArrayLen","chunkOperations","endTime","stepper","fnId","objsPool","depObjId","continueCallback","endDrawing","states","state","beginSMaskGroup","activeSMask","drawnWidth","drawnHeight","cacheId","scratchCanvas","currentCtx","currentTransform","groupCtx","copyCtxState","suspendSMaskGroup","composeSMask","deltaTransform","resumeSMaskGroup","endSMaskGroup","x","ops","xw","yh","consumePath","strokeColor","fillColor","isPatternFill","needRestore","paths","path","fontObj","bold","italic","typeface","browserFontSize","paintChar","textRenderingMode","fontSize","fillStrokeMode","isAddToPathSet","patternFill","addToPath","fontSizeScale","charSpacing","wordSpacing","fontDirection","textHScale","glyphsLength","glyphs","vertical","spacingDir","defaultVMetrics","widthAdvanceScale","simpleFillText","pattern","patternTransform","lineWidth","glyph","isNum","restoreNeeded","spacing","character","accent","vmetric","vx","vy","scaledX","scaledY","measuredWidth","characterScaleX","scaledAccentX","scaledAccentY","charWidth","showType3Text","fontMatrix","isTextInvisible","spacingLength","transformed","urx","ury","getColorN_Pattern","IR","color","baseTransform","canvasGraphicsFactory","createCanvasGraphics","getShadingPatternFromIR","inv","bl","br","ul","ur","x0","y0","x1","y1","matrix","bbox","group","bounds","canvasBounds","scaleX","scaleY","startTransformInverse","img","maskCanvas","putBinaryImageMask","positions","images","image","objId","map","w","h","widthScale","heightScale","imgToPaint","tmpCanvas","tmpCtx","putBinaryImageData","paintWidth","paintHeight","tmpCanvasId","newWidth","newHeight","position","left","top","entry","getSinglePixelWidth","inverse","getCanvasPosition","ShadingIRs","region","fromIR","raw","colorStops","r1","getPattern","applyBoundingBox","grad","createMeshCanvas","colors","rowSize","tmp","c1","c2","c3","x2","y2","x3","y3","c1r","c1g","c1b","c2r","c2g","c2b","c3r","c3g","c3b","minY","maxY","xa","car","cag","cab","xb","cbr","cbg","cbb","x1_","x2_","ps","figure","cs","verticesPerRow","rows","cols","q","drawTriangle","EXPECTED_SCALE","MAX_PATTERN_SIZE","BORDER_SIZE","boundsWidth","boundsHeight","combinesScale","paddedWidth","paddedHeight","cachedCanvases","backgroundColor","figures","drawFigure","owner","matrixScale","temporaryPatternCanvas","shadingIR","TilingPattern","PaintType","COLORED","UNCOLORED","createPatternCanvas","xstep","ystep","paintType","tilingType","curMatrixScale","combinedScale","dimx","dimy","graphics","getSizeAndScale","maxSize","clipBbox","bboxWidth","bboxHeight","setFillAndStrokeStyleToContext","cssColor","CallbackKind","DATA","ERROR","StreamKind","CANCEL","CANCEL_COMPLETE","CLOSE","ENQUEUE","PULL","PULL_COMPLETE","START_COMPLETE","event","callbackId","wrapReason","action","cbSourceName","cbTargetName","comObj","sourceName","targetName","on","ah","send","sendWithPromise","sendWithStream","streamId","controller","startCapability","startCall","pullCall","cancelCall","isClosed","desiredSize","pull","pullCapability","stream","cancelCapability","_createStreamSink","self","streamSink","enqueue","lastDesiredSize","close","sinkCapability","onPull","onCancel","isCancelled","ready","success","_processStreamMessage","_postMessage","parser","xmlDocument","_repair","chars","_parse","rdf","nodeName","children","jj","getAll","XMLParserErrorCode","NoError","EndOfDocument","UnterminatedCdat","UnterminatedXmlDeclaration","UnterminatedDoctypeDeclaration","UnterminatedComment","MalformedElement","OutOfMemory","UnterminatedAttributeValue","UnterminatedElement","ElementNeverBegun","ch","isWhitespace","_resolveEntities","entity","_parseContent","attributes","skipWs","attrName","attrValue","attrEndChar","attrEndIndex","parsed","_parseProcessingInstruction","attrStart","parseXml","ch2","pi","q2","complexDoctype","doctypeContent","content","text","onResolveEntity","onPi","onComment","onCdata","onDoctype","onText","onBeginElement","onEndElement","onError","childNodes","index","child","hasChildNodes","parseFromString","isWhitespaceString","node","lastElement","_onReceiveData","found","_onProgress","firstReader","_onProgressiveDone","_removeRangeReader","getFullReader","queuedChunks","getRangeReader","cancelAllRequests","readers","_enqueue","requestCapability","requestsCapability","WebGLUtils","drawFigures","shader","gl","compiled","errorMsg","loadShader","program","shaders","linked","texture","currentCanvas","currentGL","premultipliedalpha","smaskVertexShaderCode","smaskFragmentShaderCode","smaskCache","generateGL","vertexShader","createVertexShader","fragmentShader","createFragmentShader","cache","texCoordLocation","texLayerLocation","texMaskLocation","texCoordBuffer","initSmaskGL","createTexture","maskTexture","figuresVertexShaderCode","figuresFragmentShaderCode","figuresCache","initFiguresGL","coordsMap","colorsMap","pIndex","cIndex","col","coordsBuffer","colorsBuffer","tryInitGL","parameters","fieldType","isRenderable","ignoreBorder","_createContainer","container","horizontalRadius","verticalRadius","radius","_createPopup","trigger","popupElement","title","modificationDate","contents","hideWrapper","popup","addLinkAttributes","target","linkService","rel","_bindLink","_bindNamedAction","JSON","TEXT_ALIGNMENT","fieldWidth","combWidth","_setTextStyle","style","fontFamily","fallbackName","selectElement","optionElement","option","IGNORE_TYPES","selector","parentElement","parentLeft","parseFloat","parentWidth","BACKGROUND_ENLIGHT","g","dateObject","PDFDateString","date","_formatContents","lines","line","_toggle","_show","pin","_hide","unpin","borderWidth","square","circle","coordinate","polyline","getFilenameFromUrl","stringToPDFString","_download","sortedAnnotations","popupAnnotations","downloadManager","imageResourcesPath","svgFactory","renderTextLayer","MAX_TEXT_DIVS_TO_RENDER","NonWhitespaceRegexp","textDiv","textDivProperties","angle","canvasWidth","originalTransform","paddingBottom","paddingLeft","paddingRight","paddingTop","isAllWhitespace","geom","tx","fontHeight","fontAscent","shouldScaleText","absScaleX","absScaleY","angleCos","angleSin","divWidth","divHeight","right","bottom","textDivs","textDivsLength","t","ts","expanded","expandBounds","divProperties","boxScale","findPositiveMin","box","x1New","x2New","expandBoundsLTR","boxes","fakeBoundary","horizon","boundary","maxXNew","horizonPart","affectedBoundary","xNew","changedHorizon","lastBoundary","useBoundary","used","textContentItemsStr","TextLayerRenderTask","_processItems","len","appendText","_layoutText","_render","styleCache","textItems","textStyles","expandTextDivs","expand","transformBuf","paddingBuf","divProps","renderParameters","textContentStream","enhanceTextSelection","SVGGraphics","SVG_DEFAULTS","fontStyle","fontWeight","XML_NS","XLINK_NS","convertImgDataToPng","PNG_HEADER","CHUNK_WRAPPER_SIZE","crcTable","crc","body","crc32","deflateSyncUncompressed","input","Buffer","output","__non_webpack_require__","level","literals","maxBlockLength","deflateBlocks","idat","adler","adler32","colorType","bitDepth","offsetLiterals","offsetBytes","kind","ihdr","deflateSync","pngLength","writePngChunk","encode","opTree","opListElement","fn","pf","clipCount","maskCount","shadingCount","loadDependencies","transformMatrix","getSVG","svgElement","convertOpList","operatorIdMapping","opList","opListToTree","executeOpTree","opTreeElement","lineWidthScale","textMatrix","pm","addFontStyle","details","setStrokeAlpha","setFillAlpha","_makeColorN_Pattern","_makeTilingPattern","tilingId","txstep","tystep","tiling","tx1","ty1","_makeShadingPattern","shadingId","point0","point1","gradient","focalPoint","circlePoint","focalRadius","circleRadius","stop","colorStop","op","clipId","clipPath","clipElement","_setStrokeAttributes","dashArray","imgSrc","cliprect","imgEl","definitions","rootGroup","_ensureClipGroup","clipGroup","_ensureTransformGroup","fs","http","https","fileUriRegex","parsedUrl","parseUrl","_error","_setReadableStream","auth","host","method","handleResponse","getResponseHeader","isHttp","suggestedLength","extractFilenameFromHeader","createRequestOptions","stat","returnValues","allowRangeRequests","contentEncoding","contentDisposition","filename","getFilenameFromContentDispositionHeader","status","needsEncodingFixup","toParamRegExp","rfc2616unquote","rfc5987decode","rfc2047decode","fixupEncoding","rfc2231getparam","decoder","fatal","textdecode","iter","n","parts","part","quotindex","encodingend","extvalue","encoding","langvalue","OK_RESPONSE","PARTIAL_CONTENT_RESPONSE","xhr","array","requestRange","listeners","requestFull","xhrId","pendingRequest","onProgress","onStateChange","xhrStatus","ok_response_on_range_request","getArrayBuffer","rangeHeader","begin","hasPendingRequests","getRequestXhr","isPendingRequest","abortAllRequests","abortRequest","_onRangeRequestReaderClosed","onHeadersReceived","onDone","manager","_onHeadersReceived","fullRequestXhrId","fullRequestXhr","_onDone","_onError","createResponseStatusError","_close","signal","abortController","mode","credentials","redirect","headers","createHeaders","fetch","createFetchOptions","validateResponseStatus"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAAkBv6C,MAAlB,CAdA,EAc9B;;AAEA,UAAMlD,MAAMga,OAhBkB,GAgB9B;AACA0jC,eAEEC,mBACE,KADFA,UAEE,KAFFA,kBAGE,KALJD,gBAEEC,CAFFD,OAOOt9C,YAAY;AACjB,UAAI,CAACw9C,2CAAuBx9C,SAA5B,MAAKw9C,CAAL,EAA8C;AAC5C,cAAMX,8CAA0B78C,SAA1B68C,QADsC,GACtCA,CAAN;AAFe;;AAIjB,2BAJiB,OAIjB;;AACA,qBAAe78C,cALE,SAKFA,EAAf;AA7B4B,KAiB9Bs9C;AAeA,sBAhC8B,IAgC9B;AAjC4B;;AAoC9B,6BAA2B;AACzB,WAAO,KADkB,qBACzB;AArC4B;;AAwC9B,eAAa;AACX,UAAM,qBADK,OACX;AACA,UAAM;AAAA;AAAA;AAAA,QAAkB,MAAM,aAFnB,IAEmB,EAA9B;;AACA,cAAU;AACR,aAAO;AAAA;AAAA;AAAA,OAAP;AAJS;;AAMX,oBAAgB9nC,MANL,UAMX;;AACA,QAAI,KAAJ,YAAqB;AACnB,sBAAgB;AAAE0P,gBAAQ,KADP;AACH,OAAhB;AARS;;AAUX,UAAMrM,SAAS,sBAVJ,MAUX;AACA,WAAO;AAAErD,aAAF;AAAiBuT,YAAjB;AAAA,KAAP;AAnD4B;;AAsD9BzB,iBAAe;AACb,QAAI,KAAJ,SAAkB;AAChB,0BADgB,MAChB;AAFW;;AAIb,QAAI,KAAJ,kBAA2B;AACzB,4BADyB,KACzB;AALW;AAtDe;;AAAA,C","file":"pdf.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"pdfjs-dist/build/pdf\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"pdfjs-dist/build/pdf\"] = factory();\n\telse\n\t\troot[\"pdfjs-dist/build/pdf\"] = factory();\n})(this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __w_pdfjs_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__w_pdfjs_require__.m = modules;\n\n \t// expose the module cache\n \t__w_pdfjs_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__w_pdfjs_require__.d = function(exports, name, getter) {\n \t\tif(!__w_pdfjs_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__w_pdfjs_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__w_pdfjs_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __w_pdfjs_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__w_pdfjs_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __w_pdfjs_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__w_pdfjs_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__w_pdfjs_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__w_pdfjs_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __w_pdfjs_require__(__w_pdfjs_require__.s = 0);\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n addLinkAttributes,\n getFilenameFromUrl,\n isFetchSupported,\n isValidFetchUrl,\n LinkTarget,\n loadScript,\n PDFDateString,\n RenderingCancelledException,\n} from \"./display/display_utils.js\";\nimport {\n build,\n getDocument,\n LoopbackPort,\n PDFDataRangeTransport,\n PDFWorker,\n setPDFNetworkStreamFactory,\n version,\n} from \"./display/api.js\";\nimport {\n CMapCompressionType,\n createObjectURL,\n createPromiseCapability,\n createValidAbsoluteUrl,\n InvalidPDFException,\n MissingPDFException,\n OPS,\n PasswordResponses,\n PermissionFlag,\n removeNullCharacters,\n shadow,\n UnexpectedResponseException,\n UNSUPPORTED_FEATURES,\n Util,\n VerbosityLevel,\n} from \"./shared/util.js\";\nimport { AnnotationLayer } from \"./display/annotation_layer.js\";\nimport { apiCompatibilityParams } from \"./display/api_compatibility.js\";\nimport { GlobalWorkerOptions } from \"./display/worker_options.js\";\nimport { renderTextLayer } from \"./display/text_layer.js\";\nimport { SVGGraphics } from \"./display/svg.js\";\n\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : void 0;\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsBuild =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : void 0;\n\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n const streamsPromise = Promise.all([\n import(\"pdfjs/display/network.js\"),\n import(\"pdfjs/display/fetch_stream.js\"),\n ]);\n setPDFNetworkStreamFactory(params => {\n return streamsPromise.then(streams => {\n const [{ PDFNetworkStream }, { PDFFetchStream }] = streams;\n if (isFetchSupported() && isValidFetchUrl(params.url)) {\n return new PDFFetchStream(params);\n }\n return new PDFNetworkStream(params);\n });\n });\n} else if (PDFJSDev.test(\"GENERIC\")) {\n const { isNodeJS } = require(\"./shared/is_node.js\");\n if (isNodeJS) {\n const PDFNodeStream = require(\"./display/node_stream.js\").PDFNodeStream;\n setPDFNetworkStreamFactory(params => {\n return new PDFNodeStream(params);\n });\n } else {\n const PDFNetworkStream = require(\"./display/network.js\").PDFNetworkStream;\n let PDFFetchStream;\n if (isFetchSupported()) {\n PDFFetchStream = require(\"./display/fetch_stream.js\").PDFFetchStream;\n }\n setPDFNetworkStreamFactory(params => {\n if (PDFFetchStream && isValidFetchUrl(params.url)) {\n return new PDFFetchStream(params);\n }\n return new PDFNetworkStream(params);\n });\n }\n} else if (PDFJSDev.test(\"CHROME\")) {\n const PDFNetworkStream = require(\"./display/network.js\").PDFNetworkStream;\n let PDFFetchStream;\n const isChromeWithFetchCredentials = function () {\n // fetch does not include credentials until Chrome 61.0.3138.0 and later.\n // https://chromium.googlesource.com/chromium/src/+/2e231cf052ca5e68e22baf0008ac9e5e29121707\n try {\n // Indexed properties on window are read-only in Chrome 61.0.3151.0+\n // https://chromium.googlesource.com/chromium/src.git/+/58ab4a971b06dec13e4edf9de8382ca6847f6190\n window[999] = 123; // should throw. Note: JS strict mode MUST be enabled.\n delete window[999];\n return false;\n } catch (e) {\n return true;\n }\n };\n if (isFetchSupported() && isChromeWithFetchCredentials()) {\n PDFFetchStream = require(\"./display/fetch_stream.js\").PDFFetchStream;\n }\n setPDFNetworkStreamFactory(params => {\n if (PDFFetchStream && isValidFetchUrl(params.url)) {\n return new PDFFetchStream(params);\n }\n return new PDFNetworkStream(params);\n });\n}\n\nexport {\n // From \"./display/display_utils.js\":\n addLinkAttributes,\n getFilenameFromUrl,\n LinkTarget,\n loadScript,\n PDFDateString,\n RenderingCancelledException,\n // From \"./display/api.js\":\n build,\n getDocument,\n LoopbackPort,\n PDFDataRangeTransport,\n PDFWorker,\n version,\n // From \"./shared/util.js\":\n CMapCompressionType,\n createObjectURL,\n createPromiseCapability,\n createValidAbsoluteUrl,\n InvalidPDFException,\n MissingPDFException,\n OPS,\n PasswordResponses,\n PermissionFlag,\n removeNullCharacters,\n shadow,\n UnexpectedResponseException,\n UNSUPPORTED_FEATURES,\n Util,\n VerbosityLevel,\n // From \"./display/annotation_layer.js\":\n AnnotationLayer,\n // From \"./display/api_compatibility.js\":\n apiCompatibilityParams,\n // From \"./display/worker_options.js\":\n GlobalWorkerOptions,\n // From \"./display/text_layer.js\":\n renderTextLayer,\n // From \"./display/svg.js\":\n SVGGraphics,\n};\n","/* Copyright 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint no-var: error */\n\nimport {\n assert,\n BaseException,\n CMapCompressionType,\n isString,\n removeNullCharacters,\n stringToBytes,\n Util,\n warn,\n} from \"../shared/util.js\";\n\nconst DEFAULT_LINK_REL = \"noopener noreferrer nofollow\";\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nclass DOMCanvasFactory {\n create(width, height) {\n if (width <= 0 || height <= 0) {\n throw new Error(\"Invalid canvas size\");\n }\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n canvas.width = width;\n canvas.height = height;\n return {\n canvas,\n context,\n };\n }\n\n reset(canvasAndContext, width, height) {\n if (!canvasAndContext.canvas) {\n throw new Error(\"Canvas is not specified\");\n }\n if (width <= 0 || height <= 0) {\n throw new Error(\"Invalid canvas size\");\n }\n canvasAndContext.canvas.width = width;\n canvasAndContext.canvas.height = height;\n }\n\n destroy(canvasAndContext) {\n if (!canvasAndContext.canvas) {\n throw new Error(\"Canvas is not specified\");\n }\n // Zeroing the width and height cause Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n canvasAndContext.canvas.width = 0;\n canvasAndContext.canvas.height = 0;\n canvasAndContext.canvas = null;\n canvasAndContext.context = null;\n }\n}\n\nclass DOMCMapReaderFactory {\n constructor({ baseUrl = null, isCompressed = false }) {\n this.baseUrl = baseUrl;\n this.isCompressed = isCompressed;\n }\n\n async fetch({ name }) {\n if (!this.baseUrl) {\n throw new Error(\n 'The CMap \"baseUrl\" parameter must be specified, ensure that ' +\n 'the \"cMapUrl\" and \"cMapPacked\" API parameters are provided.'\n );\n }\n if (!name) {\n throw new Error(\"CMap name must be specified.\");\n }\n const url = this.baseUrl + name + (this.isCompressed ? \".bcmap\" : \"\");\n const compressionType = this.isCompressed\n ? CMapCompressionType.BINARY\n : CMapCompressionType.NONE;\n\n if (\n (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) ||\n (isFetchSupported() && isValidFetchUrl(url, document.baseURI))\n ) {\n return fetch(url)\n .then(async response => {\n if (!response.ok) {\n throw new Error(response.statusText);\n }\n let cMapData;\n if (this.isCompressed) {\n cMapData = new Uint8Array(await response.arrayBuffer());\n } else {\n cMapData = stringToBytes(await response.text());\n }\n return { cMapData, compressionType };\n })\n .catch(reason => {\n throw new Error(\n `Unable to load ${this.isCompressed ? \"binary \" : \"\"}` +\n `CMap at: ${url}`\n );\n });\n }\n\n // The Fetch API is not supported.\n return new Promise((resolve, reject) => {\n const request = new XMLHttpRequest();\n request.open(\"GET\", url, true);\n\n if (this.isCompressed) {\n request.responseType = \"arraybuffer\";\n }\n request.onreadystatechange = () => {\n if (request.readyState !== XMLHttpRequest.DONE) {\n return;\n }\n if (request.status === 200 || request.status === 0) {\n let cMapData;\n if (this.isCompressed && request.response) {\n cMapData = new Uint8Array(request.response);\n } else if (!this.isCompressed && request.responseText) {\n cMapData = stringToBytes(request.responseText);\n }\n if (cMapData) {\n resolve({ cMapData, compressionType });\n return;\n }\n }\n reject(new Error(request.statusText));\n };\n\n request.send(null);\n }).catch(reason => {\n throw new Error(\n `Unable to load ${this.isCompressed ? \"binary \" : \"\"}` +\n `CMap at: ${url}`\n );\n });\n }\n}\n\nclass DOMSVGFactory {\n create(width, height) {\n assert(width > 0 && height > 0, \"Invalid SVG dimensions\");\n\n const svg = document.createElementNS(SVG_NS, \"svg:svg\");\n svg.setAttribute(\"version\", \"1.1\");\n svg.setAttribute(\"width\", width + \"px\");\n svg.setAttribute(\"height\", height + \"px\");\n svg.setAttribute(\"preserveAspectRatio\", \"none\");\n svg.setAttribute(\"viewBox\", \"0 0 \" + width + \" \" + height);\n\n return svg;\n }\n\n createElement(type) {\n assert(typeof type === \"string\", \"Invalid SVG element type\");\n\n return document.createElementNS(SVG_NS, type);\n }\n}\n\n/**\n * @typedef {Object} PageViewportParameters\n * @property {Array} viewBox - The xMin, yMin, xMax and yMax coordinates.\n * @property {number} scale - The scale of the viewport.\n * @property {number} rotation - The rotation, in degrees, of the viewport.\n * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The\n * default value is `0`.\n * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. The\n * default value is `0`.\n * @property {boolean} [dontFlip] - If true, the y-axis will not be flipped.\n * The default value is `false`.\n */\n\n/**\n * @typedef {Object} PageViewportCloneParameters\n * @property {number} [scale] - The scale, overriding the one in the cloned\n * viewport. The default value is `this.scale`.\n * @property {number} [rotation] - The rotation, in degrees, overriding the one\n * in the cloned viewport. The default value is `this.rotation`.\n * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.\n * The default value is `this.offsetX`.\n * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.\n * The default value is `this.offsetY`.\n * @property {boolean} [dontFlip] - If true, the x-axis will not be flipped.\n * The default value is `false`.\n */\n\n/**\n * PDF page viewport created based on scale, rotation and offset.\n */\nclass PageViewport {\n /**\n * @param {PageViewportParameters}\n */\n constructor({\n viewBox,\n scale,\n rotation,\n offsetX = 0,\n offsetY = 0,\n dontFlip = false,\n }) {\n this.viewBox = viewBox;\n this.scale = scale;\n this.rotation = rotation;\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n\n // creating transform to convert pdf coordinate system to the normal\n // canvas like coordinates taking in account scale and rotation\n const centerX = (viewBox[2] + viewBox[0]) / 2;\n const centerY = (viewBox[3] + viewBox[1]) / 2;\n let rotateA, rotateB, rotateC, rotateD;\n rotation = rotation % 360;\n rotation = rotation < 0 ? rotation + 360 : rotation;\n switch (rotation) {\n case 180:\n rotateA = -1;\n rotateB = 0;\n rotateC = 0;\n rotateD = 1;\n break;\n case 90:\n rotateA = 0;\n rotateB = 1;\n rotateC = 1;\n rotateD = 0;\n break;\n case 270:\n rotateA = 0;\n rotateB = -1;\n rotateC = -1;\n rotateD = 0;\n break;\n case 0:\n rotateA = 1;\n rotateB = 0;\n rotateC = 0;\n rotateD = -1;\n break;\n default:\n throw new Error(\n \"PageViewport: Invalid rotation, must be a multiple of 90 degrees.\"\n );\n }\n\n if (dontFlip) {\n rotateC = -rotateC;\n rotateD = -rotateD;\n }\n\n let offsetCanvasX, offsetCanvasY;\n let width, height;\n if (rotateA === 0) {\n offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;\n offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;\n width = Math.abs(viewBox[3] - viewBox[1]) * scale;\n height = Math.abs(viewBox[2] - viewBox[0]) * scale;\n } else {\n offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;\n offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;\n width = Math.abs(viewBox[2] - viewBox[0]) * scale;\n height = Math.abs(viewBox[3] - viewBox[1]) * scale;\n }\n // creating transform for the following operations:\n // translate(-centerX, -centerY), rotate and flip vertically,\n // scale, and translate(offsetCanvasX, offsetCanvasY)\n this.transform = [\n rotateA * scale,\n rotateB * scale,\n rotateC * scale,\n rotateD * scale,\n offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY,\n offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY,\n ];\n\n this.width = width;\n this.height = height;\n }\n\n /**\n * Clones viewport, with optional additional properties.\n * @param {PageViewportCloneParameters} [params]\n * @returns {PageViewport} Cloned viewport.\n */\n clone({\n scale = this.scale,\n rotation = this.rotation,\n offsetX = this.offsetX,\n offsetY = this.offsetY,\n dontFlip = false,\n } = {}) {\n return new PageViewport({\n viewBox: this.viewBox.slice(),\n scale,\n rotation,\n offsetX,\n offsetY,\n dontFlip,\n });\n }\n\n /**\n * Converts PDF point to the viewport coordinates. For examples, useful for\n * converting PDF location into canvas pixel coordinates.\n * @param {number} x - The x-coordinate.\n * @param {number} y - The y-coordinate.\n * @returns {Object} Object containing `x` and `y` properties of the\n * point in the viewport coordinate space.\n * @see {@link convertToPdfPoint}\n * @see {@link convertToViewportRectangle}\n */\n convertToViewportPoint(x, y) {\n return Util.applyTransform([x, y], this.transform);\n }\n\n /**\n * Converts PDF rectangle to the viewport coordinates.\n * @param {Array} rect - The xMin, yMin, xMax and yMax coordinates.\n * @returns {Array} Array containing corresponding coordinates of the\n * rectangle in the viewport coordinate space.\n * @see {@link convertToViewportPoint}\n */\n convertToViewportRectangle(rect) {\n const topLeft = Util.applyTransform([rect[0], rect[1]], this.transform);\n const bottomRight = Util.applyTransform([rect[2], rect[3]], this.transform);\n return [topLeft[0], topLeft[1], bottomRight[0], bottomRight[1]];\n }\n\n /**\n * Converts viewport coordinates to the PDF location. For examples, useful\n * for converting canvas pixel location into PDF one.\n * @param {number} x - The x-coordinate.\n * @param {number} y - The y-coordinate.\n * @returns {Object} Object containing `x` and `y` properties of the\n * point in the PDF coordinate space.\n * @see {@link convertToViewportPoint}\n */\n convertToPdfPoint(x, y) {\n return Util.applyInverseTransform([x, y], this.transform);\n }\n}\n\nclass RenderingCancelledException extends BaseException {\n constructor(msg, type) {\n super(msg);\n this.type = type;\n }\n}\n\nconst LinkTarget = {\n NONE: 0, // Default value.\n SELF: 1,\n BLANK: 2,\n PARENT: 3,\n TOP: 4,\n};\n\n/**\n * @typedef ExternalLinkParameters\n * @typedef {Object} ExternalLinkParameters\n * @property {string} url - An absolute URL.\n * @property {LinkTarget} [target] - The link target. The default value is\n * `LinkTarget.NONE`.\n * @property {string} [rel] - The link relationship. The default value is\n * `DEFAULT_LINK_REL`.\n * @property {boolean} [enabled] - Whether the link should be enabled. The\n * default value is true.\n */\n\n/**\n * Adds various attributes (href, title, target, rel) to hyperlinks.\n * @param {HTMLLinkElement} link - The link element.\n * @param {ExternalLinkParameters} params\n */\nfunction addLinkAttributes(link, { url, target, rel, enabled = true } = {}) {\n assert(\n url && typeof url === \"string\",\n 'addLinkAttributes: A valid \"url\" parameter must provided.'\n );\n\n const urlNullRemoved = removeNullCharacters(url);\n if (enabled) {\n link.href = link.title = urlNullRemoved;\n } else {\n link.href = \"\";\n link.title = `Disabled: ${urlNullRemoved}`;\n link.onclick = () => {\n return false;\n };\n }\n\n let targetStr = \"\"; // LinkTarget.NONE\n switch (target) {\n case LinkTarget.NONE:\n break;\n case LinkTarget.SELF:\n targetStr = \"_self\";\n break;\n case LinkTarget.BLANK:\n targetStr = \"_blank\";\n break;\n case LinkTarget.PARENT:\n targetStr = \"_parent\";\n break;\n case LinkTarget.TOP:\n targetStr = \"_top\";\n break;\n }\n link.target = targetStr;\n\n link.rel = typeof rel === \"string\" ? rel : DEFAULT_LINK_REL;\n}\n\n// Gets the file name from a given URL.\nfunction getFilenameFromUrl(url) {\n const anchor = url.indexOf(\"#\");\n const query = url.indexOf(\"?\");\n const end = Math.min(\n anchor > 0 ? anchor : url.length,\n query > 0 ? query : url.length\n );\n return url.substring(url.lastIndexOf(\"/\", end) + 1, end);\n}\n\nclass StatTimer {\n constructor() {\n this.started = Object.create(null);\n this.times = [];\n }\n\n time(name) {\n if (name in this.started) {\n warn(`Timer is already running for ${name}`);\n }\n this.started[name] = Date.now();\n }\n\n timeEnd(name) {\n if (!(name in this.started)) {\n warn(`Timer has not been started for ${name}`);\n }\n this.times.push({\n name,\n start: this.started[name],\n end: Date.now(),\n });\n // Remove timer from started so it can be called again.\n delete this.started[name];\n }\n\n toString() {\n // Find the longest name for padding purposes.\n const outBuf = [];\n let longest = 0;\n for (const time of this.times) {\n const name = time.name;\n if (name.length > longest) {\n longest = name.length;\n }\n }\n for (const time of this.times) {\n const duration = time.end - time.start;\n outBuf.push(`${time.name.padEnd(longest)} ${duration}ms\\n`);\n }\n return outBuf.join(\"\");\n }\n}\n\nfunction isFetchSupported() {\n return (\n typeof fetch !== \"undefined\" &&\n typeof Response !== \"undefined\" &&\n \"body\" in Response.prototype &&\n typeof ReadableStream !== \"undefined\"\n );\n}\n\nfunction isValidFetchUrl(url, baseUrl) {\n try {\n const { protocol } = baseUrl ? new URL(url, baseUrl) : new URL(url);\n // The Fetch API only supports the http/https protocols, and not file/ftp.\n return protocol === \"http:\" || protocol === \"https:\";\n } catch (ex) {\n return false; // `new URL()` will throw on incorrect data.\n }\n}\n\nfunction loadScript(src) {\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.src = src;\n\n script.onload = resolve;\n script.onerror = function () {\n reject(new Error(`Cannot load script at: ${script.src}`));\n };\n (document.head || document.documentElement).appendChild(script);\n });\n}\n\n// Deprecated API function -- display regardless of the `verbosity` setting.\nfunction deprecated(details) {\n console.log(\"Deprecated API usage: \" + details);\n}\n\nlet pdfDateStringRegex;\n\nclass PDFDateString {\n /**\n * Convert a PDF date string to a JavaScript `Date` object.\n *\n * The PDF date string format is described in section 7.9.4 of the official\n * PDF 32000-1:2008 specification. However, in the PDF 1.7 reference (sixth\n * edition) Adobe describes the same format including a trailing apostrophe.\n * This syntax in incorrect, but Adobe Acrobat creates PDF files that contain\n * them. We ignore all apostrophes as they are not necessary for date parsing.\n *\n * Moreover, Adobe Acrobat doesn't handle changing the date to universal time\n * and doesn't use the user's time zone (effectively ignoring the HH' and mm'\n * parts of the date string).\n *\n * @param {string} input\n * @returns {Date|null}\n */\n static toDateObject(input) {\n if (!input || !isString(input)) {\n return null;\n }\n\n // Lazily initialize the regular expression.\n if (!pdfDateStringRegex) {\n pdfDateStringRegex = new RegExp(\n \"^D:\" + // Prefix (required)\n \"(\\\\d{4})\" + // Year (required)\n \"(\\\\d{2})?\" + // Month (optional)\n \"(\\\\d{2})?\" + // Day (optional)\n \"(\\\\d{2})?\" + // Hour (optional)\n \"(\\\\d{2})?\" + // Minute (optional)\n \"(\\\\d{2})?\" + // Second (optional)\n \"([Z|+|-])?\" + // Universal time relation (optional)\n \"(\\\\d{2})?\" + // Offset hour (optional)\n \"'?\" + // Splitting apostrophe (optional)\n \"(\\\\d{2})?\" + // Offset minute (optional)\n \"'?\" // Trailing apostrophe (optional)\n );\n }\n\n // Optional fields that don't satisfy the requirements from the regular\n // expression (such as incorrect digit counts or numbers that are out of\n // range) will fall back the defaults from the specification.\n const matches = pdfDateStringRegex.exec(input);\n if (!matches) {\n return null;\n }\n\n // JavaScript's `Date` object expects the month to be between 0 and 11\n // instead of 1 and 12, so we have to correct for that.\n const year = parseInt(matches[1], 10);\n let month = parseInt(matches[2], 10);\n month = month >= 1 && month <= 12 ? month - 1 : 0;\n let day = parseInt(matches[3], 10);\n day = day >= 1 && day <= 31 ? day : 1;\n let hour = parseInt(matches[4], 10);\n hour = hour >= 0 && hour <= 23 ? hour : 0;\n let minute = parseInt(matches[5], 10);\n minute = minute >= 0 && minute <= 59 ? minute : 0;\n let second = parseInt(matches[6], 10);\n second = second >= 0 && second <= 59 ? second : 0;\n const universalTimeRelation = matches[7] || \"Z\";\n let offsetHour = parseInt(matches[8], 10);\n offsetHour = offsetHour >= 0 && offsetHour <= 23 ? offsetHour : 0;\n let offsetMinute = parseInt(matches[9], 10) || 0;\n offsetMinute = offsetMinute >= 0 && offsetMinute <= 59 ? offsetMinute : 0;\n\n // Universal time relation 'Z' means that the local time is equal to the\n // universal time, whereas the relations '+'/'-' indicate that the local\n // time is later respectively earlier than the universal time. Every date\n // is normalized to universal time.\n if (universalTimeRelation === \"-\") {\n hour += offsetHour;\n minute += offsetMinute;\n } else if (universalTimeRelation === \"+\") {\n hour -= offsetHour;\n minute -= offsetMinute;\n }\n\n return new Date(Date.UTC(year, month, day, hour, minute, second));\n }\n}\n\nexport {\n PageViewport,\n RenderingCancelledException,\n addLinkAttributes,\n getFilenameFromUrl,\n LinkTarget,\n DEFAULT_LINK_REL,\n DOMCanvasFactory,\n DOMCMapReaderFactory,\n DOMSVGFactory,\n StatTimer,\n isFetchSupported,\n isValidFetchUrl,\n loadScript,\n deprecated,\n PDFDateString,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint no-var: error */\n\nimport \"./compatibility.js\";\n\nconst IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];\nconst FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];\n\n// Permission flags from Table 22, Section 7.6.3.2 of the PDF specification.\nconst PermissionFlag = {\n PRINT: 0x04,\n MODIFY_CONTENTS: 0x08,\n COPY: 0x10,\n MODIFY_ANNOTATIONS: 0x20,\n FILL_INTERACTIVE_FORMS: 0x100,\n COPY_FOR_ACCESSIBILITY: 0x200,\n ASSEMBLE: 0x400,\n PRINT_HIGH_QUALITY: 0x800,\n};\n\nconst TextRenderingMode = {\n FILL: 0,\n STROKE: 1,\n FILL_STROKE: 2,\n INVISIBLE: 3,\n FILL_ADD_TO_PATH: 4,\n STROKE_ADD_TO_PATH: 5,\n FILL_STROKE_ADD_TO_PATH: 6,\n ADD_TO_PATH: 7,\n FILL_STROKE_MASK: 3,\n ADD_TO_PATH_FLAG: 4,\n};\n\nconst ImageKind = {\n GRAYSCALE_1BPP: 1,\n RGB_24BPP: 2,\n RGBA_32BPP: 3,\n};\n\nconst AnnotationType = {\n TEXT: 1,\n LINK: 2,\n FREETEXT: 3,\n LINE: 4,\n SQUARE: 5,\n CIRCLE: 6,\n POLYGON: 7,\n POLYLINE: 8,\n HIGHLIGHT: 9,\n UNDERLINE: 10,\n SQUIGGLY: 11,\n STRIKEOUT: 12,\n STAMP: 13,\n CARET: 14,\n INK: 15,\n POPUP: 16,\n FILEATTACHMENT: 17,\n SOUND: 18,\n MOVIE: 19,\n WIDGET: 20,\n SCREEN: 21,\n PRINTERMARK: 22,\n TRAPNET: 23,\n WATERMARK: 24,\n THREED: 25,\n REDACT: 26,\n};\n\nconst AnnotationStateModelType = {\n MARKED: \"Marked\",\n REVIEW: \"Review\",\n};\n\nconst AnnotationMarkedState = {\n MARKED: \"Marked\",\n UNMARKED: \"Unmarked\",\n};\n\nconst AnnotationReviewState = {\n ACCEPTED: \"Accepted\",\n REJECTED: \"Rejected\",\n CANCELLED: \"Cancelled\",\n COMPLETED: \"Completed\",\n NONE: \"None\",\n};\n\nconst AnnotationReplyType = {\n GROUP: \"Group\",\n REPLY: \"R\",\n};\n\nconst AnnotationFlag = {\n INVISIBLE: 0x01,\n HIDDEN: 0x02,\n PRINT: 0x04,\n NOZOOM: 0x08,\n NOROTATE: 0x10,\n NOVIEW: 0x20,\n READONLY: 0x40,\n LOCKED: 0x80,\n TOGGLENOVIEW: 0x100,\n LOCKEDCONTENTS: 0x200,\n};\n\nconst AnnotationFieldFlag = {\n READONLY: 0x0000001,\n REQUIRED: 0x0000002,\n NOEXPORT: 0x0000004,\n MULTILINE: 0x0001000,\n PASSWORD: 0x0002000,\n NOTOGGLETOOFF: 0x0004000,\n RADIO: 0x0008000,\n PUSHBUTTON: 0x0010000,\n COMBO: 0x0020000,\n EDIT: 0x0040000,\n SORT: 0x0080000,\n FILESELECT: 0x0100000,\n MULTISELECT: 0x0200000,\n DONOTSPELLCHECK: 0x0400000,\n DONOTSCROLL: 0x0800000,\n COMB: 0x1000000,\n RICHTEXT: 0x2000000,\n RADIOSINUNISON: 0x2000000,\n COMMITONSELCHANGE: 0x4000000,\n};\n\nconst AnnotationBorderStyleType = {\n SOLID: 1,\n DASHED: 2,\n BEVELED: 3,\n INSET: 4,\n UNDERLINE: 5,\n};\n\nconst StreamType = {\n UNKNOWN: \"UNKNOWN\",\n FLATE: \"FLATE\",\n LZW: \"LZW\",\n DCT: \"DCT\",\n JPX: \"JPX\",\n JBIG: \"JBIG\",\n A85: \"A85\",\n AHX: \"AHX\",\n CCF: \"CCF\",\n RLX: \"RLX\", // PDF short name is 'RL', but telemetry requires three chars.\n};\n\nconst FontType = {\n UNKNOWN: \"UNKNOWN\",\n TYPE1: \"TYPE1\",\n TYPE1C: \"TYPE1C\",\n CIDFONTTYPE0: \"CIDFONTTYPE0\",\n CIDFONTTYPE0C: \"CIDFONTTYPE0C\",\n TRUETYPE: \"TRUETYPE\",\n CIDFONTTYPE2: \"CIDFONTTYPE2\",\n TYPE3: \"TYPE3\",\n OPENTYPE: \"OPENTYPE\",\n TYPE0: \"TYPE0\",\n MMTYPE1: \"MMTYPE1\",\n};\n\nconst VerbosityLevel = {\n ERRORS: 0,\n WARNINGS: 1,\n INFOS: 5,\n};\n\nconst CMapCompressionType = {\n NONE: 0,\n BINARY: 1,\n STREAM: 2,\n};\n\n// All the possible operations for an operator list.\nconst OPS = {\n // Intentionally start from 1 so it is easy to spot bad operators that will be\n // 0's.\n dependency: 1,\n setLineWidth: 2,\n setLineCap: 3,\n setLineJoin: 4,\n setMiterLimit: 5,\n setDash: 6,\n setRenderingIntent: 7,\n setFlatness: 8,\n setGState: 9,\n save: 10,\n restore: 11,\n transform: 12,\n moveTo: 13,\n lineTo: 14,\n curveTo: 15,\n curveTo2: 16,\n curveTo3: 17,\n closePath: 18,\n rectangle: 19,\n stroke: 20,\n closeStroke: 21,\n fill: 22,\n eoFill: 23,\n fillStroke: 24,\n eoFillStroke: 25,\n closeFillStroke: 26,\n closeEOFillStroke: 27,\n endPath: 28,\n clip: 29,\n eoClip: 30,\n beginText: 31,\n endText: 32,\n setCharSpacing: 33,\n setWordSpacing: 34,\n setHScale: 35,\n setLeading: 36,\n setFont: 37,\n setTextRenderingMode: 38,\n setTextRise: 39,\n moveText: 40,\n setLeadingMoveText: 41,\n setTextMatrix: 42,\n nextLine: 43,\n showText: 44,\n showSpacedText: 45,\n nextLineShowText: 46,\n nextLineSetSpacingShowText: 47,\n setCharWidth: 48,\n setCharWidthAndBounds: 49,\n setStrokeColorSpace: 50,\n setFillColorSpace: 51,\n setStrokeColor: 52,\n setStrokeColorN: 53,\n setFillColor: 54,\n setFillColorN: 55,\n setStrokeGray: 56,\n setFillGray: 57,\n setStrokeRGBColor: 58,\n setFillRGBColor: 59,\n setStrokeCMYKColor: 60,\n setFillCMYKColor: 61,\n shadingFill: 62,\n beginInlineImage: 63,\n beginImageData: 64,\n endInlineImage: 65,\n paintXObject: 66,\n markPoint: 67,\n markPointProps: 68,\n beginMarkedContent: 69,\n beginMarkedContentProps: 70,\n endMarkedContent: 71,\n beginCompat: 72,\n endCompat: 73,\n paintFormXObjectBegin: 74,\n paintFormXObjectEnd: 75,\n beginGroup: 76,\n endGroup: 77,\n beginAnnotations: 78,\n endAnnotations: 79,\n beginAnnotation: 80,\n endAnnotation: 81,\n paintJpegXObject: 82,\n paintImageMaskXObject: 83,\n paintImageMaskXObjectGroup: 84,\n paintImageXObject: 85,\n paintInlineImageXObject: 86,\n paintInlineImageXObjectGroup: 87,\n paintImageXObjectRepeat: 88,\n paintImageMaskXObjectRepeat: 89,\n paintSolidColorImageMask: 90,\n constructPath: 91,\n};\n\nconst UNSUPPORTED_FEATURES = {\n /** @deprecated unused */\n unknown: \"unknown\",\n forms: \"forms\",\n javaScript: \"javaScript\",\n smask: \"smask\",\n shadingPattern: \"shadingPattern\",\n /** @deprecated unused */\n font: \"font\",\n errorTilingPattern: \"errorTilingPattern\",\n errorExtGState: \"errorExtGState\",\n errorXObject: \"errorXObject\",\n errorFontLoadType3: \"errorFontLoadType3\",\n errorFontState: \"errorFontState\",\n errorFontMissing: \"errorFontMissing\",\n errorFontTranslate: \"errorFontTranslate\",\n errorColorSpace: \"errorColorSpace\",\n errorOperatorList: \"errorOperatorList\",\n errorFontToUnicode: \"errorFontToUnicode\",\n errorFontLoadNative: \"errorFontLoadNative\",\n errorFontGetPath: \"errorFontGetPath\",\n};\n\nconst PasswordResponses = {\n NEED_PASSWORD: 1,\n INCORRECT_PASSWORD: 2,\n};\n\nlet verbosity = VerbosityLevel.WARNINGS;\n\nfunction setVerbosityLevel(level) {\n if (Number.isInteger(level)) {\n verbosity = level;\n }\n}\n\nfunction getVerbosityLevel() {\n return verbosity;\n}\n\n// A notice for devs. These are good for things that are helpful to devs, such\n// as warning that Workers were disabled, which is important to devs but not\n// end users.\nfunction info(msg) {\n if (verbosity >= VerbosityLevel.INFOS) {\n console.log(`Info: ${msg}`);\n }\n}\n\n// Non-fatal warnings.\nfunction warn(msg) {\n if (verbosity >= VerbosityLevel.WARNINGS) {\n console.log(`Warning: ${msg}`);\n }\n}\n\nfunction unreachable(msg) {\n throw new Error(msg);\n}\n\nfunction assert(cond, msg) {\n if (!cond) {\n unreachable(msg);\n }\n}\n\n// Checks if URLs have the same origin. For non-HTTP based URLs, returns false.\nfunction isSameOrigin(baseUrl, otherUrl) {\n let base;\n try {\n base = new URL(baseUrl);\n if (!base.origin || base.origin === \"null\") {\n return false; // non-HTTP url\n }\n } catch (e) {\n return false;\n }\n\n const other = new URL(otherUrl, base);\n return base.origin === other.origin;\n}\n\n// Checks if URLs use one of the whitelisted protocols, e.g. to avoid XSS.\nfunction _isValidProtocol(url) {\n if (!url) {\n return false;\n }\n switch (url.protocol) {\n case \"http:\":\n case \"https:\":\n case \"ftp:\":\n case \"mailto:\":\n case \"tel:\":\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Attempts to create a valid absolute URL.\n *\n * @param {URL|string} url - An absolute, or relative, URL.\n * @param {URL|string} baseUrl - An absolute URL.\n * @returns Either a valid {URL}, or `null` otherwise.\n */\nfunction createValidAbsoluteUrl(url, baseUrl) {\n if (!url) {\n return null;\n }\n try {\n const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);\n if (_isValidProtocol(absoluteUrl)) {\n return absoluteUrl;\n }\n } catch (ex) {\n /* `new URL()` will throw on incorrect data. */\n }\n return null;\n}\n\nfunction shadow(obj, prop, value) {\n Object.defineProperty(obj, prop, {\n value,\n enumerable: true,\n configurable: true,\n writable: false,\n });\n return value;\n}\n\nconst BaseException = (function BaseExceptionClosure() {\n // eslint-disable-next-line no-shadow\n function BaseException(message) {\n if (this.constructor === BaseException) {\n unreachable(\"Cannot initialize BaseException.\");\n }\n this.message = message;\n this.name = this.constructor.name;\n }\n BaseException.prototype = new Error();\n BaseException.constructor = BaseException;\n\n return BaseException;\n})();\n\nclass PasswordException extends BaseException {\n constructor(msg, code) {\n super(msg);\n this.code = code;\n }\n}\n\nclass UnknownErrorException extends BaseException {\n constructor(msg, details) {\n super(msg);\n this.details = details;\n }\n}\n\nclass InvalidPDFException extends BaseException {}\n\nclass MissingPDFException extends BaseException {}\n\nclass UnexpectedResponseException extends BaseException {\n constructor(msg, status) {\n super(msg);\n this.status = status;\n }\n}\n\n/**\n * Error caused during parsing PDF data.\n */\nclass FormatError extends BaseException {}\n\n/**\n * Error used to indicate task cancellation.\n */\nclass AbortException extends BaseException {}\n\nconst NullCharactersRegExp = /\\x00/g;\n\nfunction removeNullCharacters(str) {\n if (typeof str !== \"string\") {\n warn(\"The argument for removeNullCharacters must be a string.\");\n return str;\n }\n return str.replace(NullCharactersRegExp, \"\");\n}\n\nfunction bytesToString(bytes) {\n assert(\n bytes !== null && typeof bytes === \"object\" && bytes.length !== undefined,\n \"Invalid argument for bytesToString\"\n );\n const length = bytes.length;\n const MAX_ARGUMENT_COUNT = 8192;\n if (length < MAX_ARGUMENT_COUNT) {\n return String.fromCharCode.apply(null, bytes);\n }\n const strBuf = [];\n for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {\n const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);\n const chunk = bytes.subarray(i, chunkEnd);\n strBuf.push(String.fromCharCode.apply(null, chunk));\n }\n return strBuf.join(\"\");\n}\n\nfunction stringToBytes(str) {\n assert(typeof str === \"string\", \"Invalid argument for stringToBytes\");\n const length = str.length;\n const bytes = new Uint8Array(length);\n for (let i = 0; i < length; ++i) {\n bytes[i] = str.charCodeAt(i) & 0xff;\n }\n return bytes;\n}\n\n/**\n * Gets length of the array (Array, Uint8Array, or string) in bytes.\n * @param {Array|Uint8Array|string} arr\n * @returns {number}\n */\nfunction arrayByteLength(arr) {\n if (arr.length !== undefined) {\n return arr.length;\n }\n assert(arr.byteLength !== undefined, \"arrayByteLength - invalid argument.\");\n return arr.byteLength;\n}\n\n/**\n * Combines array items (arrays) into single Uint8Array object.\n * @param {Array} arr - the array of the arrays (Array, Uint8Array, or string).\n * @returns {Uint8Array}\n */\nfunction arraysToBytes(arr) {\n const length = arr.length;\n // Shortcut: if first and only item is Uint8Array, return it.\n if (length === 1 && arr[0] instanceof Uint8Array) {\n return arr[0];\n }\n let resultLength = 0;\n for (let i = 0; i < length; i++) {\n resultLength += arrayByteLength(arr[i]);\n }\n let pos = 0;\n const data = new Uint8Array(resultLength);\n for (let i = 0; i < length; i++) {\n let item = arr[i];\n if (!(item instanceof Uint8Array)) {\n if (typeof item === \"string\") {\n item = stringToBytes(item);\n } else {\n item = new Uint8Array(item);\n }\n }\n const itemLength = item.byteLength;\n data.set(item, pos);\n pos += itemLength;\n }\n return data;\n}\n\nfunction string32(value) {\n return String.fromCharCode(\n (value >> 24) & 0xff,\n (value >> 16) & 0xff,\n (value >> 8) & 0xff,\n value & 0xff\n );\n}\n\n// Checks the endianness of the platform.\nfunction isLittleEndian() {\n const buffer8 = new Uint8Array(4);\n buffer8[0] = 1;\n const view32 = new Uint32Array(buffer8.buffer, 0, 1);\n return view32[0] === 1;\n}\nconst IsLittleEndianCached = {\n get value() {\n return shadow(this, \"value\", isLittleEndian());\n },\n};\n\n// Checks if it's possible to eval JS expressions.\nfunction isEvalSupported() {\n try {\n new Function(\"\"); // eslint-disable-line no-new, no-new-func\n return true;\n } catch (e) {\n return false;\n }\n}\nconst IsEvalSupportedCached = {\n get value() {\n return shadow(this, \"value\", isEvalSupported());\n },\n};\n\nconst rgbBuf = [\"rgb(\", 0, \",\", 0, \",\", 0, \")\"];\n\nclass Util {\n // makeCssRgb() can be called thousands of times. Using ´rgbBuf` avoids\n // creating many intermediate strings.\n static makeCssRgb(r, g, b) {\n rgbBuf[1] = r;\n rgbBuf[3] = g;\n rgbBuf[5] = b;\n return rgbBuf.join(\"\");\n }\n\n // Concatenates two transformation matrices together and returns the result.\n static transform(m1, m2) {\n return [\n m1[0] * m2[0] + m1[2] * m2[1],\n m1[1] * m2[0] + m1[3] * m2[1],\n m1[0] * m2[2] + m1[2] * m2[3],\n m1[1] * m2[2] + m1[3] * m2[3],\n m1[0] * m2[4] + m1[2] * m2[5] + m1[4],\n m1[1] * m2[4] + m1[3] * m2[5] + m1[5],\n ];\n }\n\n // For 2d affine transforms\n static applyTransform(p, m) {\n const xt = p[0] * m[0] + p[1] * m[2] + m[4];\n const yt = p[0] * m[1] + p[1] * m[3] + m[5];\n return [xt, yt];\n }\n\n static applyInverseTransform(p, m) {\n const d = m[0] * m[3] - m[1] * m[2];\n const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;\n const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;\n return [xt, yt];\n }\n\n // Applies the transform to the rectangle and finds the minimum axially\n // aligned bounding box.\n static getAxialAlignedBoundingBox(r, m) {\n const p1 = Util.applyTransform(r, m);\n const p2 = Util.applyTransform(r.slice(2, 4), m);\n const p3 = Util.applyTransform([r[0], r[3]], m);\n const p4 = Util.applyTransform([r[2], r[1]], m);\n return [\n Math.min(p1[0], p2[0], p3[0], p4[0]),\n Math.min(p1[1], p2[1], p3[1], p4[1]),\n Math.max(p1[0], p2[0], p3[0], p4[0]),\n Math.max(p1[1], p2[1], p3[1], p4[1]),\n ];\n }\n\n static inverseTransform(m) {\n const d = m[0] * m[3] - m[1] * m[2];\n return [\n m[3] / d,\n -m[1] / d,\n -m[2] / d,\n m[0] / d,\n (m[2] * m[5] - m[4] * m[3]) / d,\n (m[4] * m[1] - m[5] * m[0]) / d,\n ];\n }\n\n // Apply a generic 3d matrix M on a 3-vector v:\n // | a b c | | X |\n // | d e f | x | Y |\n // | g h i | | Z |\n // M is assumed to be serialized as [a,b,c,d,e,f,g,h,i],\n // with v as [X,Y,Z]\n static apply3dTransform(m, v) {\n return [\n m[0] * v[0] + m[1] * v[1] + m[2] * v[2],\n m[3] * v[0] + m[4] * v[1] + m[5] * v[2],\n m[6] * v[0] + m[7] * v[1] + m[8] * v[2],\n ];\n }\n\n // This calculation uses Singular Value Decomposition.\n // The SVD can be represented with formula A = USV. We are interested in the\n // matrix S here because it represents the scale values.\n static singularValueDecompose2dScale(m) {\n const transpose = [m[0], m[2], m[1], m[3]];\n\n // Multiply matrix m with its transpose.\n const a = m[0] * transpose[0] + m[1] * transpose[2];\n const b = m[0] * transpose[1] + m[1] * transpose[3];\n const c = m[2] * transpose[0] + m[3] * transpose[2];\n const d = m[2] * transpose[1] + m[3] * transpose[3];\n\n // Solve the second degree polynomial to get roots.\n const first = (a + d) / 2;\n const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;\n const sx = first + second || 1;\n const sy = first - second || 1;\n\n // Scale values are the square roots of the eigenvalues.\n return [Math.sqrt(sx), Math.sqrt(sy)];\n }\n\n // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)\n // For coordinate systems whose origin lies in the bottom-left, this\n // means normalization to (BL,TR) ordering. For systems with origin in the\n // top-left, this means (TL,BR) ordering.\n static normalizeRect(rect) {\n const r = rect.slice(0); // clone rect\n if (rect[0] > rect[2]) {\n r[0] = rect[2];\n r[2] = rect[0];\n }\n if (rect[1] > rect[3]) {\n r[1] = rect[3];\n r[3] = rect[1];\n }\n return r;\n }\n\n // Returns a rectangle [x1, y1, x2, y2] corresponding to the\n // intersection of rect1 and rect2. If no intersection, returns 'false'\n // The rectangle coordinates of rect1, rect2 should be [x1, y1, x2, y2]\n static intersect(rect1, rect2) {\n function compare(a, b) {\n return a - b;\n }\n\n // Order points along the axes\n const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);\n const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);\n const result = [];\n\n rect1 = Util.normalizeRect(rect1);\n rect2 = Util.normalizeRect(rect2);\n\n // X: first and second points belong to different rectangles?\n if (\n (orderedX[0] === rect1[0] && orderedX[1] === rect2[0]) ||\n (orderedX[0] === rect2[0] && orderedX[1] === rect1[0])\n ) {\n // Intersection must be between second and third points\n result[0] = orderedX[1];\n result[2] = orderedX[2];\n } else {\n return null;\n }\n\n // Y: first and second points belong to different rectangles?\n if (\n (orderedY[0] === rect1[1] && orderedY[1] === rect2[1]) ||\n (orderedY[0] === rect2[1] && orderedY[1] === rect1[1])\n ) {\n // Intersection must be between second and third points\n result[1] = orderedY[1];\n result[3] = orderedY[2];\n } else {\n return null;\n }\n\n return result;\n }\n}\n\n// prettier-ignore\nconst PDFStringTranslateTable = [\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014,\n 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C,\n 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160,\n 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC\n];\n\nfunction stringToPDFString(str) {\n const length = str.length,\n strBuf = [];\n if (str[0] === \"\\xFE\" && str[1] === \"\\xFF\") {\n // UTF16BE BOM\n for (let i = 2; i < length; i += 2) {\n strBuf.push(\n String.fromCharCode((str.charCodeAt(i) << 8) | str.charCodeAt(i + 1))\n );\n }\n } else if (str[0] === \"\\xFF\" && str[1] === \"\\xFE\") {\n // UTF16LE BOM\n for (let i = 2; i < length; i += 2) {\n strBuf.push(\n String.fromCharCode((str.charCodeAt(i + 1) << 8) | str.charCodeAt(i))\n );\n }\n } else {\n for (let i = 0; i < length; ++i) {\n const code = PDFStringTranslateTable[str.charCodeAt(i)];\n strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));\n }\n }\n return strBuf.join(\"\");\n}\n\nfunction stringToUTF8String(str) {\n return decodeURIComponent(escape(str));\n}\n\nfunction utf8StringToString(str) {\n return unescape(encodeURIComponent(str));\n}\n\nfunction isEmptyObj(obj) {\n for (const key in obj) {\n return false;\n }\n return true;\n}\n\nfunction isBool(v) {\n return typeof v === \"boolean\";\n}\n\nfunction isNum(v) {\n return typeof v === \"number\";\n}\n\nfunction isString(v) {\n return typeof v === \"string\";\n}\n\nfunction isArrayBuffer(v) {\n return typeof v === \"object\" && v !== null && v.byteLength !== undefined;\n}\n\nfunction isArrayEqual(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return false;\n }\n return arr1.every(function (element, index) {\n return element === arr2[index];\n });\n}\n\n/**\n * Promise Capability object.\n *\n * @typedef {Object} PromiseCapability\n * @property {Promise} promise - A Promise object.\n * @property {boolean} settled - If the Promise has been fulfilled/rejected.\n * @property {function} resolve - Fulfills the Promise.\n * @property {function} reject - Rejects the Promise.\n */\n\n/**\n * Creates a promise capability object.\n * @alias createPromiseCapability\n *\n * @returns {PromiseCapability}\n */\nfunction createPromiseCapability() {\n const capability = Object.create(null);\n let isSettled = false;\n\n Object.defineProperty(capability, \"settled\", {\n get() {\n return isSettled;\n },\n });\n capability.promise = new Promise(function (resolve, reject) {\n capability.resolve = function (data) {\n isSettled = true;\n resolve(data);\n };\n capability.reject = function (reason) {\n isSettled = true;\n reject(reason);\n };\n });\n return capability;\n}\n\nconst createObjectURL = (function createObjectURLClosure() {\n // Blob/createObjectURL is not available, falling back to data schema.\n const digits =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n\n // eslint-disable-next-line no-shadow\n return function createObjectURL(data, contentType, forceDataSchema = false) {\n if (!forceDataSchema && URL.createObjectURL) {\n const blob = new Blob([data], { type: contentType });\n return URL.createObjectURL(blob);\n }\n\n let buffer = `data:${contentType};base64,`;\n for (let i = 0, ii = data.length; i < ii; i += 3) {\n const b1 = data[i] & 0xff;\n const b2 = data[i + 1] & 0xff;\n const b3 = data[i + 2] & 0xff;\n const d1 = b1 >> 2,\n d2 = ((b1 & 3) << 4) | (b2 >> 4);\n const d3 = i + 1 < ii ? ((b2 & 0xf) << 2) | (b3 >> 6) : 64;\n const d4 = i + 2 < ii ? b3 & 0x3f : 64;\n buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];\n }\n return buffer;\n };\n})();\n\nexport {\n BaseException,\n FONT_IDENTITY_MATRIX,\n IDENTITY_MATRIX,\n OPS,\n VerbosityLevel,\n UNSUPPORTED_FEATURES,\n AnnotationBorderStyleType,\n AnnotationFieldFlag,\n AnnotationFlag,\n AnnotationMarkedState,\n AnnotationReplyType,\n AnnotationReviewState,\n AnnotationStateModelType,\n AnnotationType,\n FontType,\n ImageKind,\n CMapCompressionType,\n AbortException,\n InvalidPDFException,\n MissingPDFException,\n PasswordException,\n PasswordResponses,\n PermissionFlag,\n StreamType,\n TextRenderingMode,\n UnexpectedResponseException,\n UnknownErrorException,\n Util,\n FormatError,\n arrayByteLength,\n arraysToBytes,\n assert,\n bytesToString,\n createPromiseCapability,\n createObjectURL,\n getVerbosityLevel,\n info,\n isArrayBuffer,\n isArrayEqual,\n isBool,\n isEmptyObj,\n isNum,\n isString,\n isSameOrigin,\n createValidAbsoluteUrl,\n IsLittleEndianCached,\n IsEvalSupportedCached,\n removeNullCharacters,\n setVerbosityLevel,\n shadow,\n string32,\n stringToBytes,\n stringToPDFString,\n stringToUTF8String,\n utf8StringToString,\n warn,\n unreachable,\n};\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint no-var: error */\n\nimport { isNodeJS } from \"./is_node.js\";\n\n// Skip compatibility checks for modern builds and if we already ran the module.\nif (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"SKIP_BABEL\")) &&\n (typeof globalThis === \"undefined\" || !globalThis._pdfjsCompatibilityChecked)\n) {\n // Provides support for globalThis in legacy browsers.\n // Support: IE11/Edge, Opera\n if (typeof globalThis === \"undefined\" || globalThis.Math !== Math) {\n // eslint-disable-next-line no-global-assign\n globalThis = require(\"core-js/es/global-this\");\n }\n globalThis._pdfjsCompatibilityChecked = true;\n\n const hasDOM = typeof window === \"object\" && typeof document === \"object\";\n const userAgent =\n (typeof navigator !== \"undefined\" && navigator.userAgent) || \"\";\n const isIE = /Trident/.test(userAgent);\n\n // Support: Node.js\n (function checkNodeBtoa() {\n if (globalThis.btoa || !isNodeJS) {\n return;\n }\n globalThis.btoa = function (chars) {\n // eslint-disable-next-line no-undef\n return Buffer.from(chars, \"binary\").toString(\"base64\");\n };\n })();\n\n // Support: Node.js\n (function checkNodeAtob() {\n if (globalThis.atob || !isNodeJS) {\n return;\n }\n globalThis.atob = function (input) {\n // eslint-disable-next-line no-undef\n return Buffer.from(input, \"base64\").toString(\"binary\");\n };\n })();\n\n // Provides support for ChildNode.remove in legacy browsers.\n // Support: IE.\n (function checkChildNodeRemove() {\n if (!hasDOM) {\n return;\n }\n if (typeof Element.prototype.remove !== \"undefined\") {\n return;\n }\n Element.prototype.remove = function () {\n if (this.parentNode) {\n // eslint-disable-next-line mozilla/avoid-removeChild\n this.parentNode.removeChild(this);\n }\n };\n })();\n\n // Provides support for DOMTokenList.prototype.{add, remove}, with more than\n // one parameter, in legacy browsers.\n // Support: IE\n (function checkDOMTokenListAddRemove() {\n if (!hasDOM || isNodeJS) {\n return;\n }\n const div = document.createElement(\"div\");\n div.classList.add(\"testOne\", \"testTwo\");\n\n if (\n div.classList.contains(\"testOne\") === true &&\n div.classList.contains(\"testTwo\") === true\n ) {\n return;\n }\n const OriginalDOMTokenListAdd = DOMTokenList.prototype.add;\n const OriginalDOMTokenListRemove = DOMTokenList.prototype.remove;\n\n DOMTokenList.prototype.add = function (...tokens) {\n for (const token of tokens) {\n OriginalDOMTokenListAdd.call(this, token);\n }\n };\n DOMTokenList.prototype.remove = function (...tokens) {\n for (const token of tokens) {\n OriginalDOMTokenListRemove.call(this, token);\n }\n };\n })();\n\n // Provides support for DOMTokenList.prototype.toggle, with the optional\n // \"force\" parameter, in legacy browsers.\n // Support: IE\n (function checkDOMTokenListToggle() {\n if (!hasDOM || isNodeJS) {\n return;\n }\n const div = document.createElement(\"div\");\n if (div.classList.toggle(\"test\", 0) === false) {\n return;\n }\n\n DOMTokenList.prototype.toggle = function (token) {\n const force =\n arguments.length > 1 ? !!arguments[1] : !this.contains(token);\n return this[force ? \"add\" : \"remove\"](token), force;\n };\n })();\n\n // Provides support for window.history.{pushState, replaceState}, with the\n // `url` parameter set to `undefined`, without breaking the document URL.\n // Support: IE\n (function checkWindowHistoryPushStateReplaceState() {\n if (!hasDOM || !isIE) {\n return;\n }\n const OriginalPushState = window.history.pushState;\n const OriginalReplaceState = window.history.replaceState;\n\n window.history.pushState = function (state, title, url) {\n const args = url === undefined ? [state, title] : [state, title, url];\n OriginalPushState.apply(this, args);\n };\n window.history.replaceState = function (state, title, url) {\n const args = url === undefined ? [state, title] : [state, title, url];\n OriginalReplaceState.apply(this, args);\n };\n })();\n\n // Provides support for String.prototype.startsWith in legacy browsers.\n // Support: IE, Chrome<41\n (function checkStringStartsWith() {\n if (String.prototype.startsWith) {\n return;\n }\n require(\"core-js/es/string/starts-with.js\");\n })();\n\n // Provides support for String.prototype.endsWith in legacy browsers.\n // Support: IE, Chrome<41\n (function checkStringEndsWith() {\n if (String.prototype.endsWith) {\n return;\n }\n require(\"core-js/es/string/ends-with.js\");\n })();\n\n // Provides support for String.prototype.includes in legacy browsers.\n // Support: IE, Chrome<41\n (function checkStringIncludes() {\n if (String.prototype.includes) {\n return;\n }\n require(\"core-js/es/string/includes.js\");\n })();\n\n // Provides support for Array.prototype.includes in legacy browsers.\n // Support: IE, Chrome<47\n (function checkArrayIncludes() {\n if (Array.prototype.includes) {\n return;\n }\n require(\"core-js/es/array/includes.js\");\n })();\n\n // Provides support for Array.from in legacy browsers.\n // Support: IE\n (function checkArrayFrom() {\n if (Array.from) {\n return;\n }\n require(\"core-js/es/array/from.js\");\n })();\n\n // Provides support for Object.assign in legacy browsers.\n // Support: IE\n (function checkObjectAssign() {\n if (Object.assign) {\n return;\n }\n require(\"core-js/es/object/assign.js\");\n })();\n\n // Provides support for Math.log2 in legacy browsers.\n // Support: IE, Chrome<38\n (function checkMathLog2() {\n if (Math.log2) {\n return;\n }\n Math.log2 = require(\"core-js/es/math/log2.js\");\n })();\n\n // Provides support for Number.isNaN in legacy browsers.\n // Support: IE.\n (function checkNumberIsNaN() {\n if (Number.isNaN) {\n return;\n }\n Number.isNaN = require(\"core-js/es/number/is-nan.js\");\n })();\n\n // Provides support for Number.isInteger in legacy browsers.\n // Support: IE, Chrome<34\n (function checkNumberIsInteger() {\n if (Number.isInteger) {\n return;\n }\n Number.isInteger = require(\"core-js/es/number/is-integer.js\");\n })();\n\n // Provides support for TypedArray.prototype.slice in legacy browsers.\n // Support: IE\n (function checkTypedArraySlice() {\n if (Uint8Array.prototype.slice) {\n return;\n }\n require(\"core-js/es/typed-array/slice\");\n })();\n\n // Support: IE, Safari<11, Chrome<63\n (function checkPromise() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"IMAGE_DECODERS\")) {\n // The current image decoders are synchronous, hence `Promise` shouldn't\n // need to be polyfilled for the IMAGE_DECODERS build target.\n return;\n }\n if (globalThis.Promise && globalThis.Promise.allSettled) {\n return;\n }\n globalThis.Promise = require(\"core-js/es/promise/index.js\");\n })();\n\n // Support: IE\n (function checkURL() {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n // Prevent \"require is not a function\" errors in development mode,\n // since the `URL` constructor should be available in modern browers.\n return;\n } else if (!PDFJSDev.test(\"GENERIC\")) {\n // The `URL` constructor is assumed to be available in the extension\n // builds.\n return;\n } else if (PDFJSDev.test(\"IMAGE_DECODERS\")) {\n // The current image decoders don't use the `URL` constructor, so it\n // doesn't need to be polyfilled for the IMAGE_DECODERS build target.\n return;\n }\n globalThis.URL = require(\"core-js/web/url.js\");\n })();\n\n // Support: IE, Node.js\n (function checkReadableStream() {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"IMAGE_DECODERS\")) {\n // The current image decoders are synchronous, hence `ReadableStream`\n // shouldn't need to be polyfilled for the IMAGE_DECODERS build target.\n return;\n }\n let isReadableStreamSupported = false;\n\n if (typeof ReadableStream !== \"undefined\") {\n // MS Edge may say it has ReadableStream but they are not up to spec yet.\n try {\n // eslint-disable-next-line no-new\n new ReadableStream({\n start(controller) {\n controller.close();\n },\n });\n isReadableStreamSupported = true;\n } catch (e) {\n // The ReadableStream constructor cannot be used.\n }\n }\n if (isReadableStreamSupported) {\n return;\n }\n globalThis.ReadableStream = require(\"web-streams-polyfill/dist/ponyfill.js\").ReadableStream;\n })();\n\n // We want to support Map iteration, but it doesn't seem possible to easily\n // test for that specifically; hence using a similarly unsupported property.\n // Support: IE11\n (function checkMapEntries() {\n if (globalThis.Map && globalThis.Map.prototype.entries) {\n return;\n }\n globalThis.Map = require(\"core-js/es/map/index.js\");\n })();\n\n // We want to support Set iteration, but it doesn't seem possible to easily\n // test for that specifically; hence using a similarly unsupported property.\n // Support: IE11\n (function checkSetEntries() {\n if (globalThis.Set && globalThis.Set.prototype.entries) {\n return;\n }\n globalThis.Set = require(\"core-js/es/set/index.js\");\n })();\n\n // Support: IE<11, Safari<8, Chrome<36\n (function checkWeakMap() {\n if (globalThis.WeakMap) {\n return;\n }\n globalThis.WeakMap = require(\"core-js/es/weak-map/index.js\");\n })();\n\n // Support: IE11\n (function checkWeakSet() {\n if (globalThis.WeakSet) {\n return;\n }\n globalThis.WeakSet = require(\"core-js/es/weak-set/index.js\");\n })();\n\n // Provides support for String.codePointAt in legacy browsers.\n // Support: IE11.\n (function checkStringCodePointAt() {\n if (String.prototype.codePointAt) {\n return;\n }\n require(\"core-js/es/string/code-point-at.js\");\n })();\n\n // Provides support for String.fromCodePoint in legacy browsers.\n // Support: IE11.\n (function checkStringFromCodePoint() {\n if (String.fromCodePoint) {\n return;\n }\n String.fromCodePoint = require(\"core-js/es/string/from-code-point.js\");\n })();\n\n // Support: IE\n (function checkSymbol() {\n if (globalThis.Symbol) {\n return;\n }\n require(\"core-js/es/symbol/index.js\");\n })();\n\n // Provides support for String.prototype.padStart in legacy browsers.\n // Support: IE, Chrome<57\n (function checkStringPadStart() {\n if (String.prototype.padStart) {\n return;\n }\n require(\"core-js/es/string/pad-start.js\");\n })();\n\n // Provides support for String.prototype.padEnd in legacy browsers.\n // Support: IE, Chrome<57\n (function checkStringPadEnd() {\n if (String.prototype.padEnd) {\n return;\n }\n require(\"core-js/es/string/pad-end.js\");\n })();\n\n // Provides support for Object.values in legacy browsers.\n // Support: IE, Chrome<54\n (function checkObjectValues() {\n if (Object.values) {\n return;\n }\n Object.values = require(\"core-js/es/object/values.js\");\n })();\n}\n","/* Copyright 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* globals process */\n\n// NW.js / Electron is a browser context, but copies some Node.js objects; see\n// http://docs.nwjs.io/en/latest/For%20Users/Advanced/JavaScript%20Contexts%20in%20NW.js/#access-nodejs-and-nwjs-api-in-browser-context\n// https://electronjs.org/docs/api/process#processversionselectron\nconst isNodeJS =\n typeof process === \"object\" &&\n process + \"\" === \"[object process]\" &&\n !process.versions.nw &&\n !process.versions.electron;\n\nexport { isNodeJS };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/* eslint no-var: error */\n\n/**\n * @module pdfjsLib\n */\n\nimport {\n AbortException,\n assert,\n createPromiseCapability,\n getVerbosityLevel,\n info,\n InvalidPDFException,\n isArrayBuffer,\n isSameOrigin,\n MissingPDFException,\n PasswordException,\n setVerbosityLevel,\n shadow,\n stringToBytes,\n UnexpectedResponseException,\n UnknownErrorException,\n unreachable,\n warn,\n} from \"../shared/util.js\";\nimport {\n deprecated,\n DOMCanvasFactory,\n DOMCMapReaderFactory,\n loadScript,\n PageViewport,\n RenderingCancelledException,\n StatTimer,\n} from \"./display_utils.js\";\nimport { FontFaceObject, FontLoader } from \"./font_loader.js\";\nimport { apiCompatibilityParams } from \"./api_compatibility.js\";\nimport { CanvasGraphics } from \"./canvas.js\";\nimport { GlobalWorkerOptions } from \"./worker_options.js\";\nimport { isNodeJS } from \"../shared/is_node.js\";\nimport { MessageHandler } from \"../shared/message_handler.js\";\nimport { Metadata } from \"./metadata.js\";\nimport { PDFDataTransportStream } from \"./transport_stream.js\";\nimport { WebGLContext } from \"./webgl.js\";\n\nconst DEFAULT_RANGE_CHUNK_SIZE = 65536; // 2^16 = 65536\nconst RENDERING_CANCELLED_TIMEOUT = 100; // ms\n\n/**\n * @typedef {function} IPDFStreamFactory\n * @param {DocumentInitParameters} params - The document initialization\n * parameters. The \"url\" key is always present.\n * @returns {Promise} A promise, which is resolved with an instance of\n * {IPDFStream}.\n * @ignore\n */\n\n/**\n * @type IPDFStreamFactory\n * @private\n */\nlet createPDFNetworkStream;\n\n/**\n * Sets the function that instantiates an {IPDFStream} as an alternative PDF\n * data transport.\n * @param {IPDFStreamFactory} pdfNetworkStreamFactory - The factory function\n * that takes document initialization parameters (including a \"url\") and\n * returns a promise which is resolved with an instance of {IPDFStream}.\n * @ignore\n */\nfunction setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {\n createPDFNetworkStream = pdfNetworkStreamFactory;\n}\n\n/**\n * Document initialization / loading parameters object.\n *\n * @typedef {Object} DocumentInitParameters\n * @property {string} [url] - The URL of the PDF.\n * @property {TypedArray|Array|string} [data] - Binary PDF data. Use typed\n * arrays (Uint8Array) to improve the memory usage. If PDF data is\n * BASE64-encoded, use atob() to convert it to a binary string first.\n * @property {Object} [httpHeaders] - Basic authentication headers.\n * @property {boolean} [withCredentials] - Indicates whether or not\n * cross-site Access-Control requests should be made using credentials such\n * as cookies or authorization headers. The default is false.\n * @property {string} [password] - For decrypting password-protected PDFs.\n * @property {TypedArray} [initialData] - A typed array with the first portion\n * or all of the pdf data. Used by the extension since some data is already\n * loaded before the switch to range requests.\n * @property {number} [length] - The PDF file length. It's used for\n * progress reports and range requests operations.\n * @property {PDFDataRangeTransport} [range]\n * @property {number} [rangeChunkSize] - Specify maximum number of bytes\n * fetched per range request. The default value is 2^16 = 65536.\n * @property {PDFWorker} [worker] - The worker that will be used for\n * the loading and parsing of the PDF data.\n * @property {number} [verbosity] - Controls the logging level; the\n * constants from {VerbosityLevel} should be used.\n * @property {string} [docBaseUrl] - The base URL of the document,\n * used when attempting to recover valid absolute URLs for annotations, and\n * outline items, that (incorrectly) only specify relative URLs.\n * @property {string} [cMapUrl] - The URL where the predefined\n * Adobe CMaps are located. Include trailing slash.\n * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are\n * binary packed.\n * @property {Object} [CMapReaderFactory] - The factory that will be\n * used when reading built-in CMap files. Providing a custom factory is useful\n * for environments without `XMLHttpRequest` support, such as e.g. Node.js.\n * The default value is {DOMCMapReaderFactory}.\n * @property {boolean} [stopAtErrors] - Reject certain promises, e.g.\n * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated\n * PDF data cannot be successfully parsed, instead of attempting to recover\n * whatever possible of the data. The default value is `false`.\n * @property {number} [maxImageSize] - The maximum allowed image size\n * in total pixels, i.e. width * height. Images above this value will not be\n * rendered. Use -1 for no limit, which is also the default value.\n * @property {boolean} [isEvalSupported] - Determines if we can eval\n * strings as JS. Primarily used to improve performance of font rendering,\n * and when parsing PDF functions. The default value is `true`.\n * @property {boolean} [disableFontFace] - By default fonts are\n * converted to OpenType fonts and loaded via font face rules. If disabled,\n * fonts will be rendered using a built-in font renderer that constructs the\n * glyphs with primitive path commands. The default value is `false`.\n * @property {boolean} [fontExtraProperties] - Include additional properties,\n * which are unused during rendering of PDF documents, when exporting the\n * parsed font data from the worker-thread. This may be useful for debugging\n * purposes (and backwards compatibility), but note that it will lead to\n * increased memory usage. The default value is `false`.\n * @property {boolean} [disableRange] - Disable range request loading\n * of PDF files. When enabled, and if the server supports partial content\n * requests, then the PDF will be fetched in chunks.\n * The default value is `false`.\n * @property {boolean} [disableStream] - Disable streaming of PDF file\n * data. By default PDF.js attempts to load PDFs in chunks.\n * The default value is `false`.\n * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF\n * file data. When range requests are enabled PDF.js will automatically keep\n * fetching more data even if it isn't needed to display the current page.\n * The default value is `false`.\n * NOTE: It is also necessary to disable streaming, see above,\n * in order for disabling of pre-fetching to work correctly.\n * @property {boolean} [pdfBug] - Enables special hooks for debugging\n * PDF.js (see `web/debugger.js`). The default value is `false`.\n */\n\n/**\n * @typedef {Object} PDFDocumentStats\n * @property {Object} streamTypes - Used stream types in the document (an item\n * is set to true if specific stream ID was used in the document).\n * @property {Object} fontTypes - Used font types in the document (an item\n * is set to true if specific font ID was used in the document).\n */\n\n/**\n * This is the main entry point for loading a PDF and interacting with it.\n * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR)\n * is used, which means it must follow the same origin rules that any XHR does\n * e.g. No cross domain requests without CORS.\n *\n * @param {string|TypedArray|DocumentInitParameters|PDFDataRangeTransport} src\n * Can be a url to where a PDF is located, a typed array (Uint8Array)\n * already populated with data or parameter object.\n * @returns {PDFDocumentLoadingTask}\n */\nfunction getDocument(src) {\n const task = new PDFDocumentLoadingTask();\n\n let source;\n if (typeof src === \"string\") {\n source = { url: src };\n } else if (isArrayBuffer(src)) {\n source = { data: src };\n } else if (src instanceof PDFDataRangeTransport) {\n source = { range: src };\n } else {\n if (typeof src !== \"object\") {\n throw new Error(\n \"Invalid parameter in getDocument, \" +\n \"need either Uint8Array, string or a parameter object\"\n );\n }\n if (!src.url && !src.data && !src.range) {\n throw new Error(\n \"Invalid parameter object: need either .data, .range or .url\"\n );\n }\n source = src;\n }\n const params = Object.create(null);\n let rangeTransport = null,\n worker = null;\n\n for (const key in source) {\n if (key === \"url\" && typeof window !== \"undefined\") {\n // The full path is required in the 'url' field.\n params[key] = new URL(source[key], window.location).href;\n continue;\n } else if (key === \"range\") {\n rangeTransport = source[key];\n continue;\n } else if (key === \"worker\") {\n worker = source[key];\n continue;\n } else if (key === \"data\" && !(source[key] instanceof Uint8Array)) {\n // Converting string or array-like data to Uint8Array.\n const pdfBytes = source[key];\n if (typeof pdfBytes === \"string\") {\n params[key] = stringToBytes(pdfBytes);\n } else if (\n typeof pdfBytes === \"object\" &&\n pdfBytes !== null &&\n !isNaN(pdfBytes.length)\n ) {\n params[key] = new Uint8Array(pdfBytes);\n } else if (isArrayBuffer(pdfBytes)) {\n params[key] = new Uint8Array(pdfBytes);\n } else {\n throw new Error(\n \"Invalid PDF binary data: either typed array, \" +\n \"string or array-like object is expected in the \" +\n \"data property.\"\n );\n }\n continue;\n }\n params[key] = source[key];\n }\n\n params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE;\n params.CMapReaderFactory = params.CMapReaderFactory || DOMCMapReaderFactory;\n params.ignoreErrors = params.stopAtErrors !== true;\n params.fontExtraProperties = params.fontExtraProperties === true;\n params.pdfBug = params.pdfBug === true;\n\n if (!Number.isInteger(params.maxImageSize)) {\n params.maxImageSize = -1;\n }\n if (typeof params.isEvalSupported !== \"boolean\") {\n params.isEvalSupported = true;\n }\n if (typeof params.disableFontFace !== \"boolean\") {\n params.disableFontFace = apiCompatibilityParams.disableFontFace || false;\n }\n\n if (typeof params.disableRange !== \"boolean\") {\n params.disableRange = false;\n }\n if (typeof params.disableStream !== \"boolean\") {\n params.disableStream = false;\n }\n if (typeof params.disableAutoFetch !== \"boolean\") {\n params.disableAutoFetch = false;\n }\n\n // Set the main-thread verbosity level.\n setVerbosityLevel(params.verbosity);\n\n if (!worker) {\n const workerParams = {\n verbosity: params.verbosity,\n port: GlobalWorkerOptions.workerPort,\n };\n // Worker was not provided -- creating and owning our own. If message port\n // is specified in global worker options, using it.\n worker = workerParams.port\n ? PDFWorker.fromPort(workerParams)\n : new PDFWorker(workerParams);\n task._worker = worker;\n }\n const docId = task.docId;\n worker.promise\n .then(function () {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n const workerIdPromise = _fetchDocument(\n worker,\n params,\n rangeTransport,\n docId\n );\n const networkStreamPromise = new Promise(function (resolve) {\n let networkStream;\n if (rangeTransport) {\n networkStream = new PDFDataTransportStream(\n {\n length: params.length,\n initialData: params.initialData,\n progressiveDone: params.progressiveDone,\n disableRange: params.disableRange,\n disableStream: params.disableStream,\n },\n rangeTransport\n );\n } else if (!params.data) {\n networkStream = createPDFNetworkStream({\n url: params.url,\n length: params.length,\n httpHeaders: params.httpHeaders,\n withCredentials: params.withCredentials,\n rangeChunkSize: params.rangeChunkSize,\n disableRange: params.disableRange,\n disableStream: params.disableStream,\n });\n }\n resolve(networkStream);\n });\n\n return Promise.all([workerIdPromise, networkStreamPromise]).then(\n function ([workerId, networkStream]) {\n if (task.destroyed) {\n throw new Error(\"Loading aborted\");\n }\n\n const messageHandler = new MessageHandler(\n docId,\n workerId,\n worker.port\n );\n messageHandler.postMessageTransfers = worker.postMessageTransfers;\n const transport = new WorkerTransport(\n messageHandler,\n task,\n networkStream,\n params\n );\n task._transport = transport;\n messageHandler.send(\"Ready\", null);\n }\n );\n })\n .catch(task._capability.reject);\n\n return task;\n}\n\n/**\n * Starts fetching of specified PDF document/data.\n * @param {PDFWorker} worker\n * @param {Object} source\n * @param {PDFDataRangeTransport} pdfDataRangeTransport\n * @param {string} docId Unique document id, used as MessageHandler id.\n * @returns {Promise} The promise, which is resolved when worker id of\n * MessageHandler is known.\n * @private\n */\nfunction _fetchDocument(worker, source, pdfDataRangeTransport, docId) {\n if (worker.destroyed) {\n return Promise.reject(new Error(\"Worker was destroyed\"));\n }\n\n if (pdfDataRangeTransport) {\n source.length = pdfDataRangeTransport.length;\n source.initialData = pdfDataRangeTransport.initialData;\n source.progressiveDone = pdfDataRangeTransport.progressiveDone;\n }\n return worker.messageHandler\n .sendWithPromise(\"GetDocRequest\", {\n docId,\n apiVersion:\n typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"TESTING\")\n ? PDFJSDev.eval(\"BUNDLE_VERSION\")\n : null,\n // Only send the required properties, and *not* the entire object.\n source: {\n data: source.data,\n url: source.url,\n password: source.password,\n disableAutoFetch: source.disableAutoFetch,\n rangeChunkSize: source.rangeChunkSize,\n length: source.length,\n },\n maxImageSize: source.maxImageSize,\n disableFontFace: source.disableFontFace,\n postMessageTransfers: worker.postMessageTransfers,\n docBaseUrl: source.docBaseUrl,\n ignoreErrors: source.ignoreErrors,\n isEvalSupported: source.isEvalSupported,\n fontExtraProperties: source.fontExtraProperties,\n })\n .then(function (workerId) {\n if (worker.destroyed) {\n throw new Error(\"Worker was destroyed\");\n }\n return workerId;\n });\n}\n\nconst PDFDocumentLoadingTask = (function PDFDocumentLoadingTaskClosure() {\n let nextDocumentId = 0;\n\n /**\n * The loading task controls the operations required to load a PDF document\n * (such as network requests) and provides a way to listen for completion,\n * after which individual pages can be rendered.\n */\n // eslint-disable-next-line no-shadow\n class PDFDocumentLoadingTask {\n constructor() {\n this._capability = createPromiseCapability();\n this._transport = null;\n this._worker = null;\n\n /**\n * Unique document loading task id -- used in MessageHandlers.\n * @type {string}\n */\n this.docId = \"d\" + nextDocumentId++;\n\n /**\n * Shows if loading task is destroyed.\n * @type {boolean}\n */\n this.destroyed = false;\n\n /**\n * Callback to request a password if wrong or no password was provided.\n * The callback receives two parameters: function that needs to be called\n * with new password and reason (see {PasswordResponses}).\n */\n this.onPassword = null;\n\n /**\n * Callback to be able to monitor the loading progress of the PDF file\n * (necessary to implement e.g. a loading bar). The callback receives\n * an {Object} with the properties: {number} loaded and {number} total.\n */\n this.onProgress = null;\n\n /**\n * Callback to when unsupported feature is used. The callback receives\n * an {UNSUPPORTED_FEATURES} argument.\n */\n this.onUnsupportedFeature = null;\n }\n\n /**\n * Promise for document loading task completion.\n * @type {Promise}\n */\n get promise() {\n return this._capability.promise;\n }\n\n /**\n * Aborts all network requests and destroys worker.\n * @returns {Promise} A promise that is resolved after destruction activity\n * is completed.\n */\n destroy() {\n this.destroyed = true;\n\n const transportDestroyed = !this._transport\n ? Promise.resolve()\n : this._transport.destroy();\n return transportDestroyed.then(() => {\n this._transport = null;\n if (this._worker) {\n this._worker.destroy();\n this._worker = null;\n }\n });\n }\n }\n return PDFDocumentLoadingTask;\n})();\n\n/**\n * Abstract class to support range requests file loading.\n * @param {number} length\n * @param {Uint8Array} initialData\n * @param {boolean} progressiveDone\n */\nclass PDFDataRangeTransport {\n constructor(length, initialData, progressiveDone = false) {\n this.length = length;\n this.initialData = initialData;\n this.progressiveDone = progressiveDone;\n\n this._rangeListeners = [];\n this._progressListeners = [];\n this._progressiveReadListeners = [];\n this._progressiveDoneListeners = [];\n this._readyCapability = createPromiseCapability();\n }\n\n addRangeListener(listener) {\n this._rangeListeners.push(listener);\n }\n\n addProgressListener(listener) {\n this._progressListeners.push(listener);\n }\n\n addProgressiveReadListener(listener) {\n this._progressiveReadListeners.push(listener);\n }\n\n addProgressiveDoneListener(listener) {\n this._progressiveDoneListeners.push(listener);\n }\n\n onDataRange(begin, chunk) {\n for (const listener of this._rangeListeners) {\n listener(begin, chunk);\n }\n }\n\n onDataProgress(loaded, total) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressListeners) {\n listener(loaded, total);\n }\n });\n }\n\n onDataProgressiveRead(chunk) {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveReadListeners) {\n listener(chunk);\n }\n });\n }\n\n onDataProgressiveDone() {\n this._readyCapability.promise.then(() => {\n for (const listener of this._progressiveDoneListeners) {\n listener();\n }\n });\n }\n\n transportReady() {\n this._readyCapability.resolve();\n }\n\n requestDataRange(begin, end) {\n unreachable(\"Abstract method PDFDataRangeTransport.requestDataRange\");\n }\n\n abort() {}\n}\n\n/**\n * Proxy to a PDFDocument in the worker thread. Also, contains commonly used\n * properties that can be read synchronously.\n */\nclass PDFDocumentProxy {\n constructor(pdfInfo, transport) {\n this._pdfInfo = pdfInfo;\n this._transport = transport;\n }\n\n /**\n * @type {number} Total number of pages the PDF contains.\n */\n get numPages() {\n return this._pdfInfo.numPages;\n }\n\n /**\n * @type {string} A (not guaranteed to be) unique ID to identify a PDF.\n */\n get fingerprint() {\n return this._pdfInfo.fingerprint;\n }\n\n /**\n * @param {number} pageNumber - The page number to get. The first page is 1.\n * @returns {Promise} A promise that is resolved with a {@link PDFPageProxy}\n * object.\n */\n getPage(pageNumber) {\n return this._transport.getPage(pageNumber);\n }\n\n /**\n * @param {{num: number, gen: number}} ref - The page reference. Must have\n * the `num` and `gen` properties.\n * @returns {Promise} A promise that is resolved with the page index (starting\n * from zero) that is associated with the reference.\n */\n getPageIndex(ref) {\n return this._transport.getPageIndex(ref);\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a lookup table for\n * mapping named destinations to reference numbers.\n *\n * This can be slow for large documents. Use `getDestination` instead.\n */\n getDestinations() {\n return this._transport.getDestinations();\n }\n\n /**\n * @param {string} id - The named destination to get.\n * @returns {Promise} A promise that is resolved with all information\n * of the given named destination.\n */\n getDestination(id) {\n return this._transport.getDestination(id);\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Array} containing\n * the page labels that correspond to the page indexes, or `null` when\n * no page labels are present in the PDF file.\n */\n getPageLabels() {\n return this._transport.getPageLabels();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a {string} containing\n * the page layout name.\n */\n getPageLayout() {\n return this._transport.getPageLayout();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a {string} containing\n * the page mode name.\n */\n getPageMode() {\n return this._transport.getPageMode();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the viewer preferences, or `null` when no viewer preferences are present\n * in the PDF file.\n */\n getViewerPreferences() {\n return this._transport.getViewerPreferences();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Object} containing\n * the currently supported actions, or `null` when no OpenAction exists.\n */\n getOpenAction() {\n return this._transport.getOpenAction();\n }\n\n getOpenActionDestination() {\n deprecated(\"getOpenActionDestination, use getOpenAction instead.\");\n return this.getOpenAction().then(function (openAction) {\n return openAction && openAction.dest ? openAction.dest : null;\n });\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a lookup table for\n * mapping named attachments to their content.\n */\n getAttachments() {\n return this._transport.getAttachments();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Array} of all the\n * JavaScript strings in the name tree, or `null` if no JavaScript exists.\n */\n getJavaScript() {\n return this._transport.getJavaScript();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Array} that is a\n * tree outline (if it has one) of the PDF. The tree is in the format of:\n * [\n * {\n * title: string,\n * bold: boolean,\n * italic: boolean,\n * color: rgb Uint8ClampedArray,\n * count: integer or undefined,\n * dest: dest obj,\n * url: string,\n * items: array of more items like this\n * },\n * ...\n * ]\n */\n getOutline() {\n return this._transport.getOutline();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Array} that contains\n * the permission flags for the PDF document, or `null` when\n * no permissions are present in the PDF file.\n */\n getPermissions() {\n return this._transport.getPermissions();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with an {Object} that has\n * `info` and `metadata` properties. `info` is an {Object} filled with\n * anything available in the information dictionary and similarly\n * `metadata` is a {Metadata} object with information from the metadata\n * section of the PDF.\n */\n getMetadata() {\n return this._transport.getMetadata();\n }\n\n /**\n * @returns {Promise} A promise that is resolved with a {TypedArray} that has\n * the raw data from the PDF.\n */\n getData() {\n return this._transport.getData();\n }\n\n /**\n * @returns {Promise} A promise that is resolved when the document's data\n * is loaded. It is resolved with an {Object} that contains the `length`\n * property that indicates size of the PDF data in bytes.\n */\n getDownloadInfo() {\n return this._transport.downloadInfoCapability.promise;\n }\n\n /**\n * @returns {Promise} A promise this is resolved with current statistics about\n * document structures (see {@link PDFDocumentStats}).\n */\n getStats() {\n return this._transport.getStats();\n }\n\n /**\n * Cleans up resources allocated by the document, on both the main- and\n * worker-threads.\n *\n * NOTE: Do not, under any circumstances, call this method when rendering is\n * currently ongoing since that may lead to rendering errors.\n *\n * @returns {Promise} A promise that is resolved when clean-up has finished.\n */\n cleanup() {\n return this._transport.startCleanup();\n }\n\n /**\n * Destroys the current document instance and terminates the worker.\n */\n destroy() {\n return this.loadingTask.destroy();\n }\n\n /**\n * @type {Object} A subset of the current {DocumentInitParameters}, which are\n * either needed in the viewer and/or whose default values may be affected\n * by the `apiCompatibilityParams`.\n */\n get loadingParams() {\n return this._transport.loadingParams;\n }\n\n /**\n * @type {PDFDocumentLoadingTask} The loadingTask for the current document.\n */\n get loadingTask() {\n return this._transport.loadingTask;\n }\n}\n\n/**\n * Page getViewport parameters.\n *\n * @typedef {Object} GetViewportParameters\n * @property {number} scale - The desired scale of the viewport.\n * @property {number} [rotation] - The desired rotation, in degrees, of\n * the viewport. If omitted it defaults to the page rotation.\n * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset.\n * The default value is `0`.\n * @property {number} [offsetY] - The vertical, i.e. y-axis, offset.\n * The default value is `0`.\n * @property {boolean} [dontFlip] - If true, the y-axis will not be\n * flipped. The default value is `false`.\n */\n\n/**\n * Page getTextContent parameters.\n *\n * @typedef {Object} getTextContentParameters\n * @property {boolean} normalizeWhitespace - replaces all occurrences of\n * whitespace with standard spaces (0x20). The default value is `false`.\n * @property {boolean} disableCombineTextItems - do not attempt to combine\n * same line {@link TextItem}'s. The default value is `false`.\n */\n\n/**\n * Page text content.\n *\n * @typedef {Object} TextContent\n * @property {array} items - array of {@link TextItem}\n * @property {Object} styles - {@link TextStyle} objects, indexed by font name.\n */\n\n/**\n * Page text content part.\n *\n * @typedef {Object} TextItem\n * @property {string} str - text content.\n * @property {string} dir - text direction: 'ttb', 'ltr' or 'rtl'.\n * @property {array} transform - transformation matrix.\n * @property {number} width - width in device space.\n * @property {number} height - height in device space.\n * @property {string} fontName - font name used by pdf.js for converted font.\n */\n\n/**\n * Text style.\n *\n * @typedef {Object} TextStyle\n * @property {number} ascent - font ascent.\n * @property {number} descent - font descent.\n * @property {boolean} vertical - text is in vertical mode.\n * @property {string} fontFamily - possible font family\n */\n\n/**\n * Page annotation parameters.\n *\n * @typedef {Object} GetAnnotationsParameters\n * @property {string} intent - Determines the annotations that will be fetched,\n * can be either 'display' (viewable annotations) or 'print'\n * (printable annotations).\n * If the parameter is omitted, all annotations are fetched.\n */\n\n/**\n * Page render parameters.\n *\n * @typedef {Object} RenderParameters\n * @property {Object} canvasContext - A 2D context of a DOM Canvas object.\n * @property {PageViewport} viewport - Rendering viewport obtained by\n * calling the `PDFPageProxy.getViewport` method.\n * @property {string} [intent] - Rendering intent, can be 'display' or 'print'\n * (default value is 'display').\n * @property {boolean} [enableWebGL] - Enables WebGL accelerated rendering\n * for some operations. The default value is `false`.\n * @property {boolean} [renderInteractiveForms] - Whether or not\n * interactive form elements are rendered in the display\n * layer. If so, we do not render them on canvas as well.\n * @property {Array} [transform] - Additional transform, applied\n * just before viewport transform.\n * @property {Object} [imageLayer] - An object that has beginLayout,\n * endLayout and appendImage functions.\n * @property {Object} [canvasFactory] - The factory that will be used\n * when creating canvases. The default value is\n * {DOMCanvasFactory}.\n * @property {Object} [background] - Background to use for the canvas.\n * Can use any valid canvas.fillStyle: A DOMString parsed as\n * CSS value, a CanvasGradient object (a linear or\n * radial gradient) or a CanvasPattern object (a repetitive\n * image). The default value is 'rgb(255,255,255)'.\n */\n\n/**\n * PDF page operator list.\n *\n * @typedef {Object} PDFOperatorList\n * @property {Array} fnArray - Array containing the operator functions.\n * @property {Array} argsArray - Array containing the arguments of the\n * functions.\n */\n\n/**\n * Proxy to a PDFPage in the worker thread.\n * @alias PDFPageProxy\n */\nclass PDFPageProxy {\n constructor(pageIndex, pageInfo, transport, pdfBug = false) {\n this._pageIndex = pageIndex;\n this._pageInfo = pageInfo;\n this._transport = transport;\n this._stats = pdfBug ? new StatTimer() : null;\n this._pdfBug = pdfBug;\n this.commonObjs = transport.commonObjs;\n this.objs = new PDFObjects();\n\n this.cleanupAfterRender = false;\n this.pendingCleanup = false;\n this.intentStates = Object.create(null);\n this.destroyed = false;\n }\n\n /**\n * @type {number} Page number of the page. First page is 1.\n */\n get pageNumber() {\n return this._pageIndex + 1;\n }\n\n /**\n * @type {number} The number of degrees the page is rotated clockwise.\n */\n get rotate() {\n return this._pageInfo.rotate;\n }\n\n /**\n * @type {Object} The reference that points to this page. It has `num` and\n * `gen` properties.\n */\n get ref() {\n return this._pageInfo.ref;\n }\n\n /**\n * @type {number} The default size of units in 1/72nds of an inch.\n */\n get userUnit() {\n return this._pageInfo.userUnit;\n }\n\n /**\n * @type {Array} An array of the visible portion of the PDF page in user\n * space units [x1, y1, x2, y2].\n */\n get view() {\n return this._pageInfo.view;\n }\n\n /**\n * @param {GetViewportParameters} params - Viewport parameters.\n * @returns {PageViewport} Contains 'width' and 'height' properties\n * along with transforms required for rendering.\n */\n getViewport({\n scale,\n rotation = this.rotate,\n offsetX = 0,\n offsetY = 0,\n dontFlip = false,\n } = {}) {\n return new PageViewport({\n viewBox: this.view,\n scale,\n rotation,\n offsetX,\n offsetY,\n dontFlip,\n });\n }\n\n /**\n * @param {GetAnnotationsParameters} params - Annotation parameters.\n * @returns {Promise} A promise that is resolved with an {Array} of the\n * annotation objects.\n */\n getAnnotations({ intent = null } = {}) {\n if (!this.annotationsPromise || this.annotationsIntent !== intent) {\n this.annotationsPromise = this._transport.getAnnotations(\n this._pageIndex,\n intent\n );\n this.annotationsIntent = intent;\n }\n return this.annotationsPromise;\n }\n\n /**\n * Begins the process of rendering a page to the desired context.\n * @param {RenderParameters} params Page render parameters.\n * @returns {RenderTask} An object that contains the promise, which\n * is resolved when the page finishes rendering.\n */\n render({\n canvasContext,\n viewport,\n intent = \"display\",\n enableWebGL = false,\n renderInteractiveForms = false,\n transform = null,\n imageLayer = null,\n canvasFactory = null,\n background = null,\n }) {\n if (this._stats) {\n this._stats.time(\"Overall\");\n }\n\n const renderingIntent = intent === \"print\" ? \"print\" : \"display\";\n // If there was a pending destroy, cancel it so no cleanup happens during\n // this call to render.\n this.pendingCleanup = false;\n\n if (!this.intentStates[renderingIntent]) {\n this.intentStates[renderingIntent] = Object.create(null);\n }\n const intentState = this.intentStates[renderingIntent];\n\n // Ensure that a pending `streamReader` cancel timeout is always aborted.\n if (intentState.streamReaderCancelTimeout) {\n clearTimeout(intentState.streamReaderCancelTimeout);\n intentState.streamReaderCancelTimeout = null;\n }\n\n const canvasFactoryInstance = canvasFactory || new DOMCanvasFactory();\n const webGLContext = new WebGLContext({\n enable: enableWebGL,\n });\n\n // If there's no displayReadyCapability yet, then the operatorList\n // was never requested before. Make the request and create the promise.\n if (!intentState.displayReadyCapability) {\n intentState.displayReadyCapability = createPromiseCapability();\n intentState.operatorList = {\n fnArray: [],\n argsArray: [],\n lastChunk: false,\n };\n\n if (this._stats) {\n this._stats.time(\"Page Request\");\n }\n this._pumpOperatorList({\n pageIndex: this._pageIndex,\n intent: renderingIntent,\n renderInteractiveForms: renderInteractiveForms === true,\n });\n }\n\n const complete = error => {\n const i = intentState.renderTasks.indexOf(internalRenderTask);\n if (i >= 0) {\n intentState.renderTasks.splice(i, 1);\n }\n\n // Attempt to reduce memory usage during *printing*, by always running\n // cleanup once rendering has finished (regardless of cleanupAfterRender).\n if (this.cleanupAfterRender || renderingIntent === \"print\") {\n this.pendingCleanup = true;\n }\n this._tryCleanup();\n\n if (error) {\n internalRenderTask.capability.reject(error);\n\n this._abortOperatorList({\n intentState,\n reason: error,\n });\n } else {\n internalRenderTask.capability.resolve();\n }\n if (this._stats) {\n this._stats.timeEnd(\"Rendering\");\n this._stats.timeEnd(\"Overall\");\n }\n };\n\n const internalRenderTask = new InternalRenderTask({\n callback: complete,\n // Only include the required properties, and *not* the entire object.\n params: {\n canvasContext,\n viewport,\n transform,\n imageLayer,\n background,\n },\n objs: this.objs,\n commonObjs: this.commonObjs,\n operatorList: intentState.operatorList,\n pageIndex: this._pageIndex,\n canvasFactory: canvasFactoryInstance,\n webGLContext,\n useRequestAnimationFrame: renderingIntent !== \"print\",\n pdfBug: this._pdfBug,\n });\n\n if (!intentState.renderTasks) {\n intentState.renderTasks = [];\n }\n intentState.renderTasks.push(internalRenderTask);\n const renderTask = internalRenderTask.task;\n\n intentState.displayReadyCapability.promise\n .then(transparency => {\n if (this.pendingCleanup) {\n complete();\n return;\n }\n if (this._stats) {\n this._stats.time(\"Rendering\");\n }\n internalRenderTask.initializeGraphics(transparency);\n internalRenderTask.operatorListChanged();\n })\n .catch(complete);\n\n return renderTask;\n }\n\n /**\n * @returns {Promise} A promise resolved with an {@link PDFOperatorList}\n * object that represents page's operator list.\n */\n getOperatorList() {\n function operatorListChanged() {\n if (intentState.operatorList.lastChunk) {\n intentState.opListReadCapability.resolve(intentState.operatorList);\n\n const i = intentState.renderTasks.indexOf(opListTask);\n if (i >= 0) {\n intentState.renderTasks.splice(i, 1);\n }\n }\n }\n\n const renderingIntent = \"oplist\";\n if (!this.intentStates[renderingIntent]) {\n this.intentStates[renderingIntent] = Object.create(null);\n }\n const intentState = this.intentStates[renderingIntent];\n let opListTask;\n\n if (!intentState.opListReadCapability) {\n opListTask = {};\n opListTask.operatorListChanged = operatorListChanged;\n intentState.opListReadCapability = createPromiseCapability();\n intentState.renderTasks = [];\n intentState.renderTasks.push(opListTask);\n intentState.operatorList = {\n fnArray: [],\n argsArray: [],\n lastChunk: false,\n };\n\n if (this._stats) {\n this._stats.time(\"Page Request\");\n }\n this._pumpOperatorList({\n pageIndex: this._pageIndex,\n intent: renderingIntent,\n });\n }\n return intentState.opListReadCapability.promise;\n }\n\n /**\n * @param {getTextContentParameters} params - getTextContent parameters.\n * @returns {ReadableStream} ReadableStream to read textContent chunks.\n */\n streamTextContent({\n normalizeWhitespace = false,\n disableCombineTextItems = false,\n } = {}) {\n const TEXT_CONTENT_CHUNK_SIZE = 100;\n\n return this._transport.messageHandler.sendWithStream(\n \"GetTextContent\",\n {\n pageIndex: this._pageIndex,\n normalizeWhitespace: normalizeWhitespace === true,\n combineTextItems: disableCombineTextItems !== true,\n },\n {\n highWaterMark: TEXT_CONTENT_CHUNK_SIZE,\n size(textContent) {\n return textContent.items.length;\n },\n }\n );\n }\n\n /**\n * @param {getTextContentParameters} params - getTextContent parameters.\n * @returns {Promise} That is resolved a {@link TextContent}\n * object that represent the page text content.\n */\n getTextContent(params = {}) {\n const readableStream = this.streamTextContent(params);\n\n return new Promise(function (resolve, reject) {\n function pump() {\n reader.read().then(function ({ value, done }) {\n if (done) {\n resolve(textContent);\n return;\n }\n Object.assign(textContent.styles, value.styles);\n textContent.items.push(...value.items);\n pump();\n }, reject);\n }\n\n const reader = readableStream.getReader();\n const textContent = {\n items: [],\n styles: Object.create(null),\n };\n pump();\n });\n }\n\n /**\n * Destroys the page object.\n * @private\n */\n _destroy() {\n this.destroyed = true;\n this._transport.pageCache[this._pageIndex] = null;\n\n const waitOn = [];\n Object.keys(this.intentStates).forEach(intent => {\n const intentState = this.intentStates[intent];\n this._abortOperatorList({\n intentState,\n reason: new Error(\"Page was destroyed.\"),\n force: true,\n });\n\n if (intent === \"oplist\") {\n // Avoid errors below, since the renderTasks are just stubs.\n return;\n }\n intentState.renderTasks.forEach(function (renderTask) {\n const renderCompleted = renderTask.capability.promise.catch(\n function () {}\n ); // ignoring failures\n waitOn.push(renderCompleted);\n renderTask.cancel();\n });\n });\n this.objs.clear();\n this.annotationsPromise = null;\n this.pendingCleanup = false;\n return Promise.all(waitOn);\n }\n\n /**\n * Cleans up resources allocated by the page.\n * @param {boolean} [resetStats] - Reset page stats, if enabled.\n * The default value is `false`.\n * @returns {boolean} Indicating if clean-up was successfully run.\n */\n cleanup(resetStats = false) {\n this.pendingCleanup = true;\n return this._tryCleanup(resetStats);\n }\n\n /**\n * Attempts to clean up if rendering is in a state where that's possible.\n * @private\n */\n _tryCleanup(resetStats = false) {\n if (\n !this.pendingCleanup ||\n Object.keys(this.intentStates).some(intent => {\n const intentState = this.intentStates[intent];\n return (\n intentState.renderTasks.length !== 0 ||\n !intentState.operatorList.lastChunk\n );\n })\n ) {\n return false;\n }\n\n Object.keys(this.intentStates).forEach(intent => {\n delete this.intentStates[intent];\n });\n this.objs.clear();\n this.annotationsPromise = null;\n if (resetStats && this._stats) {\n this._stats = new StatTimer();\n }\n this.pendingCleanup = false;\n return true;\n }\n\n /**\n * @private\n */\n _startRenderPage(transparency, intent) {\n const intentState = this.intentStates[intent];\n if (!intentState) {\n return; // Rendering was cancelled.\n }\n if (this._stats) {\n this._stats.timeEnd(\"Page Request\");\n }\n // TODO Refactor RenderPageRequest to separate rendering\n // and operator list logic\n if (intentState.displayReadyCapability) {\n intentState.displayReadyCapability.resolve(transparency);\n }\n }\n\n /**\n * @private\n */\n _renderPageChunk(operatorListChunk, intentState) {\n // Add the new chunk to the current operator list.\n for (let i = 0, ii = operatorListChunk.length; i < ii; i++) {\n intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]);\n intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]);\n }\n intentState.operatorList.lastChunk = operatorListChunk.lastChunk;\n\n // Notify all the rendering tasks there are more operators to be consumed.\n for (let i = 0; i < intentState.renderTasks.length; i++) {\n intentState.renderTasks[i].operatorListChanged();\n }\n\n if (operatorListChunk.lastChunk) {\n this._tryCleanup();\n }\n }\n\n /**\n * @private\n */\n _pumpOperatorList(args) {\n assert(\n args.intent,\n 'PDFPageProxy._pumpOperatorList: Expected \"intent\" argument.'\n );\n\n const readableStream = this._transport.messageHandler.sendWithStream(\n \"GetOperatorList\",\n args\n );\n const reader = readableStream.getReader();\n\n const intentState = this.intentStates[args.intent];\n intentState.streamReader = reader;\n\n const pump = () => {\n reader.read().then(\n ({ value, done }) => {\n if (done) {\n intentState.streamReader = null;\n return;\n }\n if (this._transport.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n this._renderPageChunk(value, intentState);\n pump();\n },\n reason => {\n intentState.streamReader = null;\n\n if (this._transport.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n if (intentState.operatorList) {\n // Mark operator list as complete.\n intentState.operatorList.lastChunk = true;\n\n for (let i = 0; i < intentState.renderTasks.length; i++) {\n intentState.renderTasks[i].operatorListChanged();\n }\n this._tryCleanup();\n }\n\n if (intentState.displayReadyCapability) {\n intentState.displayReadyCapability.reject(reason);\n } else if (intentState.opListReadCapability) {\n intentState.opListReadCapability.reject(reason);\n } else {\n throw reason;\n }\n }\n );\n };\n pump();\n }\n\n /**\n * @private\n */\n _abortOperatorList({ intentState, reason, force = false }) {\n assert(\n reason instanceof Error ||\n (typeof reason === \"object\" && reason !== null),\n 'PDFPageProxy._abortOperatorList: Expected \"reason\" argument.'\n );\n\n if (!intentState.streamReader) {\n return;\n }\n if (!force) {\n // Ensure that an Error occurring in *only* one `InternalRenderTask`, e.g.\n // multiple render() calls on the same canvas, won't break all rendering.\n if (intentState.renderTasks.length !== 0) {\n return;\n }\n // Don't immediately abort parsing on the worker-thread when rendering is\n // cancelled, since that will unnecessarily delay re-rendering when (for\n // partially parsed pages) e.g. zooming/rotation occurs in the viewer.\n if (reason instanceof RenderingCancelledException) {\n intentState.streamReaderCancelTimeout = setTimeout(() => {\n this._abortOperatorList({ intentState, reason, force: true });\n intentState.streamReaderCancelTimeout = null;\n }, RENDERING_CANCELLED_TIMEOUT);\n return;\n }\n }\n intentState.streamReader.cancel(\n new AbortException(reason && reason.message)\n );\n intentState.streamReader = null;\n\n if (this._transport.destroyed) {\n return; // Ignore any pending requests if the worker was terminated.\n }\n // Remove the current `intentState`, since a cancelled `getOperatorList`\n // call on the worker-thread cannot be re-started...\n Object.keys(this.intentStates).some(intent => {\n if (this.intentStates[intent] === intentState) {\n delete this.intentStates[intent];\n return true;\n }\n return false;\n });\n // ... and force clean-up to ensure that any old state is always removed.\n this.cleanup();\n }\n\n /**\n * @type {Object} Returns page stats, if enabled; returns `null` otherwise.\n */\n get stats() {\n return this._stats;\n }\n}\n\nclass LoopbackPort {\n constructor(defer = true) {\n this._listeners = [];\n this._defer = defer;\n this._deferred = Promise.resolve(undefined);\n }\n\n postMessage(obj, transfers) {\n function cloneValue(value) {\n // Trying to perform a structured clone close to the spec, including\n // transfers.\n if (typeof value !== \"object\" || value === null) {\n return value;\n }\n if (cloned.has(value)) {\n // already cloned the object\n return cloned.get(value);\n }\n let buffer, result;\n if ((buffer = value.buffer) && isArrayBuffer(buffer)) {\n // We found object with ArrayBuffer (typed array).\n const transferable = transfers && transfers.includes(buffer);\n if (transferable) {\n result = new value.constructor(\n buffer,\n value.byteOffset,\n value.byteLength\n );\n } else {\n result = new value.constructor(value);\n }\n cloned.set(value, result);\n return result;\n }\n result = Array.isArray(value) ? [] : {};\n cloned.set(value, result); // adding to cache now for cyclic references\n // Cloning all value and object properties, however ignoring properties\n // defined via getter.\n for (const i in value) {\n let desc,\n p = value;\n while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {\n p = Object.getPrototypeOf(p);\n }\n if (typeof desc.value === \"undefined\") {\n continue;\n }\n if (typeof desc.value === \"function\") {\n if (value.hasOwnProperty && value.hasOwnProperty(i)) {\n throw new Error(\n `LoopbackPort.postMessage - cannot clone: ${value[i]}`\n );\n }\n continue;\n }\n result[i] = cloneValue(desc.value);\n }\n return result;\n }\n\n if (!this._defer) {\n this._listeners.forEach(listener => {\n listener.call(this, { data: obj });\n });\n return;\n }\n\n const cloned = new WeakMap();\n const e = { data: cloneValue(obj) };\n this._deferred.then(() => {\n this._listeners.forEach(listener => {\n listener.call(this, e);\n });\n });\n }\n\n addEventListener(name, listener) {\n this._listeners.push(listener);\n }\n\n removeEventListener(name, listener) {\n const i = this._listeners.indexOf(listener);\n this._listeners.splice(i, 1);\n }\n\n terminate() {\n this._listeners.length = 0;\n }\n}\n\n/**\n * @typedef {Object} PDFWorkerParameters\n * @property {string} [name] - The name of the worker.\n * @property {Object} [port] - The `workerPort`.\n * @property {number} [verbosity] - Controls the logging level; the\n * constants from {VerbosityLevel} should be used.\n */\n\nconst PDFWorker = (function PDFWorkerClosure() {\n const pdfWorkerPorts = new WeakMap();\n let isWorkerDisabled = false;\n let fallbackWorkerSrc;\n let nextFakeWorkerId = 0;\n let fakeWorkerCapability;\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n // eslint-disable-next-line no-undef\n if (isNodeJS && typeof __non_webpack_require__ === \"function\") {\n // Workers aren't supported in Node.js, force-disabling them there.\n isWorkerDisabled = true;\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"LIB\")) {\n fallbackWorkerSrc = \"../pdf.worker.js\";\n } else {\n fallbackWorkerSrc = \"./pdf.worker.js\";\n }\n } else if (typeof document === \"object\" && \"currentScript\" in document) {\n const pdfjsFilePath =\n document.currentScript && document.currentScript.src;\n if (pdfjsFilePath) {\n fallbackWorkerSrc = pdfjsFilePath.replace(\n /(\\.(?:min\\.)?js)(\\?.*)?$/i,\n \".worker$1$2\"\n );\n }\n }\n }\n\n function getWorkerSrc() {\n if (GlobalWorkerOptions.workerSrc) {\n return GlobalWorkerOptions.workerSrc;\n }\n if (typeof fallbackWorkerSrc !== \"undefined\") {\n if (!isNodeJS) {\n deprecated('No \"GlobalWorkerOptions.workerSrc\" specified.');\n }\n return fallbackWorkerSrc;\n }\n throw new Error('No \"GlobalWorkerOptions.workerSrc\" specified.');\n }\n\n function getMainThreadWorkerMessageHandler() {\n let mainWorkerMessageHandler;\n try {\n mainWorkerMessageHandler =\n globalThis.pdfjsWorker && globalThis.pdfjsWorker.WorkerMessageHandler;\n } catch (ex) {\n /* Ignore errors. */\n }\n return mainWorkerMessageHandler || null;\n }\n\n // Loads worker code into main thread.\n function setupFakeWorkerGlobal() {\n if (fakeWorkerCapability) {\n return fakeWorkerCapability.promise;\n }\n fakeWorkerCapability = createPromiseCapability();\n\n const loader = async function () {\n const mainWorkerMessageHandler = getMainThreadWorkerMessageHandler();\n\n if (mainWorkerMessageHandler) {\n // The worker was already loaded using e.g. a ` - + - +
-
- - - +
+
+ + + + +
+
+ +
+
@@ -65,8 +80,10 @@ See https://github.com/adobe-type-tools/cmap-resources
+
- +
@@ -186,11 +203,11 @@ See https://github.com/adobe-type-tools/cmap-resources
-
-
@@ -227,7 +244,7 @@ See https://github.com/adobe-type-tools/cmap-resources
-
@@ -269,17 +286,6 @@ See https://github.com/adobe-type-tools/cmap-resources
- - - - - - -
@@ -391,4 +397,3 @@ See https://github.com/adobe-type-tools/cmap-resources
- diff --git a/org.adempiere.ui.zk/pdf.js/web/viewer.js b/org.adempiere.ui.zk/pdf.js/web/viewer.js index 3cf8beed83..52eb844278 100644 --- a/org.adempiere.ui.zk/pdf.js/web/viewer.js +++ b/org.adempiere.ui.zk/pdf.js/web/viewer.js @@ -2,7 +2,7 @@ * @licstart The following is the entire license notice for the * Javascript code in this page * - * Copyright 2020 Mozilla Foundation + * Copyright 2021 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,277 +20,327 @@ * 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"; +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ([ +/* 0 */, +/* 1 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -; -let pdfjsWebApp, pdfjsWebAppOptions; + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.OptionKind = exports.AppOptions = void 0; + +var _viewer_compatibility = __webpack_require__(2); + +const OptionKind = { + VIEWER: 0x02, + API: 0x04, + WORKER: 0x08, + PREFERENCE: 0x80 +}; +exports.OptionKind = OptionKind; +const defaultOptions = { + cursorToolOnLoad: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + defaultUrl: { + value: "compressed.tracemonkey-pldi-09.pdf", + kind: OptionKind.VIEWER + }, + defaultZoomValue: { + value: "", + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + disableHistory: { + value: false, + kind: OptionKind.VIEWER + }, + disablePageLabels: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enablePermissions: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enablePrintAutoRotate: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableScripting: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + externalLinkRel: { + value: "noopener noreferrer nofollow", + kind: OptionKind.VIEWER + }, + externalLinkTarget: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + historyUpdateUrl: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + ignoreDestinationZoom: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + imageResourcesPath: { + value: "./images/", + kind: OptionKind.VIEWER + }, + maxCanvasPixels: { + value: 16777216, + compatibility: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels, + kind: OptionKind.VIEWER + }, + pdfBugEnabled: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + printResolution: { + value: 150, + kind: OptionKind.VIEWER + }, + renderer: { + value: "canvas", + kind: OptionKind.VIEWER + }, + renderInteractiveForms: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + sidebarViewOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + scrollModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + spreadModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + textLayerMode: { + value: 1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + useOnlyCssZoom: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + viewerCssTheme: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + viewOnLoad: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + cMapPacked: { + value: true, + kind: OptionKind.API + }, + cMapUrl: { + value: "../web/cmaps/", + kind: OptionKind.API + }, + disableAutoFetch: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableFontFace: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableRange: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableStream: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + docBaseUrl: { + value: "", + kind: OptionKind.API + }, + enableXfa: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + fontExtraProperties: { + value: false, + kind: OptionKind.API + }, + isEvalSupported: { + value: true, + kind: OptionKind.API + }, + maxImageSize: { + value: -1, + kind: OptionKind.API + }, + pdfBug: { + value: false, + kind: OptionKind.API + }, + verbosity: { + value: 1, + kind: OptionKind.API + }, + workerPort: { + value: null, + kind: OptionKind.WORKER + }, + workerSrc: { + value: "../build/pdf.worker.js", + kind: OptionKind.WORKER + } +}; { - pdfjsWebApp = __webpack_require__(1); - pdfjsWebAppOptions = __webpack_require__(3); -} -; -{ - __webpack_require__(33); -} -; -{ - __webpack_require__(38); -} - -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" + defaultOptions.disablePreferences = { + value: false, + kind: OptionKind.VIEWER }; + defaultOptions.locale = { + value: typeof navigator !== "undefined" ? navigator.language : "en-US", + kind: OptionKind.VIEWER + }; + defaultOptions.sandboxBundleSrc = { + value: "../build/pdf.sandbox.js", + kind: OptionKind.VIEWER + }; + defaultOptions.renderer.kind += OptionKind.PREFERENCE; } +const userOptions = Object.create(null); -function webViewerLoad() { - const config = getViewerConfiguration(); - window.PDFViewerApplication = pdfjsWebApp.PDFViewerApplication; - window.PDFViewerApplicationOptions = pdfjsWebAppOptions.AppOptions; - const event = document.createEvent("CustomEvent"); - event.initCustomEvent("webviewerloaded", true, true, { - source: window - }); - - try { - parent.document.dispatchEvent(event); - } catch (ex) { - console.error(`webviewerloaded: ${ex}`); - document.dispatchEvent(event); +class AppOptions { + constructor() { + throw new Error("Cannot initialize AppOptions."); + } + + static get(name) { + const userOption = userOptions[name]; + + if (userOption !== undefined) { + return userOption; + } + + const defaultOption = defaultOptions[name]; + + if (defaultOption !== undefined) { + return defaultOption.compatibility ?? defaultOption.value; + } + + return undefined; + } + + static getAll(kind = null) { + const options = Object.create(null); + + for (const name in defaultOptions) { + const defaultOption = defaultOptions[name]; + + if (kind) { + if ((kind & defaultOption.kind) === 0) { + continue; + } + + if (kind === OptionKind.PREFERENCE) { + const value = defaultOption.value, + valueType = typeof value; + + if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) { + options[name] = value; + continue; + } + + throw new Error(`Invalid type for preference: ${name}`); + } + } + + const userOption = userOptions[name]; + options[name] = userOption !== undefined ? userOption : defaultOption.compatibility ?? defaultOption.value; + } + + return options; + } + + static set(name, value) { + userOptions[name] = value; + } + + static setAll(options) { + for (const name in options) { + userOptions[name] = options[name]; + } + } + + static remove(name) { + delete userOptions[name]; } - pdfjsWebApp.PDFViewerApplication.run(config); } -if (document.readyState === "interactive" || document.readyState === "complete") { - webViewerLoad(); -} else { - document.addEventListener("DOMContentLoaded", webViewerLoad, true); -} +exports.AppOptions = AppOptions; /***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 2 */ +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.PDFPrintServiceFactory = exports.DefaultExternalServices = exports.PDFViewerApplication = void 0; +})); +exports.viewerCompatibilityParams = void 0; +const compatibilityParams = Object.create(null); +{ + const userAgent = typeof navigator !== "undefined" && navigator.userAgent || ""; + const platform = typeof navigator !== "undefined" && navigator.platform || ""; + const maxTouchPoints = typeof navigator !== "undefined" && navigator.maxTouchPoints || 1; + const isAndroid = /Android/.test(userAgent); + const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1; + const isIOSChrome = /CriOS/.test(userAgent); -var _ui_utils = __webpack_require__(2); + (function checkOnBlobSupport() { + if (isIOSChrome) { + compatibilityParams.disableCreateObjectURL = true; + } + })(); -var _app_options = __webpack_require__(3); + (function checkCanvasSizeLimitation() { + if (isIOS || isAndroid) { + compatibilityParams.maxCanvasPixels = 5242880; + } + })(); +} +const viewerCompatibilityParams = Object.freeze(compatibilityParams); +exports.viewerCompatibilityParams = viewerCompatibilityParams; + +/***/ }), +/* 3 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.PDFViewerApplication = exports.PDFPrintServiceFactory = exports.DefaultExternalServices = void 0; + +var _ui_utils = __webpack_require__(4); + +var _app_options = __webpack_require__(1); var _pdfjsLib = __webpack_require__(5); @@ -298,13 +348,11 @@ var _pdf_cursor_tools = __webpack_require__(6); var _pdf_rendering_queue = __webpack_require__(8); -var _pdf_sidebar = __webpack_require__(9); +var _overlay_manager = __webpack_require__(9); -var _overlay_manager = __webpack_require__(10); +var _password_prompt = __webpack_require__(10); -var _password_prompt = __webpack_require__(11); - -var _pdf_attachment_viewer = __webpack_require__(12); +var _pdf_attachment_viewer = __webpack_require__(11); var _pdf_document_properties = __webpack_require__(13); @@ -314,23 +362,31 @@ var _pdf_find_controller = __webpack_require__(15); var _pdf_history = __webpack_require__(17); -var _pdf_link_service = __webpack_require__(18); +var _pdf_layer_viewer = __webpack_require__(18); -var _pdf_outline_viewer = __webpack_require__(19); +var _pdf_link_service = __webpack_require__(19); -var _pdf_presentation_mode = __webpack_require__(20); +var _pdf_outline_viewer = __webpack_require__(20); -var _pdf_sidebar_resizer = __webpack_require__(21); +var _pdf_presentation_mode = __webpack_require__(21); -var _pdf_thumbnail_viewer = __webpack_require__(22); +var _pdf_scripting_manager = __webpack_require__(22); -var _pdf_viewer = __webpack_require__(24); +var _pdf_sidebar = __webpack_require__(23); -var _secondary_toolbar = __webpack_require__(29); +var _pdf_sidebar_resizer = __webpack_require__(24); -var _toolbar = __webpack_require__(31); +var _pdf_thumbnail_viewer = __webpack_require__(25); -var _view_history = __webpack_require__(32); +var _pdf_viewer = __webpack_require__(27); + +var _secondary_toolbar = __webpack_require__(35); + +var _toolbar = __webpack_require__(37); + +var _viewer_compatibility = __webpack_require__(2); + +var _view_history = __webpack_require__(38); const DEFAULT_SCALE_DELTA = 1.1; const DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; @@ -342,6 +398,13 @@ const ViewOnLoad = { PREVIOUS: 0, INITIAL: 1 }; +const ViewerCssTheme = { + AUTOMATIC: 0, + LIGHT: 1, + DARK: 2 +}; +const KNOWN_VERSIONS = ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2.0", "2.1", "2.2", "2.3"]; +const KNOWN_GENERATORS = ["acrobat distiller", "acrobat pdfwriter", "adobe livecycle", "adobe pdf library", "adobe photoshop", "ghostscript", "tcpdf", "cairo", "dvipdfm", "dvips", "pdftex", "pdfkit", "itext", "prince", "quarkxpress", "mac os x", "microsoft", "openoffice", "oracle", "luradocument", "pdf-xchange", "antenna house", "aspose.cells", "fpdf"]; class DefaultExternalServices { constructor() { @@ -354,7 +417,7 @@ class DefaultExternalServices { static initPassiveLoading(callbacks) {} - static fallback(data, callback) {} + static async fallback(data) {} static reportTelemetry(data) {} @@ -370,6 +433,10 @@ class DefaultExternalServices { throw new Error("Not implemented: createL10n"); } + static createScripting(options) { + throw new Error("Not implemented: createScripting"); + } + static get supportsIntegratedFind() { return (0, _pdfjsLib.shadow)(this, "supportsIntegratedFind", false); } @@ -395,7 +462,7 @@ exports.DefaultExternalServices = DefaultExternalServices; const PDFViewerApplication = { initialBookmark: document.location.hash.substring(1), _initializedCapability: (0, _pdfjsLib.createPromiseCapability)(), - fellback: false, + _fellback: false, appConfig: null, pdfDocument: null, pdfLoadingTask: null, @@ -411,7 +478,9 @@ const PDFViewerApplication = { pdfSidebarResizer: null, pdfOutlineViewer: null, pdfAttachmentViewer: null, + pdfLayerViewer: null, pdfCursorTools: null, + pdfScriptingManager: null, store: null, downloadManager: null, overlayManager: null, @@ -426,14 +495,23 @@ const PDFViewerApplication = { url: "", baseUrl: "", externalServices: DefaultExternalServices, - _boundEvents: {}, - contentDispositionFilename: null, + _boundEvents: Object.create(null), + documentInfo: null, + metadata: null, + _contentDispositionFilename: null, + _contentLength: null, + _saveInProgress: false, + _wheelUnusedTicks: 0, + _idleCallbacks: new Set(), async initialize(appConfig) { this.preferences = this.externalServices.createPreferences(); this.appConfig = appConfig; await this._readPreferences(); await this._parseHashParameters(); + + this._forceCssTheme(); + await this._initializeL10n(); if (this.isViewerEmbedded && _app_options.AppOptions.get("externalLinkTarget") === _pdfjsLib.LinkTarget.NONE) { @@ -459,13 +537,9 @@ const PDFViewerApplication = { } try { - const prefs = await this.preferences.getAll(); - - for (const name in prefs) { - _app_options.AppOptions.set(name, prefs[name]); - } + _app_options.AppOptions.setAll(await this.preferences.getAll()); } catch (reason) { - console.error(`_readPreferences: "${reason.message}".`); + console.error(`_readPreferences: "${reason?.message}".`); } }, @@ -507,10 +581,6 @@ const PDFViewerApplication = { _app_options.AppOptions.set("disableHistory", hashParams.disablehistory === "true"); } - if ("webgl" in hashParams) { - _app_options.AppOptions.set("enableWebGL", hashParams.webgl === "true"); - } - if ("verbosity" in hashParams) { _app_options.AppOptions.set("verbosity", hashParams.verbosity | 0); } @@ -544,6 +614,10 @@ const PDFViewerApplication = { _app_options.AppOptions.set("locale", hashParams.locale); } + if (waitOn.length === 0) { + return undefined; + } + return Promise.all(waitOn).catch(reason => { console.error(`_parseHashParameters: "${reason.message}".`); }); @@ -557,6 +631,44 @@ const PDFViewerApplication = { document.getElementsByTagName("html")[0].dir = dir; }, + _forceCssTheme() { + const cssTheme = _app_options.AppOptions.get("viewerCssTheme"); + + if (cssTheme === ViewerCssTheme.AUTOMATIC || !Object.values(ViewerCssTheme).includes(cssTheme)) { + return; + } + + try { + const styleSheet = document.styleSheets[0]; + const cssRules = styleSheet?.cssRules || []; + const mediaMatcher = "prefers-color-scheme"; + const mediaRule = `(${mediaMatcher}: dark)`; + const mediaRegex = new RegExp(`^@media \\(${mediaMatcher}: dark\\) {\\n\\s*([\\w\\s-.,:;/\\\\{}()]+)\\n}$`); + + for (let i = 0, ii = cssRules.length; i < ii; i++) { + const rule = cssRules[i]; + + if (rule instanceof CSSMediaRule && rule.media?.[0] === mediaRule) { + if (cssTheme === ViewerCssTheme.LIGHT) { + styleSheet.deleteRule(i); + return; + } + + const darkRules = mediaRegex.exec(rule.cssText); + + if (darkRules?.[1]) { + styleSheet.deleteRule(i); + styleSheet.insertRule(darkRules[1], i); + } + + return; + } + } + } catch (reason) { + console.error(`_forceCssTheme: "${reason?.message}".`); + } + }, + async _initializeViewerComponents() { const appConfig = this.appConfig; const eventBus = appConfig.eventBus || new _ui_utils.EventBus({ @@ -565,7 +677,7 @@ const PDFViewerApplication = { this.eventBus = eventBus; this.overlayManager = new _overlay_manager.OverlayManager(); const pdfRenderingQueue = new _pdf_rendering_queue.PDFRenderingQueue(); - pdfRenderingQueue.onIdle = this.cleanup.bind(this); + pdfRenderingQueue.onIdle = this._cleanup.bind(this); this.pdfRenderingQueue = pdfRenderingQueue; const pdfLinkService = new _pdf_link_service.PDFLinkService({ eventBus, @@ -574,15 +686,20 @@ const PDFViewerApplication = { ignoreDestinationZoom: _app_options.AppOptions.get("ignoreDestinationZoom") }); this.pdfLinkService = pdfLinkService; - const downloadManager = this.externalServices.createDownloadManager({ - disableCreateObjectURL: _app_options.AppOptions.get("disableCreateObjectURL") - }); + const downloadManager = this.externalServices.createDownloadManager(); this.downloadManager = downloadManager; const findController = new _pdf_find_controller.PDFFindController({ linkService: pdfLinkService, eventBus }); this.findController = findController; + const pdfScriptingManager = new _pdf_scripting_manager.PDFScriptingManager({ + eventBus, + sandboxBundleSrc: _app_options.AppOptions.get("sandboxBundleSrc"), + scriptingFactory: this.externalServices, + docPropertiesLookup: this._scriptingDocProperties.bind(this) + }); + this.pdfScriptingManager = pdfScriptingManager; const container = appConfig.mainContainer; const viewer = appConfig.viewerContainer; this.pdfViewer = new _pdf_viewer.PDFViewer({ @@ -593,20 +710,23 @@ const PDFViewerApplication = { linkService: pdfLinkService, downloadManager, findController, + scriptingManager: pdfScriptingManager, 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") + maxCanvasPixels: _app_options.AppOptions.get("maxCanvasPixels"), + enableScripting: _app_options.AppOptions.get("enableScripting") }); pdfRenderingQueue.setViewer(this.pdfViewer); pdfLinkService.setViewer(this.pdfViewer); + pdfScriptingManager.setViewer(this.pdfViewer); this.pdfThumbnailViewer = new _pdf_thumbnail_viewer.PDFThumbnailViewer({ container: appConfig.sidebar.thumbnailView, + eventBus, renderingQueue: pdfRenderingQueue, linkService: pdfLinkService, l10n: this.l10n @@ -635,12 +755,11 @@ const PDFViewerApplication = { this.pdfPresentationMode = new _pdf_presentation_mode.PDFPresentationMode({ container, pdfViewer: this.pdfViewer, - eventBus, - contextMenuItems: appConfig.fullscreen + eventBus }); } - this.passwordPrompt = new _password_prompt.PasswordPrompt(appConfig.passwordOverlay, this.overlayManager, this.l10n); + this.passwordPrompt = new _password_prompt.PasswordPrompt(appConfig.passwordOverlay, this.overlayManager, this.l10n, this.isViewerEmbedded); this.pdfOutlineViewer = new _pdf_outline_viewer.PDFOutlineViewer({ container: appConfig.sidebar.outlineView, eventBus, @@ -651,6 +770,11 @@ const PDFViewerApplication = { eventBus, downloadManager }); + this.pdfLayerViewer = new _pdf_layer_viewer.PDFLayerViewer({ + container: appConfig.sidebar.layersView, + eventBus, + l10n: this.l10n + }); this.pdfSidebar = new _pdf_sidebar.PDFSidebar({ elements: appConfig.sidebar, pdfViewer: this.pdfViewer, @@ -726,20 +850,15 @@ const PDFViewerApplication = { this.pdfViewer.currentPageNumber = val; }, - get printing() { - return !!this.printService; - }, - get supportsPrinting() { return PDFPrintServiceFactory.instance.supportsPrinting; }, get supportsFullscreen() { - let support; const doc = document.documentElement; - support = !!(doc.requestFullscreen || doc.mozRequestFullScreen || doc.webkitRequestFullScreen || doc.msRequestFullscreen); + let support = !!(doc.requestFullscreen || doc.mozRequestFullScreen || doc.webkitRequestFullScreen); - if (document.fullscreenEnabled === false || document.mozFullScreenEnabled === false || document.webkitFullscreenEnabled === false || document.msFullscreenEnabled === false) { + if (document.fullscreenEnabled === false || document.mozFullScreenEnabled === false || document.webkitFullscreenEnabled === false) { support = false; } @@ -770,7 +889,7 @@ const PDFViewerApplication = { setTitleUsingUrl(url = "") { this.url = url; this.baseUrl = url.split("#")[0]; - let title = (0, _ui_utils.getPDFFileNameFromURL)(url, ""); + let title = (0, _pdfjsLib.getPdfFilenameFromUrl)(url, ""); if (!title) { try { @@ -791,15 +910,44 @@ const PDFViewerApplication = { document.title = title; }, - async close() { - const errorWrapper = this.appConfig.errorWrapper.container; - errorWrapper.setAttribute("hidden", "true"); + get _docFilename() { + return this._contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(this.url); + }, - if (!this.pdfLoadingTask) { - return undefined; + _cancelIdleCallbacks() { + if (!this._idleCallbacks.size) { + return; } - const promise = this.pdfLoadingTask.destroy(); + for (const callback of this._idleCallbacks) { + window.cancelIdleCallback(callback); + } + + this._idleCallbacks.clear(); + }, + + async close() { + this._unblockDocumentLoadEvent(); + + const { + container + } = this.appConfig.errorWrapper; + container.hidden = true; + + if (!this.pdfLoadingTask) { + return; + } + + if (this.pdfDocument?.annotationStorage.size > 0 && this._annotationStorageModified) { + try { + await this.save({ + sourceEventType: "save" + }); + } catch (reason) {} + } + + const promises = []; + promises.push(this.pdfLoadingTask.destroy()); this.pdfLoadingTask = null; if (this.pdfDocument) { @@ -811,15 +959,25 @@ const PDFViewerApplication = { } webViewerResetPermissions(); + this._fellback = false; this.store = null; this.isInitialViewSet = false; this.downloadComplete = false; this.url = ""; this.baseUrl = ""; - this.contentDispositionFilename = null; + this.documentInfo = null; + this.metadata = null; + this._contentDispositionFilename = null; + this._contentLength = null; + this._saveInProgress = false; + + this._cancelIdleCallbacks(); + + promises.push(this.pdfScriptingManager.destroyPromise); this.pdfSidebar.reset(); this.pdfOutlineViewer.reset(); this.pdfAttachmentViewer.reset(); + this.pdfLayerViewer.reset(); if (this.pdfHistory) { this.pdfHistory.reset(); @@ -836,7 +994,7 @@ const PDFViewerApplication = { PDFBug.cleanup(); } - return promise; + await Promise.all(promises); }, async open(file, args) { @@ -874,13 +1032,7 @@ const PDFViewerApplication = { if (args) { for (const key in args) { - const value = args[key]; - - if (key === "length") { - this.pdfDocumentProperties.setFileSize(value); - } - - parameters[key] = value; + parameters[key] = args[key]; } } @@ -908,111 +1060,161 @@ const PDFViewerApplication = { return undefined; } - const message = exception && exception.message; - let loadingErrorMessage; + let key = "loading_error"; if (exception instanceof _pdfjsLib.InvalidPDFException) { - loadingErrorMessage = this.l10n.get("invalid_file_error", null, "Invalid or corrupted PDF file."); + key = "invalid_file_error"; } else if (exception instanceof _pdfjsLib.MissingPDFException) { - loadingErrorMessage = this.l10n.get("missing_file_error", null, "Missing PDF file."); + key = "missing_file_error"; } else if (exception instanceof _pdfjsLib.UnexpectedResponseException) { - loadingErrorMessage = this.l10n.get("unexpected_response_error", null, "Unexpected server response."); - } else { - loadingErrorMessage = this.l10n.get("loading_error", null, "An error occurred while loading the PDF."); + key = "unexpected_response_error"; } - return loadingErrorMessage.then(msg => { - this.error(msg, { - message + return this.l10n.get(key).then(msg => { + this._documentError(msg, { + message: exception?.message }); + throw exception; }); }); }, - download() { - function downloadByUrl() { - downloadManager.downloadUrl(url, filename); - } - - const url = this.baseUrl; - const filename = this.contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url); - const downloadManager = this.downloadManager; - - downloadManager.onerror = err => { - this.error(`PDF failed to download: ${err}`); - }; - - if (!this.pdfDocument || !this.downloadComplete) { - downloadByUrl(); + _ensureDownloadComplete() { + if (this.pdfDocument && this.downloadComplete) { return; } - this.pdfDocument.getData().then(function (data) { + throw new Error("PDF document not downloaded."); + }, + + async download({ + sourceEventType = "download" + } = {}) { + const url = this.baseUrl, + filename = this._docFilename; + + try { + this._ensureDownloadComplete(); + + const data = await this.pdfDocument.getData(); const blob = new Blob([data], { type: "application/pdf" }); - downloadManager.download(blob, url, filename); - }).catch(downloadByUrl); + await this.downloadManager.download(blob, url, filename, sourceEventType); + } catch (reason) { + await this.downloadManager.downloadUrl(url, filename); + } }, - fallback(featureId) { - if (this.fellback) { + async save({ + sourceEventType = "download" + } = {}) { + if (this._saveInProgress) { return; } - this.fellback = true; + this._saveInProgress = true; + await this.pdfScriptingManager.dispatchWillSave(); + const url = this.baseUrl, + filename = this._docFilename; + + try { + this._ensureDownloadComplete(); + + const data = await this.pdfDocument.saveDocument(); + const blob = new Blob([data], { + type: "application/pdf" + }); + await this.downloadManager.download(blob, url, filename, sourceEventType); + } catch (reason) { + await this.download({ + sourceEventType + }); + } finally { + await this.pdfScriptingManager.dispatchDidSave(); + this._saveInProgress = false; + } + }, + + downloadOrSave(options) { + if (this.pdfDocument?.annotationStorage.size > 0) { + this.save(options); + } else { + this.download(options); + } + }, + + fallback(featureId) { + this.externalServices.reportTelemetry({ + type: "unsupportedFeature", + featureId + }); + + if (this._fellback) { + return; + } + + this._fellback = true; this.externalServices.fallback({ featureId, url: this.baseUrl - }, function response(download) { + }).then(download => { if (!download) { return; } - PDFViewerApplication.download(); + this.download({ + sourceEventType: "download" + }); }); }, - error(message, moreInfo) { + _documentError(message, moreInfo = null) { + this._unblockDocumentLoadEvent(); + + this._otherError(message, moreInfo); + }, + + _otherError(message, moreInfo = null) { const 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}}")); + })); } } } const errorWrapperConfig = this.appConfig.errorWrapper; const errorWrapper = errorWrapperConfig.container; - errorWrapper.removeAttribute("hidden"); + errorWrapper.hidden = false; const errorMessage = errorWrapperConfig.errorMessage; errorMessage.textContent = message; const closeButton = errorWrapperConfig.closeButton; closeButton.onclick = function () { - errorWrapper.setAttribute("hidden", "true"); + errorWrapper.hidden = true; }; const errorMoreInfo = errorWrapperConfig.errorMoreInfo; @@ -1020,23 +1222,23 @@ const PDFViewerApplication = { const lessInfoButton = errorWrapperConfig.lessInfoButton; moreInfoButton.onclick = function () { - errorMoreInfo.removeAttribute("hidden"); - moreInfoButton.setAttribute("hidden", "true"); - lessInfoButton.removeAttribute("hidden"); + errorMoreInfo.hidden = false; + moreInfoButton.hidden = true; + lessInfoButton.hidden = false; errorMoreInfo.style.height = errorMoreInfo.scrollHeight + "px"; }; lessInfoButton.onclick = function () { - errorMoreInfo.setAttribute("hidden", "true"); - moreInfoButton.removeAttribute("hidden"); - lessInfoButton.setAttribute("hidden", "true"); + errorMoreInfo.hidden = true; + moreInfoButton.hidden = false; + lessInfoButton.hidden = true; }; moreInfoButton.oncontextmenu = _ui_utils.noContextMenuHandler; lessInfoButton.oncontextmenu = _ui_utils.noContextMenuHandler; closeButton.oncontextmenu = _ui_utils.noContextMenuHandler; - moreInfoButton.removeAttribute("hidden"); - lessInfoButton.setAttribute("hidden", "true"); + moreInfoButton.hidden = false; + lessInfoButton.hidden = true; Promise.all(moreInfoText).then(parts => { errorMoreInfo.value = parts.join("\n"); }); @@ -1070,7 +1272,10 @@ const PDFViewerApplication = { load(pdfDocument) { this.pdfDocument = pdfDocument; - pdfDocument.getDownloadInfo().then(() => { + pdfDocument.getDownloadInfo().then(({ + length + }) => { + this._contentLength = length; this.downloadComplete = true; this.loadingBar.hide(); firstPagePromise.then(() => { @@ -1103,7 +1308,7 @@ const PDFViewerApplication = { scrollLeft: "0", scrollTop: "0", rotation: null, - sidebarView: _pdf_sidebar.SidebarView.UNKNOWN, + sidebarView: _ui_utils.SidebarView.UNKNOWN, scrollMode: _ui_utils.ScrollMode.UNKNOWN, spreadMode: _ui_utils.SpreadMode.UNKNOWN }).catch(() => { @@ -1111,13 +1316,16 @@ const PDFViewerApplication = { }); firstPagePromise.then(pdfPage => { this.loadingBar.setWidth(this.appConfig.viewerContainer); + + this._initializeAnnotationStorageCallbacks(pdfDocument); + Promise.all([_ui_utils.animationStarted, storedPromise, pageLayoutPromise, pageModePromise, openActionPromise]).then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => { const viewOnLoad = _app_options.AppOptions.get("viewOnLoad"); this._initializePdfHistory({ fingerprint: pdfDocument.fingerprint, viewOnLoad, - initialDest: openAction && openAction.dest + initialDest: openAction?.dest }); const initialBookmark = this.initialBookmark; @@ -1137,7 +1345,7 @@ const PDFViewerApplication = { hash = `page=${stored.page}&zoom=${zoom || stored.zoom},` + `${stored.scrollLeft},${stored.scrollTop}`; rotation = parseInt(stored.rotation, 10); - if (sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) { + if (sidebarView === _ui_utils.SidebarView.UNKNOWN) { sidebarView = stored.sidebarView | 0; } @@ -1150,12 +1358,12 @@ const PDFViewerApplication = { } } - if (pageMode && sidebarView === _pdf_sidebar.SidebarView.UNKNOWN) { - sidebarView = apiPageModeToSidebarView(pageMode); + if (pageMode && sidebarView === _ui_utils.SidebarView.UNKNOWN) { + sidebarView = (0, _ui_utils.apiPageModeToSidebarView)(pageMode); } if (pageLayout && spreadMode === _ui_utils.SpreadMode.UNKNOWN) { - spreadMode = apiPageLayoutToSpreadMode(pageLayout); + spreadMode = (0, _ui_utils.apiPageLayoutToSpreadMode)(pageLayout); } this.setInitialView(hash, { @@ -1196,19 +1404,52 @@ const PDFViewerApplication = { }); }); pagesPromise.then(() => { + this._unblockDocumentLoadEvent(); + this._initializeAutoPrint(pdfDocument, openActionPromise); }); onePageRendered.then(() => { pdfDocument.getOutline().then(outline => { + if (pdfDocument !== this.pdfDocument) { + return; + } + this.pdfOutlineViewer.render({ - outline + outline, + pdfDocument }); }); pdfDocument.getAttachments().then(attachments => { + if (pdfDocument !== this.pdfDocument) { + return; + } + this.pdfAttachmentViewer.render({ attachments }); }); + pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => { + if (pdfDocument !== this.pdfDocument) { + return; + } + + this.pdfLayerViewer.render({ + optionalContentConfig, + pdfDocument + }); + }); + + if ("requestIdleCallback" in window) { + const callback = window.requestIdleCallback(() => { + this._collectTelemetry(pdfDocument); + + this._idleCallbacks.delete(callback); + }, { + timeout: 1000 + }); + + this._idleCallbacks.add(callback); + } }); this._initializePageLabels(pdfDocument); @@ -1216,8 +1457,58 @@ const PDFViewerApplication = { this._initializeMetadata(pdfDocument); }, + async _scriptingDocProperties(pdfDocument) { + if (!this.documentInfo) { + await new Promise(resolve => { + this.eventBus._on("metadataloaded", resolve, { + once: true + }); + }); + + if (pdfDocument !== this.pdfDocument) { + return null; + } + } + + if (!this._contentLength) { + await new Promise(resolve => { + this.eventBus._on("documentloaded", resolve, { + once: true + }); + }); + + if (pdfDocument !== this.pdfDocument) { + return null; + } + } + + return { ...this.documentInfo, + baseURL: this.baseUrl, + filesize: this._contentLength, + filename: this._docFilename, + metadata: this.metadata?.getRaw(), + authors: this.metadata?.get("dc:creator"), + numPages: this.pagesCount, + URL: this.url + }; + }, + + async _collectTelemetry(pdfDocument) { + const markInfo = await this.pdfDocument.getMarkInfo(); + + if (pdfDocument !== this.pdfDocument) { + return; + } + + const tagged = markInfo?.Marked || false; + this.externalServices.reportTelemetry({ + type: "tagged", + tagged + }); + }, + async _initializeAutoPrint(pdfDocument, openActionPromise) { - const [openAction, javaScript] = await Promise.all([openActionPromise, pdfDocument.getJavaScript()]); + const [openAction, javaScript] = await Promise.all([openActionPromise, !this.pdfViewer.enableScripting ? pdfDocument.getJavaScript() : null]); if (pdfDocument !== this.pdfDocument) { return; @@ -1225,7 +1516,7 @@ const PDFViewerApplication = { let triggerAutoPrint = false; - if (openAction && openAction.action === "Print") { + if (openAction?.action === "Print") { triggerAutoPrint = true; } @@ -1235,7 +1526,7 @@ const PDFViewerApplication = { return false; } - console.warn("Warning: JavaScript is not supported"); + console.warn("Warning: JavaScript support is not enabled"); this.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.javaScript); return true; }); @@ -1250,14 +1541,8 @@ const PDFViewerApplication = { } } - if (!this.supportsPrinting) { - return; - } - if (triggerAutoPrint) { - setTimeout(function () { - window.print(); - }); + this.triggerPrinting(); } }, @@ -1265,7 +1550,8 @@ const PDFViewerApplication = { const { info, metadata, - contentDispositionFilename + contentDispositionFilename, + contentLength } = await pdfDocument.getMetadata(); if (pdfDocument !== this.pdfDocument) { @@ -1274,16 +1560,11 @@ const PDFViewerApplication = { this.documentInfo = info; this.metadata = metadata; - this.contentDispositionFilename = contentDispositionFilename; - console.log(`PDF ${pdfDocument.fingerprint} [${info.PDFFormatVersion} ` + `${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` + `(PDF.js: ${_pdfjsLib.version || "-"}` + `${this.pdfViewer.enableWebGL ? " [WebGL]" : ""})`); - let pdfTitle; - const infoTitle = info && info.Title; - - if (infoTitle) { - pdfTitle = infoTitle; - } - - const metadataTitle = metadata && metadata.get("dc:title"); + this._contentDispositionFilename ?? (this._contentDispositionFilename = contentDispositionFilename); + this._contentLength ?? (this._contentLength = contentLength); + console.log(`PDF ${pdfDocument.fingerprint} [${info.PDFFormatVersion} ` + `${(info.Producer || "-").trim()} / ${(info.Creator || "-").trim()}] ` + `(PDF.js: ${_pdfjsLib.version || "-"})`); + let pdfTitle = info?.Title; + const metadataTitle = metadata?.get("dc:title"); if (metadataTitle) { if (metadataTitle !== "Untitled" && !/[\uFFF0-\uFFFF]/g.test(metadataTitle)) { @@ -1297,20 +1578,26 @@ const PDFViewerApplication = { this.setTitle(contentDispositionFilename); } - if (info.IsAcroFormPresent) { - console.warn("Warning: AcroForm/XFA is not supported"); + if (info.IsXFAPresent && !info.IsAcroFormPresent && !pdfDocument.isPureXfa) { + console.warn("Warning: XFA is not enabled"); + this.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.forms); + } else if ((info.IsAcroFormPresent || info.IsXFAPresent) && !this.pdfViewer.renderInteractiveForms) { + console.warn("Warning: Interactive form support is not enabled"); this.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.forms); } + if (info.IsSignaturesPresent) { + console.warn("Warning: Digital signatures validation is not supported"); + this.fallback(_pdfjsLib.UNSUPPORTED_FEATURES.signatures); + } + let versionId = "other"; - const KNOWN_VERSIONS = ["1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "2.0", "2.1", "2.2", "2.3"]; if (KNOWN_VERSIONS.includes(info.PDFFormatVersion)) { versionId = `v${info.PDFFormatVersion.replace(".", "_")}`; } let generatorId = "other"; - const KNOWN_GENERATORS = ["acrobat distiller", "acrobat pdfwriter", "adobe livecycle", "adobe pdf library", "adobe photoshop", "ghostscript", "tcpdf", "cairo", "dvipdfm", "dvips", "pdftex", "pdfkit", "itext", "prince", "quarkxpress", "mac os x", "microsoft", "openoffice", "oracle", "luradocument", "pdf-xchange", "antenna house", "aspose.cells", "fpdf"]; if (info.Producer) { const producer = info.Producer.toLowerCase(); @@ -1319,15 +1606,17 @@ const PDFViewerApplication = { return false; } - generatorId = generator.replace(/[ .\-]/g, "_"); + generatorId = generator.replace(/[ .-]/g, "_"); return true; }); } let formType = null; - if (info.IsAcroFormPresent) { - formType = info.IsXFAPresent ? "xfa" : "acroform"; + if (info.IsXFAPresent) { + formType = "xfa"; + } else if (info.IsAcroFormPresent) { + formType = "acroform"; } this.externalServices.reportTelemetry({ @@ -1336,6 +1625,9 @@ const PDFViewerApplication = { generator: generatorId, formType }); + this.eventBus.dispatch("metadataloaded", { + source: this + }); }, async _initializePageLabels(pdfDocument) { @@ -1422,6 +1714,26 @@ const PDFViewerApplication = { } }, + _initializeAnnotationStorageCallbacks(pdfDocument) { + if (pdfDocument !== this.pdfDocument) { + return; + } + + const { + annotationStorage + } = pdfDocument; + + annotationStorage.onSetModified = () => { + window.addEventListener("beforeunload", beforeUnload); + this._annotationStorageModified = true; + }; + + annotationStorage.onResetModified = () => { + window.removeEventListener("beforeunload", beforeUnload); + delete this._annotationStorageModified; + }; + }, + setInitialView(storedHash, { rotation, sidebarView, @@ -1466,47 +1778,50 @@ const PDFViewerApplication = { } }, - cleanup() { + _cleanup() { if (!this.pdfDocument) { return; } this.pdfViewer.cleanup(); this.pdfThumbnailViewer.cleanup(); - - if (this.pdfViewer.renderer !== _ui_utils.RendererType.SVG) { - this.pdfDocument.cleanup(); - } + this.pdfDocument.cleanup(this.pdfViewer.renderer === _ui_utils.RendererType.SVG); }, forceRendering() { - this.pdfRenderingQueue.printing = this.printing; + this.pdfRenderingQueue.printing = !!this.printService; this.pdfRenderingQueue.isThumbnailViewEnabled = this.pdfSidebar.isThumbnailViewVisible; this.pdfRenderingQueue.renderHighestPriority(); }, beforePrint() { + this.pdfScriptingManager.dispatchWillPrint(); + if (this.printService) { return; } if (!this.supportsPrinting) { - this.l10n.get("printing_not_supported", null, "Warning: Printing is not fully supported by this browser.").then(printMessage => { - this.error(printMessage); + this.l10n.get("printing_not_supported").then(msg => { + this._otherError(msg); }); return; } if (!this.pdfViewer.pageViewsReady) { - this.l10n.get("printing_not_ready", null, "Warning: The PDF is not fully loaded for printing.").then(notReadyMessage => { - window.alert(notReadyMessage); + this.l10n.get("printing_not_ready").then(msg => { + window.alert(msg); }); return; } const pagesOverview = this.pdfViewer.getPagesOverview(); const printContainer = this.appConfig.printContainer; - const printService = PDFPrintServiceFactory.instance.createPrintService(this.pdfDocument, pagesOverview, printContainer, this.l10n); + + const printResolution = _app_options.AppOptions.get("printResolution"); + + const optionalContentConfigPromise = this.pdfViewer.optionalContentConfigPromise; + const printService = PDFPrintServiceFactory.instance.createPrintService(this.pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, this.l10n); this.printService = printService; this.forceRendering(); printService.layout(); @@ -1516,21 +1831,22 @@ const PDFViewerApplication = { }, afterPrint() { + this.pdfScriptingManager.dispatchDidPrint(); + if (this.printService) { this.printService.destroy(); this.printService = null; + + if (this.pdfDocument) { + this.pdfDocument.annotationStorage.resetModified(); + } } this.forceRendering(); }, rotatePages(delta) { - if (!this.pdfDocument) { - return; - } - - const newRotation = (this.pdfViewer.pagesRotation + 360 + delta) % 360; - this.pdfViewer.pagesRotation = newRotation; + this.pdfViewer.pagesRotation += delta; }, requestPresentationMode() { @@ -1541,6 +1857,14 @@ const PDFViewerApplication = { this.pdfPresentationMode.request(); }, + triggerPrinting() { + if (!this.supportsPrinting) { + return; + } + + window.print(); + }, + bindEvents() { const { eventBus, @@ -1581,6 +1905,8 @@ const PDFViewerApplication = { eventBus._on("download", webViewerDownload); + eventBus._on("save", webViewerSave); + eventBus._on("firstpage", webViewerFirstPage); eventBus._on("lastpage", webViewerLastPage); @@ -1603,6 +1929,8 @@ const PDFViewerApplication = { eventBus._on("rotateccw", webViewerRotateCcw); + eventBus._on("optionalcontentconfig", webViewerOptionalContentConfig); + eventBus._on("switchscrollmode", webViewerSwitchScrollMode); eventBus._on("scrollmodechanged", webViewerScrollModeChanged); @@ -1621,6 +1949,14 @@ const PDFViewerApplication = { eventBus._on("updatefindcontrolstate", webViewerUpdateFindControlState); + if (_app_options.AppOptions.get("pdfBug")) { + _boundEvents.reportPageStatsPDFBug = reportPageStatsPDFBug; + + eventBus._on("pagerendered", _boundEvents.reportPageStatsPDFBug); + + eventBus._on("pagechanging", _boundEvents.reportPageStatsPDFBug); + } + eventBus._on("fileinputchange", webViewerFileInputChange); eventBus._on("openfile", webViewerOpenFile); @@ -1657,16 +1993,27 @@ const PDFViewerApplication = { }); }; + _boundEvents.windowUpdateFromSandbox = event => { + eventBus.dispatch("updatefromsandbox", { + source: window, + detail: event.detail + }); + }; + window.addEventListener("visibilitychange", webViewerVisibilityChange); window.addEventListener("wheel", webViewerWheel, { passive: false }); + window.addEventListener("touchstart", webViewerTouchStart, { + passive: false + }); 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); + window.addEventListener("updatefromsandbox", _boundEvents.windowUpdateFromSandbox); }, unbindEvents() { @@ -1707,6 +2054,8 @@ const PDFViewerApplication = { eventBus._off("download", webViewerDownload); + eventBus._off("save", webViewerSave); + eventBus._off("firstpage", webViewerFirstPage); eventBus._off("lastpage", webViewerLastPage); @@ -1729,6 +2078,8 @@ const PDFViewerApplication = { eventBus._off("rotateccw", webViewerRotateCcw); + eventBus._off("optionalcontentconfig", webViewerOptionalContentConfig); + eventBus._off("switchscrollmode", webViewerSwitchScrollMode); eventBus._off("scrollmodechanged", webViewerScrollModeChanged); @@ -1747,6 +2098,14 @@ const PDFViewerApplication = { eventBus._off("updatefindcontrolstate", webViewerUpdateFindControlState); + if (_boundEvents.reportPageStatsPDFBug) { + eventBus._off("pagerendered", _boundEvents.reportPageStatsPDFBug); + + eventBus._off("pagechanging", _boundEvents.reportPageStatsPDFBug); + + _boundEvents.reportPageStatsPDFBug = null; + } + eventBus._off("fileinputchange", webViewerFileInputChange); eventBus._off("openfile", webViewerOpenFile); @@ -1763,16 +2122,44 @@ const PDFViewerApplication = { window.removeEventListener("wheel", webViewerWheel, { passive: false }); + window.removeEventListener("touchstart", webViewerTouchStart, { + passive: false + }); 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); + window.removeEventListener("updatefromsandbox", _boundEvents.windowUpdateFromSandbox); _boundEvents.windowResize = null; _boundEvents.windowHashChange = null; _boundEvents.windowBeforePrint = null; _boundEvents.windowAfterPrint = null; + _boundEvents.windowUpdateFromSandbox = null; + }, + + accumulateWheelTicks(ticks) { + if (this._wheelUnusedTicks > 0 && ticks < 0 || this._wheelUnusedTicks < 0 && ticks > 0) { + this._wheelUnusedTicks = 0; + } + + this._wheelUnusedTicks += ticks; + const wholeTicks = Math.sign(this._wheelUnusedTicks) * Math.floor(Math.abs(this._wheelUnusedTicks)); + this._wheelUnusedTicks -= wholeTicks; + return wholeTicks; + }, + + _unblockDocumentLoadEvent() { + if (document.blockUnblockOnload) { + document.blockUnblockOnload(false); + } + + this._unblockDocumentLoadEvent = () => {}; + }, + + get scriptingReady() { + return this.pdfScriptingManager.ready; } }; @@ -1802,10 +2189,9 @@ let validateFileURL; throw new Error("file origin does not match viewer's"); } } catch (ex) { - const message = ex && ex.message; - PDFViewerApplication.l10n.get("loading_error", null, "An error occurred while loading the PDF.").then(loadingErrorMessage => { - PDFViewerApplication.error(loadingErrorMessage, { - message + PDFViewerApplication.l10n.get("loading_error").then(msg => { + PDFViewerApplication._documentError(msg, { + message: ex?.message }); }); throw ex; @@ -1831,6 +2217,23 @@ function loadAndEnablePDFBug(enabledTabs) { }); } +function reportPageStatsPDFBug({ + pageNumber +}) { + if (typeof Stats === "undefined" || !Stats.enabled) { + return; + } + + const pageView = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1); + const pageStats = pageView?.pdfPage?.stats; + + if (!pageStats) { + return; + } + + Stats.add(pageNumber, pageStats); +} + function webViewerInitialized() { const appConfig = PDFViewerApplication.appConfig; let file; @@ -1846,8 +2249,8 @@ function webViewerInitialized() { 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"); + appConfig.toolbar.openFile.hidden = true; + appConfig.secondaryToolbar.openFileButton.hidden = true; } else { fileInput.value = null; } @@ -1885,7 +2288,7 @@ function webViewerInitialized() { if (!PDFViewerApplication.supportsDocumentFonts) { _app_options.AppOptions.set("disableFontFace", true); - PDFViewerApplication.l10n.get("web_fonts_disabled", null, "Web fonts are disabled: unable to use embedded PDF fonts.").then(msg => { + PDFViewerApplication.l10n.get("web_fonts_disabled").then(msg => { console.warn(msg); }); } @@ -1915,33 +2318,16 @@ function webViewerInitialized() { try { webViewerOpenFileViaURL(file); } catch (reason) { - PDFViewerApplication.l10n.get("loading_error", null, "An error occurred while loading the PDF.").then(msg => { - PDFViewerApplication.error(msg, reason); + PDFViewerApplication.l10n.get("loading_error").then(msg => { + PDFViewerApplication._documentError(msg, reason); }); } } -let webViewerOpenFileViaURL; -{ - webViewerOpenFileViaURL = function (file) { - if (file && file.lastIndexOf("file:", 0) === 0) { - PDFViewerApplication.setTitleUsingUrl(file); - const 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 webViewerOpenFileViaURL(file) { + if (file) { + PDFViewerApplication.open(file); + } } function webViewerResetPermissions() { @@ -1956,37 +2342,33 @@ function webViewerResetPermissions() { appConfig.viewerContainer.classList.remove(ENABLE_PERMISSIONS_CLASS); } -function webViewerPageRendered(evt) { - const pageNumber = evt.pageNumber; - const pageIndex = pageNumber - 1; - const pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex); - +function webViewerPageRendered({ + pageNumber, + timestamp, + error +}) { if (pageNumber === PDFViewerApplication.page) { PDFViewerApplication.toolbar.updateLoadingIndicatorState(false); } - if (!pageView) { - return; - } - if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { - const thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageIndex); - thumbnailView.setImage(pageView); + const pageView = PDFViewerApplication.pdfViewer.getPageView(pageNumber - 1); + const thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(pageNumber - 1); + + if (pageView && thumbnailView) { + 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(msg => { - PDFViewerApplication.error(msg, pageView.error); + if (error) { + PDFViewerApplication.l10n.get("rendering_error").then(msg => { + PDFViewerApplication._otherError(msg, error); }); } PDFViewerApplication.externalServices.reportTelemetry({ type: "pageInfo", - timestamp: evt.timestamp + timestamp }); PDFViewerApplication.pdfDocument.getStats().then(function (stats) { PDFViewerApplication.externalServices.reportTelemetry({ @@ -2003,20 +2385,24 @@ function webViewerPageMode({ switch (mode) { case "thumbs": - view = _pdf_sidebar.SidebarView.THUMBS; + view = _ui_utils.SidebarView.THUMBS; break; case "bookmarks": case "outline": - view = _pdf_sidebar.SidebarView.OUTLINE; + view = _ui_utils.SidebarView.OUTLINE; break; case "attachments": - view = _pdf_sidebar.SidebarView.ATTACHMENTS; + view = _ui_utils.SidebarView.ATTACHMENTS; + break; + + case "layers": + view = _ui_utils.SidebarView.LAYERS; break; case "none": - view = _pdf_sidebar.SidebarView.NONE; + view = _ui_utils.SidebarView.NONE; break; default: @@ -2028,9 +2414,7 @@ function webViewerPageMode({ } function webViewerNamedAction(evt) { - const action = evt.action; - - switch (action) { + switch (evt.action) { case "GoToPage": PDFViewerApplication.appConfig.toolbar.pageNumber.select(); break; @@ -2041,22 +2425,19 @@ function webViewerNamedAction(evt) { } break; + + case "Print": + PDFViewerApplication.triggerPrinting(); + break; + + case "SaveAs": + webViewerSave(); + break; } } -function webViewerPresentationModeChanged({ - active, - switchInProgress -}) { - let state = _ui_utils.PresentationModeState.NORMAL; - - if (switchInProgress) { - state = _ui_utils.PresentationModeState.CHANGING; - } else if (active) { - state = _ui_utils.PresentationModeState.FULLSCREEN; - } - - PDFViewerApplication.pdfViewer.presentationModeState = state; +function webViewerPresentationModeChanged(evt) { + PDFViewerApplication.pdfViewer.presentationModeState = evt.state; } function webViewerSidebarViewChanged(evt) { @@ -2086,7 +2467,7 @@ function webViewerUpdateViewarea(evt) { PDFViewerApplication.appConfig.toolbar.viewBookmark.href = href; PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href = href; const currentPage = PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page - 1); - const loading = currentPage.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED; + const loading = currentPage?.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED; PDFViewerApplication.toolbar.updateLoadingIndicatorState(loading); } @@ -2142,13 +2523,13 @@ function webViewerHashchange(evt) { let webViewerFileInputChange, webViewerOpenFile; { webViewerFileInputChange = function (evt) { - if (PDFViewerApplication.pdfViewer && PDFViewerApplication.pdfViewer.isInPresentationMode) { + if (PDFViewerApplication.pdfViewer?.isInPresentationMode) { return; } const file = evt.fileInput.files[0]; - if (!_app_options.AppOptions.get("disableCreateObjectURL")) { + if (!_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) { let url = URL.createObjectURL(file); if (file.name) { @@ -2172,10 +2553,10 @@ let webViewerFileInputChange, webViewerOpenFile; } const 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"); + appConfig.toolbar.viewBookmark.hidden = true; + appConfig.secondaryToolbar.viewBookmarkButton.hidden = true; + appConfig.toolbar.download.hidden = true; + appConfig.secondaryToolbar.downloadButton.hidden = true; }; webViewerOpenFile = function (evt) { @@ -2189,11 +2570,19 @@ function webViewerPresentationMode() { } function webViewerPrint() { - window.print(); + PDFViewerApplication.triggerPrinting(); } function webViewerDownload() { - PDFViewerApplication.download(); + PDFViewerApplication.downloadOrSave({ + sourceEventType: "download" + }); +} + +function webViewerSave() { + PDFViewerApplication.downloadOrSave({ + sourceEventType: "save" + }); } function webViewerFirstPage() { @@ -2209,11 +2598,11 @@ function webViewerLastPage() { } function webViewerNextPage() { - PDFViewerApplication.page++; + PDFViewerApplication.pdfViewer.nextPage(); } function webViewerPreviousPage() { - PDFViewerApplication.page--; + PDFViewerApplication.pdfViewer.previousPage(); } function webViewerZoomIn() { @@ -2232,7 +2621,7 @@ function webViewerPageNumberChanged(evt) { const pdfViewer = PDFViewerApplication.pdfViewer; if (evt.value !== "") { - pdfViewer.currentPageLabel = evt.value; + PDFViewerApplication.pdfLinkService.goToPage(evt.value); } if (evt.value !== pdfViewer.currentPageNumber.toString() && evt.value !== pdfViewer.currentPageLabel) { @@ -2252,6 +2641,10 @@ function webViewerRotateCcw() { PDFViewerApplication.rotatePages(-90); } +function webViewerOptionalContentConfig(evt) { + PDFViewerApplication.pdfViewer.optionalContentConfigPromise = evt.promise; +} + function webViewerSwitchScrollMode(evt) { PDFViewerApplication.pdfViewer.scrollMode = evt.mode; } @@ -2299,13 +2692,15 @@ function webViewerUpdateFindMatchesCount({ function webViewerUpdateFindControlState({ state, previous, - matchesCount + matchesCount, + rawQuery }) { if (PDFViewerApplication.supportsIntegratedFind) { PDFViewerApplication.externalServices.updateFindControlState({ result: state, findPrevious: previous, - matchesCount + matchesCount, + rawQuery }); } else { PDFViewerApplication.findBar.updateUIState(state, previous, matchesCount); @@ -2323,21 +2718,15 @@ function webViewerRotationChanging(evt) { PDFViewerApplication.pdfViewer.currentPageNumber = evt.pageNumber; } -function webViewerPageChanging(evt) { - const page = evt.pageNumber; - PDFViewerApplication.toolbar.setPageNumber(page, evt.pageLabel || null); - PDFViewerApplication.secondaryToolbar.setPageNumber(page); +function webViewerPageChanging({ + pageNumber, + pageLabel +}) { + PDFViewerApplication.toolbar.setPageNumber(pageNumber, pageLabel); + PDFViewerApplication.secondaryToolbar.setPageNumber(pageNumber); if (PDFViewerApplication.pdfSidebar.isThumbnailViewVisible) { - PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page); - } - - if (typeof Stats !== "undefined" && Stats.enabled) { - const pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1); - - if (pageView && pageView.stats) { - Stats.add(page, pageView.stats); - } + PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(pageNumber); } } @@ -2377,13 +2766,23 @@ function webViewerWheel(evt) { } const previousScale = pdfViewer.currentScale; - const delta = (0, _ui_utils.normalizeWheelEventDelta)(evt); - const MOUSE_WHEEL_DELTA_PER_PAGE_SCALE = 3.0; - const ticks = delta * MOUSE_WHEEL_DELTA_PER_PAGE_SCALE; + const delta = (0, _ui_utils.normalizeWheelEventDirection)(evt); + let ticks = 0; + + if (evt.deltaMode === WheelEvent.DOM_DELTA_LINE || evt.deltaMode === WheelEvent.DOM_DELTA_PAGE) { + if (Math.abs(delta) >= 1) { + ticks = Math.sign(delta); + } else { + ticks = PDFViewerApplication.accumulateWheelTicks(delta); + } + } else { + const PIXELS_PER_LINE_SCALE = 30; + ticks = PDFViewerApplication.accumulateWheelTicks(delta / PIXELS_PER_LINE_SCALE); + } if (ticks < 0) { PDFViewerApplication.zoomOut(-ticks); - } else { + } else if (ticks > 0) { PDFViewerApplication.zoomIn(ticks); } @@ -2402,6 +2801,12 @@ function webViewerWheel(evt) { } } +function webViewerTouchStart(evt) { + if (evt.touches.length > 1) { + evt.preventDefault(); + } +} + function webViewerClick(evt) { if (!PDFViewerApplication.secondaryToolbar.isOpen) { return; @@ -2423,12 +2828,12 @@ function webViewerKeyDown(evt) { ensureViewerFocused = false; const cmd = (evt.ctrlKey ? 1 : 0) | (evt.altKey ? 2 : 0) | (evt.shiftKey ? 4 : 0) | (evt.metaKey ? 8 : 0); const pdfViewer = PDFViewerApplication.pdfViewer; - const isViewerInPresentationMode = pdfViewer && pdfViewer.isInPresentationMode; + const isViewerInPresentationMode = pdfViewer?.isInPresentationMode; if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) { switch (evt.keyCode) { case 70: - if (!PDFViewerApplication.supportsIntegratedFind) { + if (!PDFViewerApplication.supportsIntegratedFind && !evt.shiftKey) { PDFViewerApplication.findBar.open(); handled = true; } @@ -2554,10 +2959,10 @@ function webViewerKeyDown(evt) { return; } - const curElement = document.activeElement || document.querySelector(":focus"); - const curElementTagName = curElement && curElement.tagName.toUpperCase(); + const curElement = (0, _ui_utils.getActiveOrFocusedElement)(); + const curElementTagName = curElement?.tagName.toUpperCase(); - if (curElementTagName === "INPUT" || curElementTagName === "TEXTAREA" || curElementTagName === "SELECT" || curElement && curElement.isContentEditable) { + if (curElementTagName === "INPUT" || curElementTagName === "TEXTAREA" || curElementTagName === "SELECT" || curElement?.isContentEditable) { if (evt.keyCode !== 27) { return; } @@ -2673,13 +3078,9 @@ function webViewerKeyDown(evt) { if (turnPage !== 0 && (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === "page-fit")) { if (turnPage > 0) { - if (PDFViewerApplication.page < PDFViewerApplication.pagesCount) { - PDFViewerApplication.page++; - } + pdfViewer.nextPage(); } else { - if (PDFViewerApplication.page > 1) { - PDFViewerApplication.page--; - } + pdfViewer.previousPage(); } handled = true; @@ -2722,42 +3123,10 @@ function webViewerKeyDown(evt) { } } -function apiPageLayoutToSpreadMode(layout) { - switch (layout) { - case "SinglePage": - case "OneColumn": - return _ui_utils.SpreadMode.NONE; - - case "TwoColumnLeft": - case "TwoPageLeft": - return _ui_utils.SpreadMode.ODD; - - case "TwoColumnRight": - case "TwoPageRight": - return _ui_utils.SpreadMode.EVEN; - } - - return _ui_utils.SpreadMode.NONE; -} - -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; +function beforeUnload(evt) { + evt.preventDefault(); + evt.returnValue = ""; + return false; } const PDFPrintServiceFactory = { @@ -2773,36 +3142,37 @@ const PDFPrintServiceFactory = { exports.PDFPrintServiceFactory = PDFPrintServiceFactory; /***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 4 */ +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.apiPageLayoutToSpreadMode = apiPageLayoutToSpreadMode; +exports.apiPageModeToSidebarView = apiPageModeToSidebarView; +exports.approximateFraction = approximateFraction; +exports.backtrackBeforeAllVisibleElements = backtrackBeforeAllVisibleElements; +exports.binarySearchFirstItem = binarySearchFirstItem; +exports.getActiveOrFocusedElement = getActiveOrFocusedElement; +exports.getOutputScale = getOutputScale; +exports.getPageSizeInches = getPageSizeInches; +exports.getVisibleElements = getVisibleElements; +exports.isPortraitOrientation = isPortraitOrientation; exports.isValidRotation = isValidRotation; exports.isValidScrollMode = isValidScrollMode; exports.isValidSpreadMode = isValidSpreadMode; -exports.isPortraitOrientation = isPortraitOrientation; -exports.clamp = clamp; -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 = exports.AutoPrintRegExp = void 0; +exports.noContextMenuHandler = noContextMenuHandler; +exports.normalizeWheelEventDelta = normalizeWheelEventDelta; +exports.normalizeWheelEventDirection = normalizeWheelEventDirection; +exports.parseQueryString = parseQueryString; +exports.roundToDivide = roundToDivide; +exports.scrollIntoView = scrollIntoView; +exports.waitOnEventOrTimeout = waitOnEventOrTimeout; +exports.watchScroll = watchScroll; +exports.WaitOnType = exports.VERTICAL_PADDING = exports.UNKNOWN_SCALE = exports.TextLayerMode = exports.SpreadMode = exports.SidebarView = exports.ScrollMode = exports.SCROLLBAR_PADDING = exports.RendererType = exports.ProgressBar = exports.PresentationModeState = exports.MIN_SCALE = exports.MAX_SCALE = exports.MAX_AUTO_SCALE = exports.EventBus = exports.DEFAULT_SCALE_VALUE = exports.DEFAULT_SCALE = exports.CSS_UNITS = exports.AutoPrintRegExp = exports.animationStarted = void 0; const CSS_UNITS = 96.0 / 72.0; exports.CSS_UNITS = CSS_UNITS; const DEFAULT_SCALE_VALUE = "auto"; @@ -2821,6 +3191,7 @@ const SCROLLBAR_PADDING = 40; exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING; const VERTICAL_PADDING = 5; exports.VERTICAL_PADDING = VERTICAL_PADDING; +const LOADINGBAR_END_OFFSET_VAR = "--loadingBar-end-offset"; const PresentationModeState = { UNKNOWN: 0, NORMAL: 1, @@ -2828,6 +3199,15 @@ const PresentationModeState = { FULLSCREEN: 3 }; exports.PresentationModeState = PresentationModeState; +const SidebarView = { + UNKNOWN: -1, + NONE: 0, + THUMBS: 1, + OUTLINE: 2, + ATTACHMENTS: 3, + LAYERS: 4 +}; +exports.SidebarView = SidebarView; const RendererType = { CANVAS: "canvas", SVG: "svg" @@ -2856,37 +3236,9 @@ exports.SpreadMode = SpreadMode; const AutoPrintRegExp = /\bprint\s*\(/; exports.AutoPrintRegExp = AutoPrintRegExp; -function formatL10nValue(text, args) { - if (!args) { - return text; - } - - return text.replace(/\{\{\s*(\w+)\s*\}\}/g, (all, name) => { - return name in args ? args[name] : "{{" + name + "}}"; - }); -} - -const NullL10n = { - async getLanguage() { - return "en-us"; - }, - - async getDirection() { - return "ltr"; - }, - - async get(property, args, fallback) { - return formatL10nValue(fallback, args); - }, - - async translate(element) {} - -}; -exports.NullL10n = NullL10n; - function getOutputScale(ctx) { const devicePixelRatio = window.devicePixelRatio || 1; - const backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1; + const backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.backingStorePixelRatio || 1; const pixelRatio = devicePixelRatio / backingStoreRatio; return { sx: pixelRatio, @@ -3109,7 +3461,13 @@ function backtrackBeforeAllVisibleElements(index, views, top) { return index; } -function getVisibleElements(scrollEl, views, sortByVisibility = false, horizontal = false) { +function getVisibleElements({ + scrollEl, + views, + sortByVisibility = false, + horizontal = false, + rtl = false +}) { const top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight; const left = scrollEl.scrollLeft, @@ -3121,15 +3479,16 @@ function getVisibleElements(scrollEl, views, sortByVisibility = false, horizonta return elementBottom > top; } - function isElementRightAfterViewLeft(view) { + function isElementNextAfterViewHorizontally(view) { const element = view.div; - const elementRight = element.offsetLeft + element.clientLeft + element.clientWidth; - return elementRight > left; + const elementLeft = element.offsetLeft + element.clientLeft; + const elementRight = elementLeft + element.clientWidth; + return rtl ? elementLeft < right : elementRight > left; } const visible = [], numViews = views.length; - let firstVisibleElementInd = numViews === 0 ? 0 : binarySearchFirstItem(views, horizontal ? isElementRightAfterViewLeft : isElementBottomAfterViewTop); + let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop); if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) { firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top); @@ -3161,13 +3520,16 @@ function getVisibleElements(scrollEl, views, sortByVisibility = false, horizonta const hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom); const hiddenWidth = Math.max(0, left - currentWidth) + Math.max(0, viewRight - right); - const percent = (viewHeight - hiddenHeight) * (viewWidth - hiddenWidth) * 100 / viewHeight / viewWidth | 0; + const fractionHeight = (viewHeight - hiddenHeight) / viewHeight, + fractionWidth = (viewWidth - hiddenWidth) / viewWidth; + const percent = fractionHeight * fractionWidth * 100 | 0; visible.push({ id: view.id, x: currentWidth, y: currentHeight, view, - percent + percent, + widthPercent: fractionWidth * 100 | 0 }); } @@ -3197,53 +3559,19 @@ function noContextMenuHandler(evt) { evt.preventDefault(); } -function isDataSchema(url) { - let i = 0; - const ii = url.length; - - while (i < ii && url[i].trim() === "") { - i++; - } - - return url.substring(i, i + 5).toLowerCase() === "data:"; -} - -function getPDFFileNameFromURL(url, defaultFilename = "document.pdf") { - if (typeof url !== "string") { - return defaultFilename; - } - - if (isDataSchema(url)) { - console.warn("getPDFFileNameFromURL: " + 'ignoring "data:" URL for performance reasons.'); - return defaultFilename; - } - - const reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/; - const reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i; - const splitURI = reURI.exec(url); - let 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) { - let delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY); +function normalizeWheelEventDirection(evt) { + let delta = Math.hypot(evt.deltaX, evt.deltaY); const angle = Math.atan2(evt.deltaY, evt.deltaX); if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) { delta = -delta; } + return delta; +} + +function normalizeWheelEventDelta(evt) { + let delta = normalizeWheelEventDirection(evt); const MOUSE_DOM_DELTA_PIXEL_MODE = 0; const MOUSE_DOM_DELTA_LINE_MODE = 1; const MOUSE_PIXELS_PER_LINE = 30; @@ -3331,15 +3659,17 @@ class EventBus { this._listeners = Object.create(null); } - on(eventName, listener) { + on(eventName, listener, options = null) { this._on(eventName, listener, { - external: true + external: true, + once: options?.once }); } - off(eventName, listener) { + off(eventName, listener, options = null) { this._off(eventName, listener, { - external: true + external: true, + once: options?.once }); } @@ -3352,40 +3682,41 @@ class EventBus { const args = Array.prototype.slice.call(arguments, 1); let externalListeners; - eventListeners.slice(0).forEach(function ({ - listener, - external - }) { - if (external) { - if (!externalListeners) { - externalListeners = []; - } - externalListeners.push(listener); - return; + for (const { + listener, + external, + once + } of eventListeners.slice(0)) { + if (once) { + this._off(eventName, listener); + } + + if (external) { + (externalListeners || (externalListeners = [])).push(listener); + continue; } listener.apply(null, args); - }); + } if (externalListeners) { - externalListeners.forEach(function (listener) { + for (const listener of externalListeners) { listener.apply(null, args); - }); + } + externalListeners = null; } } _on(eventName, listener, options = null) { - let eventListeners = this._listeners[eventName]; - - if (!eventListeners) { - this._listeners[eventName] = eventListeners = []; - } + var _this$_listeners; + const eventListeners = (_this$_listeners = this._listeners)[eventName] || (_this$_listeners[eventName] = []); eventListeners.push({ listener, - external: (options && options.external) === true + external: options?.external === true, + once: options?.once === true }); } @@ -3460,7 +3791,8 @@ class ProgressBar { const scrollbarWidth = container.offsetWidth - viewer.offsetWidth; if (scrollbarWidth > 0) { - this.bar.style.width = `calc(100% - ${scrollbarWidth}px)`; + const doc = document.documentElement; + doc.style.setProperty(LOADINGBAR_END_OFFSET_VAR, `${scrollbarWidth}px`); } } @@ -3471,7 +3803,6 @@ class ProgressBar { this.visible = false; this.bar.classList.add("hidden"); - document.body.classList.remove("loadingInProgress"); } show() { @@ -3480,7 +3811,6 @@ class ProgressBar { } this.visible = true; - document.body.classList.add("loadingInProgress"); this.bar.classList.remove("hidden"); } @@ -3507,304 +3837,61 @@ function moveToEndOfArray(arr, condition) { } } -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { +function getActiveOrFocusedElement() { + let curRoot = document; + let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus"); -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.OptionKind = exports.AppOptions = void 0; - -var _viewer_compatibility = __webpack_require__(4); - -const OptionKind = { - VIEWER: 0x02, - API: 0x04, - WORKER: 0x08, - PREFERENCE: 0x80 -}; -exports.OptionKind = OptionKind; -const defaultOptions = { - cursorToolOnLoad: { - value: 0, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - defaultUrl: { - value: "compressed.tracemonkey-pldi-09.pdf", - kind: OptionKind.VIEWER - }, - defaultZoomValue: { - value: "", - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - disableCreateObjectURL: { - value: false, - compatibility: _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL, - kind: OptionKind.VIEWER - }, - disableHistory: { - value: false, - kind: OptionKind.VIEWER - }, - disablePageLabels: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - enablePermissions: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - enablePrintAutoRotate: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - enableWebGL: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - externalLinkRel: { - value: "noopener noreferrer nofollow", - kind: OptionKind.VIEWER - }, - externalLinkTarget: { - value: 0, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - historyUpdateUrl: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - ignoreDestinationZoom: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - imageResourcesPath: { - value: "./images/", - kind: OptionKind.VIEWER - }, - maxCanvasPixels: { - value: 16777216, - compatibility: _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels, - kind: OptionKind.VIEWER - }, - pdfBugEnabled: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - printResolution: { - value: 150, - kind: OptionKind.VIEWER - }, - renderer: { - value: "canvas", - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - renderInteractiveForms: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - sidebarViewOnLoad: { - value: -1, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - scrollModeOnLoad: { - value: -1, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - spreadModeOnLoad: { - value: -1, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - textLayerMode: { - value: 1, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - useOnlyCssZoom: { - value: false, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - viewOnLoad: { - value: 0, - kind: OptionKind.VIEWER + OptionKind.PREFERENCE - }, - cMapPacked: { - value: true, - kind: OptionKind.API - }, - cMapUrl: { - value: "../web/cmaps/", - kind: OptionKind.API - }, - disableAutoFetch: { - value: false, - kind: OptionKind.API + OptionKind.PREFERENCE - }, - disableFontFace: { - value: false, - kind: OptionKind.API + OptionKind.PREFERENCE - }, - disableRange: { - value: false, - kind: OptionKind.API + OptionKind.PREFERENCE - }, - disableStream: { - value: false, - kind: OptionKind.API + OptionKind.PREFERENCE - }, - docBaseUrl: { - value: "", - kind: OptionKind.API - }, - fontExtraProperties: { - value: false, - kind: OptionKind.API - }, - isEvalSupported: { - value: true, - kind: OptionKind.API - }, - maxImageSize: { - value: -1, - kind: OptionKind.API - }, - pdfBug: { - value: false, - kind: OptionKind.API - }, - verbosity: { - value: 1, - kind: OptionKind.API - }, - workerPort: { - value: null, - kind: OptionKind.WORKER - }, - workerSrc: { - value: "../build/pdf.worker.js", - kind: OptionKind.WORKER - } -}; -{ - defaultOptions.disablePreferences = { - value: false, - kind: OptionKind.VIEWER - }; - defaultOptions.locale = { - value: typeof navigator !== "undefined" ? navigator.language : "en-US", - kind: OptionKind.VIEWER - }; -} -const userOptions = Object.create(null); - -class AppOptions { - constructor() { - throw new Error("Cannot initialize AppOptions."); - } - - static get(name) { - const userOption = userOptions[name]; - - if (userOption !== undefined) { - return userOption; - } - - const defaultOption = defaultOptions[name]; - - if (defaultOption !== undefined) { - return defaultOption.compatibility || defaultOption.value; - } - - return undefined; - } - - static getAll(kind = null) { - const options = Object.create(null); - - for (const name in defaultOptions) { - const defaultOption = defaultOptions[name]; - - if (kind) { - if ((kind & defaultOption.kind) === 0) { - continue; - } - - if (kind === OptionKind.PREFERENCE) { - const value = defaultOption.value, - valueType = typeof value; - - if (valueType === "boolean" || valueType === "string" || valueType === "number" && Number.isInteger(value)) { - options[name] = value; - continue; - } - - throw new Error(`Invalid type for preference: ${name}`); - } - } - - const userOption = userOptions[name]; - options[name] = userOption !== undefined ? userOption : defaultOption.compatibility || defaultOption.value; - } - - return options; - } - - static set(name, value) { - userOptions[name] = value; - } - - static remove(name) { - delete userOptions[name]; + while (curActiveOrFocused?.shadowRoot) { + curRoot = curActiveOrFocused.shadowRoot; + curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus"); } + return curActiveOrFocused; } -exports.AppOptions = AppOptions; +function apiPageLayoutToSpreadMode(layout) { + switch (layout) { + case "SinglePage": + case "OneColumn": + return SpreadMode.NONE; -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { + case "TwoColumnLeft": + case "TwoPageLeft": + return SpreadMode.ODD; -"use strict"; + case "TwoColumnRight": + case "TwoPageRight": + return SpreadMode.EVEN; + } - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.viewerCompatibilityParams = void 0; -const compatibilityParams = Object.create(null); -{ - const userAgent = typeof navigator !== "undefined" && navigator.userAgent || ""; - const platform = typeof navigator !== "undefined" && navigator.platform || ""; - const maxTouchPoints = typeof navigator !== "undefined" && navigator.maxTouchPoints || 1; - const isAndroid = /Android/.test(userAgent); - const isIE = /Trident/.test(userAgent); - const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1; - const isIOSChrome = /CriOS/.test(userAgent); - - (function checkOnBlobSupport() { - if (isIE || isIOSChrome) { - compatibilityParams.disableCreateObjectURL = true; - } - })(); - - (function checkCanvasSizeLimitation() { - if (isIOS || isAndroid) { - compatibilityParams.maxCanvasPixels = 5242880; - } - })(); + return SpreadMode.NONE; +} + +function apiPageModeToSidebarView(mode) { + switch (mode) { + case "UseNone": + return SidebarView.NONE; + + case "UseThumbs": + return SidebarView.THUMBS; + + case "UseOutlines": + return SidebarView.OUTLINE; + + case "UseAttachments": + return SidebarView.ATTACHMENTS; + + case "UseOC": + return SidebarView.LAYERS; + } + + return SidebarView.NONE; } -const viewerCompatibilityParams = Object.freeze(compatibilityParams); -exports.viewerCompatibilityParams = viewerCompatibilityParams; /***/ }), /* 5 */ -/***/ (function(module, exports, __webpack_require__) { +/***/ ((module) => { -"use strict"; let pdfjsLib; @@ -3819,18 +3906,19 @@ module.exports = pdfjsLib; /***/ }), /* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFCursorTools = exports.CursorTool = void 0; var _grab_to_pan = __webpack_require__(7); +var _ui_utils = __webpack_require__(4); + const CursorTool = { SELECT: 0, HAND: 1, @@ -3919,20 +4007,22 @@ class PDFCursorTools { }); this.eventBus._on("presentationmodechanged", evt => { - if (evt.switchInProgress) { - return; - } + switch (evt.state) { + case _ui_utils.PresentationModeState.FULLSCREEN: + { + const previouslyActive = this.active; + this.switchTool(CursorTool.SELECT); + this.activeBeforePresentationMode = previouslyActive; + break; + } - let previouslyActive; - - if (evt.active) { - previouslyActive = this.active; - this.switchTool(CursorTool.SELECT); - this.activeBeforePresentationMode = previouslyActive; - } else { - previouslyActive = this.activeBeforePresentationMode; - this.activeBeforePresentationMode = null; - this.switchTool(previouslyActive); + case _ui_utils.PresentationModeState.NORMAL: + { + const previouslyActive = this.activeBeforePresentationMode; + this.activeBeforePresentationMode = null; + this.switchTool(previouslyActive); + break; + } } }); } @@ -3943,14 +4033,13 @@ exports.PDFCursorTools = PDFCursorTools; /***/ }), /* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.GrabToPan = GrabToPan; function GrabToPan(options) { @@ -4007,7 +4096,7 @@ GrabToPan.prototype = { } }, ignoreTarget: function GrabToPan_ignoreTarget(node) { - return node[matchesSelector]("a[href], a[href] *, input, textarea, button, button *, select, option"); + return node.matches("a[href], a[href] *, input, textarea, button, button *, select, option"); }, _onmousedown: function GrabToPan__onmousedown(event) { if (event.button !== 0 || this.ignoreTarget(event.target)) { @@ -4073,32 +4162,16 @@ GrabToPan.prototype = { this.overlay.remove(); } }; -let matchesSelector; -["webkitM", "mozM", "msM", "oM", "m"].some(function (prefix) { - let name = prefix + "atches"; - - if (name in document.documentElement) { - matchesSelector = name; - } - - name += "Selector"; - - if (name in document.documentElement) { - matchesSelector = name; - } - - return matchesSelector; -}); -const isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9; -const chrome = window.chrome; -const isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app); -const isSafari6plus = /Apple/.test(navigator.vendor) && /Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent); function isLeftMouseReleased(event) { - if ("buttons" in event && isNotIEorIsIE10plus) { + if ("buttons" in event) { return !(event.buttons & 1); } + const chrome = window.chrome; + const isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app); + const isSafari6plus = /Apple/.test(navigator.vendor) && /Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent); + if (isChrome15OrOpera15plus || isSafari6plus) { return event.which === 0; } @@ -4108,15 +4181,17 @@ function isLeftMouseReleased(event) { /***/ }), /* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.PDFRenderingQueue = exports.RenderingStates = void 0; +})); +exports.RenderingStates = exports.PDFRenderingQueue = void 0; + +var _pdfjsLib = __webpack_require__(5); + const CLEANUP_TIMEOUT = 30000; const RenderingStates = { INITIAL: 0, @@ -4230,6 +4305,10 @@ class PDFRenderingQueue { view.draw().finally(() => { this.renderHighestPriority(); }).catch(reason => { + if (reason instanceof _pdfjsLib.RenderingCancelledException) { + return; + } + console.error(`renderView: "${reason}"`); }); break; @@ -4244,396 +4323,13 @@ exports.PDFRenderingQueue = PDFRenderingQueue; /***/ }), /* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.PDFSidebar = exports.SidebarView = void 0; - -var _ui_utils = __webpack_require__(2); - -var _pdf_rendering_queue = __webpack_require__(8); - -const UI_NOTIFICATION_CLASS = "pdfSidebarNotification"; -const SidebarView = { - UNKNOWN: -1, - NONE: 0, - THUMBS: 1, - OUTLINE: 2, - ATTACHMENTS: 3, - LAYERS: 4 -}; -exports.SidebarView = SidebarView; - -class PDFSidebar { - constructor({ - elements, - pdfViewer, - pdfThumbnailViewer, - eventBus, - l10n = _ui_utils.NullL10n, - disableNotification = false - }) { - this.isOpen = false; - this.active = SidebarView.THUMBS; - this.isInitialViewSet = false; - this.onToggled = null; - this.pdfViewer = pdfViewer; - this.pdfThumbnailViewer = pdfThumbnailViewer; - this.outerContainer = elements.outerContainer; - this.viewerContainer = elements.viewerContainer; - this.toggleButton = elements.toggleButton; - this.thumbnailButton = elements.thumbnailButton; - this.outlineButton = elements.outlineButton; - this.attachmentsButton = elements.attachmentsButton; - this.thumbnailView = elements.thumbnailView; - this.outlineView = elements.outlineView; - this.attachmentsView = elements.attachmentsView; - this.eventBus = eventBus; - this.l10n = l10n; - this._disableNotification = disableNotification; - - this._addEventListeners(); - } - - reset() { - this.isInitialViewSet = false; - - this._hideUINotification(null); - - this.switchView(SidebarView.THUMBS); - this.outlineButton.disabled = false; - this.attachmentsButton.disabled = false; - } - - get visibleView() { - return this.isOpen ? this.active : SidebarView.NONE; - } - - get isThumbnailViewVisible() { - return this.isOpen && this.active === SidebarView.THUMBS; - } - - get isOutlineViewVisible() { - return this.isOpen && this.active === SidebarView.OUTLINE; - } - - get isAttachmentsViewVisible() { - return this.isOpen && this.active === SidebarView.ATTACHMENTS; - } - - setInitialView(view = 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(); - } - } - - switchView(view, forceOpen = false) { - this._switchView(view, forceOpen); - } - - _switchView(view, forceOpen = false) { - const isViewChanged = view !== this.active; - let 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: "${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; - } - - 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); - } - - 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(); - } - - toggle() { - if (this.isOpen) { - this.close(); - } else { - this.open(); - } - } - - _dispatchEvent() { - this.eventBus.dispatch("sidebarviewchanged", { - source: this, - view: this.visibleView - }); - } - - _forceRendering() { - if (this.onToggled) { - this.onToggled(); - } else { - this.pdfViewer.forceRendering(); - this.pdfThumbnailViewer.forceRendering(); - } - } - - _updateThumbnailViewer() { - const { - pdfViewer, - pdfThumbnailViewer - } = this; - const pagesCount = pdfViewer.pagesCount; - - for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) { - const pageView = pdfViewer.getPageView(pageIndex); - - if (pageView && pageView.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) { - const thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex); - thumbnailView.setImage(pageView); - } - } - - pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber); - } - - _showUINotification(view) { - if (this._disableNotification) { - return; - } - - this.l10n.get("toggle_sidebar_notification.title", null, "Toggle Sidebar (document contains outline/attachments)").then(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; - } - } - - _hideUINotification(view) { - if (this._disableNotification) { - return; - } - - const removeNotification = sidebarView => { - switch (sidebarView) { - case SidebarView.OUTLINE: - this.outlineButton.classList.remove(UI_NOTIFICATION_CLASS); - break; - - case SidebarView.ATTACHMENTS: - this.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(msg => { - this.toggleButton.title = msg; - }); - } - - _addEventListeners() { - this.viewerContainer.addEventListener("transitionend", evt => { - if (evt.target === this.viewerContainer) { - this.outerContainer.classList.remove("sidebarMoving"); - } - }); - this.toggleButton.addEventListener("click", () => { - this.toggle(); - }); - this.thumbnailButton.addEventListener("click", () => { - this.switchView(SidebarView.THUMBS); - }); - this.outlineButton.addEventListener("click", () => { - this.switchView(SidebarView.OUTLINE); - }); - this.outlineButton.addEventListener("dblclick", () => { - this.eventBus.dispatch("toggleoutlinetree", { - source: this - }); - }); - this.attachmentsButton.addEventListener("click", () => { - this.switchView(SidebarView.ATTACHMENTS); - }); - - this.eventBus._on("outlineloaded", evt => { - const outlineCount = evt.outlineCount; - this.outlineButton.disabled = !outlineCount; - - if (outlineCount) { - this._showUINotification(SidebarView.OUTLINE); - } else if (this.active === SidebarView.OUTLINE) { - this.switchView(SidebarView.THUMBS); - } - }); - - this.eventBus._on("attachmentsloaded", evt => { - if (evt.attachmentsCount) { - this.attachmentsButton.disabled = false; - - this._showUINotification(SidebarView.ATTACHMENTS); - - return; - } - - Promise.resolve().then(() => { - if (this.attachmentsView.hasChildNodes()) { - return; - } - - this.attachmentsButton.disabled = true; - - if (this.active === SidebarView.ATTACHMENTS) { - this.switchView(SidebarView.THUMBS); - } - }); - }); - - this.eventBus._on("presentationmodechanged", evt => { - if (!evt.active && !evt.switchInProgress && this.isThumbnailViewVisible) { - this._updateThumbnailViewer(); - } - }); - } - -} - -exports.PDFSidebar = PDFSidebar; - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); +})); exports.OverlayManager = void 0; class OverlayManager { @@ -4736,23 +4432,20 @@ class OverlayManager { exports.OverlayManager = OverlayManager; /***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 10 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PasswordPrompt = void 0; -var _ui_utils = __webpack_require__(2); - var _pdfjsLib = __webpack_require__(5); class PasswordPrompt { - constructor(options, overlayManager, l10n = _ui_utils.NullL10n) { + constructor(options, overlayManager, l10n, isViewerEmbedded = false) { this.overlayName = options.overlayName; this.container = options.container; this.label = options.label; @@ -4761,6 +4454,7 @@ class PasswordPrompt { this.cancelButton = options.cancelButton; this.overlayManager = overlayManager; this.l10n = l10n; + this._isViewerEmbedded = isViewerEmbedded; this.updateCallback = null; this.reason = null; this.submitButton.addEventListener("click", this.verify.bind(this)); @@ -4773,21 +4467,15 @@ class PasswordPrompt { this.overlayManager.register(this.overlayName, this.container, this.close.bind(this), true); } - open() { - this.overlayManager.open(this.overlayName).then(() => { + async open() { + await this.overlayManager.open(this.overlayName); + const passwordIncorrect = this.reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD; + + if (!this._isViewerEmbedded || passwordIncorrect) { this.input.focus(); - let promptString; + } - if (this.reason === _pdfjsLib.PasswordResponses.INCORRECT_PASSWORD) { - promptString = this.l10n.get("password_invalid", null, "Invalid password. Please try again."); - } else { - promptString = this.l10n.get("password_label", null, "Enter the password to open this PDF file."); - } - - promptString.then(msg => { - this.label.textContent = msg; - }); - }); + this.label.textContent = await this.l10n.get(`password_${passwordIncorrect ? "invalid" : "label"}`); } close() { @@ -4799,7 +4487,7 @@ class PasswordPrompt { verify() { const password = this.input.value; - if (password && password.length > 0) { + if (password?.length > 0) { this.close(); this.updateCallback(password); } @@ -4815,80 +4503,74 @@ class PasswordPrompt { exports.PasswordPrompt = PasswordPrompt; /***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 11 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFAttachmentViewer = void 0; var _pdfjsLib = __webpack_require__(5); -class PDFAttachmentViewer { - constructor({ - container, - eventBus, - downloadManager - }) { - this.container = container; - this.eventBus = eventBus; - this.downloadManager = downloadManager; - this.reset(); +var _base_tree_viewer = __webpack_require__(12); + +class PDFAttachmentViewer extends _base_tree_viewer.BaseTreeViewer { + constructor(options) { + super(options); + this.downloadManager = options.downloadManager; this.eventBus._on("fileattachmentannotation", this._appendAttachment.bind(this)); } reset(keepRenderedCapability = false) { - this.attachments = null; - this.container.textContent = ""; + super.reset(); + this._attachments = null; if (!keepRenderedCapability) { this._renderedCapability = (0, _pdfjsLib.createPromiseCapability)(); } + + if (this._pendingDispatchEvent) { + clearTimeout(this._pendingDispatchEvent); + } + + this._pendingDispatchEvent = null; } _dispatchEvent(attachmentsCount) { this._renderedCapability.resolve(); + if (this._pendingDispatchEvent) { + clearTimeout(this._pendingDispatchEvent); + this._pendingDispatchEvent = null; + } + + if (attachmentsCount === 0) { + this._pendingDispatchEvent = setTimeout(() => { + this.eventBus.dispatch("attachmentsloaded", { + source: this, + attachmentsCount: 0 + }); + this._pendingDispatchEvent = null; + }); + return; + } + this.eventBus.dispatch("attachmentsloaded", { source: this, attachmentsCount }); } - _bindPdfLink(button, content, filename) { - let blobUrl; - - button.onclick = () => { - if (!blobUrl) { - blobUrl = URL.createObjectURL(new Blob([content], { - type: "application/pdf" - })); - } - - let viewerUrl; - viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename); - - try { - window.open(viewerUrl); - } catch (ex) { - console.error(`_bindPdfLink: ${ex}`); - URL.revokeObjectURL(blobUrl); - blobUrl = null; - this.downloadManager.downloadData(content, filename, "application/pdf"); - } - - return false; - }; - } - - _bindLink(button, content, filename) { - button.onclick = () => { - this.downloadManager.downloadData(content, filename, ""); + _bindLink(element, { + content, + filename + }) { + element.onclick = () => { + this.downloadManager.openOrDownloadData(element, content, filename); return false; }; } @@ -4897,16 +4579,14 @@ class PDFAttachmentViewer { attachments, keepRenderedCapability = false }) { - let attachmentsCount = 0; - - if (this.attachments) { - this.reset(keepRenderedCapability === true); + if (this._attachments) { + this.reset(keepRenderedCapability); } - this.attachments = attachments || null; + this._attachments = attachments || null; if (!attachments) { - this._dispatchEvent(attachmentsCount); + this._dispatchEvent(0); return; } @@ -4914,27 +4594,29 @@ class PDFAttachmentViewer { const names = Object.keys(attachments).sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }); - attachmentsCount = names.length; + const fragment = document.createDocumentFragment(); + let attachmentsCount = 0; - for (let i = 0; i < attachmentsCount; i++) { - const item = attachments[names[i]]; - const filename = (0, _pdfjsLib.removeNullCharacters)((0, _pdfjsLib.getFilenameFromUrl)(item.filename)); + for (const name of names) { + const item = attachments[name]; + const content = item.content, + filename = (0, _pdfjsLib.getFilenameFromUrl)(item.filename); const div = document.createElement("div"); - div.className = "attachmentsItem"; - const button = document.createElement("button"); - button.textContent = filename; + div.className = "treeItem"; + const element = document.createElement("a"); - if (/\.pdf$/i.test(filename) && !this.downloadManager.disableCreateObjectURL) { - this._bindPdfLink(button, item.content, filename); - } else { - this._bindLink(button, item.content, filename); - } + this._bindLink(element, { + content, + filename + }); - div.appendChild(button); - this.container.appendChild(div); + element.textContent = this._normalizeTextContent(filename); + div.appendChild(element); + fragment.appendChild(div); + attachmentsCount++; } - this._dispatchEvent(attachmentsCount); + this._finishRendering(fragment, attachmentsCount); } _appendAttachment({ @@ -4942,8 +4624,13 @@ class PDFAttachmentViewer { filename, content }) { - this._renderedCapability.promise.then(() => { - let attachments = this.attachments; + const renderedPromise = this._renderedCapability.promise; + renderedPromise.then(() => { + if (renderedPromise !== this._renderedCapability.promise) { + return; + } + + let attachments = this._attachments; if (!attachments) { attachments = Object.create(null); @@ -4971,20 +4658,153 @@ class PDFAttachmentViewer { exports.PDFAttachmentViewer = PDFAttachmentViewer; /***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 12 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.BaseTreeViewer = void 0; + +var _pdfjsLib = __webpack_require__(5); + +const TREEITEM_OFFSET_TOP = -100; +const TREEITEM_SELECTED_CLASS = "selected"; + +class BaseTreeViewer { + constructor(options) { + if (this.constructor === BaseTreeViewer) { + throw new Error("Cannot initialize BaseTreeViewer."); + } + + this.container = options.container; + this.eventBus = options.eventBus; + this.reset(); + } + + reset() { + this._pdfDocument = null; + this._lastToggleIsShow = true; + this._currentTreeItem = null; + this.container.textContent = ""; + this.container.classList.remove("treeWithDeepNesting"); + } + + _dispatchEvent(count) { + throw new Error("Not implemented: _dispatchEvent"); + } + + _bindLink(element, params) { + throw new Error("Not implemented: _bindLink"); + } + + _normalizeTextContent(str) { + return (0, _pdfjsLib.removeNullCharacters)(str) || "\u2013"; + } + + _addToggleButton(div, hidden = false) { + const toggler = document.createElement("div"); + toggler.className = "treeItemToggler"; + + if (hidden) { + toggler.classList.add("treeItemsHidden"); + } + + toggler.onclick = evt => { + evt.stopPropagation(); + toggler.classList.toggle("treeItemsHidden"); + + if (evt.shiftKey) { + const shouldShowAll = !toggler.classList.contains("treeItemsHidden"); + + this._toggleTreeItem(div, shouldShowAll); + } + }; + + div.insertBefore(toggler, div.firstChild); + } + + _toggleTreeItem(root, show = false) { + this._lastToggleIsShow = show; + + for (const toggler of root.querySelectorAll(".treeItemToggler")) { + toggler.classList.toggle("treeItemsHidden", !show); + } + } + + _toggleAllTreeItems() { + this._toggleTreeItem(this.container, !this._lastToggleIsShow); + } + + _finishRendering(fragment, count, hasAnyNesting = false) { + if (hasAnyNesting) { + this.container.classList.add("treeWithDeepNesting"); + this._lastToggleIsShow = !fragment.querySelector(".treeItemsHidden"); + } + + this.container.appendChild(fragment); + + this._dispatchEvent(count); + } + + render(params) { + throw new Error("Not implemented: render"); + } + + _updateCurrentTreeItem(treeItem = null) { + if (this._currentTreeItem) { + this._currentTreeItem.classList.remove(TREEITEM_SELECTED_CLASS); + + this._currentTreeItem = null; + } + + if (treeItem) { + treeItem.classList.add(TREEITEM_SELECTED_CLASS); + this._currentTreeItem = treeItem; + } + } + + _scrollToCurrentTreeItem(treeItem) { + if (!treeItem) { + return; + } + + let currentNode = treeItem.parentNode; + + while (currentNode && currentNode !== this.container) { + if (currentNode.classList.contains("treeItem")) { + const toggler = currentNode.firstElementChild; + toggler?.classList.remove("treeItemsHidden"); + } + + currentNode = currentNode.parentNode; + } + + this._updateCurrentTreeItem(treeItem); + + this.container.scrollTo(treeItem.offsetLeft, treeItem.offsetTop + TREEITEM_OFFSET_TOP); + } + +} + +exports.BaseTreeViewer = BaseTreeViewer; + +/***/ }), +/* 13 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); exports.PDFDocumentProperties = void 0; var _pdfjsLib = __webpack_require__(5); -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); const DEFAULT_FIELD_CONTENT = "-"; const NON_METRIC_LOCALES = ["en-us", "en-lr", "my"]; @@ -5009,7 +4829,7 @@ class PDFDocumentProperties { fields, container, closeButton - }, overlayManager, eventBus, l10n = _ui_utils.NullL10n) { + }, overlayManager, eventBus, l10n) { this.overlayName = overlayName; this.fields = fields; this.container = container; @@ -5035,7 +4855,7 @@ class PDFDocumentProperties { }); } - open() { + async open() { const freezeFieldData = data => { Object.defineProperty(this, "fieldData", { value: Object.freeze(data), @@ -5045,64 +4865,58 @@ class PDFDocumentProperties { }); }; - Promise.all([this.overlayManager.open(this.overlayName), this._dataAvailableCapability.promise]).then(() => { - const currentPageNumber = this._currentPageNumber; - const pagesRotation = this._pagesRotation; + await Promise.all([this.overlayManager.open(this.overlayName), this._dataAvailableCapability.promise]); + const currentPageNumber = this._currentPageNumber; + const pagesRotation = this._pagesRotation; - if (this.fieldData && currentPageNumber === this.fieldData._currentPageNumber && pagesRotation === this.fieldData._pagesRotation) { - this._updateUI(); + if (this.fieldData && currentPageNumber === this.fieldData._currentPageNumber && pagesRotation === this.fieldData._pagesRotation) { + this._updateUI(); - return; - } + return; + } - this.pdfDocument.getMetadata().then(({ - info, - metadata, - contentDispositionFilename - }) => { - return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url), this._parseFileSize(this.maybeFileSize), this._parseDate(info.CreationDate), this._parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => { - return this._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation); - }), this._parseLinearization(info.IsLinearized)]); - }).then(([info, metadata, fileName, fileSize, creationDate, modDate, pageSize, isLinearized]) => { - freezeFieldData({ - fileName, - fileSize, - title: info.Title, - author: info.Author, - subject: info.Subject, - keywords: info.Keywords, - creationDate, - modificationDate: modDate, - creator: info.Creator, - producer: info.Producer, - version: info.PDFFormatVersion, - pageCount: this.pdfDocument.numPages, - pageSize, - linearized: isLinearized, - _currentPageNumber: currentPageNumber, - _pagesRotation: pagesRotation - }); - - this._updateUI(); - - return this.pdfDocument.getDownloadInfo(); - }).then(({ - length - }) => { - this.maybeFileSize = length; - return this._parseFileSize(length); - }).then(fileSize => { - if (fileSize === this.fieldData.fileSize) { - return; - } - - const data = Object.assign(Object.create(null), this.fieldData); - data.fileSize = fileSize; - freezeFieldData(data); - - this._updateUI(); - }); + const { + info, + contentDispositionFilename, + contentLength + } = await this.pdfDocument.getMetadata(); + const [fileName, fileSize, creationDate, modificationDate, pageSize, isLinearized] = await Promise.all([contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(this.url), this._parseFileSize(contentLength), this._parseDate(info.CreationDate), this._parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => { + return this._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation); + }), this._parseLinearization(info.IsLinearized)]); + freezeFieldData({ + fileName, + fileSize, + title: info.Title, + author: info.Author, + subject: info.Subject, + keywords: info.Keywords, + creationDate, + modificationDate, + creator: info.Creator, + producer: info.Producer, + version: info.PDFFormatVersion, + pageCount: this.pdfDocument.numPages, + pageSize, + linearized: isLinearized, + _currentPageNumber: currentPageNumber, + _pagesRotation: pagesRotation }); + + this._updateUI(); + + const { + length + } = await this.pdfDocument.getDownloadInfo(); + + if (contentLength === length) { + return; + } + + const data = Object.assign(Object.create(null), this.fieldData); + data.fileSize = await this._parseFileSize(length); + freezeFieldData(data); + + this._updateUI(); } close() { @@ -5126,16 +4940,9 @@ class PDFDocumentProperties { this._dataAvailableCapability.resolve(); } - setFileSize(fileSize) { - if (Number.isInteger(fileSize) && fileSize > 0) { - this.maybeFileSize = fileSize; - } - } - _reset() { this.pdfDocument = null; this.url = null; - this.maybeFileSize = 0; delete this.fieldData; this._dataAvailableCapability = (0, _pdfjsLib.createPromiseCapability)(); this._currentPageNumber = 1; @@ -5162,21 +4969,18 @@ class PDFDocumentProperties { } async _parseFileSize(fileSize = 0) { - const kb = fileSize / 1024; + const kb = fileSize / 1024, + mb = kb / 1024; if (!kb) { return undefined; - } else if (kb < 1024) { - return this.l10n.get("document_properties_kb", { - size_kb: (+kb.toPrecision(3)).toLocaleString(), - size_b: fileSize.toLocaleString() - }, "{{size_kb}} KB ({{size_b}} bytes)"); } - return this.l10n.get("document_properties_mb", { - size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(), + return this.l10n.get(`document_properties_${mb >= 1 ? "mb" : "kb"}`, { + size_mb: mb >= 1 && (+mb.toPrecision(3)).toLocaleString(), + size_kb: mb < 1 && (+kb.toPrecision(3)).toLocaleString(), size_b: fileSize.toLocaleString() - }, "{{size_mb}} MB ({{size_b}} bytes)"); + }); } async _parsePageSize(pageSizeInches, pagesRotation) { @@ -5200,7 +5004,6 @@ class PDFDocumentProperties { width: Math.round(pageSizeInches.width * 25.4 * 10) / 10, height: Math.round(pageSizeInches.height * 25.4 * 10) / 10 }; - let pageName = null; let rawName = getPageName(sizeInches, isPortrait, US_PAGE_NAMES) || getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES); if (!rawName && !(Number.isInteger(sizeMillimeters.width) && Number.isInteger(sizeMillimeters.height))) { @@ -5226,21 +5029,16 @@ class PDFDocumentProperties { } } - if (rawName) { - pageName = this.l10n.get("document_properties_page_size_name_" + rawName.toLowerCase(), null, rawName); - } - - return Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get("document_properties_page_size_unit_" + (this._isNonMetricLocale ? "inches" : "millimeters"), null, this._isNonMetricLocale ? "in" : "mm"), pageName, this.l10n.get("document_properties_page_size_orientation_" + (isPortrait ? "portrait" : "landscape"), null, isPortrait ? "portrait" : "landscape")]).then(([{ + const [{ width, height - }, unit, name, orientation]) => { - return this.l10n.get("document_properties_page_size_dimension_" + (name ? "name_" : "") + "string", { - width: width.toLocaleString(), - height: height.toLocaleString(), - unit, - name, - orientation - }, "{{width}} × {{height}} {{unit}} (" + (name ? "{{name}}, " : "") + "{{orientation}})"); + }, unit, name, orientation] = await Promise.all([this._isNonMetricLocale ? sizeInches : sizeMillimeters, this.l10n.get(`document_properties_page_size_unit_${this._isNonMetricLocale ? "inches" : "millimeters"}`), rawName && this.l10n.get(`document_properties_page_size_name_${rawName.toLowerCase()}`), this.l10n.get(`document_properties_page_size_orientation_${isPortrait ? "portrait" : "landscape"}`)]); + return this.l10n.get(`document_properties_page_size_dimension_${name ? "name_" : ""}string`, { + width: width.toLocaleString(), + height: height.toLocaleString(), + unit, + name, + orientation }); } @@ -5254,11 +5052,11 @@ class PDFDocumentProperties { return this.l10n.get("document_properties_date_string", { date: dateObject.toLocaleDateString(), time: dateObject.toLocaleTimeString() - }, "{{date}}, {{time}}"); + }); } _parseLinearization(isLinearized) { - return this.l10n.get("document_properties_linearized_" + (isLinearized ? "yes" : "no"), null, isLinearized ? "Yes" : "No"); + return this.l10n.get(`document_properties_linearized_${isLinearized ? "yes" : "no"}`); } } @@ -5267,35 +5065,32 @@ exports.PDFDocumentProperties = PDFDocumentProperties; /***/ }), /* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFFindBar = void 0; var _pdf_find_controller = __webpack_require__(15); -var _ui_utils = __webpack_require__(2); - const MATCHES_COUNT_LIMIT = 1000; class PDFFindBar { - constructor(options, eventBus, l10n = _ui_utils.NullL10n) { + constructor(options, eventBus, l10n) { this.opened = false; - this.bar = options.bar || null; - this.toggleButton = options.toggleButton || null; - this.findField = options.findField || null; - this.highlightAll = options.highlightAllCheckbox || null; - this.caseSensitive = options.caseSensitiveCheckbox || null; - this.entireWord = options.entireWordCheckbox || null; - this.findMsg = options.findMsg || null; - this.findResultsCount = options.findResultsCount || null; - this.findPreviousButton = options.findPreviousButton || null; - this.findNextButton = options.findNextButton || null; + this.bar = options.bar; + this.toggleButton = options.toggleButton; + this.findField = options.findField; + this.highlightAll = options.highlightAllCheckbox; + this.caseSensitive = options.caseSensitiveCheckbox; + this.entireWord = options.entireWordCheckbox; + this.findMsg = options.findMsg; + this.findResultsCount = options.findResultsCount; + this.findPreviousButton = options.findPreviousButton; + this.findNextButton = options.findNextButton; this.eventBus = eventBus; this.l10n = l10n; this.toggleButton.addEventListener("click", () => { @@ -5355,8 +5150,7 @@ class PDFFindBar { } updateUIState(state, previous, matchesCount) { - let notFound = false; - let findMsg = ""; + let findMsg = Promise.resolve(""); let status = ""; switch (state) { @@ -5368,23 +5162,17 @@ class PDFFindBar { break; case _pdf_find_controller.FindState.NOT_FOUND: - findMsg = this.l10n.get("find_not_found", null, "Phrase not found"); - notFound = true; + findMsg = this.l10n.get("find_not_found"); + status = "notFound"; break; case _pdf_find_controller.FindState.WRAPPED: - if (previous) { - findMsg = this.l10n.get("find_reached_top", null, "Reached top of document, continued from bottom"); - } else { - findMsg = this.l10n.get("find_reached_bottom", null, "Reached end of document, continued from top"); - } - + findMsg = this.l10n.get(`find_reached_${previous ? "top" : "bottom"}`); break; } - this.findField.classList.toggle("notFound", notFound); this.findField.setAttribute("data-status", status); - Promise.resolve(findMsg).then(msg => { + findMsg.then(msg => { this.findMsg.textContent = msg; this._adjustWidth(); @@ -5396,27 +5184,25 @@ class PDFFindBar { current = 0, total = 0 } = {}) { - if (!this.findResultsCount) { - return; - } - const limit = MATCHES_COUNT_LIMIT; - let matchesCountMsg = ""; + let matchCountMsg = Promise.resolve(""); if (total > 0) { if (total > limit) { - matchesCountMsg = this.l10n.get("find_match_count_limit", { + let key = "find_match_count_limit"; + matchCountMsg = this.l10n.get(key, { limit - }, "More than {{limit}} match" + (limit !== 1 ? "es" : "")); + }); } else { - matchesCountMsg = this.l10n.get("find_match_count", { + let key = "find_match_count"; + matchCountMsg = this.l10n.get(key, { current, total - }, "{{current}} of {{total}} match" + (total !== 1 ? "es" : "")); + }); } } - Promise.resolve(matchesCountMsg).then(msg => { + matchCountMsg.then(msg => { this.findResultsCount.textContent = msg; this.findResultsCount.classList.toggle("hidden", !total); @@ -5428,6 +5214,7 @@ class PDFFindBar { if (!this.opened) { this.opened = true; this.toggleButton.classList.add("toggled"); + this.toggleButton.setAttribute("aria-expanded", "true"); this.bar.classList.remove("hidden"); } @@ -5444,6 +5231,7 @@ class PDFFindBar { this.opened = false; this.toggleButton.classList.remove("toggled"); + this.toggleButton.setAttribute("aria-expanded", "false"); this.bar.classList.add("hidden"); this.eventBus.dispatch("findbarclose", { source: this @@ -5478,21 +5266,20 @@ exports.PDFFindBar = PDFFindBar; /***/ }), /* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFFindController = exports.FindState = void 0; var _pdfjsLib = __webpack_require__(5); var _pdf_find_utils = __webpack_require__(16); -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); const FindState = { FOUND: 0, @@ -5525,9 +5312,43 @@ function normalize(text) { normalizationRegex = new RegExp(`[${replace}]`, "g"); } - return text.replace(normalizationRegex, function (ch) { - return CHARACTERS_TO_NORMALIZE[ch]; + let diffs = null; + const normalizedText = text.replace(normalizationRegex, function (ch, index) { + const normalizedCh = CHARACTERS_TO_NORMALIZE[ch], + diff = normalizedCh.length - ch.length; + + if (diff !== 0) { + (diffs || (diffs = [])).push([index, diff]); + } + + return normalizedCh; }); + return [normalizedText, diffs]; +} + +function getOriginalIndex(matchIndex, diffs = null) { + if (!diffs) { + return matchIndex; + } + + let totalDiff = 0; + + for (const [index, diff] of diffs) { + const currentIndex = index + totalDiff; + + if (currentIndex >= matchIndex) { + break; + } + + if (currentIndex + diff > matchIndex) { + totalDiff += matchIndex - currentIndex; + break; + } + + totalDiff += diff; + } + + return matchIndex - totalDiff; } class PDFFindController { @@ -5676,9 +5497,10 @@ class PDFFindController { }; this._extractTextPromises = []; this._pageContents = []; + this._pageDiffs = []; this._matchesCountTotal = 0; this._pagesToSearch = null; - this._pendingFindMatches = Object.create(null); + this._pendingFindMatches = new Set(); this._resumePageIdx = null; this._dirtyMatch = false; clearTimeout(this._findTimeout); @@ -5689,7 +5511,7 @@ class PDFFindController { get _query() { if (this._state.query !== this._rawQuery) { this._rawQuery = this._state.query; - this._normalizedQuery = normalize(this._state.query); + [this._normalizedQuery] = normalize(this._state.query); } return this._normalizedQuery; @@ -5786,8 +5608,9 @@ class PDFFindController { return true; } - _calculatePhraseMatch(query, pageIndex, pageContent, entireWord) { - const matches = []; + _calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord) { + const matches = [], + matchesLength = []; const queryLen = query.length; let matchIdx = -queryLen; @@ -5802,13 +5625,18 @@ class PDFFindController { continue; } - matches.push(matchIdx); + const originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs), + matchEnd = matchIdx + queryLen - 1, + originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1; + matches.push(originalMatchIdx); + matchesLength.push(originalQueryLen); } this._pageMatches[pageIndex] = matches; + this._pageMatchesLength[pageIndex] = matchesLength; } - _calculateWordMatch(query, pageIndex, pageContent, entireWord) { + _calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord) { const matchesWithLength = []; const queryArray = query.match(/\S+/g); @@ -5828,9 +5656,12 @@ class PDFFindController { continue; } + const originalMatchIdx = getOriginalIndex(matchIdx, pageDiffs), + matchEnd = matchIdx + subqueryLen - 1, + originalQueryLen = getOriginalIndex(matchEnd, pageDiffs) - originalMatchIdx + 1; matchesWithLength.push({ - match: matchIdx, - matchLength: subqueryLen, + match: originalMatchIdx, + matchLength: originalQueryLen, skipped: false }); } @@ -5844,6 +5675,7 @@ class PDFFindController { _calculateMatch(pageIndex) { let pageContent = this._pageContents[pageIndex]; + const pageDiffs = this._pageDiffs[pageIndex]; let query = this._query; const { caseSensitive, @@ -5861,9 +5693,9 @@ class PDFFindController { } if (phraseSearch) { - this._calculatePhraseMatch(query, pageIndex, pageContent, entireWord); + this._calculatePhraseMatch(query, pageIndex, pageContent, pageDiffs, entireWord); } else { - this._calculateWordMatch(query, pageIndex, pageContent, entireWord); + this._calculateWordMatch(query, pageIndex, pageContent, pageDiffs, entireWord); } if (this._state.highlightAll) { @@ -5908,11 +5740,12 @@ class PDFFindController { strBuf.push(textItems[j].str); } - this._pageContents[i] = normalize(strBuf.join("")); + [this._pageContents[i], this._pageDiffs[i]] = normalize(strBuf.join("")); extractTextCapability.resolve(i); }, reason => { console.error(`Unable to get text content for page ${i + 1}`, reason); this._pageContents[i] = ""; + this._pageDiffs[i] = null; extractTextCapability.resolve(i); }); }); @@ -5957,14 +5790,14 @@ class PDFFindController { this._updateAllPages(); for (let i = 0; i < numPages; i++) { - if (this._pendingFindMatches[i] === true) { + if (this._pendingFindMatches.has(i)) { continue; } - this._pendingFindMatches[i] = true; + this._pendingFindMatches.add(i); this._extractTextPromises[i].then(pageIdx => { - delete this._pendingFindMatches[pageIdx]; + this._pendingFindMatches.delete(pageIdx); this._calculateMatch(pageIdx); }); @@ -6121,7 +5954,7 @@ class PDFFindController { if (matchIdx !== -1) { for (let i = 0; i < pageIdx; i++) { - current += this._pageMatches[i] && this._pageMatches[i].length || 0; + current += this._pageMatches[i]?.length || 0; } current += matchIdx + 1; @@ -6149,7 +5982,8 @@ class PDFFindController { source: this, state, previous, - matchesCount: this._requestMatchesCount() + matchesCount: this._requestMatchesCount(), + rawQuery: this._state?.query ?? null }); } @@ -6159,14 +5993,13 @@ exports.PDFFindController = PDFFindController; /***/ }), /* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.getCharacterType = getCharacterType; exports.CharacterType = void 0; const CharacterType = { @@ -6255,19 +6088,18 @@ function getCharacterType(charCode) { /***/ }), /* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.isDestHashesEqual = isDestHashesEqual; +})); exports.isDestArraysEqual = isDestArraysEqual; +exports.isDestHashesEqual = isDestHashesEqual; exports.PDFHistory = void 0; -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); const HASH_CHANGE_TIMEOUT = 1000; const POSITION_UPDATED_THRESHOLD = 50; @@ -6291,19 +6123,17 @@ class PDFHistory { this._isViewerInPresentationMode = false; this.eventBus._on("presentationmodechanged", evt => { - this._isViewerInPresentationMode = evt.active || evt.switchInProgress; + this._isViewerInPresentationMode = evt.state !== _ui_utils.PresentationModeState.NORMAL; }); this.eventBus._on("pagesinit", () => { this._isPagesLoaded = false; - const onPagesLoaded = evt => { - this.eventBus._off("pagesloaded", onPagesLoaded); - + this.eventBus._on("pagesloaded", evt => { this._isPagesLoaded = !!evt.pagesCount; - }; - - this.eventBus._on("pagesloaded", onPagesLoaded); + }, { + once: true + }); }); } @@ -6363,10 +6193,6 @@ class PDFHistory { this._updateInternalState(destination, state.uid, true); - if (this._uid > this._maxUid) { - this._maxUid = this._uid; - } - if (destination.rotation !== undefined) { this._initialRotation = destination.rotation; } @@ -6414,7 +6240,7 @@ class PDFHistory { } else if (!Array.isArray(explicitDest)) { console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`); return; - } else if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.linkService.pagesCount)) { + } else if (!this._isValidPage(pageNumber)) { if (pageNumber !== null || this._destination) { console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`); return; @@ -6456,6 +6282,39 @@ class PDFHistory { } } + pushPage(pageNumber) { + if (!this._initialized) { + return; + } + + if (!this._isValidPage(pageNumber)) { + console.error(`PDFHistory.pushPage: "${pageNumber}" is not a valid page number.`); + return; + } + + if (this._destination?.page === pageNumber) { + return; + } + + if (this._popStateInProgress) { + return; + } + + this._pushOrReplaceState({ + dest: null, + hash: `page=${pageNumber}`, + page: pageNumber, + rotation: this.linkService.rotation + }); + + if (!this._popStateInProgress) { + this._popStateInProgress = true; + Promise.resolve().then(() => { + this._popStateInProgress = false; + }); + } + } + pushCurrentPosition() { if (!this._initialized || this._popStateInProgress) { return; @@ -6512,7 +6371,7 @@ class PDFHistory { let newUrl; - if (this._updateUrl && destination && destination.hash) { + if (this._updateUrl && destination?.hash) { const baseUrl = document.location.href.split("#")[0]; if (!baseUrl.startsWith("file://")) { @@ -6523,7 +6382,6 @@ class PDFHistory { if (shouldReplace) { window.history.replaceState(newState, "", newUrl); } else { - this._maxUid = this._uid; window.history.pushState(newState, "", newUrl); } } @@ -6563,7 +6421,7 @@ class PDFHistory { let forceReplace = false; if (this._destination.page >= position.first && this._destination.page <= position.page) { - if (this._destination.dest || !this._destination.first) { + if (this._destination.dest !== undefined || !this._destination.first) { return; } @@ -6573,6 +6431,10 @@ class PDFHistory { this._pushOrReplaceState(position, forceReplace); } + _isValidPage(val) { + return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount; + } + _isValidState(state, checkReload = false) { if (!state) { return false; @@ -6586,7 +6448,7 @@ class PDFHistory { const [perfEntry] = performance.getEntriesByType("navigation"); - if (!perfEntry || perfEntry.type !== "reload") { + if (perfEntry?.type !== "reload") { return false; } } else { @@ -6611,12 +6473,13 @@ class PDFHistory { this._updateViewareaTimeout = null; } - if (removeTemporary && destination && destination.temporary) { + if (removeTemporary && destination?.temporary) { delete destination.temporary; } this._destination = destination; this._uid = uid; + this._maxUid = Math.max(this._maxUid, uid); this._numPositionUpdates = 0; } @@ -6626,7 +6489,7 @@ class PDFHistory { const nameddest = params.nameddest || ""; let page = params.page | 0; - if (!(Number.isInteger(page) && page > 0 && page <= this.linkService.pagesCount) || checkNameddest && nameddest.length > 0) { + if (!this._isValidPage(page) || checkNameddest && nameddest.length > 0) { page = null; } @@ -6717,16 +6580,12 @@ class PDFHistory { this._updateInternalState(destination, state.uid, true); - if (this._uid > this._maxUid) { - this._maxUid = this._uid; - } - if ((0, _ui_utils.isValidRotation)(destination.rotation)) { this.linkService.rotation = destination.rotation; } if (destination.dest) { - this.linkService.navigateTo(destination.dest); + this.linkService.goToDestination(destination.dest); } else if (destination.hash) { this.linkService.setHash(destination.hash); } else if (destination.page) { @@ -6843,17 +6702,200 @@ function isDestArraysEqual(firstDest, secondDest) { /***/ }), /* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.PDFLayerViewer = void 0; + +var _base_tree_viewer = __webpack_require__(12); + +class PDFLayerViewer extends _base_tree_viewer.BaseTreeViewer { + constructor(options) { + super(options); + this.l10n = options.l10n; + + this.eventBus._on("resetlayers", this._resetLayers.bind(this)); + + this.eventBus._on("togglelayerstree", this._toggleAllTreeItems.bind(this)); + } + + reset() { + super.reset(); + this._optionalContentConfig = null; + } + + _dispatchEvent(layersCount) { + this.eventBus.dispatch("layersloaded", { + source: this, + layersCount + }); + } + + _bindLink(element, { + groupId, + input + }) { + const setVisibility = () => { + this._optionalContentConfig.setVisibility(groupId, input.checked); + + this.eventBus.dispatch("optionalcontentconfig", { + source: this, + promise: Promise.resolve(this._optionalContentConfig) + }); + }; + + element.onclick = evt => { + if (evt.target === input) { + setVisibility(); + return true; + } else if (evt.target !== element) { + return true; + } + + input.checked = !input.checked; + setVisibility(); + return false; + }; + } + + async _setNestedName(element, { + name = null + }) { + if (typeof name === "string") { + element.textContent = this._normalizeTextContent(name); + return; + } + + element.textContent = await this.l10n.get("additional_layers"); + element.style.fontStyle = "italic"; + } + + _addToggleButton(div, { + name = null + }) { + super._addToggleButton(div, name === null); + } + + _toggleAllTreeItems() { + if (!this._optionalContentConfig) { + return; + } + + super._toggleAllTreeItems(); + } + + render({ + optionalContentConfig, + pdfDocument + }) { + if (this._optionalContentConfig) { + this.reset(); + } + + this._optionalContentConfig = optionalContentConfig || null; + this._pdfDocument = pdfDocument || null; + const groups = optionalContentConfig?.getOrder(); + + if (!groups) { + this._dispatchEvent(0); + + return; + } + + const fragment = document.createDocumentFragment(), + queue = [{ + parent: fragment, + groups + }]; + let layersCount = 0, + hasAnyNesting = false; + + while (queue.length > 0) { + const levelData = queue.shift(); + + for (const groupId of levelData.groups) { + const div = document.createElement("div"); + div.className = "treeItem"; + const element = document.createElement("a"); + div.appendChild(element); + + if (typeof groupId === "object") { + hasAnyNesting = true; + + this._addToggleButton(div, groupId); + + this._setNestedName(element, groupId); + + const itemsDiv = document.createElement("div"); + itemsDiv.className = "treeItems"; + div.appendChild(itemsDiv); + queue.push({ + parent: itemsDiv, + groups: groupId.order + }); + } else { + const group = optionalContentConfig.getGroup(groupId); + const input = document.createElement("input"); + + this._bindLink(element, { + groupId, + input + }); + + input.type = "checkbox"; + input.id = groupId; + input.checked = group.visible; + const label = document.createElement("label"); + label.setAttribute("for", groupId); + label.textContent = this._normalizeTextContent(group.name); + element.appendChild(input); + element.appendChild(label); + layersCount++; + } + + levelData.parent.appendChild(div); + } + } + + this._finishRendering(fragment, layersCount, hasAnyNesting); + } + + async _resetLayers() { + if (!this._optionalContentConfig) { + return; + } + + const optionalContentConfig = await this._pdfDocument.getOptionalContentConfig(); + this.eventBus.dispatch("optionalcontentconfig", { + source: this, + promise: Promise.resolve(optionalContentConfig) + }); + this.render({ + optionalContentConfig, + pdfDocument: this._pdfDocument + }); + } + +} + +exports.PDFLayerViewer = PDFLayerViewer; + +/***/ }), +/* 19 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); exports.SimpleLinkService = exports.PDFLinkService = void 0; -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); class PDFLinkService { constructor({ @@ -6909,90 +6951,107 @@ class PDFLinkService { this.pdfViewer.pagesRotation = value; } - navigateTo(dest) { - const goToDestination = ({ - namedDest, - explicitDest - }) => { - const destRef = explicitDest[0]; - let pageNumber; + _goToDestinationHelper(rawDest, namedDest = null, explicitDest) { + const destRef = explicitDest[0]; + let pageNumber; - if (destRef instanceof Object) { - pageNumber = this._cachedPageNumber(destRef); + if (destRef instanceof Object) { + pageNumber = this._cachedPageNumber(destRef); - if (pageNumber === null) { - this.pdfDocument.getPageIndex(destRef).then(pageIndex => { - this.cachePageRef(pageIndex + 1, destRef); - goToDestination({ - namedDest, - explicitDest - }); - }).catch(() => { - console.error(`PDFLinkService.navigateTo: "${destRef}" is not ` + `a valid page reference, for dest="${dest}".`); - }); - return; - } - } else if (Number.isInteger(destRef)) { - pageNumber = destRef + 1; - } else { - console.error(`PDFLinkService.navigateTo: "${destRef}" is not ` + `a valid destination reference, for dest="${dest}".`); - return; - } + if (pageNumber === null) { + this.pdfDocument.getPageIndex(destRef).then(pageIndex => { + this.cachePageRef(pageIndex + 1, destRef); - if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) { - console.error(`PDFLinkService.navigateTo: "${pageNumber}" is not ` + `a valid page number, for dest="${dest}".`); - return; - } - - if (this.pdfHistory) { - this.pdfHistory.pushCurrentPosition(); - this.pdfHistory.push({ - namedDest, - explicitDest, - pageNumber - }); - } - - this.pdfViewer.scrollPageIntoView({ - pageNumber, - destArray: explicitDest, - ignoreDestinationZoom: this._ignoreDestinationZoom - }); - }; - - new Promise((resolve, reject) => { - if (typeof dest === "string") { - this.pdfDocument.getDestination(dest).then(destArray => { - resolve({ - namedDest: dest, - explicitDest: destArray - }); + this._goToDestinationHelper(rawDest, namedDest, explicitDest); + }).catch(() => { + console.error(`PDFLinkService._goToDestinationHelper: "${destRef}" is not ` + `a valid page reference, for dest="${rawDest}".`); }); return; } + } else if (Number.isInteger(destRef)) { + pageNumber = destRef + 1; + } else { + console.error(`PDFLinkService._goToDestinationHelper: "${destRef}" is not ` + `a valid destination reference, for dest="${rawDest}".`); + return; + } - resolve({ - namedDest: "", - explicitDest: dest + if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) { + console.error(`PDFLinkService._goToDestinationHelper: "${pageNumber}" is not ` + `a valid page number, for dest="${rawDest}".`); + return; + } + + if (this.pdfHistory) { + this.pdfHistory.pushCurrentPosition(); + this.pdfHistory.push({ + namedDest, + explicitDest, + pageNumber }); - }).then(data => { - if (!Array.isArray(data.explicitDest)) { - console.error(`PDFLinkService.navigateTo: "${data.explicitDest}" is` + ` not a valid destination array, for dest="${dest}".`); - return; - } + } - goToDestination(data); + this.pdfViewer.scrollPageIntoView({ + pageNumber, + destArray: explicitDest, + ignoreDestinationZoom: this._ignoreDestinationZoom + }); + } + + async goToDestination(dest) { + if (!this.pdfDocument) { + return; + } + + let namedDest, explicitDest; + + if (typeof dest === "string") { + namedDest = dest; + explicitDest = await this.pdfDocument.getDestination(dest); + } else { + namedDest = null; + explicitDest = await dest; + } + + if (!Array.isArray(explicitDest)) { + console.error(`PDFLinkService.goToDestination: "${explicitDest}" is not ` + `a valid destination array, for dest="${dest}".`); + return; + } + + this._goToDestinationHelper(dest, namedDest, explicitDest); + } + + goToPage(val) { + if (!this.pdfDocument) { + return; + } + + const pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0; + + if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) { + console.error(`PDFLinkService.goToPage: "${val}" is not a valid page.`); + return; + } + + if (this.pdfHistory) { + this.pdfHistory.pushCurrentPosition(); + this.pdfHistory.pushPage(pageNumber); + } + + this.pdfViewer.scrollPageIntoView({ + pageNumber }); } getDestinationHash(dest) { if (typeof dest === "string") { - return this.getAnchorUrl("#" + escape(dest)); - } - - if (Array.isArray(dest)) { + if (dest.length > 0) { + return this.getAnchorUrl("#" + escape(dest)); + } + } else if (Array.isArray(dest)) { const str = JSON.stringify(dest); - return this.getAnchorUrl("#" + escape(str)); + + if (str.length > 0) { + return this.getAnchorUrl("#" + escape(str)); + } } return this.getAnchorUrl(""); @@ -7003,6 +7062,10 @@ class PDFLinkService { } setHash(hash) { + if (!this.pdfDocument) { + return; + } + let pageNumber, dest; if (hash.includes("=")) { @@ -7070,7 +7133,7 @@ class PDFLinkService { } if ("nameddest" in params) { - this.navigateTo(params.nameddest); + this.goToDestination(params.nameddest); } } else { dest = unescape(hash); @@ -7084,7 +7147,7 @@ class PDFLinkService { } catch (ex) {} if (typeof dest === "string" || isValidExplicitDestination(dest)) { - this.navigateTo(dest); + this.goToDestination(dest); return; } @@ -7109,17 +7172,11 @@ class PDFLinkService { break; case "NextPage": - if (this.page < this.pagesCount) { - this.page++; - } - + this.pdfViewer.nextPage(); break; case "PrevPage": - if (this.page > 1) { - this.page--; - } - + this.pdfViewer.previousPage(); break; case "LastPage": @@ -7151,13 +7208,17 @@ class PDFLinkService { _cachedPageNumber(pageRef) { const refStr = pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`; - return this._pagesRefCache && this._pagesRefCache[refStr] || null; + return this._pagesRefCache?.[refStr] || null; } isPageVisible(pageNumber) { return this.pdfViewer.isPageVisible(pageNumber); } + isPageCached(pageNumber) { + return this.pdfViewer.isPageCached(pageNumber); + } + } exports.PDFLinkService = PDFLinkService; @@ -7256,7 +7317,9 @@ class SimpleLinkService { set rotation(value) {} - navigateTo(dest) {} + async goToDestination(dest) {} + + goToPage(val) {} getDestinationHash(dest) { return "#"; @@ -7276,51 +7339,84 @@ class SimpleLinkService { return true; } + isPageCached(pageNumber) { + return true; + } + } exports.SimpleLinkService = SimpleLinkService; /***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 20 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFOutlineViewer = void 0; var _pdfjsLib = __webpack_require__(5); -const DEFAULT_TITLE = "\u2013"; +var _base_tree_viewer = __webpack_require__(12); -class PDFOutlineViewer { - constructor({ - container, - linkService, - eventBus - }) { - this.container = container; - this.linkService = linkService; - this.eventBus = eventBus; - this.reset(); +var _ui_utils = __webpack_require__(4); - eventBus._on("toggleoutlinetree", this.toggleOutlineTree.bind(this)); +class PDFOutlineViewer extends _base_tree_viewer.BaseTreeViewer { + constructor(options) { + super(options); + this.linkService = options.linkService; + + this.eventBus._on("toggleoutlinetree", this._toggleAllTreeItems.bind(this)); + + this.eventBus._on("currentoutlineitem", this._currentOutlineItem.bind(this)); + + this.eventBus._on("pagechanging", evt => { + this._currentPageNumber = evt.pageNumber; + }); + + this.eventBus._on("pagesloaded", evt => { + this._isPagesLoaded = !!evt.pagesCount; + + if (this._currentOutlineItemCapability && !this._currentOutlineItemCapability.settled) { + this._currentOutlineItemCapability.resolve(this._isPagesLoaded); + } + }); + + this.eventBus._on("sidebarviewchanged", evt => { + this._sidebarView = evt.view; + }); } reset() { - this.outline = null; - this.lastToggleIsShow = true; - this.container.textContent = ""; - this.container.classList.remove("outlineWithDeepNesting"); + super.reset(); + this._outline = null; + this._pageNumberToDestHashCapability = null; + this._currentPageNumber = 1; + this._isPagesLoaded = false; + + if (this._currentOutlineItemCapability && !this._currentOutlineItemCapability.settled) { + this._currentOutlineItemCapability.resolve(false); + } + + this._currentOutlineItemCapability = null; } _dispatchEvent(outlineCount) { + this._currentOutlineItemCapability = (0, _pdfjsLib.createPromiseCapability)(); + + if (outlineCount === 0 || this._pdfDocument?.loadingParams.disableAutoFetch) { + this._currentOutlineItemCapability.resolve(false); + } else if (this._isPagesLoaded) { + this._currentOutlineItemCapability.resolve(true); + } + this.eventBus.dispatch("outlineloaded", { source: this, - outlineCount + outlineCount, + currentOutlineItemPromise: this._currentOutlineItemCapability.promise }); } @@ -7345,9 +7441,11 @@ class PDFOutlineViewer { element.href = linkService.getDestinationHash(dest); - element.onclick = () => { + element.onclick = evt => { + this._updateCurrentTreeItem(evt.target.parentNode); + if (dest) { - linkService.navigateTo(dest); + linkService.goToDestination(dest); } return false; @@ -7371,56 +7469,56 @@ class PDFOutlineViewer { count, items }) { - const toggler = document.createElement("div"); - toggler.className = "outlineItemToggler"; + let hidden = false; - if (count < 0 && Math.abs(count) === items.length) { - toggler.classList.add("outlineItemsHidden"); - } + if (count < 0) { + let totalCount = items.length; - toggler.onclick = evt => { - evt.stopPropagation(); - toggler.classList.toggle("outlineItemsHidden"); + if (totalCount > 0) { + const queue = [...items]; - if (evt.shiftKey) { - const shouldShowAll = !toggler.classList.contains("outlineItemsHidden"); + while (queue.length > 0) { + const { + count: nestedCount, + items: nestedItems + } = queue.shift(); - this._toggleOutlineItem(div, shouldShowAll); + if (nestedCount > 0 && nestedItems.length > 0) { + totalCount += nestedItems.length; + queue.push(...nestedItems); + } + } } - }; - div.insertBefore(toggler, div.firstChild); - } - - _toggleOutlineItem(root, show = false) { - this.lastToggleIsShow = show; - - for (const toggler of root.querySelectorAll(".outlineItemToggler")) { - toggler.classList.toggle("outlineItemsHidden", !show); + if (Math.abs(count) === totalCount) { + hidden = true; + } } + + super._addToggleButton(div, hidden); } - toggleOutlineTree() { - if (!this.outline) { + _toggleAllTreeItems() { + if (!this._outline) { return; } - this._toggleOutlineItem(this.container, !this.lastToggleIsShow); + super._toggleAllTreeItems(); } render({ - outline + outline, + pdfDocument }) { - let outlineCount = 0; - - if (this.outline) { + if (this._outline) { this.reset(); } - this.outline = outline || null; + this._outline = outline || null; + this._pdfDocument = pdfDocument || null; if (!outline) { - this._dispatchEvent(outlineCount); + this._dispatchEvent(0); return; } @@ -7428,23 +7526,24 @@ class PDFOutlineViewer { const fragment = document.createDocumentFragment(); const queue = [{ parent: fragment, - items: this.outline + items: outline }]; - let hasAnyNesting = false; + let outlineCount = 0, + hasAnyNesting = false; while (queue.length > 0) { const levelData = queue.shift(); for (const item of levelData.items) { const div = document.createElement("div"); - div.className = "outlineItem"; + div.className = "treeItem"; const element = document.createElement("a"); this._bindLink(element, item); this._setStyles(element, item); - element.textContent = (0, _pdfjsLib.removeNullCharacters)(item.title) || DEFAULT_TITLE; + element.textContent = this._normalizeTextContent(item.title); div.appendChild(element); if (item.items.length > 0) { @@ -7453,7 +7552,7 @@ class PDFOutlineViewer { this._addToggleButton(div, item); const itemsDiv = document.createElement("div"); - itemsDiv.className = "outlineItems"; + itemsDiv.className = "treeItems"; div.appendChild(itemsDiv); queue.push({ parent: itemsDiv, @@ -7466,14 +7565,122 @@ class PDFOutlineViewer { } } - if (hasAnyNesting) { - this.container.classList.add("outlineWithDeepNesting"); - this.lastToggleIsShow = fragment.querySelectorAll(".outlineItemsHidden").length === 0; + this._finishRendering(fragment, outlineCount, hasAnyNesting); + } + + async _currentOutlineItem() { + if (!this._isPagesLoaded) { + throw new Error("_currentOutlineItem: All pages have not been loaded."); } - this.container.appendChild(fragment); + if (!this._outline || !this._pdfDocument) { + return; + } - this._dispatchEvent(outlineCount); + const pageNumberToDestHash = await this._getPageNumberToDestHash(this._pdfDocument); + + if (!pageNumberToDestHash) { + return; + } + + this._updateCurrentTreeItem(null); + + if (this._sidebarView !== _ui_utils.SidebarView.OUTLINE) { + return; + } + + for (let i = this._currentPageNumber; i > 0; i--) { + const destHash = pageNumberToDestHash.get(i); + + if (!destHash) { + continue; + } + + const linkElement = this.container.querySelector(`a[href="${destHash}"]`); + + if (!linkElement) { + continue; + } + + this._scrollToCurrentTreeItem(linkElement.parentNode); + + break; + } + } + + async _getPageNumberToDestHash(pdfDocument) { + if (this._pageNumberToDestHashCapability) { + return this._pageNumberToDestHashCapability.promise; + } + + this._pageNumberToDestHashCapability = (0, _pdfjsLib.createPromiseCapability)(); + const pageNumberToDestHash = new Map(), + pageNumberNesting = new Map(); + const queue = [{ + nesting: 0, + items: this._outline + }]; + + while (queue.length > 0) { + const levelData = queue.shift(), + currentNesting = levelData.nesting; + + for (const { + dest, + items + } of levelData.items) { + let explicitDest, pageNumber; + + if (typeof dest === "string") { + explicitDest = await pdfDocument.getDestination(dest); + + if (pdfDocument !== this._pdfDocument) { + return null; + } + } else { + explicitDest = dest; + } + + if (Array.isArray(explicitDest)) { + const [destRef] = explicitDest; + + if (destRef instanceof Object) { + pageNumber = this.linkService._cachedPageNumber(destRef); + + if (!pageNumber) { + try { + pageNumber = (await pdfDocument.getPageIndex(destRef)) + 1; + + if (pdfDocument !== this._pdfDocument) { + return null; + } + + this.linkService.cachePageRef(pageNumber, destRef); + } catch (ex) {} + } + } else if (Number.isInteger(destRef)) { + pageNumber = destRef + 1; + } + + if (Number.isInteger(pageNumber) && (!pageNumberToDestHash.has(pageNumber) || currentNesting > pageNumberNesting.get(pageNumber))) { + const destHash = this.linkService.getDestinationHash(dest); + pageNumberToDestHash.set(pageNumber, destHash); + pageNumberNesting.set(pageNumber, currentNesting); + } + } + + if (items.length > 0) { + queue.push({ + nesting: currentNesting + 1, + items + }); + } + } + } + + this._pageNumberToDestHashCapability.resolve(pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null); + + return this._pageNumberToDestHashCapability.promise; } } @@ -7481,18 +7688,17 @@ class PDFOutlineViewer { exports.PDFOutlineViewer = PDFOutlineViewer; /***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 21 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFPresentationMode = void 0; -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); const DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1500; const DELAY_BEFORE_HIDING_CONTROLS = 3000; @@ -7507,8 +7713,7 @@ class PDFPresentationMode { constructor({ container, pdfViewer, - eventBus, - contextMenuItems = null + eventBus }) { this.container = container; this.pdfViewer = pdfViewer; @@ -7519,33 +7724,6 @@ class PDFPresentationMode { this.mouseScrollTimeStamp = 0; this.mouseScrollDelta = 0; this.touchSwipeState = null; - - if (contextMenuItems) { - contextMenuItems.contextFirstPage.addEventListener("click", () => { - this.contextMenuOpen = false; - this.eventBus.dispatch("firstpage", { - source: this - }); - }); - contextMenuItems.contextLastPage.addEventListener("click", () => { - this.contextMenuOpen = false; - this.eventBus.dispatch("lastpage", { - source: this - }); - }); - contextMenuItems.contextPageRotateCw.addEventListener("click", () => { - this.contextMenuOpen = false; - this.eventBus.dispatch("rotatecw", { - source: this - }); - }); - contextMenuItems.contextPageRotateCcw.addEventListener("click", () => { - this.contextMenuOpen = false; - this.eventBus.dispatch("rotateccw", { - source: this - }); - }); - } } request() { @@ -7565,8 +7743,6 @@ class PDFPresentationMode { this.container.mozRequestFullScreen(); } else if (this.container.webkitRequestFullscreen) { this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); - } else if (this.container.msRequestFullscreen) { - this.container.msRequestFullscreen(); } else { return false; } @@ -7585,7 +7761,7 @@ class PDFPresentationMode { evt.preventDefault(); const delta = (0, _ui_utils.normalizeWheelEventDelta)(evt); - const currentTime = new Date().getTime(); + const currentTime = Date.now(); const storedTime = this.mouseScrollTimeStamp; if (currentTime > storedTime && currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) { @@ -7603,7 +7779,7 @@ class PDFPresentationMode { this._resetMouseScrollState(); - const success = totalDelta > 0 ? this._goToPreviousPage() : this._goToNextPage(); + const success = totalDelta > 0 ? this.pdfViewer.previousPage() : this.pdfViewer.nextPage(); if (success) { this.mouseScrollTimeStamp = currentTime; @@ -7612,36 +7788,21 @@ class PDFPresentationMode { } get isFullscreen() { - return !!(document.fullscreenElement || document.mozFullScreen || document.webkitIsFullScreen || document.msFullscreenElement); - } - - _goToPreviousPage() { - const page = this.pdfViewer.currentPageNumber; - - if (page <= 1) { - return false; - } - - this.pdfViewer.currentPageNumber = page - 1; - return true; - } - - _goToNextPage() { - const page = this.pdfViewer.currentPageNumber; - - if (page >= this.pdfViewer.pagesCount) { - return false; - } - - this.pdfViewer.currentPageNumber = page + 1; - return true; + return !!(document.fullscreenElement || document.mozFullScreen || document.webkitIsFullScreen); } _notifyStateChange() { + let state = _ui_utils.PresentationModeState.NORMAL; + + if (this.switchInProgress) { + state = _ui_utils.PresentationModeState.CHANGING; + } else if (this.active) { + state = _ui_utils.PresentationModeState.FULLSCREEN; + } + this.eventBus.dispatch("presentationmodechanged", { source: this, - active: this.active, - switchInProgress: !!this.switchInProgress + state }); } @@ -7684,7 +7845,6 @@ class PDFPresentationMode { this._showControls(); this.contextMenuOpen = false; - this.container.setAttribute("contextmenu", "viewerContextMenu"); window.getSelection().removeAllRanges(); } @@ -7709,7 +7869,6 @@ class PDFPresentationMode { this._resetMouseScrollState(); - this.container.removeAttribute("contextmenu"); this.contextMenuOpen = false; } @@ -7727,9 +7886,9 @@ class PDFPresentationMode { evt.preventDefault(); if (evt.shiftKey) { - this._goToPreviousPage(); + this.pdfViewer.previousPage(); } else { - this._goToNextPage(); + this.pdfViewer.nextPage(); } } } @@ -7814,9 +7973,9 @@ class PDFPresentationMode { } if (delta > 0) { - this._goToPreviousPage(); + this.pdfViewer.previousPage(); } else if (delta < 0) { - this._goToNextPage(); + this.pdfViewer.nextPage(); } break; @@ -7874,14 +8033,12 @@ class PDFPresentationMode { window.addEventListener("fullscreenchange", this.fullscreenChangeBind); window.addEventListener("mozfullscreenchange", this.fullscreenChangeBind); window.addEventListener("webkitfullscreenchange", this.fullscreenChangeBind); - window.addEventListener("MSFullscreenChange", this.fullscreenChangeBind); } _removeFullscreenChangeListeners() { window.removeEventListener("fullscreenchange", this.fullscreenChangeBind); window.removeEventListener("mozfullscreenchange", this.fullscreenChangeBind); window.removeEventListener("webkitfullscreenchange", this.fullscreenChangeBind); - window.removeEventListener("MSFullscreenChange", this.fullscreenChangeBind); delete this.fullscreenChangeBind; } @@ -7890,26 +8047,826 @@ class PDFPresentationMode { exports.PDFPresentationMode = PDFPresentationMode; /***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 22 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.PDFScriptingManager = void 0; + +var _pdfjsLib = __webpack_require__(5); + +var _ui_utils = __webpack_require__(4); + +var _pdf_rendering_queue = __webpack_require__(8); + +class PDFScriptingManager { + constructor({ + eventBus, + sandboxBundleSrc = null, + scriptingFactory = null, + docPropertiesLookup = null + }) { + this._pdfDocument = null; + this._pdfViewer = null; + this._closeCapability = null; + this._destroyCapability = null; + this._scripting = null; + this._mouseState = Object.create(null); + this._pageEventsReady = false; + this._ready = false; + this._eventBus = eventBus; + this._sandboxBundleSrc = sandboxBundleSrc; + this._scriptingFactory = scriptingFactory; + this._docPropertiesLookup = docPropertiesLookup; + } + + setViewer(pdfViewer) { + this._pdfViewer = pdfViewer; + } + + async setDocument(pdfDocument) { + if (this._pdfDocument) { + await this._destroyScripting(); + } + + this._pdfDocument = pdfDocument; + + if (!pdfDocument) { + return; + } + + const [objects, calculationOrder, docActions] = await Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]); + + if (!objects && !docActions) { + await this._destroyScripting(); + return; + } + + if (pdfDocument !== this._pdfDocument) { + return; + } + + this._scripting = this._createScripting(); + + this._internalEvents.set("updatefromsandbox", event => { + if (event?.source !== window) { + return; + } + + this._updateFromSandbox(event.detail); + }); + + this._internalEvents.set("dispatcheventinsandbox", event => { + this._scripting?.dispatchEventInSandbox(event.detail); + }); + + this._internalEvents.set("pagechanging", ({ + pageNumber, + previous + }) => { + if (pageNumber === previous) { + return; + } + + this._dispatchPageClose(previous); + + this._dispatchPageOpen(pageNumber); + }); + + this._internalEvents.set("pagerendered", ({ + pageNumber + }) => { + if (!this._pageOpenPending.has(pageNumber)) { + return; + } + + if (pageNumber !== this._pdfViewer.currentPageNumber) { + return; + } + + this._dispatchPageOpen(pageNumber); + }); + + this._internalEvents.set("pagesdestroy", async event => { + await this._dispatchPageClose(this._pdfViewer.currentPageNumber); + await this._scripting?.dispatchEventInSandbox({ + id: "doc", + name: "WillClose" + }); + this._closeCapability?.resolve(); + }); + + this._domEvents.set("mousedown", event => { + this._mouseState.isDown = true; + }); + + this._domEvents.set("mouseup", event => { + this._mouseState.isDown = false; + }); + + for (const [name, listener] of this._internalEvents) { + this._eventBus._on(name, listener); + } + + for (const [name, listener] of this._domEvents) { + window.addEventListener(name, listener); + } + + try { + const docProperties = await this._getDocProperties(); + + if (pdfDocument !== this._pdfDocument) { + return; + } + + await this._scripting.createSandbox({ + objects, + calculationOrder, + appInfo: { + platform: navigator.platform, + language: navigator.language + }, + docInfo: { ...docProperties, + actions: docActions + } + }); + + this._eventBus.dispatch("sandboxcreated", { + source: this + }); + } catch (error) { + console.error(`PDFScriptingManager.setDocument: "${error?.message}".`); + await this._destroyScripting(); + return; + } + + await this._scripting?.dispatchEventInSandbox({ + id: "doc", + name: "Open" + }); + await this._dispatchPageOpen(this._pdfViewer.currentPageNumber, true); + Promise.resolve().then(() => { + if (pdfDocument === this._pdfDocument) { + this._ready = true; + } + }); + } + + async dispatchWillSave(detail) { + return this._scripting?.dispatchEventInSandbox({ + id: "doc", + name: "WillSave" + }); + } + + async dispatchDidSave(detail) { + return this._scripting?.dispatchEventInSandbox({ + id: "doc", + name: "DidSave" + }); + } + + async dispatchWillPrint(detail) { + return this._scripting?.dispatchEventInSandbox({ + id: "doc", + name: "WillPrint" + }); + } + + async dispatchDidPrint(detail) { + return this._scripting?.dispatchEventInSandbox({ + id: "doc", + name: "DidPrint" + }); + } + + get mouseState() { + return this._mouseState; + } + + get destroyPromise() { + return this._destroyCapability?.promise || null; + } + + get ready() { + return this._ready; + } + + get _internalEvents() { + return (0, _pdfjsLib.shadow)(this, "_internalEvents", new Map()); + } + + get _domEvents() { + return (0, _pdfjsLib.shadow)(this, "_domEvents", new Map()); + } + + get _pageOpenPending() { + return (0, _pdfjsLib.shadow)(this, "_pageOpenPending", new Set()); + } + + get _visitedPages() { + return (0, _pdfjsLib.shadow)(this, "_visitedPages", new Map()); + } + + async _updateFromSandbox(detail) { + const isInPresentationMode = this._pdfViewer.isInPresentationMode || this._pdfViewer.isChangingPresentationMode; + const { + id, + siblings, + command, + value + } = detail; + + if (!id) { + switch (command) { + case "clear": + console.clear(); + break; + + case "error": + console.error(value); + break; + + case "layout": + this._pdfViewer.spreadMode = (0, _ui_utils.apiPageLayoutToSpreadMode)(value); + break; + + case "page-num": + this._pdfViewer.currentPageNumber = value + 1; + break; + + case "print": + await this._pdfViewer.pagesPromise; + + this._eventBus.dispatch("print", { + source: this + }); + + break; + + case "println": + console.log(value); + break; + + case "zoom": + if (isInPresentationMode) { + return; + } + + this._pdfViewer.currentScaleValue = value; + break; + } + + return; + } + + if (isInPresentationMode) { + if (detail.focus) { + return; + } + } + + delete detail.id; + delete detail.siblings; + const ids = siblings ? [id, ...siblings] : [id]; + + for (const elementId of ids) { + const element = document.getElementById(elementId); + + if (element) { + element.dispatchEvent(new CustomEvent("updatefromsandbox", { + detail + })); + } else { + this._pdfDocument?.annotationStorage.setValue(elementId, detail); + } + } + } + + async _dispatchPageOpen(pageNumber, initialize = false) { + const pdfDocument = this._pdfDocument, + visitedPages = this._visitedPages; + + if (initialize) { + this._closeCapability = (0, _pdfjsLib.createPromiseCapability)(); + this._pageEventsReady = true; + } + + if (!this._pageEventsReady) { + return; + } + + const pageView = this._pdfViewer.getPageView(pageNumber - 1); + + if (pageView?.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) { + this._pageOpenPending.add(pageNumber); + + return; + } + + this._pageOpenPending.delete(pageNumber); + + const actionsPromise = (async () => { + const actions = await (!visitedPages.has(pageNumber) ? pageView.pdfPage?.getJSActions() : null); + + if (pdfDocument !== this._pdfDocument) { + return; + } + + await this._scripting?.dispatchEventInSandbox({ + id: "page", + name: "PageOpen", + pageNumber, + actions + }); + })(); + + visitedPages.set(pageNumber, actionsPromise); + } + + async _dispatchPageClose(pageNumber) { + const pdfDocument = this._pdfDocument, + visitedPages = this._visitedPages; + + if (!this._pageEventsReady) { + return; + } + + if (this._pageOpenPending.has(pageNumber)) { + return; + } + + const actionsPromise = visitedPages.get(pageNumber); + + if (!actionsPromise) { + return; + } + + visitedPages.set(pageNumber, null); + await actionsPromise; + + if (pdfDocument !== this._pdfDocument) { + return; + } + + await this._scripting?.dispatchEventInSandbox({ + id: "page", + name: "PageClose", + pageNumber + }); + } + + async _getDocProperties() { + if (this._docPropertiesLookup) { + return this._docPropertiesLookup(this._pdfDocument); + } + + throw new Error("_getDocProperties: Unable to lookup properties."); + } + + _createScripting() { + this._destroyCapability = (0, _pdfjsLib.createPromiseCapability)(); + + if (this._scripting) { + throw new Error("_createScripting: Scripting already exists."); + } + + if (this._scriptingFactory) { + return this._scriptingFactory.createScripting({ + sandboxBundleSrc: this._sandboxBundleSrc + }); + } + + throw new Error("_createScripting: Cannot create scripting."); + } + + async _destroyScripting() { + if (!this._scripting) { + this._pdfDocument = null; + this._destroyCapability?.resolve(); + return; + } + + if (this._closeCapability) { + await Promise.race([this._closeCapability.promise, new Promise(resolve => { + setTimeout(resolve, 1000); + })]).catch(reason => {}); + this._closeCapability = null; + } + + this._pdfDocument = null; + + try { + await this._scripting.destroySandbox(); + } catch (ex) {} + + for (const [name, listener] of this._internalEvents) { + this._eventBus._off(name, listener); + } + + this._internalEvents.clear(); + + for (const [name, listener] of this._domEvents) { + window.removeEventListener(name, listener); + } + + this._domEvents.clear(); + + this._pageOpenPending.clear(); + + this._visitedPages.clear(); + + this._scripting = null; + delete this._mouseState.isDown; + this._pageEventsReady = false; + this._ready = false; + this._destroyCapability?.resolve(); + } + +} + +exports.PDFScriptingManager = PDFScriptingManager; + +/***/ }), +/* 23 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.PDFSidebar = void 0; + +var _ui_utils = __webpack_require__(4); + +var _pdf_rendering_queue = __webpack_require__(8); + +const UI_NOTIFICATION_CLASS = "pdfSidebarNotification"; + +class PDFSidebar { + constructor({ + elements, + pdfViewer, + pdfThumbnailViewer, + eventBus, + l10n + }) { + this.isOpen = false; + this.active = _ui_utils.SidebarView.THUMBS; + this.isInitialViewSet = false; + this.onToggled = null; + this.pdfViewer = pdfViewer; + this.pdfThumbnailViewer = pdfThumbnailViewer; + this.outerContainer = elements.outerContainer; + this.viewerContainer = elements.viewerContainer; + this.toggleButton = elements.toggleButton; + this.thumbnailButton = elements.thumbnailButton; + this.outlineButton = elements.outlineButton; + this.attachmentsButton = elements.attachmentsButton; + this.layersButton = elements.layersButton; + this.thumbnailView = elements.thumbnailView; + this.outlineView = elements.outlineView; + this.attachmentsView = elements.attachmentsView; + this.layersView = elements.layersView; + this._outlineOptionsContainer = elements.outlineOptionsContainer; + this._currentOutlineItemButton = elements.currentOutlineItemButton; + this.eventBus = eventBus; + this.l10n = l10n; + + this._addEventListeners(); + } + + reset() { + this.isInitialViewSet = false; + + this._hideUINotification(true); + + this.switchView(_ui_utils.SidebarView.THUMBS); + this.outlineButton.disabled = false; + this.attachmentsButton.disabled = false; + this.layersButton.disabled = false; + this._currentOutlineItemButton.disabled = true; + } + + get visibleView() { + return this.isOpen ? this.active : _ui_utils.SidebarView.NONE; + } + + get isThumbnailViewVisible() { + return this.isOpen && this.active === _ui_utils.SidebarView.THUMBS; + } + + get isOutlineViewVisible() { + return this.isOpen && this.active === _ui_utils.SidebarView.OUTLINE; + } + + get isAttachmentsViewVisible() { + return this.isOpen && this.active === _ui_utils.SidebarView.ATTACHMENTS; + } + + get isLayersViewVisible() { + return this.isOpen && this.active === _ui_utils.SidebarView.LAYERS; + } + + setInitialView(view = _ui_utils.SidebarView.NONE) { + if (this.isInitialViewSet) { + return; + } + + this.isInitialViewSet = true; + + if (view === _ui_utils.SidebarView.NONE || view === _ui_utils.SidebarView.UNKNOWN) { + this._dispatchEvent(); + + return; + } + + if (!this._switchView(view, true)) { + this._dispatchEvent(); + } + } + + switchView(view, forceOpen = false) { + this._switchView(view, forceOpen); + } + + _switchView(view, forceOpen = false) { + const isViewChanged = view !== this.active; + let shouldForceRendering = false; + + switch (view) { + case _ui_utils.SidebarView.NONE: + if (this.isOpen) { + this.close(); + return true; + } + + return false; + + case _ui_utils.SidebarView.THUMBS: + if (this.isOpen && isViewChanged) { + shouldForceRendering = true; + } + + break; + + case _ui_utils.SidebarView.OUTLINE: + if (this.outlineButton.disabled) { + return false; + } + + break; + + case _ui_utils.SidebarView.ATTACHMENTS: + if (this.attachmentsButton.disabled) { + return false; + } + + break; + + case _ui_utils.SidebarView.LAYERS: + if (this.layersButton.disabled) { + return false; + } + + break; + + default: + console.error(`PDFSidebar._switchView: "${view}" is not a valid view.`); + return false; + } + + this.active = view; + this.thumbnailButton.classList.toggle("toggled", view === _ui_utils.SidebarView.THUMBS); + this.outlineButton.classList.toggle("toggled", view === _ui_utils.SidebarView.OUTLINE); + this.attachmentsButton.classList.toggle("toggled", view === _ui_utils.SidebarView.ATTACHMENTS); + this.layersButton.classList.toggle("toggled", view === _ui_utils.SidebarView.LAYERS); + this.thumbnailView.classList.toggle("hidden", view !== _ui_utils.SidebarView.THUMBS); + this.outlineView.classList.toggle("hidden", view !== _ui_utils.SidebarView.OUTLINE); + this.attachmentsView.classList.toggle("hidden", view !== _ui_utils.SidebarView.ATTACHMENTS); + this.layersView.classList.toggle("hidden", view !== _ui_utils.SidebarView.LAYERS); + + this._outlineOptionsContainer.classList.toggle("hidden", view !== _ui_utils.SidebarView.OUTLINE); + + if (forceOpen && !this.isOpen) { + this.open(); + return true; + } + + if (shouldForceRendering) { + this._updateThumbnailViewer(); + + this._forceRendering(); + } + + if (isViewChanged) { + this._dispatchEvent(); + } + + return isViewChanged; + } + + open() { + if (this.isOpen) { + return; + } + + this.isOpen = true; + this.toggleButton.classList.add("toggled"); + this.toggleButton.setAttribute("aria-expanded", "true"); + this.outerContainer.classList.add("sidebarMoving", "sidebarOpen"); + + if (this.active === _ui_utils.SidebarView.THUMBS) { + this._updateThumbnailViewer(); + } + + this._forceRendering(); + + this._dispatchEvent(); + + this._hideUINotification(); + } + + close() { + if (!this.isOpen) { + return; + } + + this.isOpen = false; + this.toggleButton.classList.remove("toggled"); + this.toggleButton.setAttribute("aria-expanded", "false"); + this.outerContainer.classList.add("sidebarMoving"); + this.outerContainer.classList.remove("sidebarOpen"); + + this._forceRendering(); + + this._dispatchEvent(); + } + + toggle() { + if (this.isOpen) { + this.close(); + } else { + this.open(); + } + } + + _dispatchEvent() { + this.eventBus.dispatch("sidebarviewchanged", { + source: this, + view: this.visibleView + }); + } + + _forceRendering() { + if (this.onToggled) { + this.onToggled(); + } else { + this.pdfViewer.forceRendering(); + this.pdfThumbnailViewer.forceRendering(); + } + } + + _updateThumbnailViewer() { + const { + pdfViewer, + pdfThumbnailViewer + } = this; + const pagesCount = pdfViewer.pagesCount; + + for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) { + const pageView = pdfViewer.getPageView(pageIndex); + + if (pageView?.renderingState === _pdf_rendering_queue.RenderingStates.FINISHED) { + const thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex); + thumbnailView.setImage(pageView); + } + } + + pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber); + } + + _showUINotification() { + this.l10n.get("toggle_sidebar_notification2.title").then(msg => { + this.toggleButton.title = msg; + }); + + if (!this.isOpen) { + this.toggleButton.classList.add(UI_NOTIFICATION_CLASS); + } + } + + _hideUINotification(reset = false) { + if (this.isOpen || reset) { + this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS); + } + + if (reset) { + this.l10n.get("toggle_sidebar.title").then(msg => { + this.toggleButton.title = msg; + }); + } + } + + _addEventListeners() { + this.viewerContainer.addEventListener("transitionend", evt => { + if (evt.target === this.viewerContainer) { + this.outerContainer.classList.remove("sidebarMoving"); + } + }); + this.toggleButton.addEventListener("click", () => { + this.toggle(); + }); + this.thumbnailButton.addEventListener("click", () => { + this.switchView(_ui_utils.SidebarView.THUMBS); + }); + this.outlineButton.addEventListener("click", () => { + this.switchView(_ui_utils.SidebarView.OUTLINE); + }); + this.outlineButton.addEventListener("dblclick", () => { + this.eventBus.dispatch("toggleoutlinetree", { + source: this + }); + }); + this.attachmentsButton.addEventListener("click", () => { + this.switchView(_ui_utils.SidebarView.ATTACHMENTS); + }); + this.layersButton.addEventListener("click", () => { + this.switchView(_ui_utils.SidebarView.LAYERS); + }); + this.layersButton.addEventListener("dblclick", () => { + this.eventBus.dispatch("resetlayers", { + source: this + }); + }); + + this._currentOutlineItemButton.addEventListener("click", () => { + this.eventBus.dispatch("currentoutlineitem", { + source: this + }); + }); + + const onTreeLoaded = (count, button, view) => { + button.disabled = !count; + + if (count) { + this._showUINotification(); + } else if (this.active === view) { + this.switchView(_ui_utils.SidebarView.THUMBS); + } + }; + + this.eventBus._on("outlineloaded", evt => { + onTreeLoaded(evt.outlineCount, this.outlineButton, _ui_utils.SidebarView.OUTLINE); + evt.currentOutlineItemPromise.then(enabled => { + if (!this.isInitialViewSet) { + return; + } + + this._currentOutlineItemButton.disabled = !enabled; + }); + }); + + this.eventBus._on("attachmentsloaded", evt => { + onTreeLoaded(evt.attachmentsCount, this.attachmentsButton, _ui_utils.SidebarView.ATTACHMENTS); + }); + + this.eventBus._on("layersloaded", evt => { + onTreeLoaded(evt.layersCount, this.layersButton, _ui_utils.SidebarView.LAYERS); + }); + + this.eventBus._on("presentationmodechanged", evt => { + if (evt.state === _ui_utils.PresentationModeState.NORMAL && this.isThumbnailViewVisible) { + this._updateThumbnailViewer(); + } + }); + } + +} + +exports.PDFSidebar = PDFSidebar; + +/***/ }), +/* 24 */ +/***/ ((__unused_webpack_module, exports) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); exports.PDFSidebarResizer = void 0; - -var _ui_utils = __webpack_require__(2); - const SIDEBAR_WIDTH_VAR = "--sidebar-width"; const SIDEBAR_MIN_WIDTH = 200; const SIDEBAR_RESIZING_CLASS = "sidebarResizing"; class PDFSidebarResizer { - constructor(options, eventBus, l10n = _ui_utils.NullL10n) { - this.enabled = false; + constructor(options, eventBus, l10n) { this.isRTL = false; this.sidebarOpen = false; this.doc = document.documentElement; @@ -7919,16 +8876,7 @@ class PDFSidebarResizer { this.outerContainer = options.outerContainer; this.resizer = options.resizer; this.eventBus = eventBus; - this.l10n = l10n; - - if (typeof CSS === "undefined" || typeof CSS.supports !== "function" || !CSS.supports(SIDEBAR_WIDTH_VAR, `calc(-1 * ${SIDEBAR_MIN_WIDTH}px)`)) { - console.warn("PDFSidebarResizer: " + "The browser does not support resizing of the sidebar."); - return; - } - - this.enabled = true; - this.resizer.classList.remove("hidden"); - this.l10n.getDirection().then(dir => { + l10n.getDirection().then(dir => { this.isRTL = dir === "rtl"; }); @@ -7936,26 +8884,26 @@ class PDFSidebarResizer { } get outerContainerWidth() { - if (!this._outerContainerWidth) { - this._outerContainerWidth = this.outerContainer.clientWidth; - } - - return this._outerContainerWidth; + return this._outerContainerWidth || (this._outerContainerWidth = this.outerContainer.clientWidth); } _updateWidth(width = 0) { - if (!this.enabled) { + const maxWidth = Math.floor(this.outerContainerWidth / 2); + + if (width > maxWidth) { + width = maxWidth; + } + + if (width < SIDEBAR_MIN_WIDTH) { + width = SIDEBAR_MIN_WIDTH; + } + + if (width === this._width) { return false; } - const newWidth = (0, _ui_utils.clamp)(width, SIDEBAR_MIN_WIDTH, Math.floor(this.outerContainerWidth / 2)); - - if (newWidth === this._width) { - return false; - } - - this._width = newWidth; - this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, `${newWidth}px`); + this._width = width; + this.doc.style.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`); return true; } @@ -7980,10 +8928,6 @@ class PDFSidebarResizer { } _addEventListeners() { - if (!this.enabled) { - return; - } - const _boundEvents = this._boundEvents; _boundEvents.mouseMove = this._mouseMove.bind(this); _boundEvents.mouseUp = this._mouseUp.bind(this); @@ -7998,11 +8942,11 @@ class PDFSidebarResizer { }); this.eventBus._on("sidebarviewchanged", evt => { - this.sidebarOpen = !!(evt && evt.view); + this.sidebarOpen = !!evt?.view; }); this.eventBus._on("resize", evt => { - if (!evt || evt.source !== window) { + if (evt?.source !== window) { return; } @@ -8039,20 +8983,21 @@ class PDFSidebarResizer { exports.PDFSidebarResizer = PDFSidebarResizer; /***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 25 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFThumbnailViewer = void 0; -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); -var _pdf_thumbnail_view = __webpack_require__(23); +var _pdf_thumbnail_view = __webpack_require__(26); + +var _pdf_rendering_queue = __webpack_require__(8); const THUMBNAIL_SCROLL_MARGIN = -19; const THUMBNAIL_SELECTED_CLASS = "selected"; @@ -8060,9 +9005,10 @@ const THUMBNAIL_SELECTED_CLASS = "selected"; class PDFThumbnailViewer { constructor({ container, + eventBus, linkService, renderingQueue, - l10n = _ui_utils.NullL10n + l10n }) { this.container = container; this.linkService = linkService; @@ -8071,6 +9017,10 @@ class PDFThumbnailViewer { this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdated.bind(this)); this._resetView(); + + eventBus._on("optionalcontentconfigchanged", () => { + this._setImageDisabled = true; + }); } _scrollUpdated() { @@ -8082,7 +9032,10 @@ class PDFThumbnailViewer { } _getVisibleThumbs() { - return (0, _ui_utils.getVisibleElements)(this.container, this._thumbnails); + return (0, _ui_utils.getVisibleElements)({ + scrollEl: this.container, + views: this._thumbnails + }); } scrollThumbnailIntoView(pageNumber) { @@ -8160,7 +9113,13 @@ class PDFThumbnailViewer { } cleanup() { - _pdf_thumbnail_view.PDFThumbnailView.cleanup(); + for (let i = 0, ii = this._thumbnails.length; i < ii; i++) { + if (this._thumbnails[i] && this._thumbnails[i].renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) { + this._thumbnails[i].reset(); + } + } + + _pdf_thumbnail_view.TempImageFactory.destroyCanvas(); } _resetView() { @@ -8168,7 +9127,9 @@ class PDFThumbnailViewer { this._currentPageNumber = 1; this._pageLabels = null; this._pagesRotation = 0; + this._optionalContentConfigPromise = null; this._pagesRequests = new WeakMap(); + this._setImageDisabled = false; this.container.textContent = ""; } @@ -8185,20 +9146,28 @@ class PDFThumbnailViewer { return; } - pdfDocument.getPage(1).then(firstPdfPage => { + const firstPagePromise = pdfDocument.getPage(1); + const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig(); + firstPagePromise.then(firstPdfPage => { + this._optionalContentConfigPromise = optionalContentConfigPromise; const pagesCount = pdfDocument.numPages; const viewport = firstPdfPage.getViewport({ scale: 1 }); + const checkSetImageDisabled = () => { + return this._setImageDisabled; + }; + for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { const thumbnail = new _pdf_thumbnail_view.PDFThumbnailView({ container: this.container, id: pageNum, defaultViewport: viewport.clone(), + optionalContentConfigPromise, linkService: this.linkService, renderingQueue: this.renderingQueue, - disableCanvasToImageConversion: false, + checkSetImageDisabled, l10n: this.l10n }); @@ -8241,9 +9210,7 @@ class PDFThumbnailViewer { } for (let i = 0, ii = this._thumbnails.length; i < ii; i++) { - const label = this._pageLabels && this._pageLabels[i]; - - this._thumbnails[i].setPageLabel(label); + this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null); } } @@ -8296,23 +9263,23 @@ class PDFThumbnailViewer { exports.PDFThumbnailViewer = PDFThumbnailViewer; /***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 26 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.PDFThumbnailView = void 0; +})); +exports.TempImageFactory = exports.PDFThumbnailView = void 0; + +var _ui_utils = __webpack_require__(4); var _pdfjsLib = __webpack_require__(5); -var _ui_utils = __webpack_require__(2); - var _pdf_rendering_queue = __webpack_require__(8); +const DRAW_UPSCALE_FACTOR = 2; const MAX_NUM_SCALING_STEPS = 3; const THUMBNAIL_CANVAS_BORDER_WIDTH = 1; const THUMBNAIL_WIDTH = 98; @@ -8338,7 +9305,7 @@ const TempImageFactory = function TempImageFactoryClosure() { ctx.fillStyle = "rgb(255, 255, 255)"; ctx.fillRect(0, 0, width, height); ctx.restore(); - return tempCanvas; + return [tempCanvas, tempCanvas.getContext("2d")]; }, destroyCanvas() { @@ -8355,15 +9322,18 @@ const TempImageFactory = function TempImageFactoryClosure() { }; }(); +exports.TempImageFactory = TempImageFactory; + class PDFThumbnailView { constructor({ container, id, defaultViewport, + optionalContentConfigPromise, linkService, renderingQueue, - disableCanvasToImageConversion = false, - l10n = _ui_utils.NullL10n + checkSetImageDisabled, + l10n }) { this.id = id; this.renderingId = "thumbnail" + id; @@ -8372,18 +9342,23 @@ class PDFThumbnailView { this.rotation = 0; this.viewport = defaultViewport; this.pdfPageRotate = defaultViewport.rotation; + this._optionalContentConfigPromise = optionalContentConfigPromise || null; this.linkService = linkService; this.renderingQueue = renderingQueue; this.renderTask = null; this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; this.resume = null; - this.disableCanvasToImageConversion = disableCanvasToImageConversion; - this.pageWidth = this.viewport.width; - this.pageHeight = this.viewport.height; - this.pageRatio = this.pageWidth / this.pageHeight; + + this._checkSetImageDisabled = checkSetImageDisabled || function () { + return false; + }; + + const pageWidth = this.viewport.width, + pageHeight = this.viewport.height, + pageRatio = pageWidth / pageHeight; this.canvasWidth = THUMBNAIL_WIDTH; - this.canvasHeight = this.canvasWidth / this.pageRatio | 0; - this.scale = this.canvasWidth / this.pageWidth; + this.canvasHeight = this.canvasWidth / pageRatio | 0; + this.scale = this.canvasWidth / pageWidth; this.l10n = l10n; const anchor = document.createElement("a"); anchor.href = linkService.getAnchorUrl("#page=" + id); @@ -8393,7 +9368,7 @@ class PDFThumbnailView { }); anchor.onclick = function () { - linkService.page = id; + linkService.goToPage(id); return false; }; @@ -8427,19 +9402,14 @@ class PDFThumbnailView { reset() { this.cancelRendering(); this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; - this.pageWidth = this.viewport.width; - this.pageHeight = this.viewport.height; - this.pageRatio = this.pageWidth / this.pageHeight; - this.canvasHeight = this.canvasWidth / this.pageRatio | 0; - this.scale = this.canvasWidth / this.pageWidth; + const pageWidth = this.viewport.width, + pageHeight = this.viewport.height, + pageRatio = pageWidth / pageHeight; + this.canvasHeight = this.canvasWidth / pageRatio | 0; + this.scale = this.canvasWidth / pageWidth; this.div.removeAttribute("data-loaded"); const ring = this.ring; - const childNodes = ring.childNodes; - - for (let i = childNodes.length - 1; i >= 0; i--) { - ring.removeChild(childNodes[i]); - } - + ring.textContent = ""; const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH; ring.style.width = this.canvasWidth + borderAdjustment + "px"; ring.style.height = this.canvasHeight + borderAdjustment + "px"; @@ -8478,51 +9448,32 @@ class PDFThumbnailView { this.resume = null; } - _getPageDrawContext(noCtxScale = false) { + _getPageDrawContext(upscaleFactor = 1) { const canvas = document.createElement("canvas"); - this.canvas = canvas; canvas.mozOpaque = true; const ctx = canvas.getContext("2d", { alpha: false }); const outputScale = (0, _ui_utils.getOutputScale)(ctx); - canvas.width = this.canvasWidth * outputScale.sx | 0; - canvas.height = this.canvasHeight * outputScale.sy | 0; - canvas.style.width = this.canvasWidth + "px"; - canvas.style.height = this.canvasHeight + "px"; - - if (!noCtxScale && outputScale.scaled) { - ctx.scale(outputScale.sx, outputScale.sy); - } - - return ctx; + canvas.width = upscaleFactor * this.canvasWidth * outputScale.sx | 0; + canvas.height = upscaleFactor * this.canvasHeight * outputScale.sy | 0; + const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null; + return { + ctx, + canvas, + transform + }; } - _convertCanvasToImage() { - if (!this.canvas) { - return; - } - + _convertCanvasToImage(canvas) { if (this.renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) { - return; + throw new Error("_convertCanvasToImage: Rendering has not finished."); } - const className = "thumbnailImage"; - - if (this.disableCanvasToImageConversion) { - this.canvas.className = className; - - this._thumbPageCanvas.then(msg => { - this.canvas.setAttribute("aria-label", msg); - }); - - this.div.setAttribute("data-loaded", true); - this.ring.appendChild(this.canvas); - return; - } + const reducedCanvas = this._reduceImage(canvas); const image = document.createElement("img"); - image.className = className; + image.className = "thumbnailImage"; this._thumbPageCanvas.then(msg => { image.setAttribute("aria-label", msg); @@ -8530,13 +9481,12 @@ class PDFThumbnailView { image.style.width = this.canvasWidth + "px"; image.style.height = this.canvasHeight + "px"; - image.src = this.canvas.toDataURL(); + image.src = reducedCanvas.toDataURL(); this.image = image; this.div.setAttribute("data-loaded", true); this.ring.appendChild(image); - this.canvas.width = 0; - this.canvas.height = 0; - delete this.canvas; + reducedCanvas.width = 0; + reducedCanvas.height = 0; } draw() { @@ -8555,33 +9505,33 @@ class PDFThumbnailView { } this.renderingState = _pdf_rendering_queue.RenderingStates.RUNNING; - const renderCapability = (0, _pdfjsLib.createPromiseCapability)(); - const finishRenderTask = error => { + const finishRenderTask = async (error = null) => { if (renderTask === this.renderTask) { this.renderTask = null; } if (error instanceof _pdfjsLib.RenderingCancelledException) { - renderCapability.resolve(undefined); return; } this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; - this._convertCanvasToImage(); + this._convertCanvasToImage(canvas); - if (!error) { - renderCapability.resolve(undefined); - } else { - renderCapability.reject(error); + if (error) { + throw error; } }; - const ctx = this._getPageDrawContext(); + const { + ctx, + canvas, + transform + } = this._getPageDrawContext(DRAW_UPSCALE_FACTOR); const drawViewport = this.viewport.clone({ - scale: this.scale + scale: DRAW_UPSCALE_FACTOR * this.scale }); const renderContinueCallback = cont => { @@ -8601,51 +9551,70 @@ class PDFThumbnailView { const renderContext = { canvasContext: ctx, - viewport: drawViewport + transform, + viewport: drawViewport, + optionalContentConfigPromise: this._optionalContentConfigPromise }; const renderTask = this.renderTask = pdfPage.render(renderContext); renderTask.onContinue = renderContinueCallback; - renderTask.promise.then(function () { - finishRenderTask(null); + const resultPromise = renderTask.promise.then(function () { + return finishRenderTask(null); }, function (error) { - finishRenderTask(error); + return finishRenderTask(error); }); - return renderCapability.promise; + resultPromise.finally(() => { + canvas.width = 0; + canvas.height = 0; + const pageCached = this.linkService.isPageCached(this.id); + + if (!pageCached) { + this.pdfPage?.cleanup(); + } + }); + return resultPromise; } setImage(pageView) { + if (this._checkSetImageDisabled()) { + return; + } + if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) { return; } - const img = pageView.canvas; + const { + canvas, + pdfPage + } = pageView; - if (!img) { + if (!canvas) { return; } if (!this.pdfPage) { - this.setPdfPage(pageView.pdfPage); + this.setPdfPage(pdfPage); } this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; - const ctx = this._getPageDrawContext(true); + this._convertCanvasToImage(canvas); + } - const canvas = ctx.canvas; + _reduceImage(img) { + const { + ctx, + canvas + } = this._getPageDrawContext(); if (img.width <= 2 * canvas.width) { ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height); - - this._convertCanvasToImage(); - - return; + return canvas; } let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS; let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS; - const reducedImage = TempImageFactory.getCanvas(reducedWidth, reducedHeight); - const reducedImageCtx = reducedImage.getContext("2d"); + const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(reducedWidth, reducedHeight); while (reducedWidth > img.width || reducedHeight > img.height) { reducedWidth >>= 1; @@ -8661,20 +9630,19 @@ class PDFThumbnailView { } ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height); - - this._convertCanvasToImage(); + return canvas; } get _thumbPageTitle() { return this.l10n.get("thumb_page_title", { - page: this.pageLabel !== null ? this.pageLabel : this.id - }, "Page {{page}}"); + page: this.pageLabel ?? this.id + }); } get _thumbPageCanvas() { return this.l10n.get("thumb_page_canvas", { - page: this.pageLabel !== null ? this.pageLabel : this.id - }, "Thumbnail of Page {{page}}"); + page: this.pageLabel ?? this.id + }); } setPageLabel(label) { @@ -8689,35 +9657,28 @@ class PDFThumbnailView { } this._thumbPageCanvas.then(msg => { - if (this.image) { - this.image.setAttribute("aria-label", msg); - } else if (this.disableCanvasToImageConversion && this.canvas) { - this.canvas.setAttribute("aria-label", msg); - } + this.image?.setAttribute("aria-label", msg); }); } - static cleanup() { - TempImageFactory.destroyCanvas(); - } - } exports.PDFThumbnailView = PDFThumbnailView; /***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 27 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFViewer = void 0; -var _base_viewer = __webpack_require__(25); +var _ui_utils = __webpack_require__(4); + +var _base_viewer = __webpack_require__(28); var _pdfjsLib = __webpack_require__(5); @@ -8775,7 +9736,7 @@ class PDFViewer extends _base_viewer.BaseViewer { break; } - if (page.id === currentId) { + if (page.id === currentId && this._scrollMode === _ui_utils.ScrollMode.VERTICAL && this._spreadMode === _ui_utils.SpreadMode.NONE) { stillFullyVisible = true; break; } @@ -8793,30 +9754,35 @@ class PDFViewer extends _base_viewer.BaseViewer { exports.PDFViewer = PDFViewer; /***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 28 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.BaseViewer = void 0; -var _ui_utils = __webpack_require__(2); - -var _pdf_rendering_queue = __webpack_require__(8); - -var _annotation_layer_builder = __webpack_require__(26); - var _pdfjsLib = __webpack_require__(5); -var _pdf_page_view = __webpack_require__(27); +var _ui_utils = __webpack_require__(4); -var _pdf_link_service = __webpack_require__(18); +var _pdf_rendering_queue = __webpack_require__(8); -var _text_layer_builder = __webpack_require__(28); +var _annotation_layer_builder = __webpack_require__(29); + +var _l10n_utils = __webpack_require__(30); + +var _pdf_page_view = __webpack_require__(31); + +var _pdf_link_service = __webpack_require__(19); + +var _struct_tree_layer_builder = __webpack_require__(32); + +var _text_layer_builder = __webpack_require__(33); + +var _xfa_layer_builder = __webpack_require__(34); const DEFAULT_CACHE_SIZE = 10; @@ -8856,6 +9822,10 @@ function PDFPageViewBuffer(size) { data.shift().destroy(); } }; + + this.has = function (view) { + return data.includes(view); + }; } function isSameScale(oldScale, newScale) { @@ -8876,23 +9846,39 @@ class BaseViewer { throw new Error("Cannot initialize BaseViewer."); } + const viewerVersion = '2.9.359'; + + if (_pdfjsLib.version !== viewerVersion) { + throw new Error(`The API version "${_pdfjsLib.version}" does not match the Viewer version "${viewerVersion}".`); + } + this._name = this.constructor.name; this.container = options.container; this.viewer = options.viewer || options.container.firstElementChild; + + if (!(this.container?.tagName.toUpperCase() === "DIV" && this.viewer?.tagName.toUpperCase() === "DIV")) { + throw new Error("Invalid `container` and/or `viewer` option."); + } + + if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") { + throw new Error("The `container` must be absolutely positioned."); + } + this.eventBus = options.eventBus; this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService(); this.downloadManager = options.downloadManager || null; this.findController = options.findController || null; + this._scriptingManager = options.scriptingManager || null; this.removePageBorders = options.removePageBorders || false; this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE; this.imageResourcesPath = options.imageResourcesPath || ""; - this.renderInteractiveForms = options.renderInteractiveForms || false; + this.renderInteractiveForms = options.renderInteractiveForms !== false; this.enablePrintAutoRotate = options.enablePrintAutoRotate || false; this.renderer = options.renderer || _ui_utils.RendererType.CANVAS; - this.enableWebGL = options.enableWebGL || false; this.useOnlyCssZoom = options.useOnlyCssZoom || false; this.maxCanvasPixels = options.maxCanvasPixels; - this.l10n = options.l10n || _ui_utils.NullL10n; + this.l10n = options.l10n || _l10n_utils.NullL10n; + this.enableScripting = options.enableScripting === true && !!this._scriptingManager; this.defaultRenderingQueue = !options.renderingQueue; if (this.defaultRenderingQueue) { @@ -8933,7 +9919,7 @@ class BaseViewer { } return this._pages.every(function (pageView) { - return pageView && pageView.pdfPage; + return pageView?.pdfPage; }); } @@ -8968,11 +9954,13 @@ class BaseViewer { return false; } + const previous = this._currentPageNumber; this._currentPageNumber = val; this.eventBus.dispatch("pagechanging", { source: this, pageNumber: val, - pageLabel: this._pageLabels && this._pageLabels[val - 1] + pageLabel: this._pageLabels?.[val - 1] ?? null, + previous }); if (resetCurrentPageView) { @@ -8983,7 +9971,7 @@ class BaseViewer { } get currentPageLabel() { - return this._pageLabels && this._pageLabels[this._currentPageNumber - 1]; + return this._pageLabels?.[this._currentPageNumber - 1] ?? null; } set currentPageLabel(val) { @@ -9047,6 +10035,12 @@ class BaseViewer { return; } + rotation %= 360; + + if (rotation < 0) { + rotation += 360; + } + if (this._pagesRotation === rotation) { return; } @@ -9100,6 +10094,10 @@ class BaseViewer { setDocument(pdfDocument) { if (this.pdfDocument) { + this.eventBus.dispatch("pagesdestroy", { + source: this + }); + this._cancelRendering(); this._resetView(); @@ -9107,6 +10105,10 @@ class BaseViewer { if (this.findController) { this.findController.setDocument(null); } + + if (this._scriptingManager) { + this._scriptingManager.setDocument(null); + } } this.pdfDocument = pdfDocument; @@ -9115,8 +10117,10 @@ class BaseViewer { return; } + const isPureXfa = pdfDocument.isPureXfa; const pagesCount = pdfDocument.numPages; const firstPagePromise = pdfDocument.getPage(1); + const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig(); this._pagesCapability.promise.then(() => { this.eventBus.dispatch("pagesloaded", { @@ -9154,11 +10158,13 @@ class BaseViewer { firstPagePromise.then(firstPdfPage => { this._firstPageCapability.resolve(firstPdfPage); + this._optionalContentConfigPromise = optionalContentConfigPromise; const scale = this.currentScale; const viewport = firstPdfPage.getViewport({ scale: scale * _ui_utils.CSS_UNITS }); const textLayerFactory = this.textLayerMode !== _ui_utils.TextLayerMode.DISABLE ? this : null; + const xfaLayerFactory = isPureXfa ? this : null; for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { const pageView = new _pdf_page_view.PDFPageView({ @@ -9167,14 +10173,16 @@ class BaseViewer { id: pageNum, scale, defaultViewport: viewport.clone(), + optionalContentConfigPromise, renderingQueue: this.renderingQueue, textLayerFactory, textLayerMode: this.textLayerMode, annotationLayerFactory: this, + xfaLayerFactory, + structTreeLayerFactory: this, imageResourcesPath: this.imageResourcesPath, renderInteractiveForms: this.renderInteractiveForms, renderer: this.renderer, - enableWebGL: this.enableWebGL, useOnlyCssZoom: this.useOnlyCssZoom, maxCanvasPixels: this.maxCanvasPixels, l10n: this.l10n @@ -9199,6 +10207,10 @@ class BaseViewer { this.findController.setDocument(pdfDocument); } + if (this.enableScripting) { + this._scriptingManager.setDocument(pdfDocument); + } + if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > 7500) { this._pagesCapability.resolve(); @@ -9263,9 +10275,7 @@ class BaseViewer { } for (let i = 0, ii = this._pages.length; i < ii; i++) { - const pageView = this._pages[i]; - const label = this._pageLabels && this._pageLabels[i]; - pageView.setPageLabel(label); + this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null); } } @@ -9278,6 +10288,7 @@ class BaseViewer { this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE); this._location = null; this._pagesRotation = 0; + this._optionalContentConfigPromise = null; this._pagesRequests = new WeakMap(); this._firstPageCapability = (0, _pdfjsLib.createPromiseCapability)(); this._onePageRenderedCapability = (0, _pdfjsLib.createPromiseCapability)(); @@ -9368,6 +10379,14 @@ class BaseViewer { } } + get _pageWidthScaleFactor() { + if (this._spreadMode !== _ui_utils.SpreadMode.NONE && this._scrollMode !== _ui_utils.ScrollMode.HORIZONTAL && !this.isInPresentationMode) { + return 2; + } + + return 1; + } + _setScale(value, noScroll = false) { let scale = parseFloat(value); @@ -9388,7 +10407,7 @@ class BaseViewer { [hPadding, vPadding] = [vPadding, hPadding]; } - const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale; + const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this._pageWidthScaleFactor; const pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale; switch (value) { @@ -9434,6 +10453,20 @@ class BaseViewer { }); } + pageLabelToPageNumber(label) { + if (!this._pageLabels) { + return null; + } + + const i = this._pageLabels.indexOf(label); + + if (i < 0) { + return null; + } + + return i + 1; + } + scrollPageIntoView({ pageNumber, destArray = null, @@ -9490,6 +10523,8 @@ class BaseViewer { if (y === null && this._location) { x = this._location.left; y = this._location.top; + } else if (typeof y !== "number") { + y = pageHeight; } break; @@ -9620,6 +10655,10 @@ class BaseViewer { return this.isInPresentationMode ? false : this._scrollMode === _ui_utils.ScrollMode.HORIZONTAL; } + get _isContainerRtl() { + return getComputedStyle(this.container).direction === "rtl"; + } + get isInPresentationMode() { return this.presentationModeState === _ui_utils.PresentationModeState.FULLSCREEN; } @@ -9659,7 +10698,13 @@ class BaseViewer { } _getVisiblePages() { - return (0, _ui_utils.getVisibleElements)(this.container, this._pages, true, this._isScrollModeHorizontal); + return (0, _ui_utils.getVisibleElements)({ + scrollEl: this.container, + views: this._pages, + sortByVisibility: true, + horizontal: this._isScrollModeHorizontal, + rtl: this._isScrollModeHorizontal && this._isContainerRtl + }); } isPageVisible(pageNumber) { @@ -9667,8 +10712,8 @@ class BaseViewer { return false; } - if (pageNumber < 1 || pageNumber > this.pagesCount) { - console.error(`${this._name}.isPageVisible: "${pageNumber}" is out of bounds.`); + if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) { + console.error(`${this._name}.isPageVisible: "${pageNumber}" is not a valid page.`); return false; } @@ -9677,6 +10722,25 @@ class BaseViewer { }); } + isPageCached(pageNumber) { + if (!this.pdfDocument || !this._buffer) { + return false; + } + + if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) { + console.error(`${this._name}.isPageCached: "${pageNumber}" is not a valid page.`); + return false; + } + + const pageView = this._pages[pageNumber - 1]; + + if (!pageView) { + return false; + } + + return this._buffer.has(pageView); + } + cleanup() { for (let i = 0, ii = this._pages.length; i < ii; i++) { if (this._pages[i] && this._pages[i].renderingState !== _pdf_rendering_queue.RenderingStates.FINISHED) { @@ -9749,15 +10813,33 @@ class BaseViewer { }); } - createAnnotationLayerBuilder(pageDiv, pdfPage, imageResourcesPath = "", renderInteractiveForms = false, l10n = _ui_utils.NullL10n) { + createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = false, l10n = _l10n_utils.NullL10n, enableScripting = null, hasJSActionsPromise = null, mouseState = null) { return new _annotation_layer_builder.AnnotationLayerBuilder({ pageDiv, pdfPage, + annotationStorage: annotationStorage || this.pdfDocument?.annotationStorage, imageResourcesPath, renderInteractiveForms, linkService: this.linkService, downloadManager: this.downloadManager, - l10n + l10n, + enableScripting: enableScripting ?? this.enableScripting, + hasJSActionsPromise: hasJSActionsPromise || this.pdfDocument?.hasJSActions(), + mouseState: mouseState || this._scriptingManager?.mouseState + }); + } + + createXfaLayerBuilder(pageDiv, pdfPage, annotationStorage = null) { + return new _xfa_layer_builder.XfaLayerBuilder({ + pageDiv, + pdfPage, + annotationStorage: annotationStorage || this.pdfDocument?.annotationStorage + }); + } + + createStructTreeLayerBuilder(pdfPage) { + return new _struct_tree_layer_builder.StructTreeLayerBuilder({ + pdfPage }); } @@ -9776,35 +10858,65 @@ class BaseViewer { } getPagesOverview() { - const pagesOverview = this._pages.map(function (pageView) { + return this._pages.map(pageView => { const viewport = pageView.pdfPage.getViewport({ scale: 1 }); - return { - width: viewport.width, - height: viewport.height, - rotation: viewport.rotation - }; - }); - if (!this.enablePrintAutoRotate) { - return pagesOverview; - } - - const isFirstPagePortrait = (0, _ui_utils.isPortraitOrientation)(pagesOverview[0]); - return pagesOverview.map(function (size) { - if (isFirstPagePortrait === (0, _ui_utils.isPortraitOrientation)(size)) { - return size; + if (!this.enablePrintAutoRotate || (0, _ui_utils.isPortraitOrientation)(viewport)) { + return { + width: viewport.width, + height: viewport.height, + rotation: viewport.rotation + }; } return { - width: size.height, - height: size.width, - rotation: (size.rotation + 90) % 360 + width: viewport.height, + height: viewport.width, + rotation: (viewport.rotation - 90) % 360 }; }); } + get optionalContentConfigPromise() { + if (!this.pdfDocument) { + return Promise.resolve(null); + } + + if (!this._optionalContentConfigPromise) { + return this.pdfDocument.getOptionalContentConfig(); + } + + return this._optionalContentConfigPromise; + } + + set optionalContentConfigPromise(promise) { + if (!(promise instanceof Promise)) { + throw new Error(`Invalid optionalContentConfigPromise: ${promise}`); + } + + if (!this.pdfDocument) { + return; + } + + if (!this._optionalContentConfigPromise) { + return; + } + + this._optionalContentConfigPromise = promise; + + for (const pageView of this._pages) { + pageView.update(pageView.scale, pageView.rotation, promise); + } + + this.update(); + this.eventBus.dispatch("optionalcontentconfigchanged", { + source: this, + promise + }); + } + get scrollMode() { return this._scrollMode; } @@ -9903,32 +11015,192 @@ class BaseViewer { return; } + if (this._currentScaleValue && isNaN(this._currentScaleValue)) { + this._setScale(this._currentScaleValue, true); + } + this._setCurrentPageNumber(pageNumber, true); this.update(); } + _getPageAdvance(currentPageNumber, previous = false) { + if (this.isInPresentationMode) { + return 1; + } + + switch (this._scrollMode) { + case _ui_utils.ScrollMode.WRAPPED: + { + const { + views + } = this._getVisiblePages(), + pageLayout = new Map(); + + for (const { + id, + y, + percent, + widthPercent + } of views) { + if (percent === 0 || widthPercent < 100) { + continue; + } + + let yArray = pageLayout.get(y); + + if (!yArray) { + pageLayout.set(y, yArray || (yArray = [])); + } + + yArray.push(id); + } + + for (const yArray of pageLayout.values()) { + const currentIndex = yArray.indexOf(currentPageNumber); + + if (currentIndex === -1) { + continue; + } + + const numPages = yArray.length; + + if (numPages === 1) { + break; + } + + if (previous) { + for (let i = currentIndex - 1, ii = 0; i >= ii; i--) { + const currentId = yArray[i], + expectedId = yArray[i + 1] - 1; + + if (currentId < expectedId) { + return currentPageNumber - expectedId; + } + } + } else { + for (let i = currentIndex + 1, ii = numPages; i < ii; i++) { + const currentId = yArray[i], + expectedId = yArray[i - 1] + 1; + + if (currentId > expectedId) { + return expectedId - currentPageNumber; + } + } + } + + if (previous) { + const firstId = yArray[0]; + + if (firstId < currentPageNumber) { + return currentPageNumber - firstId + 1; + } + } else { + const lastId = yArray[numPages - 1]; + + if (lastId > currentPageNumber) { + return lastId - currentPageNumber + 1; + } + } + + break; + } + + break; + } + + case _ui_utils.ScrollMode.HORIZONTAL: + { + break; + } + + case _ui_utils.ScrollMode.VERTICAL: + { + if (this._spreadMode === _ui_utils.SpreadMode.NONE) { + break; + } + + const parity = this._spreadMode - 1; + + if (previous && currentPageNumber % 2 !== parity) { + break; + } else if (!previous && currentPageNumber % 2 === parity) { + break; + } + + const { + views + } = this._getVisiblePages(), + expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1; + + for (const { + id, + percent, + widthPercent + } of views) { + if (id !== expectedId) { + continue; + } + + if (percent > 0 && widthPercent === 100) { + return 2; + } + + break; + } + + break; + } + } + + return 1; + } + + nextPage() { + const currentPageNumber = this._currentPageNumber, + pagesCount = this.pagesCount; + + if (currentPageNumber >= pagesCount) { + return false; + } + + const advance = this._getPageAdvance(currentPageNumber, false) || 1; + this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount); + return true; + } + + previousPage() { + const currentPageNumber = this._currentPageNumber; + + if (currentPageNumber <= 1) { + return false; + } + + const advance = this._getPageAdvance(currentPageNumber, true) || 1; + this.currentPageNumber = Math.max(currentPageNumber - advance, 1); + return true; + } + } exports.BaseViewer = BaseViewer; /***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 29 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.DefaultAnnotationLayerFactory = exports.AnnotationLayerBuilder = void 0; var _pdfjsLib = __webpack_require__(5); -var _ui_utils = __webpack_require__(2); +var _l10n_utils = __webpack_require__(30); -var _pdf_link_service = __webpack_require__(18); +var _pdf_link_service = __webpack_require__(19); class AnnotationLayerBuilder { constructor({ @@ -9936,9 +11208,13 @@ class AnnotationLayerBuilder { pdfPage, linkService, downloadManager, + annotationStorage = null, imageResourcesPath = "", - renderInteractiveForms = false, - l10n = _ui_utils.NullL10n + renderInteractiveForms = true, + l10n = _l10n_utils.NullL10n, + enableScripting = false, + hasJSActionsPromise = null, + mouseState = null }) { this.pageDiv = pageDiv; this.pdfPage = pdfPage; @@ -9947,18 +11223,26 @@ class AnnotationLayerBuilder { this.imageResourcesPath = imageResourcesPath; this.renderInteractiveForms = renderInteractiveForms; this.l10n = l10n; + this.annotationStorage = annotationStorage; + this.enableScripting = enableScripting; + this._hasJSActionsPromise = hasJSActionsPromise; + this._mouseState = mouseState; this.div = null; this._cancelled = false; } render(viewport, intent = "display") { - this.pdfPage.getAnnotations({ + return Promise.all([this.pdfPage.getAnnotations({ intent - }).then(annotations => { + }), this._hasJSActionsPromise]).then(([annotations, hasJSActions = false]) => { if (this._cancelled) { return; } + if (annotations.length === 0) { + return; + } + const parameters = { viewport: viewport.clone({ dontFlip: true @@ -9969,16 +11253,16 @@ class AnnotationLayerBuilder { imageResourcesPath: this.imageResourcesPath, renderInteractiveForms: this.renderInteractiveForms, linkService: this.linkService, - downloadManager: this.downloadManager + downloadManager: this.downloadManager, + annotationStorage: this.annotationStorage, + enableScripting: this.enableScripting, + hasJSActions, + mouseState: this._mouseState }; if (this.div) { _pdfjsLib.AnnotationLayer.update(parameters); } else { - if (annotations.length === 0) { - return; - } - this.div = document.createElement("div"); this.div.className = "annotationLayer"; this.pageDiv.appendChild(this.div); @@ -10000,7 +11284,7 @@ class AnnotationLayerBuilder { return; } - this.div.setAttribute("hidden", "true"); + this.div.hidden = true; } } @@ -10008,14 +11292,18 @@ class AnnotationLayerBuilder { exports.AnnotationLayerBuilder = AnnotationLayerBuilder; class DefaultAnnotationLayerFactory { - createAnnotationLayerBuilder(pageDiv, pdfPage, imageResourcesPath = "", renderInteractiveForms = false, l10n = _ui_utils.NullL10n) { + createAnnotationLayerBuilder(pageDiv, pdfPage, annotationStorage = null, imageResourcesPath = "", renderInteractiveForms = true, l10n = _l10n_utils.NullL10n, enableScripting = false, hasJSActionsPromise = null, mouseState = null) { return new AnnotationLayerBuilder({ pageDiv, pdfPage, imageResourcesPath, renderInteractiveForms, linkService: new _pdf_link_service.SimpleLinkService(), - l10n + l10n, + annotationStorage, + enableScripting, + hasJSActionsPromise, + mouseState }); } @@ -10024,24 +11312,131 @@ class DefaultAnnotationLayerFactory { exports.DefaultAnnotationLayerFactory = DefaultAnnotationLayerFactory; /***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 30 */ +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.getL10nFallback = getL10nFallback; +exports.NullL10n = void 0; +const DEFAULT_L10N_STRINGS = { + of_pages: "of {{pagesCount}}", + page_of_pages: "({{pageNumber}} of {{pagesCount}})", + document_properties_kb: "{{size_kb}} KB ({{size_b}} bytes)", + document_properties_mb: "{{size_mb}} MB ({{size_b}} bytes)", + document_properties_date_string: "{{date}}, {{time}}", + document_properties_page_size_unit_inches: "in", + document_properties_page_size_unit_millimeters: "mm", + document_properties_page_size_orientation_portrait: "portrait", + document_properties_page_size_orientation_landscape: "landscape", + document_properties_page_size_name_a3: "A3", + document_properties_page_size_name_a4: "A4", + document_properties_page_size_name_letter: "Letter", + document_properties_page_size_name_legal: "Legal", + document_properties_page_size_dimension_string: "{{width}} × {{height}} {{unit}} ({{orientation}})", + document_properties_page_size_dimension_name_string: "{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})", + document_properties_linearized_yes: "Yes", + document_properties_linearized_no: "No", + print_progress_percent: "{{progress}}%", + "toggle_sidebar.title": "Toggle Sidebar", + "toggle_sidebar_notification2.title": "Toggle Sidebar (document contains outline/attachments/layers)", + additional_layers: "Additional Layers", + page_landmark: "Page {{page}}", + thumb_page_title: "Page {{page}}", + thumb_page_canvas: "Thumbnail of Page {{page}}", + find_reached_top: "Reached top of document, continued from bottom", + find_reached_bottom: "Reached end of document, continued from top", + "find_match_count[one]": "{{current}} of {{total}} match", + "find_match_count[other]": "{{current}} of {{total}} matches", + "find_match_count_limit[one]": "More than {{limit}} match", + "find_match_count_limit[other]": "More than {{limit}} matches", + find_not_found: "Phrase not found", + error_version_info: "PDF.js v{{version}} (build: {{build}})", + error_message: "Message: {{message}}", + error_stack: "Stack: {{stack}}", + error_file: "File: {{file}}", + error_line: "Line: {{line}}", + rendering_error: "An error occurred while rendering the page.", + page_scale_width: "Page Width", + page_scale_fit: "Page Fit", + page_scale_auto: "Automatic Zoom", + page_scale_actual: "Actual Size", + page_scale_percent: "{{scale}}%", + loading: "Loading…", + loading_error: "An error occurred while loading the PDF.", + invalid_file_error: "Invalid or corrupted PDF file.", + missing_file_error: "Missing PDF file.", + unexpected_response_error: "Unexpected server response.", + printing_not_supported: "Warning: Printing is not fully supported by this browser.", + printing_not_ready: "Warning: The PDF is not fully loaded for printing.", + web_fonts_disabled: "Web fonts are disabled: unable to use embedded PDF fonts." +}; + +function getL10nFallback(key, args) { + switch (key) { + case "find_match_count": + key = `find_match_count[${args.total === 1 ? "one" : "other"}]`; + break; + + case "find_match_count_limit": + key = `find_match_count_limit[${args.limit === 1 ? "one" : "other"}]`; + break; + } + + return DEFAULT_L10N_STRINGS[key] || ""; +} + +function formatL10nValue(text, args) { + if (!args) { + return text; + } + + return text.replace(/\{\{\s*(\w+)\s*\}\}/g, (all, name) => { + return name in args ? args[name] : "{{" + name + "}}"; + }); +} + +const NullL10n = { + async getLanguage() { + return "en-us"; + }, + + async getDirection() { + return "ltr"; + }, + + async get(key, args = null, fallback = getL10nFallback(key, args)) { + return formatL10nValue(fallback, args); + }, + + async translate(element) {} + +}; +exports.NullL10n = NullL10n; + +/***/ }), +/* 31 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); exports.PDFPageView = void 0; -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); var _pdfjsLib = __webpack_require__(5); +var _l10n_utils = __webpack_require__(30); + var _pdf_rendering_queue = __webpack_require__(8); -var _viewer_compatibility = __webpack_require__(4); +var _viewer_compatibility = __webpack_require__(2); const MAX_CANVAS_PIXELS = _viewer_compatibility.viewerCompatibilityParams.maxCanvasPixels || 16777216; @@ -10057,32 +11452,42 @@ class PDFPageView { this.scale = options.scale || _ui_utils.DEFAULT_SCALE; this.viewport = defaultViewport; this.pdfPageRotate = defaultViewport.rotation; + this._optionalContentConfigPromise = options.optionalContentConfigPromise || null; this.hasRestrictedScaling = false; this.textLayerMode = Number.isInteger(options.textLayerMode) ? options.textLayerMode : _ui_utils.TextLayerMode.ENABLE; this.imageResourcesPath = options.imageResourcesPath || ""; - this.renderInteractiveForms = options.renderInteractiveForms || false; + this.renderInteractiveForms = options.renderInteractiveForms !== false; this.useOnlyCssZoom = options.useOnlyCssZoom || false; this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS; this.eventBus = options.eventBus; this.renderingQueue = options.renderingQueue; this.textLayerFactory = options.textLayerFactory; this.annotationLayerFactory = options.annotationLayerFactory; + this.xfaLayerFactory = options.xfaLayerFactory; + this.structTreeLayerFactory = options.structTreeLayerFactory; this.renderer = options.renderer || _ui_utils.RendererType.CANVAS; - this.enableWebGL = options.enableWebGL || false; - this.l10n = options.l10n || _ui_utils.NullL10n; + this.l10n = options.l10n || _l10n_utils.NullL10n; this.paintTask = null; this.paintedViewportMap = new WeakMap(); this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL; this.resume = null; - this.error = null; + this._renderError = null; this.annotationLayer = null; this.textLayer = null; this.zoomLayer = null; + this.xfaLayer = null; + this.structTreeLayer = null; const div = document.createElement("div"); div.className = "page"; div.style.width = Math.floor(this.viewport.width) + "px"; div.style.height = Math.floor(this.viewport.height) + "px"; div.setAttribute("data-page-number", this.id); + div.setAttribute("role", "region"); + this.l10n.get("page_landmark", { + page: this.id + }).then(msg => { + div.setAttribute("aria-label", msg); + }); this.div = div; container.appendChild(div); } @@ -10095,7 +11500,6 @@ class PDFPageView { scale: this.scale * _ui_utils.CSS_UNITS, rotation: totalRotation }); - this.stats = pdfPage.stats; this.reset(); } @@ -10107,6 +11511,38 @@ class PDFPageView { } } + async _renderAnnotationLayer() { + let error = null; + + try { + await this.annotationLayer.render(this.viewport, "display"); + } catch (ex) { + error = ex; + } finally { + this.eventBus.dispatch("annotationlayerrendered", { + source: this, + pageNumber: this.id, + error + }); + } + } + + async _renderXfaLayer() { + let error = null; + + try { + await this.xfaLayer.render(this.viewport, "display"); + } catch (ex) { + error = ex; + } finally { + this.eventBus.dispatch("xfalayerrendered", { + source: this, + pageNumber: this.id, + error + }); + } + } + _resetZoomLayer(removeFromDOM = false) { if (!this.zoomLayer) { return; @@ -10132,12 +11568,13 @@ class PDFPageView { div.style.height = Math.floor(this.viewport.height) + "px"; const childNodes = div.childNodes; const currentZoomLayerNode = keepZoomLayer && this.zoomLayer || null; - const currentAnnotationNode = keepAnnotations && this.annotationLayer && this.annotationLayer.div || null; + const currentAnnotationNode = keepAnnotations && this.annotationLayer?.div || null; + const currentXfaLayerNode = this.xfaLayer?.div || null; for (let i = childNodes.length - 1; i >= 0; i--) { const node = childNodes[i]; - if (currentZoomLayerNode === node || currentAnnotationNode === node) { + if (currentZoomLayerNode === node || currentAnnotationNode === node || currentXfaLayerNode === node) { continue; } @@ -10171,16 +11608,24 @@ class PDFPageView { this.loadingIconDiv = document.createElement("div"); this.loadingIconDiv.className = "loadingIcon"; + this.loadingIconDiv.setAttribute("role", "img"); + this.l10n.get("loading").then(msg => { + this.loadingIconDiv?.setAttribute("aria-label", msg); + }); div.appendChild(this.loadingIconDiv); } - update(scale, rotation) { + update(scale, rotation, optionalContentConfigPromise = null) { this.scale = scale || this.scale; if (typeof rotation !== "undefined") { this.rotation = rotation; } + if (optionalContentConfigPromise instanceof Promise) { + this._optionalContentConfigPromise = optionalContentConfigPromise; + } + const totalRotation = (this.rotation + this.pdfPageRotate) % 360; this.viewport = this.viewport.clone({ scale: this.scale * _ui_utils.CSS_UNITS, @@ -10193,7 +11638,8 @@ class PDFPageView { source: this, pageNumber: this.id, cssTransform: true, - timestamp: performance.now() + timestamp: performance.now(), + error: this._renderError }); return; } @@ -10215,12 +11661,13 @@ class PDFPageView { source: this, pageNumber: this.id, cssTransform: true, - timestamp: performance.now() + timestamp: performance.now(), + error: this._renderError }); return; } - if (!this.zoomLayer && !this.canvas.hasAttribute("hidden")) { + if (!this.zoomLayer && !this.canvas.hidden) { this.zoomLayer = this.canvas.parentNode; this.zoomLayer.style.position = "absolute"; } @@ -10250,6 +11697,12 @@ class PDFPageView { this.annotationLayer.cancel(); this.annotationLayer = null; } + + if (this._onTextLayerRendered) { + this.eventBus._off("textlayerrendered", this._onTextLayerRendered); + + this._onTextLayerRendered = null; + } } cssTransform(target, redrawAnnotations = false) { @@ -10268,8 +11721,7 @@ class PDFPageView { scaleY = width / height; } - const cssTransform = "rotate(" + relativeRotation + "deg) " + "scale(" + scaleX + "," + scaleY + ")"; - target.style.transform = cssTransform; + target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`; if (this.textLayer) { const textLayerViewport = this.textLayer.viewport; @@ -10309,12 +11761,16 @@ class PDFPageView { break; } - textLayerDiv.style.transform = "rotate(" + textAbsRotation + "deg) " + "scale(" + scale + ", " + scale + ") " + "translate(" + transX + ", " + transY + ")"; + textLayerDiv.style.transform = `rotate(${textAbsRotation}deg) ` + `scale(${scale}) ` + `translate(${transX}, ${transY})`; textLayerDiv.style.transformOrigin = "0% 0%"; } if (redrawAnnotations && this.annotationLayer) { - this.annotationLayer.render(this.viewport, "display"); + this._renderAnnotationLayer(); + } + + if (this.xfaLayer) { + this._renderXfaLayer(); } } @@ -10358,7 +11814,7 @@ class PDFPageView { canvasWrapper.style.height = div.style.height; canvasWrapper.classList.add("canvasWrapper"); - if (this.annotationLayer && this.annotationLayer.div) { + if (this.annotationLayer?.div) { div.insertBefore(canvasWrapper, this.annotationLayer.div); } else { div.appendChild(canvasWrapper); @@ -10372,7 +11828,7 @@ class PDFPageView { textLayerDiv.style.width = canvasWrapper.style.width; textLayerDiv.style.height = canvasWrapper.style.height; - if (this.annotationLayer && this.annotationLayer.div) { + if (this.annotationLayer?.div) { div.insertBefore(textLayerDiv, this.annotationLayer.div); } else { div.appendChild(textLayerDiv); @@ -10401,16 +11857,17 @@ class PDFPageView { }; } - const finishPaintTask = async error => { + const finishPaintTask = async (error = null) => { if (paintTask === this.paintTask) { this.paintTask = null; } if (error instanceof _pdfjsLib.RenderingCancelledException) { - this.error = null; + this._renderError = null; return; } + this._renderError = error; this.renderingState = _pdf_rendering_queue.RenderingStates.FINISHED; if (this.loadingIconDiv) { @@ -10420,13 +11877,12 @@ class PDFPageView { this._resetZoomLayer(true); - this.error = error; - this.stats = pdfPage.stats; this.eventBus.dispatch("pagerendered", { source: this, pageNumber: this.id, cssTransform: false, - timestamp: performance.now() + timestamp: performance.now(), + error: this._renderError }); if (error) { @@ -10437,11 +11893,12 @@ class PDFPageView { const paintTask = this.renderer === _ui_utils.RendererType.SVG ? this.paintOnSvg(canvasWrapper) : this.paintOnCanvas(canvasWrapper); paintTask.onRenderContinue = renderContinueCallback; this.paintTask = paintTask; - const resultPromise = paintTask.promise.then(function () { - return finishPaintTask(null).then(function () { + const resultPromise = paintTask.promise.then(() => { + return finishPaintTask(null).then(() => { if (textLayer) { const readableStream = pdfPage.streamTextContent({ - normalizeWhitespace: true + normalizeWhitespace: true, + includeMarkedContent: true }); textLayer.setTextContentStream(readableStream); textLayer.render(); @@ -10453,10 +11910,52 @@ class PDFPageView { if (this.annotationLayerFactory) { if (!this.annotationLayer) { - this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, this.imageResourcesPath, this.renderInteractiveForms, this.l10n); + this.annotationLayer = this.annotationLayerFactory.createAnnotationLayerBuilder(div, pdfPage, null, this.imageResourcesPath, this.renderInteractiveForms, this.l10n, null, null, null); } - this.annotationLayer.render(this.viewport, "display"); + this._renderAnnotationLayer(); + } + + if (this.xfaLayerFactory) { + if (!this.xfaLayer) { + this.xfaLayer = this.xfaLayerFactory.createXfaLayerBuilder(div, pdfPage, null); + } + + this._renderXfaLayer(); + } + + if (this.structTreeLayerFactory && this.textLayer && this.canvas) { + this._onTextLayerRendered = event => { + if (event.pageNumber !== this.id) { + return; + } + + this.eventBus._off("textlayerrendered", this._onTextLayerRendered); + + this._onTextLayerRendered = null; + + if (!this.canvas) { + return; + } + + this.pdfPage.getStructTree().then(tree => { + if (!tree) { + return; + } + + if (!this.canvas) { + return; + } + + const treeDom = this.structTreeLayer.render(tree); + treeDom.classList.add("structTree"); + this.canvas.appendChild(treeDom); + }); + }; + + this.eventBus._on("textlayerrendered", this._onTextLayerRendered); + + this.structTreeLayer = this.structTreeLayerFactory.createStructTreeLayerBuilder(pdfPage); } div.setAttribute("data-loaded", true); @@ -10483,17 +11982,12 @@ class PDFPageView { }; const viewport = this.viewport; const canvas = document.createElement("canvas"); - this.l10n.get("page_canvas", { - page: this.id - }, "Page {{page}}").then(msg => { - canvas.setAttribute("aria-label", msg); - }); - canvas.setAttribute("hidden", "hidden"); + canvas.hidden = true; let isCanvasHidden = true; const showCanvas = function () { if (isCanvasHidden) { - canvas.removeAttribute("hidden"); + canvas.hidden = false; isCanvasHidden = false; } }; @@ -10542,8 +12036,8 @@ class PDFPageView { canvasContext: ctx, transform, viewport: this.viewport, - enableWebGL: this.enableWebGL, - renderInteractiveForms: this.renderInteractiveForms + renderInteractiveForms: this.renderInteractiveForms, + optionalContentConfigPromise: this._optionalContentConfigPromise }; const renderTask = this.pdfPage.render(renderContext); @@ -10582,7 +12076,7 @@ class PDFPageView { }); const promise = pdfPage.getOperatorList().then(opList => { ensureNotCancelled(); - const svgGfx = new _pdfjsLib.SVGGraphics(pdfPage.commonObjs, pdfPage.objs); + const svgGfx = new _pdfjsLib.SVGGraphics(pdfPage.commonObjs, pdfPage.objs, _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL); return svgGfx.getSVG(opList, actualSizeViewport).then(svg => { ensureNotCancelled(); this.svg = svg; @@ -10622,16 +12116,141 @@ class PDFPageView { exports.PDFPageView = PDFPageView; /***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 32 */ +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); -exports.DefaultTextLayerFactory = exports.TextLayerBuilder = void 0; +})); +exports.StructTreeLayerBuilder = exports.DefaultStructTreeLayerFactory = void 0; +const PDF_ROLE_TO_HTML_ROLE = { + Document: null, + DocumentFragment: null, + Part: "group", + Sect: "group", + Div: "group", + Aside: "note", + NonStruct: "none", + P: null, + H: "heading", + Title: null, + FENote: "note", + Sub: "group", + Lbl: null, + Span: null, + Em: null, + Strong: null, + Link: "link", + Annot: "note", + Form: "form", + Ruby: null, + RB: null, + RT: null, + RP: null, + Warichu: null, + WT: null, + WP: null, + L: "list", + LI: "listitem", + LBody: null, + Table: "table", + TR: "row", + TH: "columnheader", + TD: "cell", + THead: "columnheader", + TBody: null, + TFoot: null, + Caption: null, + Figure: "figure", + Formula: null, + Artifact: null +}; +const HEADING_PATTERN = /^H(\d+)$/; + +class StructTreeLayerBuilder { + constructor({ + pdfPage + }) { + this.pdfPage = pdfPage; + } + + render(structTree) { + return this._walk(structTree); + } + + _setAttributes(structElement, htmlElement) { + if (structElement.alt !== undefined) { + htmlElement.setAttribute("aria-label", structElement.alt); + } + + if (structElement.id !== undefined) { + htmlElement.setAttribute("aria-owns", structElement.id); + } + } + + _walk(node) { + if (!node) { + return null; + } + + const element = document.createElement("span"); + + if ("role" in node) { + const { + role + } = node; + const match = role.match(HEADING_PATTERN); + + if (match) { + element.setAttribute("role", "heading"); + element.setAttribute("aria-level", match[1]); + } else if (PDF_ROLE_TO_HTML_ROLE[role]) { + element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]); + } + } + + this._setAttributes(node, element); + + if (node.children) { + if (node.children.length === 1 && "id" in node.children[0]) { + this._setAttributes(node.children[0], element); + } else { + for (const kid of node.children) { + element.appendChild(this._walk(kid)); + } + } + } + + return element; + } + +} + +exports.StructTreeLayerBuilder = StructTreeLayerBuilder; + +class DefaultStructTreeLayerFactory { + createStructTreeLayerBuilder(pdfPage) { + return new StructTreeLayerBuilder({ + pdfPage + }); + } + +} + +exports.DefaultStructTreeLayerFactory = DefaultStructTreeLayerFactory; + +/***/ }), +/* 33 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.TextLayerBuilder = exports.DefaultTextLayerFactory = void 0; var _pdfjsLib = __webpack_require__(5); @@ -10747,13 +12366,11 @@ class TextLayerBuilder { } const { - findController, textContentItemsStr } = this; let i = 0, iIndex = 0; const end = textContentItemsStr.length - 1; - const queryLen = findController.state.query.length; const result = []; for (let m = 0, mm = matches.length; m < mm; m++) { @@ -10774,12 +12391,7 @@ class TextLayerBuilder { offset: matchIdx - iIndex } }; - - if (matchesLength) { - matchIdx += matchesLength[m]; - } else { - matchIdx += queryLen; - } + matchIdx += matchesLength[m]; while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) { iIndex += textContentItemsStr[i].length; @@ -10920,7 +12532,7 @@ class TextLayerBuilder { clearedUntilDivIdx = match.end.divIdx + 1; } - if (!findController || !findController.highlightMatches) { + if (!findController?.highlightMatches) { return; } @@ -11006,22 +12618,106 @@ class DefaultTextLayerFactory { exports.DefaultTextLayerFactory = DefaultTextLayerFactory; /***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 34 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.XfaLayerBuilder = exports.DefaultXfaLayerFactory = void 0; + +var _pdfjsLib = __webpack_require__(5); + +class XfaLayerBuilder { + constructor({ + pageDiv, + pdfPage, + annotationStorage + }) { + this.pageDiv = pageDiv; + this.pdfPage = pdfPage; + this.annotationStorage = annotationStorage; + this.div = null; + this._cancelled = false; + } + + render(viewport, intent = "display") { + return this.pdfPage.getXfa().then(xfa => { + if (this._cancelled) { + return; + } + + const parameters = { + viewport: viewport.clone({ + dontFlip: true + }), + div: this.div, + xfa, + page: this.pdfPage, + annotationStorage: this.annotationStorage + }; + + if (this.div) { + _pdfjsLib.XfaLayer.update(parameters); + } else { + this.div = document.createElement("div"); + this.pageDiv.appendChild(this.div); + parameters.div = this.div; + + _pdfjsLib.XfaLayer.render(parameters); + } + }).catch(error => { + console.error(error); + }); + } + + cancel() { + this._cancelled = true; + } + + hide() { + if (!this.div) { + return; + } + + this.div.hidden = true; + } + +} + +exports.XfaLayerBuilder = XfaLayerBuilder; + +class DefaultXfaLayerFactory { + createXfaLayerBuilder(pageDiv, pdfPage, annotationStorage = null) { + return new XfaLayerBuilder({ + pageDiv, + pdfPage, + annotationStorage + }); + } + +} + +exports.DefaultXfaLayerFactory = DefaultXfaLayerFactory; + +/***/ }), +/* 35 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); exports.SecondaryToolbar = void 0; -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); var _pdf_cursor_tools = __webpack_require__(6); -var _pdf_single_page_viewer = __webpack_require__(30); +var _pdf_single_page_viewer = __webpack_require__(36); class SecondaryToolbar { constructor(options, mainContainer, eventBus) { @@ -11283,6 +12979,7 @@ class SecondaryToolbar { this._setMaxHeight(); this.toggleButton.classList.add("toggled"); + this.toggleButton.setAttribute("aria-expanded", "true"); this.toolbar.classList.remove("hidden"); } @@ -11294,6 +12991,7 @@ class SecondaryToolbar { this.opened = false; this.toolbar.classList.add("hidden"); this.toggleButton.classList.remove("toggled"); + this.toggleButton.setAttribute("aria-expanded", "false"); } toggle() { @@ -11324,18 +13022,17 @@ class SecondaryToolbar { exports.SecondaryToolbar = SecondaryToolbar; /***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 36 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.PDFSinglePageViewer = void 0; -var _base_viewer = __webpack_require__(25); +var _base_viewer = __webpack_require__(28); var _pdfjsLib = __webpack_require__(5); @@ -11352,6 +13049,10 @@ class PDFSinglePageViewer extends _base_viewer.BaseViewer { return (0, _pdfjsLib.shadow)(this, "_viewerElement", this._shadowViewer); } + get _pageWidthScaleFactor() { + return 1; + } + _resetView() { super._resetView(); @@ -11441,30 +13142,33 @@ class PDFSinglePageViewer extends _base_viewer.BaseViewer { _updateSpreadMode() {} + _getPageAdvance() { + return 1; + } + } exports.PDFSinglePageViewer = PDFSinglePageViewer; /***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 37 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.Toolbar = void 0; -var _ui_utils = __webpack_require__(2); +var _ui_utils = __webpack_require__(4); const PAGE_NUMBER_LOADING_INDICATOR = "visiblePageIsLoading"; const SCALE_SELECT_CONTAINER_WIDTH = 140; const SCALE_SELECT_WIDTH = 162; class Toolbar { - constructor(options, eventBus, l10n = _ui_utils.NullL10n) { + constructor(options, eventBus, l10n) { this.toolbar = options.container; this.eventBus = eventBus; this.l10n = l10n; @@ -11586,6 +13290,13 @@ class Toolbar { value: this.value }); }); + scaleSelect.addEventListener("click", function (evt) { + const target = evt.target; + + if (this.value === self.pageScaleValue && target.tagName.toUpperCase() === "OPTION") { + this.blur(); + } + }); scaleSelect.oncontextmenu = _ui_utils.noContextMenuHandler; this.eventBus._on("localized", () => { @@ -11617,7 +13328,7 @@ class Toolbar { items.pageNumber.type = "number"; this.l10n.get("of_pages", { pagesCount - }, "of {{pagesCount}}").then(msg => { + }).then(msg => { items.numPages.textContent = msg; }); } @@ -11630,7 +13341,7 @@ class Toolbar { this.l10n.get("page_of_pages", { pageNumber, pagesCount - }, "({{pageNumber}} of {{pagesCount}})").then(msg => { + }).then(msg => { items.numPages.textContent = msg; }); } else { @@ -11641,10 +13352,9 @@ class Toolbar { items.next.disabled = pageNumber >= pagesCount; items.zoomOut.disabled = pageScale <= _ui_utils.MIN_SCALE; items.zoomIn.disabled = pageScale >= _ui_utils.MAX_SCALE; - const customScale = Math.round(pageScale * 10000) / 100; this.l10n.get("page_scale_percent", { - scale: customScale - }, "{{scale}}%").then(msg => { + scale: Math.round(pageScale * 10000) / 100 + }).then(msg => { let predefinedValueFound = false; for (const option of items.scaleSelect.options) { @@ -11674,7 +13384,7 @@ class Toolbar { items, l10n } = this; - const predefinedValuesPromise = Promise.all([l10n.get("page_scale_auto", null, "Automatic Zoom"), l10n.get("page_scale_actual", null, "Actual Size"), l10n.get("page_scale_fit", null, "Page Fit"), l10n.get("page_scale_width", null, "Page Width")]); + const predefinedValuesPromise = Promise.all([l10n.get("page_scale_auto"), l10n.get("page_scale_actual"), l10n.get("page_scale_fit"), l10n.get("page_scale_width")]); let canvas = document.createElement("canvas"); canvas.mozOpaque = true; let ctx = canvas.getContext("2d", { @@ -11699,7 +13409,7 @@ class Toolbar { } const overflow = SCALE_SELECT_WIDTH - SCALE_SELECT_CONTAINER_WIDTH; - maxWidth += 1.5 * overflow; + maxWidth += 2 * overflow; if (maxWidth > SCALE_SELECT_CONTAINER_WIDTH) { items.scaleSelect.style.width = `${maxWidth + overflow}px`; @@ -11716,15 +13426,14 @@ class Toolbar { exports.Toolbar = Toolbar; /***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 38 */ +/***/ ((__unused_webpack_module, exports) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.ViewHistory = void 0; const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20; @@ -11812,24 +13521,25 @@ class ViewHistory { exports.ViewHistory = ViewHistory; /***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 39 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.GenericCom = void 0; -var _app = __webpack_require__(1); +var _app = __webpack_require__(3); -var _preferences = __webpack_require__(34); +var _preferences = __webpack_require__(40); -var _download_manager = __webpack_require__(35); +var _download_manager = __webpack_require__(41); -var _genericl10n = __webpack_require__(36); +var _genericl10n = __webpack_require__(42); + +var _generic_scripting = __webpack_require__(44); ; const GenericCom = {}; @@ -11848,7 +13558,7 @@ class GenericPreferences extends _preferences.BasePreferences { class GenericExternalServices extends _app.DefaultExternalServices { static createDownloadManager(options) { - return new _download_manager.DownloadManager(options); + return new _download_manager.DownloadManager(); } static createPreferences() { @@ -11861,56 +13571,28 @@ class GenericExternalServices extends _app.DefaultExternalServices { return new _genericl10n.GenericL10n(locale); } + static createScripting({ + sandboxBundleSrc + }) { + return new _generic_scripting.GenericScripting(sandboxBundleSrc); + } + } _app.PDFViewerApplication.externalServices = GenericExternalServices; /***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 40 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.BasePreferences = void 0; -var _app_options = __webpack_require__(3); - -let defaultPreferences = null; - -function getDefaultPreferences() { - if (!defaultPreferences) { - defaultPreferences = Promise.resolve({ - "cursorToolOnLoad": 0, - "defaultZoomValue": "", - "disablePageLabels": false, - "enablePermissions": false, - "enablePrintAutoRotate": false, - "enableWebGL": false, - "externalLinkTarget": 0, - "historyUpdateUrl": false, - "ignoreDestinationZoom": false, - "pdfBugEnabled": false, - "renderer": "canvas", - "renderInteractiveForms": false, - "sidebarViewOnLoad": -1, - "scrollModeOnLoad": -1, - "spreadModeOnLoad": -1, - "textLayerMode": 1, - "useOnlyCssZoom": false, - "viewOnLoad": 0, - "disableAutoFetch": false, - "disableFontFace": false, - "disableRange": false, - "disableStream": false - }); - } - - return defaultPreferences; -} +var _app_options = __webpack_require__(1); class BasePreferences { constructor() { @@ -11918,30 +13600,45 @@ class BasePreferences { throw new Error("Cannot initialize BasePreferences."); } - this.prefs = null; - this._initializedPromise = getDefaultPreferences().then(defaults => { - Object.defineProperty(this, "defaults", { - value: Object.freeze(defaults), - writable: false, - enumerable: true, - configurable: false - }); - this.prefs = Object.assign(Object.create(null), defaults); - return this._readFromStorage(defaults); - }).then(prefs => { - if (!prefs) { - return; - } + Object.defineProperty(this, "defaults", { + value: Object.freeze({ + "cursorToolOnLoad": 0, + "defaultZoomValue": "", + "disablePageLabels": false, + "enablePermissions": false, + "enablePrintAutoRotate": true, + "enableScripting": true, + "externalLinkTarget": 0, + "historyUpdateUrl": false, + "ignoreDestinationZoom": false, + "pdfBugEnabled": false, + "renderer": "canvas", + "renderInteractiveForms": true, + "sidebarViewOnLoad": -1, + "scrollModeOnLoad": -1, + "spreadModeOnLoad": -1, + "textLayerMode": 1, + "useOnlyCssZoom": false, + "viewerCssTheme": 0, + "viewOnLoad": 0, + "disableAutoFetch": false, + "disableFontFace": false, + "disableRange": false, + "disableStream": false, + "enableXfa": false + }), + writable: false, + enumerable: true, + configurable: false + }); + this.prefs = Object.create(null); + this._initializedPromise = this._readFromStorage(this.defaults).then(prefs => { + for (const name in this.defaults) { + const prefValue = prefs?.[name]; - for (const name in prefs) { - const defaultValue = this.defaults[name], - prefValue = prefs[name]; - - if (defaultValue === undefined || typeof prefValue !== typeof defaultValue) { - continue; + if (typeof prefValue === typeof this.defaults[name]) { + this.prefs[name] = prefValue; } - - this.prefs[name] = prefValue; } }); } @@ -11956,7 +13653,7 @@ class BasePreferences { async reset() { await this._initializedPromise; - this.prefs = Object.assign(Object.create(null), this.defaults); + this.prefs = Object.create(null); return this._writeToStorage(this.defaults); } @@ -11977,7 +13674,7 @@ class BasePreferences { if (valueType === "number" && defaultType === "string") { value = value.toString(); } else { - throw new Error(`Set preference: "${value}" is a ${valueType}, ` + `expected a ${defaultType}.`); + throw new Error(`Set preference: "${value}" is a ${valueType}, expected a ${defaultType}.`); } } else { if (valueType === "number" && !Number.isInteger(value)) { @@ -11991,24 +13688,26 @@ class BasePreferences { async get(name) { await this._initializedPromise; - const defaultValue = this.defaults[name]; + const defaultValue = this.defaults[name], + prefValue = this.prefs[name]; if (defaultValue === undefined) { throw new Error(`Get preference: "${name}" is undefined.`); - } else { - const prefValue = this.prefs[name]; - - if (prefValue !== undefined) { - return prefValue; - } } - return defaultValue; + return prefValue !== undefined ? prefValue : defaultValue; } async getAll() { await this._initializedPromise; - return Object.assign(Object.create(null), this.defaults, this.prefs); + const obj = Object.create(null); + + for (const name in this.defaults) { + const prefValue = this.prefs[name]; + obj[name] = prefValue !== undefined ? prefValue : this.defaults[name]; + } + + return obj; } } @@ -12016,23 +13715,21 @@ class BasePreferences { exports.BasePreferences = BasePreferences; /***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 41 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.DownloadManager = void 0; var _pdfjsLib = __webpack_require__(5); -var _viewer_compatibility = __webpack_require__(4); +var _viewer_compatibility = __webpack_require__(2); ; -const DISABLE_CREATE_OBJECT_URL = _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL || false; function download(blobUrl, filename) { const a = document.createElement("a"); @@ -12054,10 +13751,8 @@ function download(blobUrl, filename) { } class DownloadManager { - constructor({ - disableCreateObjectURL = DISABLE_CREATE_OBJECT_URL - }) { - this.disableCreateObjectURL = disableCreateObjectURL; + constructor() { + this._openBlobUrls = new WeakMap(); } downloadUrl(url, filename) { @@ -12069,27 +13764,45 @@ class DownloadManager { } downloadData(data, filename, contentType) { - if (navigator.msSaveBlob) { - navigator.msSaveBlob(new Blob([data], { - type: contentType - }), filename); - return; - } - - const blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, this.disableCreateObjectURL); + const blobUrl = (0, _pdfjsLib.createObjectURL)(data, contentType, _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL); download(blobUrl, filename); } - download(blob, url, filename) { - if (navigator.msSaveBlob) { - if (!navigator.msSaveBlob(blob, filename)) { - this.downloadUrl(url, filename); + openOrDownloadData(element, data, filename) { + const isPdfData = (0, _pdfjsLib.isPdfFile)(filename); + const contentType = isPdfData ? "application/pdf" : ""; + + if (isPdfData && !_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) { + let blobUrl = this._openBlobUrls.get(element); + + if (!blobUrl) { + blobUrl = URL.createObjectURL(new Blob([data], { + type: contentType + })); + + this._openBlobUrls.set(element, blobUrl); } - return; + let viewerUrl; + viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename); + + try { + window.open(viewerUrl); + return true; + } catch (ex) { + console.error(`openOrDownloadData: ${ex}`); + URL.revokeObjectURL(blobUrl); + + this._openBlobUrls.delete(element); + } } - if (this.disableCreateObjectURL) { + this.downloadData(data, filename, contentType); + return false; + } + + download(blob, url, filename, sourceEventType = "download") { + if (_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) { this.downloadUrl(url, filename); return; } @@ -12103,18 +13816,19 @@ class DownloadManager { exports.DownloadManager = DownloadManager; /***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 42 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); exports.GenericL10n = void 0; -__webpack_require__(37); +__webpack_require__(43); + +var _l10n_utils = __webpack_require__(30); const webL10n = document.webL10n; @@ -12138,9 +13852,9 @@ class GenericL10n { return l10n.getDirection(); } - async get(property, args, fallback) { + async get(key, args = null, fallback = (0, _l10n_utils.getL10nFallback)(key, args)) { const l10n = await this._ready; - return l10n.get(property, args, fallback); + return l10n.get(key, args, fallback); } async translate(element) { @@ -12153,10 +13867,9 @@ class GenericL10n { exports.GenericL10n = GenericL10n; /***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { +/* 43 */ +/***/ (() => { -"use strict"; document.webL10n = function (window, document, undefined) { @@ -12976,34 +14689,96 @@ document.webL10n = function (window, document, undefined) { }(window, document); /***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 44 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -Object.defineProperty(exports, "__esModule", { + +Object.defineProperty(exports, "__esModule", ({ value: true -}); +})); +exports.docPropertiesLookup = docPropertiesLookup; +exports.GenericScripting = void 0; + +var _pdfjsLib = __webpack_require__(5); + +async function docPropertiesLookup(pdfDocument) { + const url = "", + baseUrl = url.split("#")[0]; + let { + info, + metadata, + contentDispositionFilename, + contentLength + } = await pdfDocument.getMetadata(); + + if (!contentLength) { + const { + length + } = await pdfDocument.getDownloadInfo(); + contentLength = length; + } + + return { ...info, + baseURL: baseUrl, + filesize: contentLength, + filename: contentDispositionFilename || (0, _pdfjsLib.getPdfFilenameFromUrl)(url), + metadata: metadata?.getRaw(), + authors: metadata?.get("dc:creator"), + numPages: pdfDocument.numPages, + URL: url + }; +} + +class GenericScripting { + constructor(sandboxBundleSrc) { + this._ready = (0, _pdfjsLib.loadScript)(sandboxBundleSrc, true).then(() => { + return window.pdfjsSandbox.QuickJSSandbox(); + }); + } + + async createSandbox(data) { + const sandbox = await this._ready; + sandbox.create(data); + } + + async dispatchEventInSandbox(event) { + const sandbox = await this._ready; + sandbox.dispatchEvent(event); + } + + async destroySandbox() { + const sandbox = await this._ready; + sandbox.nukeSandbox(); + } + +} + +exports.GenericScripting = GenericScripting; + +/***/ }), +/* 45 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); exports.PDFPrintService = PDFPrintService; -var _ui_utils = __webpack_require__(2); +var _app = __webpack_require__(3); -var _app = __webpack_require__(1); - -var _app_options = __webpack_require__(3); +var _viewer_compatibility = __webpack_require__(2); let activeService = null; let overlayManager = null; -function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) { +function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size, printResolution, optionalContentConfigPromise) { const scratchCanvas = activeService.scratchCanvas; - const PRINT_RESOLUTION = _app_options.AppOptions.get("printResolution") || 150; - const PRINT_UNITS = PRINT_RESOLUTION / 72.0; + const PRINT_UNITS = printResolution / 72.0; scratchCanvas.width = Math.floor(size.width * PRINT_UNITS); scratchCanvas.height = Math.floor(size.height * PRINT_UNITS); - const width = Math.floor(size.width * _ui_utils.CSS_UNITS) + "px"; - const height = Math.floor(size.height * _ui_utils.CSS_UNITS) + "px"; const ctx = scratchCanvas.getContext("2d"); ctx.save(); ctx.fillStyle = "rgb(255, 255, 255)"; @@ -13017,23 +14792,21 @@ function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) { scale: 1, rotation: size.rotation }), - intent: "print" + intent: "print", + includeAnnotationStorage: true, + optionalContentConfigPromise }; return pdfPage.render(renderContext).promise; - }).then(function () { - return { - width, - height - }; }); } -function PDFPrintService(pdfDocument, pagesOverview, printContainer, l10n) { +function PDFPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise = null, l10n) { this.pdfDocument = pdfDocument; this.pagesOverview = pagesOverview; this.printContainer = printContainer; - this.l10n = l10n || _ui_utils.NullL10n; - this.disableCreateObjectURL = _app_options.AppOptions.get("disableCreateObjectURL"); + this._printResolution = printResolution || 150; + this._optionalContentConfigPromise = optionalContentConfigPromise || pdfDocument.getOptionalContentConfig(); + this.l10n = l10n; this.currentPage = -1; this.scratchCanvas = document.createElement("canvas"); } @@ -13053,7 +14826,7 @@ PDFPrintService.prototype = { this.pageStyleSheet = document.createElement("style"); const pageSize = this.pagesOverview[0]; - this.pageStyleSheet.textContent = "@supports ((size:A4) and (size:1pt 1pt)) {" + "@page { size: " + pageSize.width + "pt " + pageSize.height + "pt;}" + "}"; + this.pageStyleSheet.textContent = "@page { size: " + pageSize.width + "pt " + pageSize.height + "pt;}"; body.appendChild(this.pageStyleSheet); }, @@ -13097,7 +14870,7 @@ PDFPrintService.prototype = { const index = this.currentPage; renderProgress(index, pageCount, this.l10n); - renderPage(this, this.pdfDocument, index + 1, this.pagesOverview[index]).then(this.useRenderedPage.bind(this)).then(function () { + renderPage(this, this.pdfDocument, index + 1, this.pagesOverview[index], this._printResolution, this._optionalContentConfigPromise).then(this.useRenderedPage.bind(this)).then(function () { renderNextPage(resolve, reject); }, reject); }; @@ -13105,14 +14878,12 @@ PDFPrintService.prototype = { return new Promise(renderNextPage); }, - useRenderedPage(printItem) { + useRenderedPage() { this.throwIfInactive(); const img = document.createElement("img"); - img.style.width = printItem.width; - img.style.height = printItem.height; const scratchCanvas = this.scratchCanvas; - if ("toBlob" in scratchCanvas && !this.disableCreateObjectURL) { + if ("toBlob" in scratchCanvas && !_viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL) { scratchCanvas.toBlob(function (blob) { img.src = URL.createObjectURL(blob); }); @@ -13214,7 +14985,7 @@ function renderProgress(index, total, l10n) { progressBar.value = progress; l10n.get("print_progress_percent", { progress - }, progress + "%").then(msg => { + }).then(msg => { progressPerc.textContent = msg; }); } @@ -13263,17 +15034,236 @@ function ensureOverlay() { _app.PDFPrintServiceFactory.instance = { supportsPrinting: true, - createPrintService(pdfDocument, pagesOverview, printContainer, l10n) { + createPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, l10n) { if (activeService) { throw new Error("The print service is created and active."); } - activeService = new PDFPrintService(pdfDocument, pagesOverview, printContainer, l10n); + activeService = new PDFPrintService(pdfDocument, pagesOverview, printContainer, printResolution, optionalContentConfigPromise, l10n); return activeService; } }; /***/ }) -/******/ ]); +/******/ ]); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +var exports = __webpack_exports__; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "PDFViewerApplicationOptions", ({ + enumerable: true, + get: function () { + return _app_options.AppOptions; + } +})); +Object.defineProperty(exports, "PDFViewerApplication", ({ + enumerable: true, + get: function () { + return _app.PDFViewerApplication; + } +})); + +var _app_options = __webpack_require__(1); + +var _app = __webpack_require__(3); + +const pdfjsVersion = '2.9.359'; +const pdfjsBuild = 'e667c8cbc'; +window.PDFViewerApplication = _app.PDFViewerApplication; +window.PDFViewerApplicationOptions = _app_options.AppOptions; +; +; +{ + __webpack_require__(39); +} +; +{ + __webpack_require__(45); +} + +function getViewerConfiguration() { + let errorWrapper = null; + 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") + }; + 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") + }, + 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"), + layersButton: document.getElementById("viewLayers"), + thumbnailView: document.getElementById("thumbnailView"), + outlineView: document.getElementById("outlineView"), + attachmentsView: document.getElementById("attachmentsView"), + layersView: document.getElementById("layersView"), + outlineOptionsContainer: document.getElementById("outlineOptionsContainer"), + currentOutlineItemButton: document.getElementById("currentOutlineItem") + }, + 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, + printContainer: document.getElementById("printContainer"), + openFileInputName: "fileInput", + debuggerScriptPath: "./debugger.js" + }; +} + +function webViewerLoad() { + const config = getViewerConfiguration(); + const event = document.createEvent("CustomEvent"); + event.initCustomEvent("webviewerloaded", true, true, { + source: window + }); + + try { + parent.document.dispatchEvent(event); + } catch (ex) { + console.error(`webviewerloaded: ${ex}`); + document.dispatchEvent(event); + } + + _app.PDFViewerApplication.run(config); +} + +if (document.blockUnblockOnload) { + document.blockUnblockOnload(true); +} + +if (document.readyState === "interactive" || document.readyState === "complete") { + webViewerLoad(); +} else { + document.addEventListener("DOMContentLoaded", webViewerLoad, true); +} +})(); + +/******/ })() +; //# sourceMappingURL=viewer.js.map \ No newline at end of file diff --git a/org.adempiere.ui.zk/pdf.js/web/viewer.js.map b/org.adempiere.ui.zk/pdf.js/web/viewer.js.map index a99f7e26e8..3b686be6d0 100644 --- a/org.adempiere.ui.zk/pdf.js/web/viewer.js.map +++ b/org.adempiere.ui.zk/pdf.js/web/viewer.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///web/viewer.js","webpack:///web/app.js","webpack:///web/ui_utils.js","webpack:///web/app_options.js","webpack:///web/viewer_compatibility.js","webpack:///web/pdfjs.js","webpack:///web/pdf_cursor_tools.js","webpack:///web/grab_to_pan.js","webpack:///web/pdf_rendering_queue.js","webpack:///web/pdf_sidebar.js","webpack:///web/overlay_manager.js","webpack:///web/password_prompt.js","webpack:///web/pdf_attachment_viewer.js","webpack:///web/pdf_document_properties.js","webpack:///web/pdf_find_bar.js","webpack:///web/pdf_find_controller.js","webpack:///web/pdf_find_utils.js","webpack:///web/pdf_history.js","webpack:///web/pdf_link_service.js","webpack:///web/pdf_outline_viewer.js","webpack:///web/pdf_presentation_mode.js","webpack:///web/pdf_sidebar_resizer.js","webpack:///web/pdf_thumbnail_viewer.js","webpack:///web/pdf_thumbnail_view.js","webpack:///web/pdf_viewer.js","webpack:///web/base_viewer.js","webpack:///web/annotation_layer_builder.js","webpack:///web/pdf_page_view.js","webpack:///web/text_layer_builder.js","webpack:///web/secondary_toolbar.js","webpack:///web/pdf_single_page_viewer.js","webpack:///web/toolbar.js","webpack:///web/view_history.js","webpack:///web/genericcom.js","webpack:///web/preferences.js","webpack:///web/download_manager.js","webpack:///web/genericl10n.js","webpack:///external/webL10n/l10n.js","webpack:///web/pdf_print_service.js"],"names":["pdfjsWebApp","require","pdfjsWebAppOptions","appContainer","document","mainContainer","viewerContainer","eventBus","toolbar","container","numPages","pageNumber","scaleSelectContainer","scaleSelect","customScaleOption","previous","next","zoomIn","zoomOut","viewFind","openFile","print","presentationModeButton","download","viewBookmark","secondaryToolbar","toggleButton","toolbarButtonContainer","openFileButton","printButton","downloadButton","viewBookmarkButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","cursorHandToolButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","documentPropertiesButton","fullscreen","contextFirstPage","contextLastPage","contextPageRotateCw","contextPageRotateCcw","sidebar","outerContainer","thumbnailButton","outlineButton","attachmentsButton","thumbnailView","outlineView","attachmentsView","sidebarResizer","resizer","findBar","bar","findField","highlightAllCheckbox","caseSensitiveCheckbox","entireWordCheckbox","findMsg","findResultsCount","findPreviousButton","findNextButton","passwordOverlay","overlayName","label","input","submitButton","cancelButton","documentProperties","closeButton","fields","fileName","fileSize","title","author","subject","keywords","creationDate","modificationDate","creator","producer","version","pageCount","pageSize","linearized","errorWrapper","errorMessage","errorMoreInfo","moreInfoButton","lessInfoButton","printContainer","openFileInputName","debuggerScriptPath","config","getViewerConfiguration","window","event","source","parent","console","webViewerLoad","DEFAULT_SCALE_DELTA","DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT","FORCE_PAGES_LOADED_TIMEOUT","WHEEL_ZOOM_DISABLED_TIMEOUT","ENABLE_PERMISSIONS_CLASS","ViewOnLoad","UNKNOWN","PREVIOUS","INITIAL","constructor","shadow","ctrlKey","metaKey","PDFViewerApplication","initialBookmark","_initializedCapability","fellback","appConfig","pdfDocument","pdfLoadingTask","printService","pdfViewer","pdfThumbnailViewer","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfHistory","pdfSidebar","pdfSidebarResizer","pdfOutlineViewer","pdfAttachmentViewer","pdfCursorTools","store","downloadManager","overlayManager","preferences","l10n","isInitialViewSet","downloadComplete","isViewerEmbedded","url","baseUrl","externalServices","_boundEvents","contentDispositionFilename","AppOptions","LinkTarget","prefs","reason","hash","hashParams","parseQueryString","waitOn","loadFakeWorker","TextLayerMode","viewer","enabled","loadAndEnablePDFBug","locale","dir","isInAutomation","externalLinkTarget","externalLinkRel","ignoreDestinationZoom","disableCreateObjectURL","findController","linkService","renderingQueue","renderer","enableWebGL","textLayerMode","imageResourcesPath","renderInteractiveForms","enablePrintAutoRotate","useOnlyCssZoom","maxCanvasPixels","cursorToolOnLoad","contextMenuItems","elements","run","newScale","Math","zoomReset","PDFPrintServiceFactory","doc","support","initPassiveLoading","setTitleUsingUrl","getPDFFileNameFromURL","decodeURIComponent","getFilenameFromUrl","setTitle","promise","webViewerResetPermissions","PDFBug","workerParameters","OptionKind","GlobalWorkerOptions","parameters","Object","file","apiParameters","value","key","args","loadingTask","getDocument","loaded","exception","message","loadingErrorMessage","msg","filename","err","downloadByUrl","blob","type","fallback","error","moreInfoText","build","moreInfo","stack","line","errorWrapperConfig","Promise","parts","progress","percent","level","isNaN","disableAutoFetch","clearTimeout","load","firstPagePromise","pageLayoutPromise","pageModePromise","openActionPromise","baseDocumentUrl","storedPromise","page","zoom","scrollLeft","scrollTop","rotation","sidebarView","SidebarView","scrollMode","ScrollMode","spreadMode","SpreadMode","pdfPage","viewOnLoad","fingerprint","initialDest","openAction","stored","parseInt","pageMode","apiPageModeToSidebarView","pageLayout","apiPageLayoutToSpreadMode","resolve","setTimeout","pagesPromise","onePageRendered","outline","attachments","triggerAutoPrint","javaScript","js","UNSUPPORTED_FEATURES","AutoPrintRegExp","info","infoTitle","pdfTitle","metadataTitle","metadata","versionId","KNOWN_VERSIONS","generatorId","KNOWN_GENERATORS","generator","formType","labels","numLabels","i","_initializePdfHistory","resetHistory","updateUrl","JSON","explicitDest","permissions","PermissionFlag","setInitialView","setRotation","angle","isValidRotation","setViewerModes","isValidScrollMode","isValidSpreadMode","cleanup","RendererType","forceRendering","beforePrint","printMessage","notReadyMessage","pagesOverview","afterPrint","rotatePages","newRotation","requestPresentationMode","bindEvents","bindWindowEvents","passive","unbindEvents","unbindWindowEvents","HOSTED_VIEWER_ORIGINS","validateFileURL","viewerOrigin","origin","protocol","ex","loadScript","PDFWorker","OPS","queryString","params","fileInput","files","evt","webViewerOpenFileViaURL","xhr","pageIndex","pageView","Stats","timestamp","view","action","state","PresentationModeState","location","href","currentPage","loading","RenderingStates","currentScaleValue","webViewerFileInputChange","URL","originalUrl","fileReader","buffer","webViewerOpenFile","query","phraseSearch","caseSensitive","entireWord","highlightAll","findPrevious","result","setZoomDisabledTimeout","zoomDisabledTimeout","supportedMouseWheelZoomModifierKeys","previousScale","delta","normalizeWheelEventDelta","MOUSE_WHEEL_DELTA_PER_PAGE_SCALE","ticks","currentScale","scaleCorrectionFactor","rect","dx","dy","handled","ensureViewerFocused","cmd","isViewerInPresentationMode","findState","curElement","curElementTagName","turnPage","turnOnlyIfPageFit","CursorTool","instance","supportsPrinting","createPrintService","CSS_UNITS","DEFAULT_SCALE_VALUE","DEFAULT_SCALE","MIN_SCALE","MAX_SCALE","UNKNOWN_SCALE","MAX_AUTO_SCALE","SCROLLBAR_PADDING","VERTICAL_PADDING","NORMAL","CHANGING","FULLSCREEN","CANVAS","SVG","DISABLE","ENABLE","ENABLE_ENHANCE","VERTICAL","HORIZONTAL","WRAPPED","NONE","ODD","EVEN","name","NullL10n","formatL10nValue","devicePixelRatio","backingStoreRatio","ctx","pixelRatio","sx","sy","scaled","skipOverflowHiddenElements","element","offsetY","offsetX","getComputedStyle","spot","debounceScroll","rAF","currentX","viewAreaElement","lastX","currentY","lastY","callback","right","down","_eventHandler","ii","param","minIndex","maxIndex","items","condition","currentIndex","currentItem","xinv","limit","x_","x","a","b","c","d","p","q","r","changeOrientation","rotate","width","height","index","elt","views","pageTop","sortByVisibility","horizontal","top","scrollEl","bottom","left","elementBottom","elementRight","visible","numViews","firstVisibleElementInd","binarySearchFirstItem","backtrackBeforeAllVisibleElements","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","hiddenWidth","id","y","first","last","pc","defaultFilename","isDataSchema","reURI","reFilename","splitURI","suggestedFilename","MOUSE_DOM_DELTA_PIXEL_MODE","MOUSE_DOM_DELTA_LINE_MODE","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","Number","mode","size","WaitOnType","EVENT","TIMEOUT","delay","target","eventHandler","handler","timeoutHandler","timeout","animationStarted","on","external","off","dispatch","eventListeners","Array","externalListeners","listener","_on","options","_off","units","_updateBar","progressSize","clamp","setWidth","scrollbarWidth","hide","show","moved","len","arr","write","read","VIEWER","API","WORKER","PREFERENCE","defaultOptions","kind","defaultUrl","defaultZoomValue","compatibility","viewerCompatibilityParams","disableHistory","disablePageLabels","enablePermissions","historyUpdateUrl","pdfBugEnabled","printResolution","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","cMapPacked","cMapUrl","disableFontFace","disableRange","disableStream","docBaseUrl","fontExtraProperties","isEvalSupported","maxImageSize","pdfBug","verbosity","workerPort","workerSrc","navigator","userOptions","userOption","defaultOption","valueType","compatibilityParams","userAgent","platform","maxTouchPoints","isAndroid","isIE","isIOS","isIOSChrome","pdfjsLib","__non_webpack_require__","module","SELECT","HAND","ZOOM","switchTool","tool","disableActiveTool","_dispatchEvent","_addEventListeners","previouslyActive","overlay","GrabToPan","CSS_CLASS_GRAB","activate","deactivate","toggle","ignoreTarget","node","_onmousedown","focusedElement","_onmousemove","isLeftMouseReleased","xDiff","yDiff","behavior","_endPan","prefix","matchesSelector","isNotIEorIsIE10plus","chrome","isChrome15OrOpera15plus","isSafari6plus","CLEANUP_TIMEOUT","RUNNING","PAUSED","FINISHED","setViewer","setThumbnailViewer","isHighestPriority","renderHighestPriority","getHighestPriority","visibleViews","numVisible","nextPageIndex","previousPageIndex","isViewFinished","renderView","UI_NOTIFICATION_CLASS","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","disableNotification","reset","switchView","forceOpen","_switchView","isViewChanged","shouldForceRendering","open","close","_forceRendering","_updateThumbnailViewer","pagesCount","_showUINotification","_hideUINotification","removeNotification","outlineCount","callerCloseMethod","canForceClose","_keyDown","_closeThroughCaller","e","PasswordResponses","promptString","verify","password","setUpdateCallback","keepRenderedCapability","_bindPdfLink","button","blobUrl","viewerUrl","encodeURIComponent","_bindLink","render","attachmentsCount","names","item","removeNullCharacters","div","_appendAttachment","DEFAULT_FIELD_CONTENT","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","isPortrait","pageNames","freezeFieldData","data","writable","enumerable","configurable","currentPageNumber","pagesRotation","getPageSizeInches","_currentPageNumber","_pagesRotation","setDocument","setFileSize","_reset","_updateUI","content","kb","size_kb","size_b","size_mb","pageSizeInches","isPortraitOrientation","sizeInches","sizeMillimeters","pageName","rawName","getPageName","exactMillimeters","intMillimeters","dateObject","PDFDateString","date","time","_parseLinearization","isLinearized","MATCHES_COUNT_LIMIT","dispatchEvent","updateUIState","notFound","status","FindState","updateResultsCount","current","total","matchesCountMsg","_adjustWidth","findbarHeight","inputContainerHeight","FOUND","NOT_FOUND","PENDING","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","normalizationRegex","replace","executeCommand","findbarClosed","pendingTimeout","scrollMatchIntoView","matchIndex","scrollIntoView","pageIdx","matchIdx","wrapped","normalize","_shouldDirtyMatch","_prepareMatches","currentElem","matchesWithLength","nextElem","prevElem","isSubTerm","matches","matchesLength","_isEntireWord","startIdx","getCharacterType","endIdx","_calculatePhraseMatch","queryLen","pageContent","_calculateWordMatch","queryArray","subquery","subqueryLen","match","matchLength","skipped","_calculateMatch","pageMatchesCount","_extractText","extractTextCapability","normalizeWhitespace","textContent","textItems","strBuf","j","jj","_updatePage","_updateAllPages","_nextMatch","currentPageIndex","offset","numPageMatches","_matchesReady","numMatches","_nextPageMatch","_advanceOffsetPage","_updateMatch","found","previousPage","_onFindBarClose","_requestMatchesCount","_updateUIResultsCount","matchesCount","_updateUIState","CharacterType","SPACE","ALPHA_LETTER","PUNCT","HAN_LETTER","KATAKANA_LETTER","HIRAGANA_LETTER","HALFWIDTH_KATAKANA_LETTER","THAI_LETTER","charCode","isAlphabeticalScript","isAscii","isAsciiSpace","isAsciiAlpha","isAsciiDigit","isThai","isHan","isKatakana","isHiragana","isHalfwidthKatakana","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","onPagesLoaded","initialize","reInitialized","getCurrentHash","destination","push","namedDest","forceReplace","isDestArraysEqual","dest","pushCurrentPosition","back","forward","_pushOrReplaceState","shouldReplace","newState","uid","newUrl","_tryPushCurrentPosition","temporary","position","_isValidState","checkReload","performance","perfEntry","_updateInternalState","removeTemporary","_parseCurrentHash","checkNameddest","unescape","nameddest","_updateViewarea","_popState","newHash","hashChanged","waitOnEventOrTimeout","_pageHide","_bindEvents","updateViewarea","popState","pageHide","_unbindEvents","destHash","second","isEntryEqual","firstDest","secondDest","externalLinkEnabled","setHistory","navigateTo","goToDestination","destRef","destArray","getDestinationHash","escape","str","getAnchorUrl","setHash","zoomArgs","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","isValidExplicitDestination","executeNamedAction","cachePageRef","refStr","pageRef","_cachedPageNumber","isPageVisible","destLength","allowNull","DEFAULT_TITLE","addLinkAttributes","newWindow","rel","_setStyles","_addToggleButton","toggler","count","shouldShowAll","_toggleOutlineItem","root","toggleOutlineTree","fragment","queue","hasAnyNesting","levelData","itemsDiv","DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS","DELAY_BEFORE_HIDING_CONTROLS","ACTIVE_SELECTOR","CONTROLS_SELECTOR","MOUSE_SCROLL_COOLDOWN_TIME","PAGE_SWITCH_THRESHOLD","SWIPE_MIN_DISTANCE_THRESHOLD","SWIPE_ANGLE_THRESHOLD","request","Element","_mouseWheel","currentTime","storedTime","totalDelta","success","_goToPreviousPage","_goToNextPage","_notifyStateChange","active","switchInProgress","_setSwitchInProgress","_resetSwitchInProgress","_enter","_exit","_mouseDown","isInternalLink","_contextMenu","_showControls","_hideControls","_resetMouseScrollState","_touchSwipe","startX","startY","endX","endY","absAngle","_addWindowListeners","_removeWindowListeners","_fullscreenChange","_addFullscreenChangeListeners","_removeFullscreenChangeListeners","SIDEBAR_WIDTH_VAR","SIDEBAR_MIN_WIDTH","SIDEBAR_RESIZING_CLASS","CSS","_updateWidth","newWidth","_mouseMove","_mouseUp","updated","THUMBNAIL_SCROLL_MARGIN","THUMBNAIL_SELECTED_CLASS","watchScroll","_scrollUpdated","getThumbnail","_getVisibleThumbs","getVisibleElements","scrollThumbnailIntoView","prevThumbnailView","visibleThumbs","numVisibleThumbs","shouldScroll","PDFThumbnailView","_resetView","firstPdfPage","viewport","scale","pageNum","thumbnail","defaultViewport","disableCanvasToImageConversion","firstThumbnailView","_cancelRendering","setPageLabels","_ensurePdfPageLoaded","thumbView","MAX_NUM_SCALING_STEPS","THUMBNAIL_CANVAS_BORDER_WIDTH","THUMBNAIL_WIDTH","TempImageFactory","tempCanvasCache","getCanvas","tempCanvas","alpha","destroyCanvas","anchor","ring","borderAdjustment","setPdfPage","totalRotation","childNodes","update","cancelRendering","_getPageDrawContext","noCtxScale","canvas","outputScale","getOutputScale","_convertCanvasToImage","className","image","draw","renderCapability","finishRenderTask","renderTask","drawViewport","renderContinueCallback","cont","renderContext","canvasContext","setImage","img","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","setPageLabel","_scrollIntoView","pageSpot","pageDiv","_getVisiblePages","_updateHelper","currentId","stillFullyVisible","visiblePages","DEFAULT_CACHE_SIZE","pageIdsToKeep","iMax","pagesToKeep","moveToEndOfArray","getPageView","_setCurrentPageNumber","resetCurrentPageView","val","pageLabel","_onePageRenderedOrForceFetch","textLayerFactory","annotationLayerFactory","firstPageView","getPagesLeft","_scrollUpdate","_setScaleUpdatePages","noScroll","preset","newValue","isSameScale","presetValue","_setScale","noPadding","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","_resetCurrentPageView","scrollPageIntoView","pageWidth","pageHeight","widthScale","heightScale","boundingRect","_updateLocation","normalizedScaleValue","firstPage","pdfOpenParams","currentPageView","topLeft","intLeft","intTop","numVisiblePages","newCacheSize","containsElement","focus","_getCurrentVisiblePage","currentlyVisiblePages","scrollAhead","createTextLayerBuilder","enhanceTextSelection","createAnnotationLayerBuilder","getPagesOverview","isFirstPagePortrait","_updateScrollMode","_updateSpreadMode","pages","parity","spread","intent","annotations","dontFlip","AnnotationLayer","cancel","MAX_CANVAS_PIXELS","destroy","_resetZoomLayer","removeFromDOM","zoomLayerCanvas","keepZoomLayer","keepAnnotations","currentZoomLayerNode","currentAnnotationNode","cssTransform","isScalingRestricted","redrawAnnotations","relativeRotation","absRotation","scaleX","scaleY","textLayerViewport","textRelativeRotation","textAbsRotation","textLayerDiv","transX","transY","getPagePoint","canvasWrapper","textLayer","finishPaintTask","paintTask","resultPromise","readableStream","paintOnCanvas","onRenderContinue","isCanvasHidden","showCanvas","actualSizeViewport","pixelsInViewport","maxScale","sfx","approximateFraction","sfy","roundToDivide","transform","paintOnSvg","cancelled","ensureNotCancelled","opList","svgGfx","svg","wrapper","EXPAND_DIVS_TIMEOUT","_finishRendering","endOfContent","numTextDivs","textLayerFrag","textContentStream","textDivs","textContentItemsStr","setTextContentStream","setTextContent","_convertMatches","iIndex","end","m","mm","begin","divIdx","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","infinity","appendTextToDiv","span","i0","i1","isSelected","highlightSuffix","beginText","n0","n1","_updateMatches","clearedUntilDivIdx","n","pageMatches","pageMatchesLength","_bindMouse","expandDivsTimer","adjustTop","divBounds","eventName","eventDetails","lastPage","pageRotateCw","pageRotateCcw","setPageNumber","setPagesCount","_bindClickListeners","details","_bindCursorToolsListener","buttons","_bindScrollModeListener","isScrollModeHorizontal","scrollModeChanged","_bindSpreadModeListener","spreadModeChanged","_setMaxHeight","_ensurePageViewVisible","previousPageView","viewerNodes","scrolledDown","PAGE_NUMBER_LOADING_INDICATOR","SCALE_SELECT_CONTAINER_WIDTH","SCALE_SELECT_WIDTH","setPageScale","_bindListeners","self","resetNumPages","pageScale","customScale","predefinedValueFound","option","updateLoadingIndicatorState","pageNumberInput","predefinedValuesPromise","maxWidth","overflow","DEFAULT_VIEW_HISTORY_CACHE_SIZE","cacheSize","databaseStr","database","branch","localStorage","properties","values","GenericCom","defaultPreferences","defaults","defaultValue","prefValue","defaultType","DISABLE_CREATE_OBJECT_URL","downloadUrl","createValidAbsoluteUrl","downloadData","createObjectURL","webL10n","gL10nData","gTextData","gTextProp","gLanguage","gMacros","gReadyState","gAsyncResourceLoading","script","l10nId","l10nArgs","onSuccess","onFailure","baseURL","text","dictionary","reBlank","reComment","reSection","reImport","reSplit","entries","rawText","currentLang","genericLang","lang","skipLang","parsedRawLinesCallback","loadImport","tmp","evalString","nextEntry","xhrLoadText","parseRawLines","parsedPropertiesCallback","parseProperties","prop","successCallback","clear","langLinks","getL10nResourceLinks","langCount","dict","getL10nDictionary","defaultLocale","anyCaseLang","onResourceLoaded","gResourceCount","link","parseResource","resource","locales2rules","list","start","pluralRules","isBetween","getPluralRules","rv","substIndexes","substArguments","reIndex","reMatch","macroName","paramName","macro","reArgs","arg","getL10nAttributes","getL10nData","getChildElementCount","children","l","textNode","getTranslatableChildren","elementCount","translateElement","get","getData","getText","getLanguage","setLanguage","loadLocale","getDirection","rtlList","shortCode","translate","getReadyState","ready","activeService","scratchCanvas","PRINT_RESOLUTION","PRINT_UNITS","PDFPrintService","layout","body","hasEqualPageSizes","ensureOverlay","renderPages","renderNextPage","renderProgress","renderPage","useRenderedPage","printItem","performPrint","throwIfInactive","activeServiceOnEntry","abort","progressContainer","progressBar","progressPerc","stopPropagationIfNeeded","overlayPromise"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAA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InD,CAAhBA;AAMA,WAVmE,aAUnE;AAb8B;;AAAA,CAAlC/nC,C","file":"viewer.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\"use strict\";\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n var defaultUrl; // eslint-disable-line no-var\n\n (function rewriteUrlClosure() {\n // Run this code outside DOMContentLoaded to make sure that the URL\n // is rewritten as soon as possible.\n const queryString = document.location.search.slice(1);\n const m = /(^|&)file=([^&]*)/.exec(queryString);\n defaultUrl = m ? decodeURIComponent(m[2]) : \"\";\n\n // Example: chrome-extension://.../http://example.com/file.pdf\n const humanReadableUrl = \"/\" + defaultUrl + location.hash;\n history.replaceState(history.state, \"\", humanReadableUrl);\n if (top === window) {\n // eslint-disable-next-line no-undef\n chrome.runtime.sendMessage(\"showPageAction\");\n }\n })();\n}\n\nlet pdfjsWebApp, pdfjsWebAppOptions;\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"PRODUCTION\")) {\n pdfjsWebApp = require(\"./app.js\");\n pdfjsWebAppOptions = require(\"./app_options.js\");\n}\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n require(\"./firefoxcom.js\");\n require(\"./firefox_print_service.js\");\n}\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n require(\"./genericcom.js\");\n}\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n require(\"./chromecom.js\");\n}\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME || GENERIC\")) {\n require(\"./pdf_print_service.js\");\n}\n\nfunction getViewerConfiguration() {\n return {\n appContainer: document.body,\n mainContainer: document.getElementById(\"viewerContainer\"),\n viewerContainer: document.getElementById(\"viewer\"),\n eventBus: null,\n toolbar: {\n container: document.getElementById(\"toolbarViewer\"),\n numPages: document.getElementById(\"numPages\"),\n pageNumber: document.getElementById(\"pageNumber\"),\n scaleSelectContainer: document.getElementById(\"scaleSelectContainer\"),\n scaleSelect: document.getElementById(\"scaleSelect\"),\n customScaleOption: document.getElementById(\"customScaleOption\"),\n previous: document.getElementById(\"previous\"),\n next: document.getElementById(\"next\"),\n zoomIn: document.getElementById(\"zoomIn\"),\n zoomOut: document.getElementById(\"zoomOut\"),\n viewFind: document.getElementById(\"viewFind\"),\n openFile: document.getElementById(\"openFile\"),\n print: document.getElementById(\"print\"),\n presentationModeButton: document.getElementById(\"presentationMode\"),\n download: document.getElementById(\"download\"),\n viewBookmark: document.getElementById(\"viewBookmark\"),\n },\n secondaryToolbar: {\n toolbar: document.getElementById(\"secondaryToolbar\"),\n toggleButton: document.getElementById(\"secondaryToolbarToggle\"),\n toolbarButtonContainer: document.getElementById(\n \"secondaryToolbarButtonContainer\"\n ),\n presentationModeButton: document.getElementById(\n \"secondaryPresentationMode\"\n ),\n openFileButton: document.getElementById(\"secondaryOpenFile\"),\n printButton: document.getElementById(\"secondaryPrint\"),\n downloadButton: document.getElementById(\"secondaryDownload\"),\n viewBookmarkButton: document.getElementById(\"secondaryViewBookmark\"),\n firstPageButton: document.getElementById(\"firstPage\"),\n lastPageButton: document.getElementById(\"lastPage\"),\n pageRotateCwButton: document.getElementById(\"pageRotateCw\"),\n pageRotateCcwButton: document.getElementById(\"pageRotateCcw\"),\n cursorSelectToolButton: document.getElementById(\"cursorSelectTool\"),\n cursorHandToolButton: document.getElementById(\"cursorHandTool\"),\n scrollVerticalButton: document.getElementById(\"scrollVertical\"),\n scrollHorizontalButton: document.getElementById(\"scrollHorizontal\"),\n scrollWrappedButton: document.getElementById(\"scrollWrapped\"),\n spreadNoneButton: document.getElementById(\"spreadNone\"),\n spreadOddButton: document.getElementById(\"spreadOdd\"),\n spreadEvenButton: document.getElementById(\"spreadEven\"),\n documentPropertiesButton: document.getElementById(\"documentProperties\"),\n },\n fullscreen: {\n contextFirstPage: document.getElementById(\"contextFirstPage\"),\n contextLastPage: document.getElementById(\"contextLastPage\"),\n contextPageRotateCw: document.getElementById(\"contextPageRotateCw\"),\n contextPageRotateCcw: document.getElementById(\"contextPageRotateCcw\"),\n },\n sidebar: {\n // Divs (and sidebar button)\n outerContainer: document.getElementById(\"outerContainer\"),\n viewerContainer: document.getElementById(\"viewerContainer\"),\n toggleButton: document.getElementById(\"sidebarToggle\"),\n // Buttons\n thumbnailButton: document.getElementById(\"viewThumbnail\"),\n outlineButton: document.getElementById(\"viewOutline\"),\n attachmentsButton: document.getElementById(\"viewAttachments\"),\n // Views\n thumbnailView: document.getElementById(\"thumbnailView\"),\n outlineView: document.getElementById(\"outlineView\"),\n attachmentsView: document.getElementById(\"attachmentsView\"),\n },\n sidebarResizer: {\n outerContainer: document.getElementById(\"outerContainer\"),\n resizer: document.getElementById(\"sidebarResizer\"),\n },\n findBar: {\n bar: document.getElementById(\"findbar\"),\n toggleButton: document.getElementById(\"viewFind\"),\n findField: document.getElementById(\"findInput\"),\n highlightAllCheckbox: document.getElementById(\"findHighlightAll\"),\n caseSensitiveCheckbox: document.getElementById(\"findMatchCase\"),\n entireWordCheckbox: document.getElementById(\"findEntireWord\"),\n findMsg: document.getElementById(\"findMsg\"),\n findResultsCount: document.getElementById(\"findResultsCount\"),\n findPreviousButton: document.getElementById(\"findPrevious\"),\n findNextButton: document.getElementById(\"findNext\"),\n },\n passwordOverlay: {\n overlayName: \"passwordOverlay\",\n container: document.getElementById(\"passwordOverlay\"),\n label: document.getElementById(\"passwordText\"),\n input: document.getElementById(\"password\"),\n submitButton: document.getElementById(\"passwordSubmit\"),\n cancelButton: document.getElementById(\"passwordCancel\"),\n },\n documentProperties: {\n overlayName: \"documentPropertiesOverlay\",\n container: document.getElementById(\"documentPropertiesOverlay\"),\n closeButton: document.getElementById(\"documentPropertiesClose\"),\n fields: {\n fileName: document.getElementById(\"fileNameField\"),\n fileSize: document.getElementById(\"fileSizeField\"),\n title: document.getElementById(\"titleField\"),\n author: document.getElementById(\"authorField\"),\n subject: document.getElementById(\"subjectField\"),\n keywords: document.getElementById(\"keywordsField\"),\n creationDate: document.getElementById(\"creationDateField\"),\n modificationDate: document.getElementById(\"modificationDateField\"),\n creator: document.getElementById(\"creatorField\"),\n producer: document.getElementById(\"producerField\"),\n version: document.getElementById(\"versionField\"),\n pageCount: document.getElementById(\"pageCountField\"),\n pageSize: document.getElementById(\"pageSizeField\"),\n linearized: document.getElementById(\"linearizedField\"),\n },\n },\n errorWrapper: {\n container: document.getElementById(\"errorWrapper\"),\n errorMessage: document.getElementById(\"errorMessage\"),\n closeButton: document.getElementById(\"errorClose\"),\n errorMoreInfo: document.getElementById(\"errorMoreInfo\"),\n moreInfoButton: document.getElementById(\"errorShowMore\"),\n lessInfoButton: document.getElementById(\"errorShowLess\"),\n },\n printContainer: document.getElementById(\"printContainer\"),\n openFileInputName: \"fileInput\",\n debuggerScriptPath: \"./debugger.js\",\n };\n}\n\nfunction webViewerLoad() {\n const config = getViewerConfiguration();\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n Promise.all([\n import(\"pdfjs-web/app.js\"),\n import(\"pdfjs-web/app_options.js\"),\n import(\"pdfjs-web/genericcom.js\"),\n import(\"pdfjs-web/pdf_print_service.js\"),\n ]).then(function ([app, appOptions, genericCom, pdfPrintService]) {\n window.PDFViewerApplication = app.PDFViewerApplication;\n window.PDFViewerApplicationOptions = appOptions.AppOptions;\n app.PDFViewerApplication.run(config);\n });\n } else {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n pdfjsWebAppOptions.AppOptions.set(\"defaultUrl\", defaultUrl);\n }\n\n window.PDFViewerApplication = pdfjsWebApp.PDFViewerApplication;\n window.PDFViewerApplicationOptions = pdfjsWebAppOptions.AppOptions;\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n // Give custom implementations of the default viewer a simpler way to\n // set various `AppOptions`, by dispatching an event once all viewer\n // files are loaded but *before* the viewer initialization has run.\n const event = document.createEvent(\"CustomEvent\");\n event.initCustomEvent(\"webviewerloaded\", true, true, {\n source: window,\n });\n try {\n // Attempt to dispatch the event at the embedding `document`,\n // in order to support cases where the viewer is embedded in\n // a *dynamically* created