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CAAuB9J,KAAvB;EAJW;EAQf7Y,0BAAqByI,GAArB,CAAyBC,MAAzB;AAvCqB;AA6CzBtY,SAASwpB,kBAAT,GAA8B,IAA9B;AAEA,IACExpB,SAAS+hE,UAAT,KAAwB,aAAxB,IACA/hE,SAAS+hE,UAAT,KAAwB,UAF1B,EAGE;EACAiI;AADA,CAHF,MAKO;EACLhqE,SAASnI,gBAAT,CAA0B,kBAA1B,EAA8CmyE,aAA9C,EAA6D,IAA7D;AADK","sources":["webpack://pdf.js/web/ui_utils.js","webpack://pdf.js/web/app_options.js","webpack://pdf.js/web/pdf_link_service.js","webpack://pdf.js/web/app.js","webpack://pdf.js/web/pdfjs.js","webpack://pdf.js/web/event_utils.js","webpack://pdf.js/web/pdf_cursor_tools.js","webpack://pdf.js/web/grab_to_pan.js","webpack://pdf.js/web/annotation_editor_params.js","webpack://pdf.js/web/overlay_manager.js","webpack://pdf.js/web/password_prompt.js","webpack://pdf.js/web/pdf_attachment_viewer.js","webpack://pdf.js/web/base_tree_viewer.js","webpack://pdf.js/web/pdf_document_properties.js","webpack://pdf.js/web/pdf_find_bar.js","webpack://pdf.js/web/pdf_find_controller.js","webpack://pdf.js/web/pdf_find_utils.js","webpack://pdf.js/web/pdf_history.js","webpack://pdf.js/web/pdf_layer_viewer.js","webpack://pdf.js/web/pdf_outline_viewer.js","webpack://pdf.js/web/pdf_presentation_mode.js","webpack://pdf.js/web/pdf_rendering_queue.js","webpack://pdf.js/web/pdf_scripting_manager.js","webpack://pdf.js/web/pdf_sidebar.js","webpack://pdf.js/web/pdf_sidebar_resizer.js","webpack://pdf.js/web/pdf_thumbnail_viewer.js","webpack://pdf.js/web/pdf_thumbnail_view.js","webpack://pdf.js/web/pdf_viewer.js","webpack://pdf.js/web/annotation_editor_layer_builder.js","webpack://pdf.js/web/l10n_utils.js","webpack://pdf.js/web/annotation_layer_builder.js","webpack://pdf.js/web/pdf_page_view.js","webpack://pdf.js/web/text_accessibility.js","webpack://pdf.js/web/struct_tree_layer_builder.js","webpack://pdf.js/web/text_highlighter.js","webpack://pdf.js/web/text_layer_builder.js","webpack://pdf.js/web/xfa_layer_builder.js","webpack://pdf.js/web/secondary_toolbar.js","webpack://pdf.js/web/toolbar.js","webpack://pdf.js/web/view_history.js","webpack://pdf.js/web/genericcom.js","webpack://pdf.js/web/preferences.js","webpack://pdf.js/web/download_manager.js","webpack://pdf.js/web/genericl10n.js","webpack://pdf.js/external/webL10n/l10n.js","webpack://pdf.js/web/generic_scripting.js","webpack://pdf.js/web/pdf_print_service.js","webpack://pdf.js/web/print_utils.js","webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/web/viewer.js"],"sourcesContent":["/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst DEFAULT_SCALE_VALUE = \"auto\";\nconst DEFAULT_SCALE = 1.0;\nconst DEFAULT_SCALE_DELTA = 1.1;\nconst MIN_SCALE = 0.1;\nconst MAX_SCALE = 10.0;\nconst UNKNOWN_SCALE = 0;\nconst MAX_AUTO_SCALE = 1.25;\nconst SCROLLBAR_PADDING = 40;\nconst VERTICAL_PADDING = 5;\n\nconst RenderingStates = {\n  INITIAL: 0,\n  RUNNING: 1,\n  PAUSED: 2,\n  FINISHED: 3,\n};\n\nconst PresentationModeState = {\n  UNKNOWN: 0,\n  NORMAL: 1,\n  CHANGING: 2,\n  FULLSCREEN: 3,\n};\n\nconst SidebarView = {\n  UNKNOWN: -1,\n  NONE: 0,\n  THUMBS: 1, // Default value.\n  OUTLINE: 2,\n  ATTACHMENTS: 3,\n  LAYERS: 4,\n};\n\nconst RendererType =\n  typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n    ? {\n        CANVAS: \"canvas\",\n        SVG: \"svg\",\n      }\n    : null;\n\nconst TextLayerMode = {\n  DISABLE: 0,\n  ENABLE: 1,\n};\n\nconst ScrollMode = {\n  UNKNOWN: -1,\n  VERTICAL: 0, // Default value.\n  HORIZONTAL: 1,\n  WRAPPED: 2,\n  PAGE: 3,\n};\n\nconst SpreadMode = {\n  UNKNOWN: -1,\n  NONE: 0, // Default value.\n  ODD: 1,\n  EVEN: 2,\n};\n\n// Used by `PDFViewerApplication`, and by the API unit-tests.\nconst AutoPrintRegExp = /\\bprint\\s*\\(/;\n\n/**\n * Scale factors for the canvas, necessary with HiDPI displays.\n */\nclass OutputScale {\n  constructor() {\n    const pixelRatio = window.devicePixelRatio || 1;\n\n    /**\n     * @type {number} Horizontal scale.\n     */\n    this.sx = pixelRatio;\n\n    /**\n     * @type {number} Vertical scale.\n     */\n    this.sy = pixelRatio;\n  }\n\n  /**\n   * @type {boolean} Returns `true` when scaling is required, `false` otherwise.\n   */\n  get scaled() {\n    return this.sx !== 1 || this.sy !== 1;\n  }\n}\n\n/**\n * Scrolls specified element into view of its parent.\n * @param {Object} element - The element to be visible.\n * @param {Object} spot - An object with optional top and left properties,\n *   specifying the offset from the top left edge.\n * @param {boolean} [scrollMatches] - When scrolling search results into view,\n *   ignore elements that either: Contains marked content identifiers,\n *   or have the CSS-rule `overflow: hidden;` set. The default value is `false`.\n */\nfunction scrollIntoView(element, spot, scrollMatches = false) {\n  // Assuming offsetParent is available (it's not available when viewer is in\n  // hidden iframe or object). We have to scroll: if the offsetParent is not set\n  // producing the error. See also animationStarted.\n  let parent = element.offsetParent;\n  if (!parent) {\n    console.error(\"offsetParent is not set -- cannot scroll\");\n    return;\n  }\n  let offsetY = element.offsetTop + element.clientTop;\n  let offsetX = element.offsetLeft + element.clientLeft;\n  while (\n    (parent.clientHeight === parent.scrollHeight &&\n      parent.clientWidth === parent.scrollWidth) ||\n    (scrollMatches &&\n      (parent.classList.contains(\"markedContent\") ||\n        getComputedStyle(parent).overflow === \"hidden\"))\n  ) {\n    offsetY += parent.offsetTop;\n    offsetX += parent.offsetLeft;\n\n    parent = parent.offsetParent;\n    if (!parent) {\n      return; // no need to scroll\n    }\n  }\n  if (spot) {\n    if (spot.top !== undefined) {\n      offsetY += spot.top;\n    }\n    if (spot.left !== undefined) {\n      offsetX += spot.left;\n      parent.scrollLeft = offsetX;\n    }\n  }\n  parent.scrollTop = offsetY;\n}\n\n/**\n * Helper function to start monitoring the scroll event and converting them into\n * PDF.js friendly one: with scroll debounce and scroll direction.\n */\nfunction watchScroll(viewAreaElement, callback) {\n  const debounceScroll = function (evt) {\n    if (rAF) {\n      return;\n    }\n    // schedule an invocation of scroll for next animation frame.\n    rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {\n      rAF = null;\n\n      const currentX = viewAreaElement.scrollLeft;\n      const lastX = state.lastX;\n      if (currentX !== lastX) {\n        state.right = currentX > lastX;\n      }\n      state.lastX = currentX;\n      const currentY = viewAreaElement.scrollTop;\n      const lastY = state.lastY;\n      if (currentY !== lastY) {\n        state.down = currentY > lastY;\n      }\n      state.lastY = currentY;\n      callback(state);\n    });\n  };\n\n  const state = {\n    right: true,\n    down: true,\n    lastX: viewAreaElement.scrollLeft,\n    lastY: viewAreaElement.scrollTop,\n    _eventHandler: debounceScroll,\n  };\n\n  let rAF = null;\n  viewAreaElement.addEventListener(\"scroll\", debounceScroll, true);\n  return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value&param2=...).\n * @param {string}\n * @returns {Map}\n */\nfunction parseQueryString(query) {\n  const params = new Map();\n  for (const [key, value] of new URLSearchParams(query)) {\n    params.set(key.toLowerCase(), value);\n  }\n  return params;\n}\n\nconst NullCharactersRegExp = /\\x00/g;\nconst InvisibleCharactersRegExp = /[\\x01-\\x1F]/g;\n\n/**\n * @param {string} str\n * @param {boolean} [replaceInvisible]\n */\nfunction removeNullCharacters(str, replaceInvisible = false) {\n  if (typeof str !== \"string\") {\n    console.error(`The argument must be a string.`);\n    return str;\n  }\n  if (replaceInvisible) {\n    str = str.replace(InvisibleCharactersRegExp, \" \");\n  }\n  return str.replace(NullCharactersRegExp, \"\");\n}\n\n/**\n * Use binary search to find the index of the first item in a given array which\n * passes a given condition. The items are expected to be sorted in the sense\n * that if the condition is true for one item in the array, then it is also true\n * for all following items.\n *\n * @returns {number} Index of the first array element to pass the test,\n *                   or |items.length| if no such element exists.\n */\nfunction binarySearchFirstItem(items, condition, start = 0) {\n  let minIndex = start;\n  let maxIndex = items.length - 1;\n\n  if (maxIndex < 0 || !condition(items[maxIndex])) {\n    return items.length;\n  }\n  if (condition(items[minIndex])) {\n    return minIndex;\n  }\n\n  while (minIndex < maxIndex) {\n    const currentIndex = (minIndex + maxIndex) >> 1;\n    const currentItem = items[currentIndex];\n    if (condition(currentItem)) {\n      maxIndex = currentIndex;\n    } else {\n      minIndex = currentIndex + 1;\n    }\n  }\n  return minIndex; /* === maxIndex */\n}\n\n/**\n *  Approximates float number as a fraction using Farey sequence (max order\n *  of 8).\n *  @param {number} x - Positive float number.\n *  @returns {Array} Estimated fraction: the first array item is a numerator,\n *                   the second one is a denominator.\n */\nfunction approximateFraction(x) {\n  // Fast paths for int numbers or their inversions.\n  if (Math.floor(x) === x) {\n    return [x, 1];\n  }\n  const xinv = 1 / x;\n  const limit = 8;\n  if (xinv > limit) {\n    return [1, limit];\n  } else if (Math.floor(xinv) === xinv) {\n    return [1, xinv];\n  }\n\n  const x_ = x > 1 ? xinv : x;\n  // a/b and c/d are neighbours in Farey sequence.\n  let a = 0,\n    b = 1,\n    c = 1,\n    d = 1;\n  // Limiting search to order 8.\n  while (true) {\n    // Generating next term in sequence (order of q).\n    const p = a + c,\n      q = b + d;\n    if (q > limit) {\n      break;\n    }\n    if (x_ <= p / q) {\n      c = p;\n      d = q;\n    } else {\n      a = p;\n      b = q;\n    }\n  }\n  let result;\n  // Select closest of the neighbours to x.\n  if (x_ - a / b < c / d - x_) {\n    result = x_ === x ? [a, b] : [b, a];\n  } else {\n    result = x_ === x ? [c, d] : [d, c];\n  }\n  return result;\n}\n\nfunction roundToDivide(x, div) {\n  const r = x % div;\n  return r === 0 ? x : Math.round(x - r + div);\n}\n\n/**\n * @typedef {Object} GetPageSizeInchesParameters\n * @property {number[]} view\n * @property {number} userUnit\n * @property {number} rotate\n */\n\n/**\n * @typedef {Object} PageSize\n * @property {number} width - In inches.\n * @property {number} height - In inches.\n */\n\n/**\n * Gets the size of the specified page, converted from PDF units to inches.\n * @param {GetPageSizeInchesParameters} params\n * @returns {PageSize}\n */\nfunction getPageSizeInches({ view, userUnit, rotate }) {\n  const [x1, y1, x2, y2] = view;\n  // We need to take the page rotation into account as well.\n  const changeOrientation = rotate % 180 !== 0;\n\n  const width = ((x2 - x1) / 72) * userUnit;\n  const height = ((y2 - y1) / 72) * userUnit;\n\n  return {\n    width: changeOrientation ? height : width,\n    height: changeOrientation ? width : height,\n  };\n}\n\n/**\n * Helper function for getVisibleElements.\n *\n * @param {number} index - initial guess at the first visible element\n * @param {Array} views - array of pages, into which `index` is an index\n * @param {number} top - the top of the scroll pane\n * @returns {number} less than or equal to `index` that is definitely at or\n *   before the first visible element in `views`, but not by too much. (Usually,\n *   this will be the first element in the first partially visible row in\n *   `views`, although sometimes it goes back one row further.)\n */\nfunction backtrackBeforeAllVisibleElements(index, views, top) {\n  // binarySearchFirstItem's assumption is that the input is ordered, with only\n  // one index where the conditions flips from false to true: [false ...,\n  // true...]. With vertical scrolling and spreads, it is possible to have\n  // [false ..., true, false, true ...]. With wrapped scrolling we can have a\n  // similar sequence, with many more mixed true and false in the middle.\n  //\n  // So there is no guarantee that the binary search yields the index of the\n  // first visible element. It could have been any of the other visible elements\n  // that were preceded by a hidden element.\n\n  // Of course, if either this element or the previous (hidden) element is also\n  // the first element, there's nothing to worry about.\n  if (index < 2) {\n    return index;\n  }\n\n  // That aside, the possible cases are represented below.\n  //\n  //     ****  = fully hidden\n  //     A*B*  = mix of partially visible and/or hidden pages\n  //     CDEF  = fully visible\n  //\n  // (1) Binary search could have returned A, in which case we can stop.\n  // (2) Binary search could also have returned B, in which case we need to\n  // check the whole row.\n  // (3) Binary search could also have returned C, in which case we need to\n  // check the whole previous row.\n  //\n  // There's one other possibility:\n  //\n  //     ****  = fully hidden\n  //     ABCD  = mix of fully and/or partially visible pages\n  //\n  // (4) Binary search could only have returned A.\n\n  // Initially assume that we need to find the beginning of the current row\n  // (case 1, 2, or 4), which means finding a page that is above the current\n  // page's top. If the found page is partially visible, we're definitely not in\n  // case 3, and this assumption is correct.\n  let elt = views[index].div;\n  let pageTop = elt.offsetTop + elt.clientTop;\n\n  if (pageTop >= top) {\n    // The found page is fully visible, so we're actually either in case 3 or 4,\n    // and unfortunately we can't tell the difference between them without\n    // scanning the entire previous row, so we just conservatively assume that\n    // we do need to backtrack to that row. In both cases, the previous page is\n    // in the previous row, so use its top instead.\n    elt = views[index - 1].div;\n    pageTop = elt.offsetTop + elt.clientTop;\n  }\n\n  // Now we backtrack to the first page that still has its bottom below\n  // `pageTop`, which is the top of a page in the first visible row (unless\n  // we're in case 4, in which case it's the row before that).\n  // `index` is found by binary search, so the page at `index - 1` is\n  // invisible and we can start looking for potentially visible pages from\n  // `index - 2`. (However, if this loop terminates on its first iteration,\n  // which is the case when pages are stacked vertically, `index` should remain\n  // unchanged, so we use a distinct loop variable.)\n  for (let i = index - 2; i >= 0; --i) {\n    elt = views[i].div;\n    if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {\n      // We have reached the previous row, so stop now.\n      // This loop is expected to terminate relatively quickly because the\n      // number of pages per row is expected to be small.\n      break;\n    }\n    index = i;\n  }\n  return index;\n}\n\n/**\n * @typedef {Object} GetVisibleElementsParameters\n * @property {HTMLElement} scrollEl - A container that can possibly scroll.\n * @property {Array} views - Objects with a `div` property that contains an\n *   HTMLElement, which should all be descendants of `scrollEl` satisfying the\n *   relevant layout assumptions.\n * @property {boolean} sortByVisibility - If `true`, the returned elements are\n *   sorted in descending order of the percent of their padding box that is\n *   visible. The default value is `false`.\n * @property {boolean} horizontal - If `true`, the elements are assumed to be\n *   laid out horizontally instead of vertically. The default value is `false`.\n * @property {boolean} rtl - If `true`, the `scrollEl` container is assumed to\n *   be in right-to-left mode. The default value is `false`.\n */\n\n/**\n * Generic helper to find out what elements are visible within a scroll pane.\n *\n * Well, pretty generic. There are some assumptions placed on the elements\n * referenced by `views`:\n *   - If `horizontal`, no left of any earlier element is to the right of the\n *     left of any later element.\n *   - Otherwise, `views` can be split into contiguous rows where, within a row,\n *     no top of any element is below the bottom of any other element, and\n *     between rows, no bottom of any element in an earlier row is below the\n *     top of any element in a later row.\n *\n * (Here, top, left, etc. all refer to the padding edge of the element in\n * question. For pages, that ends up being equivalent to the bounding box of the\n * rendering canvas. Earlier and later refer to index in `views`, not page\n * layout.)\n *\n * @param {GetVisibleElementsParameters}\n * @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`\n */\nfunction getVisibleElements({\n  scrollEl,\n  views,\n  sortByVisibility = false,\n  horizontal = false,\n  rtl = false,\n}) {\n  const top = scrollEl.scrollTop,\n    bottom = top + scrollEl.clientHeight;\n  const left = scrollEl.scrollLeft,\n    right = left + scrollEl.clientWidth;\n\n  // Throughout this \"generic\" function, comments will assume we're working with\n  // PDF document pages, which is the most important and complex case. In this\n  // case, the visible elements we're actually interested is the page canvas,\n  // which is contained in a wrapper which adds no padding/border/margin, which\n  // is itself contained in `view.div` which adds no padding (but does add a\n  // border). So, as specified in this function's doc comment, this function\n  // does all of its work on the padding edge of the provided views, starting at\n  // offsetLeft/Top (which includes margin) and adding clientLeft/Top (which is\n  // the border). Adding clientWidth/Height gets us the bottom-right corner of\n  // the padding edge.\n  function isElementBottomAfterViewTop(view) {\n    const element = view.div;\n    const elementBottom =\n      element.offsetTop + element.clientTop + element.clientHeight;\n    return elementBottom > top;\n  }\n  function isElementNextAfterViewHorizontally(view) {\n    const element = view.div;\n    const elementLeft = element.offsetLeft + element.clientLeft;\n    const elementRight = elementLeft + element.clientWidth;\n    return rtl ? elementLeft < right : elementRight > left;\n  }\n\n  const visible = [],\n    ids = new Set(),\n    numViews = views.length;\n  let firstVisibleElementInd = binarySearchFirstItem(\n    views,\n    horizontal\n      ? isElementNextAfterViewHorizontally\n      : isElementBottomAfterViewTop\n  );\n\n  // Please note the return value of the `binarySearchFirstItem` function when\n  // no valid element is found (hence the `firstVisibleElementInd` check below).\n  if (\n    firstVisibleElementInd > 0 &&\n    firstVisibleElementInd < numViews &&\n    !horizontal\n  ) {\n    // In wrapped scrolling (or vertical scrolling with spreads), with some page\n    // sizes, isElementBottomAfterViewTop doesn't satisfy the binary search\n    // condition: there can be pages with bottoms above the view top between\n    // pages with bottoms below. This function detects and corrects that error;\n    // see it for more comments.\n    firstVisibleElementInd = backtrackBeforeAllVisibleElements(\n      firstVisibleElementInd,\n      views,\n      top\n    );\n  }\n\n  // lastEdge acts as a cutoff for us to stop looping, because we know all\n  // subsequent pages will be hidden.\n  //\n  // When using wrapped scrolling or vertical scrolling with spreads, we can't\n  // simply stop the first time we reach a page below the bottom of the view;\n  // the tops of subsequent pages on the same row could still be visible. In\n  // horizontal scrolling, we don't have that issue, so we can stop as soon as\n  // we pass `right`, without needing the code below that handles the -1 case.\n  let lastEdge = horizontal ? right : -1;\n\n  for (let i = firstVisibleElementInd; i < numViews; i++) {\n    const view = views[i],\n      element = view.div;\n    const currentWidth = element.offsetLeft + element.clientLeft;\n    const currentHeight = element.offsetTop + element.clientTop;\n    const viewWidth = element.clientWidth,\n      viewHeight = element.clientHeight;\n    const viewRight = currentWidth + viewWidth;\n    const viewBottom = currentHeight + viewHeight;\n\n    if (lastEdge === -1) {\n      // As commented above, this is only needed in non-horizontal cases.\n      // Setting lastEdge to the bottom of the first page that is partially\n      // visible ensures that the next page fully below lastEdge is on the\n      // next row, which has to be fully hidden along with all subsequent rows.\n      if (viewBottom >= bottom) {\n        lastEdge = viewBottom;\n      }\n    } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {\n      break;\n    }\n\n    if (\n      viewBottom <= top ||\n      currentHeight >= bottom ||\n      viewRight <= left ||\n      currentWidth >= right\n    ) {\n      continue;\n    }\n\n    const hiddenHeight =\n      Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);\n    const hiddenWidth =\n      Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);\n\n    const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,\n      fractionWidth = (viewWidth - hiddenWidth) / viewWidth;\n    const percent = (fractionHeight * fractionWidth * 100) | 0;\n\n    visible.push({\n      id: view.id,\n      x: currentWidth,\n      y: currentHeight,\n      view,\n      percent,\n      widthPercent: (fractionWidth * 100) | 0,\n    });\n    ids.add(view.id);\n  }\n\n  const first = visible[0],\n    last = visible.at(-1);\n\n  if (sortByVisibility) {\n    visible.sort(function (a, b) {\n      const pc = a.percent - b.percent;\n      if (Math.abs(pc) > 0.001) {\n        return -pc;\n      }\n      return a.id - b.id; // ensure stability\n    });\n  }\n  return { first, last, views: visible, ids };\n}\n\n/**\n * Event handler to suppress context menu.\n */\nfunction noContextMenuHandler(evt) {\n  evt.preventDefault();\n}\n\nfunction normalizeWheelEventDirection(evt) {\n  let delta = Math.hypot(evt.deltaX, evt.deltaY);\n  const angle = Math.atan2(evt.deltaY, evt.deltaX);\n  if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {\n    // All that is left-up oriented has to change the sign.\n    delta = -delta;\n  }\n  return delta;\n}\n\nfunction normalizeWheelEventDelta(evt) {\n  let delta = normalizeWheelEventDirection(evt);\n\n  const MOUSE_DOM_DELTA_PIXEL_MODE = 0;\n  const MOUSE_DOM_DELTA_LINE_MODE = 1;\n  const MOUSE_PIXELS_PER_LINE = 30;\n  const MOUSE_LINES_PER_PAGE = 30;\n\n  // Converts delta to per-page units\n  if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {\n    delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;\n  } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {\n    delta /= MOUSE_LINES_PER_PAGE;\n  }\n  return delta;\n}\n\nfunction isValidRotation(angle) {\n  return Number.isInteger(angle) && angle % 90 === 0;\n}\n\nfunction isValidScrollMode(mode) {\n  return (\n    Number.isInteger(mode) &&\n    Object.values(ScrollMode).includes(mode) &&\n    mode !== ScrollMode.UNKNOWN\n  );\n}\n\nfunction isValidSpreadMode(mode) {\n  return (\n    Number.isInteger(mode) &&\n    Object.values(SpreadMode).includes(mode) &&\n    mode !== SpreadMode.UNKNOWN\n  );\n}\n\nfunction isPortraitOrientation(size) {\n  return size.width <= size.height;\n}\n\n/**\n * Promise that is resolved when DOM window becomes visible.\n */\nconst animationStarted = new Promise(function (resolve) {\n  if (\n    typeof PDFJSDev !== \"undefined\" &&\n    PDFJSDev.test(\"LIB\") &&\n    typeof window === \"undefined\"\n  ) {\n    // Prevent \"ReferenceError: window is not defined\" errors when running the\n    // unit-tests in Node.js environments.\n    setTimeout(resolve, 20);\n    return;\n  }\n  window.requestAnimationFrame(resolve);\n});\n\nconst docStyle =\n  typeof PDFJSDev !== \"undefined\" &&\n  PDFJSDev.test(\"LIB\") &&\n  typeof document === \"undefined\"\n    ? null\n    : document.documentElement.style;\n\nfunction clamp(v, min, max) {\n  return Math.min(Math.max(v, min), max);\n}\n\nclass ProgressBar {\n  #classList = null;\n\n  #percent = 0;\n\n  #visible = true;\n\n  constructor(id) {\n    const bar = document.getElementById(id);\n    this.#classList = bar.classList;\n  }\n\n  get percent() {\n    return this.#percent;\n  }\n\n  set percent(val) {\n    this.#percent = clamp(val, 0, 100);\n\n    if (isNaN(val)) {\n      this.#classList.add(\"indeterminate\");\n      return;\n    }\n    this.#classList.remove(\"indeterminate\");\n\n    docStyle.setProperty(\"--progressBar-percent\", `${this.#percent}%`);\n  }\n\n  setWidth(viewer) {\n    if (!viewer) {\n      return;\n    }\n    const container = viewer.parentNode;\n    const scrollbarWidth = container.offsetWidth - viewer.offsetWidth;\n    if (scrollbarWidth > 0) {\n      docStyle.setProperty(\"--progressBar-end-offset\", `${scrollbarWidth}px`);\n    }\n  }\n\n  hide() {\n    if (!this.#visible) {\n      return;\n    }\n    this.#visible = false;\n    this.#classList.add(\"hidden\");\n  }\n\n  show() {\n    if (this.#visible) {\n      return;\n    }\n    this.#visible = true;\n    this.#classList.remove(\"hidden\");\n  }\n}\n\n/**\n * Get the active or focused element in current DOM.\n *\n * Recursively search for the truly active or focused element in case there are\n * shadow DOMs.\n *\n * @returns {Element} the truly active or focused element.\n */\nfunction getActiveOrFocusedElement() {\n  let curRoot = document;\n  let curActiveOrFocused =\n    curRoot.activeElement || curRoot.querySelector(\":focus\");\n\n  while (curActiveOrFocused?.shadowRoot) {\n    curRoot = curActiveOrFocused.shadowRoot;\n    curActiveOrFocused =\n      curRoot.activeElement || curRoot.querySelector(\":focus\");\n  }\n\n  return curActiveOrFocused;\n}\n\n/**\n * Converts API PageLayout values to the format used by `BaseViewer`.\n * NOTE: This is supported to the extent that the viewer implements the\n *       necessary Scroll/Spread modes (since SinglePage, TwoPageLeft,\n *       and TwoPageRight all suggests using non-continuous scrolling).\n * @param {string} mode - The API PageLayout value.\n * @returns {Object}\n */\nfunction apiPageLayoutToViewerModes(layout) {\n  let scrollMode = ScrollMode.VERTICAL,\n    spreadMode = SpreadMode.NONE;\n\n  switch (layout) {\n    case \"SinglePage\":\n      scrollMode = ScrollMode.PAGE;\n      break;\n    case \"OneColumn\":\n      break;\n    case \"TwoPageLeft\":\n      scrollMode = ScrollMode.PAGE;\n    /* falls through */\n    case \"TwoColumnLeft\":\n      spreadMode = SpreadMode.ODD;\n      break;\n    case \"TwoPageRight\":\n      scrollMode = ScrollMode.PAGE;\n    /* falls through */\n    case \"TwoColumnRight\":\n      spreadMode = SpreadMode.EVEN;\n      break;\n  }\n  return { scrollMode, spreadMode };\n}\n\n/**\n * Converts API PageMode values to the format used by `PDFSidebar`.\n * NOTE: There's also a \"FullScreen\" parameter which is not possible to support,\n *       since the Fullscreen API used in browsers requires that entering\n *       fullscreen mode only occurs as a result of a user-initiated event.\n * @param {string} mode - The API PageMode value.\n * @returns {number} A value from {SidebarView}.\n */\nfunction apiPageModeToSidebarView(mode) {\n  switch (mode) {\n    case \"UseNone\":\n      return SidebarView.NONE;\n    case \"UseThumbs\":\n      return SidebarView.THUMBS;\n    case \"UseOutlines\":\n      return SidebarView.OUTLINE;\n    case \"UseAttachments\":\n      return SidebarView.ATTACHMENTS;\n    case \"UseOC\":\n      return SidebarView.LAYERS;\n  }\n  return SidebarView.NONE; // Default value.\n}\n\nexport {\n  animationStarted,\n  apiPageLayoutToViewerModes,\n  apiPageModeToSidebarView,\n  approximateFraction,\n  AutoPrintRegExp,\n  backtrackBeforeAllVisibleElements, // only exported for testing\n  binarySearchFirstItem,\n  DEFAULT_SCALE,\n  DEFAULT_SCALE_DELTA,\n  DEFAULT_SCALE_VALUE,\n  docStyle,\n  getActiveOrFocusedElement,\n  getPageSizeInches,\n  getVisibleElements,\n  isPortraitOrientation,\n  isValidRotation,\n  isValidScrollMode,\n  isValidSpreadMode,\n  MAX_AUTO_SCALE,\n  MAX_SCALE,\n  MIN_SCALE,\n  noContextMenuHandler,\n  normalizeWheelEventDelta,\n  normalizeWheelEventDirection,\n  OutputScale,\n  parseQueryString,\n  PresentationModeState,\n  ProgressBar,\n  removeNullCharacters,\n  RendererType,\n  RenderingStates,\n  roundToDivide,\n  SCROLLBAR_PADDING,\n  scrollIntoView,\n  ScrollMode,\n  SidebarView,\n  SpreadMode,\n  TextLayerMode,\n  UNKNOWN_SCALE,\n  VERTICAL_PADDING,\n  watchScroll,\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\nconst compatibilityParams = Object.create(null);\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n  if (\n    typeof PDFJSDev !== \"undefined\" &&\n    PDFJSDev.test(\"LIB\") &&\n    typeof navigator === \"undefined\"\n  ) {\n    globalThis.navigator = Object.create(null);\n  }\n  const userAgent = navigator.userAgent || \"\";\n  const platform = navigator.platform || \"\";\n  const maxTouchPoints = navigator.maxTouchPoints || 1;\n\n  const isAndroid = /Android/.test(userAgent);\n  const isIOS =\n    /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) ||\n    (platform === \"MacIntel\" && maxTouchPoints > 1);\n\n  // Limit canvas size to 5 mega-pixels on mobile.\n  // Support: Android, iOS\n  (function checkCanvasSizeLimitation() {\n    if (isIOS || isAndroid) {\n      compatibilityParams.maxCanvasPixels = 5242880;\n    }\n  })();\n}\n\nconst OptionKind = {\n  VIEWER: 0x02,\n  API: 0x04,\n  WORKER: 0x08,\n  PREFERENCE: 0x80,\n};\n\n/**\n * NOTE: These options are used to generate the `default_preferences.json` file,\n *       see `OptionKind.PREFERENCE`, hence the values below must use only\n *       primitive types and cannot rely on any imported types.\n */\nconst defaultOptions = {\n  annotationEditorMode: {\n    /** @type {number} */\n    value: 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  annotationMode: {\n    /** @type {number} */\n    value: 2,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  cursorToolOnLoad: {\n    /** @type {number} */\n    value: 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  defaultZoomValue: {\n    /** @type {string} */\n    value: \"\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  disableHistory: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER,\n  },\n  disablePageLabels: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enablePermissions: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enablePrintAutoRotate: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableScripting: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\"),\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  externalLinkRel: {\n    /** @type {string} */\n    value: \"noopener noreferrer nofollow\",\n    kind: OptionKind.VIEWER,\n  },\n  externalLinkTarget: {\n    /** @type {number} */\n    value: 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  historyUpdateUrl: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  ignoreDestinationZoom: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  imageResourcesPath: {\n    /** @type {string} */\n    value: \"./images/\",\n    kind: OptionKind.VIEWER,\n  },\n  maxCanvasPixels: {\n    /** @type {number} */\n    value: 16777216,\n    kind: OptionKind.VIEWER,\n  },\n  forcePageColors: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  pageColorsBackground: {\n    /** @type {string} */\n    value: \"Canvas\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  pageColorsForeground: {\n    /** @type {string} */\n    value: \"CanvasText\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  pdfBugEnabled: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\"),\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  printResolution: {\n    /** @type {number} */\n    value: 150,\n    kind: OptionKind.VIEWER,\n  },\n  sidebarViewOnLoad: {\n    /** @type {number} */\n    value: -1,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  scrollModeOnLoad: {\n    /** @type {number} */\n    value: -1,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  spreadModeOnLoad: {\n    /** @type {number} */\n    value: -1,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  textLayerMode: {\n    /** @type {number} */\n    value: 1,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  useOnlyCssZoom: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  viewerCssTheme: {\n    /** @type {number} */\n    value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\") ? 2 : 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  viewOnLoad: {\n    /** @type {boolean} */\n    value: 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n\n  cMapPacked: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API,\n  },\n  cMapUrl: {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n        ? \"../external/bcmaps/\"\n        : \"../web/cmaps/\",\n    kind: OptionKind.API,\n  },\n  disableAutoFetch: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\n  },\n  disableFontFace: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\n  },\n  disableRange: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\n  },\n  disableStream: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\n  },\n  docBaseUrl: {\n    /** @type {string} */\n    value: \"\",\n    kind: OptionKind.API,\n  },\n  enableXfa: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\n  },\n  fontExtraProperties: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API,\n  },\n  isEvalSupported: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API,\n  },\n  isOffscreenCanvasSupported: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API,\n  },\n  maxImageSize: {\n    /** @type {number} */\n    value: -1,\n    kind: OptionKind.API,\n  },\n  pdfBug: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.API,\n  },\n  standardFontDataUrl: {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n        ? \"../external/standard_fonts/\"\n        : \"../web/standard_fonts/\",\n    kind: OptionKind.API,\n  },\n  verbosity: {\n    /** @type {number} */\n    value: 1,\n    kind: OptionKind.API,\n  },\n\n  workerPort: {\n    /** @type {Object} */\n    value: null,\n    kind: OptionKind.WORKER,\n  },\n  workerSrc: {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n        ? \"../src/worker_loader.js\"\n        : \"../build/pdf.worker.js\",\n    kind: OptionKind.WORKER,\n  },\n};\nif (\n  typeof PDFJSDev === \"undefined\" ||\n  PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n) {\n  defaultOptions.defaultUrl = {\n    /** @type {string} */\n    value: \"compressed.tracemonkey-pldi-09.pdf\",\n    kind: OptionKind.VIEWER,\n  };\n  defaultOptions.disablePreferences = {\n    /** @type {boolean} */\n    value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\"),\n    kind: OptionKind.VIEWER,\n  };\n  defaultOptions.locale = {\n    /** @type {string} */\n    value: navigator.language || \"en-US\",\n    kind: OptionKind.VIEWER,\n  };\n  defaultOptions.renderer = {\n    /** @type {string} */\n    value: \"canvas\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  };\n  defaultOptions.sandboxBundleSrc = {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n        ? \"../build/dev-sandbox/pdf.sandbox.js\"\n        : \"../build/pdf.sandbox.js\",\n    kind: OptionKind.VIEWER,\n  };\n} else if (PDFJSDev.test(\"CHROME\")) {\n  defaultOptions.defaultUrl = {\n    /** @type {string} */\n    value: \"\",\n    kind: OptionKind.VIEWER,\n  };\n  defaultOptions.disableTelemetry = {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  };\n  defaultOptions.sandboxBundleSrc = {\n    /** @type {string} */\n    value: \"../build/pdf.sandbox.js\",\n    kind: OptionKind.VIEWER,\n  };\n}\n\nconst userOptions = Object.create(null);\n\nclass AppOptions {\n  constructor() {\n    throw new Error(\"Cannot initialize AppOptions.\");\n  }\n\n  static get(name) {\n    const userOption = userOptions[name];\n    if (userOption !== undefined) {\n      return userOption;\n    }\n    const defaultOption = defaultOptions[name];\n    if (defaultOption !== undefined) {\n      return compatibilityParams[name] ?? defaultOption.value;\n    }\n    return undefined;\n  }\n\n  static getAll(kind = null) {\n    const options = Object.create(null);\n    for (const name in defaultOptions) {\n      const defaultOption = defaultOptions[name];\n      if (kind) {\n        if ((kind & defaultOption.kind) === 0) {\n          continue;\n        }\n        if (kind === OptionKind.PREFERENCE) {\n          const value = defaultOption.value,\n            valueType = typeof value;\n\n          if (\n            valueType === \"boolean\" ||\n            valueType === \"string\" ||\n            (valueType === \"number\" && Number.isInteger(value))\n          ) {\n            options[name] = value;\n            continue;\n          }\n          throw new Error(`Invalid type for preference: ${name}`);\n        }\n      }\n      const userOption = userOptions[name];\n      options[name] =\n        userOption !== undefined\n          ? userOption\n          : compatibilityParams[name] ?? defaultOption.value;\n    }\n    return options;\n  }\n\n  static set(name, value) {\n    userOptions[name] = value;\n  }\n\n  static setAll(options) {\n    for (const name in options) {\n      userOptions[name] = options[name];\n    }\n  }\n\n  static remove(name) {\n    delete userOptions[name];\n  }\n\n  /**\n   * @ignore\n   */\n  static _hasUserOptions() {\n    return Object.keys(userOptions).length > 0;\n  }\n}\n\nexport { AppOptions, compatibilityParams, OptionKind };\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\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { parseQueryString, removeNullCharacters } from \"./ui_utils.js\";\n\nconst DEFAULT_LINK_REL = \"noopener noreferrer nofollow\";\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 {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 {HTMLAnchorElement} link - The link element.\n * @param {ExternalLinkParameters} params\n */\nfunction addLinkAttributes(link, { url, target, rel, enabled = true } = {}) {\n  if (!url || typeof url !== \"string\") {\n    throw new Error('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/**\n * @typedef {Object} PDFLinkServiceOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [externalLinkTarget] - Specifies the `target` attribute\n *   for external links. Must use one of the values from {LinkTarget}.\n *   Defaults to using no target.\n * @property {string} [externalLinkRel] - Specifies the `rel` attribute for\n *   external links. Defaults to stripping the referrer.\n * @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument,\n *   thus preserving the current zoom level in the viewer, when navigating\n *   to internal destinations. The default value is `false`.\n */\n\n/**\n * Performs navigation functions inside PDF, such as opening specified page,\n * or destination.\n * @implements {IPDFLinkService}\n */\nclass PDFLinkService {\n  #pagesRefCache = new Map();\n\n  /**\n   * @param {PDFLinkServiceOptions} options\n   */\n  constructor({\n    eventBus,\n    externalLinkTarget = null,\n    externalLinkRel = null,\n    ignoreDestinationZoom = false,\n  } = {}) {\n    this.eventBus = eventBus;\n    this.externalLinkTarget = externalLinkTarget;\n    this.externalLinkRel = externalLinkRel;\n    this.externalLinkEnabled = true;\n    this._ignoreDestinationZoom = ignoreDestinationZoom;\n\n    this.baseUrl = null;\n    this.pdfDocument = null;\n    this.pdfViewer = null;\n    this.pdfHistory = null;\n  }\n\n  setDocument(pdfDocument, baseUrl = null) {\n    this.baseUrl = baseUrl;\n    this.pdfDocument = pdfDocument;\n    this.#pagesRefCache.clear();\n  }\n\n  setViewer(pdfViewer) {\n    this.pdfViewer = pdfViewer;\n  }\n\n  setHistory(pdfHistory) {\n    this.pdfHistory = pdfHistory;\n  }\n\n  /**\n   * @type {number}\n   */\n  get pagesCount() {\n    return this.pdfDocument ? this.pdfDocument.numPages : 0;\n  }\n\n  /**\n   * @type {number}\n   */\n  get page() {\n    return this.pdfViewer.currentPageNumber;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set page(value) {\n    this.pdfViewer.currentPageNumber = value;\n  }\n\n  /**\n   * @type {number}\n   */\n  get rotation() {\n    return this.pdfViewer.pagesRotation;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set rotation(value) {\n    this.pdfViewer.pagesRotation = value;\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get isInPresentationMode() {\n    return this.pdfViewer.isInPresentationMode;\n  }\n\n  #goToDestinationHelper(rawDest, namedDest = null, explicitDest) {\n    // Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n    const destRef = explicitDest[0];\n    let pageNumber;\n\n    if (typeof destRef === \"object\" && destRef !== null) {\n      pageNumber = this._cachedPageNumber(destRef);\n\n      if (!pageNumber) {\n        // Fetch the page reference if it's not yet available. This could\n        // only occur during loading, before all pages have been resolved.\n        this.pdfDocument\n          .getPageIndex(destRef)\n          .then(pageIndex => {\n            this.cachePageRef(pageIndex + 1, destRef);\n            this.#goToDestinationHelper(rawDest, namedDest, explicitDest);\n          })\n          .catch(() => {\n            console.error(\n              `PDFLinkService.#goToDestinationHelper: \"${destRef}\" is not ` +\n                `a valid page reference, for dest=\"${rawDest}\".`\n            );\n          });\n        return;\n      }\n    } else if (Number.isInteger(destRef)) {\n      pageNumber = destRef + 1;\n    } else {\n      console.error(\n        `PDFLinkService.#goToDestinationHelper: \"${destRef}\" is not ` +\n          `a valid destination reference, for dest=\"${rawDest}\".`\n      );\n      return;\n    }\n    if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n      console.error(\n        `PDFLinkService.#goToDestinationHelper: \"${pageNumber}\" is not ` +\n          `a valid page number, for dest=\"${rawDest}\".`\n      );\n      return;\n    }\n\n    if (this.pdfHistory) {\n      // Update the browser history before scrolling the new destination into\n      // view, to be able to accurately capture the current document position.\n      this.pdfHistory.pushCurrentPosition();\n      this.pdfHistory.push({ namedDest, explicitDest, pageNumber });\n    }\n\n    this.pdfViewer.scrollPageIntoView({\n      pageNumber,\n      destArray: explicitDest,\n      ignoreDestinationZoom: this._ignoreDestinationZoom,\n    });\n  }\n\n  /**\n   * This method will, when available, also update the browser history.\n   *\n   * @param {string|Array} dest - The named, or explicit, PDF destination.\n   */\n  async goToDestination(dest) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let namedDest, explicitDest;\n    if (typeof dest === \"string\") {\n      namedDest = dest;\n      explicitDest = await this.pdfDocument.getDestination(dest);\n    } else {\n      namedDest = null;\n      explicitDest = await dest;\n    }\n    if (!Array.isArray(explicitDest)) {\n      console.error(\n        `PDFLinkService.goToDestination: \"${explicitDest}\" is not ` +\n          `a valid destination array, for dest=\"${dest}\".`\n      );\n      return;\n    }\n    this.#goToDestinationHelper(dest, namedDest, explicitDest);\n  }\n\n  /**\n   * This method will, when available, also update the browser history.\n   *\n   * @param {number|string} val - The page number, or page label.\n   */\n  goToPage(val) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const pageNumber =\n      (typeof val === \"string\" && this.pdfViewer.pageLabelToPageNumber(val)) ||\n      val | 0;\n    if (\n      !(\n        Number.isInteger(pageNumber) &&\n        pageNumber > 0 &&\n        pageNumber <= this.pagesCount\n      )\n    ) {\n      console.error(`PDFLinkService.goToPage: \"${val}\" is not a valid page.`);\n      return;\n    }\n\n    if (this.pdfHistory) {\n      // Update the browser history before scrolling the new page into view,\n      // to be able to accurately capture the current document position.\n      this.pdfHistory.pushCurrentPosition();\n      this.pdfHistory.pushPage(pageNumber);\n    }\n\n    this.pdfViewer.scrollPageIntoView({ pageNumber });\n  }\n\n  /**\n   * Wrapper around the `addLinkAttributes` helper function.\n   * @param {HTMLAnchorElement} link\n   * @param {string} url\n   * @param {boolean} [newWindow]\n   */\n  addLinkAttributes(link, url, newWindow = false) {\n    addLinkAttributes(link, {\n      url,\n      target: newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n      rel: this.externalLinkRel,\n      enabled: this.externalLinkEnabled,\n    });\n  }\n\n  /**\n   * @param {string|Array} dest - The PDF destination object.\n   * @returns {string} The hyperlink to the PDF object.\n   */\n  getDestinationHash(dest) {\n    if (typeof dest === \"string\") {\n      if (dest.length > 0) {\n        return this.getAnchorUrl(\"#\" + escape(dest));\n      }\n    } else if (Array.isArray(dest)) {\n      const str = JSON.stringify(dest);\n      if (str.length > 0) {\n        return this.getAnchorUrl(\"#\" + escape(str));\n      }\n    }\n    return this.getAnchorUrl(\"\");\n  }\n\n  /**\n   * Prefix the full url on anchor links to make sure that links are resolved\n   * relative to the current URL instead of the one defined in <base href>.\n   * @param {string} anchor - The anchor hash, including the #.\n   * @returns {string} The hyperlink to the PDF object.\n   */\n  getAnchorUrl(anchor) {\n    return (this.baseUrl || \"\") + anchor;\n  }\n\n  /**\n   * @param {string} hash\n   */\n  setHash(hash) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let pageNumber, dest;\n    if (hash.includes(\"=\")) {\n      const params = parseQueryString(hash);\n      if (params.has(\"search\")) {\n        this.eventBus.dispatch(\"findfromurlhash\", {\n          source: this,\n          query: params.get(\"search\").replace(/\"/g, \"\"),\n          phraseSearch: params.get(\"phrase\") === \"true\",\n        });\n      }\n      // borrowing syntax from \"Parameters for Opening PDF Files\"\n      if (params.has(\"page\")) {\n        pageNumber = params.get(\"page\") | 0 || 1;\n      }\n      if (params.has(\"zoom\")) {\n        // Build the destination array.\n        const zoomArgs = params.get(\"zoom\").split(\",\"); // scale,left,top\n        const zoomArg = zoomArgs[0];\n        const zoomArgNumber = parseFloat(zoomArg);\n\n        if (!zoomArg.includes(\"Fit\")) {\n          // If the zoomArg is a number, it has to get divided by 100. If it's\n          // a string, it should stay as it is.\n          dest = [\n            null,\n            { name: \"XYZ\" },\n            zoomArgs.length > 1 ? zoomArgs[1] | 0 : null,\n            zoomArgs.length > 2 ? zoomArgs[2] | 0 : null,\n            zoomArgNumber ? zoomArgNumber / 100 : zoomArg,\n          ];\n        } else {\n          if (zoomArg === \"Fit\" || zoomArg === \"FitB\") {\n            dest = [null, { name: zoomArg }];\n          } else if (\n            zoomArg === \"FitH\" ||\n            zoomArg === \"FitBH\" ||\n            zoomArg === \"FitV\" ||\n            zoomArg === \"FitBV\"\n          ) {\n            dest = [\n              null,\n              { name: zoomArg },\n              zoomArgs.length > 1 ? zoomArgs[1] | 0 : null,\n            ];\n          } else if (zoomArg === \"FitR\") {\n            if (zoomArgs.length !== 5) {\n              console.error(\n                'PDFLinkService.setHash: Not enough parameters for \"FitR\".'\n              );\n            } else {\n              dest = [\n                null,\n                { name: zoomArg },\n                zoomArgs[1] | 0,\n                zoomArgs[2] | 0,\n                zoomArgs[3] | 0,\n                zoomArgs[4] | 0,\n              ];\n            }\n          } else {\n            console.error(\n              `PDFLinkService.setHash: \"${zoomArg}\" is not a valid zoom value.`\n            );\n          }\n        }\n      }\n      if (dest) {\n        this.pdfViewer.scrollPageIntoView({\n          pageNumber: pageNumber || this.page,\n          destArray: dest,\n          allowNegativeOffset: true,\n        });\n      } else if (pageNumber) {\n        this.page = pageNumber; // simple page\n      }\n      if (params.has(\"pagemode\")) {\n        this.eventBus.dispatch(\"pagemode\", {\n          source: this,\n          mode: params.get(\"pagemode\"),\n        });\n      }\n      // Ensure that this parameter is *always* handled last, in order to\n      // guarantee that it won't be overridden (e.g. by the \"page\" parameter).\n      if (params.has(\"nameddest\")) {\n        this.goToDestination(params.get(\"nameddest\"));\n      }\n    } else {\n      // Named (or explicit) destination.\n      dest = unescape(hash);\n      try {\n        dest = JSON.parse(dest);\n\n        if (!Array.isArray(dest)) {\n          // Avoid incorrectly rejecting a valid named destination, such as\n          // e.g. \"4.3\" or \"true\", because `JSON.parse` converted its type.\n          dest = dest.toString();\n        }\n      } catch (ex) {}\n\n      if (\n        typeof dest === \"string\" ||\n        PDFLinkService.#isValidExplicitDestination(dest)\n      ) {\n        this.goToDestination(dest);\n        return;\n      }\n      console.error(\n        `PDFLinkService.setHash: \"${unescape(\n          hash\n        )}\" is not a valid destination.`\n      );\n    }\n  }\n\n  /**\n   * @param {string} action\n   */\n  executeNamedAction(action) {\n    // See PDF reference, table 8.45 - Named action\n    switch (action) {\n      case \"GoBack\":\n        this.pdfHistory?.back();\n        break;\n\n      case \"GoForward\":\n        this.pdfHistory?.forward();\n        break;\n\n      case \"NextPage\":\n        this.pdfViewer.nextPage();\n        break;\n\n      case \"PrevPage\":\n        this.pdfViewer.previousPage();\n        break;\n\n      case \"LastPage\":\n        this.page = this.pagesCount;\n        break;\n\n      case \"FirstPage\":\n        this.page = 1;\n        break;\n\n      default:\n        break; // No action according to spec\n    }\n\n    this.eventBus.dispatch(\"namedaction\", {\n      source: this,\n      action,\n    });\n  }\n\n  /**\n   * @param {Object} action\n   */\n  async executeSetOCGState(action) {\n    const pdfDocument = this.pdfDocument;\n    const optionalContentConfig = await this.pdfViewer\n      .optionalContentConfigPromise;\n\n    if (pdfDocument !== this.pdfDocument) {\n      return; // The document was closed while the optional content resolved.\n    }\n    let operator;\n\n    for (const elem of action.state) {\n      switch (elem) {\n        case \"ON\":\n        case \"OFF\":\n        case \"Toggle\":\n          operator = elem;\n          continue;\n      }\n      switch (operator) {\n        case \"ON\":\n          optionalContentConfig.setVisibility(elem, true);\n          break;\n        case \"OFF\":\n          optionalContentConfig.setVisibility(elem, false);\n          break;\n        case \"Toggle\":\n          const group = optionalContentConfig.getGroup(elem);\n          if (group) {\n            optionalContentConfig.setVisibility(elem, !group.visible);\n          }\n          break;\n      }\n    }\n\n    this.pdfViewer.optionalContentConfigPromise = Promise.resolve(\n      optionalContentConfig\n    );\n  }\n\n  /**\n   * @param {number} pageNum - page number.\n   * @param {Object} pageRef - reference to the page.\n   */\n  cachePageRef(pageNum, pageRef) {\n    if (!pageRef) {\n      return;\n    }\n    const refStr =\n      pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n    this.#pagesRefCache.set(refStr, pageNum);\n  }\n\n  /**\n   * @ignore\n   */\n  _cachedPageNumber(pageRef) {\n    if (!pageRef) {\n      return null;\n    }\n    const refStr =\n      pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n    return this.#pagesRefCache.get(refStr) || null;\n  }\n\n  /**\n   * @param {number} pageNumber\n   */\n  isPageVisible(pageNumber) {\n    return this.pdfViewer.isPageVisible(pageNumber);\n  }\n\n  /**\n   * @param {number} pageNumber\n   */\n  isPageCached(pageNumber) {\n    return this.pdfViewer.isPageCached(pageNumber);\n  }\n\n  static #isValidExplicitDestination(dest) {\n    if (!Array.isArray(dest)) {\n      return false;\n    }\n    const destLength = dest.length;\n    if (destLength < 2) {\n      return false;\n    }\n    const page = dest[0];\n    if (\n      !(\n        typeof page === \"object\" &&\n        Number.isInteger(page.num) &&\n        Number.isInteger(page.gen)\n      ) &&\n      !(Number.isInteger(page) && page >= 0)\n    ) {\n      return false;\n    }\n    const zoom = dest[1];\n    if (!(typeof zoom === \"object\" && typeof zoom.name === \"string\")) {\n      return false;\n    }\n    let allowNull = true;\n    switch (zoom.name) {\n      case \"XYZ\":\n        if (destLength !== 5) {\n          return false;\n        }\n        break;\n      case \"Fit\":\n      case \"FitB\":\n        return destLength === 2;\n      case \"FitH\":\n      case \"FitBH\":\n      case \"FitV\":\n      case \"FitBV\":\n        if (destLength !== 3) {\n          return false;\n        }\n        break;\n      case \"FitR\":\n        if (destLength !== 6) {\n          return false;\n        }\n        allowNull = false;\n        break;\n      default:\n        return false;\n    }\n    for (let i = 2; i < destLength; i++) {\n      const param = dest[i];\n      if (!(typeof param === \"number\" || (allowNull && param === null))) {\n        return false;\n      }\n    }\n    return true;\n  }\n}\n\n/**\n * @implements {IPDFLinkService}\n */\nclass SimpleLinkService {\n  constructor() {\n    this.externalLinkEnabled = true;\n  }\n\n  /**\n   * @type {number}\n   */\n  get pagesCount() {\n    return 0;\n  }\n\n  /**\n   * @type {number}\n   */\n  get page() {\n    return 0;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set page(value) {}\n\n  /**\n   * @type {number}\n   */\n  get rotation() {\n    return 0;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set rotation(value) {}\n\n  /**\n   * @type {boolean}\n   */\n  get isInPresentationMode() {\n    return false;\n  }\n\n  /**\n   * @param {string|Array} dest - The named, or explicit, PDF destination.\n   */\n  async goToDestination(dest) {}\n\n  /**\n   * @param {number|string} val - The page number, or page label.\n   */\n  goToPage(val) {}\n\n  /**\n   * @param {HTMLAnchorElement} link\n   * @param {string} url\n   * @param {boolean} [newWindow]\n   */\n  addLinkAttributes(link, url, newWindow = false) {\n    addLinkAttributes(link, { url, enabled: this.externalLinkEnabled });\n  }\n\n  /**\n   * @param dest - The PDF destination object.\n   * @returns {string} The hyperlink to the PDF object.\n   */\n  getDestinationHash(dest) {\n    return \"#\";\n  }\n\n  /**\n   * @param hash - The PDF parameters/hash.\n   * @returns {string} The hyperlink to the PDF object.\n   */\n  getAnchorUrl(hash) {\n    return \"#\";\n  }\n\n  /**\n   * @param {string} hash\n   */\n  setHash(hash) {}\n\n  /**\n   * @param {string} action\n   */\n  executeNamedAction(action) {}\n\n  /**\n   * @param {Object} action\n   */\n  executeSetOCGState(action) {}\n\n  /**\n   * @param {number} pageNum - page number.\n   * @param {Object} pageRef - reference to the page.\n   */\n  cachePageRef(pageNum, pageRef) {}\n\n  /**\n   * @param {number} pageNumber\n   */\n  isPageVisible(pageNumber) {\n    return true;\n  }\n\n  /**\n   * @param {number} pageNumber\n   */\n  isPageCached(pageNumber) {\n    return true;\n  }\n}\n\nexport { LinkTarget, PDFLinkService, SimpleLinkService };\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  animationStarted,\n  apiPageLayoutToViewerModes,\n  apiPageModeToSidebarView,\n  AutoPrintRegExp,\n  DEFAULT_SCALE_VALUE,\n  getActiveOrFocusedElement,\n  isValidRotation,\n  isValidScrollMode,\n  isValidSpreadMode,\n  normalizeWheelEventDirection,\n  parseQueryString,\n  ProgressBar,\n  RendererType,\n  RenderingStates,\n  ScrollMode,\n  SidebarView,\n  SpreadMode,\n  TextLayerMode,\n} from \"./ui_utils.js\";\nimport {\n  AnnotationEditorType,\n  build,\n  createPromiseCapability,\n  getDocument,\n  getFilenameFromUrl,\n  getPdfFilenameFromUrl,\n  GlobalWorkerOptions,\n  InvalidPDFException,\n  isPdfFile,\n  loadScript,\n  MissingPDFException,\n  OPS,\n  PDFWorker,\n  shadow,\n  UnexpectedResponseException,\n  UNSUPPORTED_FEATURES,\n  version,\n} from \"pdfjs-lib\";\nimport { AppOptions, OptionKind } from \"./app_options.js\";\nimport { AutomationEventBus, EventBus } from \"./event_utils.js\";\nimport { CursorTool, PDFCursorTools } from \"./pdf_cursor_tools.js\";\nimport { LinkTarget, PDFLinkService } from \"./pdf_link_service.js\";\nimport { AnnotationEditorParams } from \"./annotation_editor_params.js\";\nimport { OverlayManager } from \"./overlay_manager.js\";\nimport { PasswordPrompt } from \"./password_prompt.js\";\nimport { PDFAttachmentViewer } from \"./pdf_attachment_viewer.js\";\nimport { PDFDocumentProperties } from \"./pdf_document_properties.js\";\nimport { PDFFindBar } from \"./pdf_find_bar.js\";\nimport { PDFFindController } from \"./pdf_find_controller.js\";\nimport { PDFHistory } from \"./pdf_history.js\";\nimport { PDFLayerViewer } from \"./pdf_layer_viewer.js\";\nimport { PDFOutlineViewer } from \"./pdf_outline_viewer.js\";\nimport { PDFPresentationMode } from \"./pdf_presentation_mode.js\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\nimport { PDFSidebar } from \"./pdf_sidebar.js\";\nimport { PDFSidebarResizer } from \"./pdf_sidebar_resizer.js\";\nimport { PDFThumbnailViewer } from \"./pdf_thumbnail_viewer.js\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\nimport { SecondaryToolbar } from \"./secondary_toolbar.js\";\nimport { Toolbar } from \"./toolbar.js\";\nimport { ViewHistory } from \"./view_history.js\";\n\nconst DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000; // ms\nconst FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms\nconst WHEEL_ZOOM_DISABLED_TIMEOUT = 1000; // ms\n\nconst ViewOnLoad = {\n  UNKNOWN: -1,\n  PREVIOUS: 0, // Default value.\n  INITIAL: 1,\n};\n\nconst ViewerCssTheme = {\n  AUTOMATIC: 0, // Default value.\n  LIGHT: 1,\n  DARK: 2,\n};\n\n// Keep these in sync with mozilla-central's Histograms.json.\nconst KNOWN_VERSIONS = [\n  \"1.0\",\n  \"1.1\",\n  \"1.2\",\n  \"1.3\",\n  \"1.4\",\n  \"1.5\",\n  \"1.6\",\n  \"1.7\",\n  \"1.8\",\n  \"1.9\",\n  \"2.0\",\n  \"2.1\",\n  \"2.2\",\n  \"2.3\",\n];\n// Keep these in sync with mozilla-central's Histograms.json.\nconst KNOWN_GENERATORS = [\n  \"acrobat distiller\",\n  \"acrobat pdfwriter\",\n  \"adobe livecycle\",\n  \"adobe pdf library\",\n  \"adobe photoshop\",\n  \"ghostscript\",\n  \"tcpdf\",\n  \"cairo\",\n  \"dvipdfm\",\n  \"dvips\",\n  \"pdftex\",\n  \"pdfkit\",\n  \"itext\",\n  \"prince\",\n  \"quarkxpress\",\n  \"mac os x\",\n  \"microsoft\",\n  \"openoffice\",\n  \"oracle\",\n  \"luradocument\",\n  \"pdf-xchange\",\n  \"antenna house\",\n  \"aspose.cells\",\n  \"fpdf\",\n];\n\nclass DefaultExternalServices {\n  constructor() {\n    throw new Error(\"Cannot initialize DefaultExternalServices.\");\n  }\n\n  static updateFindControlState(data) {}\n\n  static updateFindMatchesCount(data) {}\n\n  static initPassiveLoading(callbacks) {}\n\n  static reportTelemetry(data) {}\n\n  static createDownloadManager(options) {\n    throw new Error(\"Not implemented: createDownloadManager\");\n  }\n\n  static createPreferences() {\n    throw new Error(\"Not implemented: createPreferences\");\n  }\n\n  static createL10n(options) {\n    throw new Error(\"Not implemented: createL10n\");\n  }\n\n  static createScripting(options) {\n    throw new Error(\"Not implemented: createScripting\");\n  }\n\n  static get supportsIntegratedFind() {\n    return shadow(this, \"supportsIntegratedFind\", false);\n  }\n\n  static get supportsDocumentFonts() {\n    return shadow(this, \"supportsDocumentFonts\", true);\n  }\n\n  static get supportedMouseWheelZoomModifierKeys() {\n    return shadow(this, \"supportedMouseWheelZoomModifierKeys\", {\n      ctrlKey: true,\n      metaKey: true,\n    });\n  }\n\n  static get isInAutomation() {\n    return shadow(this, \"isInAutomation\", false);\n  }\n\n  static updateEditorStates(data) {\n    throw new Error(\"Not implemented: updateEditorStates\");\n  }\n}\n\nconst PDFViewerApplication = {\n  initialBookmark: document.location.hash.substring(1),\n  _initializedCapability: createPromiseCapability(),\n  appConfig: null,\n  pdfDocument: null,\n  pdfLoadingTask: null,\n  printService: null,\n  /** @type {PDFViewer} */\n  pdfViewer: null,\n  /** @type {PDFThumbnailViewer} */\n  pdfThumbnailViewer: null,\n  /** @type {PDFRenderingQueue} */\n  pdfRenderingQueue: null,\n  /** @type {PDFPresentationMode} */\n  pdfPresentationMode: null,\n  /** @type {PDFDocumentProperties} */\n  pdfDocumentProperties: null,\n  /** @type {PDFLinkService} */\n  pdfLinkService: null,\n  /** @type {PDFHistory} */\n  pdfHistory: null,\n  /** @type {PDFSidebar} */\n  pdfSidebar: null,\n  /** @type {PDFSidebarResizer} */\n  pdfSidebarResizer: null,\n  /** @type {PDFOutlineViewer} */\n  pdfOutlineViewer: null,\n  /** @type {PDFAttachmentViewer} */\n  pdfAttachmentViewer: null,\n  /** @type {PDFLayerViewer} */\n  pdfLayerViewer: null,\n  /** @type {PDFCursorTools} */\n  pdfCursorTools: null,\n  /** @type {PDFScriptingManager} */\n  pdfScriptingManager: null,\n  /** @type {ViewHistory} */\n  store: null,\n  /** @type {DownloadManager} */\n  downloadManager: null,\n  /** @type {OverlayManager} */\n  overlayManager: null,\n  /** @type {Preferences} */\n  preferences: null,\n  /** @type {Toolbar} */\n  toolbar: null,\n  /** @type {SecondaryToolbar} */\n  secondaryToolbar: null,\n  /** @type {EventBus} */\n  eventBus: null,\n  /** @type {IL10n} */\n  l10n: null,\n  /** @type {AnnotationEditorParams} */\n  annotationEditorParams: null,\n  isInitialViewSet: false,\n  downloadComplete: false,\n  isViewerEmbedded: window.parent !== window,\n  url: \"\",\n  baseUrl: \"\",\n  _downloadUrl: \"\",\n  externalServices: DefaultExternalServices,\n  _boundEvents: Object.create(null),\n  documentInfo: null,\n  metadata: null,\n  _contentDispositionFilename: null,\n  _contentLength: null,\n  _saveInProgress: false,\n  _docStats: null,\n  _wheelUnusedTicks: 0,\n  _PDFBug: null,\n  _hasAnnotationEditors: false,\n  _title: document.title,\n  _printAnnotationStoragePromise: null,\n\n  // Called once when the document is loaded.\n  async initialize(appConfig) {\n    this.preferences = this.externalServices.createPreferences();\n    this.appConfig = appConfig;\n\n    await this._readPreferences();\n    await this._parseHashParameters();\n    this._forceCssTheme();\n    await this._initializeL10n();\n\n    if (\n      this.isViewerEmbedded &&\n      AppOptions.get(\"externalLinkTarget\") === LinkTarget.NONE\n    ) {\n      // Prevent external links from \"replacing\" the viewer,\n      // when it's embedded in e.g. an <iframe> or an <object>.\n      AppOptions.set(\"externalLinkTarget\", LinkTarget.TOP);\n    }\n    await this._initializeViewerComponents();\n\n    // Bind the various event handlers *after* the viewer has been\n    // initialized, to prevent errors if an event arrives too soon.\n    this.bindEvents();\n    this.bindWindowEvents();\n\n    // We can start UI localization now.\n    const appContainer = appConfig.appContainer || document.documentElement;\n    this.l10n.translate(appContainer).then(() => {\n      // Dispatch the 'localized' event on the `eventBus` once the viewer\n      // has been fully initialized and translated.\n      this.eventBus.dispatch(\"localized\", { source: this });\n    });\n\n    this._initializedCapability.resolve();\n  },\n\n  /**\n   * @private\n   */\n  async _readPreferences() {\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n    ) {\n      if (AppOptions.get(\"disablePreferences\")) {\n        // Give custom implementations of the default viewer a simpler way to\n        // opt-out of having the `Preferences` override existing `AppOptions`.\n        return;\n      }\n      if (AppOptions._hasUserOptions()) {\n        console.warn(\n          \"_readPreferences: The Preferences may override manually set AppOptions; \" +\n            'please use the \"disablePreferences\"-option in order to prevent that.'\n        );\n      }\n    }\n    try {\n      AppOptions.setAll(await this.preferences.getAll());\n    } catch (reason) {\n      console.error(`_readPreferences: \"${reason?.message}\".`);\n    }\n  },\n\n  /**\n   * Potentially parse special debugging flags in the hash section of the URL.\n   * @private\n   */\n  async _parseHashParameters() {\n    if (!AppOptions.get(\"pdfBugEnabled\")) {\n      return;\n    }\n    const hash = document.location.hash.substring(1);\n    if (!hash) {\n      return;\n    }\n    const { mainContainer, viewerContainer } = this.appConfig,\n      params = parseQueryString(hash);\n\n    if (params.get(\"disableworker\") === \"true\") {\n      try {\n        await loadFakeWorker();\n      } catch (ex) {\n        console.error(`_parseHashParameters: \"${ex.message}\".`);\n      }\n    }\n    if (params.has(\"disablerange\")) {\n      AppOptions.set(\"disableRange\", params.get(\"disablerange\") === \"true\");\n    }\n    if (params.has(\"disablestream\")) {\n      AppOptions.set(\"disableStream\", params.get(\"disablestream\") === \"true\");\n    }\n    if (params.has(\"disableautofetch\")) {\n      AppOptions.set(\n        \"disableAutoFetch\",\n        params.get(\"disableautofetch\") === \"true\"\n      );\n    }\n    if (params.has(\"disablefontface\")) {\n      AppOptions.set(\n        \"disableFontFace\",\n        params.get(\"disablefontface\") === \"true\"\n      );\n    }\n    if (params.has(\"disablehistory\")) {\n      AppOptions.set(\"disableHistory\", params.get(\"disablehistory\") === \"true\");\n    }\n    if (params.has(\"verbosity\")) {\n      AppOptions.set(\"verbosity\", params.get(\"verbosity\") | 0);\n    }\n    if (params.has(\"textlayer\")) {\n      switch (params.get(\"textlayer\")) {\n        case \"off\":\n          AppOptions.set(\"textLayerMode\", TextLayerMode.DISABLE);\n          break;\n        case \"visible\":\n        case \"shadow\":\n        case \"hover\":\n          viewerContainer.classList.add(`textLayer-${params.get(\"textlayer\")}`);\n          try {\n            await loadPDFBug(this);\n            this._PDFBug.loadCSS();\n          } catch (ex) {\n            console.error(`_parseHashParameters: \"${ex.message}\".`);\n          }\n          break;\n      }\n    }\n    if (params.has(\"pdfbug\")) {\n      AppOptions.set(\"pdfBug\", true);\n      AppOptions.set(\"fontExtraProperties\", true);\n\n      const enabled = params.get(\"pdfbug\").split(\",\");\n      try {\n        await loadPDFBug(this);\n        this._PDFBug.init({ OPS }, mainContainer, enabled);\n      } catch (ex) {\n        console.error(`_parseHashParameters: \"${ex.message}\".`);\n      }\n    }\n    // It is not possible to change locale for the (various) extension builds.\n    if (\n      (typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n      params.has(\"locale\")\n    ) {\n      AppOptions.set(\"locale\", params.get(\"locale\"));\n    }\n  },\n\n  /**\n   * @private\n   */\n  async _initializeL10n() {\n    this.l10n = this.externalServices.createL10n(\n      typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n        ? { locale: AppOptions.get(\"locale\") }\n        : null\n    );\n    const dir = await this.l10n.getDirection();\n    document.getElementsByTagName(\"html\")[0].dir = dir;\n  },\n\n  /**\n   * @private\n   */\n  _forceCssTheme() {\n    const cssTheme = AppOptions.get(\"viewerCssTheme\");\n    if (\n      cssTheme === ViewerCssTheme.AUTOMATIC ||\n      !Object.values(ViewerCssTheme).includes(cssTheme)\n    ) {\n      return;\n    }\n    try {\n      const styleSheet = document.styleSheets[0];\n      const cssRules = styleSheet?.cssRules || [];\n      for (let i = 0, ii = cssRules.length; i < ii; i++) {\n        const rule = cssRules[i];\n        if (\n          rule instanceof CSSMediaRule &&\n          rule.media?.[0] === \"(prefers-color-scheme: dark)\"\n        ) {\n          if (cssTheme === ViewerCssTheme.LIGHT) {\n            styleSheet.deleteRule(i);\n            return;\n          }\n          // cssTheme === ViewerCssTheme.DARK\n          const darkRules =\n            /^@media \\(prefers-color-scheme: dark\\) {\\n\\s*([\\w\\s-.,:;/\\\\{}()]+)\\n}$/.exec(\n              rule.cssText\n            );\n          if (darkRules?.[1]) {\n            styleSheet.deleteRule(i);\n            styleSheet.insertRule(darkRules[1], i);\n          }\n          return;\n        }\n      }\n    } catch (reason) {\n      console.error(`_forceCssTheme: \"${reason?.message}\".`);\n    }\n  },\n\n  /**\n   * @private\n   */\n  async _initializeViewerComponents() {\n    const { appConfig, externalServices } = this;\n\n    const eventBus = externalServices.isInAutomation\n      ? new AutomationEventBus()\n      : new EventBus();\n    this.eventBus = eventBus;\n\n    this.overlayManager = new OverlayManager();\n\n    const pdfRenderingQueue = new PDFRenderingQueue();\n    pdfRenderingQueue.onIdle = this._cleanup.bind(this);\n    this.pdfRenderingQueue = pdfRenderingQueue;\n\n    const pdfLinkService = new PDFLinkService({\n      eventBus,\n      externalLinkTarget: AppOptions.get(\"externalLinkTarget\"),\n      externalLinkRel: AppOptions.get(\"externalLinkRel\"),\n      ignoreDestinationZoom: AppOptions.get(\"ignoreDestinationZoom\"),\n    });\n    this.pdfLinkService = pdfLinkService;\n\n    const downloadManager = externalServices.createDownloadManager();\n    this.downloadManager = downloadManager;\n\n    const findController = new PDFFindController({\n      linkService: pdfLinkService,\n      eventBus,\n    });\n    this.findController = findController;\n\n    const pdfScriptingManager = new PDFScriptingManager({\n      eventBus,\n      sandboxBundleSrc:\n        typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC || CHROME\")\n          ? AppOptions.get(\"sandboxBundleSrc\")\n          : null,\n      scriptingFactory: externalServices,\n      docPropertiesLookup: this._scriptingDocProperties.bind(this),\n    });\n    this.pdfScriptingManager = pdfScriptingManager;\n\n    const container = appConfig.mainContainer,\n      viewer = appConfig.viewerContainer;\n    const annotationEditorMode = AppOptions.get(\"annotationEditorMode\");\n    const pageColors =\n      AppOptions.get(\"forcePageColors\") ||\n      window.matchMedia(\"(forced-colors: active)\").matches\n        ? {\n            background: AppOptions.get(\"pageColorsBackground\"),\n            foreground: AppOptions.get(\"pageColorsForeground\"),\n          }\n        : null;\n\n    this.pdfViewer = new PDFViewer({\n      container,\n      viewer,\n      eventBus,\n      renderingQueue: pdfRenderingQueue,\n      linkService: pdfLinkService,\n      downloadManager,\n      findController,\n      scriptingManager:\n        AppOptions.get(\"enableScripting\") && pdfScriptingManager,\n      renderer:\n        typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n          ? AppOptions.get(\"renderer\")\n          : null,\n      l10n: this.l10n,\n      textLayerMode: AppOptions.get(\"textLayerMode\"),\n      annotationMode: AppOptions.get(\"annotationMode\"),\n      annotationEditorMode,\n      imageResourcesPath: AppOptions.get(\"imageResourcesPath\"),\n      enablePrintAutoRotate: AppOptions.get(\"enablePrintAutoRotate\"),\n      useOnlyCssZoom: AppOptions.get(\"useOnlyCssZoom\"),\n      maxCanvasPixels: AppOptions.get(\"maxCanvasPixels\"),\n      enablePermissions: AppOptions.get(\"enablePermissions\"),\n      pageColors,\n    });\n    pdfRenderingQueue.setViewer(this.pdfViewer);\n    pdfLinkService.setViewer(this.pdfViewer);\n    pdfScriptingManager.setViewer(this.pdfViewer);\n\n    this.pdfThumbnailViewer = new PDFThumbnailViewer({\n      container: appConfig.sidebar.thumbnailView,\n      eventBus,\n      renderingQueue: pdfRenderingQueue,\n      linkService: pdfLinkService,\n      l10n: this.l10n,\n      pageColors,\n    });\n    pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);\n\n    // The browsing history is only enabled when the viewer is standalone,\n    // i.e. not when it is embedded in a web page.\n    if (!this.isViewerEmbedded && !AppOptions.get(\"disableHistory\")) {\n      this.pdfHistory = new PDFHistory({\n        linkService: pdfLinkService,\n        eventBus,\n      });\n      pdfLinkService.setHistory(this.pdfHistory);\n    }\n\n    if (!this.supportsIntegratedFind) {\n      this.findBar = new PDFFindBar(appConfig.findBar, eventBus, this.l10n);\n    }\n\n    if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n      this.annotationEditorParams = new AnnotationEditorParams(\n        appConfig.annotationEditorParams,\n        eventBus\n      );\n    } else {\n      for (const element of [\n        document.getElementById(\"editorModeButtons\"),\n        document.getElementById(\"editorModeSeparator\"),\n      ]) {\n        element.hidden = true;\n      }\n    }\n\n    this.pdfDocumentProperties = new PDFDocumentProperties(\n      appConfig.documentProperties,\n      this.overlayManager,\n      eventBus,\n      this.l10n,\n      /* fileNameLookup = */ () => {\n        return this._docFilename;\n      }\n    );\n\n    this.pdfCursorTools = new PDFCursorTools({\n      container,\n      eventBus,\n      cursorToolOnLoad: AppOptions.get(\"cursorToolOnLoad\"),\n    });\n\n    this.toolbar = new Toolbar(appConfig.toolbar, eventBus, this.l10n);\n\n    this.secondaryToolbar = new SecondaryToolbar(\n      appConfig.secondaryToolbar,\n      eventBus,\n      this.externalServices\n    );\n\n    if (this.supportsFullscreen) {\n      this.pdfPresentationMode = new PDFPresentationMode({\n        container,\n        pdfViewer: this.pdfViewer,\n        eventBus,\n      });\n    }\n\n    this.passwordPrompt = new PasswordPrompt(\n      appConfig.passwordOverlay,\n      this.overlayManager,\n      this.l10n,\n      this.isViewerEmbedded\n    );\n\n    this.pdfOutlineViewer = new PDFOutlineViewer({\n      container: appConfig.sidebar.outlineView,\n      eventBus,\n      linkService: pdfLinkService,\n      downloadManager,\n    });\n\n    this.pdfAttachmentViewer = new PDFAttachmentViewer({\n      container: appConfig.sidebar.attachmentsView,\n      eventBus,\n      downloadManager,\n    });\n\n    this.pdfLayerViewer = new PDFLayerViewer({\n      container: appConfig.sidebar.layersView,\n      eventBus,\n      l10n: this.l10n,\n    });\n\n    this.pdfSidebar = new PDFSidebar({\n      elements: appConfig.sidebar,\n      pdfViewer: this.pdfViewer,\n      pdfThumbnailViewer: this.pdfThumbnailViewer,\n      eventBus,\n      l10n: this.l10n,\n    });\n    this.pdfSidebar.onToggled = this.forceRendering.bind(this);\n\n    this.pdfSidebarResizer = new PDFSidebarResizer(\n      appConfig.sidebarResizer,\n      eventBus,\n      this.l10n\n    );\n  },\n\n  run(config) {\n    this.initialize(config).then(webViewerInitialized);\n  },\n\n  get initialized() {\n    return this._initializedCapability.settled;\n  },\n\n  get initializedPromise() {\n    return this._initializedCapability.promise;\n  },\n\n  zoomIn(steps) {\n    if (this.pdfViewer.isInPresentationMode) {\n      return;\n    }\n    this.pdfViewer.increaseScale(steps);\n  },\n\n  zoomOut(steps) {\n    if (this.pdfViewer.isInPresentationMode) {\n      return;\n    }\n    this.pdfViewer.decreaseScale(steps);\n  },\n\n  zoomReset() {\n    if (this.pdfViewer.isInPresentationMode) {\n      return;\n    }\n    this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n  },\n\n  get pagesCount() {\n    return this.pdfDocument ? this.pdfDocument.numPages : 0;\n  },\n\n  get page() {\n    return this.pdfViewer.currentPageNumber;\n  },\n\n  set page(val) {\n    this.pdfViewer.currentPageNumber = val;\n  },\n\n  get supportsPrinting() {\n    return PDFPrintServiceFactory.instance.supportsPrinting;\n  },\n\n  get supportsFullscreen() {\n    return shadow(this, \"supportsFullscreen\", document.fullscreenEnabled);\n  },\n\n  get supportsIntegratedFind() {\n    return this.externalServices.supportsIntegratedFind;\n  },\n\n  get supportsDocumentFonts() {\n    return this.externalServices.supportsDocumentFonts;\n  },\n\n  get loadingBar() {\n    const bar = new ProgressBar(\"loadingBar\");\n    return shadow(this, \"loadingBar\", bar);\n  },\n\n  get supportedMouseWheelZoomModifierKeys() {\n    return this.externalServices.supportedMouseWheelZoomModifierKeys;\n  },\n\n  initPassiveLoading() {\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      !PDFJSDev.test(\"MOZCENTRAL || CHROME\")\n    ) {\n      throw new Error(\"Not implemented: initPassiveLoading\");\n    }\n    this.externalServices.initPassiveLoading({\n      onOpenWithTransport: (url, length, transport) => {\n        this.open(url, { length, range: transport });\n      },\n      onOpenWithData: (data, contentDispositionFilename) => {\n        if (isPdfFile(contentDispositionFilename)) {\n          this._contentDispositionFilename = contentDispositionFilename;\n        }\n        this.open(data);\n      },\n      onOpenWithURL: (url, length, originalUrl) => {\n        const file = originalUrl !== undefined ? { url, originalUrl } : url;\n        const args = length !== undefined ? { length } : null;\n\n        this.open(file, args);\n      },\n      onError: err => {\n        this.l10n.get(\"loading_error\").then(msg => {\n          this._documentError(msg, err);\n        });\n      },\n      onProgress: (loaded, total) => {\n        this.progress(loaded / total);\n      },\n    });\n  },\n\n  setTitleUsingUrl(url = \"\", downloadUrl = null) {\n    this.url = url;\n    this.baseUrl = url.split(\"#\")[0];\n    if (downloadUrl) {\n      this._downloadUrl =\n        downloadUrl === url ? this.baseUrl : downloadUrl.split(\"#\")[0];\n    }\n    let title = getPdfFilenameFromUrl(url, \"\");\n    if (!title) {\n      try {\n        title = decodeURIComponent(getFilenameFromUrl(url)) || url;\n      } catch (ex) {\n        // decodeURIComponent may throw URIError,\n        // fall back to using the unprocessed url in that case\n        title = url;\n      }\n    }\n    this.setTitle(title);\n  },\n\n  setTitle(title = this._title) {\n    this._title = title;\n\n    if (this.isViewerEmbedded) {\n      // Embedded PDF viewers should not be changing their parent page's title.\n      return;\n    }\n    const editorIndicator =\n      this._hasAnnotationEditors && !this.pdfRenderingQueue.printing;\n    document.title = `${editorIndicator ? \"* \" : \"\"}${title}`;\n  },\n\n  get _docFilename() {\n    // Use `this.url` instead of `this.baseUrl` to perform filename detection\n    // based on the reference fragment as ultimate fallback if needed.\n    return this._contentDispositionFilename || getPdfFilenameFromUrl(this.url);\n  },\n\n  /**\n   * @private\n   */\n  _hideViewBookmark() {\n    // URL does not reflect proper document location - hiding some buttons.\n    this.appConfig.secondaryToolbar.viewBookmarkButton.hidden = true;\n  },\n\n  /**\n   * Closes opened PDF document.\n   * @returns {Promise} - Returns the promise, which is resolved when all\n   *                      destruction is completed.\n   */\n  async close() {\n    this._unblockDocumentLoadEvent();\n    this._hideViewBookmark();\n\n    if (!this.pdfLoadingTask) {\n      return;\n    }\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      this.pdfDocument?.annotationStorage.size > 0 &&\n      this._annotationStorageModified\n    ) {\n      try {\n        // Trigger saving, to prevent data loss in forms; see issue 12257.\n        await this.save();\n      } catch (reason) {\n        // Ignoring errors, to ensure that document closing won't break.\n      }\n    }\n    const promises = [];\n\n    promises.push(this.pdfLoadingTask.destroy());\n    this.pdfLoadingTask = null;\n\n    if (this.pdfDocument) {\n      this.pdfDocument = null;\n\n      this.pdfThumbnailViewer.setDocument(null);\n      this.pdfViewer.setDocument(null);\n      this.pdfLinkService.setDocument(null);\n      this.pdfDocumentProperties.setDocument(null);\n    }\n    this.pdfLinkService.externalLinkEnabled = true;\n    this.store = null;\n    this.isInitialViewSet = false;\n    this.downloadComplete = false;\n    this.url = \"\";\n    this.baseUrl = \"\";\n    this._downloadUrl = \"\";\n    this.documentInfo = null;\n    this.metadata = null;\n    this._contentDispositionFilename = null;\n    this._contentLength = null;\n    this._saveInProgress = false;\n    this._docStats = null;\n    this._hasAnnotationEditors = false;\n\n    promises.push(this.pdfScriptingManager.destroyPromise);\n\n    this.setTitle();\n    this.pdfSidebar.reset();\n    this.pdfOutlineViewer.reset();\n    this.pdfAttachmentViewer.reset();\n    this.pdfLayerViewer.reset();\n\n    this.pdfHistory?.reset();\n    this.findBar?.reset();\n    this.toolbar.reset();\n    this.secondaryToolbar.reset();\n    this._PDFBug?.cleanup();\n\n    await Promise.all(promises);\n  },\n\n  /**\n   * Opens PDF document specified by URL or array with additional arguments.\n   * @param {string|TypedArray|ArrayBuffer} file - PDF location or binary data.\n   * @param {Object} [args] - Additional arguments for the getDocument call,\n   *                          e.g. HTTP headers ('httpHeaders') or alternative\n   *                          data transport ('range').\n   * @returns {Promise} - Returns the promise, which is resolved when document\n   *                      is opened.\n   */\n  async open(file, args) {\n    if (this.pdfLoadingTask) {\n      // We need to destroy already opened document.\n      await this.close();\n    }\n    // Set the necessary global worker parameters, using the available options.\n    const workerParameters = AppOptions.getAll(OptionKind.WORKER);\n    for (const key in workerParameters) {\n      GlobalWorkerOptions[key] = workerParameters[key];\n    }\n\n    const parameters = Object.create(null);\n    if (typeof file === \"string\") {\n      // URL\n      this.setTitleUsingUrl(file, /* downloadUrl = */ file);\n      parameters.url = file;\n    } else if (file && \"byteLength\" in file) {\n      // ArrayBuffer\n      parameters.data = file;\n    } else if (file.url && file.originalUrl) {\n      this.setTitleUsingUrl(file.originalUrl, /* downloadUrl = */ file.url);\n      parameters.url = file.url;\n    }\n    // Set the necessary API parameters, using the available options.\n    const apiParameters = AppOptions.getAll(OptionKind.API);\n    for (const key in apiParameters) {\n      let value = apiParameters[key];\n\n      if (key === \"docBaseUrl\" && !value) {\n        if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n          value = document.URL.split(\"#\")[0];\n        } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n          value = this.baseUrl;\n        }\n      }\n      parameters[key] = value;\n    }\n    // Finally, update the API parameters with the arguments (if they exist).\n    if (args) {\n      for (const key in args) {\n        parameters[key] = args[key];\n      }\n    }\n\n    const loadingTask = getDocument(parameters);\n    this.pdfLoadingTask = loadingTask;\n\n    loadingTask.onPassword = (updateCallback, reason) => {\n      if (this.isViewerEmbedded) {\n        // The load event can't be triggered until the password is entered, so\n        // if the viewer is in an iframe and its visibility depends on the\n        // onload callback then the viewer never shows (bug 1801341).\n        this._unblockDocumentLoadEvent();\n      }\n\n      this.pdfLinkService.externalLinkEnabled = false;\n      this.passwordPrompt.setUpdateCallback(updateCallback, reason);\n      this.passwordPrompt.open();\n    };\n\n    loadingTask.onProgress = ({ loaded, total }) => {\n      this.progress(loaded / total);\n    };\n\n    // Listen for unsupported features to report telemetry.\n    loadingTask.onUnsupportedFeature = this.fallback.bind(this);\n\n    return loadingTask.promise.then(\n      pdfDocument => {\n        this.load(pdfDocument);\n      },\n      reason => {\n        if (loadingTask !== this.pdfLoadingTask) {\n          return undefined; // Ignore errors for previously opened PDF files.\n        }\n\n        let key = \"loading_error\";\n        if (reason instanceof InvalidPDFException) {\n          key = \"invalid_file_error\";\n        } else if (reason instanceof MissingPDFException) {\n          key = \"missing_file_error\";\n        } else if (reason instanceof UnexpectedResponseException) {\n          key = \"unexpected_response_error\";\n        }\n        return this.l10n.get(key).then(msg => {\n          this._documentError(msg, { message: reason?.message });\n          throw reason;\n        });\n      }\n    );\n  },\n\n  /**\n   * @private\n   */\n  _ensureDownloadComplete() {\n    if (this.pdfDocument && this.downloadComplete) {\n      return;\n    }\n    throw new Error(\"PDF document not downloaded.\");\n  },\n\n  async download() {\n    const url = this._downloadUrl,\n      filename = this._docFilename;\n    try {\n      this._ensureDownloadComplete();\n\n      const data = await this.pdfDocument.getData();\n      const blob = new Blob([data], { type: \"application/pdf\" });\n\n      await this.downloadManager.download(blob, url, filename);\n    } catch (reason) {\n      // When the PDF document isn't ready, or the PDF file is still\n      // downloading, simply download using the URL.\n      await this.downloadManager.downloadUrl(url, filename);\n    }\n  },\n\n  async save() {\n    if (this._saveInProgress) {\n      return;\n    }\n    this._saveInProgress = true;\n    await this.pdfScriptingManager.dispatchWillSave();\n\n    const url = this._downloadUrl,\n      filename = this._docFilename;\n    try {\n      this._ensureDownloadComplete();\n\n      const data = await this.pdfDocument.saveDocument();\n      const blob = new Blob([data], { type: \"application/pdf\" });\n\n      await this.downloadManager.download(blob, url, filename);\n    } catch (reason) {\n      // When the PDF document isn't ready, or the PDF file is still\n      // downloading, simply fallback to a \"regular\" download.\n      console.error(`Error when saving the document: ${reason.message}`);\n      await this.download();\n    } finally {\n      await this.pdfScriptingManager.dispatchDidSave();\n      this._saveInProgress = false;\n    }\n\n    if (this._hasAnnotationEditors) {\n      this.externalServices.reportTelemetry({\n        type: \"editing\",\n        data: { type: \"save\" },\n      });\n    }\n  },\n\n  downloadOrSave() {\n    if (this.pdfDocument?.annotationStorage.size > 0) {\n      this.save();\n    } else {\n      this.download();\n    }\n  },\n\n  fallback(featureId) {\n    this.externalServices.reportTelemetry({\n      type: \"unsupportedFeature\",\n      featureId,\n    });\n  },\n\n  /**\n   * Report the error; used for errors affecting loading and/or parsing of\n   * the entire PDF document.\n   */\n  _documentError(message, moreInfo = null) {\n    this._unblockDocumentLoadEvent();\n\n    this._otherError(message, moreInfo);\n\n    this.eventBus.dispatch(\"documenterror\", {\n      source: this,\n      message,\n      reason: moreInfo?.message ?? null,\n    });\n  },\n\n  /**\n   * Report the error; used for errors affecting e.g. only a single page.\n   * @param {string} message - A message that is human readable.\n   * @param {Object} [moreInfo] - Further information about the error that is\n   *                              more technical. Should have a 'message' and\n   *                              optionally a 'stack' property.\n   */\n  _otherError(message, moreInfo = null) {\n    const moreInfoText = [`PDF.js v${version || \"?\"} (build: ${build || \"?\"})`];\n    if (moreInfo) {\n      moreInfoText.push(`Message: ${moreInfo.message}`);\n\n      if (moreInfo.stack) {\n        moreInfoText.push(`Stack: ${moreInfo.stack}`);\n      } else {\n        if (moreInfo.filename) {\n          moreInfoText.push(`File: ${moreInfo.filename}`);\n        }\n        if (moreInfo.lineNumber) {\n          moreInfoText.push(`Line: ${moreInfo.lineNumber}`);\n        }\n      }\n    }\n\n    console.error(`${message}\\n\\n${moreInfoText.join(\"\\n\")}`);\n    this.fallback();\n  },\n\n  progress(level) {\n    if (this.downloadComplete) {\n      // Don't accidentally show the loading bar again when the entire file has\n      // already been fetched (only an issue when disableAutoFetch is enabled).\n      return;\n    }\n    const percent = Math.round(level * 100);\n    // When we transition from full request to range requests, it's possible\n    // that we discard some of the loaded data. This can cause the loading\n    // bar to move backwards. So prevent this by only updating the bar if it\n    // increases.\n    if (percent <= this.loadingBar.percent) {\n      return;\n    }\n    this.loadingBar.percent = percent;\n\n    // When disableAutoFetch is enabled, it's not uncommon for the entire file\n    // to never be fetched (depends on e.g. the file structure). In this case\n    // the loading bar will not be completely filled, nor will it be hidden.\n    // To prevent displaying a partially filled loading bar permanently, we\n    // hide it when no data has been loaded during a certain amount of time.\n    const disableAutoFetch =\n      this.pdfDocument?.loadingParams.disableAutoFetch ??\n      AppOptions.get(\"disableAutoFetch\");\n\n    if (!disableAutoFetch || isNaN(percent)) {\n      return;\n    }\n    if (this.disableAutoFetchLoadingBarTimeout) {\n      clearTimeout(this.disableAutoFetchLoadingBarTimeout);\n      this.disableAutoFetchLoadingBarTimeout = null;\n    }\n    this.loadingBar.show();\n\n    this.disableAutoFetchLoadingBarTimeout = setTimeout(() => {\n      this.loadingBar.hide();\n      this.disableAutoFetchLoadingBarTimeout = null;\n    }, DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);\n  },\n\n  load(pdfDocument) {\n    this.pdfDocument = pdfDocument;\n\n    pdfDocument.getDownloadInfo().then(({ length }) => {\n      this._contentLength = length; // Ensure that the correct length is used.\n      this.downloadComplete = true;\n      this.loadingBar.hide();\n\n      firstPagePromise.then(() => {\n        this.eventBus.dispatch(\"documentloaded\", { source: this });\n      });\n    });\n\n    // Since the `setInitialView` call below depends on this being resolved,\n    // fetch it early to avoid delaying initial rendering of the PDF document.\n    const pageLayoutPromise = pdfDocument.getPageLayout().catch(function () {\n      /* Avoid breaking initial rendering; ignoring errors. */\n    });\n    const pageModePromise = pdfDocument.getPageMode().catch(function () {\n      /* Avoid breaking initial rendering; ignoring errors. */\n    });\n    const openActionPromise = pdfDocument.getOpenAction().catch(function () {\n      /* Avoid breaking initial rendering; ignoring errors. */\n    });\n\n    this.toolbar.setPagesCount(pdfDocument.numPages, false);\n    this.secondaryToolbar.setPagesCount(pdfDocument.numPages);\n\n    let baseDocumentUrl;\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      baseDocumentUrl = null;\n    } else if (PDFJSDev.test(\"MOZCENTRAL\")) {\n      baseDocumentUrl = this.baseUrl;\n    } else if (PDFJSDev.test(\"CHROME\")) {\n      baseDocumentUrl = location.href.split(\"#\")[0];\n    }\n    this.pdfLinkService.setDocument(pdfDocument, baseDocumentUrl);\n    this.pdfDocumentProperties.setDocument(pdfDocument);\n\n    const pdfViewer = this.pdfViewer;\n    pdfViewer.setDocument(pdfDocument);\n    const { firstPagePromise, onePageRendered, pagesPromise } = pdfViewer;\n\n    const pdfThumbnailViewer = this.pdfThumbnailViewer;\n    pdfThumbnailViewer.setDocument(pdfDocument);\n\n    const storedPromise = (this.store = new ViewHistory(\n      pdfDocument.fingerprints[0]\n    ))\n      .getMultiple({\n        page: null,\n        zoom: DEFAULT_SCALE_VALUE,\n        scrollLeft: \"0\",\n        scrollTop: \"0\",\n        rotation: null,\n        sidebarView: SidebarView.UNKNOWN,\n        scrollMode: ScrollMode.UNKNOWN,\n        spreadMode: SpreadMode.UNKNOWN,\n      })\n      .catch(() => {\n        /* Unable to read from storage; ignoring errors. */\n        return Object.create(null);\n      });\n\n    firstPagePromise.then(pdfPage => {\n      this.loadingBar.setWidth(this.appConfig.viewerContainer);\n      this._initializeAnnotationStorageCallbacks(pdfDocument);\n\n      Promise.all([\n        animationStarted,\n        storedPromise,\n        pageLayoutPromise,\n        pageModePromise,\n        openActionPromise,\n      ])\n        .then(async ([timeStamp, stored, pageLayout, pageMode, openAction]) => {\n          const viewOnLoad = AppOptions.get(\"viewOnLoad\");\n\n          this._initializePdfHistory({\n            fingerprint: pdfDocument.fingerprints[0],\n            viewOnLoad,\n            initialDest: openAction?.dest,\n          });\n          const initialBookmark = this.initialBookmark;\n\n          // Initialize the default values, from user preferences.\n          const zoom = AppOptions.get(\"defaultZoomValue\");\n          let hash = zoom ? `zoom=${zoom}` : null;\n\n          let rotation = null;\n          let sidebarView = AppOptions.get(\"sidebarViewOnLoad\");\n          let scrollMode = AppOptions.get(\"scrollModeOnLoad\");\n          let spreadMode = AppOptions.get(\"spreadModeOnLoad\");\n\n          if (stored.page && viewOnLoad !== ViewOnLoad.INITIAL) {\n            hash =\n              `page=${stored.page}&zoom=${zoom || stored.zoom},` +\n              `${stored.scrollLeft},${stored.scrollTop}`;\n\n            rotation = parseInt(stored.rotation, 10);\n            // Always let user preference take precedence over the view history.\n            if (sidebarView === SidebarView.UNKNOWN) {\n              sidebarView = stored.sidebarView | 0;\n            }\n            if (scrollMode === ScrollMode.UNKNOWN) {\n              scrollMode = stored.scrollMode | 0;\n            }\n            if (spreadMode === SpreadMode.UNKNOWN) {\n              spreadMode = stored.spreadMode | 0;\n            }\n          }\n          // Always let the user preference/view history take precedence.\n          if (pageMode && sidebarView === SidebarView.UNKNOWN) {\n            sidebarView = apiPageModeToSidebarView(pageMode);\n          }\n          if (\n            pageLayout &&\n            scrollMode === ScrollMode.UNKNOWN &&\n            spreadMode === SpreadMode.UNKNOWN\n          ) {\n            const modes = apiPageLayoutToViewerModes(pageLayout);\n            // TODO: Try to improve page-switching when using the mouse-wheel\n            // and/or arrow-keys before allowing the document to control this.\n            // scrollMode = modes.scrollMode;\n            spreadMode = modes.spreadMode;\n          }\n\n          this.setInitialView(hash, {\n            rotation,\n            sidebarView,\n            scrollMode,\n            spreadMode,\n          });\n          this.eventBus.dispatch(\"documentinit\", { source: this });\n          // Make all navigation keys work on document load,\n          // unless the viewer is embedded in a web page.\n          if (!this.isViewerEmbedded) {\n            pdfViewer.focus();\n          }\n\n          // For documents with different page sizes, once all pages are\n          // resolved, ensure that the correct location becomes visible on load.\n          // (To reduce the risk, in very large and/or slow loading documents,\n          //  that the location changes *after* the user has started interacting\n          //  with the viewer, wait for either `pagesPromise` or a timeout.)\n          await Promise.race([\n            pagesPromise,\n            new Promise(resolve => {\n              setTimeout(resolve, FORCE_PAGES_LOADED_TIMEOUT);\n            }),\n          ]);\n          if (!initialBookmark && !hash) {\n            return;\n          }\n          if (pdfViewer.hasEqualPageSizes) {\n            return;\n          }\n          this.initialBookmark = initialBookmark;\n\n          // eslint-disable-next-line no-self-assign\n          pdfViewer.currentScaleValue = pdfViewer.currentScaleValue;\n          // Re-apply the initial document location.\n          this.setInitialView(hash);\n        })\n        .catch(() => {\n          // Ensure that the document is always completely initialized,\n          // even if there are any errors thrown above.\n          this.setInitialView();\n        })\n        .then(function () {\n          // At this point, rendering of the initial page(s) should always have\n          // started (and may even have completed).\n          // To prevent any future issues, e.g. the document being completely\n          // blank on load, always trigger rendering here.\n          pdfViewer.update();\n        });\n    });\n\n    pagesPromise.then(\n      () => {\n        this._unblockDocumentLoadEvent();\n\n        this._initializeAutoPrint(pdfDocument, openActionPromise);\n      },\n      reason => {\n        this.l10n.get(\"loading_error\").then(msg => {\n          this._documentError(msg, { message: reason?.message });\n        });\n      }\n    );\n\n    onePageRendered.then(data => {\n      this.externalServices.reportTelemetry({\n        type: \"pageInfo\",\n        timestamp: data.timestamp,\n      });\n\n      pdfDocument.getOutline().then(outline => {\n        if (pdfDocument !== this.pdfDocument) {\n          return; // The document was closed while the outline resolved.\n        }\n        this.pdfOutlineViewer.render({ outline, pdfDocument });\n      });\n      pdfDocument.getAttachments().then(attachments => {\n        if (pdfDocument !== this.pdfDocument) {\n          return; // The document was closed while the attachments resolved.\n        }\n        this.pdfAttachmentViewer.render({ attachments });\n      });\n      // Ensure that the layers accurately reflects the current state in the\n      // viewer itself, rather than the default state provided by the API.\n      pdfViewer.optionalContentConfigPromise.then(optionalContentConfig => {\n        if (pdfDocument !== this.pdfDocument) {\n          return; // The document was closed while the layers resolved.\n        }\n        this.pdfLayerViewer.render({ optionalContentConfig, pdfDocument });\n      });\n    });\n\n    this._initializePageLabels(pdfDocument);\n    this._initializeMetadata(pdfDocument);\n  },\n\n  /**\n   * @private\n   */\n  async _scriptingDocProperties(pdfDocument) {\n    if (!this.documentInfo) {\n      // It should be *extremely* rare for metadata to not have been resolved\n      // when this code runs, but ensure that we handle that case here.\n      await new Promise(resolve => {\n        this.eventBus._on(\"metadataloaded\", resolve, { once: true });\n      });\n      if (pdfDocument !== this.pdfDocument) {\n        return null; // The document was closed while the metadata resolved.\n      }\n    }\n    if (!this._contentLength) {\n      // Always waiting for the entire PDF document to be loaded will, most\n      // likely, delay sandbox-creation too much in the general case for all\n      // PDF documents which are not provided as binary data to the API.\n      // Hence we'll simply have to trust that the `contentLength` (as provided\n      // by the server), when it exists, is accurate enough here.\n      await new Promise(resolve => {\n        this.eventBus._on(\"documentloaded\", resolve, { once: true });\n      });\n      if (pdfDocument !== this.pdfDocument) {\n        return null; // The document was closed while the downloadInfo resolved.\n      }\n    }\n\n    return {\n      ...this.documentInfo,\n      baseURL: this.baseUrl,\n      filesize: this._contentLength,\n      filename: this._docFilename,\n      metadata: this.metadata?.getRaw(),\n      authors: this.metadata?.get(\"dc:creator\"),\n      numPages: this.pagesCount,\n      URL: this.url,\n    };\n  },\n\n  /**\n   * @private\n   */\n  async _initializeAutoPrint(pdfDocument, openActionPromise) {\n    const [openAction, javaScript] = await Promise.all([\n      openActionPromise,\n      !this.pdfViewer.enableScripting ? pdfDocument.getJavaScript() : null,\n    ]);\n\n    if (pdfDocument !== this.pdfDocument) {\n      return; // The document was closed while the auto print data resolved.\n    }\n    let triggerAutoPrint = false;\n\n    if (openAction?.action === \"Print\") {\n      triggerAutoPrint = true;\n    }\n    if (javaScript) {\n      javaScript.some(js => {\n        if (!js) {\n          // Don't warn/fallback for empty JavaScript actions.\n          return false;\n        }\n        console.warn(\"Warning: JavaScript support is not enabled\");\n        this.fallback(UNSUPPORTED_FEATURES.javaScript);\n        return true;\n      });\n\n      if (!triggerAutoPrint) {\n        // Hack to support auto printing.\n        for (const js of javaScript) {\n          if (js && AutoPrintRegExp.test(js)) {\n            triggerAutoPrint = true;\n            break;\n          }\n        }\n      }\n    }\n\n    if (triggerAutoPrint) {\n      this.triggerPrinting();\n    }\n  },\n\n  /**\n   * @private\n   */\n  async _initializeMetadata(pdfDocument) {\n    const { info, metadata, contentDispositionFilename, contentLength } =\n      await pdfDocument.getMetadata();\n\n    if (pdfDocument !== this.pdfDocument) {\n      return; // The document was closed while the metadata resolved.\n    }\n    this.documentInfo = info;\n    this.metadata = metadata;\n    this._contentDispositionFilename ??= contentDispositionFilename;\n    this._contentLength ??= contentLength; // See `getDownloadInfo`-call above.\n\n    // Provides some basic debug information\n    console.log(\n      `PDF ${pdfDocument.fingerprints[0]} [${info.PDFFormatVersion} ` +\n        `${(info.Producer || \"-\").trim()} / ${(info.Creator || \"-\").trim()}] ` +\n        `(PDF.js: ${version || \"?\"} [${build || \"?\"}])`\n    );\n    let pdfTitle = info.Title;\n\n    const metadataTitle = metadata?.get(\"dc:title\");\n    if (metadataTitle) {\n      // Ghostscript can produce invalid 'dc:title' Metadata entries:\n      //  - The title may be \"Untitled\" (fixes bug 1031612).\n      //  - The title may contain incorrectly encoded characters, which thus\n      //    looks broken, hence we ignore the Metadata entry when it contains\n      //    characters from the Specials Unicode block (fixes bug 1605526).\n      if (\n        metadataTitle !== \"Untitled\" &&\n        !/[\\uFFF0-\\uFFFF]/g.test(metadataTitle)\n      ) {\n        pdfTitle = metadataTitle;\n      }\n    }\n    if (pdfTitle) {\n      this.setTitle(\n        `${pdfTitle} - ${this._contentDispositionFilename || this._title}`\n      );\n    } else if (this._contentDispositionFilename) {\n      this.setTitle(this._contentDispositionFilename);\n    }\n\n    if (\n      info.IsXFAPresent &&\n      !info.IsAcroFormPresent &&\n      !pdfDocument.isPureXfa\n    ) {\n      if (pdfDocument.loadingParams.enableXfa) {\n        console.warn(\"Warning: XFA Foreground documents are not supported\");\n      } else {\n        console.warn(\"Warning: XFA support is not enabled\");\n      }\n      this.fallback(UNSUPPORTED_FEATURES.forms);\n    } else if (\n      (info.IsAcroFormPresent || info.IsXFAPresent) &&\n      !this.pdfViewer.renderForms\n    ) {\n      console.warn(\"Warning: Interactive form support is not enabled\");\n      this.fallback(UNSUPPORTED_FEATURES.forms);\n    }\n\n    if (info.IsSignaturesPresent) {\n      console.warn(\"Warning: Digital signatures validation is not supported\");\n      this.fallback(UNSUPPORTED_FEATURES.signatures);\n    }\n\n    // Telemetry labels must be C++ variable friendly.\n    let versionId = \"other\";\n    if (KNOWN_VERSIONS.includes(info.PDFFormatVersion)) {\n      versionId = `v${info.PDFFormatVersion.replace(\".\", \"_\")}`;\n    }\n    let generatorId = \"other\";\n    if (info.Producer) {\n      const producer = info.Producer.toLowerCase();\n      KNOWN_GENERATORS.some(function (generator) {\n        if (!producer.includes(generator)) {\n          return false;\n        }\n        generatorId = generator.replace(/[ .-]/g, \"_\");\n        return true;\n      });\n    }\n    let formType = null;\n    if (info.IsXFAPresent) {\n      formType = \"xfa\";\n    } else if (info.IsAcroFormPresent) {\n      formType = \"acroform\";\n    }\n    this.externalServices.reportTelemetry({\n      type: \"documentInfo\",\n      version: versionId,\n      generator: generatorId,\n      formType,\n    });\n\n    this.eventBus.dispatch(\"metadataloaded\", { source: this });\n  },\n\n  /**\n   * @private\n   */\n  async _initializePageLabels(pdfDocument) {\n    const labels = await pdfDocument.getPageLabels();\n\n    if (pdfDocument !== this.pdfDocument) {\n      return; // The document was closed while the page labels resolved.\n    }\n    if (!labels || AppOptions.get(\"disablePageLabels\")) {\n      return;\n    }\n    const numLabels = labels.length;\n    // Ignore page labels that correspond to standard page numbering,\n    // or page labels that are all empty.\n    let standardLabels = 0,\n      emptyLabels = 0;\n    for (let i = 0; i < numLabels; i++) {\n      const label = labels[i];\n      if (label === (i + 1).toString()) {\n        standardLabels++;\n      } else if (label === \"\") {\n        emptyLabels++;\n      } else {\n        break;\n      }\n    }\n    if (standardLabels >= numLabels || emptyLabels >= numLabels) {\n      return;\n    }\n    const { pdfViewer, pdfThumbnailViewer, toolbar } = this;\n\n    pdfViewer.setPageLabels(labels);\n    pdfThumbnailViewer.setPageLabels(labels);\n\n    // Changing toolbar page display to use labels and we need to set\n    // the label of the current page.\n    toolbar.setPagesCount(numLabels, true);\n    toolbar.setPageNumber(\n      pdfViewer.currentPageNumber,\n      pdfViewer.currentPageLabel\n    );\n  },\n\n  /**\n   * @private\n   */\n  _initializePdfHistory({ fingerprint, viewOnLoad, initialDest = null }) {\n    if (!this.pdfHistory) {\n      return;\n    }\n    this.pdfHistory.initialize({\n      fingerprint,\n      resetHistory: viewOnLoad === ViewOnLoad.INITIAL,\n      updateUrl: AppOptions.get(\"historyUpdateUrl\"),\n    });\n\n    if (this.pdfHistory.initialBookmark) {\n      this.initialBookmark = this.pdfHistory.initialBookmark;\n\n      this.initialRotation = this.pdfHistory.initialRotation;\n    }\n\n    // Always let the browser history/document hash take precedence.\n    if (\n      initialDest &&\n      !this.initialBookmark &&\n      viewOnLoad === ViewOnLoad.UNKNOWN\n    ) {\n      this.initialBookmark = JSON.stringify(initialDest);\n      // TODO: Re-factor the `PDFHistory` initialization to remove this hack\n      // that's currently necessary to prevent weird initial history state.\n      this.pdfHistory.push({ explicitDest: initialDest, pageNumber: null });\n    }\n  },\n\n  /**\n   * @private\n   */\n  _initializeAnnotationStorageCallbacks(pdfDocument) {\n    if (pdfDocument !== this.pdfDocument) {\n      return;\n    }\n    const { annotationStorage } = pdfDocument;\n\n    annotationStorage.onSetModified = () => {\n      window.addEventListener(\"beforeunload\", beforeUnload);\n\n      if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n        this._annotationStorageModified = true;\n      }\n    };\n    annotationStorage.onResetModified = () => {\n      window.removeEventListener(\"beforeunload\", beforeUnload);\n\n      if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n        delete this._annotationStorageModified;\n      }\n    };\n    annotationStorage.onAnnotationEditor = typeStr => {\n      this._hasAnnotationEditors = !!typeStr;\n      this.setTitle();\n\n      if (typeStr) {\n        this.externalServices.reportTelemetry({\n          type: \"editing\",\n          data: { type: typeStr },\n        });\n      }\n    };\n  },\n\n  setInitialView(\n    storedHash,\n    { rotation, sidebarView, scrollMode, spreadMode } = {}\n  ) {\n    const setRotation = angle => {\n      if (isValidRotation(angle)) {\n        this.pdfViewer.pagesRotation = angle;\n      }\n    };\n    const setViewerModes = (scroll, spread) => {\n      if (isValidScrollMode(scroll)) {\n        this.pdfViewer.scrollMode = scroll;\n      }\n      if (isValidSpreadMode(spread)) {\n        this.pdfViewer.spreadMode = spread;\n      }\n    };\n    this.isInitialViewSet = true;\n    this.pdfSidebar.setInitialView(sidebarView);\n\n    setViewerModes(scrollMode, spreadMode);\n\n    if (this.initialBookmark) {\n      setRotation(this.initialRotation);\n      delete this.initialRotation;\n\n      this.pdfLinkService.setHash(this.initialBookmark);\n      this.initialBookmark = null;\n    } else if (storedHash) {\n      setRotation(rotation);\n\n      this.pdfLinkService.setHash(storedHash);\n    }\n\n    // Ensure that the correct page number is displayed in the UI,\n    // even if the active page didn't change during document load.\n    this.toolbar.setPageNumber(\n      this.pdfViewer.currentPageNumber,\n      this.pdfViewer.currentPageLabel\n    );\n    this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber);\n\n    if (!this.pdfViewer.currentScaleValue) {\n      // Scale was not initialized: invalid bookmark or scale was not specified.\n      // Setting the default one.\n      this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n    }\n  },\n\n  /**\n   * @private\n   */\n  _cleanup() {\n    if (!this.pdfDocument) {\n      return; // run cleanup when document is loaded\n    }\n    this.pdfViewer.cleanup();\n    this.pdfThumbnailViewer.cleanup();\n\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n    ) {\n      // We don't want to remove fonts used by active page SVGs.\n      this.pdfDocument.cleanup(\n        /* keepLoadedFonts = */ this.pdfViewer.renderer === RendererType.SVG\n      );\n    } else {\n      this.pdfDocument.cleanup();\n    }\n  },\n\n  forceRendering() {\n    this.pdfRenderingQueue.printing = !!this.printService;\n    this.pdfRenderingQueue.isThumbnailViewEnabled =\n      this.pdfSidebar.visibleView === SidebarView.THUMBS;\n    this.pdfRenderingQueue.renderHighestPriority();\n  },\n\n  beforePrint() {\n    this._printAnnotationStoragePromise = this.pdfScriptingManager\n      .dispatchWillPrint()\n      .catch(() => {\n        /* Avoid breaking printing; ignoring errors. */\n      })\n      .then(() => {\n        return this.pdfDocument?.annotationStorage.print;\n      });\n\n    if (this.printService) {\n      // There is no way to suppress beforePrint/afterPrint events,\n      // but PDFPrintService may generate double events -- this will ignore\n      // the second event that will be coming from native window.print().\n      return;\n    }\n\n    if (!this.supportsPrinting) {\n      this.l10n.get(\"printing_not_supported\").then(msg => {\n        this._otherError(msg);\n      });\n      return;\n    }\n\n    // The beforePrint is a sync method and we need to know layout before\n    // returning from this method. Ensure that we can get sizes of the pages.\n    if (!this.pdfViewer.pageViewsReady) {\n      this.l10n.get(\"printing_not_ready\").then(msg => {\n        // eslint-disable-next-line no-alert\n        window.alert(msg);\n      });\n      return;\n    }\n\n    const pagesOverview = this.pdfViewer.getPagesOverview();\n    const printContainer = this.appConfig.printContainer;\n    const printResolution = AppOptions.get(\"printResolution\");\n    const optionalContentConfigPromise =\n      this.pdfViewer.optionalContentConfigPromise;\n\n    const printService = PDFPrintServiceFactory.instance.createPrintService(\n      this.pdfDocument,\n      pagesOverview,\n      printContainer,\n      printResolution,\n      optionalContentConfigPromise,\n      this._printAnnotationStoragePromise,\n      this.l10n\n    );\n    this.printService = printService;\n    this.forceRendering();\n    // Disable the editor-indicator during printing (fixes bug 1790552).\n    this.setTitle();\n\n    printService.layout();\n\n    this.externalServices.reportTelemetry({\n      type: \"print\",\n    });\n\n    if (this._hasAnnotationEditors) {\n      this.externalServices.reportTelemetry({\n        type: \"editing\",\n        data: { type: \"print\" },\n      });\n    }\n  },\n\n  afterPrint() {\n    if (this._printAnnotationStoragePromise) {\n      this._printAnnotationStoragePromise.then(() => {\n        this.pdfScriptingManager.dispatchDidPrint();\n      });\n      this._printAnnotationStoragePromise = null;\n    }\n\n    if (this.printService) {\n      this.printService.destroy();\n      this.printService = null;\n\n      this.pdfDocument?.annotationStorage.resetModified();\n    }\n    this.forceRendering();\n    // Re-enable the editor-indicator after printing (fixes bug 1790552).\n    this.setTitle();\n  },\n\n  rotatePages(delta) {\n    this.pdfViewer.pagesRotation += delta;\n    // Note that the thumbnail viewer is updated, and rendering is triggered,\n    // in the 'rotationchanging' event handler.\n  },\n\n  requestPresentationMode() {\n    this.pdfPresentationMode?.request();\n  },\n\n  triggerPrinting() {\n    if (!this.supportsPrinting) {\n      return;\n    }\n    window.print();\n  },\n\n  bindEvents() {\n    const { eventBus, _boundEvents } = this;\n\n    _boundEvents.beforePrint = this.beforePrint.bind(this);\n    _boundEvents.afterPrint = this.afterPrint.bind(this);\n\n    eventBus._on(\"resize\", webViewerResize);\n    eventBus._on(\"hashchange\", webViewerHashchange);\n    eventBus._on(\"beforeprint\", _boundEvents.beforePrint);\n    eventBus._on(\"afterprint\", _boundEvents.afterPrint);\n    eventBus._on(\"pagerendered\", webViewerPageRendered);\n    eventBus._on(\"updateviewarea\", webViewerUpdateViewarea);\n    eventBus._on(\"pagechanging\", webViewerPageChanging);\n    eventBus._on(\"scalechanging\", webViewerScaleChanging);\n    eventBus._on(\"rotationchanging\", webViewerRotationChanging);\n    eventBus._on(\"sidebarviewchanged\", webViewerSidebarViewChanged);\n    eventBus._on(\"pagemode\", webViewerPageMode);\n    eventBus._on(\"namedaction\", webViewerNamedAction);\n    eventBus._on(\"presentationmodechanged\", webViewerPresentationModeChanged);\n    eventBus._on(\"presentationmode\", webViewerPresentationMode);\n    eventBus._on(\n      \"switchannotationeditormode\",\n      webViewerSwitchAnnotationEditorMode\n    );\n    eventBus._on(\n      \"switchannotationeditorparams\",\n      webViewerSwitchAnnotationEditorParams\n    );\n    eventBus._on(\"print\", webViewerPrint);\n    eventBus._on(\"download\", webViewerDownload);\n    eventBus._on(\"firstpage\", webViewerFirstPage);\n    eventBus._on(\"lastpage\", webViewerLastPage);\n    eventBus._on(\"nextpage\", webViewerNextPage);\n    eventBus._on(\"previouspage\", webViewerPreviousPage);\n    eventBus._on(\"zoomin\", webViewerZoomIn);\n    eventBus._on(\"zoomout\", webViewerZoomOut);\n    eventBus._on(\"zoomreset\", webViewerZoomReset);\n    eventBus._on(\"pagenumberchanged\", webViewerPageNumberChanged);\n    eventBus._on(\"scalechanged\", webViewerScaleChanged);\n    eventBus._on(\"rotatecw\", webViewerRotateCw);\n    eventBus._on(\"rotateccw\", webViewerRotateCcw);\n    eventBus._on(\"optionalcontentconfig\", webViewerOptionalContentConfig);\n    eventBus._on(\"switchscrollmode\", webViewerSwitchScrollMode);\n    eventBus._on(\"scrollmodechanged\", webViewerScrollModeChanged);\n    eventBus._on(\"switchspreadmode\", webViewerSwitchSpreadMode);\n    eventBus._on(\"spreadmodechanged\", webViewerSpreadModeChanged);\n    eventBus._on(\"documentproperties\", webViewerDocumentProperties);\n    eventBus._on(\"findfromurlhash\", webViewerFindFromUrlHash);\n    eventBus._on(\"updatefindmatchescount\", webViewerUpdateFindMatchesCount);\n    eventBus._on(\"updatefindcontrolstate\", webViewerUpdateFindControlState);\n\n    if (AppOptions.get(\"pdfBug\")) {\n      _boundEvents.reportPageStatsPDFBug = reportPageStatsPDFBug;\n\n      eventBus._on(\"pagerendered\", _boundEvents.reportPageStatsPDFBug);\n      eventBus._on(\"pagechanging\", _boundEvents.reportPageStatsPDFBug);\n    }\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      eventBus._on(\"fileinputchange\", webViewerFileInputChange);\n      eventBus._on(\"openfile\", webViewerOpenFile);\n    }\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      eventBus._on(\n        \"annotationeditorstateschanged\",\n        webViewerAnnotationEditorStatesChanged\n      );\n    }\n  },\n\n  bindWindowEvents() {\n    const { eventBus, _boundEvents } = this;\n\n    function addWindowResolutionChange(evt = null) {\n      if (evt) {\n        webViewerResolutionChange(evt);\n      }\n      const mediaQueryList = window.matchMedia(\n        `(resolution: ${window.devicePixelRatio || 1}dppx)`\n      );\n      mediaQueryList.addEventListener(\"change\", addWindowResolutionChange, {\n        once: true,\n      });\n\n      if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n        return;\n      }\n      _boundEvents.removeWindowResolutionChange ||= function () {\n        mediaQueryList.removeEventListener(\"change\", addWindowResolutionChange);\n        _boundEvents.removeWindowResolutionChange = null;\n      };\n    }\n    addWindowResolutionChange();\n\n    _boundEvents.windowResize = () => {\n      eventBus.dispatch(\"resize\", { source: window });\n    };\n    _boundEvents.windowHashChange = () => {\n      eventBus.dispatch(\"hashchange\", {\n        source: window,\n        hash: document.location.hash.substring(1),\n      });\n    };\n    _boundEvents.windowBeforePrint = () => {\n      eventBus.dispatch(\"beforeprint\", { source: window });\n    };\n    _boundEvents.windowAfterPrint = () => {\n      eventBus.dispatch(\"afterprint\", { source: window });\n    };\n    _boundEvents.windowUpdateFromSandbox = event => {\n      eventBus.dispatch(\"updatefromsandbox\", {\n        source: window,\n        detail: event.detail,\n      });\n    };\n\n    window.addEventListener(\"visibilitychange\", webViewerVisibilityChange);\n    window.addEventListener(\"wheel\", webViewerWheel, { passive: false });\n    window.addEventListener(\"touchstart\", webViewerTouchStart, {\n      passive: false,\n    });\n    window.addEventListener(\"click\", webViewerClick);\n    window.addEventListener(\"keydown\", webViewerKeyDown);\n    window.addEventListener(\"resize\", _boundEvents.windowResize);\n    window.addEventListener(\"hashchange\", _boundEvents.windowHashChange);\n    window.addEventListener(\"beforeprint\", _boundEvents.windowBeforePrint);\n    window.addEventListener(\"afterprint\", _boundEvents.windowAfterPrint);\n    window.addEventListener(\n      \"updatefromsandbox\",\n      _boundEvents.windowUpdateFromSandbox\n    );\n  },\n\n  unbindEvents() {\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      throw new Error(\"Not implemented: unbindEvents\");\n    }\n    const { eventBus, _boundEvents } = this;\n\n    eventBus._off(\"resize\", webViewerResize);\n    eventBus._off(\"hashchange\", webViewerHashchange);\n    eventBus._off(\"beforeprint\", _boundEvents.beforePrint);\n    eventBus._off(\"afterprint\", _boundEvents.afterPrint);\n    eventBus._off(\"pagerendered\", webViewerPageRendered);\n    eventBus._off(\"updateviewarea\", webViewerUpdateViewarea);\n    eventBus._off(\"pagechanging\", webViewerPageChanging);\n    eventBus._off(\"scalechanging\", webViewerScaleChanging);\n    eventBus._off(\"rotationchanging\", webViewerRotationChanging);\n    eventBus._off(\"sidebarviewchanged\", webViewerSidebarViewChanged);\n    eventBus._off(\"pagemode\", webViewerPageMode);\n    eventBus._off(\"namedaction\", webViewerNamedAction);\n    eventBus._off(\"presentationmodechanged\", webViewerPresentationModeChanged);\n    eventBus._off(\"presentationmode\", webViewerPresentationMode);\n    eventBus._off(\"print\", webViewerPrint);\n    eventBus._off(\"download\", webViewerDownload);\n    eventBus._off(\"firstpage\", webViewerFirstPage);\n    eventBus._off(\"lastpage\", webViewerLastPage);\n    eventBus._off(\"nextpage\", webViewerNextPage);\n    eventBus._off(\"previouspage\", webViewerPreviousPage);\n    eventBus._off(\"zoomin\", webViewerZoomIn);\n    eventBus._off(\"zoomout\", webViewerZoomOut);\n    eventBus._off(\"zoomreset\", webViewerZoomReset);\n    eventBus._off(\"pagenumberchanged\", webViewerPageNumberChanged);\n    eventBus._off(\"scalechanged\", webViewerScaleChanged);\n    eventBus._off(\"rotatecw\", webViewerRotateCw);\n    eventBus._off(\"rotateccw\", webViewerRotateCcw);\n    eventBus._off(\"optionalcontentconfig\", webViewerOptionalContentConfig);\n    eventBus._off(\"switchscrollmode\", webViewerSwitchScrollMode);\n    eventBus._off(\"scrollmodechanged\", webViewerScrollModeChanged);\n    eventBus._off(\"switchspreadmode\", webViewerSwitchSpreadMode);\n    eventBus._off(\"spreadmodechanged\", webViewerSpreadModeChanged);\n    eventBus._off(\"documentproperties\", webViewerDocumentProperties);\n    eventBus._off(\"findfromurlhash\", webViewerFindFromUrlHash);\n    eventBus._off(\"updatefindmatchescount\", webViewerUpdateFindMatchesCount);\n    eventBus._off(\"updatefindcontrolstate\", webViewerUpdateFindControlState);\n\n    if (_boundEvents.reportPageStatsPDFBug) {\n      eventBus._off(\"pagerendered\", _boundEvents.reportPageStatsPDFBug);\n      eventBus._off(\"pagechanging\", _boundEvents.reportPageStatsPDFBug);\n\n      _boundEvents.reportPageStatsPDFBug = null;\n    }\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      eventBus._off(\"fileinputchange\", webViewerFileInputChange);\n      eventBus._off(\"openfile\", webViewerOpenFile);\n    }\n\n    _boundEvents.beforePrint = null;\n    _boundEvents.afterPrint = null;\n  },\n\n  unbindWindowEvents() {\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      throw new Error(\"Not implemented: unbindWindowEvents\");\n    }\n    const { _boundEvents } = this;\n\n    window.removeEventListener(\"visibilitychange\", webViewerVisibilityChange);\n    window.removeEventListener(\"wheel\", webViewerWheel, { passive: false });\n    window.removeEventListener(\"touchstart\", webViewerTouchStart, {\n      passive: false,\n    });\n    window.removeEventListener(\"click\", webViewerClick);\n    window.removeEventListener(\"keydown\", webViewerKeyDown);\n    window.removeEventListener(\"resize\", _boundEvents.windowResize);\n    window.removeEventListener(\"hashchange\", _boundEvents.windowHashChange);\n    window.removeEventListener(\"beforeprint\", _boundEvents.windowBeforePrint);\n    window.removeEventListener(\"afterprint\", _boundEvents.windowAfterPrint);\n    window.removeEventListener(\n      \"updatefromsandbox\",\n      _boundEvents.windowUpdateFromSandbox\n    );\n\n    _boundEvents.removeWindowResolutionChange?.();\n    _boundEvents.windowResize = null;\n    _boundEvents.windowHashChange = null;\n    _boundEvents.windowBeforePrint = null;\n    _boundEvents.windowAfterPrint = null;\n    _boundEvents.windowUpdateFromSandbox = null;\n  },\n\n  accumulateWheelTicks(ticks) {\n    // If the scroll direction changed, reset the accumulated wheel ticks.\n    if (\n      (this._wheelUnusedTicks > 0 && ticks < 0) ||\n      (this._wheelUnusedTicks < 0 && ticks > 0)\n    ) {\n      this._wheelUnusedTicks = 0;\n    }\n    this._wheelUnusedTicks += ticks;\n    const wholeTicks =\n      Math.sign(this._wheelUnusedTicks) *\n      Math.floor(Math.abs(this._wheelUnusedTicks));\n    this._wheelUnusedTicks -= wholeTicks;\n    return wholeTicks;\n  },\n\n  /**\n   * Should be called *after* all pages have loaded, or if an error occurred,\n   * to unblock the \"load\" event; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553\n   * @private\n   */\n  _unblockDocumentLoadEvent() {\n    document.blockUnblockOnload?.(false);\n\n    // Ensure that this method is only ever run once.\n    this._unblockDocumentLoadEvent = () => {};\n  },\n\n  /**\n   * @ignore\n   */\n  _reportDocumentStatsTelemetry() {\n    const { stats } = this.pdfDocument;\n    if (stats !== this._docStats) {\n      this._docStats = stats;\n\n      this.externalServices.reportTelemetry({\n        type: \"documentStats\",\n        stats,\n      });\n    }\n  },\n\n  /**\n   * Used together with the integration-tests, to enable awaiting full\n   * initialization of the scripting/sandbox.\n   */\n  get scriptingReady() {\n    return this.pdfScriptingManager.ready;\n  },\n};\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n  const HOSTED_VIEWER_ORIGINS = [\n    \"null\",\n    \"http://mozilla.github.io\",\n    \"https://mozilla.github.io\",\n  ];\n  // eslint-disable-next-line no-var\n  var validateFileURL = function (file) {\n    if (!file) {\n      return;\n    }\n    try {\n      const viewerOrigin = new URL(window.location.href).origin || \"null\";\n      if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) {\n        // Hosted or local viewer, allow for any file locations\n        return;\n      }\n      const fileOrigin = new URL(file, window.location.href).origin;\n      // Removing of the following line will not guarantee that the viewer will\n      // start accepting URLs from foreign origin -- CORS headers on the remote\n      // server must be properly configured.\n      if (fileOrigin !== viewerOrigin) {\n        throw new Error(\"file origin does not match viewer's\");\n      }\n    } catch (ex) {\n      PDFViewerApplication.l10n.get(\"loading_error\").then(msg => {\n        PDFViewerApplication._documentError(msg, { message: ex?.message });\n      });\n      throw ex;\n    }\n  };\n}\n\nasync function loadFakeWorker() {\n  GlobalWorkerOptions.workerSrc ||= AppOptions.get(\"workerSrc\");\n\n  if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n    window.pdfjsWorker = await import(\"pdfjs/core/worker.js\");\n    return;\n  }\n  await loadScript(PDFWorker.workerSrc);\n}\n\nasync function loadPDFBug(self) {\n  const { debuggerScriptPath } = self.appConfig;\n  const { PDFBug } =\n    typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n      ? await import(debuggerScriptPath) // eslint-disable-line no-unsanitized/method\n      : await import(debuggerScriptPath); // eslint-disable-line no-undef\n\n  self._PDFBug = PDFBug;\n}\n\nfunction reportPageStatsPDFBug({ pageNumber }) {\n  if (!globalThis.Stats?.enabled) {\n    return;\n  }\n  const pageView = PDFViewerApplication.pdfViewer.getPageView(\n    /* index = */ pageNumber - 1\n  );\n  globalThis.Stats.add(pageNumber, pageView?.pdfPage?.stats);\n}\n\nfunction webViewerInitialized() {\n  const { appConfig, eventBus } = PDFViewerApplication;\n  let file;\n  if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n    const queryString = document.location.search.substring(1);\n    const params = parseQueryString(queryString);\n    file = params.get(\"file\") ?? AppOptions.get(\"defaultUrl\");\n    validateFileURL(file);\n  } else if (PDFJSDev.test(\"MOZCENTRAL\")) {\n    file = window.location.href;\n  } else if (PDFJSDev.test(\"CHROME\")) {\n    file = AppOptions.get(\"defaultUrl\");\n  }\n\n  if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n    const fileInput = appConfig.openFileInput;\n    fileInput.value = null;\n\n    fileInput.addEventListener(\"change\", function (evt) {\n      const { files } = evt.target;\n      if (!files || files.length === 0) {\n        return;\n      }\n      eventBus.dispatch(\"fileinputchange\", {\n        source: this,\n        fileInput: evt.target,\n      });\n    });\n\n    // Enable dragging-and-dropping a new PDF file onto the viewerContainer.\n    appConfig.mainContainer.addEventListener(\"dragover\", function (evt) {\n      evt.preventDefault();\n\n      evt.dataTransfer.dropEffect =\n        evt.dataTransfer.effectAllowed === \"copy\" ? \"copy\" : \"move\";\n    });\n    appConfig.mainContainer.addEventListener(\"drop\", function (evt) {\n      evt.preventDefault();\n\n      const { files } = evt.dataTransfer;\n      if (!files || files.length === 0) {\n        return;\n      }\n      eventBus.dispatch(\"fileinputchange\", {\n        source: this,\n        fileInput: evt.dataTransfer,\n      });\n    });\n  }\n\n  if (!PDFViewerApplication.supportsDocumentFonts) {\n    AppOptions.set(\"disableFontFace\", true);\n    PDFViewerApplication.l10n.get(\"web_fonts_disabled\").then(msg => {\n      console.warn(msg);\n    });\n  }\n\n  if (!PDFViewerApplication.supportsPrinting) {\n    appConfig.toolbar.print.classList.add(\"hidden\");\n    appConfig.secondaryToolbar.printButton.classList.add(\"hidden\");\n  }\n\n  if (!PDFViewerApplication.supportsFullscreen) {\n    appConfig.secondaryToolbar.presentationModeButton.classList.add(\"hidden\");\n  }\n\n  if (PDFViewerApplication.supportsIntegratedFind) {\n    appConfig.toolbar.viewFind.classList.add(\"hidden\");\n  }\n\n  appConfig.mainContainer.addEventListener(\n    \"transitionend\",\n    function (evt) {\n      if (evt.target === /* mainContainer */ this) {\n        eventBus.dispatch(\"resize\", { source: this });\n      }\n    },\n    true\n  );\n\n  try {\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      if (file) {\n        PDFViewerApplication.open(file);\n      } else {\n        PDFViewerApplication._hideViewBookmark();\n      }\n    } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n      PDFViewerApplication.setTitleUsingUrl(file, /* downloadUrl = */ file);\n      PDFViewerApplication.initPassiveLoading();\n    } else {\n      throw new Error(\"Not implemented: webViewerInitialized\");\n    }\n  } catch (reason) {\n    PDFViewerApplication.l10n.get(\"loading_error\").then(msg => {\n      PDFViewerApplication._documentError(msg, reason);\n    });\n  }\n}\n\nfunction webViewerPageRendered({ pageNumber, error }) {\n  // If the page is still visible when it has finished rendering,\n  // ensure that the page number input loading indicator is hidden.\n  if (pageNumber === PDFViewerApplication.page) {\n    PDFViewerApplication.toolbar.updateLoadingIndicatorState(false);\n  }\n\n  // Use the rendered page to set the corresponding thumbnail image.\n  if (PDFViewerApplication.pdfSidebar.visibleView === SidebarView.THUMBS) {\n    const pageView = PDFViewerApplication.pdfViewer.getPageView(\n      /* index = */ pageNumber - 1\n    );\n    const thumbnailView = PDFViewerApplication.pdfThumbnailViewer.getThumbnail(\n      /* index = */ pageNumber - 1\n    );\n    if (pageView && thumbnailView) {\n      thumbnailView.setImage(pageView);\n    }\n  }\n\n  if (error) {\n    PDFViewerApplication.l10n.get(\"rendering_error\").then(msg => {\n      PDFViewerApplication._otherError(msg, error);\n    });\n  }\n\n  // It is a good time to report stream and font types.\n  PDFViewerApplication._reportDocumentStatsTelemetry();\n}\n\nfunction webViewerPageMode({ mode }) {\n  // Handle the 'pagemode' hash parameter, see also `PDFLinkService_setHash`.\n  let view;\n  switch (mode) {\n    case \"thumbs\":\n      view = SidebarView.THUMBS;\n      break;\n    case \"bookmarks\":\n    case \"outline\": // non-standard\n      view = SidebarView.OUTLINE;\n      break;\n    case \"attachments\": // non-standard\n      view = SidebarView.ATTACHMENTS;\n      break;\n    case \"layers\": // non-standard\n      view = SidebarView.LAYERS;\n      break;\n    case \"none\":\n      view = SidebarView.NONE;\n      break;\n    default:\n      console.error('Invalid \"pagemode\" hash parameter: ' + mode);\n      return;\n  }\n  PDFViewerApplication.pdfSidebar.switchView(view, /* forceOpen = */ true);\n}\n\nfunction webViewerNamedAction(evt) {\n  // Processing a couple of named actions that might be useful, see also\n  // `PDFLinkService.executeNamedAction`.\n  switch (evt.action) {\n    case \"GoToPage\":\n      PDFViewerApplication.appConfig.toolbar.pageNumber.select();\n      break;\n\n    case \"Find\":\n      if (!PDFViewerApplication.supportsIntegratedFind) {\n        PDFViewerApplication.findBar.toggle();\n      }\n      break;\n\n    case \"Print\":\n      PDFViewerApplication.triggerPrinting();\n      break;\n\n    case \"SaveAs\":\n      PDFViewerApplication.downloadOrSave();\n      break;\n  }\n}\n\nfunction webViewerPresentationModeChanged(evt) {\n  PDFViewerApplication.pdfViewer.presentationModeState = evt.state;\n}\n\nfunction webViewerSidebarViewChanged({ view }) {\n  PDFViewerApplication.pdfRenderingQueue.isThumbnailViewEnabled =\n    view === SidebarView.THUMBS;\n\n  if (PDFViewerApplication.isInitialViewSet) {\n    // Only update the storage when the document has been loaded *and* rendered.\n    PDFViewerApplication.store?.set(\"sidebarView\", view).catch(() => {\n      // Unable to write to storage.\n    });\n  }\n}\n\nfunction webViewerUpdateViewarea({ location }) {\n  if (PDFViewerApplication.isInitialViewSet) {\n    // Only update the storage when the document has been loaded *and* rendered.\n    PDFViewerApplication.store\n      ?.setMultiple({\n        page: location.pageNumber,\n        zoom: location.scale,\n        scrollLeft: location.left,\n        scrollTop: location.top,\n        rotation: location.rotation,\n      })\n      .catch(() => {\n        // Unable to write to storage.\n      });\n  }\n  const href = PDFViewerApplication.pdfLinkService.getAnchorUrl(\n    location.pdfOpenParams\n  );\n  PDFViewerApplication.appConfig.secondaryToolbar.viewBookmarkButton.href =\n    href;\n\n  // Show/hide the loading indicator in the page number input element.\n  const currentPage = PDFViewerApplication.pdfViewer.getPageView(\n    /* index = */ PDFViewerApplication.page - 1\n  );\n  const loading = currentPage?.renderingState !== RenderingStates.FINISHED;\n  PDFViewerApplication.toolbar.updateLoadingIndicatorState(loading);\n}\n\nfunction webViewerScrollModeChanged(evt) {\n  if (\n    PDFViewerApplication.isInitialViewSet &&\n    !PDFViewerApplication.pdfViewer.isInPresentationMode\n  ) {\n    // Only update the storage when the document has been loaded *and* rendered.\n    PDFViewerApplication.store?.set(\"scrollMode\", evt.mode).catch(() => {\n      // Unable to write to storage.\n    });\n  }\n}\n\nfunction webViewerSpreadModeChanged(evt) {\n  if (\n    PDFViewerApplication.isInitialViewSet &&\n    !PDFViewerApplication.pdfViewer.isInPresentationMode\n  ) {\n    // Only update the storage when the document has been loaded *and* rendered.\n    PDFViewerApplication.store?.set(\"spreadMode\", evt.mode).catch(() => {\n      // Unable to write to storage.\n    });\n  }\n}\n\nfunction webViewerResize() {\n  const { pdfDocument, pdfViewer, pdfRenderingQueue } = PDFViewerApplication;\n\n  if (pdfRenderingQueue.printing && window.matchMedia(\"print\").matches) {\n    // Work-around issue 15324 by ignoring \"resize\" events during printing.\n    return;\n  }\n  pdfViewer.updateContainerHeightCss();\n\n  if (!pdfDocument) {\n    return;\n  }\n  const currentScaleValue = pdfViewer.currentScaleValue;\n  if (\n    currentScaleValue === \"auto\" ||\n    currentScaleValue === \"page-fit\" ||\n    currentScaleValue === \"page-width\"\n  ) {\n    // Note: the scale is constant for 'page-actual'.\n    pdfViewer.currentScaleValue = currentScaleValue;\n  }\n  pdfViewer.update();\n}\n\nfunction webViewerHashchange(evt) {\n  const hash = evt.hash;\n  if (!hash) {\n    return;\n  }\n  if (!PDFViewerApplication.isInitialViewSet) {\n    PDFViewerApplication.initialBookmark = hash;\n  } else if (!PDFViewerApplication.pdfHistory?.popStateInProgress) {\n    PDFViewerApplication.pdfLinkService.setHash(hash);\n  }\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n  // eslint-disable-next-line no-var\n  var webViewerFileInputChange = function (evt) {\n    if (PDFViewerApplication.pdfViewer?.isInPresentationMode) {\n      return; // Opening a new PDF file isn't supported in Presentation Mode.\n    }\n    const file = evt.fileInput.files[0];\n\n    let url = URL.createObjectURL(file);\n    if (file.name) {\n      url = { url, originalUrl: file.name };\n    }\n    PDFViewerApplication.open(url);\n  };\n\n  // eslint-disable-next-line no-var\n  var webViewerOpenFile = function (evt) {\n    const fileInput = PDFViewerApplication.appConfig.openFileInput;\n    fileInput.click();\n  };\n}\n\nfunction webViewerPresentationMode() {\n  PDFViewerApplication.requestPresentationMode();\n}\nfunction webViewerSwitchAnnotationEditorMode(evt) {\n  PDFViewerApplication.pdfViewer.annotationEditorMode = evt.mode;\n}\nfunction webViewerSwitchAnnotationEditorParams(evt) {\n  PDFViewerApplication.pdfViewer.annotationEditorParams = evt;\n}\nfunction webViewerPrint() {\n  PDFViewerApplication.triggerPrinting();\n}\nfunction webViewerDownload() {\n  PDFViewerApplication.downloadOrSave();\n}\nfunction webViewerFirstPage() {\n  if (PDFViewerApplication.pdfDocument) {\n    PDFViewerApplication.page = 1;\n  }\n}\nfunction webViewerLastPage() {\n  if (PDFViewerApplication.pdfDocument) {\n    PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n  }\n}\nfunction webViewerNextPage() {\n  PDFViewerApplication.pdfViewer.nextPage();\n}\nfunction webViewerPreviousPage() {\n  PDFViewerApplication.pdfViewer.previousPage();\n}\nfunction webViewerZoomIn() {\n  PDFViewerApplication.zoomIn();\n}\nfunction webViewerZoomOut() {\n  PDFViewerApplication.zoomOut();\n}\nfunction webViewerZoomReset() {\n  PDFViewerApplication.zoomReset();\n}\nfunction webViewerPageNumberChanged(evt) {\n  const pdfViewer = PDFViewerApplication.pdfViewer;\n  // Note that for `<input type=\"number\">` HTML elements, an empty string will\n  // be returned for non-number inputs; hence we simply do nothing in that case.\n  if (evt.value !== \"\") {\n    PDFViewerApplication.pdfLinkService.goToPage(evt.value);\n  }\n\n  // Ensure that the page number input displays the correct value, even if the\n  // value entered by the user was invalid (e.g. a floating point number).\n  if (\n    evt.value !== pdfViewer.currentPageNumber.toString() &&\n    evt.value !== pdfViewer.currentPageLabel\n  ) {\n    PDFViewerApplication.toolbar.setPageNumber(\n      pdfViewer.currentPageNumber,\n      pdfViewer.currentPageLabel\n    );\n  }\n}\nfunction webViewerScaleChanged(evt) {\n  PDFViewerApplication.pdfViewer.currentScaleValue = evt.value;\n}\nfunction webViewerRotateCw() {\n  PDFViewerApplication.rotatePages(90);\n}\nfunction webViewerRotateCcw() {\n  PDFViewerApplication.rotatePages(-90);\n}\nfunction webViewerOptionalContentConfig(evt) {\n  PDFViewerApplication.pdfViewer.optionalContentConfigPromise = evt.promise;\n}\nfunction webViewerSwitchScrollMode(evt) {\n  PDFViewerApplication.pdfViewer.scrollMode = evt.mode;\n}\nfunction webViewerSwitchSpreadMode(evt) {\n  PDFViewerApplication.pdfViewer.spreadMode = evt.mode;\n}\nfunction webViewerDocumentProperties() {\n  PDFViewerApplication.pdfDocumentProperties.open();\n}\n\nfunction webViewerFindFromUrlHash(evt) {\n  PDFViewerApplication.eventBus.dispatch(\"find\", {\n    source: evt.source,\n    type: \"\",\n    query: evt.query,\n    phraseSearch: evt.phraseSearch,\n    caseSensitive: false,\n    entireWord: false,\n    highlightAll: true,\n    findPrevious: false,\n    matchDiacritics: true,\n  });\n}\n\nfunction webViewerUpdateFindMatchesCount({ matchesCount }) {\n  if (PDFViewerApplication.supportsIntegratedFind) {\n    PDFViewerApplication.externalServices.updateFindMatchesCount(matchesCount);\n  } else {\n    PDFViewerApplication.findBar.updateResultsCount(matchesCount);\n  }\n}\n\nfunction webViewerUpdateFindControlState({\n  state,\n  previous,\n  matchesCount,\n  rawQuery,\n}) {\n  if (PDFViewerApplication.supportsIntegratedFind) {\n    PDFViewerApplication.externalServices.updateFindControlState({\n      result: state,\n      findPrevious: previous,\n      matchesCount,\n      rawQuery,\n    });\n  } else {\n    PDFViewerApplication.findBar.updateUIState(state, previous, matchesCount);\n  }\n}\n\nfunction webViewerScaleChanging(evt) {\n  PDFViewerApplication.toolbar.setPageScale(evt.presetValue, evt.scale);\n\n  PDFViewerApplication.pdfViewer.update();\n}\n\nfunction webViewerRotationChanging(evt) {\n  PDFViewerApplication.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;\n\n  PDFViewerApplication.forceRendering();\n  // Ensure that the active page doesn't change during rotation.\n  PDFViewerApplication.pdfViewer.currentPageNumber = evt.pageNumber;\n}\n\nfunction webViewerPageChanging({ pageNumber, pageLabel }) {\n  PDFViewerApplication.toolbar.setPageNumber(pageNumber, pageLabel);\n  PDFViewerApplication.secondaryToolbar.setPageNumber(pageNumber);\n\n  if (PDFViewerApplication.pdfSidebar.visibleView === SidebarView.THUMBS) {\n    PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(pageNumber);\n  }\n}\n\nfunction webViewerResolutionChange(evt) {\n  PDFViewerApplication.pdfViewer.refresh();\n}\n\nfunction webViewerVisibilityChange(evt) {\n  if (document.visibilityState === \"visible\") {\n    // Ignore mouse wheel zooming during tab switches (bug 1503412).\n    setZoomDisabledTimeout();\n  }\n}\n\nlet zoomDisabledTimeout = null;\nfunction setZoomDisabledTimeout() {\n  if (zoomDisabledTimeout) {\n    clearTimeout(zoomDisabledTimeout);\n  }\n  zoomDisabledTimeout = setTimeout(function () {\n    zoomDisabledTimeout = null;\n  }, WHEEL_ZOOM_DISABLED_TIMEOUT);\n}\n\nfunction webViewerWheel(evt) {\n  const { pdfViewer, supportedMouseWheelZoomModifierKeys } =\n    PDFViewerApplication;\n\n  if (pdfViewer.isInPresentationMode) {\n    return;\n  }\n\n  if (\n    (evt.ctrlKey && supportedMouseWheelZoomModifierKeys.ctrlKey) ||\n    (evt.metaKey && supportedMouseWheelZoomModifierKeys.metaKey)\n  ) {\n    // Only zoom the pages, not the entire viewer.\n    evt.preventDefault();\n    // NOTE: this check must be placed *after* preventDefault.\n    if (zoomDisabledTimeout || document.visibilityState === \"hidden\") {\n      return;\n    }\n\n    // It is important that we query deltaMode before delta{X,Y}, so that\n    // Firefox doesn't switch to DOM_DELTA_PIXEL mode for compat with other\n    // browsers, see https://bugzilla.mozilla.org/show_bug.cgi?id=1392460.\n    const deltaMode = evt.deltaMode;\n    const delta = normalizeWheelEventDirection(evt);\n    const previousScale = pdfViewer.currentScale;\n\n    let ticks = 0;\n    if (\n      deltaMode === WheelEvent.DOM_DELTA_LINE ||\n      deltaMode === WheelEvent.DOM_DELTA_PAGE\n    ) {\n      // For line-based devices, use one tick per event, because different\n      // OSs have different defaults for the number lines. But we generally\n      // want one \"clicky\" roll of the wheel (which produces one event) to\n      // adjust the zoom by one step.\n      if (Math.abs(delta) >= 1) {\n        ticks = Math.sign(delta);\n      } else {\n        // If we're getting fractional lines (I can't think of a scenario\n        // this might actually happen), be safe and use the accumulator.\n        ticks = PDFViewerApplication.accumulateWheelTicks(delta);\n      }\n    } else {\n      // pixel-based devices\n      const PIXELS_PER_LINE_SCALE = 30;\n      ticks = PDFViewerApplication.accumulateWheelTicks(\n        delta / PIXELS_PER_LINE_SCALE\n      );\n    }\n\n    if (ticks < 0) {\n      PDFViewerApplication.zoomOut(-ticks);\n    } else if (ticks > 0) {\n      PDFViewerApplication.zoomIn(ticks);\n    }\n\n    const currentScale = pdfViewer.currentScale;\n    if (previousScale !== currentScale) {\n      // After scaling the page via zoomIn/zoomOut, the position of the upper-\n      // left corner is restored. When the mouse wheel is used, the position\n      // under the cursor should be restored instead.\n      const scaleCorrectionFactor = currentScale / previousScale - 1;\n      const rect = pdfViewer.container.getBoundingClientRect();\n      const dx = evt.clientX - rect.left;\n      const dy = evt.clientY - rect.top;\n      pdfViewer.container.scrollLeft += dx * scaleCorrectionFactor;\n      pdfViewer.container.scrollTop += dy * scaleCorrectionFactor;\n    }\n  } else {\n    setZoomDisabledTimeout();\n  }\n}\n\nfunction webViewerTouchStart(evt) {\n  if (evt.touches.length > 1) {\n    // Disable touch-based zooming, because the entire UI bits gets zoomed and\n    // that doesn't look great. If we do want to have a good touch-based\n    // zooming experience, we need to implement smooth zoom capability (probably\n    // using a CSS transform for faster visual response, followed by async\n    // re-rendering at the final zoom level) and do gesture detection on the\n    // touchmove events to drive it. Or if we want to settle for a less good\n    // experience we can make the touchmove events drive the existing step-zoom\n    // behaviour that the ctrl+mousewheel path takes.\n    evt.preventDefault();\n  }\n}\n\nfunction webViewerClick(evt) {\n  if (!PDFViewerApplication.secondaryToolbar.isOpen) {\n    return;\n  }\n  const appConfig = PDFViewerApplication.appConfig;\n  if (\n    PDFViewerApplication.pdfViewer.containsElement(evt.target) ||\n    (appConfig.toolbar.container.contains(evt.target) &&\n      evt.target !== appConfig.secondaryToolbar.toggleButton)\n  ) {\n    PDFViewerApplication.secondaryToolbar.close();\n  }\n}\n\nfunction webViewerKeyDown(evt) {\n  if (PDFViewerApplication.overlayManager.active) {\n    return;\n  }\n  const { eventBus, pdfViewer } = PDFViewerApplication;\n  const isViewerInPresentationMode = pdfViewer.isInPresentationMode;\n\n  let handled = false,\n    ensureViewerFocused = false;\n  const cmd =\n    (evt.ctrlKey ? 1 : 0) |\n    (evt.altKey ? 2 : 0) |\n    (evt.shiftKey ? 4 : 0) |\n    (evt.metaKey ? 8 : 0);\n\n  // First, handle the key bindings that are independent whether an input\n  // control is selected or not.\n  if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {\n    // either CTRL or META key with optional SHIFT.\n    switch (evt.keyCode) {\n      case 70: // f\n        if (!PDFViewerApplication.supportsIntegratedFind && !evt.shiftKey) {\n          PDFViewerApplication.findBar.open();\n          handled = true;\n        }\n        break;\n      case 71: // g\n        if (!PDFViewerApplication.supportsIntegratedFind) {\n          const { state } = PDFViewerApplication.findController;\n          if (state) {\n            const eventState = Object.assign(Object.create(null), state, {\n              source: window,\n              type: \"again\",\n              findPrevious: cmd === 5 || cmd === 12,\n            });\n            eventBus.dispatch(\"find\", eventState);\n          }\n          handled = true;\n        }\n        break;\n      case 61: // FF/Mac '='\n      case 107: // FF '+' and '='\n      case 187: // Chrome '+'\n      case 171: // FF with German keyboard\n        if (!isViewerInPresentationMode) {\n          PDFViewerApplication.zoomIn();\n        }\n        handled = true;\n        break;\n      case 173: // FF/Mac '-'\n      case 109: // FF '-'\n      case 189: // Chrome '-'\n        if (!isViewerInPresentationMode) {\n          PDFViewerApplication.zoomOut();\n        }\n        handled = true;\n        break;\n      case 48: // '0'\n      case 96: // '0' on Numpad of Swedish keyboard\n        if (!isViewerInPresentationMode) {\n          // keeping it unhandled (to restore page zoom to 100%)\n          setTimeout(function () {\n            // ... and resetting the scale after browser adjusts its scale\n            PDFViewerApplication.zoomReset();\n          });\n          handled = false;\n        }\n        break;\n\n      case 38: // up arrow\n        if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {\n          PDFViewerApplication.page = 1;\n          handled = true;\n          ensureViewerFocused = true;\n        }\n        break;\n      case 40: // down arrow\n        if (\n          isViewerInPresentationMode ||\n          PDFViewerApplication.page < PDFViewerApplication.pagesCount\n        ) {\n          PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n          handled = true;\n          ensureViewerFocused = true;\n        }\n        break;\n    }\n  }\n\n  if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC || CHROME\")) {\n    // CTRL or META without shift\n    if (cmd === 1 || cmd === 8) {\n      switch (evt.keyCode) {\n        case 83: // s\n          eventBus.dispatch(\"download\", { source: window });\n          handled = true;\n          break;\n\n        case 79: // o\n          if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n            eventBus.dispatch(\"openfile\", { source: window });\n            handled = true;\n          }\n          break;\n      }\n    }\n  }\n\n  // CTRL+ALT or Option+Command\n  if (cmd === 3 || cmd === 10) {\n    switch (evt.keyCode) {\n      case 80: // p\n        PDFViewerApplication.requestPresentationMode();\n        handled = true;\n        PDFViewerApplication.externalServices.reportTelemetry({\n          type: \"buttons\",\n          data: { id: \"presentationModeKeyboard\" },\n        });\n        break;\n      case 71: // g\n        // focuses input#pageNumber field\n        PDFViewerApplication.appConfig.toolbar.pageNumber.select();\n        handled = true;\n        break;\n    }\n  }\n\n  if (handled) {\n    if (ensureViewerFocused && !isViewerInPresentationMode) {\n      pdfViewer.focus();\n    }\n    evt.preventDefault();\n    return;\n  }\n\n  // Some shortcuts should not get handled if a control/input element\n  // is selected.\n  const curElement = getActiveOrFocusedElement();\n  const curElementTagName = curElement?.tagName.toUpperCase();\n  if (\n    curElementTagName === \"INPUT\" ||\n    curElementTagName === \"TEXTAREA\" ||\n    curElementTagName === \"SELECT\" ||\n    curElement?.isContentEditable\n  ) {\n    // Make sure that the secondary toolbar is closed when Escape is pressed.\n    if (evt.keyCode !== /* Esc = */ 27) {\n      return;\n    }\n  }\n\n  // No control key pressed at all.\n  if (cmd === 0) {\n    let turnPage = 0,\n      turnOnlyIfPageFit = false;\n    switch (evt.keyCode) {\n      case 38: // up arrow\n      case 33: // pg up\n        // vertical scrolling using arrow/pg keys\n        if (pdfViewer.isVerticalScrollbarEnabled) {\n          turnOnlyIfPageFit = true;\n        }\n        turnPage = -1;\n        break;\n      case 8: // backspace\n        if (!isViewerInPresentationMode) {\n          turnOnlyIfPageFit = true;\n        }\n        turnPage = -1;\n        break;\n      case 37: // left arrow\n        // horizontal scrolling using arrow keys\n        if (pdfViewer.isHorizontalScrollbarEnabled) {\n          turnOnlyIfPageFit = true;\n        }\n      /* falls through */\n      case 75: // 'k'\n      case 80: // 'p'\n        turnPage = -1;\n        break;\n      case 27: // esc key\n        if (PDFViewerApplication.secondaryToolbar.isOpen) {\n          PDFViewerApplication.secondaryToolbar.close();\n          handled = true;\n        }\n        if (\n          !PDFViewerApplication.supportsIntegratedFind &&\n          PDFViewerApplication.findBar.opened\n        ) {\n          PDFViewerApplication.findBar.close();\n          handled = true;\n        }\n        break;\n      case 40: // down arrow\n      case 34: // pg down\n        // vertical scrolling using arrow/pg keys\n        if (pdfViewer.isVerticalScrollbarEnabled) {\n          turnOnlyIfPageFit = true;\n        }\n        turnPage = 1;\n        break;\n      case 13: // enter key\n      case 32: // spacebar\n        if (!isViewerInPresentationMode) {\n          turnOnlyIfPageFit = true;\n        }\n        turnPage = 1;\n        break;\n      case 39: // right arrow\n        // horizontal scrolling using arrow keys\n        if (pdfViewer.isHorizontalScrollbarEnabled) {\n          turnOnlyIfPageFit = true;\n        }\n      /* falls through */\n      case 74: // 'j'\n      case 78: // 'n'\n        turnPage = 1;\n        break;\n\n      case 36: // home\n        if (isViewerInPresentationMode || PDFViewerApplication.page > 1) {\n          PDFViewerApplication.page = 1;\n          handled = true;\n          ensureViewerFocused = true;\n        }\n        break;\n      case 35: // end\n        if (\n          isViewerInPresentationMode ||\n          PDFViewerApplication.page < PDFViewerApplication.pagesCount\n        ) {\n          PDFViewerApplication.page = PDFViewerApplication.pagesCount;\n          handled = true;\n          ensureViewerFocused = true;\n        }\n        break;\n\n      case 83: // 's'\n        PDFViewerApplication.pdfCursorTools.switchTool(CursorTool.SELECT);\n        break;\n      case 72: // 'h'\n        PDFViewerApplication.pdfCursorTools.switchTool(CursorTool.HAND);\n        break;\n\n      case 82: // 'r'\n        PDFViewerApplication.rotatePages(90);\n        break;\n\n      case 115: // F4\n        PDFViewerApplication.pdfSidebar.toggle();\n        break;\n    }\n\n    if (\n      turnPage !== 0 &&\n      (!turnOnlyIfPageFit || pdfViewer.currentScaleValue === \"page-fit\")\n    ) {\n      if (turnPage > 0) {\n        pdfViewer.nextPage();\n      } else {\n        pdfViewer.previousPage();\n      }\n      handled = true;\n    }\n  }\n\n  // shift-key\n  if (cmd === 4) {\n    switch (evt.keyCode) {\n      case 13: // enter key\n      case 32: // spacebar\n        if (\n          !isViewerInPresentationMode &&\n          pdfViewer.currentScaleValue !== \"page-fit\"\n        ) {\n          break;\n        }\n        pdfViewer.previousPage();\n\n        handled = true;\n        break;\n\n      case 82: // 'r'\n        PDFViewerApplication.rotatePages(-90);\n        break;\n    }\n  }\n\n  if (!handled && !isViewerInPresentationMode) {\n    // 33=Page Up  34=Page Down  35=End    36=Home\n    // 37=Left     38=Up         39=Right  40=Down\n    // 32=Spacebar\n    if (\n      (evt.keyCode >= 33 && evt.keyCode <= 40) ||\n      (evt.keyCode === 32 && curElementTagName !== \"BUTTON\")\n    ) {\n      ensureViewerFocused = true;\n    }\n  }\n\n  if (ensureViewerFocused && !pdfViewer.containsElement(curElement)) {\n    // The page container is not focused, but a page navigation key has been\n    // pressed. Change the focus to the viewer container to make sure that\n    // navigation by keyboard works as expected.\n    pdfViewer.focus();\n  }\n\n  if (handled) {\n    evt.preventDefault();\n  }\n}\n\nfunction beforeUnload(evt) {\n  evt.preventDefault();\n  evt.returnValue = \"\";\n  return false;\n}\n\nfunction webViewerAnnotationEditorStatesChanged(data) {\n  PDFViewerApplication.externalServices.updateEditorStates(data);\n}\n\n/* Abstract factory for the print service. */\nconst PDFPrintServiceFactory = {\n  instance: {\n    supportsPrinting: false,\n    createPrintService() {\n      throw new Error(\"Not implemented: createPrintService\");\n    },\n  },\n};\n\nexport {\n  DefaultExternalServices,\n  PDFPrintServiceFactory,\n  PDFViewerApplication,\n};\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/* globals module, __non_webpack_require__ */\n\n\"use strict\";\n\nlet pdfjsLib;\nif (typeof window !== \"undefined\" && window[\"pdfjs-dist/build/pdf\"]) {\n  pdfjsLib = window[\"pdfjs-dist/build/pdf\"];\n} else {\n  pdfjsLib = __non_webpack_require__(\"../build/pdf.js\");\n}\nmodule.exports = pdfjsLib;\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst WaitOnType = {\n  EVENT: \"event\",\n  TIMEOUT: \"timeout\",\n};\n\n/**\n * @typedef {Object} WaitOnEventOrTimeoutParameters\n * @property {Object} target - The event target, can for example be:\n *   `window`, `document`, a DOM element, or an {EventBus} instance.\n * @property {string} name - The name of the event.\n * @property {number} delay - The delay, in milliseconds, after which the\n *   timeout occurs (if the event wasn't already dispatched).\n */\n\n/**\n * Allows waiting for an event or a timeout, whichever occurs first.\n * Can be used to ensure that an action always occurs, even when an event\n * arrives late or not at all.\n *\n * @param {WaitOnEventOrTimeoutParameters}\n * @returns {Promise} A promise that is resolved with a {WaitOnType} value.\n */\nfunction waitOnEventOrTimeout({ target, name, delay = 0 }) {\n  return new Promise(function (resolve, reject) {\n    if (\n      typeof target !== \"object\" ||\n      !(name && typeof name === \"string\") ||\n      !(Number.isInteger(delay) && delay >= 0)\n    ) {\n      throw new Error(\"waitOnEventOrTimeout - invalid parameters.\");\n    }\n\n    function handler(type) {\n      if (target instanceof EventBus) {\n        target._off(name, eventHandler);\n      } else {\n        target.removeEventListener(name, eventHandler);\n      }\n\n      if (timeout) {\n        clearTimeout(timeout);\n      }\n      resolve(type);\n    }\n\n    const eventHandler = handler.bind(null, WaitOnType.EVENT);\n    if (target instanceof EventBus) {\n      target._on(name, eventHandler);\n    } else {\n      target.addEventListener(name, eventHandler);\n    }\n\n    const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);\n    const timeout = setTimeout(timeoutHandler, delay);\n  });\n}\n\n/**\n * Simple event bus for an application. Listeners are attached using the `on`\n * and `off` methods. To raise an event, the `dispatch` method shall be used.\n */\nclass EventBus {\n  #listeners = Object.create(null);\n\n  /**\n   * @param {string} eventName\n   * @param {function} listener\n   * @param {Object} [options]\n   */\n  on(eventName, listener, options = null) {\n    this._on(eventName, listener, {\n      external: true,\n      once: options?.once,\n    });\n  }\n\n  /**\n   * @param {string} eventName\n   * @param {function} listener\n   * @param {Object} [options]\n   */\n  off(eventName, listener, options = null) {\n    this._off(eventName, listener, {\n      external: true,\n      once: options?.once,\n    });\n  }\n\n  /**\n   * @param {string} eventName\n   * @param {Object} data\n   */\n  dispatch(eventName, data) {\n    const eventListeners = this.#listeners[eventName];\n    if (!eventListeners || eventListeners.length === 0) {\n      return;\n    }\n    let externalListeners;\n    // Making copy of the listeners array in case if it will be modified\n    // during dispatch.\n    for (const { listener, external, once } of eventListeners.slice(0)) {\n      if (once) {\n        this._off(eventName, listener);\n      }\n      if (external) {\n        (externalListeners ||= []).push(listener);\n        continue;\n      }\n      listener(data);\n    }\n    // Dispatch any \"external\" listeners *after* the internal ones, to give the\n    // viewer components time to handle events and update their state first.\n    if (externalListeners) {\n      for (const listener of externalListeners) {\n        listener(data);\n      }\n      externalListeners = null;\n    }\n  }\n\n  /**\n   * @ignore\n   */\n  _on(eventName, listener, options = null) {\n    const eventListeners = (this.#listeners[eventName] ||= []);\n    eventListeners.push({\n      listener,\n      external: options?.external === true,\n      once: options?.once === true,\n    });\n  }\n\n  /**\n   * @ignore\n   */\n  _off(eventName, listener, options = null) {\n    const eventListeners = this.#listeners[eventName];\n    if (!eventListeners) {\n      return;\n    }\n    for (let i = 0, ii = eventListeners.length; i < ii; i++) {\n      if (eventListeners[i].listener === listener) {\n        eventListeners.splice(i, 1);\n        return;\n      }\n    }\n  }\n}\n\n/**\n * NOTE: Only used to support various PDF viewer tests in `mozilla-central`.\n */\nclass AutomationEventBus extends EventBus {\n  dispatch(eventName, data) {\n    if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n      throw new Error(\"Not implemented: AutomationEventBus.dispatch\");\n    }\n    super.dispatch(eventName, data);\n\n    const details = Object.create(null);\n    if (data) {\n      for (const key in data) {\n        const value = data[key];\n        if (key === \"source\") {\n          if (value === window || value === document) {\n            return; // No need to re-dispatch (already) global events.\n          }\n          continue; // Ignore the `source` property.\n        }\n        details[key] = value;\n      }\n    }\n    const event = document.createEvent(\"CustomEvent\");\n    event.initCustomEvent(eventName, true, true, details);\n    document.dispatchEvent(event);\n  }\n}\n\nexport { AutomationEventBus, EventBus, waitOnEventOrTimeout, WaitOnType };\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\nimport { AnnotationEditorType } from \"pdfjs-lib\";\nimport { GrabToPan } from \"./grab_to_pan.js\";\nimport { PresentationModeState } from \"./ui_utils.js\";\n\nconst CursorTool = {\n  SELECT: 0, // The default value.\n  HAND: 1,\n  ZOOM: 2,\n};\n\n/**\n * @typedef {Object} PDFCursorToolsOptions\n * @property {HTMLDivElement} container - The document container.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [cursorToolOnLoad] - The cursor tool that will be enabled\n *   on load; the constants from {CursorTool} should be used. The default value\n *   is `CursorTool.SELECT`.\n */\n\nclass PDFCursorTools {\n  /**\n   * @param {PDFCursorToolsOptions} options\n   */\n  constructor({ container, eventBus, cursorToolOnLoad = CursorTool.SELECT }) {\n    this.container = container;\n    this.eventBus = eventBus;\n\n    this.active = CursorTool.SELECT;\n    this.previouslyActive = null;\n\n    this.handTool = new GrabToPan({\n      element: this.container,\n    });\n\n    this.#addEventListeners();\n\n    // Defer the initial `switchTool` call, to give other viewer components\n    // time to initialize *and* register 'cursortoolchanged' event listeners.\n    Promise.resolve().then(() => {\n      this.switchTool(cursorToolOnLoad);\n    });\n  }\n\n  /**\n   * @type {number} One of the values in {CursorTool}.\n   */\n  get activeTool() {\n    return this.active;\n  }\n\n  /**\n   * @param {number} tool - The cursor mode that should be switched to,\n   *                        must be one of the values in {CursorTool}.\n   */\n  switchTool(tool) {\n    if (this.previouslyActive !== null) {\n      // Cursor tools cannot be used in PresentationMode/AnnotationEditor.\n      return;\n    }\n    if (tool === this.active) {\n      return; // The requested tool is already active.\n    }\n\n    const disableActiveTool = () => {\n      switch (this.active) {\n        case CursorTool.SELECT:\n          break;\n        case CursorTool.HAND:\n          this.handTool.deactivate();\n          break;\n        case CursorTool.ZOOM:\n        /* falls through */\n      }\n    };\n\n    // Enable the new cursor tool.\n    switch (tool) {\n      case CursorTool.SELECT:\n        disableActiveTool();\n        break;\n      case CursorTool.HAND:\n        disableActiveTool();\n        this.handTool.activate();\n        break;\n      case CursorTool.ZOOM:\n      /* falls through */\n      default:\n        console.error(`switchTool: \"${tool}\" is an unsupported value.`);\n        return;\n    }\n    // Update the active tool *after* it has been validated above,\n    // in order to prevent setting it to an invalid state.\n    this.active = tool;\n\n    this.#dispatchEvent();\n  }\n\n  #dispatchEvent() {\n    this.eventBus.dispatch(\"cursortoolchanged\", {\n      source: this,\n      tool: this.active,\n    });\n  }\n\n  #addEventListeners() {\n    this.eventBus._on(\"switchcursortool\", evt => {\n      this.switchTool(evt.tool);\n    });\n\n    let annotationEditorMode = AnnotationEditorType.NONE,\n      presentationModeState = PresentationModeState.NORMAL;\n\n    const disableActive = () => {\n      const previouslyActive = this.active;\n\n      this.switchTool(CursorTool.SELECT);\n      this.previouslyActive ??= previouslyActive; // Keep track of the first one.\n    };\n    const enableActive = () => {\n      const previouslyActive = this.previouslyActive;\n\n      if (\n        previouslyActive !== null &&\n        annotationEditorMode === AnnotationEditorType.NONE &&\n        presentationModeState === PresentationModeState.NORMAL\n      ) {\n        this.previouslyActive = null;\n        this.switchTool(previouslyActive);\n      }\n    };\n\n    this.eventBus._on(\"secondarytoolbarreset\", evt => {\n      if (this.previouslyActive !== null) {\n        annotationEditorMode = AnnotationEditorType.NONE;\n        presentationModeState = PresentationModeState.NORMAL;\n\n        enableActive();\n      }\n    });\n\n    this.eventBus._on(\"annotationeditormodechanged\", ({ mode }) => {\n      annotationEditorMode = mode;\n\n      if (mode === AnnotationEditorType.NONE) {\n        enableActive();\n      } else {\n        disableActive();\n      }\n    });\n\n    this.eventBus._on(\"presentationmodechanged\", ({ state }) => {\n      presentationModeState = state;\n\n      if (state === PresentationModeState.NORMAL) {\n        enableActive();\n      } else if (state === PresentationModeState.FULLSCREEN) {\n        disableActive();\n      }\n    });\n  }\n}\n\nexport { CursorTool, PDFCursorTools };\n","/* Copyright 2013 Rob Wu <rob@robwu.nl>\n * https://github.com/Rob--W/grab-to-pan.js\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// Class name of element which can be grabbed.\nconst CSS_CLASS_GRAB = \"grab-to-pan-grab\";\n\nclass GrabToPan {\n  /**\n   * Construct a GrabToPan instance for a given HTML element.\n   * @param {Element} options.element\n   * @param {function} [options.ignoreTarget] - See `ignoreTarget(node)`.\n   * @param {function(boolean)} [options.onActiveChanged] - Called when\n   *   grab-to-pan is (de)activated. The first argument is a boolean that\n   *   shows whether grab-to-pan is activated.\n   */\n  constructor(options) {\n    this.element = options.element;\n    this.document = options.element.ownerDocument;\n    if (typeof options.ignoreTarget === \"function\") {\n      this.ignoreTarget = options.ignoreTarget;\n    }\n    this.onActiveChanged = options.onActiveChanged;\n\n    // Bind the contexts to ensure that `this` always points to\n    // the GrabToPan instance.\n    this.activate = this.activate.bind(this);\n    this.deactivate = this.deactivate.bind(this);\n    this.toggle = this.toggle.bind(this);\n    this._onMouseDown = this.#onMouseDown.bind(this);\n    this._onMouseMove = this.#onMouseMove.bind(this);\n    this._endPan = this.#endPan.bind(this);\n\n    // This overlay will be inserted in the document when the mouse moves during\n    // a grab operation, to ensure that the cursor has the desired appearance.\n    const overlay = (this.overlay = document.createElement(\"div\"));\n    overlay.className = \"grab-to-pan-grabbing\";\n  }\n\n  /**\n   * Bind a mousedown event to the element to enable grab-detection.\n   */\n  activate() {\n    if (!this.active) {\n      this.active = true;\n      this.element.addEventListener(\"mousedown\", this._onMouseDown, true);\n      this.element.classList.add(CSS_CLASS_GRAB);\n\n      this.onActiveChanged?.(true);\n    }\n  }\n\n  /**\n   * Removes all events. Any pending pan session is immediately stopped.\n   */\n  deactivate() {\n    if (this.active) {\n      this.active = false;\n      this.element.removeEventListener(\"mousedown\", this._onMouseDown, true);\n      this._endPan();\n      this.element.classList.remove(CSS_CLASS_GRAB);\n\n      this.onActiveChanged?.(false);\n    }\n  }\n\n  toggle() {\n    if (this.active) {\n      this.deactivate();\n    } else {\n      this.activate();\n    }\n  }\n\n  /**\n   * Whether to not pan if the target element is clicked.\n   * Override this method to change the default behaviour.\n   *\n   * @param {Element} node - The target of the event.\n   * @returns {boolean} Whether to not react to the click event.\n   */\n  ignoreTarget(node) {\n    // Check whether the clicked element is, a child of, an input element/link.\n    return node.matches(\n      \"a[href], a[href] *, input, textarea, button, button *, select, option\"\n    );\n  }\n\n  #onMouseDown(event) {\n    if (event.button !== 0 || this.ignoreTarget(event.target)) {\n      return;\n    }\n    if (event.originalTarget) {\n      try {\n        // eslint-disable-next-line no-unused-expressions\n        event.originalTarget.tagName;\n      } catch (e) {\n        // Mozilla-specific: element is a scrollbar (XUL element)\n        return;\n      }\n    }\n\n    this.scrollLeftStart = this.element.scrollLeft;\n    this.scrollTopStart = this.element.scrollTop;\n    this.clientXStart = event.clientX;\n    this.clientYStart = event.clientY;\n    this.document.addEventListener(\"mousemove\", this._onMouseMove, true);\n    this.document.addEventListener(\"mouseup\", this._endPan, true);\n    // When a scroll event occurs before a mousemove, assume that the user\n    // dragged a scrollbar (necessary for Opera Presto, Safari and IE)\n    // (not needed for Chrome/Firefox)\n    this.element.addEventListener(\"scroll\", this._endPan, true);\n    event.preventDefault();\n    event.stopPropagation();\n\n    const focusedElement = document.activeElement;\n    if (focusedElement && !focusedElement.contains(event.target)) {\n      focusedElement.blur();\n    }\n  }\n\n  #onMouseMove(event) {\n    this.element.removeEventListener(\"scroll\", this._endPan, true);\n    if (!(event.buttons & 1)) {\n      // The left mouse button is released.\n      this._endPan();\n      return;\n    }\n    const xDiff = event.clientX - this.clientXStart;\n    const yDiff = event.clientY - this.clientYStart;\n    const scrollTop = this.scrollTopStart - yDiff;\n    const scrollLeft = this.scrollLeftStart - xDiff;\n    if (this.element.scrollTo) {\n      this.element.scrollTo({\n        top: scrollTop,\n        left: scrollLeft,\n        behavior: \"instant\",\n      });\n    } else {\n      this.element.scrollTop = scrollTop;\n      this.element.scrollLeft = scrollLeft;\n    }\n    if (!this.overlay.parentNode) {\n      document.body.append(this.overlay);\n    }\n  }\n\n  #endPan() {\n    this.element.removeEventListener(\"scroll\", this._endPan, true);\n    this.document.removeEventListener(\"mousemove\", this._onMouseMove, true);\n    this.document.removeEventListener(\"mouseup\", this._endPan, true);\n    // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n    this.overlay.remove();\n  }\n}\n\nexport { GrabToPan };\n","/* Copyright 2022 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 { AnnotationEditorParamsType } from \"pdfjs-lib\";\n\nclass AnnotationEditorParams {\n  /**\n   * @param {AnnotationEditorParamsOptions} options\n   * @param {EventBus} eventBus\n   */\n  constructor(options, eventBus) {\n    this.eventBus = eventBus;\n    this.#bindListeners(options);\n  }\n\n  #bindListeners({\n    editorFreeTextFontSize,\n    editorFreeTextColor,\n    editorInkColor,\n    editorInkThickness,\n    editorInkOpacity,\n  }) {\n    editorFreeTextFontSize.addEventListener(\"input\", evt => {\n      this.eventBus.dispatch(\"switchannotationeditorparams\", {\n        source: this,\n        type: AnnotationEditorParamsType.FREETEXT_SIZE,\n        value: editorFreeTextFontSize.valueAsNumber,\n      });\n    });\n    editorFreeTextColor.addEventListener(\"input\", evt => {\n      this.eventBus.dispatch(\"switchannotationeditorparams\", {\n        source: this,\n        type: AnnotationEditorParamsType.FREETEXT_COLOR,\n        value: editorFreeTextColor.value,\n      });\n    });\n    editorInkColor.addEventListener(\"input\", evt => {\n      this.eventBus.dispatch(\"switchannotationeditorparams\", {\n        source: this,\n        type: AnnotationEditorParamsType.INK_COLOR,\n        value: editorInkColor.value,\n      });\n    });\n    editorInkThickness.addEventListener(\"input\", evt => {\n      this.eventBus.dispatch(\"switchannotationeditorparams\", {\n        source: this,\n        type: AnnotationEditorParamsType.INK_THICKNESS,\n        value: editorInkThickness.valueAsNumber,\n      });\n    });\n    editorInkOpacity.addEventListener(\"input\", evt => {\n      this.eventBus.dispatch(\"switchannotationeditorparams\", {\n        source: this,\n        type: AnnotationEditorParamsType.INK_OPACITY,\n        value: editorInkOpacity.valueAsNumber,\n      });\n    });\n\n    this.eventBus._on(\"annotationeditorparamschanged\", evt => {\n      for (const [type, value] of evt.details) {\n        switch (type) {\n          case AnnotationEditorParamsType.FREETEXT_SIZE:\n            editorFreeTextFontSize.value = value;\n            break;\n          case AnnotationEditorParamsType.FREETEXT_COLOR:\n            editorFreeTextColor.value = value;\n            break;\n          case AnnotationEditorParamsType.INK_COLOR:\n            editorInkColor.value = value;\n            break;\n          case AnnotationEditorParamsType.INK_THICKNESS:\n            editorInkThickness.value = value;\n            break;\n          case AnnotationEditorParamsType.INK_OPACITY:\n            editorInkOpacity.value = value;\n            break;\n        }\n      }\n    });\n  }\n}\n\nexport { AnnotationEditorParams };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nclass OverlayManager {\n  #overlays = new WeakMap();\n\n  #active = null;\n\n  get active() {\n    return this.#active;\n  }\n\n  /**\n   * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n   * @param {boolean} [canForceClose] - Indicates if opening the overlay closes\n   *                  an active overlay. The default is `false`.\n   * @returns {Promise} A promise that is resolved when the overlay has been\n   *                    registered.\n   */\n  async register(dialog, canForceClose = false) {\n    if (typeof dialog !== \"object\") {\n      throw new Error(\"Not enough parameters.\");\n    } else if (this.#overlays.has(dialog)) {\n      throw new Error(\"The overlay is already registered.\");\n    }\n    this.#overlays.set(dialog, { canForceClose });\n\n    if (\n      typeof PDFJSDev !== \"undefined\" &&\n      PDFJSDev.test(\"GENERIC && !SKIP_BABEL\") &&\n      !dialog.showModal\n    ) {\n      const dialogPolyfill = require(\"dialog-polyfill/dist/dialog-polyfill.js\");\n      dialogPolyfill.registerDialog(dialog);\n\n      if (!this._dialogPolyfillCSS) {\n        this._dialogPolyfillCSS = true;\n\n        const style = document.createElement(\"style\");\n        style.textContent = PDFJSDev.eval(\"DIALOG_POLYFILL_CSS\");\n\n        document.head.prepend(style);\n      }\n    }\n\n    dialog.addEventListener(\"cancel\", evt => {\n      this.#active = null;\n    });\n  }\n\n  /**\n   * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n   * @returns {Promise} A promise that is resolved when the overlay has been\n   *                    unregistered.\n   */\n  async unregister(dialog) {\n    if (!this.#overlays.has(dialog)) {\n      throw new Error(\"The overlay does not exist.\");\n    } else if (this.#active === dialog) {\n      throw new Error(\"The overlay cannot be removed while it is active.\");\n    }\n    this.#overlays.delete(dialog);\n  }\n\n  /**\n   * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n   * @returns {Promise} A promise that is resolved when the overlay has been\n   *                    opened.\n   */\n  async open(dialog) {\n    if (!this.#overlays.has(dialog)) {\n      throw new Error(\"The overlay does not exist.\");\n    } else if (this.#active) {\n      if (this.#active === dialog) {\n        throw new Error(\"The overlay is already active.\");\n      } else if (this.#overlays.get(dialog).canForceClose) {\n        await this.close();\n      } else {\n        throw new Error(\"Another overlay is currently active.\");\n      }\n    }\n    this.#active = dialog;\n    dialog.showModal();\n  }\n\n  /**\n   * @param {HTMLDialogElement} dialog - The overlay's DOM element.\n   * @returns {Promise} A promise that is resolved when the overlay has been\n   *                    closed.\n   */\n  async close(dialog = this.#active) {\n    if (!this.#overlays.has(dialog)) {\n      throw new Error(\"The overlay does not exist.\");\n    } else if (!this.#active) {\n      throw new Error(\"The overlay is currently not active.\");\n    } else if (this.#active !== dialog) {\n      throw new Error(\"Another overlay is currently active.\");\n    }\n    dialog.close();\n    this.#active = null;\n  }\n}\n\nexport { OverlayManager };\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 { createPromiseCapability, PasswordResponses } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} PasswordPromptOptions\n * @property {HTMLDialogElement} dialog - The overlay's DOM element.\n * @property {HTMLParagraphElement} label - Label containing instructions for\n *                                          entering the password.\n * @property {HTMLInputElement} input - Input field for entering the password.\n * @property {HTMLButtonElement} submitButton - Button for submitting the\n *                                              password.\n * @property {HTMLButtonElement} cancelButton - Button for cancelling password\n *                                              entry.\n */\n\nclass PasswordPrompt {\n  #activeCapability = null;\n\n  #updateCallback = null;\n\n  #reason = null;\n\n  /**\n   * @param {PasswordPromptOptions} options\n   * @param {OverlayManager} overlayManager - Manager for the viewer overlays.\n   * @param {IL10n} l10n - Localization service.\n   * @param {boolean} [isViewerEmbedded] - If the viewer is embedded, in e.g.\n   *   an <iframe> or an <object>. The default value is `false`.\n   */\n  constructor(options, overlayManager, l10n, isViewerEmbedded = false) {\n    this.dialog = options.dialog;\n    this.label = options.label;\n    this.input = options.input;\n    this.submitButton = options.submitButton;\n    this.cancelButton = options.cancelButton;\n    this.overlayManager = overlayManager;\n    this.l10n = l10n;\n    this._isViewerEmbedded = isViewerEmbedded;\n\n    // Attach the event listeners.\n    this.submitButton.addEventListener(\"click\", this.#verify.bind(this));\n    this.cancelButton.addEventListener(\"click\", this.close.bind(this));\n    this.input.addEventListener(\"keydown\", e => {\n      if (e.keyCode === /* Enter = */ 13) {\n        this.#verify();\n      }\n    });\n\n    this.overlayManager.register(this.dialog, /* canForceClose = */ true);\n\n    this.dialog.addEventListener(\"close\", this.#cancel.bind(this));\n  }\n\n  async open() {\n    if (this.#activeCapability) {\n      await this.#activeCapability.promise;\n    }\n    this.#activeCapability = createPromiseCapability();\n\n    try {\n      await this.overlayManager.open(this.dialog);\n    } catch (ex) {\n      this.#activeCapability = null;\n      throw ex;\n    }\n\n    const passwordIncorrect =\n      this.#reason === PasswordResponses.INCORRECT_PASSWORD;\n\n    if (!this._isViewerEmbedded || passwordIncorrect) {\n      this.input.focus();\n    }\n    this.label.textContent = await this.l10n.get(\n      `password_${passwordIncorrect ? \"invalid\" : \"label\"}`\n    );\n  }\n\n  async close() {\n    if (this.overlayManager.active === this.dialog) {\n      this.overlayManager.close(this.dialog);\n    }\n  }\n\n  #verify() {\n    const password = this.input.value;\n    if (password?.length > 0) {\n      this.#invokeCallback(password);\n    }\n  }\n\n  #cancel() {\n    this.#invokeCallback(new Error(\"PasswordPrompt cancelled.\"));\n    this.#activeCapability.resolve();\n  }\n\n  #invokeCallback(password) {\n    if (!this.#updateCallback) {\n      return; // Ensure that the callback is only invoked once.\n    }\n    this.close();\n    this.input.value = \"\";\n\n    this.#updateCallback(password);\n    this.#updateCallback = null;\n  }\n\n  async setUpdateCallback(updateCallback, reason) {\n    if (this.#activeCapability) {\n      await this.#activeCapability.promise;\n    }\n    this.#updateCallback = updateCallback;\n    this.#reason = reason;\n  }\n}\n\nexport { PasswordPrompt };\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 { createPromiseCapability, getFilenameFromUrl } from \"pdfjs-lib\";\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n/**\n * @typedef {Object} PDFAttachmentViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {DownloadManager} downloadManager - The download manager.\n */\n\n/**\n * @typedef {Object} PDFAttachmentViewerRenderParameters\n * @property {Object|null} attachments - A lookup table of attachment objects.\n */\n\nclass PDFAttachmentViewer extends BaseTreeViewer {\n  /**\n   * @param {PDFAttachmentViewerOptions} options\n   */\n  constructor(options) {\n    super(options);\n    this.downloadManager = options.downloadManager;\n\n    this.eventBus._on(\n      \"fileattachmentannotation\",\n      this.#appendAttachment.bind(this)\n    );\n  }\n\n  reset(keepRenderedCapability = false) {\n    super.reset();\n    this._attachments = null;\n\n    if (!keepRenderedCapability) {\n      // The only situation in which the `_renderedCapability` should *not* be\n      // replaced is when appending FileAttachment annotations.\n      this._renderedCapability = createPromiseCapability();\n    }\n    this._pendingDispatchEvent = false;\n  }\n\n  /**\n   * @private\n   */\n  async _dispatchEvent(attachmentsCount) {\n    this._renderedCapability.resolve();\n\n    if (attachmentsCount === 0 && !this._pendingDispatchEvent) {\n      // Delay the event when no \"regular\" attachments exist, to allow time for\n      // parsing of any FileAttachment annotations that may be present on the\n      // *initially* rendered page; this reduces the likelihood of temporarily\n      // disabling the attachmentsView when the `PDFSidebar` handles the event.\n      this._pendingDispatchEvent = true;\n\n      await waitOnEventOrTimeout({\n        target: this.eventBus,\n        name: \"annotationlayerrendered\",\n        delay: 1000,\n      });\n\n      if (!this._pendingDispatchEvent) {\n        return; // There was already another `_dispatchEvent`-call`.\n      }\n    }\n    this._pendingDispatchEvent = false;\n\n    this.eventBus.dispatch(\"attachmentsloaded\", {\n      source: this,\n      attachmentsCount,\n    });\n  }\n\n  /**\n   * @private\n   */\n  _bindLink(element, { content, filename }) {\n    element.onclick = () => {\n      this.downloadManager.openOrDownloadData(element, content, filename);\n      return false;\n    };\n  }\n\n  /**\n   * @param {PDFAttachmentViewerRenderParameters} params\n   */\n  render({ attachments, keepRenderedCapability = false }) {\n    if (this._attachments) {\n      this.reset(keepRenderedCapability);\n    }\n    this._attachments = attachments || null;\n\n    if (!attachments) {\n      this._dispatchEvent(/* attachmentsCount = */ 0);\n      return;\n    }\n    const names = Object.keys(attachments).sort(function (a, b) {\n      return a.toLowerCase().localeCompare(b.toLowerCase());\n    });\n\n    const fragment = document.createDocumentFragment();\n    let attachmentsCount = 0;\n    for (const name of names) {\n      const item = attachments[name];\n      const content = item.content,\n        filename = getFilenameFromUrl(\n          item.filename,\n          /* onlyStripPath = */ true\n        );\n\n      const div = document.createElement(\"div\");\n      div.className = \"treeItem\";\n\n      const element = document.createElement(\"a\");\n      this._bindLink(element, { content, filename });\n      element.textContent = this._normalizeTextContent(filename);\n\n      div.append(element);\n\n      fragment.append(div);\n      attachmentsCount++;\n    }\n\n    this._finishRendering(fragment, attachmentsCount);\n  }\n\n  /**\n   * Used to append FileAttachment annotations to the sidebar.\n   */\n  #appendAttachment({ filename, content }) {\n    const renderedPromise = this._renderedCapability.promise;\n\n    renderedPromise.then(() => {\n      if (renderedPromise !== this._renderedCapability.promise) {\n        return; // The FileAttachment annotation belongs to a previous document.\n      }\n      const attachments = this._attachments || Object.create(null);\n\n      for (const name in attachments) {\n        if (filename === name) {\n          return; // Ignore the new attachment if it already exists.\n        }\n      }\n      attachments[filename] = {\n        filename,\n        content,\n      };\n      this.render({\n        attachments,\n        keepRenderedCapability: true,\n      });\n    });\n  }\n}\n\nexport { PDFAttachmentViewer };\n","/* Copyright 2020 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 { removeNullCharacters } from \"./ui_utils.js\";\n\nconst TREEITEM_OFFSET_TOP = -100; // px\nconst TREEITEM_SELECTED_CLASS = \"selected\";\n\nclass BaseTreeViewer {\n  constructor(options) {\n    if (this.constructor === BaseTreeViewer) {\n      throw new Error(\"Cannot initialize BaseTreeViewer.\");\n    }\n    this.container = options.container;\n    this.eventBus = options.eventBus;\n\n    this.reset();\n  }\n\n  reset() {\n    this._pdfDocument = null;\n    this._lastToggleIsShow = true;\n    this._currentTreeItem = null;\n\n    // Remove the tree from the DOM.\n    this.container.textContent = \"\";\n    // Ensure that the left (right in RTL locales) margin is always reset,\n    // to prevent incorrect tree alignment if a new document is opened.\n    this.container.classList.remove(\"treeWithDeepNesting\");\n  }\n\n  /**\n   * @private\n   */\n  _dispatchEvent(count) {\n    throw new Error(\"Not implemented: _dispatchEvent\");\n  }\n\n  /**\n   * @private\n   */\n  _bindLink(element, params) {\n    throw new Error(\"Not implemented: _bindLink\");\n  }\n\n  /**\n   * @private\n   */\n  _normalizeTextContent(str) {\n    // Chars in range [0x01-0x1F] will be replaced with a white space\n    // and 0x00 by \"\".\n    return (\n      removeNullCharacters(str, /* replaceInvisible */ true) ||\n      /* en dash = */ \"\\u2013\"\n    );\n  }\n\n  /**\n   * Prepend a button before a tree item which allows the user to collapse or\n   * expand all tree items at that level; see `_toggleTreeItem`.\n   * @private\n   */\n  _addToggleButton(div, hidden = false) {\n    const toggler = document.createElement(\"div\");\n    toggler.className = \"treeItemToggler\";\n    if (hidden) {\n      toggler.classList.add(\"treeItemsHidden\");\n    }\n    toggler.onclick = evt => {\n      evt.stopPropagation();\n      toggler.classList.toggle(\"treeItemsHidden\");\n\n      if (evt.shiftKey) {\n        const shouldShowAll = !toggler.classList.contains(\"treeItemsHidden\");\n        this._toggleTreeItem(div, shouldShowAll);\n      }\n    };\n    div.prepend(toggler);\n  }\n\n  /**\n   * Collapse or expand the subtree of a tree item.\n   *\n   * @param {Element} root - the root of the item (sub)tree.\n   * @param {boolean} show - whether to show the item (sub)tree. If false,\n   *   the item subtree rooted at `root` will be collapsed.\n   * @private\n   */\n  _toggleTreeItem(root, show = false) {\n    this._lastToggleIsShow = show;\n    for (const toggler of root.querySelectorAll(\".treeItemToggler\")) {\n      toggler.classList.toggle(\"treeItemsHidden\", !show);\n    }\n  }\n\n  /**\n   * Collapse or expand all subtrees of the `container`.\n   * @private\n   */\n  _toggleAllTreeItems() {\n    this._toggleTreeItem(this.container, !this._lastToggleIsShow);\n  }\n\n  /**\n   * @private\n   */\n  _finishRendering(fragment, count, hasAnyNesting = false) {\n    if (hasAnyNesting) {\n      this.container.classList.add(\"treeWithDeepNesting\");\n\n      this._lastToggleIsShow = !fragment.querySelector(\".treeItemsHidden\");\n    }\n    this.container.append(fragment);\n\n    this._dispatchEvent(count);\n  }\n\n  render(params) {\n    throw new Error(\"Not implemented: render\");\n  }\n\n  /**\n   * @private\n   */\n  _updateCurrentTreeItem(treeItem = null) {\n    if (this._currentTreeItem) {\n      // Ensure that the current treeItem-selection is always removed.\n      this._currentTreeItem.classList.remove(TREEITEM_SELECTED_CLASS);\n      this._currentTreeItem = null;\n    }\n    if (treeItem) {\n      treeItem.classList.add(TREEITEM_SELECTED_CLASS);\n      this._currentTreeItem = treeItem;\n    }\n  }\n\n  /**\n   * @private\n   */\n  _scrollToCurrentTreeItem(treeItem) {\n    if (!treeItem) {\n      return;\n    }\n    // Ensure that the treeItem is *fully* expanded, such that it will first of\n    // all be visible and secondly that scrolling it into view works correctly.\n    let currentNode = treeItem.parentNode;\n    while (currentNode && currentNode !== this.container) {\n      if (currentNode.classList.contains(\"treeItem\")) {\n        const toggler = currentNode.firstElementChild;\n        toggler?.classList.remove(\"treeItemsHidden\");\n      }\n      currentNode = currentNode.parentNode;\n    }\n    this._updateCurrentTreeItem(treeItem);\n\n    this.container.scrollTo(\n      treeItem.offsetLeft,\n      treeItem.offsetTop + TREEITEM_OFFSET_TOP\n    );\n  }\n}\n\nexport { BaseTreeViewer };\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 { createPromiseCapability, PDFDateString } from \"pdfjs-lib\";\nimport { getPageSizeInches, isPortraitOrientation } from \"./ui_utils.js\";\n\nconst DEFAULT_FIELD_CONTENT = \"-\";\n\n// See https://en.wikibooks.org/wiki/Lentis/Conversion_to_the_Metric_Standard_in_the_United_States\nconst NON_METRIC_LOCALES = [\"en-us\", \"en-lr\", \"my\"];\n\n// Should use the format: `width x height`, in portrait orientation.\n// See https://en.wikipedia.org/wiki/Paper_size\nconst US_PAGE_NAMES = {\n  \"8.5x11\": \"Letter\",\n  \"8.5x14\": \"Legal\",\n};\nconst METRIC_PAGE_NAMES = {\n  \"297x420\": \"A3\",\n  \"210x297\": \"A4\",\n};\n\nfunction getPageName(size, isPortrait, pageNames) {\n  const width = isPortrait ? size.width : size.height;\n  const height = isPortrait ? size.height : size.width;\n\n  return pageNames[`${width}x${height}`];\n}\n\n/**\n * @typedef {Object} PDFDocumentPropertiesOptions\n * @property {HTMLDialogElement} dialog - The overlay's DOM element.\n * @property {Object} fields - Names and elements of the overlay's fields.\n * @property {HTMLButtonElement} closeButton - Button for closing the overlay.\n */\n\nclass PDFDocumentProperties {\n  #fieldData = null;\n\n  /**\n   * @param {PDFDocumentPropertiesOptions} options\n   * @param {OverlayManager} overlayManager - Manager for the viewer overlays.\n   * @param {EventBus} eventBus - The application event bus.\n   * @param {IL10n} l10n - Localization service.\n   * @param {function} fileNameLookup - The function that is used to lookup\n   *   the document fileName.\n   */\n  constructor(\n    { dialog, fields, closeButton },\n    overlayManager,\n    eventBus,\n    l10n,\n    fileNameLookup\n  ) {\n    this.dialog = dialog;\n    this.fields = fields;\n    this.overlayManager = overlayManager;\n    this.l10n = l10n;\n    this._fileNameLookup = fileNameLookup;\n\n    this.#reset();\n    // Bind the event listener for the Close button.\n    closeButton.addEventListener(\"click\", this.close.bind(this));\n\n    this.overlayManager.register(this.dialog);\n\n    eventBus._on(\"pagechanging\", evt => {\n      this._currentPageNumber = evt.pageNumber;\n    });\n    eventBus._on(\"rotationchanging\", evt => {\n      this._pagesRotation = evt.pagesRotation;\n    });\n\n    this._isNonMetricLocale = true; // The default viewer locale is 'en-us'.\n    l10n.getLanguage().then(locale => {\n      this._isNonMetricLocale = NON_METRIC_LOCALES.includes(locale);\n    });\n  }\n\n  /**\n   * Open the document properties overlay.\n   */\n  async open() {\n    await Promise.all([\n      this.overlayManager.open(this.dialog),\n      this._dataAvailableCapability.promise,\n    ]);\n    const currentPageNumber = this._currentPageNumber;\n    const pagesRotation = this._pagesRotation;\n\n    // If the document properties were previously fetched (for this PDF file),\n    // just update the dialog immediately to avoid redundant lookups.\n    if (\n      this.#fieldData &&\n      currentPageNumber === this.#fieldData._currentPageNumber &&\n      pagesRotation === this.#fieldData._pagesRotation\n    ) {\n      this.#updateUI();\n      return;\n    }\n\n    // Get the document properties.\n    const {\n      info,\n      /* metadata, */\n      /* contentDispositionFilename, */\n      contentLength,\n    } = await this.pdfDocument.getMetadata();\n\n    const [\n      fileName,\n      fileSize,\n      creationDate,\n      modificationDate,\n      pageSize,\n      isLinearized,\n    ] = await Promise.all([\n      this._fileNameLookup(),\n      this.#parseFileSize(contentLength),\n      this.#parseDate(info.CreationDate),\n      this.#parseDate(info.ModDate),\n      this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {\n        return this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation);\n      }),\n      this.#parseLinearization(info.IsLinearized),\n    ]);\n\n    this.#fieldData = Object.freeze({\n      fileName,\n      fileSize,\n      title: info.Title,\n      author: info.Author,\n      subject: info.Subject,\n      keywords: info.Keywords,\n      creationDate,\n      modificationDate,\n      creator: info.Creator,\n      producer: info.Producer,\n      version: info.PDFFormatVersion,\n      pageCount: this.pdfDocument.numPages,\n      pageSize,\n      linearized: isLinearized,\n      _currentPageNumber: currentPageNumber,\n      _pagesRotation: pagesRotation,\n    });\n    this.#updateUI();\n\n    // Get the correct fileSize, since it may not have been available\n    // or could potentially be wrong.\n    const { length } = await this.pdfDocument.getDownloadInfo();\n    if (contentLength === length) {\n      return; // The fileSize has already been correctly set.\n    }\n    const data = Object.assign(Object.create(null), this.#fieldData);\n    data.fileSize = await this.#parseFileSize(length);\n\n    this.#fieldData = Object.freeze(data);\n    this.#updateUI();\n  }\n\n  /**\n   * Close the document properties overlay.\n   */\n  async close() {\n    this.overlayManager.close(this.dialog);\n  }\n\n  /**\n   * Set a reference to the PDF document in order to populate the dialog fields\n   * with the document properties. Note that the dialog will contain no\n   * information if this method is not called.\n   *\n   * @param {PDFDocumentProxy} pdfDocument - A reference to the PDF document.\n   */\n  setDocument(pdfDocument) {\n    if (this.pdfDocument) {\n      this.#reset();\n      this.#updateUI(true);\n    }\n    if (!pdfDocument) {\n      return;\n    }\n    this.pdfDocument = pdfDocument;\n\n    this._dataAvailableCapability.resolve();\n  }\n\n  #reset() {\n    this.pdfDocument = null;\n\n    this.#fieldData = null;\n    this._dataAvailableCapability = createPromiseCapability();\n    this._currentPageNumber = 1;\n    this._pagesRotation = 0;\n  }\n\n  /**\n   * Always updates all of the dialog fields, to prevent inconsistent UI state.\n   * NOTE: If the contents of a particular field is neither a non-empty string,\n   *       nor a number, it will fall back to `DEFAULT_FIELD_CONTENT`.\n   */\n  #updateUI(reset = false) {\n    if (reset || !this.#fieldData) {\n      for (const id in this.fields) {\n        this.fields[id].textContent = DEFAULT_FIELD_CONTENT;\n      }\n      return;\n    }\n    if (this.overlayManager.active !== this.dialog) {\n      // Don't bother updating the dialog if has already been closed,\n      // since it will be updated the next time `this.open` is called.\n      return;\n    }\n    for (const id in this.fields) {\n      const content = this.#fieldData[id];\n      this.fields[id].textContent =\n        content || content === 0 ? content : DEFAULT_FIELD_CONTENT;\n    }\n  }\n\n  async #parseFileSize(fileSize = 0) {\n    const kb = fileSize / 1024,\n      mb = kb / 1024;\n    if (!kb) {\n      return undefined;\n    }\n    return this.l10n.get(`document_properties_${mb >= 1 ? \"mb\" : \"kb\"}`, {\n      size_mb: mb >= 1 && (+mb.toPrecision(3)).toLocaleString(),\n      size_kb: mb < 1 && (+kb.toPrecision(3)).toLocaleString(),\n      size_b: fileSize.toLocaleString(),\n    });\n  }\n\n  async #parsePageSize(pageSizeInches, pagesRotation) {\n    if (!pageSizeInches) {\n      return undefined;\n    }\n    // Take the viewer rotation into account as well; compare with Adobe Reader.\n    if (pagesRotation % 180 !== 0) {\n      pageSizeInches = {\n        width: pageSizeInches.height,\n        height: pageSizeInches.width,\n      };\n    }\n    const isPortrait = isPortraitOrientation(pageSizeInches);\n\n    let sizeInches = {\n      width: Math.round(pageSizeInches.width * 100) / 100,\n      height: Math.round(pageSizeInches.height * 100) / 100,\n    };\n    // 1in == 25.4mm; no need to round to 2 decimals for millimeters.\n    let sizeMillimeters = {\n      width: Math.round(pageSizeInches.width * 25.4 * 10) / 10,\n      height: Math.round(pageSizeInches.height * 25.4 * 10) / 10,\n    };\n\n    let rawName =\n      getPageName(sizeInches, isPortrait, US_PAGE_NAMES) ||\n      getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);\n\n    if (\n      !rawName &&\n      !(\n        Number.isInteger(sizeMillimeters.width) &&\n        Number.isInteger(sizeMillimeters.height)\n      )\n    ) {\n      // Attempt to improve the page name detection by falling back to fuzzy\n      // matching of the metric dimensions, to account for e.g. rounding errors\n      // and/or PDF files that define the page sizes in an imprecise manner.\n      const exactMillimeters = {\n        width: pageSizeInches.width * 25.4,\n        height: pageSizeInches.height * 25.4,\n      };\n      const intMillimeters = {\n        width: Math.round(sizeMillimeters.width),\n        height: Math.round(sizeMillimeters.height),\n      };\n\n      // Try to avoid false positives, by only considering \"small\" differences.\n      if (\n        Math.abs(exactMillimeters.width - intMillimeters.width) < 0.1 &&\n        Math.abs(exactMillimeters.height - intMillimeters.height) < 0.1\n      ) {\n        rawName = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);\n        if (rawName) {\n          // Update *both* sizes, computed above, to ensure that the displayed\n          // dimensions always correspond to the detected page name.\n          sizeInches = {\n            width: Math.round((intMillimeters.width / 25.4) * 100) / 100,\n            height: Math.round((intMillimeters.height / 25.4) * 100) / 100,\n          };\n          sizeMillimeters = intMillimeters;\n        }\n      }\n    }\n\n    const [{ width, height }, unit, name, orientation] = await Promise.all([\n      this._isNonMetricLocale ? sizeInches : sizeMillimeters,\n      this.l10n.get(\n        `document_properties_page_size_unit_${\n          this._isNonMetricLocale ? \"inches\" : \"millimeters\"\n        }`\n      ),\n      rawName &&\n        this.l10n.get(\n          `document_properties_page_size_name_${rawName.toLowerCase()}`\n        ),\n      this.l10n.get(\n        `document_properties_page_size_orientation_${\n          isPortrait ? \"portrait\" : \"landscape\"\n        }`\n      ),\n    ]);\n\n    return this.l10n.get(\n      `document_properties_page_size_dimension_${name ? \"name_\" : \"\"}string`,\n      {\n        width: width.toLocaleString(),\n        height: height.toLocaleString(),\n        unit,\n        name,\n        orientation,\n      }\n    );\n  }\n\n  async #parseDate(inputDate) {\n    const dateObject = PDFDateString.toDateObject(inputDate);\n    if (!dateObject) {\n      return undefined;\n    }\n    return this.l10n.get(\"document_properties_date_string\", {\n      date: dateObject.toLocaleDateString(),\n      time: dateObject.toLocaleTimeString(),\n    });\n  }\n\n  #parseLinearization(isLinearized) {\n    return this.l10n.get(\n      `document_properties_linearized_${isLinearized ? \"yes\" : \"no\"}`\n    );\n  }\n}\n\nexport { PDFDocumentProperties };\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 { FindState } from \"./pdf_find_controller.js\";\n\nconst MATCHES_COUNT_LIMIT = 1000;\n\n/**\n * Creates a \"search bar\" given a set of DOM elements that act as controls\n * for searching or for setting search preferences in the UI. This object\n * also sets up the appropriate events for the controls. Actual searching\n * is done by PDFFindController.\n */\nclass PDFFindBar {\n  constructor(options, eventBus, l10n) {\n    this.opened = false;\n\n    this.bar = options.bar;\n    this.toggleButton = options.toggleButton;\n    this.findField = options.findField;\n    this.highlightAll = options.highlightAllCheckbox;\n    this.caseSensitive = options.caseSensitiveCheckbox;\n    this.matchDiacritics = options.matchDiacriticsCheckbox;\n    this.entireWord = options.entireWordCheckbox;\n    this.findMsg = options.findMsg;\n    this.findResultsCount = options.findResultsCount;\n    this.findPreviousButton = options.findPreviousButton;\n    this.findNextButton = options.findNextButton;\n    this.eventBus = eventBus;\n    this.l10n = l10n;\n\n    // Add event listeners to the DOM elements.\n    this.toggleButton.addEventListener(\"click\", () => {\n      this.toggle();\n    });\n\n    this.findField.addEventListener(\"input\", () => {\n      this.dispatchEvent(\"\");\n    });\n\n    this.bar.addEventListener(\"keydown\", e => {\n      switch (e.keyCode) {\n        case 13: // Enter\n          if (e.target === this.findField) {\n            this.dispatchEvent(\"again\", e.shiftKey);\n          }\n          break;\n        case 27: // Escape\n          this.close();\n          break;\n      }\n    });\n\n    this.findPreviousButton.addEventListener(\"click\", () => {\n      this.dispatchEvent(\"again\", true);\n    });\n\n    this.findNextButton.addEventListener(\"click\", () => {\n      this.dispatchEvent(\"again\", false);\n    });\n\n    this.highlightAll.addEventListener(\"click\", () => {\n      this.dispatchEvent(\"highlightallchange\");\n    });\n\n    this.caseSensitive.addEventListener(\"click\", () => {\n      this.dispatchEvent(\"casesensitivitychange\");\n    });\n\n    this.entireWord.addEventListener(\"click\", () => {\n      this.dispatchEvent(\"entirewordchange\");\n    });\n\n    this.matchDiacritics.addEventListener(\"click\", () => {\n      this.dispatchEvent(\"diacriticmatchingchange\");\n    });\n\n    this.eventBus._on(\"resize\", this.#adjustWidth.bind(this));\n  }\n\n  reset() {\n    this.updateUIState();\n  }\n\n  dispatchEvent(type, findPrev = false) {\n    this.eventBus.dispatch(\"find\", {\n      source: this,\n      type,\n      query: this.findField.value,\n      phraseSearch: true,\n      caseSensitive: this.caseSensitive.checked,\n      entireWord: this.entireWord.checked,\n      highlightAll: this.highlightAll.checked,\n      findPrevious: findPrev,\n      matchDiacritics: this.matchDiacritics.checked,\n    });\n  }\n\n  updateUIState(state, previous, matchesCount) {\n    let findMsg = Promise.resolve(\"\");\n    let status = \"\";\n\n    switch (state) {\n      case FindState.FOUND:\n        break;\n      case FindState.PENDING:\n        status = \"pending\";\n        break;\n      case FindState.NOT_FOUND:\n        findMsg = this.l10n.get(\"find_not_found\");\n        status = \"notFound\";\n        break;\n      case FindState.WRAPPED:\n        findMsg = this.l10n.get(`find_reached_${previous ? \"top\" : \"bottom\"}`);\n        break;\n    }\n    this.findField.setAttribute(\"data-status\", status);\n    this.findField.setAttribute(\"aria-invalid\", state === FindState.NOT_FOUND);\n\n    findMsg.then(msg => {\n      this.findMsg.textContent = msg;\n      this.#adjustWidth();\n    });\n\n    this.updateResultsCount(matchesCount);\n  }\n\n  updateResultsCount({ current = 0, total = 0 } = {}) {\n    const limit = MATCHES_COUNT_LIMIT;\n    let matchCountMsg = Promise.resolve(\"\");\n\n    if (total > 0) {\n      if (total > limit) {\n        let key = \"find_match_count_limit\";\n\n        if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n          // TODO: Remove this hard-coded `[other]` form once plural support has\n          // been implemented in the mozilla-central specific `l10n.js` file.\n          key += \"[other]\";\n        }\n        matchCountMsg = this.l10n.get(key, { limit });\n      } else {\n        let key = \"find_match_count\";\n\n        if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n          // TODO: Remove this hard-coded `[other]` form once plural support has\n          // been implemented in the mozilla-central specific `l10n.js` file.\n          key += \"[other]\";\n        }\n        matchCountMsg = this.l10n.get(key, { current, total });\n      }\n    }\n    matchCountMsg.then(msg => {\n      this.findResultsCount.textContent = msg;\n      // Since `updateResultsCount` may be called from `PDFFindController`,\n      // ensure that the width of the findbar is always updated correctly.\n      this.#adjustWidth();\n    });\n  }\n\n  open() {\n    if (!this.opened) {\n      this.opened = true;\n      this.toggleButton.classList.add(\"toggled\");\n      this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n      this.bar.classList.remove(\"hidden\");\n    }\n    this.findField.select();\n    this.findField.focus();\n\n    this.#adjustWidth();\n  }\n\n  close() {\n    if (!this.opened) {\n      return;\n    }\n    this.opened = false;\n    this.toggleButton.classList.remove(\"toggled\");\n    this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n    this.bar.classList.add(\"hidden\");\n\n    this.eventBus.dispatch(\"findbarclose\", { source: this });\n  }\n\n  toggle() {\n    if (this.opened) {\n      this.close();\n    } else {\n      this.open();\n    }\n  }\n\n  #adjustWidth() {\n    if (!this.opened) {\n      return;\n    }\n\n    // The find bar has an absolute position and thus the browser extends\n    // its width to the maximum possible width once the find bar does not fit\n    // entirely within the window anymore (and its elements are automatically\n    // wrapped). Here we detect and fix that.\n    this.bar.classList.remove(\"wrapContainers\");\n\n    const findbarHeight = this.bar.clientHeight;\n    const inputContainerHeight = this.bar.firstElementChild.clientHeight;\n\n    if (findbarHeight > inputContainerHeight) {\n      // The findbar is taller than the input container, which means that\n      // the browser wrapped some of the elements. For a consistent look,\n      // wrap all of them to adjust the width of the find bar.\n      this.bar.classList.add(\"wrapContainers\");\n    }\n  }\n}\n\nexport { PDFFindBar };\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\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { binarySearchFirstItem, scrollIntoView } from \"./ui_utils.js\";\nimport { createPromiseCapability } from \"pdfjs-lib\";\nimport { getCharacterType } from \"./pdf_find_utils.js\";\n\nconst FindState = {\n  FOUND: 0,\n  NOT_FOUND: 1,\n  WRAPPED: 2,\n  PENDING: 3,\n};\n\nconst FIND_TIMEOUT = 250; // ms\nconst MATCH_SCROLL_OFFSET_TOP = -50; // px\nconst MATCH_SCROLL_OFFSET_LEFT = -400; // px\n\nconst CHARACTERS_TO_NORMALIZE = {\n  \"\\u2010\": \"-\", // Hyphen\n  \"\\u2018\": \"'\", // Left single quotation mark\n  \"\\u2019\": \"'\", // Right single quotation mark\n  \"\\u201A\": \"'\", // Single low-9 quotation mark\n  \"\\u201B\": \"'\", // Single high-reversed-9 quotation mark\n  \"\\u201C\": '\"', // Left double quotation mark\n  \"\\u201D\": '\"', // Right double quotation mark\n  \"\\u201E\": '\"', // Double low-9 quotation mark\n  \"\\u201F\": '\"', // Double high-reversed-9 quotation mark\n  \"\\u00BC\": \"1/4\", // Vulgar fraction one quarter\n  \"\\u00BD\": \"1/2\", // Vulgar fraction one half\n  \"\\u00BE\": \"3/4\", // Vulgar fraction three quarters\n};\n\n// These diacritics aren't considered as combining diacritics\n// when searching in a document:\n//   https://searchfox.org/mozilla-central/source/intl/unicharutil/util/is_combining_diacritic.py.\n// The combining class definitions can be found:\n//   https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values\n// Category 0 corresponds to [^\\p{Mn}].\nconst DIACRITICS_EXCEPTION = new Set([\n  // UNICODE_COMBINING_CLASS_KANA_VOICING\n  // https://www.compart.com/fr/unicode/combining/8\n  0x3099, 0x309a,\n  // UNICODE_COMBINING_CLASS_VIRAMA (under 0xFFFF)\n  // https://www.compart.com/fr/unicode/combining/9\n  0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b,\n  0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714,\n  0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f,\n  0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed,\n  // 91\n  // https://www.compart.com/fr/unicode/combining/91\n  0x0c56,\n  // 129\n  // https://www.compart.com/fr/unicode/combining/129\n  0x0f71,\n  // 130\n  // https://www.compart.com/fr/unicode/combining/130\n  0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80,\n  // 132\n  // https://www.compart.com/fr/unicode/combining/132\n  0x0f74,\n]);\nlet DIACRITICS_EXCEPTION_STR; // Lazily initialized, see below.\n\nconst DIACRITICS_REG_EXP = /\\p{M}+/gu;\nconst SPECIAL_CHARS_REG_EXP =\n  /([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})/gu;\nconst NOT_DIACRITIC_FROM_END_REG_EXP = /([^\\p{M}])\\p{M}*$/u;\nconst NOT_DIACRITIC_FROM_START_REG_EXP = /^\\p{M}*([^\\p{M}])/u;\n\n// The range [AC00-D7AF] corresponds to the Hangul syllables.\n// The few other chars are some CJK Compatibility Ideographs.\nconst SYLLABLES_REG_EXP = /[\\uAC00-\\uD7AF\\uFA6C\\uFACF-\\uFAD1\\uFAD5-\\uFAD7]+/g;\nconst SYLLABLES_LENGTHS = new Map();\n// When decomposed (in using NFD) the above syllables will start\n// with one of the chars in this regexp.\nconst FIRST_CHAR_SYLLABLES_REG_EXP =\n  \"[\\\\u1100-\\\\u1112\\\\ud7a4-\\\\ud7af\\\\ud84a\\\\ud84c\\\\ud850\\\\ud854\\\\ud857\\\\ud85f]\";\n\nconst NFKC_CHARS_TO_NORMALIZE = new Map();\n\nlet noSyllablesRegExp = null;\nlet withSyllablesRegExp = null;\n\nfunction normalize(text) {\n  // The diacritics in the text or in the query can be composed or not.\n  // So we use a decomposed text using NFD (and the same for the query)\n  // in order to be sure that diacritics are in the same order.\n\n  // Collect syllables length and positions.\n  const syllablePositions = [];\n  let m;\n  while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) {\n    let { index } = m;\n    for (const char of m[0]) {\n      let len = SYLLABLES_LENGTHS.get(char);\n      if (!len) {\n        len = char.normalize(\"NFD\").length;\n        SYLLABLES_LENGTHS.set(char, len);\n      }\n      syllablePositions.push([len, index++]);\n    }\n  }\n\n  let normalizationRegex;\n  if (syllablePositions.length === 0 && noSyllablesRegExp) {\n    normalizationRegex = noSyllablesRegExp;\n  } else if (syllablePositions.length > 0 && withSyllablesRegExp) {\n    normalizationRegex = withSyllablesRegExp;\n  } else {\n    // Compile the regular expression for text normalization once.\n    const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(\"\");\n    const toNormalizeWithNFKC =\n      \"\\u2460-\\u2473\" + // Circled numbers.\n      \"\\u24b6-\\u24ff\" + // Circled letters/numbers.\n      \"\\u3244-\\u32bf\" + // Circled ideograms/numbers.\n      \"\\u32d0-\\u32fe\" + // Circled ideograms.\n      \"\\uff00-\\uffef\"; // Halfwidth, fullwidth forms.\n    const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(\\\\p{M}+(?:-\\\\n)?)|(\\\\S-\\\\n)|(\\\\p{Ideographic}\\\\n)|(\\\\n)`;\n\n    if (syllablePositions.length === 0) {\n      // Most of the syllables belong to Hangul so there are no need\n      // to search for them in a non-Hangul document.\n      // We use the \\0 in order to have the same number of groups.\n      normalizationRegex = noSyllablesRegExp = new RegExp(\n        regexp + \"|(\\\\u0000)\",\n        \"gum\"\n      );\n    } else {\n      normalizationRegex = withSyllablesRegExp = new RegExp(\n        regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`,\n        \"gum\"\n      );\n    }\n  }\n\n  // The goal of this function is to normalize the string and\n  // be able to get from an index in the new string the\n  // corresponding index in the old string.\n  // For example if we have: abCd12ef456gh where C is replaced by ccc\n  // and numbers replaced by nothing (it's the case for diacritics), then\n  // we'll obtain the normalized string: abcccdefgh.\n  // So here the reverse map is: [0,1,2,2,2,3,6,7,11,12].\n\n  // The goal is to obtain the array: [[0, 0], [3, -1], [4, -2],\n  // [6, 0], [8, 3]].\n  // which can be used like this:\n  //  - let say that i is the index in new string and j the index\n  //    the old string.\n  //  - if i is in [0; 3[ then j = i + 0\n  //  - if i is in [3; 4[ then j = i - 1\n  //  - if i is in [4; 6[ then j = i - 2\n  //  ...\n  // Thanks to a binary search it's easy to know where is i and what's the\n  // shift.\n  // Let say that the last entry in the array is [x, s] and we have a\n  // substitution at index y (old string) which will replace o chars by n chars.\n  // Firstly, if o === n, then no need to add a new entry: the shift is\n  // the same.\n  // Secondly, if o < n, then we push the n - o elements:\n  // [y - (s - 1), s - 1], [y - (s - 2), s - 2], ...\n  // Thirdly, if o > n, then we push the element: [y - (s - n), o + s - n]\n\n  // Collect diacritics length and positions.\n  const rawDiacriticsPositions = [];\n  while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {\n    rawDiacriticsPositions.push([m[0].length, m.index]);\n  }\n\n  let normalized = text.normalize(\"NFD\");\n  const positions = [[0, 0]];\n  let rawDiacriticsIndex = 0;\n  let syllableIndex = 0;\n  let shift = 0;\n  let shiftOrigin = 0;\n  let eol = 0;\n  let hasDiacritics = false;\n\n  normalized = normalized.replace(\n    normalizationRegex,\n    (match, p1, p2, p3, p4, p5, p6, p7, i) => {\n      i -= shiftOrigin;\n      if (p1) {\n        // Maybe fractions or quotations mark...\n        const replacement = CHARACTERS_TO_NORMALIZE[p1];\n        const jj = replacement.length;\n        for (let j = 1; j < jj; j++) {\n          positions.push([i - shift + j, shift - j]);\n        }\n        shift -= jj - 1;\n        return replacement;\n      }\n\n      if (p2) {\n        // Use the NFKC representation to normalize the char.\n        let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2);\n        if (!replacement) {\n          replacement = p2.normalize(\"NFKC\");\n          NFKC_CHARS_TO_NORMALIZE.set(p2, replacement);\n        }\n        const jj = replacement.length;\n        for (let j = 1; j < jj; j++) {\n          positions.push([i - shift + j, shift - j]);\n        }\n        shift -= jj - 1;\n        return replacement;\n      }\n\n      if (p3) {\n        const hasTrailingDashEOL = p3.endsWith(\"\\n\");\n        const len = hasTrailingDashEOL ? p3.length - 2 : p3.length;\n\n        // Diacritics.\n        hasDiacritics = true;\n        let jj = len;\n        if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n          jj -= rawDiacriticsPositions[rawDiacriticsIndex][0];\n          ++rawDiacriticsIndex;\n        }\n\n        for (let j = 1; j <= jj; j++) {\n          // i is the position of the first diacritic\n          // so (i - 1) is the position for the letter before.\n          positions.push([i - 1 - shift + j, shift - j]);\n        }\n        shift -= jj;\n        shiftOrigin += jj;\n\n        if (hasTrailingDashEOL) {\n          // Diacritics are followed by a -\\n.\n          // See comments in `if (p4)` block.\n          i += len - 1;\n          positions.push([i - shift + 1, 1 + shift]);\n          shift += 1;\n          shiftOrigin += 1;\n          eol += 1;\n          return p3.slice(0, len);\n        }\n\n        return p3;\n      }\n\n      if (p4) {\n        // \"X-\\n\" is removed because an hyphen at the end of a line\n        // with not a space before is likely here to mark a break\n        // in a word.\n        // The \\n isn't in the original text so here y = i, n = 1 and o = 2.\n        positions.push([i - shift + 1, 1 + shift]);\n        shift += 1;\n        shiftOrigin += 1;\n        eol += 1;\n        return p4.charAt(0);\n      }\n\n      if (p5) {\n        // An ideographic at the end of a line doesn't imply adding an extra\n        // white space.\n        positions.push([i - shift + 1, shift]);\n        shiftOrigin += 1;\n        eol += 1;\n        return p5.charAt(0);\n      }\n\n      if (p6) {\n        // eol is replaced by space: \"foo\\nbar\" is likely equivalent to\n        // \"foo bar\".\n        positions.push([i - shift + 1, shift - 1]);\n        shift -= 1;\n        shiftOrigin += 1;\n        eol += 1;\n        return \" \";\n      }\n\n      // p7\n      if (i + eol === syllablePositions[syllableIndex]?.[1]) {\n        // A syllable (1 char) is replaced with several chars (n) so\n        // newCharsLen = n - 1.\n        const newCharLen = syllablePositions[syllableIndex][0] - 1;\n        ++syllableIndex;\n        for (let j = 1; j <= newCharLen; j++) {\n          positions.push([i - (shift - j), shift - j]);\n        }\n        shift -= newCharLen;\n        shiftOrigin += newCharLen;\n      }\n      return p7;\n    }\n  );\n\n  positions.push([normalized.length, shift]);\n\n  return [normalized, positions, hasDiacritics];\n}\n\n// Determine the original, non-normalized, match index such that highlighting of\n// search results is correct in the `textLayer` for strings containing e.g. \"½\"\n// characters; essentially \"inverting\" the result of the `normalize` function.\nfunction getOriginalIndex(diffs, pos, len) {\n  if (!diffs) {\n    return [pos, len];\n  }\n\n  const start = pos;\n  const end = pos + len;\n  let i = binarySearchFirstItem(diffs, x => x[0] >= start);\n  if (diffs[i][0] > start) {\n    --i;\n  }\n\n  let j = binarySearchFirstItem(diffs, x => x[0] >= end, i);\n  if (diffs[j][0] > end) {\n    --j;\n  }\n\n  return [start + diffs[i][1], len + diffs[j][1] - diffs[i][1]];\n}\n\n/**\n * @typedef {Object} PDFFindControllerOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * Provides search functionality to find a given string in a PDF document.\n */\nclass PDFFindController {\n  /**\n   * @param {PDFFindControllerOptions} options\n   */\n  constructor({ linkService, eventBus }) {\n    this._linkService = linkService;\n    this._eventBus = eventBus;\n\n    this.#reset();\n    eventBus._on(\"find\", this.#onFind.bind(this));\n    eventBus._on(\"findbarclose\", this.#onFindBarClose.bind(this));\n  }\n\n  get highlightMatches() {\n    return this._highlightMatches;\n  }\n\n  get pageMatches() {\n    return this._pageMatches;\n  }\n\n  get pageMatchesLength() {\n    return this._pageMatchesLength;\n  }\n\n  get selected() {\n    return this._selected;\n  }\n\n  get state() {\n    return this._state;\n  }\n\n  /**\n   * Set a reference to the PDF document in order to search it.\n   * Note that searching is not possible if this method is not called.\n   *\n   * @param {PDFDocumentProxy} pdfDocument - The PDF document to search.\n   */\n  setDocument(pdfDocument) {\n    if (this._pdfDocument) {\n      this.#reset();\n    }\n    if (!pdfDocument) {\n      return;\n    }\n    this._pdfDocument = pdfDocument;\n    this._firstPageCapability.resolve();\n  }\n\n  #onFind(state) {\n    if (!state) {\n      return;\n    }\n    const pdfDocument = this._pdfDocument;\n    const { type } = state;\n\n    if (this._state === null || this.#shouldDirtyMatch(state)) {\n      this._dirtyMatch = true;\n    }\n    this._state = state;\n    if (type !== \"highlightallchange\") {\n      this.#updateUIState(FindState.PENDING);\n    }\n\n    this._firstPageCapability.promise.then(() => {\n      // If the document was closed before searching began, or if the search\n      // operation was relevant for a previously opened document, do nothing.\n      if (\n        !this._pdfDocument ||\n        (pdfDocument && this._pdfDocument !== pdfDocument)\n      ) {\n        return;\n      }\n      this.#extractText();\n\n      const findbarClosed = !this._highlightMatches;\n      const pendingTimeout = !!this._findTimeout;\n\n      if (this._findTimeout) {\n        clearTimeout(this._findTimeout);\n        this._findTimeout = null;\n      }\n      if (!type) {\n        // Trigger the find action with a small delay to avoid starting the\n        // search when the user is still typing (saving resources).\n        this._findTimeout = setTimeout(() => {\n          this.#nextMatch();\n          this._findTimeout = null;\n        }, FIND_TIMEOUT);\n      } else if (this._dirtyMatch) {\n        // Immediately trigger searching for non-'find' operations, when the\n        // current state needs to be reset and matches re-calculated.\n        this.#nextMatch();\n      } else if (type === \"again\") {\n        this.#nextMatch();\n\n        // When the findbar was previously closed, and `highlightAll` is set,\n        // ensure that the matches on all active pages are highlighted again.\n        if (findbarClosed && this._state.highlightAll) {\n          this.#updateAllPages();\n        }\n      } else if (type === \"highlightallchange\") {\n        // If there was a pending search operation, synchronously trigger a new\n        // search *first* to ensure that the correct matches are highlighted.\n        if (pendingTimeout) {\n          this.#nextMatch();\n        } else {\n          this._highlightMatches = true;\n        }\n        this.#updateAllPages(); // Update the highlighting on all active pages.\n      } else {\n        this.#nextMatch();\n      }\n    });\n  }\n\n  scrollMatchIntoView({\n    element = null,\n    selectedLeft = 0,\n    pageIndex = -1,\n    matchIndex = -1,\n  }) {\n    if (!this._scrollMatches || !element) {\n      return;\n    } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {\n      return;\n    } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {\n      return;\n    }\n    this._scrollMatches = false; // Ensure that scrolling only happens once.\n\n    const spot = {\n      top: MATCH_SCROLL_OFFSET_TOP,\n      left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT,\n    };\n    scrollIntoView(element, spot, /* scrollMatches = */ true);\n  }\n\n  #reset() {\n    this._highlightMatches = false;\n    this._scrollMatches = false;\n    this._pdfDocument = null;\n    this._pageMatches = [];\n    this._pageMatchesLength = [];\n    this._state = null;\n    // Currently selected match.\n    this._selected = {\n      pageIdx: -1,\n      matchIdx: -1,\n    };\n    // Where the find algorithm currently is in the document.\n    this._offset = {\n      pageIdx: null,\n      matchIdx: null,\n      wrapped: false,\n    };\n    this._extractTextPromises = [];\n    this._pageContents = []; // Stores the normalized text for each page.\n    this._pageDiffs = [];\n    this._hasDiacritics = [];\n    this._matchesCountTotal = 0;\n    this._pagesToSearch = null;\n    this._pendingFindMatches = new Set();\n    this._resumePageIdx = null;\n    this._dirtyMatch = false;\n    clearTimeout(this._findTimeout);\n    this._findTimeout = null;\n\n    this._firstPageCapability = createPromiseCapability();\n  }\n\n  /**\n   * @type {string} The (current) normalized search query.\n   */\n  get #query() {\n    if (this._state.query !== this._rawQuery) {\n      this._rawQuery = this._state.query;\n      [this._normalizedQuery] = normalize(this._state.query);\n    }\n    return this._normalizedQuery;\n  }\n\n  #shouldDirtyMatch(state) {\n    // When the search query changes, regardless of the actual search command\n    // used, always re-calculate matches to avoid errors (fixes bug 1030622).\n    if (state.query !== this._state.query) {\n      return true;\n    }\n    switch (state.type) {\n      case \"again\":\n        const pageNumber = this._selected.pageIdx + 1;\n        const linkService = this._linkService;\n        // Only treat a 'findagain' event as a new search operation when it's\n        // *absolutely* certain that the currently selected match is no longer\n        // visible, e.g. as a result of the user scrolling in the document.\n        //\n        // NOTE: If only a simple `this._linkService.page` check was used here,\n        // there's a risk that consecutive 'findagain' operations could \"skip\"\n        // over matches at the top/bottom of pages thus making them completely\n        // inaccessible when there's multiple pages visible in the viewer.\n        if (\n          pageNumber >= 1 &&\n          pageNumber <= linkService.pagesCount &&\n          pageNumber !== linkService.page &&\n          !linkService.isPageVisible(pageNumber)\n        ) {\n          return true;\n        }\n        return false;\n      case \"highlightallchange\":\n        return false;\n    }\n    return true;\n  }\n\n  /**\n   * Determine if the search query constitutes a \"whole word\", by comparing the\n   * first/last character type with the preceding/following character type.\n   */\n  #isEntireWord(content, startIdx, length) {\n    let match = content\n      .slice(0, startIdx)\n      .match(NOT_DIACRITIC_FROM_END_REG_EXP);\n    if (match) {\n      const first = content.charCodeAt(startIdx);\n      const limit = match[1].charCodeAt(0);\n      if (getCharacterType(first) === getCharacterType(limit)) {\n        return false;\n      }\n    }\n\n    match = content\n      .slice(startIdx + length)\n      .match(NOT_DIACRITIC_FROM_START_REG_EXP);\n    if (match) {\n      const last = content.charCodeAt(startIdx + length - 1);\n      const limit = match[1].charCodeAt(0);\n      if (getCharacterType(last) === getCharacterType(limit)) {\n        return false;\n      }\n    }\n\n    return true;\n  }\n\n  #calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {\n    const matches = [],\n      matchesLength = [];\n\n    const diffs = this._pageDiffs[pageIndex];\n    let match;\n    while ((match = query.exec(pageContent)) !== null) {\n      if (\n        entireWord &&\n        !this.#isEntireWord(pageContent, match.index, match[0].length)\n      ) {\n        continue;\n      }\n\n      const [matchPos, matchLen] = getOriginalIndex(\n        diffs,\n        match.index,\n        match[0].length\n      );\n\n      if (matchLen) {\n        matches.push(matchPos);\n        matchesLength.push(matchLen);\n      }\n    }\n    this._pageMatches[pageIndex] = matches;\n    this._pageMatchesLength[pageIndex] = matchesLength;\n  }\n\n  #convertToRegExpString(query, hasDiacritics) {\n    const { matchDiacritics } = this._state;\n    let isUnicode = false;\n    query = query.replace(\n      SPECIAL_CHARS_REG_EXP,\n      (\n        match,\n        p1 /* to escape */,\n        p2 /* punctuation */,\n        p3 /* whitespaces */,\n        p4 /* diacritics */,\n        p5 /* letters */\n      ) => {\n        // We don't need to use a \\s for whitespaces since all the different\n        // kind of whitespaces are replaced by a single \" \".\n\n        if (p1) {\n          // Escape characters like *+?... to not interfer with regexp syntax.\n          return `[ ]*\\\\${p1}[ ]*`;\n        }\n        if (p2) {\n          // Allow whitespaces around punctuation signs.\n          return `[ ]*${p2}[ ]*`;\n        }\n        if (p3) {\n          // Replace spaces by \\s+ to be sure to match any spaces.\n          return \"[ ]+\";\n        }\n        if (matchDiacritics) {\n          return p4 || p5;\n        }\n\n        if (p4) {\n          // Diacritics are removed with few exceptions.\n          return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : \"\";\n        }\n\n        // A letter has been matched and it can be followed by any diacritics\n        // in normalized text.\n        if (hasDiacritics) {\n          isUnicode = true;\n          return `${p5}\\\\p{M}*`;\n        }\n        return p5;\n      }\n    );\n\n    const trailingSpaces = \"[ ]*\";\n    if (query.endsWith(trailingSpaces)) {\n      // The [ ]* has been added in order to help to match \"foo . bar\" but\n      // it doesn't make sense to match some whitespaces after the dot\n      // when it's the last character.\n      query = query.slice(0, query.length - trailingSpaces.length);\n    }\n\n    if (matchDiacritics) {\n      // aX must not match aXY.\n      if (hasDiacritics) {\n        DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(\n          ...DIACRITICS_EXCEPTION\n        );\n\n        isUnicode = true;\n        query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\\\p{M}]|$)`;\n      }\n    }\n\n    return [isUnicode, query];\n  }\n\n  #calculateMatch(pageIndex) {\n    let query = this.#query;\n    if (query.length === 0) {\n      // Do nothing: the matches should be wiped out already.\n      return;\n    }\n\n    const { caseSensitive, entireWord, phraseSearch } = this._state;\n    const pageContent = this._pageContents[pageIndex];\n    const hasDiacritics = this._hasDiacritics[pageIndex];\n\n    let isUnicode = false;\n    if (phraseSearch) {\n      [isUnicode, query] = this.#convertToRegExpString(query, hasDiacritics);\n    } else {\n      // Words are sorted in reverse order to be sure that \"foobar\" is matched\n      // before \"foo\" in case the query is \"foobar foo\".\n      const match = query.match(/\\S+/g);\n      if (match) {\n        query = match\n          .sort()\n          .reverse()\n          .map(q => {\n            const [isUnicodePart, queryPart] = this.#convertToRegExpString(\n              q,\n              hasDiacritics\n            );\n            isUnicode ||= isUnicodePart;\n            return `(${queryPart})`;\n          })\n          .join(\"|\");\n      }\n    }\n\n    const flags = `g${isUnicode ? \"u\" : \"\"}${caseSensitive ? \"\" : \"i\"}`;\n    query = new RegExp(query, flags);\n\n    this.#calculateRegExpMatch(query, entireWord, pageIndex, pageContent);\n\n    // When `highlightAll` is set, ensure that the matches on previously\n    // rendered (and still active) pages are correctly highlighted.\n    if (this._state.highlightAll) {\n      this.#updatePage(pageIndex);\n    }\n    if (this._resumePageIdx === pageIndex) {\n      this._resumePageIdx = null;\n      this.#nextPageMatch();\n    }\n\n    // Update the match count.\n    const pageMatchesCount = this._pageMatches[pageIndex].length;\n    if (pageMatchesCount > 0) {\n      this._matchesCountTotal += pageMatchesCount;\n      this.#updateUIResultsCount();\n    }\n  }\n\n  #extractText() {\n    // Perform text extraction once if this method is called multiple times.\n    if (this._extractTextPromises.length > 0) {\n      return;\n    }\n\n    let promise = Promise.resolve();\n    for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n      const extractTextCapability = createPromiseCapability();\n      this._extractTextPromises[i] = extractTextCapability.promise;\n\n      promise = promise.then(() => {\n        return this._pdfDocument\n          .getPage(i + 1)\n          .then(pdfPage => {\n            return pdfPage.getTextContent();\n          })\n          .then(\n            textContent => {\n              const strBuf = [];\n\n              for (const textItem of textContent.items) {\n                strBuf.push(textItem.str);\n                if (textItem.hasEOL) {\n                  strBuf.push(\"\\n\");\n                }\n              }\n\n              // Store the normalized page content (text items) as one string.\n              [\n                this._pageContents[i],\n                this._pageDiffs[i],\n                this._hasDiacritics[i],\n              ] = normalize(strBuf.join(\"\"));\n              extractTextCapability.resolve();\n            },\n            reason => {\n              console.error(\n                `Unable to get text content for page ${i + 1}`,\n                reason\n              );\n              // Page error -- assuming no text content.\n              this._pageContents[i] = \"\";\n              this._pageDiffs[i] = null;\n              this._hasDiacritics[i] = false;\n              extractTextCapability.resolve();\n            }\n          );\n      });\n    }\n  }\n\n  #updatePage(index) {\n    if (this._scrollMatches && this._selected.pageIdx === index) {\n      // If the page is selected, scroll the page into view, which triggers\n      // rendering the page, which adds the text layer. Once the text layer\n      // is built, it will attempt to scroll the selected match into view.\n      this._linkService.page = index + 1;\n    }\n\n    this._eventBus.dispatch(\"updatetextlayermatches\", {\n      source: this,\n      pageIndex: index,\n    });\n  }\n\n  #updateAllPages() {\n    this._eventBus.dispatch(\"updatetextlayermatches\", {\n      source: this,\n      pageIndex: -1,\n    });\n  }\n\n  #nextMatch() {\n    const previous = this._state.findPrevious;\n    const currentPageIndex = this._linkService.page - 1;\n    const numPages = this._linkService.pagesCount;\n\n    this._highlightMatches = true;\n\n    if (this._dirtyMatch) {\n      // Need to recalculate the matches, reset everything.\n      this._dirtyMatch = false;\n      this._selected.pageIdx = this._selected.matchIdx = -1;\n      this._offset.pageIdx = currentPageIndex;\n      this._offset.matchIdx = null;\n      this._offset.wrapped = false;\n      this._resumePageIdx = null;\n      this._pageMatches.length = 0;\n      this._pageMatchesLength.length = 0;\n      this._matchesCountTotal = 0;\n\n      this.#updateAllPages(); // Wipe out any previously highlighted matches.\n\n      for (let i = 0; i < numPages; i++) {\n        // Start finding the matches as soon as the text is extracted.\n        if (this._pendingFindMatches.has(i)) {\n          continue;\n        }\n        this._pendingFindMatches.add(i);\n        this._extractTextPromises[i].then(() => {\n          this._pendingFindMatches.delete(i);\n          this.#calculateMatch(i);\n        });\n      }\n    }\n\n    // If there's no query there's no point in searching.\n    if (this.#query === \"\") {\n      this.#updateUIState(FindState.FOUND);\n      return;\n    }\n    // If we're waiting on a page, we return since we can't do anything else.\n    if (this._resumePageIdx) {\n      return;\n    }\n\n    const offset = this._offset;\n    // Keep track of how many pages we should maximally iterate through.\n    this._pagesToSearch = numPages;\n    // If there's already a `matchIdx` that means we are iterating through a\n    // page's matches.\n    if (offset.matchIdx !== null) {\n      const numPageMatches = this._pageMatches[offset.pageIdx].length;\n      if (\n        (!previous && offset.matchIdx + 1 < numPageMatches) ||\n        (previous && offset.matchIdx > 0)\n      ) {\n        // The simple case; we just have advance the matchIdx to select\n        // the next match on the page.\n        offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;\n        this.#updateMatch(/* found = */ true);\n        return;\n      }\n      // We went beyond the current page's matches, so we advance to\n      // the next page.\n      this.#advanceOffsetPage(previous);\n    }\n    // Start searching through the page.\n    this.#nextPageMatch();\n  }\n\n  #matchesReady(matches) {\n    const offset = this._offset;\n    const numMatches = matches.length;\n    const previous = this._state.findPrevious;\n\n    if (numMatches) {\n      // There were matches for the page, so initialize `matchIdx`.\n      offset.matchIdx = previous ? numMatches - 1 : 0;\n      this.#updateMatch(/* found = */ true);\n      return true;\n    }\n    // No matches, so attempt to search the next page.\n    this.#advanceOffsetPage(previous);\n    if (offset.wrapped) {\n      offset.matchIdx = null;\n      if (this._pagesToSearch < 0) {\n        // No point in wrapping again, there were no matches.\n        this.#updateMatch(/* found = */ false);\n        // While matches were not found, searching for a page\n        // with matches should nevertheless halt.\n        return true;\n      }\n    }\n    // Matches were not found (and searching is not done).\n    return false;\n  }\n\n  #nextPageMatch() {\n    if (this._resumePageIdx !== null) {\n      console.error(\"There can only be one pending page.\");\n    }\n\n    let matches = null;\n    do {\n      const pageIdx = this._offset.pageIdx;\n      matches = this._pageMatches[pageIdx];\n      if (!matches) {\n        // The matches don't exist yet for processing by `_matchesReady`,\n        // so set a resume point for when they do exist.\n        this._resumePageIdx = pageIdx;\n        break;\n      }\n    } while (!this.#matchesReady(matches));\n  }\n\n  #advanceOffsetPage(previous) {\n    const offset = this._offset;\n    const numPages = this._linkService.pagesCount;\n    offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;\n    offset.matchIdx = null;\n\n    this._pagesToSearch--;\n\n    if (offset.pageIdx >= numPages || offset.pageIdx < 0) {\n      offset.pageIdx = previous ? numPages - 1 : 0;\n      offset.wrapped = true;\n    }\n  }\n\n  #updateMatch(found = false) {\n    let state = FindState.NOT_FOUND;\n    const wrapped = this._offset.wrapped;\n    this._offset.wrapped = false;\n\n    if (found) {\n      const previousPage = this._selected.pageIdx;\n      this._selected.pageIdx = this._offset.pageIdx;\n      this._selected.matchIdx = this._offset.matchIdx;\n      state = wrapped ? FindState.WRAPPED : FindState.FOUND;\n\n      // Update the currently selected page to wipe out any selected matches.\n      if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {\n        this.#updatePage(previousPage);\n      }\n    }\n\n    this.#updateUIState(state, this._state.findPrevious);\n    if (this._selected.pageIdx !== -1) {\n      // Ensure that the match will be scrolled into view.\n      this._scrollMatches = true;\n\n      this.#updatePage(this._selected.pageIdx);\n    }\n  }\n\n  #onFindBarClose(evt) {\n    const pdfDocument = this._pdfDocument;\n    // Since searching is asynchronous, ensure that the removal of highlighted\n    // matches (from the UI) is async too such that the 'updatetextlayermatches'\n    // events will always be dispatched in the expected order.\n    this._firstPageCapability.promise.then(() => {\n      // Only update the UI if the document is open, and is the current one.\n      if (\n        !this._pdfDocument ||\n        (pdfDocument && this._pdfDocument !== pdfDocument)\n      ) {\n        return;\n      }\n      // Ensure that a pending, not yet started, search operation is aborted.\n      if (this._findTimeout) {\n        clearTimeout(this._findTimeout);\n        this._findTimeout = null;\n      }\n      // Abort any long running searches, to avoid a match being scrolled into\n      // view *after* the findbar has been closed. In this case `this._offset`\n      // will most likely differ from `this._selected`, hence we also ensure\n      // that any new search operation will always start with a clean slate.\n      if (this._resumePageIdx) {\n        this._resumePageIdx = null;\n        this._dirtyMatch = true;\n      }\n      // Avoid the UI being in a pending state when the findbar is re-opened.\n      this.#updateUIState(FindState.FOUND);\n\n      this._highlightMatches = false;\n      this.#updateAllPages(); // Wipe out any previously highlighted matches.\n    });\n  }\n\n  #requestMatchesCount() {\n    const { pageIdx, matchIdx } = this._selected;\n    let current = 0,\n      total = this._matchesCountTotal;\n    if (matchIdx !== -1) {\n      for (let i = 0; i < pageIdx; i++) {\n        current += this._pageMatches[i]?.length || 0;\n      }\n      current += matchIdx + 1;\n    }\n    // When searching starts, this method may be called before the `pageMatches`\n    // have been counted (in `_calculateMatch`). Ensure that the UI won't show\n    // temporarily broken state when the active find result doesn't make sense.\n    if (current < 1 || current > total) {\n      current = total = 0;\n    }\n    return { current, total };\n  }\n\n  #updateUIResultsCount() {\n    this._eventBus.dispatch(\"updatefindmatchescount\", {\n      source: this,\n      matchesCount: this.#requestMatchesCount(),\n    });\n  }\n\n  #updateUIState(state, previous = false) {\n    this._eventBus.dispatch(\"updatefindcontrolstate\", {\n      source: this,\n      state,\n      previous,\n      matchesCount: this.#requestMatchesCount(),\n      rawQuery: this._state?.query ?? null,\n    });\n  }\n}\n\nexport { FindState, PDFFindController };\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\nconst CharacterType = {\n  SPACE: 0,\n  ALPHA_LETTER: 1,\n  PUNCT: 2,\n  HAN_LETTER: 3,\n  KATAKANA_LETTER: 4,\n  HIRAGANA_LETTER: 5,\n  HALFWIDTH_KATAKANA_LETTER: 6,\n  THAI_LETTER: 7,\n};\n\nfunction isAlphabeticalScript(charCode) {\n  return charCode < 0x2e80;\n}\n\nfunction isAscii(charCode) {\n  return (charCode & 0xff80) === 0;\n}\n\nfunction isAsciiAlpha(charCode) {\n  return (\n    (charCode >= /* a = */ 0x61 && charCode <= /* z = */ 0x7a) ||\n    (charCode >= /* A = */ 0x41 && charCode <= /* Z = */ 0x5a)\n  );\n}\n\nfunction isAsciiDigit(charCode) {\n  return charCode >= /* 0 = */ 0x30 && charCode <= /* 9 = */ 0x39;\n}\n\nfunction isAsciiSpace(charCode) {\n  return (\n    charCode === /* SPACE = */ 0x20 ||\n    charCode === /* TAB = */ 0x09 ||\n    charCode === /* CR = */ 0x0d ||\n    charCode === /* LF = */ 0x0a\n  );\n}\n\nfunction isHan(charCode) {\n  return (\n    (charCode >= 0x3400 && charCode <= 0x9fff) ||\n    (charCode >= 0xf900 && charCode <= 0xfaff)\n  );\n}\n\nfunction isKatakana(charCode) {\n  return charCode >= 0x30a0 && charCode <= 0x30ff;\n}\n\nfunction isHiragana(charCode) {\n  return charCode >= 0x3040 && charCode <= 0x309f;\n}\n\nfunction isHalfwidthKatakana(charCode) {\n  return charCode >= 0xff60 && charCode <= 0xff9f;\n}\n\nfunction isThai(charCode) {\n  return (charCode & 0xff80) === 0x0e00;\n}\n\n/**\n * This function is based on the word-break detection implemented in:\n * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp\n */\nfunction getCharacterType(charCode) {\n  if (isAlphabeticalScript(charCode)) {\n    if (isAscii(charCode)) {\n      if (isAsciiSpace(charCode)) {\n        return CharacterType.SPACE;\n      } else if (\n        isAsciiAlpha(charCode) ||\n        isAsciiDigit(charCode) ||\n        charCode === /* UNDERSCORE = */ 0x5f\n      ) {\n        return CharacterType.ALPHA_LETTER;\n      }\n      return CharacterType.PUNCT;\n    } else if (isThai(charCode)) {\n      return CharacterType.THAI_LETTER;\n    } else if (charCode === /* NBSP = */ 0xa0) {\n      return CharacterType.SPACE;\n    }\n    return CharacterType.ALPHA_LETTER;\n  }\n\n  if (isHan(charCode)) {\n    return CharacterType.HAN_LETTER;\n  } else if (isKatakana(charCode)) {\n    return CharacterType.KATAKANA_LETTER;\n  } else if (isHiragana(charCode)) {\n    return CharacterType.HIRAGANA_LETTER;\n  } else if (isHalfwidthKatakana(charCode)) {\n    return CharacterType.HALFWIDTH_KATAKANA_LETTER;\n  }\n  return CharacterType.ALPHA_LETTER;\n}\n\nexport { CharacterType, getCharacterType };\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\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { isValidRotation, parseQueryString } from \"./ui_utils.js\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n// Heuristic value used when force-resetting `this._blockHashChange`.\nconst HASH_CHANGE_TIMEOUT = 1000; // milliseconds\n// Heuristic value used when adding the current position to the browser history.\nconst POSITION_UPDATED_THRESHOLD = 50;\n// Heuristic value used when adding a temporary position to the browser history.\nconst UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds\n\n/**\n * @typedef {Object} PDFHistoryOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} InitializeParameters\n * @property {string} fingerprint - The PDF document's unique fingerprint.\n * @property {boolean} [resetHistory] - Reset the browsing history.\n * @property {boolean} [updateUrl] - Attempt to update the document URL, with\n *   the current hash, when pushing/replacing browser history entries.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} [namedDest] - The named destination. If absent, a\n *   stringified version of `explicitDest` is used.\n * @property {Array} explicitDest - The explicit destination array.\n * @property {number} pageNumber - The page to which the destination points.\n */\n\nfunction getCurrentHash() {\n  return document.location.hash;\n}\n\nclass PDFHistory {\n  /**\n   * @param {PDFHistoryOptions} options\n   */\n  constructor({ linkService, eventBus }) {\n    this.linkService = linkService;\n    this.eventBus = eventBus;\n\n    this._initialized = false;\n    this._fingerprint = \"\";\n    this.reset();\n\n    this._boundEvents = null;\n    // Ensure that we don't miss a \"pagesinit\" event,\n    // by registering the listener immediately.\n    this.eventBus._on(\"pagesinit\", () => {\n      this._isPagesLoaded = false;\n\n      this.eventBus._on(\n        \"pagesloaded\",\n        evt => {\n          this._isPagesLoaded = !!evt.pagesCount;\n        },\n        { once: true }\n      );\n    });\n  }\n\n  /**\n   * Initialize the history for the PDF document, using either the current\n   * browser history entry or the document hash, whichever is present.\n   * @param {InitializeParameters} params\n   */\n  initialize({ fingerprint, resetHistory = false, updateUrl = false }) {\n    if (!fingerprint || typeof fingerprint !== \"string\") {\n      console.error(\n        'PDFHistory.initialize: The \"fingerprint\" must be a non-empty string.'\n      );\n      return;\n    }\n    // Ensure that any old state is always reset upon initialization.\n    if (this._initialized) {\n      this.reset();\n    }\n    const reInitialized =\n      this._fingerprint !== \"\" && this._fingerprint !== fingerprint;\n    this._fingerprint = fingerprint;\n    this._updateUrl = updateUrl === true;\n\n    this._initialized = true;\n    this._bindEvents();\n    const state = window.history.state;\n\n    this._popStateInProgress = false;\n    this._blockHashChange = 0;\n    this._currentHash = getCurrentHash();\n    this._numPositionUpdates = 0;\n\n    this._uid = this._maxUid = 0;\n    this._destination = null;\n    this._position = null;\n\n    if (!this._isValidState(state, /* checkReload = */ true) || resetHistory) {\n      const { hash, page, rotation } = this._parseCurrentHash(\n        /* checkNameddest = */ true\n      );\n\n      if (!hash || reInitialized || resetHistory) {\n        // Ensure that the browser history is reset on PDF document load.\n        this._pushOrReplaceState(null, /* forceReplace = */ true);\n        return;\n      }\n      // Ensure that the browser history is initialized correctly when\n      // the document hash is present on PDF document load.\n      this._pushOrReplaceState(\n        { hash, page, rotation },\n        /* forceReplace = */ true\n      );\n      return;\n    }\n\n    // The browser history contains a valid entry, ensure that the history is\n    // initialized correctly on PDF document load.\n    const destination = state.destination;\n    this._updateInternalState(\n      destination,\n      state.uid,\n      /* removeTemporary = */ true\n    );\n\n    if (destination.rotation !== undefined) {\n      this._initialRotation = destination.rotation;\n    }\n    if (destination.dest) {\n      this._initialBookmark = JSON.stringify(destination.dest);\n\n      // If the history is updated, e.g. through the user changing the hash,\n      // before the initial destination has become visible, then we do *not*\n      // want to potentially add `this._position` to the browser history.\n      this._destination.page = null;\n    } else if (destination.hash) {\n      this._initialBookmark = destination.hash;\n    } else if (destination.page) {\n      // Fallback case; shouldn't be necessary, but better safe than sorry.\n      this._initialBookmark = `page=${destination.page}`;\n    }\n  }\n\n  /**\n   * Reset the current `PDFHistory` instance, and consequently prevent any\n   * further updates and/or navigation of the browser history.\n   */\n  reset() {\n    if (this._initialized) {\n      this._pageHide(); // Simulate a 'pagehide' event when resetting.\n\n      this._initialized = false;\n      this._unbindEvents();\n    }\n    if (this._updateViewareaTimeout) {\n      clearTimeout(this._updateViewareaTimeout);\n      this._updateViewareaTimeout = null;\n    }\n    this._initialBookmark = null;\n    this._initialRotation = null;\n  }\n\n  /**\n   * Push an internal destination to the browser history.\n   * @param {PushParameters}\n   */\n  push({ namedDest = null, explicitDest, pageNumber }) {\n    if (!this._initialized) {\n      return;\n    }\n    if (namedDest && typeof namedDest !== \"string\") {\n      console.error(\n        \"PDFHistory.push: \" +\n          `\"${namedDest}\" is not a valid namedDest parameter.`\n      );\n      return;\n    } else if (!Array.isArray(explicitDest)) {\n      console.error(\n        \"PDFHistory.push: \" +\n          `\"${explicitDest}\" is not a valid explicitDest parameter.`\n      );\n      return;\n    } else if (!this._isValidPage(pageNumber)) {\n      // Allow an unset `pageNumber` if and only if the history is still empty;\n      // please refer to the `this._destination.page = null;` comment above.\n      if (pageNumber !== null || this._destination) {\n        console.error(\n          \"PDFHistory.push: \" +\n            `\"${pageNumber}\" is not a valid pageNumber parameter.`\n        );\n        return;\n      }\n    }\n\n    const hash = namedDest || JSON.stringify(explicitDest);\n    if (!hash) {\n      // The hash *should* never be undefined, but if that were to occur,\n      // avoid any possible issues by not updating the browser history.\n      return;\n    }\n\n    let forceReplace = false;\n    if (\n      this._destination &&\n      (isDestHashesEqual(this._destination.hash, hash) ||\n        isDestArraysEqual(this._destination.dest, explicitDest))\n    ) {\n      // When the new destination is identical to `this._destination`, and\n      // its `page` is undefined, replace the current browser history entry.\n      // NOTE: This can only occur if `this._destination` was set either:\n      //  - through the document hash being specified on load.\n      //  - through the user changing the hash of the document.\n      if (this._destination.page) {\n        return;\n      }\n      forceReplace = true;\n    }\n    if (this._popStateInProgress && !forceReplace) {\n      return;\n    }\n\n    this._pushOrReplaceState(\n      {\n        dest: explicitDest,\n        hash,\n        page: pageNumber,\n        rotation: this.linkService.rotation,\n      },\n      forceReplace\n    );\n\n    if (!this._popStateInProgress) {\n      // Prevent the browser history from updating while the new destination is\n      // being scrolled into view, to avoid potentially inconsistent state.\n      this._popStateInProgress = true;\n      // We defer the resetting of `this._popStateInProgress`, to account for\n      // e.g. zooming occurring when the new destination is being navigated to.\n      Promise.resolve().then(() => {\n        this._popStateInProgress = false;\n      });\n    }\n  }\n\n  /**\n   * Push a page to the browser history; generally the `push` method should be\n   * used instead.\n   * @param {number} pageNumber\n   */\n  pushPage(pageNumber) {\n    if (!this._initialized) {\n      return;\n    }\n    if (!this._isValidPage(pageNumber)) {\n      console.error(\n        `PDFHistory.pushPage: \"${pageNumber}\" is not a valid page number.`\n      );\n      return;\n    }\n\n    if (this._destination?.page === pageNumber) {\n      // When the new page is identical to the one in `this._destination`, we\n      // don't want to add a potential duplicate entry in the browser history.\n      return;\n    }\n    if (this._popStateInProgress) {\n      return;\n    }\n\n    this._pushOrReplaceState({\n      // Simulate an internal destination, for `this._tryPushCurrentPosition`:\n      dest: null,\n      hash: `page=${pageNumber}`,\n      page: pageNumber,\n      rotation: this.linkService.rotation,\n    });\n\n    if (!this._popStateInProgress) {\n      // Prevent the browser history from updating while the new page is\n      // being scrolled into view, to avoid potentially inconsistent state.\n      this._popStateInProgress = true;\n      // We defer the resetting of `this._popStateInProgress`, to account for\n      // e.g. zooming occurring when the new page is being navigated to.\n      Promise.resolve().then(() => {\n        this._popStateInProgress = false;\n      });\n    }\n  }\n\n  /**\n   * Push the current position to the browser history.\n   */\n  pushCurrentPosition() {\n    if (!this._initialized || this._popStateInProgress) {\n      return;\n    }\n    this._tryPushCurrentPosition();\n  }\n\n  /**\n   * Go back one step in the browser history.\n   * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n   */\n  back() {\n    if (!this._initialized || this._popStateInProgress) {\n      return;\n    }\n    const state = window.history.state;\n    if (this._isValidState(state) && state.uid > 0) {\n      window.history.back();\n    }\n  }\n\n  /**\n   * Go forward one step in the browser history.\n   * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n   */\n  forward() {\n    if (!this._initialized || this._popStateInProgress) {\n      return;\n    }\n    const state = window.history.state;\n    if (this._isValidState(state) && state.uid < this._maxUid) {\n      window.history.forward();\n    }\n  }\n\n  /**\n   * @type {boolean} Indicating if the user is currently moving through the\n   *   browser history, useful e.g. for skipping the next 'hashchange' event.\n   */\n  get popStateInProgress() {\n    return (\n      this._initialized &&\n      (this._popStateInProgress || this._blockHashChange > 0)\n    );\n  }\n\n  get initialBookmark() {\n    return this._initialized ? this._initialBookmark : null;\n  }\n\n  get initialRotation() {\n    return this._initialized ? this._initialRotation : null;\n  }\n\n  /**\n   * @private\n   */\n  _pushOrReplaceState(destination, forceReplace = false) {\n    const shouldReplace = forceReplace || !this._destination;\n    const newState = {\n      fingerprint: this._fingerprint,\n      uid: shouldReplace ? this._uid : this._uid + 1,\n      destination,\n    };\n\n    if (\n      typeof PDFJSDev !== \"undefined\" &&\n      PDFJSDev.test(\"CHROME\") &&\n      window.history.state?.chromecomState\n    ) {\n      // history.state.chromecomState is managed by chromecom.js.\n      newState.chromecomState = window.history.state.chromecomState;\n    }\n    this._updateInternalState(destination, newState.uid);\n\n    let newUrl;\n    if (this._updateUrl && destination?.hash) {\n      const baseUrl = document.location.href.split(\"#\")[0];\n      // Prevent errors in Firefox.\n      if (!baseUrl.startsWith(\"file://\")) {\n        newUrl = `${baseUrl}#${destination.hash}`;\n      }\n    }\n    if (shouldReplace) {\n      window.history.replaceState(newState, \"\", newUrl);\n    } else {\n      window.history.pushState(newState, \"\", newUrl);\n    }\n\n    if (\n      typeof PDFJSDev !== \"undefined\" &&\n      PDFJSDev.test(\"CHROME\") &&\n      top === window\n    ) {\n      // eslint-disable-next-line no-undef\n      chrome.runtime.sendMessage(\"showPageAction\");\n    }\n  }\n\n  /**\n   * @private\n   */\n  _tryPushCurrentPosition(temporary = false) {\n    if (!this._position) {\n      return;\n    }\n    let position = this._position;\n    if (temporary) {\n      position = Object.assign(Object.create(null), this._position);\n      position.temporary = true;\n    }\n\n    if (!this._destination) {\n      this._pushOrReplaceState(position);\n      return;\n    }\n    if (this._destination.temporary) {\n      // Always replace a previous *temporary* position.\n      this._pushOrReplaceState(position, /* forceReplace = */ true);\n      return;\n    }\n    if (this._destination.hash === position.hash) {\n      return; // The current document position has not changed.\n    }\n    if (\n      !this._destination.page &&\n      (POSITION_UPDATED_THRESHOLD <= 0 ||\n        this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)\n    ) {\n      // `this._destination` was set through the user changing the hash of\n      // the document. Do not add `this._position` to the browser history,\n      // to avoid \"flooding\" it with lots of (nearly) identical entries,\n      // since we cannot ensure that the document position has changed.\n      return;\n    }\n\n    let forceReplace = false;\n    if (\n      this._destination.page >= position.first &&\n      this._destination.page <= position.page\n    ) {\n      // When the `page` of `this._destination` is still visible, do not\n      // update the browsing history when `this._destination` either:\n      //  - contains an internal destination, since in this case we\n      //    cannot ensure that the document position has actually changed.\n      //  - was set through the user changing the hash of the document.\n      if (this._destination.dest !== undefined || !this._destination.first) {\n        return;\n      }\n      // To avoid \"flooding\" the browser history, replace the current entry.\n      forceReplace = true;\n    }\n    this._pushOrReplaceState(position, forceReplace);\n  }\n\n  /**\n   * @private\n   */\n  _isValidPage(val) {\n    return (\n      Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n    );\n  }\n\n  /**\n   * @private\n   */\n  _isValidState(state, checkReload = false) {\n    if (!state) {\n      return false;\n    }\n    if (state.fingerprint !== this._fingerprint) {\n      if (checkReload) {\n        // Potentially accept the history entry, even if the fingerprints don't\n        // match, when the viewer was reloaded (see issue 6847).\n        if (\n          typeof state.fingerprint !== \"string\" ||\n          state.fingerprint.length !== this._fingerprint.length\n        ) {\n          return false;\n        }\n        const [perfEntry] = performance.getEntriesByType(\"navigation\");\n        if (perfEntry?.type !== \"reload\") {\n          return false;\n        }\n      } else {\n        // This should only occur in viewers with support for opening more than\n        // one PDF document, e.g. the GENERIC viewer.\n        return false;\n      }\n    }\n    if (!Number.isInteger(state.uid) || state.uid < 0) {\n      return false;\n    }\n    if (state.destination === null || typeof state.destination !== \"object\") {\n      return false;\n    }\n    return true;\n  }\n\n  /**\n   * @private\n   */\n  _updateInternalState(destination, uid, removeTemporary = false) {\n    if (this._updateViewareaTimeout) {\n      // When updating `this._destination`, make sure that we always wait for\n      // the next 'updateviewarea' event before (potentially) attempting to\n      // push the current position to the browser history.\n      clearTimeout(this._updateViewareaTimeout);\n      this._updateViewareaTimeout = null;\n    }\n    if (removeTemporary && destination?.temporary) {\n      // When the `destination` comes from the browser history,\n      // we no longer treat it as a *temporary* position.\n      delete destination.temporary;\n    }\n    this._destination = destination;\n    this._uid = uid;\n    this._maxUid = Math.max(this._maxUid, uid);\n    // This should always be reset when `this._destination` is updated.\n    this._numPositionUpdates = 0;\n  }\n\n  /**\n   * @private\n   */\n  _parseCurrentHash(checkNameddest = false) {\n    const hash = unescape(getCurrentHash()).substring(1);\n    const params = parseQueryString(hash);\n\n    const nameddest = params.get(\"nameddest\") || \"\";\n    let page = params.get(\"page\") | 0;\n\n    if (!this._isValidPage(page) || (checkNameddest && nameddest.length > 0)) {\n      page = null;\n    }\n    return { hash, page, rotation: this.linkService.rotation };\n  }\n\n  /**\n   * @private\n   */\n  _updateViewarea({ location }) {\n    if (this._updateViewareaTimeout) {\n      clearTimeout(this._updateViewareaTimeout);\n      this._updateViewareaTimeout = null;\n    }\n\n    this._position = {\n      hash: location.pdfOpenParams.substring(1),\n      page: this.linkService.page,\n      first: location.pageNumber,\n      rotation: location.rotation,\n    };\n\n    if (this._popStateInProgress) {\n      return;\n    }\n\n    if (\n      POSITION_UPDATED_THRESHOLD > 0 &&\n      this._isPagesLoaded &&\n      this._destination &&\n      !this._destination.page\n    ) {\n      // If the current destination was set through the user changing the hash\n      // of the document, we will usually not try to push the current position\n      // to the browser history; see `this._tryPushCurrentPosition()`.\n      //\n      // To prevent `this._tryPushCurrentPosition()` from effectively being\n      // reduced to a no-op in this case, we will assume that the position\n      // *did* in fact change if the 'updateviewarea' event was dispatched\n      // more than `POSITION_UPDATED_THRESHOLD` times.\n      this._numPositionUpdates++;\n    }\n\n    if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n      // When closing the browser, a 'pagehide' event will be dispatched which\n      // *should* allow us to push the current position to the browser history.\n      // In practice, it seems that the event is arriving too late in order for\n      // the session history to be successfully updated.\n      // (For additional details, please refer to the discussion in\n      //  https://bugzilla.mozilla.org/show_bug.cgi?id=1153393.)\n      //\n      // To workaround this we attempt to *temporarily* add the current position\n      // to the browser history only when the viewer is *idle*,\n      // i.e. when scrolling and/or zooming does not occur.\n      //\n      // PLEASE NOTE: It's absolutely imperative that the browser history is\n      // *not* updated too often, since that would render the viewer more or\n      // less unusable. Hence the use of a timeout to delay the update until\n      // the viewer has been idle for `UPDATE_VIEWAREA_TIMEOUT` milliseconds.\n      this._updateViewareaTimeout = setTimeout(() => {\n        if (!this._popStateInProgress) {\n          this._tryPushCurrentPosition(/* temporary = */ true);\n        }\n        this._updateViewareaTimeout = null;\n      }, UPDATE_VIEWAREA_TIMEOUT);\n    }\n  }\n\n  /**\n   * @private\n   */\n  _popState({ state }) {\n    const newHash = getCurrentHash(),\n      hashChanged = this._currentHash !== newHash;\n    this._currentHash = newHash;\n\n    if (\n      (typeof PDFJSDev !== \"undefined\" &&\n        PDFJSDev.test(\"CHROME\") &&\n        state?.chromecomState &&\n        !this._isValidState(state)) ||\n      !state\n    ) {\n      // This case corresponds to the user changing the hash of the document.\n      this._uid++;\n\n      const { hash, page, rotation } = this._parseCurrentHash();\n      this._pushOrReplaceState(\n        { hash, page, rotation },\n        /* forceReplace = */ true\n      );\n      return;\n    }\n    if (!this._isValidState(state)) {\n      // This should only occur in viewers with support for opening more than\n      // one PDF document, e.g. the GENERIC viewer.\n      return;\n    }\n\n    // Prevent the browser history from updating until the new destination,\n    // as stored in the browser history, has been scrolled into view.\n    this._popStateInProgress = true;\n\n    if (hashChanged) {\n      // When the hash changed, implying that the 'popstate' event will be\n      // followed by a 'hashchange' event, then we do *not* want to update the\n      // browser history when handling the 'hashchange' event (in web/app.js)\n      // since that would *overwrite* the new destination navigated to below.\n      //\n      // To avoid accidentally disabling all future user-initiated hash changes,\n      // if there's e.g. another 'hashchange' listener that stops the event\n      // propagation, we make sure to always force-reset `this._blockHashChange`\n      // after `HASH_CHANGE_TIMEOUT` milliseconds have passed.\n      this._blockHashChange++;\n      waitOnEventOrTimeout({\n        target: window,\n        name: \"hashchange\",\n        delay: HASH_CHANGE_TIMEOUT,\n      }).then(() => {\n        this._blockHashChange--;\n      });\n    }\n\n    // Navigate to the new destination.\n    const destination = state.destination;\n    this._updateInternalState(\n      destination,\n      state.uid,\n      /* removeTemporary = */ true\n    );\n\n    if (isValidRotation(destination.rotation)) {\n      this.linkService.rotation = destination.rotation;\n    }\n    if (destination.dest) {\n      this.linkService.goToDestination(destination.dest);\n    } else if (destination.hash) {\n      this.linkService.setHash(destination.hash);\n    } else if (destination.page) {\n      // Fallback case; shouldn't be necessary, but better safe than sorry.\n      this.linkService.page = destination.page;\n    }\n\n    // Since `PDFLinkService.goToDestination` is asynchronous, we thus defer the\n    // resetting of `this._popStateInProgress` slightly.\n    Promise.resolve().then(() => {\n      this._popStateInProgress = false;\n    });\n  }\n\n  /**\n   * @private\n   */\n  _pageHide() {\n    // Attempt to push the `this._position` into the browser history when\n    // navigating away from the document. This is *only* done if the history\n    // is empty/temporary, since otherwise an existing browser history entry\n    // will end up being overwritten (given that new entries cannot be pushed\n    // into the browser history when the 'unload' event has already fired).\n    if (!this._destination || this._destination.temporary) {\n      this._tryPushCurrentPosition();\n    }\n  }\n\n  /**\n   * @private\n   */\n  _bindEvents() {\n    if (this._boundEvents) {\n      return; // The event listeners were already added.\n    }\n    this._boundEvents = {\n      updateViewarea: this._updateViewarea.bind(this),\n      popState: this._popState.bind(this),\n      pageHide: this._pageHide.bind(this),\n    };\n\n    this.eventBus._on(\"updateviewarea\", this._boundEvents.updateViewarea);\n    window.addEventListener(\"popstate\", this._boundEvents.popState);\n    window.addEventListener(\"pagehide\", this._boundEvents.pageHide);\n  }\n\n  /**\n   * @private\n   */\n  _unbindEvents() {\n    if (!this._boundEvents) {\n      return; // The event listeners were already removed.\n    }\n    this.eventBus._off(\"updateviewarea\", this._boundEvents.updateViewarea);\n    window.removeEventListener(\"popstate\", this._boundEvents.popState);\n    window.removeEventListener(\"pagehide\", this._boundEvents.pageHide);\n\n    this._boundEvents = null;\n  }\n}\n\nfunction isDestHashesEqual(destHash, pushHash) {\n  if (typeof destHash !== \"string\" || typeof pushHash !== \"string\") {\n    return false;\n  }\n  if (destHash === pushHash) {\n    return true;\n  }\n  const nameddest = parseQueryString(destHash).get(\"nameddest\");\n  if (nameddest === pushHash) {\n    return true;\n  }\n  return false;\n}\n\nfunction isDestArraysEqual(firstDest, secondDest) {\n  function isEntryEqual(first, second) {\n    if (typeof first !== typeof second) {\n      return false;\n    }\n    if (Array.isArray(first) || Array.isArray(second)) {\n      return false;\n    }\n    if (first !== null && typeof first === \"object\" && second !== null) {\n      if (Object.keys(first).length !== Object.keys(second).length) {\n        return false;\n      }\n      for (const key in first) {\n        if (!isEntryEqual(first[key], second[key])) {\n          return false;\n        }\n      }\n      return true;\n    }\n    return first === second || (Number.isNaN(first) && Number.isNaN(second));\n  }\n\n  if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {\n    return false;\n  }\n  if (firstDest.length !== secondDest.length) {\n    return false;\n  }\n  for (let i = 0, ii = firstDest.length; i < ii; i++) {\n    if (!isEntryEqual(firstDest[i], secondDest[i])) {\n      return false;\n    }\n  }\n  return true;\n}\n\nexport { isDestArraysEqual, isDestHashesEqual, PDFHistory };\n","/* Copyright 2020 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 { BaseTreeViewer } from \"./base_tree_viewer.js\";\n\n/**\n * @typedef {Object} PDFLayerViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IL10n} l10n - Localization service.\n */\n\n/**\n * @typedef {Object} PDFLayerViewerRenderParameters\n * @property {OptionalContentConfig|null} optionalContentConfig - An\n *   {OptionalContentConfig} instance.\n * @property {PDFDocument} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFLayerViewer extends BaseTreeViewer {\n  constructor(options) {\n    super(options);\n    this.l10n = options.l10n;\n\n    this.eventBus._on(\"optionalcontentconfigchanged\", evt => {\n      this.#updateLayers(evt.promise);\n    });\n    this.eventBus._on(\"resetlayers\", () => {\n      this.#updateLayers();\n    });\n    this.eventBus._on(\"togglelayerstree\", this._toggleAllTreeItems.bind(this));\n  }\n\n  reset() {\n    super.reset();\n    this._optionalContentConfig = null;\n    this._optionalContentHash = null;\n  }\n\n  /**\n   * @private\n   */\n  _dispatchEvent(layersCount) {\n    this.eventBus.dispatch(\"layersloaded\", {\n      source: this,\n      layersCount,\n    });\n  }\n\n  /**\n   * @private\n   */\n  _bindLink(element, { groupId, input }) {\n    const setVisibility = () => {\n      this._optionalContentConfig.setVisibility(groupId, input.checked);\n      this._optionalContentHash = this._optionalContentConfig.getHash();\n\n      this.eventBus.dispatch(\"optionalcontentconfig\", {\n        source: this,\n        promise: Promise.resolve(this._optionalContentConfig),\n      });\n    };\n\n    element.onclick = evt => {\n      if (evt.target === input) {\n        setVisibility();\n        return true;\n      } else if (evt.target !== element) {\n        return true; // The target is the \"label\", which is handled above.\n      }\n      input.checked = !input.checked;\n      setVisibility();\n      return false;\n    };\n  }\n\n  /**\n   * @private\n   */\n  async _setNestedName(element, { name = null }) {\n    if (typeof name === \"string\") {\n      element.textContent = this._normalizeTextContent(name);\n      return;\n    }\n    element.textContent = await this.l10n.get(\"additional_layers\");\n    element.style.fontStyle = \"italic\";\n  }\n\n  /**\n   * @private\n   */\n  _addToggleButton(div, { name = null }) {\n    super._addToggleButton(div, /* hidden = */ name === null);\n  }\n\n  /**\n   * @private\n   */\n  _toggleAllTreeItems() {\n    if (!this._optionalContentConfig) {\n      return;\n    }\n    super._toggleAllTreeItems();\n  }\n\n  /**\n   * @param {PDFLayerViewerRenderParameters} params\n   */\n  render({ optionalContentConfig, pdfDocument }) {\n    if (this._optionalContentConfig) {\n      this.reset();\n    }\n    this._optionalContentConfig = optionalContentConfig || null;\n    this._pdfDocument = pdfDocument || null;\n\n    const groups = optionalContentConfig?.getOrder();\n    if (!groups) {\n      this._dispatchEvent(/* layersCount = */ 0);\n      return;\n    }\n    this._optionalContentHash = optionalContentConfig.getHash();\n\n    const fragment = document.createDocumentFragment(),\n      queue = [{ parent: fragment, groups }];\n    let layersCount = 0,\n      hasAnyNesting = false;\n    while (queue.length > 0) {\n      const levelData = queue.shift();\n      for (const groupId of levelData.groups) {\n        const div = document.createElement(\"div\");\n        div.className = \"treeItem\";\n\n        const element = document.createElement(\"a\");\n        div.append(element);\n\n        if (typeof groupId === \"object\") {\n          hasAnyNesting = true;\n          this._addToggleButton(div, groupId);\n          this._setNestedName(element, groupId);\n\n          const itemsDiv = document.createElement(\"div\");\n          itemsDiv.className = \"treeItems\";\n          div.append(itemsDiv);\n\n          queue.push({ parent: itemsDiv, groups: groupId.order });\n        } else {\n          const group = optionalContentConfig.getGroup(groupId);\n\n          const input = document.createElement(\"input\");\n          this._bindLink(element, { groupId, input });\n          input.type = \"checkbox\";\n          input.checked = group.visible;\n\n          const label = document.createElement(\"label\");\n          label.textContent = this._normalizeTextContent(group.name);\n\n          label.append(input);\n          element.append(label);\n          layersCount++;\n        }\n\n        levelData.parent.append(div);\n      }\n    }\n\n    this._finishRendering(fragment, layersCount, hasAnyNesting);\n  }\n\n  async #updateLayers(promise = null) {\n    if (!this._optionalContentConfig) {\n      return;\n    }\n    const pdfDocument = this._pdfDocument;\n    const optionalContentConfig = await (promise ||\n      pdfDocument.getOptionalContentConfig());\n\n    if (pdfDocument !== this._pdfDocument) {\n      return; // The document was closed while the optional content resolved.\n    }\n    if (promise) {\n      if (optionalContentConfig.getHash() === this._optionalContentHash) {\n        return; // The optional content didn't change, hence no need to reset the UI.\n      }\n    } else {\n      this.eventBus.dispatch(\"optionalcontentconfig\", {\n        source: this,\n        promise: Promise.resolve(optionalContentConfig),\n      });\n    }\n\n    // Reset the sidebarView to the new state.\n    this.render({\n      optionalContentConfig,\n      pdfDocument: this._pdfDocument,\n    });\n  }\n}\n\nexport { PDFLayerViewer };\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 { BaseTreeViewer } from \"./base_tree_viewer.js\";\nimport { createPromiseCapability } from \"pdfjs-lib\";\nimport { SidebarView } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} PDFOutlineViewerOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {DownloadManager} downloadManager - The download manager.\n */\n\n/**\n * @typedef {Object} PDFOutlineViewerRenderParameters\n * @property {Array|null} outline - An array of outline objects.\n * @property {PDFDocument} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFOutlineViewer extends BaseTreeViewer {\n  /**\n   * @param {PDFOutlineViewerOptions} options\n   */\n  constructor(options) {\n    super(options);\n    this.linkService = options.linkService;\n    this.downloadManager = options.downloadManager;\n\n    this.eventBus._on(\"toggleoutlinetree\", this._toggleAllTreeItems.bind(this));\n    this.eventBus._on(\n      \"currentoutlineitem\",\n      this._currentOutlineItem.bind(this)\n    );\n\n    this.eventBus._on(\"pagechanging\", evt => {\n      this._currentPageNumber = evt.pageNumber;\n    });\n    this.eventBus._on(\"pagesloaded\", evt => {\n      this._isPagesLoaded = !!evt.pagesCount;\n\n      // If the capability is still pending, see the `_dispatchEvent`-method,\n      // we know that the `currentOutlineItem`-button can be enabled here.\n      if (\n        this._currentOutlineItemCapability &&\n        !this._currentOutlineItemCapability.settled\n      ) {\n        this._currentOutlineItemCapability.resolve(\n          /* enabled = */ this._isPagesLoaded\n        );\n      }\n    });\n    this.eventBus._on(\"sidebarviewchanged\", evt => {\n      this._sidebarView = evt.view;\n    });\n  }\n\n  reset() {\n    super.reset();\n    this._outline = null;\n\n    this._pageNumberToDestHashCapability = null;\n    this._currentPageNumber = 1;\n    this._isPagesLoaded = null;\n\n    if (\n      this._currentOutlineItemCapability &&\n      !this._currentOutlineItemCapability.settled\n    ) {\n      this._currentOutlineItemCapability.resolve(/* enabled = */ false);\n    }\n    this._currentOutlineItemCapability = null;\n  }\n\n  /**\n   * @private\n   */\n  _dispatchEvent(outlineCount) {\n    this._currentOutlineItemCapability = createPromiseCapability();\n    if (\n      outlineCount === 0 ||\n      this._pdfDocument?.loadingParams.disableAutoFetch\n    ) {\n      this._currentOutlineItemCapability.resolve(/* enabled = */ false);\n    } else if (this._isPagesLoaded !== null) {\n      this._currentOutlineItemCapability.resolve(\n        /* enabled = */ this._isPagesLoaded\n      );\n    }\n\n    this.eventBus.dispatch(\"outlineloaded\", {\n      source: this,\n      outlineCount,\n      currentOutlineItemPromise: this._currentOutlineItemCapability.promise,\n    });\n  }\n\n  /**\n   * @private\n   */\n  _bindLink(\n    element,\n    { url, newWindow, action, attachment, dest, setOCGState }\n  ) {\n    const { linkService } = this;\n\n    if (url) {\n      linkService.addLinkAttributes(element, url, newWindow);\n      return;\n    }\n    if (action) {\n      element.href = linkService.getAnchorUrl(\"\");\n      element.onclick = () => {\n        linkService.executeNamedAction(action);\n        return false;\n      };\n      return;\n    }\n    if (attachment) {\n      element.href = linkService.getAnchorUrl(\"\");\n      element.onclick = () => {\n        this.downloadManager.openOrDownloadData(\n          element,\n          attachment.content,\n          attachment.filename\n        );\n        return false;\n      };\n      return;\n    }\n    if (setOCGState) {\n      element.href = linkService.getAnchorUrl(\"\");\n      element.onclick = () => {\n        linkService.executeSetOCGState(setOCGState);\n        return false;\n      };\n      return;\n    }\n\n    element.href = linkService.getDestinationHash(dest);\n    element.onclick = evt => {\n      this._updateCurrentTreeItem(evt.target.parentNode);\n\n      if (dest) {\n        linkService.goToDestination(dest);\n      }\n      return false;\n    };\n  }\n\n  /**\n   * @private\n   */\n  _setStyles(element, { bold, italic }) {\n    if (bold) {\n      element.style.fontWeight = \"bold\";\n    }\n    if (italic) {\n      element.style.fontStyle = \"italic\";\n    }\n  }\n\n  /**\n   * @private\n   */\n  _addToggleButton(div, { count, items }) {\n    let hidden = false;\n    if (count < 0) {\n      let totalCount = items.length;\n      if (totalCount > 0) {\n        const queue = [...items];\n        while (queue.length > 0) {\n          const { count: nestedCount, items: nestedItems } = queue.shift();\n          if (nestedCount > 0 && nestedItems.length > 0) {\n            totalCount += nestedItems.length;\n            queue.push(...nestedItems);\n          }\n        }\n      }\n      if (Math.abs(count) === totalCount) {\n        hidden = true;\n      }\n    }\n    super._addToggleButton(div, hidden);\n  }\n\n  /**\n   * @private\n   */\n  _toggleAllTreeItems() {\n    if (!this._outline) {\n      return;\n    }\n    super._toggleAllTreeItems();\n  }\n\n  /**\n   * @param {PDFOutlineViewerRenderParameters} params\n   */\n  render({ outline, pdfDocument }) {\n    if (this._outline) {\n      this.reset();\n    }\n    this._outline = outline || null;\n    this._pdfDocument = pdfDocument || null;\n\n    if (!outline) {\n      this._dispatchEvent(/* outlineCount = */ 0);\n      return;\n    }\n\n    const fragment = document.createDocumentFragment();\n    const queue = [{ parent: fragment, items: outline }];\n    let outlineCount = 0,\n      hasAnyNesting = false;\n    while (queue.length > 0) {\n      const levelData = queue.shift();\n      for (const item of levelData.items) {\n        const div = document.createElement(\"div\");\n        div.className = \"treeItem\";\n\n        const element = document.createElement(\"a\");\n        this._bindLink(element, item);\n        this._setStyles(element, item);\n        element.textContent = this._normalizeTextContent(item.title);\n\n        div.append(element);\n\n        if (item.items.length > 0) {\n          hasAnyNesting = true;\n          this._addToggleButton(div, item);\n\n          const itemsDiv = document.createElement(\"div\");\n          itemsDiv.className = \"treeItems\";\n          div.append(itemsDiv);\n\n          queue.push({ parent: itemsDiv, items: item.items });\n        }\n\n        levelData.parent.append(div);\n        outlineCount++;\n      }\n    }\n\n    this._finishRendering(fragment, outlineCount, hasAnyNesting);\n  }\n\n  /**\n   * Find/highlight the current outline item, corresponding to the active page.\n   * @private\n   */\n  async _currentOutlineItem() {\n    if (!this._isPagesLoaded) {\n      throw new Error(\"_currentOutlineItem: All pages have not been loaded.\");\n    }\n    if (!this._outline || !this._pdfDocument) {\n      return;\n    }\n\n    const pageNumberToDestHash = await this._getPageNumberToDestHash(\n      this._pdfDocument\n    );\n    if (!pageNumberToDestHash) {\n      return;\n    }\n    this._updateCurrentTreeItem(/* treeItem = */ null);\n\n    if (this._sidebarView !== SidebarView.OUTLINE) {\n      return; // The outline view is no longer visible, hence do nothing.\n    }\n    // When there is no destination on the current page, always check the\n    // previous ones in (reverse) order.\n    for (let i = this._currentPageNumber; i > 0; i--) {\n      const destHash = pageNumberToDestHash.get(i);\n      if (!destHash) {\n        continue;\n      }\n      const linkElement = this.container.querySelector(`a[href=\"${destHash}\"]`);\n      if (!linkElement) {\n        continue;\n      }\n      this._scrollToCurrentTreeItem(linkElement.parentNode);\n      break;\n    }\n  }\n\n  /**\n   * To (significantly) simplify the overall implementation, we will only\n   * consider *one* destination per page when finding/highlighting the current\n   * outline item (similar to e.g. Adobe Reader); more specifically, we choose\n   * the *first* outline item at the *lowest* level of the outline tree.\n   * @private\n   */\n  async _getPageNumberToDestHash(pdfDocument) {\n    if (this._pageNumberToDestHashCapability) {\n      return this._pageNumberToDestHashCapability.promise;\n    }\n    this._pageNumberToDestHashCapability = createPromiseCapability();\n\n    const pageNumberToDestHash = new Map(),\n      pageNumberNesting = new Map();\n    const queue = [{ nesting: 0, items: this._outline }];\n    while (queue.length > 0) {\n      const levelData = queue.shift(),\n        currentNesting = levelData.nesting;\n      for (const { dest, items } of levelData.items) {\n        let explicitDest, pageNumber;\n        if (typeof dest === \"string\") {\n          explicitDest = await pdfDocument.getDestination(dest);\n\n          if (pdfDocument !== this._pdfDocument) {\n            return null; // The document was closed while the data resolved.\n          }\n        } else {\n          explicitDest = dest;\n        }\n        if (Array.isArray(explicitDest)) {\n          const [destRef] = explicitDest;\n\n          if (typeof destRef === \"object\" && destRef !== null) {\n            pageNumber = this.linkService._cachedPageNumber(destRef);\n\n            if (!pageNumber) {\n              try {\n                pageNumber = (await pdfDocument.getPageIndex(destRef)) + 1;\n\n                if (pdfDocument !== this._pdfDocument) {\n                  return null; // The document was closed while the data resolved.\n                }\n                this.linkService.cachePageRef(pageNumber, destRef);\n              } catch (ex) {\n                // Invalid page reference, ignore it and continue parsing.\n              }\n            }\n          } else if (Number.isInteger(destRef)) {\n            pageNumber = destRef + 1;\n          }\n\n          if (\n            Number.isInteger(pageNumber) &&\n            (!pageNumberToDestHash.has(pageNumber) ||\n              currentNesting > pageNumberNesting.get(pageNumber))\n          ) {\n            const destHash = this.linkService.getDestinationHash(dest);\n            pageNumberToDestHash.set(pageNumber, destHash);\n            pageNumberNesting.set(pageNumber, currentNesting);\n          }\n        }\n\n        if (items.length > 0) {\n          queue.push({ nesting: currentNesting + 1, items });\n        }\n      }\n    }\n\n    this._pageNumberToDestHashCapability.resolve(\n      pageNumberToDestHash.size > 0 ? pageNumberToDestHash : null\n    );\n    return this._pageNumberToDestHashCapability.promise;\n  }\n}\n\nexport { PDFOutlineViewer };\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  normalizeWheelEventDelta,\n  PresentationModeState,\n  ScrollMode,\n  SpreadMode,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorType } from \"pdfjs-lib\";\n\nconst DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms\nconst ACTIVE_SELECTOR = \"pdfPresentationMode\";\nconst CONTROLS_SELECTOR = \"pdfPresentationModeControls\";\nconst MOUSE_SCROLL_COOLDOWN_TIME = 50; // in ms\nconst PAGE_SWITCH_THRESHOLD = 0.1;\n\n// Number of CSS pixels for a movement to count as a swipe.\nconst SWIPE_MIN_DISTANCE_THRESHOLD = 50;\n\n// Swipe angle deviation from the x or y axis before it is not\n// considered a swipe in that direction any more.\nconst SWIPE_ANGLE_THRESHOLD = Math.PI / 6;\n\n/**\n * @typedef {Object} PDFPresentationModeOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {PDFViewer} pdfViewer - The document viewer.\n * @property {EventBus} eventBus - The application event bus.\n */\n\nclass PDFPresentationMode {\n  #state = PresentationModeState.UNKNOWN;\n\n  #args = null;\n\n  /**\n   * @param {PDFPresentationModeOptions} options\n   */\n  constructor({ container, pdfViewer, eventBus }) {\n    this.container = container;\n    this.pdfViewer = pdfViewer;\n    this.eventBus = eventBus;\n\n    this.contextMenuOpen = false;\n    this.mouseScrollTimeStamp = 0;\n    this.mouseScrollDelta = 0;\n    this.touchSwipeState = null;\n  }\n\n  /**\n   * Request the browser to enter fullscreen mode.\n   * @returns {Promise<boolean>} Indicating if the request was successful.\n   */\n  async request() {\n    const { container, pdfViewer } = this;\n\n    if (this.active || !pdfViewer.pagesCount || !container.requestFullscreen) {\n      return false;\n    }\n    this.#addFullscreenChangeListeners();\n    this.#notifyStateChange(PresentationModeState.CHANGING);\n\n    const promise = container.requestFullscreen();\n\n    this.#args = {\n      pageNumber: pdfViewer.currentPageNumber,\n      scaleValue: pdfViewer.currentScaleValue,\n      scrollMode: pdfViewer.scrollMode,\n      spreadMode: null,\n      annotationEditorMode: null,\n    };\n\n    if (\n      pdfViewer.spreadMode !== SpreadMode.NONE &&\n      !(pdfViewer.pageViewsReady && pdfViewer.hasEqualPageSizes)\n    ) {\n      console.warn(\n        \"Ignoring Spread modes when entering PresentationMode, \" +\n          \"since the document may contain varying page sizes.\"\n      );\n      this.#args.spreadMode = pdfViewer.spreadMode;\n    }\n    if (pdfViewer.annotationEditorMode !== AnnotationEditorType.DISABLE) {\n      this.#args.annotationEditorMode = pdfViewer.annotationEditorMode;\n    }\n\n    try {\n      await promise;\n      pdfViewer.focus(); // Fixes bug 1787456.\n      return true;\n    } catch (reason) {\n      this.#removeFullscreenChangeListeners();\n      this.#notifyStateChange(PresentationModeState.NORMAL);\n    }\n    return false;\n  }\n\n  get active() {\n    return (\n      this.#state === PresentationModeState.CHANGING ||\n      this.#state === PresentationModeState.FULLSCREEN\n    );\n  }\n\n  #mouseWheel(evt) {\n    if (!this.active) {\n      return;\n    }\n    evt.preventDefault();\n\n    const delta = normalizeWheelEventDelta(evt);\n    const currentTime = Date.now();\n    const storedTime = this.mouseScrollTimeStamp;\n\n    // If we've already switched page, avoid accidentally switching again.\n    if (\n      currentTime > storedTime &&\n      currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME\n    ) {\n      return;\n    }\n    // If the scroll direction changed, reset the accumulated scroll delta.\n    if (\n      (this.mouseScrollDelta > 0 && delta < 0) ||\n      (this.mouseScrollDelta < 0 && delta > 0)\n    ) {\n      this.#resetMouseScrollState();\n    }\n    this.mouseScrollDelta += delta;\n\n    if (Math.abs(this.mouseScrollDelta) >= PAGE_SWITCH_THRESHOLD) {\n      const totalDelta = this.mouseScrollDelta;\n      this.#resetMouseScrollState();\n      const success =\n        totalDelta > 0\n          ? this.pdfViewer.previousPage()\n          : this.pdfViewer.nextPage();\n      if (success) {\n        this.mouseScrollTimeStamp = currentTime;\n      }\n    }\n  }\n\n  #notifyStateChange(state) {\n    this.#state = state;\n\n    this.eventBus.dispatch(\"presentationmodechanged\", { source: this, state });\n  }\n\n  #enter() {\n    this.#notifyStateChange(PresentationModeState.FULLSCREEN);\n    this.container.classList.add(ACTIVE_SELECTOR);\n\n    // Ensure that the correct page is scrolled into view when entering\n    // Presentation Mode, by waiting until fullscreen mode in enabled.\n    setTimeout(() => {\n      this.pdfViewer.scrollMode = ScrollMode.PAGE;\n      if (this.#args.spreadMode !== null) {\n        this.pdfViewer.spreadMode = SpreadMode.NONE;\n      }\n      this.pdfViewer.currentPageNumber = this.#args.pageNumber;\n      this.pdfViewer.currentScaleValue = \"page-fit\";\n\n      if (this.#args.annotationEditorMode !== null) {\n        this.pdfViewer.annotationEditorMode = AnnotationEditorType.NONE;\n      }\n    }, 0);\n\n    this.#addWindowListeners();\n    this.#showControls();\n    this.contextMenuOpen = false;\n\n    // Text selection is disabled in Presentation Mode, thus it's not possible\n    // for the user to deselect text that is selected (e.g. with \"Select all\")\n    // when entering Presentation Mode, hence we remove any active selection.\n    window.getSelection().removeAllRanges();\n  }\n\n  #exit() {\n    const pageNumber = this.pdfViewer.currentPageNumber;\n    this.container.classList.remove(ACTIVE_SELECTOR);\n\n    // Ensure that the correct page is scrolled into view when exiting\n    // Presentation Mode, by waiting until fullscreen mode is disabled.\n    setTimeout(() => {\n      this.#removeFullscreenChangeListeners();\n      this.#notifyStateChange(PresentationModeState.NORMAL);\n\n      this.pdfViewer.scrollMode = this.#args.scrollMode;\n      if (this.#args.spreadMode !== null) {\n        this.pdfViewer.spreadMode = this.#args.spreadMode;\n      }\n      this.pdfViewer.currentScaleValue = this.#args.scaleValue;\n      this.pdfViewer.currentPageNumber = pageNumber;\n\n      if (this.#args.annotationEditorMode !== null) {\n        this.pdfViewer.annotationEditorMode = this.#args.annotationEditorMode;\n      }\n      this.#args = null;\n    }, 0);\n\n    this.#removeWindowListeners();\n    this.#hideControls();\n    this.#resetMouseScrollState();\n    this.contextMenuOpen = false;\n  }\n\n  #mouseDown(evt) {\n    if (this.contextMenuOpen) {\n      this.contextMenuOpen = false;\n      evt.preventDefault();\n      return;\n    }\n    if (evt.button !== 0) {\n      return;\n    }\n    // Enable clicking of links in presentation mode. Note: only links\n    // pointing to destinations in the current PDF document work.\n    if (\n      evt.target.href &&\n      evt.target.parentNode?.hasAttribute(\"data-internal-link\")\n    ) {\n      return;\n    }\n    // Unless an internal link was clicked, advance one page.\n    evt.preventDefault();\n\n    if (evt.shiftKey) {\n      this.pdfViewer.previousPage();\n    } else {\n      this.pdfViewer.nextPage();\n    }\n  }\n\n  #contextMenu() {\n    this.contextMenuOpen = true;\n  }\n\n  #showControls() {\n    if (this.controlsTimeout) {\n      clearTimeout(this.controlsTimeout);\n    } else {\n      this.container.classList.add(CONTROLS_SELECTOR);\n    }\n    this.controlsTimeout = setTimeout(() => {\n      this.container.classList.remove(CONTROLS_SELECTOR);\n      delete this.controlsTimeout;\n    }, DELAY_BEFORE_HIDING_CONTROLS);\n  }\n\n  #hideControls() {\n    if (!this.controlsTimeout) {\n      return;\n    }\n    clearTimeout(this.controlsTimeout);\n    this.container.classList.remove(CONTROLS_SELECTOR);\n    delete this.controlsTimeout;\n  }\n\n  /**\n   * Resets the properties used for tracking mouse scrolling events.\n   */\n  #resetMouseScrollState() {\n    this.mouseScrollTimeStamp = 0;\n    this.mouseScrollDelta = 0;\n  }\n\n  #touchSwipe(evt) {\n    if (!this.active) {\n      return;\n    }\n    if (evt.touches.length > 1) {\n      // Multiple touch points detected; cancel the swipe.\n      this.touchSwipeState = null;\n      return;\n    }\n\n    switch (evt.type) {\n      case \"touchstart\":\n        this.touchSwipeState = {\n          startX: evt.touches[0].pageX,\n          startY: evt.touches[0].pageY,\n          endX: evt.touches[0].pageX,\n          endY: evt.touches[0].pageY,\n        };\n        break;\n      case \"touchmove\":\n        if (this.touchSwipeState === null) {\n          return;\n        }\n        this.touchSwipeState.endX = evt.touches[0].pageX;\n        this.touchSwipeState.endY = evt.touches[0].pageY;\n        // Avoid the swipe from triggering browser gestures (Chrome in\n        // particular has some sort of swipe gesture in fullscreen mode).\n        evt.preventDefault();\n        break;\n      case \"touchend\":\n        if (this.touchSwipeState === null) {\n          return;\n        }\n        let delta = 0;\n        const dx = this.touchSwipeState.endX - this.touchSwipeState.startX;\n        const dy = this.touchSwipeState.endY - this.touchSwipeState.startY;\n        const absAngle = Math.abs(Math.atan2(dy, dx));\n        if (\n          Math.abs(dx) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n          (absAngle <= SWIPE_ANGLE_THRESHOLD ||\n            absAngle >= Math.PI - SWIPE_ANGLE_THRESHOLD)\n        ) {\n          // Horizontal swipe.\n          delta = dx;\n        } else if (\n          Math.abs(dy) > SWIPE_MIN_DISTANCE_THRESHOLD &&\n          Math.abs(absAngle - Math.PI / 2) <= SWIPE_ANGLE_THRESHOLD\n        ) {\n          // Vertical swipe.\n          delta = dy;\n        }\n        if (delta > 0) {\n          this.pdfViewer.previousPage();\n        } else if (delta < 0) {\n          this.pdfViewer.nextPage();\n        }\n        break;\n    }\n  }\n\n  #addWindowListeners() {\n    this.showControlsBind = this.#showControls.bind(this);\n    this.mouseDownBind = this.#mouseDown.bind(this);\n    this.mouseWheelBind = this.#mouseWheel.bind(this);\n    this.resetMouseScrollStateBind = this.#resetMouseScrollState.bind(this);\n    this.contextMenuBind = this.#contextMenu.bind(this);\n    this.touchSwipeBind = this.#touchSwipe.bind(this);\n\n    window.addEventListener(\"mousemove\", this.showControlsBind);\n    window.addEventListener(\"mousedown\", this.mouseDownBind);\n    window.addEventListener(\"wheel\", this.mouseWheelBind, { passive: false });\n    window.addEventListener(\"keydown\", this.resetMouseScrollStateBind);\n    window.addEventListener(\"contextmenu\", this.contextMenuBind);\n    window.addEventListener(\"touchstart\", this.touchSwipeBind);\n    window.addEventListener(\"touchmove\", this.touchSwipeBind);\n    window.addEventListener(\"touchend\", this.touchSwipeBind);\n  }\n\n  #removeWindowListeners() {\n    window.removeEventListener(\"mousemove\", this.showControlsBind);\n    window.removeEventListener(\"mousedown\", this.mouseDownBind);\n    window.removeEventListener(\"wheel\", this.mouseWheelBind, {\n      passive: false,\n    });\n    window.removeEventListener(\"keydown\", this.resetMouseScrollStateBind);\n    window.removeEventListener(\"contextmenu\", this.contextMenuBind);\n    window.removeEventListener(\"touchstart\", this.touchSwipeBind);\n    window.removeEventListener(\"touchmove\", this.touchSwipeBind);\n    window.removeEventListener(\"touchend\", this.touchSwipeBind);\n\n    delete this.showControlsBind;\n    delete this.mouseDownBind;\n    delete this.mouseWheelBind;\n    delete this.resetMouseScrollStateBind;\n    delete this.contextMenuBind;\n    delete this.touchSwipeBind;\n  }\n\n  #fullscreenChange() {\n    if (/* isFullscreen = */ document.fullscreenElement) {\n      this.#enter();\n    } else {\n      this.#exit();\n    }\n  }\n\n  #addFullscreenChangeListeners() {\n    this.fullscreenChangeBind = this.#fullscreenChange.bind(this);\n    window.addEventListener(\"fullscreenchange\", this.fullscreenChangeBind);\n  }\n\n  #removeFullscreenChangeListeners() {\n    window.removeEventListener(\"fullscreenchange\", this.fullscreenChangeBind);\n    delete this.fullscreenChangeBind;\n  }\n}\n\nexport { PDFPresentationMode };\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\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n/** @typedef {import(\"./pdf_viewer\").PDFViewer} PDFViewer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_thumbnail_viewer\").PDFThumbnailViewer} PDFThumbnailViewer */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n  constructor() {\n    this.pdfViewer = null;\n    this.pdfThumbnailViewer = null;\n    this.onIdle = null;\n    this.highestPriorityPage = null;\n    /** @type {number} */\n    this.idleTimeout = null;\n    this.printing = false;\n    this.isThumbnailViewEnabled = false;\n  }\n\n  /**\n   * @param {PDFViewer} pdfViewer\n   */\n  setViewer(pdfViewer) {\n    this.pdfViewer = pdfViewer;\n  }\n\n  /**\n   * @param {PDFThumbnailViewer} pdfThumbnailViewer\n   */\n  setThumbnailViewer(pdfThumbnailViewer) {\n    this.pdfThumbnailViewer = pdfThumbnailViewer;\n  }\n\n  /**\n   * @param {IRenderableView} view\n   * @returns {boolean}\n   */\n  isHighestPriority(view) {\n    return this.highestPriorityPage === view.renderingId;\n  }\n\n  /**\n   * @returns {boolean}\n   */\n  hasViewer() {\n    return !!this.pdfViewer;\n  }\n\n  /**\n   * @param {Object} currentlyVisiblePages\n   */\n  renderHighestPriority(currentlyVisiblePages) {\n    if (this.idleTimeout) {\n      clearTimeout(this.idleTimeout);\n      this.idleTimeout = null;\n    }\n\n    // Pages have a higher priority than thumbnails, so check them first.\n    if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {\n      return;\n    }\n    // No pages needed rendering, so check thumbnails.\n    if (\n      this.isThumbnailViewEnabled &&\n      this.pdfThumbnailViewer?.forceRendering()\n    ) {\n      return;\n    }\n\n    if (this.printing) {\n      // If printing is currently ongoing do not reschedule cleanup.\n      return;\n    }\n\n    if (this.onIdle) {\n      this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);\n    }\n  }\n\n  /**\n   * @param {Object} visible\n   * @param {Array} views\n   * @param {boolean} scrolledDown\n   * @param {boolean} [preRenderExtra]\n   */\n  getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {\n    /**\n     * The state has changed. Figure out which page has the highest priority to\n     * render next (if any).\n     *\n     * Priority:\n     * 1. visible pages\n     * 2. if last scrolled down, the page after the visible pages, or\n     *    if last scrolled up, the page before the visible pages\n     */\n    const visibleViews = visible.views,\n      numVisible = visibleViews.length;\n\n    if (numVisible === 0) {\n      return null;\n    }\n    for (let i = 0; i < numVisible; i++) {\n      const view = visibleViews[i].view;\n      if (!this.isViewFinished(view)) {\n        return view;\n      }\n    }\n    const firstId = visible.first.id,\n      lastId = visible.last.id;\n\n    // All the visible views have rendered; try to handle any \"holes\" in the\n    // page layout (can happen e.g. with spreadModes at higher zoom levels).\n    if (lastId - firstId + 1 > numVisible) {\n      const visibleIds = visible.ids;\n      for (let i = 1, ii = lastId - firstId; i < ii; i++) {\n        const holeId = scrolledDown ? firstId + i : lastId - i;\n        if (visibleIds.has(holeId)) {\n          continue;\n        }\n        const holeView = views[holeId - 1];\n        if (!this.isViewFinished(holeView)) {\n          return holeView;\n        }\n      }\n    }\n\n    // All the visible views have rendered; try to render next/previous page.\n    // (IDs start at 1, so no need to add 1 when `scrolledDown === true`.)\n    let preRenderIndex = scrolledDown ? lastId : firstId - 2;\n    let preRenderView = views[preRenderIndex];\n\n    if (preRenderView && !this.isViewFinished(preRenderView)) {\n      return preRenderView;\n    }\n    if (preRenderExtra) {\n      preRenderIndex += scrolledDown ? 1 : -1;\n      preRenderView = views[preRenderIndex];\n\n      if (preRenderView && !this.isViewFinished(preRenderView)) {\n        return preRenderView;\n      }\n    }\n    // Everything that needs to be rendered has been.\n    return null;\n  }\n\n  /**\n   * @param {IRenderableView} view\n   * @returns {boolean}\n   */\n  isViewFinished(view) {\n    return view.renderingState === RenderingStates.FINISHED;\n  }\n\n  /**\n   * Render a page or thumbnail view. This calls the appropriate function\n   * based on the views state. If the view is already rendered it will return\n   * `false`.\n   *\n   * @param {IRenderableView} view\n   */\n  renderView(view) {\n    switch (view.renderingState) {\n      case RenderingStates.FINISHED:\n        return false;\n      case RenderingStates.PAUSED:\n        this.highestPriorityPage = view.renderingId;\n        view.resume();\n        break;\n      case RenderingStates.RUNNING:\n        this.highestPriorityPage = view.renderingId;\n        break;\n      case RenderingStates.INITIAL:\n        this.highestPriorityPage = view.renderingId;\n        view\n          .draw()\n          .finally(() => {\n            this.renderHighestPriority();\n          })\n          .catch(reason => {\n            if (reason instanceof RenderingCancelledException) {\n              return;\n            }\n            console.error(`renderView: \"${reason}\"`);\n          });\n        break;\n    }\n    return true;\n  }\n}\n\nexport { PDFRenderingQueue };\n","/* Copyright 2021 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/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n\nimport { apiPageLayoutToViewerModes, RenderingStates } from \"./ui_utils.js\";\nimport { createPromiseCapability, shadow } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} PDFScriptingManagerOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {string} sandboxBundleSrc - The path and filename of the scripting\n *   bundle.\n * @property {Object} [scriptingFactory] - The factory that is used when\n *   initializing scripting; must contain a `createScripting` method.\n *   PLEASE NOTE: Primarily intended for the default viewer use-case.\n * @property {function} [docPropertiesLookup] - The function that is used to\n *   lookup the necessary document properties.\n */\n\nclass PDFScriptingManager {\n  /**\n   * @param {PDFScriptingManagerOptions} options\n   */\n  constructor({\n    eventBus,\n    sandboxBundleSrc = null,\n    scriptingFactory = null,\n    docPropertiesLookup = null,\n  }) {\n    this._pdfDocument = null;\n    this._pdfViewer = null;\n    this._closeCapability = null;\n    this._destroyCapability = null;\n\n    this._scripting = null;\n    this._mouseState = Object.create(null);\n    this._ready = false;\n\n    this._eventBus = eventBus;\n    this._sandboxBundleSrc = sandboxBundleSrc;\n    this._scriptingFactory = scriptingFactory;\n    this._docPropertiesLookup = docPropertiesLookup;\n\n    // The default viewer already handles adding/removing of DOM events,\n    // hence limit this to only the viewer components.\n    if (\n      typeof PDFJSDev !== \"undefined\" &&\n      PDFJSDev.test(\"COMPONENTS\") &&\n      !this._scriptingFactory\n    ) {\n      window.addEventListener(\"updatefromsandbox\", event => {\n        this._eventBus.dispatch(\"updatefromsandbox\", {\n          source: window,\n          detail: event.detail,\n        });\n      });\n    }\n  }\n\n  setViewer(pdfViewer) {\n    this._pdfViewer = pdfViewer;\n  }\n\n  async setDocument(pdfDocument) {\n    if (this._pdfDocument) {\n      await this._destroyScripting();\n    }\n    this._pdfDocument = pdfDocument;\n\n    if (!pdfDocument) {\n      return;\n    }\n    const [objects, calculationOrder, docActions] = await Promise.all([\n      pdfDocument.getFieldObjects(),\n      pdfDocument.getCalculationOrderIds(),\n      pdfDocument.getJSActions(),\n    ]);\n\n    if (!objects && !docActions) {\n      // No FieldObjects or JavaScript actions were found in the document.\n      await this._destroyScripting();\n      return;\n    }\n    if (pdfDocument !== this._pdfDocument) {\n      return; // The document was closed while the data resolved.\n    }\n    try {\n      this._scripting = this._createScripting();\n    } catch (error) {\n      console.error(`PDFScriptingManager.setDocument: \"${error?.message}\".`);\n\n      await this._destroyScripting();\n      return;\n    }\n\n    this._internalEvents.set(\"updatefromsandbox\", event => {\n      if (event?.source !== window) {\n        return;\n      }\n      this._updateFromSandbox(event.detail);\n    });\n    this._internalEvents.set(\"dispatcheventinsandbox\", event => {\n      this._scripting?.dispatchEventInSandbox(event.detail);\n    });\n\n    this._internalEvents.set(\"pagechanging\", ({ pageNumber, previous }) => {\n      if (pageNumber === previous) {\n        return; // The current page didn't change.\n      }\n      this._dispatchPageClose(previous);\n      this._dispatchPageOpen(pageNumber);\n    });\n    this._internalEvents.set(\"pagerendered\", ({ pageNumber }) => {\n      if (!this._pageOpenPending.has(pageNumber)) {\n        return; // No pending \"PageOpen\" event for the newly rendered page.\n      }\n      if (pageNumber !== this._pdfViewer.currentPageNumber) {\n        return; // The newly rendered page is no longer the current one.\n      }\n      this._dispatchPageOpen(pageNumber);\n    });\n    this._internalEvents.set(\"pagesdestroy\", async event => {\n      await this._dispatchPageClose(this._pdfViewer.currentPageNumber);\n\n      await this._scripting?.dispatchEventInSandbox({\n        id: \"doc\",\n        name: \"WillClose\",\n      });\n\n      this._closeCapability?.resolve();\n    });\n\n    this._domEvents.set(\"mousedown\", event => {\n      this._mouseState.isDown = true;\n    });\n    this._domEvents.set(\"mouseup\", event => {\n      this._mouseState.isDown = false;\n    });\n\n    for (const [name, listener] of this._internalEvents) {\n      this._eventBus._on(name, listener);\n    }\n    for (const [name, listener] of this._domEvents) {\n      window.addEventListener(name, listener, true);\n    }\n\n    try {\n      const docProperties = await this._getDocProperties();\n      if (pdfDocument !== this._pdfDocument) {\n        return; // The document was closed while the properties resolved.\n      }\n\n      await this._scripting.createSandbox({\n        objects,\n        calculationOrder,\n        appInfo: {\n          platform: navigator.platform,\n          language: navigator.language,\n        },\n        docInfo: {\n          ...docProperties,\n          actions: docActions,\n        },\n      });\n\n      this._eventBus.dispatch(\"sandboxcreated\", { source: this });\n    } catch (error) {\n      console.error(`PDFScriptingManager.setDocument: \"${error?.message}\".`);\n\n      await this._destroyScripting();\n      return;\n    }\n\n    await this._scripting?.dispatchEventInSandbox({\n      id: \"doc\",\n      name: \"Open\",\n    });\n    await this._dispatchPageOpen(\n      this._pdfViewer.currentPageNumber,\n      /* initialize = */ true\n    );\n\n    // Defer this slightly, to ensure that scripting is *fully* initialized.\n    Promise.resolve().then(() => {\n      if (pdfDocument === this._pdfDocument) {\n        this._ready = true;\n      }\n    });\n  }\n\n  async dispatchWillSave(detail) {\n    return this._scripting?.dispatchEventInSandbox({\n      id: \"doc\",\n      name: \"WillSave\",\n    });\n  }\n\n  async dispatchDidSave(detail) {\n    return this._scripting?.dispatchEventInSandbox({\n      id: \"doc\",\n      name: \"DidSave\",\n    });\n  }\n\n  async dispatchWillPrint(detail) {\n    return this._scripting?.dispatchEventInSandbox({\n      id: \"doc\",\n      name: \"WillPrint\",\n    });\n  }\n\n  async dispatchDidPrint(detail) {\n    return this._scripting?.dispatchEventInSandbox({\n      id: \"doc\",\n      name: \"DidPrint\",\n    });\n  }\n\n  get mouseState() {\n    return this._mouseState;\n  }\n\n  get destroyPromise() {\n    return this._destroyCapability?.promise || null;\n  }\n\n  get ready() {\n    return this._ready;\n  }\n\n  /**\n   * @private\n   */\n  get _internalEvents() {\n    return shadow(this, \"_internalEvents\", new Map());\n  }\n\n  /**\n   * @private\n   */\n  get _domEvents() {\n    return shadow(this, \"_domEvents\", new Map());\n  }\n\n  /**\n   * @private\n   */\n  get _pageOpenPending() {\n    return shadow(this, \"_pageOpenPending\", new Set());\n  }\n\n  /**\n   * @private\n   */\n  get _visitedPages() {\n    return shadow(this, \"_visitedPages\", new Map());\n  }\n\n  /**\n   * @private\n   */\n  async _updateFromSandbox(detail) {\n    // Ignore some events, see below, that don't make sense in PresentationMode.\n    const isInPresentationMode =\n      this._pdfViewer.isInPresentationMode ||\n      this._pdfViewer.isChangingPresentationMode;\n\n    const { id, siblings, command, value } = detail;\n    if (!id) {\n      switch (command) {\n        case \"clear\":\n          console.clear();\n          break;\n        case \"error\":\n          console.error(value);\n          break;\n        case \"layout\":\n          if (isInPresentationMode) {\n            return;\n          }\n          const modes = apiPageLayoutToViewerModes(value);\n          this._pdfViewer.spreadMode = modes.spreadMode;\n          break;\n        case \"page-num\":\n          this._pdfViewer.currentPageNumber = value + 1;\n          break;\n        case \"print\":\n          await this._pdfViewer.pagesPromise;\n          this._eventBus.dispatch(\"print\", { source: this });\n          break;\n        case \"println\":\n          console.log(value);\n          break;\n        case \"zoom\":\n          if (isInPresentationMode) {\n            return;\n          }\n          this._pdfViewer.currentScaleValue = value;\n          break;\n        case \"SaveAs\":\n          this._eventBus.dispatch(\"download\", { source: this });\n          break;\n        case \"FirstPage\":\n          this._pdfViewer.currentPageNumber = 1;\n          break;\n        case \"LastPage\":\n          this._pdfViewer.currentPageNumber = this._pdfViewer.pagesCount;\n          break;\n        case \"NextPage\":\n          this._pdfViewer.nextPage();\n          break;\n        case \"PrevPage\":\n          this._pdfViewer.previousPage();\n          break;\n        case \"ZoomViewIn\":\n          if (isInPresentationMode) {\n            return;\n          }\n          this._pdfViewer.increaseScale();\n          break;\n        case \"ZoomViewOut\":\n          if (isInPresentationMode) {\n            return;\n          }\n          this._pdfViewer.decreaseScale();\n          break;\n      }\n      return;\n    }\n\n    if (isInPresentationMode) {\n      if (detail.focus) {\n        return;\n      }\n    }\n    delete detail.id;\n    delete detail.siblings;\n\n    const ids = siblings ? [id, ...siblings] : [id];\n    for (const elementId of ids) {\n      const element = document.querySelector(\n        `[data-element-id=\"${elementId}\"]`\n      );\n      if (element) {\n        element.dispatchEvent(new CustomEvent(\"updatefromsandbox\", { detail }));\n      } else {\n        // The element hasn't been rendered yet, use the AnnotationStorage.\n        this._pdfDocument?.annotationStorage.setValue(elementId, detail);\n      }\n    }\n  }\n\n  /**\n   * @private\n   */\n  async _dispatchPageOpen(pageNumber, initialize = false) {\n    const pdfDocument = this._pdfDocument,\n      visitedPages = this._visitedPages;\n\n    if (initialize) {\n      this._closeCapability = createPromiseCapability();\n    }\n    if (!this._closeCapability) {\n      return; // Scripting isn't fully initialized yet.\n    }\n    const pageView = this._pdfViewer.getPageView(/* index = */ pageNumber - 1);\n\n    if (pageView?.renderingState !== RenderingStates.FINISHED) {\n      this._pageOpenPending.add(pageNumber);\n      return; // Wait for the page to finish rendering.\n    }\n    this._pageOpenPending.delete(pageNumber);\n\n    const actionsPromise = (async () => {\n      // Avoid sending, and thus serializing, the `actions` data more than once.\n      const actions = await (!visitedPages.has(pageNumber)\n        ? pageView.pdfPage?.getJSActions()\n        : null);\n      if (pdfDocument !== this._pdfDocument) {\n        return; // The document was closed while the actions resolved.\n      }\n\n      await this._scripting?.dispatchEventInSandbox({\n        id: \"page\",\n        name: \"PageOpen\",\n        pageNumber,\n        actions,\n      });\n    })();\n    visitedPages.set(pageNumber, actionsPromise);\n  }\n\n  /**\n   * @private\n   */\n  async _dispatchPageClose(pageNumber) {\n    const pdfDocument = this._pdfDocument,\n      visitedPages = this._visitedPages;\n\n    if (!this._closeCapability) {\n      return; // Scripting isn't fully initialized yet.\n    }\n    if (this._pageOpenPending.has(pageNumber)) {\n      return; // The page is still rendering; no \"PageOpen\" event dispatched.\n    }\n    const actionsPromise = visitedPages.get(pageNumber);\n    if (!actionsPromise) {\n      return; // The \"PageClose\" event must be preceded by a \"PageOpen\" event.\n    }\n    visitedPages.set(pageNumber, null);\n\n    // Ensure that the \"PageOpen\" event is dispatched first.\n    await actionsPromise;\n    if (pdfDocument !== this._pdfDocument) {\n      return; // The document was closed while the actions resolved.\n    }\n\n    await this._scripting?.dispatchEventInSandbox({\n      id: \"page\",\n      name: \"PageClose\",\n      pageNumber,\n    });\n  }\n\n  /**\n   * @returns {Promise<Object>} A promise that is resolved with an {Object}\n   *   containing the necessary document properties; please find the expected\n   *   format in `PDFViewerApplication._scriptingDocProperties`.\n   * @private\n   */\n  async _getDocProperties() {\n    if (this._docPropertiesLookup) {\n      return this._docPropertiesLookup(this._pdfDocument);\n    }\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"COMPONENTS\")) {\n      const { docPropertiesLookup } = require(\"./generic_scripting.js\");\n\n      return docPropertiesLookup(this._pdfDocument);\n    }\n    throw new Error(\"_getDocProperties: Unable to lookup properties.\");\n  }\n\n  /**\n   * @private\n   */\n  _createScripting() {\n    this._destroyCapability = createPromiseCapability();\n\n    if (this._scripting) {\n      throw new Error(\"_createScripting: Scripting already exists.\");\n    }\n    if (this._scriptingFactory) {\n      return this._scriptingFactory.createScripting({\n        sandboxBundleSrc: this._sandboxBundleSrc,\n      });\n    }\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"COMPONENTS\")) {\n      const { GenericScripting } = require(\"./generic_scripting.js\");\n\n      return new GenericScripting(this._sandboxBundleSrc);\n    }\n    throw new Error(\"_createScripting: Cannot create scripting.\");\n  }\n\n  /**\n   * @private\n   */\n  async _destroyScripting() {\n    if (!this._scripting) {\n      this._pdfDocument = null;\n\n      this._destroyCapability?.resolve();\n      return;\n    }\n    if (this._closeCapability) {\n      await Promise.race([\n        this._closeCapability.promise,\n        new Promise(resolve => {\n          // Avoid the scripting/sandbox-destruction hanging indefinitely.\n          setTimeout(resolve, 1000);\n        }),\n      ]).catch(reason => {\n        // Ignore any errors, to ensure that the sandbox is always destroyed.\n      });\n      this._closeCapability = null;\n    }\n    this._pdfDocument = null;\n\n    try {\n      await this._scripting.destroySandbox();\n    } catch (ex) {}\n\n    for (const [name, listener] of this._internalEvents) {\n      this._eventBus._off(name, listener);\n    }\n    this._internalEvents.clear();\n\n    for (const [name, listener] of this._domEvents) {\n      window.removeEventListener(name, listener, true);\n    }\n    this._domEvents.clear();\n\n    this._pageOpenPending.clear();\n    this._visitedPages.clear();\n\n    this._scripting = null;\n    delete this._mouseState.isDown;\n    this._ready = false;\n\n    this._destroyCapability?.resolve();\n  }\n}\n\nexport { PDFScriptingManager };\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\nimport {\n  PresentationModeState,\n  RenderingStates,\n  SidebarView,\n} from \"./ui_utils.js\";\n\nconst UI_NOTIFICATION_CLASS = \"pdfSidebarNotification\";\n\n/**\n * @typedef {Object} PDFSidebarOptions\n * @property {PDFSidebarElements} elements - The DOM elements.\n * @property {PDFViewer} pdfViewer - The document viewer.\n * @property {PDFThumbnailViewer} pdfThumbnailViewer - The thumbnail viewer.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IL10n} l10n - The localization service.\n */\n\n/**\n * @typedef {Object} PDFSidebarElements\n * @property {HTMLDivElement} outerContainer - The outer container\n *   (encasing both the viewer and sidebar elements).\n * @property {HTMLDivElement} sidebarContainer - The sidebar container\n *   (in which the views are placed).\n * @property {HTMLButtonElement} toggleButton - The button used for\n *   opening/closing the sidebar.\n * @property {HTMLButtonElement} thumbnailButton - The button used to show\n *   the thumbnail view.\n * @property {HTMLButtonElement} outlineButton - The button used to show\n *   the outline view.\n * @property {HTMLButtonElement} attachmentsButton - The button used to show\n *   the attachments view.\n * @property {HTMLButtonElement} layersButton - The button used to show\n *   the layers view.\n * @property {HTMLDivElement} thumbnailView - The container in which\n *   the thumbnails are placed.\n * @property {HTMLDivElement} outlineView - The container in which\n *   the outline is placed.\n * @property {HTMLDivElement} attachmentsView - The container in which\n *   the attachments are placed.\n * @property {HTMLDivElement} layersView - The container in which\n *   the layers are placed.\n * @property {HTMLDivElement} outlineOptionsContainer - The container in which\n *   the outline view-specific option button(s) are placed.\n * @property {HTMLButtonElement} currentOutlineItemButton - The button used to\n *   find the current outline item.\n */\n\nclass PDFSidebar {\n  /**\n   * @param {PDFSidebarOptions} options\n   */\n  constructor({ elements, pdfViewer, pdfThumbnailViewer, eventBus, l10n }) {\n    this.isOpen = false;\n    this.active = SidebarView.THUMBS;\n    this.isInitialViewSet = false;\n    this.isInitialEventDispatched = false;\n\n    /**\n     * Callback used when the sidebar has been opened/closed, to ensure that\n     * the viewers (PDFViewer/PDFThumbnailViewer) are updated correctly.\n     */\n    this.onToggled = null;\n\n    this.pdfViewer = pdfViewer;\n    this.pdfThumbnailViewer = pdfThumbnailViewer;\n\n    this.outerContainer = elements.outerContainer;\n    this.sidebarContainer = elements.sidebarContainer;\n    this.toggleButton = elements.toggleButton;\n\n    this.thumbnailButton = elements.thumbnailButton;\n    this.outlineButton = elements.outlineButton;\n    this.attachmentsButton = elements.attachmentsButton;\n    this.layersButton = elements.layersButton;\n\n    this.thumbnailView = elements.thumbnailView;\n    this.outlineView = elements.outlineView;\n    this.attachmentsView = elements.attachmentsView;\n    this.layersView = elements.layersView;\n\n    this._outlineOptionsContainer = elements.outlineOptionsContainer;\n    this._currentOutlineItemButton = elements.currentOutlineItemButton;\n\n    this.eventBus = eventBus;\n    this.l10n = l10n;\n\n    this.#addEventListeners();\n  }\n\n  reset() {\n    this.isInitialViewSet = false;\n    this.isInitialEventDispatched = false;\n\n    this.#hideUINotification(/* reset = */ true);\n    this.switchView(SidebarView.THUMBS);\n\n    this.outlineButton.disabled = false;\n    this.attachmentsButton.disabled = false;\n    this.layersButton.disabled = false;\n    this._currentOutlineItemButton.disabled = true;\n  }\n\n  /**\n   * @type {number} One of the values in {SidebarView}.\n   */\n  get visibleView() {\n    return this.isOpen ? this.active : SidebarView.NONE;\n  }\n\n  /**\n   * @param {number} view - The sidebar view that should become visible,\n   *                        must be one of the values in {SidebarView}.\n   */\n  setInitialView(view = SidebarView.NONE) {\n    if (this.isInitialViewSet) {\n      return;\n    }\n    this.isInitialViewSet = true;\n\n    // If the user has already manually opened the sidebar, immediately closing\n    // it would be bad UX; also ignore the \"unknown\" sidebar view value.\n    if (view === SidebarView.NONE || view === SidebarView.UNKNOWN) {\n      this.#dispatchEvent();\n      return;\n    }\n    this.switchView(view, /* forceOpen = */ true);\n\n    // Prevent dispatching two back-to-back \"sidebarviewchanged\" events,\n    // since `this.switchView` dispatched the event if the view changed.\n    if (!this.isInitialEventDispatched) {\n      this.#dispatchEvent();\n    }\n  }\n\n  /**\n   * @param {number} view - The sidebar view that should be switched to,\n   *                        must be one of the values in {SidebarView}.\n   * @param {boolean} [forceOpen] - Ensure that the sidebar is open.\n   *                                The default value is `false`.\n   */\n  switchView(view, forceOpen = false) {\n    const isViewChanged = view !== this.active;\n    let shouldForceRendering = false;\n\n    switch (view) {\n      case SidebarView.NONE:\n        if (this.isOpen) {\n          this.close();\n        }\n        return; // Closing will trigger rendering and dispatch the event.\n      case SidebarView.THUMBS:\n        if (this.isOpen && isViewChanged) {\n          shouldForceRendering = true;\n        }\n        break;\n      case SidebarView.OUTLINE:\n        if (this.outlineButton.disabled) {\n          return;\n        }\n        break;\n      case SidebarView.ATTACHMENTS:\n        if (this.attachmentsButton.disabled) {\n          return;\n        }\n        break;\n      case SidebarView.LAYERS:\n        if (this.layersButton.disabled) {\n          return;\n        }\n        break;\n      default:\n        console.error(`PDFSidebar.switchView: \"${view}\" is not a valid view.`);\n        return;\n    }\n    // Update the active view *after* it has been validated above,\n    // in order to prevent setting it to an invalid state.\n    this.active = view;\n\n    const isThumbs = view === SidebarView.THUMBS,\n      isOutline = view === SidebarView.OUTLINE,\n      isAttachments = view === SidebarView.ATTACHMENTS,\n      isLayers = view === SidebarView.LAYERS;\n\n    // Update the CSS classes (and aria attributes), for all buttons...\n    this.thumbnailButton.classList.toggle(\"toggled\", isThumbs);\n    this.outlineButton.classList.toggle(\"toggled\", isOutline);\n    this.attachmentsButton.classList.toggle(\"toggled\", isAttachments);\n    this.layersButton.classList.toggle(\"toggled\", isLayers);\n\n    this.thumbnailButton.setAttribute(\"aria-checked\", isThumbs);\n    this.outlineButton.setAttribute(\"aria-checked\", isOutline);\n    this.attachmentsButton.setAttribute(\"aria-checked\", isAttachments);\n    this.layersButton.setAttribute(\"aria-checked\", isLayers);\n    // ... and for all views.\n    this.thumbnailView.classList.toggle(\"hidden\", !isThumbs);\n    this.outlineView.classList.toggle(\"hidden\", !isOutline);\n    this.attachmentsView.classList.toggle(\"hidden\", !isAttachments);\n    this.layersView.classList.toggle(\"hidden\", !isLayers);\n\n    // Finally, update view-specific CSS classes.\n    this._outlineOptionsContainer.classList.toggle(\"hidden\", !isOutline);\n\n    if (forceOpen && !this.isOpen) {\n      this.open();\n      return; // Opening will trigger rendering and dispatch the event.\n    }\n    if (shouldForceRendering) {\n      this.#updateThumbnailViewer();\n      this.#forceRendering();\n    }\n    if (isViewChanged) {\n      this.#dispatchEvent();\n    }\n  }\n\n  open() {\n    if (this.isOpen) {\n      return;\n    }\n    this.isOpen = true;\n    this.toggleButton.classList.add(\"toggled\");\n    this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n\n    this.outerContainer.classList.add(\"sidebarMoving\", \"sidebarOpen\");\n\n    if (this.active === SidebarView.THUMBS) {\n      this.#updateThumbnailViewer();\n    }\n    this.#forceRendering();\n    this.#dispatchEvent();\n\n    this.#hideUINotification();\n  }\n\n  close() {\n    if (!this.isOpen) {\n      return;\n    }\n    this.isOpen = false;\n    this.toggleButton.classList.remove(\"toggled\");\n    this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n\n    this.outerContainer.classList.add(\"sidebarMoving\");\n    this.outerContainer.classList.remove(\"sidebarOpen\");\n\n    this.#forceRendering();\n    this.#dispatchEvent();\n  }\n\n  toggle() {\n    if (this.isOpen) {\n      this.close();\n    } else {\n      this.open();\n    }\n  }\n\n  #dispatchEvent() {\n    if (this.isInitialViewSet && !this.isInitialEventDispatched) {\n      this.isInitialEventDispatched = true;\n    }\n\n    this.eventBus.dispatch(\"sidebarviewchanged\", {\n      source: this,\n      view: this.visibleView,\n    });\n  }\n\n  #forceRendering() {\n    if (this.onToggled) {\n      this.onToggled();\n    } else {\n      // Fallback\n      this.pdfViewer.forceRendering();\n      this.pdfThumbnailViewer.forceRendering();\n    }\n  }\n\n  #updateThumbnailViewer() {\n    const { pdfViewer, pdfThumbnailViewer } = this;\n\n    // Use the rendered pages to set the corresponding thumbnail images.\n    const pagesCount = pdfViewer.pagesCount;\n    for (let pageIndex = 0; pageIndex < pagesCount; pageIndex++) {\n      const pageView = pdfViewer.getPageView(pageIndex);\n      if (pageView?.renderingState === RenderingStates.FINISHED) {\n        const thumbnailView = pdfThumbnailViewer.getThumbnail(pageIndex);\n        thumbnailView.setImage(pageView);\n      }\n    }\n    pdfThumbnailViewer.scrollThumbnailIntoView(pdfViewer.currentPageNumber);\n  }\n\n  #showUINotification() {\n    this.toggleButton.setAttribute(\n      \"data-l10n-id\",\n      \"toggle_sidebar_notification2\"\n    );\n    this.l10n.translate(this.toggleButton);\n\n    if (!this.isOpen) {\n      // Only show the notification on the `toggleButton` if the sidebar is\n      // currently closed, to avoid unnecessarily bothering the user.\n      this.toggleButton.classList.add(UI_NOTIFICATION_CLASS);\n    }\n  }\n\n  #hideUINotification(reset = false) {\n    if (this.isOpen || reset) {\n      // Only hide the notification on the `toggleButton` if the sidebar is\n      // currently open, or when the current PDF document is being closed.\n      this.toggleButton.classList.remove(UI_NOTIFICATION_CLASS);\n    }\n\n    if (reset) {\n      this.toggleButton.setAttribute(\"data-l10n-id\", \"toggle_sidebar\");\n      this.l10n.translate(this.toggleButton);\n    }\n  }\n\n  #addEventListeners() {\n    this.sidebarContainer.addEventListener(\"transitionend\", evt => {\n      if (evt.target === this.sidebarContainer) {\n        this.outerContainer.classList.remove(\"sidebarMoving\");\n      }\n    });\n\n    this.toggleButton.addEventListener(\"click\", () => {\n      this.toggle();\n    });\n\n    // Buttons for switching views.\n    this.thumbnailButton.addEventListener(\"click\", () => {\n      this.switchView(SidebarView.THUMBS);\n    });\n\n    this.outlineButton.addEventListener(\"click\", () => {\n      this.switchView(SidebarView.OUTLINE);\n    });\n    this.outlineButton.addEventListener(\"dblclick\", () => {\n      this.eventBus.dispatch(\"toggleoutlinetree\", { source: this });\n    });\n\n    this.attachmentsButton.addEventListener(\"click\", () => {\n      this.switchView(SidebarView.ATTACHMENTS);\n    });\n\n    this.layersButton.addEventListener(\"click\", () => {\n      this.switchView(SidebarView.LAYERS);\n    });\n    this.layersButton.addEventListener(\"dblclick\", () => {\n      this.eventBus.dispatch(\"resetlayers\", { source: this });\n    });\n\n    // Buttons for view-specific options.\n    this._currentOutlineItemButton.addEventListener(\"click\", () => {\n      this.eventBus.dispatch(\"currentoutlineitem\", { source: this });\n    });\n\n    // Disable/enable views.\n    const onTreeLoaded = (count, button, view) => {\n      button.disabled = !count;\n\n      if (count) {\n        this.#showUINotification();\n      } else if (this.active === view) {\n        // If the `view` was opened by the user during document load,\n        // switch away from it if it turns out to be empty.\n        this.switchView(SidebarView.THUMBS);\n      }\n    };\n\n    this.eventBus._on(\"outlineloaded\", evt => {\n      onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE);\n\n      evt.currentOutlineItemPromise.then(enabled => {\n        if (!this.isInitialViewSet) {\n          return;\n        }\n        this._currentOutlineItemButton.disabled = !enabled;\n      });\n    });\n\n    this.eventBus._on(\"attachmentsloaded\", evt => {\n      onTreeLoaded(\n        evt.attachmentsCount,\n        this.attachmentsButton,\n        SidebarView.ATTACHMENTS\n      );\n    });\n\n    this.eventBus._on(\"layersloaded\", evt => {\n      onTreeLoaded(evt.layersCount, this.layersButton, SidebarView.LAYERS);\n    });\n\n    // Update the thumbnailViewer, if visible, when exiting presentation mode.\n    this.eventBus._on(\"presentationmodechanged\", evt => {\n      if (\n        evt.state === PresentationModeState.NORMAL &&\n        this.visibleView === SidebarView.THUMBS\n      ) {\n        this.#updateThumbnailViewer();\n      }\n    });\n  }\n}\n\nexport { PDFSidebar };\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\nimport { docStyle } from \"./ui_utils.js\";\n\nconst SIDEBAR_WIDTH_VAR = \"--sidebar-width\";\nconst SIDEBAR_MIN_WIDTH = 200; // pixels\nconst SIDEBAR_RESIZING_CLASS = \"sidebarResizing\";\n\n/**\n * @typedef {Object} PDFSidebarResizerOptions\n * @property {HTMLDivElement} outerContainer - The outer container\n *   (encasing both the viewer and sidebar elements).\n * @property {HTMLDivElement} resizer - The DOM element that can be dragged in\n *   order to adjust the width of the sidebar.\n */\n\nclass PDFSidebarResizer {\n  /**\n   * @param {PDFSidebarResizerOptions} options\n   * @param {EventBus} eventBus - The application event bus.\n   * @param {IL10n} l10n - Localization service.\n   */\n  constructor(options, eventBus, l10n) {\n    this.isRTL = false;\n    this.sidebarOpen = false;\n    this._width = null;\n    this._outerContainerWidth = null;\n    this._boundEvents = Object.create(null);\n\n    this.outerContainer = options.outerContainer;\n    this.resizer = options.resizer;\n    this.eventBus = eventBus;\n\n    l10n.getDirection().then(dir => {\n      this.isRTL = dir === \"rtl\";\n    });\n    this._addEventListeners();\n  }\n\n  /**\n   * @type {number}\n   */\n  get outerContainerWidth() {\n    return (this._outerContainerWidth ||= this.outerContainer.clientWidth);\n  }\n\n  /**\n   * @private\n   * returns {boolean} Indicating if the sidebar width was updated.\n   */\n  _updateWidth(width = 0) {\n    // Prevent the sidebar from becoming too narrow, or from occupying more\n    // than half of the available viewer width.\n    const maxWidth = Math.floor(this.outerContainerWidth / 2);\n    if (width > maxWidth) {\n      width = maxWidth;\n    }\n    if (width < SIDEBAR_MIN_WIDTH) {\n      width = SIDEBAR_MIN_WIDTH;\n    }\n    // Only update the UI when the sidebar width did in fact change.\n    if (width === this._width) {\n      return false;\n    }\n    this._width = width;\n\n    docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${width}px`);\n    return true;\n  }\n\n  /**\n   * @private\n   */\n  _mouseMove(evt) {\n    let width = evt.clientX;\n    // For sidebar resizing to work correctly in RTL mode, invert the width.\n    if (this.isRTL) {\n      width = this.outerContainerWidth - width;\n    }\n    this._updateWidth(width);\n  }\n\n  /**\n   * @private\n   */\n  _mouseUp(evt) {\n    // Re-enable the `transition-duration` rules when sidebar resizing ends...\n    this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n    // ... and ensure that rendering will always be triggered.\n    this.eventBus.dispatch(\"resize\", { source: this });\n\n    const _boundEvents = this._boundEvents;\n    window.removeEventListener(\"mousemove\", _boundEvents.mouseMove);\n    window.removeEventListener(\"mouseup\", _boundEvents.mouseUp);\n  }\n\n  /**\n   * @private\n   */\n  _addEventListeners() {\n    const _boundEvents = this._boundEvents;\n    _boundEvents.mouseMove = this._mouseMove.bind(this);\n    _boundEvents.mouseUp = this._mouseUp.bind(this);\n\n    this.resizer.addEventListener(\"mousedown\", evt => {\n      if (evt.button !== 0) {\n        return;\n      }\n      // Disable the `transition-duration` rules when sidebar resizing begins,\n      // in order to improve responsiveness and to avoid visual glitches.\n      this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n\n      window.addEventListener(\"mousemove\", _boundEvents.mouseMove);\n      window.addEventListener(\"mouseup\", _boundEvents.mouseUp);\n    });\n\n    this.eventBus._on(\"sidebarviewchanged\", evt => {\n      this.sidebarOpen = !!evt?.view;\n    });\n\n    this.eventBus._on(\"resize\", evt => {\n      // When the *entire* viewer is resized, such that it becomes narrower,\n      // ensure that the sidebar doesn't end up being too wide.\n      if (evt?.source !== window) {\n        return;\n      }\n      // Always reset the cached width when the viewer is resized.\n      this._outerContainerWidth = null;\n\n      if (!this._width) {\n        // The sidebar hasn't been resized, hence no need to adjust its width.\n        return;\n      }\n      // NOTE: If the sidebar is closed, we don't need to worry about\n      //       visual glitches nor ensure that rendering is triggered.\n      if (!this.sidebarOpen) {\n        this._updateWidth(this._width);\n        return;\n      }\n      this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n      const updated = this._updateWidth(this._width);\n\n      Promise.resolve().then(() => {\n        this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n        // Trigger rendering if the sidebar width changed, to avoid\n        // depending on the order in which 'resize' events are handled.\n        if (updated) {\n          this.eventBus.dispatch(\"resize\", { source: this });\n        }\n      });\n    });\n  }\n}\n\nexport { PDFSidebarResizer };\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\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport {\n  getVisibleElements,\n  isValidRotation,\n  RenderingStates,\n  scrollIntoView,\n  watchScroll,\n} from \"./ui_utils.js\";\nimport { PDFThumbnailView, TempImageFactory } from \"./pdf_thumbnail_view.js\";\n\nconst THUMBNAIL_SCROLL_MARGIN = -19;\nconst THUMBNAIL_SELECTED_CLASS = \"selected\";\n\n/**\n * @typedef {Object} PDFThumbnailViewerOptions\n * @property {HTMLDivElement} container - The container for the thumbnail\n *   elements.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {IL10n} l10n - Localization service.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n *   with user defined ones in order to improve readability in high contrast\n *   mode.\n */\n\n/**\n * Viewer control to display thumbnails for pages in a PDF document.\n */\nclass PDFThumbnailViewer {\n  /**\n   * @param {PDFThumbnailViewerOptions} options\n   */\n  constructor({\n    container,\n    eventBus,\n    linkService,\n    renderingQueue,\n    l10n,\n    pageColors,\n  }) {\n    this.container = container;\n    this.linkService = linkService;\n    this.renderingQueue = renderingQueue;\n    this.l10n = l10n;\n    this.pageColors = pageColors || null;\n\n    if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n      if (\n        this.pageColors &&\n        !(\n          CSS.supports(\"color\", this.pageColors.background) &&\n          CSS.supports(\"color\", this.pageColors.foreground)\n        )\n      ) {\n        if (this.pageColors.background || this.pageColors.foreground) {\n          console.warn(\n            \"PDFThumbnailViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used.\"\n          );\n        }\n        this.pageColors = null;\n      }\n    }\n\n    this.scroll = watchScroll(this.container, this._scrollUpdated.bind(this));\n    this._resetView();\n  }\n\n  /**\n   * @private\n   */\n  _scrollUpdated() {\n    this.renderingQueue.renderHighestPriority();\n  }\n\n  getThumbnail(index) {\n    return this._thumbnails[index];\n  }\n\n  /**\n   * @private\n   */\n  _getVisibleThumbs() {\n    return getVisibleElements({\n      scrollEl: this.container,\n      views: this._thumbnails,\n    });\n  }\n\n  scrollThumbnailIntoView(pageNumber) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const thumbnailView = this._thumbnails[pageNumber - 1];\n\n    if (!thumbnailView) {\n      console.error('scrollThumbnailIntoView: Invalid \"pageNumber\" parameter.');\n      return;\n    }\n\n    if (pageNumber !== this._currentPageNumber) {\n      const prevThumbnailView = this._thumbnails[this._currentPageNumber - 1];\n      // Remove the highlight from the previous thumbnail...\n      prevThumbnailView.div.classList.remove(THUMBNAIL_SELECTED_CLASS);\n      // ... and add the highlight to the new thumbnail.\n      thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);\n    }\n    const { first, last, views } = this._getVisibleThumbs();\n\n    // If the thumbnail isn't currently visible, scroll it into view.\n    if (views.length > 0) {\n      let shouldScroll = false;\n      if (pageNumber <= first.id || pageNumber >= last.id) {\n        shouldScroll = true;\n      } else {\n        for (const { id, percent } of views) {\n          if (id !== pageNumber) {\n            continue;\n          }\n          shouldScroll = percent < 100;\n          break;\n        }\n      }\n      if (shouldScroll) {\n        scrollIntoView(thumbnailView.div, { top: THUMBNAIL_SCROLL_MARGIN });\n      }\n    }\n\n    this._currentPageNumber = pageNumber;\n  }\n\n  get pagesRotation() {\n    return this._pagesRotation;\n  }\n\n  set pagesRotation(rotation) {\n    if (!isValidRotation(rotation)) {\n      throw new Error(\"Invalid thumbnails rotation angle.\");\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    if (this._pagesRotation === rotation) {\n      return; // The rotation didn't change.\n    }\n    this._pagesRotation = rotation;\n\n    const updateArgs = { rotation };\n    for (const thumbnail of this._thumbnails) {\n      thumbnail.update(updateArgs);\n    }\n  }\n\n  cleanup() {\n    for (const thumbnail of this._thumbnails) {\n      if (thumbnail.renderingState !== RenderingStates.FINISHED) {\n        thumbnail.reset();\n      }\n    }\n    TempImageFactory.destroyCanvas();\n  }\n\n  /**\n   * @private\n   */\n  _resetView() {\n    this._thumbnails = [];\n    this._currentPageNumber = 1;\n    this._pageLabels = null;\n    this._pagesRotation = 0;\n\n    // Remove the thumbnails from the DOM.\n    this.container.textContent = \"\";\n  }\n\n  /**\n   * @param {PDFDocumentProxy} pdfDocument\n   */\n  setDocument(pdfDocument) {\n    if (this.pdfDocument) {\n      this._cancelRendering();\n      this._resetView();\n    }\n\n    this.pdfDocument = pdfDocument;\n    if (!pdfDocument) {\n      return;\n    }\n    const firstPagePromise = pdfDocument.getPage(1);\n    const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();\n\n    firstPagePromise\n      .then(firstPdfPage => {\n        const pagesCount = pdfDocument.numPages;\n        const viewport = firstPdfPage.getViewport({ scale: 1 });\n\n        for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n          const thumbnail = new PDFThumbnailView({\n            container: this.container,\n            id: pageNum,\n            defaultViewport: viewport.clone(),\n            optionalContentConfigPromise,\n            linkService: this.linkService,\n            renderingQueue: this.renderingQueue,\n            l10n: this.l10n,\n            pageColors: this.pageColors,\n          });\n          this._thumbnails.push(thumbnail);\n        }\n        // Set the first `pdfPage` immediately, since it's already loaded,\n        // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n        // the `this.#ensurePdfPageLoaded` method before rendering can start.\n        this._thumbnails[0]?.setPdfPage(firstPdfPage);\n\n        // Ensure that the current thumbnail is always highlighted on load.\n        const thumbnailView = this._thumbnails[this._currentPageNumber - 1];\n        thumbnailView.div.classList.add(THUMBNAIL_SELECTED_CLASS);\n      })\n      .catch(reason => {\n        console.error(\"Unable to initialize thumbnail viewer\", reason);\n      });\n  }\n\n  /**\n   * @private\n   */\n  _cancelRendering() {\n    for (const thumbnail of this._thumbnails) {\n      thumbnail.cancelRendering();\n    }\n  }\n\n  /**\n   * @param {Array|null} labels\n   */\n  setPageLabels(labels) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    if (!labels) {\n      this._pageLabels = null;\n    } else if (\n      !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n    ) {\n      this._pageLabels = null;\n      console.error(\"PDFThumbnailViewer_setPageLabels: Invalid page labels.\");\n    } else {\n      this._pageLabels = labels;\n    }\n    // Update all the `PDFThumbnailView` instances.\n    for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n      this._thumbnails[i].setPageLabel(this._pageLabels?.[i] ?? null);\n    }\n  }\n\n  /**\n   * @param {PDFThumbnailView} thumbView\n   * @returns {Promise<PDFPageProxy | null>}\n   */\n  async #ensurePdfPageLoaded(thumbView) {\n    if (thumbView.pdfPage) {\n      return thumbView.pdfPage;\n    }\n    try {\n      const pdfPage = await this.pdfDocument.getPage(thumbView.id);\n      if (!thumbView.pdfPage) {\n        thumbView.setPdfPage(pdfPage);\n      }\n      return pdfPage;\n    } catch (reason) {\n      console.error(\"Unable to get page for thumb view\", reason);\n      return null; // Page error -- there is nothing that can be done.\n    }\n  }\n\n  #getScrollAhead(visible) {\n    if (visible.first?.id === 1) {\n      return true;\n    } else if (visible.last?.id === this._thumbnails.length) {\n      return false;\n    }\n    return this.scroll.down;\n  }\n\n  forceRendering() {\n    const visibleThumbs = this._getVisibleThumbs();\n    const scrollAhead = this.#getScrollAhead(visibleThumbs);\n    const thumbView = this.renderingQueue.getHighestPriority(\n      visibleThumbs,\n      this._thumbnails,\n      scrollAhead\n    );\n    if (thumbView) {\n      this.#ensurePdfPageLoaded(thumbView).then(() => {\n        this.renderingQueue.renderView(thumbView);\n      });\n      return true;\n    }\n    return false;\n  }\n}\n\nexport { PDFThumbnailViewer };\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\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport { OutputScale, RenderingStates } from \"./ui_utils.js\";\nimport { RenderingCancelledException } from \"pdfjs-lib\";\n\nconst DRAW_UPSCALE_FACTOR = 2; // See comment in `PDFThumbnailView.draw` below.\nconst MAX_NUM_SCALING_STEPS = 3;\nconst THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px\nconst THUMBNAIL_WIDTH = 98; // px\n\n/**\n * @typedef {Object} PDFThumbnailViewOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {number} id - The thumbnail's unique ID (normally its number).\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n *   A promise that is resolved with an {@link OptionalContentConfig} instance.\n *   The default value is `null`.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {IL10n} l10n - Localization service.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n *   with user defined ones in order to improve readability in high contrast\n *   mode.\n */\n\nclass TempImageFactory {\n  static #tempCanvas = null;\n\n  static getCanvas(width, height) {\n    const tempCanvas = (this.#tempCanvas ||= document.createElement(\"canvas\"));\n    tempCanvas.width = width;\n    tempCanvas.height = height;\n\n    // Since this is a temporary canvas, we need to fill it with a white\n    // background ourselves. `_getPageDrawContext` uses CSS rules for this.\n    const ctx = tempCanvas.getContext(\"2d\", { alpha: false });\n    ctx.save();\n    ctx.fillStyle = \"rgb(255, 255, 255)\";\n    ctx.fillRect(0, 0, width, height);\n    ctx.restore();\n    return [tempCanvas, tempCanvas.getContext(\"2d\")];\n  }\n\n  static destroyCanvas() {\n    const tempCanvas = this.#tempCanvas;\n    if (tempCanvas) {\n      // Zeroing the width and height causes Firefox to release graphics\n      // resources immediately, which can greatly reduce memory consumption.\n      tempCanvas.width = 0;\n      tempCanvas.height = 0;\n    }\n    this.#tempCanvas = null;\n  }\n}\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFThumbnailView {\n  /**\n   * @param {PDFThumbnailViewOptions} options\n   */\n  constructor({\n    container,\n    id,\n    defaultViewport,\n    optionalContentConfigPromise,\n    linkService,\n    renderingQueue,\n    l10n,\n    pageColors,\n  }) {\n    this.id = id;\n    this.renderingId = \"thumbnail\" + id;\n    this.pageLabel = null;\n\n    this.pdfPage = null;\n    this.rotation = 0;\n    this.viewport = defaultViewport;\n    this.pdfPageRotate = defaultViewport.rotation;\n    this._optionalContentConfigPromise = optionalContentConfigPromise || null;\n    this.pageColors = pageColors || null;\n\n    this.linkService = linkService;\n    this.renderingQueue = renderingQueue;\n\n    this.renderTask = null;\n    this.renderingState = RenderingStates.INITIAL;\n    this.resume = null;\n\n    const pageWidth = this.viewport.width,\n      pageHeight = this.viewport.height,\n      pageRatio = pageWidth / pageHeight;\n\n    this.canvasWidth = THUMBNAIL_WIDTH;\n    this.canvasHeight = (this.canvasWidth / pageRatio) | 0;\n    this.scale = this.canvasWidth / pageWidth;\n\n    this.l10n = l10n;\n\n    const anchor = document.createElement(\"a\");\n    anchor.href = linkService.getAnchorUrl(\"#page=\" + id);\n    this._thumbPageTitle.then(msg => {\n      anchor.title = msg;\n    });\n    anchor.onclick = function () {\n      linkService.goToPage(id);\n      return false;\n    };\n    this.anchor = anchor;\n\n    const div = document.createElement(\"div\");\n    div.className = \"thumbnail\";\n    div.setAttribute(\"data-page-number\", this.id);\n    this.div = div;\n\n    const ring = document.createElement(\"div\");\n    ring.className = \"thumbnailSelectionRing\";\n    const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;\n    ring.style.width = this.canvasWidth + borderAdjustment + \"px\";\n    ring.style.height = this.canvasHeight + borderAdjustment + \"px\";\n    this.ring = ring;\n\n    div.append(ring);\n    anchor.append(div);\n    container.append(anchor);\n  }\n\n  setPdfPage(pdfPage) {\n    this.pdfPage = pdfPage;\n    this.pdfPageRotate = pdfPage.rotate;\n    const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n    this.viewport = pdfPage.getViewport({ scale: 1, rotation: totalRotation });\n    this.reset();\n  }\n\n  reset() {\n    this.cancelRendering();\n    this.renderingState = RenderingStates.INITIAL;\n\n    const pageWidth = this.viewport.width,\n      pageHeight = this.viewport.height,\n      pageRatio = pageWidth / pageHeight;\n\n    this.canvasHeight = (this.canvasWidth / pageRatio) | 0;\n    this.scale = this.canvasWidth / pageWidth;\n\n    this.div.removeAttribute(\"data-loaded\");\n    const ring = this.ring;\n    ring.textContent = \"\"; // Remove the thumbnail from the DOM.\n    const borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;\n    ring.style.width = this.canvasWidth + borderAdjustment + \"px\";\n    ring.style.height = this.canvasHeight + borderAdjustment + \"px\";\n\n    if (this.canvas) {\n      // Zeroing the width and height causes Firefox to release graphics\n      // resources immediately, which can greatly reduce memory consumption.\n      this.canvas.width = 0;\n      this.canvas.height = 0;\n      delete this.canvas;\n    }\n    if (this.image) {\n      this.image.removeAttribute(\"src\");\n      delete this.image;\n    }\n  }\n\n  update({ rotation = null }) {\n    if (typeof rotation === \"number\") {\n      this.rotation = rotation; // The rotation may be zero.\n    }\n    const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n    this.viewport = this.viewport.clone({\n      scale: 1,\n      rotation: totalRotation,\n    });\n    this.reset();\n  }\n\n  /**\n   * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n   *              rather than calling this one directly.\n   */\n  cancelRendering() {\n    if (this.renderTask) {\n      this.renderTask.cancel();\n      this.renderTask = null;\n    }\n    this.resume = null;\n  }\n\n  /**\n   * @private\n   */\n  _getPageDrawContext(upscaleFactor = 1) {\n    // Keep the no-thumbnail outline visible, i.e. `data-loaded === false`,\n    // until rendering/image conversion is complete, to avoid display issues.\n    const canvas = document.createElement(\"canvas\");\n    const ctx = canvas.getContext(\"2d\", { alpha: false });\n    const outputScale = new OutputScale();\n\n    canvas.width = (upscaleFactor * this.canvasWidth * outputScale.sx) | 0;\n    canvas.height = (upscaleFactor * this.canvasHeight * outputScale.sy) | 0;\n\n    const transform = outputScale.scaled\n      ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n      : null;\n\n    return { ctx, canvas, transform };\n  }\n\n  /**\n   * @private\n   */\n  _convertCanvasToImage(canvas) {\n    if (this.renderingState !== RenderingStates.FINISHED) {\n      throw new Error(\"_convertCanvasToImage: Rendering has not finished.\");\n    }\n    const reducedCanvas = this._reduceImage(canvas);\n\n    const image = document.createElement(\"img\");\n    image.className = \"thumbnailImage\";\n    this._thumbPageCanvas.then(msg => {\n      image.setAttribute(\"aria-label\", msg);\n    });\n    image.style.width = this.canvasWidth + \"px\";\n    image.style.height = this.canvasHeight + \"px\";\n\n    image.src = reducedCanvas.toDataURL();\n    this.image = image;\n\n    this.div.setAttribute(\"data-loaded\", true);\n    this.ring.append(image);\n\n    // Zeroing the width and height causes Firefox to release graphics\n    // resources immediately, which can greatly reduce memory consumption.\n    reducedCanvas.width = 0;\n    reducedCanvas.height = 0;\n  }\n\n  draw() {\n    if (this.renderingState !== RenderingStates.INITIAL) {\n      console.error(\"Must be in new state before drawing\");\n      return Promise.resolve();\n    }\n    const { pdfPage } = this;\n\n    if (!pdfPage) {\n      this.renderingState = RenderingStates.FINISHED;\n      return Promise.reject(new Error(\"pdfPage is not loaded\"));\n    }\n\n    this.renderingState = RenderingStates.RUNNING;\n\n    const finishRenderTask = async (error = null) => {\n      // The renderTask may have been replaced by a new one, so only remove\n      // the reference to the renderTask if it matches the one that is\n      // triggering this callback.\n      if (renderTask === this.renderTask) {\n        this.renderTask = null;\n      }\n\n      if (error instanceof RenderingCancelledException) {\n        return;\n      }\n      this.renderingState = RenderingStates.FINISHED;\n      this._convertCanvasToImage(canvas);\n\n      if (error) {\n        throw error;\n      }\n    };\n\n    // Render the thumbnail at a larger size and downsize the canvas (similar\n    // to `setImage`), to improve consistency between thumbnails created by\n    // the `draw` and `setImage` methods (fixes issue 8233).\n    // NOTE: To primarily avoid increasing memory usage too much, but also to\n    //   reduce downsizing overhead, we purposely limit the up-scaling factor.\n    const { ctx, canvas, transform } =\n      this._getPageDrawContext(DRAW_UPSCALE_FACTOR);\n    const drawViewport = this.viewport.clone({\n      scale: DRAW_UPSCALE_FACTOR * this.scale,\n    });\n    const renderContinueCallback = cont => {\n      if (!this.renderingQueue.isHighestPriority(this)) {\n        this.renderingState = RenderingStates.PAUSED;\n        this.resume = () => {\n          this.renderingState = RenderingStates.RUNNING;\n          cont();\n        };\n        return;\n      }\n      cont();\n    };\n\n    const renderContext = {\n      canvasContext: ctx,\n      transform,\n      viewport: drawViewport,\n      optionalContentConfigPromise: this._optionalContentConfigPromise,\n      pageColors: this.pageColors,\n    };\n    const renderTask = (this.renderTask = pdfPage.render(renderContext));\n    renderTask.onContinue = renderContinueCallback;\n\n    const resultPromise = renderTask.promise.then(\n      function () {\n        return finishRenderTask(null);\n      },\n      function (error) {\n        return finishRenderTask(error);\n      }\n    );\n    resultPromise.finally(() => {\n      // Zeroing the width and height causes Firefox to release graphics\n      // resources immediately, which can greatly reduce memory consumption.\n      canvas.width = 0;\n      canvas.height = 0;\n\n      // Only trigger cleanup, once rendering has finished, when the current\n      // pageView is *not* cached on the `BaseViewer`-instance.\n      const pageCached = this.linkService.isPageCached(this.id);\n      if (!pageCached) {\n        this.pdfPage?.cleanup();\n      }\n    });\n\n    return resultPromise;\n  }\n\n  setImage(pageView) {\n    if (this.renderingState !== RenderingStates.INITIAL) {\n      return;\n    }\n    const { thumbnailCanvas: canvas, pdfPage, scale } = pageView;\n    if (!canvas) {\n      return;\n    }\n    if (!this.pdfPage) {\n      this.setPdfPage(pdfPage);\n    }\n    if (scale < this.scale) {\n      // Avoid upscaling the image, since that makes the thumbnail look blurry.\n      return;\n    }\n    this.renderingState = RenderingStates.FINISHED;\n    this._convertCanvasToImage(canvas);\n  }\n\n  /**\n   * @private\n   */\n  _reduceImage(img) {\n    const { ctx, canvas } = this._getPageDrawContext();\n\n    if (img.width <= 2 * canvas.width) {\n      ctx.drawImage(\n        img,\n        0,\n        0,\n        img.width,\n        img.height,\n        0,\n        0,\n        canvas.width,\n        canvas.height\n      );\n      return canvas;\n    }\n    // drawImage does an awful job of rescaling the image, doing it gradually.\n    let reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;\n    let reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;\n    const [reducedImage, reducedImageCtx] = TempImageFactory.getCanvas(\n      reducedWidth,\n      reducedHeight\n    );\n\n    while (reducedWidth > img.width || reducedHeight > img.height) {\n      reducedWidth >>= 1;\n      reducedHeight >>= 1;\n    }\n    reducedImageCtx.drawImage(\n      img,\n      0,\n      0,\n      img.width,\n      img.height,\n      0,\n      0,\n      reducedWidth,\n      reducedHeight\n    );\n    while (reducedWidth > 2 * canvas.width) {\n      reducedImageCtx.drawImage(\n        reducedImage,\n        0,\n        0,\n        reducedWidth,\n        reducedHeight,\n        0,\n        0,\n        reducedWidth >> 1,\n        reducedHeight >> 1\n      );\n      reducedWidth >>= 1;\n      reducedHeight >>= 1;\n    }\n    ctx.drawImage(\n      reducedImage,\n      0,\n      0,\n      reducedWidth,\n      reducedHeight,\n      0,\n      0,\n      canvas.width,\n      canvas.height\n    );\n    return canvas;\n  }\n\n  get _thumbPageTitle() {\n    return this.l10n.get(\"thumb_page_title\", {\n      page: this.pageLabel ?? this.id,\n    });\n  }\n\n  get _thumbPageCanvas() {\n    return this.l10n.get(\"thumb_page_canvas\", {\n      page: this.pageLabel ?? this.id,\n    });\n  }\n\n  /**\n   * @param {string|null} label\n   */\n  setPageLabel(label) {\n    this.pageLabel = typeof label === \"string\" ? label : null;\n\n    this._thumbPageTitle.then(msg => {\n      this.anchor.title = msg;\n    });\n\n    if (this.renderingState !== RenderingStates.FINISHED) {\n      return;\n    }\n\n    this._thumbPageCanvas.then(msg => {\n      this.image?.setAttribute(\"aria-label\", msg);\n    });\n  }\n}\n\nexport { PDFThumbnailView, TempImageFactory };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces\").IPDFAnnotationLayerFactory} IPDFAnnotationLayerFactory */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces\").IPDFAnnotationEditorLayerFactory} IPDFAnnotationEditorLayerFactory */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces\").IPDFStructTreeLayerFactory} IPDFStructTreeLayerFactory */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces\").IPDFTextLayerFactory} IPDFTextLayerFactory */\n/** @typedef {import(\"./interfaces\").IPDFXfaLayerFactory} IPDFXfaLayerFactory */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport {\n  AnnotationEditorType,\n  AnnotationEditorUIManager,\n  AnnotationMode,\n  createPromiseCapability,\n  PermissionFlag,\n  PixelsPerInch,\n  version,\n} from \"pdfjs-lib\";\nimport {\n  DEFAULT_SCALE,\n  DEFAULT_SCALE_DELTA,\n  DEFAULT_SCALE_VALUE,\n  docStyle,\n  getVisibleElements,\n  isPortraitOrientation,\n  isValidRotation,\n  isValidScrollMode,\n  isValidSpreadMode,\n  MAX_AUTO_SCALE,\n  MAX_SCALE,\n  MIN_SCALE,\n  PresentationModeState,\n  RendererType,\n  RenderingStates,\n  SCROLLBAR_PADDING,\n  scrollIntoView,\n  ScrollMode,\n  SpreadMode,\n  TextLayerMode,\n  UNKNOWN_SCALE,\n  VERTICAL_PADDING,\n  watchScroll,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorLayerBuilder } from \"./annotation_editor_layer_builder.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { StructTreeLayerBuilder } from \"./struct_tree_layer_builder.js\";\nimport { TextHighlighter } from \"./text_highlighter.js\";\nimport { TextLayerBuilder } from \"./text_layer_builder.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\nconst DEFAULT_CACHE_SIZE = 10;\nconst ENABLE_PERMISSIONS_CLASS = \"enablePermissions\";\n\nconst PagesCountLimit = {\n  FORCE_SCROLL_MODE_PAGE: 15000,\n  FORCE_LAZY_PAGE_INIT: 7500,\n  PAUSE_EAGER_PAGE_INIT: 250,\n};\n\nfunction isValidAnnotationEditorMode(mode) {\n  return (\n    Object.values(AnnotationEditorType).includes(mode) &&\n    mode !== AnnotationEditorType.DISABLE\n  );\n}\n\n/**\n * @typedef {Object} PDFViewerOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {HTMLDivElement} [viewer] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {IDownloadManager} [downloadManager] - The download manager\n *   component.\n * @property {PDFFindController} [findController] - The find controller\n *   component.\n * @property {PDFScriptingManager} [scriptingManager] - The scripting manager\n *   component.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {boolean} [removePageBorders] - Removes the border shadow around\n *   the pages. The default value is `false`.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n *   selection and searching is created. The constants from {TextLayerMode}\n *   should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n *   created, and if interactive form elements or `AnnotationStorage`-data are\n *   being rendered. The constants from {@link AnnotationMode} should be used;\n *   see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n *   The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {number} [annotationEditorMode] - Enables the creation and editing\n *   of new Annotations. The constants from {@link AnnotationEditorType} should\n *   be used. The default value is `AnnotationEditorType.NONE`.\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n *   mainly for annotation icons. Include trailing slash.\n * @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of\n *   landscape pages upon printing. The default is `false`.\n * @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default\n *   value is `false`.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n *   total pixels, i.e. width * height. Use -1 for no limit. The default value\n *   is 4096 * 4096 (16 mega-pixels).\n * @property {IL10n} l10n - Localization service.\n * @property {boolean} [enablePermissions] - Enables PDF document permissions,\n *   when they exist. The default value is `false`.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n *   with user defined ones in order to improve readability in high contrast\n *   mode.\n */\n\nclass PDFPageViewBuffer {\n  // Here we rely on the fact that `Set`s preserve the insertion order.\n  #buf = new Set();\n\n  #size = 0;\n\n  constructor(size) {\n    this.#size = size;\n  }\n\n  push(view) {\n    const buf = this.#buf;\n    if (buf.has(view)) {\n      buf.delete(view); // Move the view to the \"end\" of the buffer.\n    }\n    buf.add(view);\n\n    if (buf.size > this.#size) {\n      this.#destroyFirstView();\n    }\n  }\n\n  /**\n   * After calling resize, the size of the buffer will be `newSize`.\n   * The optional parameter `idsToKeep` is, if present, a Set of page-ids to\n   * push to the back of the buffer, delaying their destruction. The size of\n   * `idsToKeep` has no impact on the final size of the buffer; if `idsToKeep`\n   * is larger than `newSize`, some of those pages will be destroyed anyway.\n   */\n  resize(newSize, idsToKeep = null) {\n    this.#size = newSize;\n\n    const buf = this.#buf;\n    if (idsToKeep) {\n      const ii = buf.size;\n      let i = 1;\n      for (const view of buf) {\n        if (idsToKeep.has(view.id)) {\n          buf.delete(view); // Move the view to the \"end\" of the buffer.\n          buf.add(view);\n        }\n        if (++i > ii) {\n          break;\n        }\n      }\n    }\n\n    while (buf.size > this.#size) {\n      this.#destroyFirstView();\n    }\n  }\n\n  has(view) {\n    return this.#buf.has(view);\n  }\n\n  [Symbol.iterator]() {\n    return this.#buf.keys();\n  }\n\n  #destroyFirstView() {\n    const firstView = this.#buf.keys().next().value;\n\n    firstView?.destroy();\n    this.#buf.delete(firstView);\n  }\n}\n\n/**\n * Simple viewer control to display PDF content/pages.\n *\n * @implements {IPDFAnnotationLayerFactory}\n * @implements {IPDFAnnotationEditorLayerFactory}\n * @implements {IPDFStructTreeLayerFactory}\n * @implements {IPDFTextLayerFactory}\n * @implements {IPDFXfaLayerFactory}\n */\nclass PDFViewer {\n  #buffer = null;\n\n  #annotationEditorMode = AnnotationEditorType.NONE;\n\n  #annotationEditorUIManager = null;\n\n  #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n  #enablePermissions = false;\n\n  #previousContainerHeight = 0;\n\n  #scrollModePageState = null;\n\n  #onVisibilityChange = null;\n\n  /**\n   * @param {PDFViewerOptions} options\n   */\n  constructor(options) {\n    const viewerVersion =\n      typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\n    if (version !== viewerVersion) {\n      throw new Error(\n        `The API version \"${version}\" does not match the Viewer version \"${viewerVersion}\".`\n      );\n    }\n    this.container = options.container;\n    this.viewer = options.viewer || options.container.firstElementChild;\n\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n    ) {\n      if (\n        !(\n          this.container?.tagName.toUpperCase() === \"DIV\" &&\n          this.viewer?.tagName.toUpperCase() === \"DIV\"\n        )\n      ) {\n        throw new Error(\"Invalid `container` and/or `viewer` option.\");\n      }\n\n      if (\n        this.container.offsetParent &&\n        getComputedStyle(this.container).position !== \"absolute\"\n      ) {\n        throw new Error(\"The `container` must be absolutely positioned.\");\n      }\n    }\n    this.eventBus = options.eventBus;\n    this.linkService = options.linkService || new SimpleLinkService();\n    this.downloadManager = options.downloadManager || null;\n    this.findController = options.findController || null;\n    this._scriptingManager = options.scriptingManager || null;\n    this.removePageBorders = options.removePageBorders || false;\n    this.textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n    this.#annotationMode =\n      options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n    this.#annotationEditorMode =\n      options.annotationEditorMode ?? AnnotationEditorType.NONE;\n    this.imageResourcesPath = options.imageResourcesPath || \"\";\n    this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n    ) {\n      this.renderer = options.renderer || RendererType.CANVAS;\n    }\n    this.useOnlyCssZoom = options.useOnlyCssZoom || false;\n    this.maxCanvasPixels = options.maxCanvasPixels;\n    this.l10n = options.l10n || NullL10n;\n    this.#enablePermissions = options.enablePermissions || false;\n    this.pageColors = options.pageColors || null;\n\n    if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n      if (\n        this.pageColors &&\n        !(\n          CSS.supports(\"color\", this.pageColors.background) &&\n          CSS.supports(\"color\", this.pageColors.foreground)\n        )\n      ) {\n        if (this.pageColors.background || this.pageColors.foreground) {\n          console.warn(\n            \"PDFViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used.\"\n          );\n        }\n        this.pageColors = null;\n      }\n    }\n\n    this.defaultRenderingQueue = !options.renderingQueue;\n    if (this.defaultRenderingQueue) {\n      // Custom rendering queue is not specified, using default one\n      this.renderingQueue = new PDFRenderingQueue();\n      this.renderingQueue.setViewer(this);\n    } else {\n      this.renderingQueue = options.renderingQueue;\n    }\n\n    this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));\n    this.presentationModeState = PresentationModeState.UNKNOWN;\n    this._onBeforeDraw = this._onAfterDraw = null;\n    this._resetView();\n\n    if (this.removePageBorders) {\n      this.viewer.classList.add(\"removePageBorders\");\n    }\n    this.updateContainerHeightCss();\n  }\n\n  get pagesCount() {\n    return this._pages.length;\n  }\n\n  getPageView(index) {\n    return this._pages[index];\n  }\n\n  /**\n   * @type {boolean} - True if all {PDFPageView} objects are initialized.\n   */\n  get pageViewsReady() {\n    if (!this._pagesCapability.settled) {\n      return false;\n    }\n    // Prevent printing errors when 'disableAutoFetch' is set, by ensuring\n    // that *all* pages have in fact been completely loaded.\n    return this._pages.every(function (pageView) {\n      return pageView?.pdfPage;\n    });\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get renderForms() {\n    return this.#annotationMode === AnnotationMode.ENABLE_FORMS;\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get enableScripting() {\n    return !!this._scriptingManager;\n  }\n\n  /**\n   * @type {number}\n   */\n  get currentPageNumber() {\n    return this._currentPageNumber;\n  }\n\n  /**\n   * @param {number} val - The page number.\n   */\n  set currentPageNumber(val) {\n    if (!Number.isInteger(val)) {\n      throw new Error(\"Invalid page number.\");\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    // The intent can be to just reset a scroll position and/or scale.\n    if (!this._setCurrentPageNumber(val, /* resetCurrentPageView = */ true)) {\n      console.error(`currentPageNumber: \"${val}\" is not a valid page.`);\n    }\n  }\n\n  /**\n   * @returns {boolean} Whether the pageNumber is valid (within bounds).\n   * @private\n   */\n  _setCurrentPageNumber(val, resetCurrentPageView = false) {\n    if (this._currentPageNumber === val) {\n      if (resetCurrentPageView) {\n        this.#resetCurrentPageView();\n      }\n      return true;\n    }\n\n    if (!(0 < val && val <= this.pagesCount)) {\n      return false;\n    }\n    const previous = this._currentPageNumber;\n    this._currentPageNumber = val;\n\n    this.eventBus.dispatch(\"pagechanging\", {\n      source: this,\n      pageNumber: val,\n      pageLabel: this._pageLabels?.[val - 1] ?? null,\n      previous,\n    });\n\n    if (resetCurrentPageView) {\n      this.#resetCurrentPageView();\n    }\n    return true;\n  }\n\n  /**\n   * @type {string|null} Returns the current page label, or `null` if no page\n   *   labels exist.\n   */\n  get currentPageLabel() {\n    return this._pageLabels?.[this._currentPageNumber - 1] ?? null;\n  }\n\n  /**\n   * @param {string} val - The page label.\n   */\n  set currentPageLabel(val) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    let page = val | 0; // Fallback page number.\n    if (this._pageLabels) {\n      const i = this._pageLabels.indexOf(val);\n      if (i >= 0) {\n        page = i + 1;\n      }\n    }\n    // The intent can be to just reset a scroll position and/or scale.\n    if (!this._setCurrentPageNumber(page, /* resetCurrentPageView = */ true)) {\n      console.error(`currentPageLabel: \"${val}\" is not a valid page.`);\n    }\n  }\n\n  /**\n   * @type {number}\n   */\n  get currentScale() {\n    return this._currentScale !== UNKNOWN_SCALE\n      ? this._currentScale\n      : DEFAULT_SCALE;\n  }\n\n  /**\n   * @param {number} val - Scale of the pages in percents.\n   */\n  set currentScale(val) {\n    if (isNaN(val)) {\n      throw new Error(\"Invalid numeric scale.\");\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    this._setScale(val, false);\n  }\n\n  /**\n   * @type {string}\n   */\n  get currentScaleValue() {\n    return this._currentScaleValue;\n  }\n\n  /**\n   * @param val - The scale of the pages (in percent or predefined value).\n   */\n  set currentScaleValue(val) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    this._setScale(val, false);\n  }\n\n  /**\n   * @type {number}\n   */\n  get pagesRotation() {\n    return this._pagesRotation;\n  }\n\n  /**\n   * @param {number} rotation - The rotation of the pages (0, 90, 180, 270).\n   */\n  set pagesRotation(rotation) {\n    if (!isValidRotation(rotation)) {\n      throw new Error(\"Invalid pages rotation angle.\");\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    // Normalize the rotation, by clamping it to the [0, 360) range.\n    rotation %= 360;\n    if (rotation < 0) {\n      rotation += 360;\n    }\n    if (this._pagesRotation === rotation) {\n      return; // The rotation didn't change.\n    }\n    this._pagesRotation = rotation;\n\n    const pageNumber = this._currentPageNumber;\n\n    const updateArgs = { rotation };\n    for (const pageView of this._pages) {\n      pageView.update(updateArgs);\n    }\n    // Prevent errors in case the rotation changes *before* the scale has been\n    // set to a non-default value.\n    if (this._currentScaleValue) {\n      this._setScale(this._currentScaleValue, true);\n    }\n\n    this.eventBus.dispatch(\"rotationchanging\", {\n      source: this,\n      pagesRotation: rotation,\n      pageNumber,\n    });\n\n    if (this.defaultRenderingQueue) {\n      this.update();\n    }\n  }\n\n  get firstPagePromise() {\n    return this.pdfDocument ? this._firstPageCapability.promise : null;\n  }\n\n  get onePageRendered() {\n    return this.pdfDocument ? this._onePageRenderedCapability.promise : null;\n  }\n\n  get pagesPromise() {\n    return this.pdfDocument ? this._pagesCapability.promise : null;\n  }\n\n  /**\n   * Currently only *some* permissions are supported.\n   * @returns {Object}\n   */\n  #initializePermissions(permissions) {\n    const params = {\n      annotationEditorMode: this.#annotationEditorMode,\n      annotationMode: this.#annotationMode,\n      textLayerMode: this.textLayerMode,\n    };\n    if (!permissions) {\n      return params;\n    }\n\n    if (!permissions.includes(PermissionFlag.COPY)) {\n      this.viewer.classList.add(ENABLE_PERMISSIONS_CLASS);\n    }\n\n    if (!permissions.includes(PermissionFlag.MODIFY_CONTENTS)) {\n      params.annotationEditorMode = AnnotationEditorType.DISABLE;\n    }\n\n    if (\n      !permissions.includes(PermissionFlag.MODIFY_ANNOTATIONS) &&\n      !permissions.includes(PermissionFlag.FILL_INTERACTIVE_FORMS) &&\n      this.#annotationMode === AnnotationMode.ENABLE_FORMS\n    ) {\n      params.annotationMode = AnnotationMode.ENABLE;\n    }\n\n    return params;\n  }\n\n  #onePageRenderedOrForceFetch() {\n    // Unless the viewer *and* its pages are visible, rendering won't start and\n    // `this._onePageRenderedCapability` thus won't be resolved.\n    // To ensure that automatic printing, on document load, still works even in\n    // those cases we force-allow fetching of all pages when:\n    //  - The current window/tab is inactive, which will prevent rendering since\n    //    `requestAnimationFrame` is being used; fixes bug 1746213.\n    //  - The viewer is hidden in the DOM, e.g. in a `display: none` <iframe>\n    //    element; fixes bug 1618621.\n    //  - The viewer is visible, but none of the pages are (e.g. if the\n    //    viewer is very small); fixes bug 1618955.\n    if (\n      document.visibilityState === \"hidden\" ||\n      !this.container.offsetParent ||\n      this._getVisiblePages().views.length === 0\n    ) {\n      return Promise.resolve();\n    }\n\n    // Handle the window/tab becoming inactive *after* rendering has started;\n    // fixes (another part of) bug 1746213.\n    const visibilityChangePromise = new Promise(resolve => {\n      this.#onVisibilityChange = () => {\n        if (document.visibilityState !== \"hidden\") {\n          return;\n        }\n        resolve();\n\n        document.removeEventListener(\n          \"visibilitychange\",\n          this.#onVisibilityChange\n        );\n        this.#onVisibilityChange = null;\n      };\n      document.addEventListener(\"visibilitychange\", this.#onVisibilityChange);\n    });\n\n    return Promise.race([\n      this._onePageRenderedCapability.promise,\n      visibilityChangePromise,\n    ]);\n  }\n\n  /**\n   * @param {PDFDocumentProxy} pdfDocument\n   */\n  setDocument(pdfDocument) {\n    if (this.pdfDocument) {\n      this.eventBus.dispatch(\"pagesdestroy\", { source: this });\n\n      this._cancelRendering();\n      this._resetView();\n\n      this.findController?.setDocument(null);\n      this._scriptingManager?.setDocument(null);\n\n      if (this.#annotationEditorUIManager) {\n        this.#annotationEditorUIManager.destroy();\n        this.#annotationEditorUIManager = null;\n      }\n    }\n\n    this.pdfDocument = pdfDocument;\n    if (!pdfDocument) {\n      return;\n    }\n    const isPureXfa = pdfDocument.isPureXfa;\n    const pagesCount = pdfDocument.numPages;\n    const firstPagePromise = pdfDocument.getPage(1);\n    // Rendering (potentially) depends on this, hence fetching it immediately.\n    const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig();\n    const permissionsPromise = this.#enablePermissions\n      ? pdfDocument.getPermissions()\n      : Promise.resolve();\n\n    // Given that browsers don't handle huge amounts of DOM-elements very well,\n    // enforce usage of PAGE-scrolling when loading *very* long/large documents.\n    if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n      console.warn(\n        \"Forcing PAGE-scrolling for performance reasons, given the length of the document.\"\n      );\n      const mode = (this._scrollMode = ScrollMode.PAGE);\n      this.eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n    }\n\n    this._pagesCapability.promise.then(\n      () => {\n        this.eventBus.dispatch(\"pagesloaded\", { source: this, pagesCount });\n      },\n      () => {\n        /* Prevent \"Uncaught (in promise)\"-messages in the console. */\n      }\n    );\n\n    this._onBeforeDraw = evt => {\n      const pageView = this._pages[evt.pageNumber - 1];\n      if (!pageView) {\n        return;\n      }\n      // Add the page to the buffer at the start of drawing. That way it can be\n      // evicted from the buffer and destroyed even if we pause its rendering.\n      this.#buffer.push(pageView);\n    };\n    this.eventBus._on(\"pagerender\", this._onBeforeDraw);\n\n    this._onAfterDraw = evt => {\n      if (evt.cssTransform || this._onePageRenderedCapability.settled) {\n        return;\n      }\n      this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });\n\n      this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n      this._onAfterDraw = null;\n\n      if (this.#onVisibilityChange) {\n        document.removeEventListener(\n          \"visibilitychange\",\n          this.#onVisibilityChange\n        );\n        this.#onVisibilityChange = null;\n      }\n    };\n    this.eventBus._on(\"pagerendered\", this._onAfterDraw);\n\n    // Fetch a single page so we can get a viewport that will be the default\n    // viewport for all pages\n    Promise.all([firstPagePromise, permissionsPromise])\n      .then(([firstPdfPage, permissions]) => {\n        if (pdfDocument !== this.pdfDocument) {\n          return; // The document was closed while the first page resolved.\n        }\n        this._firstPageCapability.resolve(firstPdfPage);\n        this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n        const { annotationEditorMode, annotationMode, textLayerMode } =\n          this.#initializePermissions(permissions);\n\n        if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n          const mode = annotationEditorMode;\n\n          if (isPureXfa) {\n            console.warn(\"Warning: XFA-editing is not implemented.\");\n          } else if (isValidAnnotationEditorMode(mode)) {\n            this.#annotationEditorUIManager = new AnnotationEditorUIManager(\n              this.container,\n              this.eventBus\n            );\n            if (mode !== AnnotationEditorType.NONE) {\n              this.#annotationEditorUIManager.updateMode(mode);\n            }\n          } else {\n            console.error(`Invalid AnnotationEditor mode: ${mode}`);\n          }\n        }\n\n        const viewerElement =\n          this._scrollMode === ScrollMode.PAGE ? null : this.viewer;\n        const scale = this.currentScale;\n        const viewport = firstPdfPage.getViewport({\n          scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n        });\n        const textLayerFactory =\n          textLayerMode !== TextLayerMode.DISABLE && !isPureXfa ? this : null;\n        const annotationLayerFactory =\n          annotationMode !== AnnotationMode.DISABLE ? this : null;\n        const xfaLayerFactory = isPureXfa ? this : null;\n        const annotationEditorLayerFactory = this.#annotationEditorUIManager\n          ? this\n          : null;\n\n        for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n          const pageView = new PDFPageView({\n            container: viewerElement,\n            eventBus: this.eventBus,\n            id: pageNum,\n            scale,\n            defaultViewport: viewport.clone(),\n            optionalContentConfigPromise,\n            renderingQueue: this.renderingQueue,\n            textLayerFactory,\n            textLayerMode,\n            annotationLayerFactory,\n            annotationMode,\n            xfaLayerFactory,\n            annotationEditorLayerFactory,\n            textHighlighterFactory: this,\n            structTreeLayerFactory: this,\n            imageResourcesPath: this.imageResourcesPath,\n            renderer:\n              typeof PDFJSDev === \"undefined\" ||\n              PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n                ? this.renderer\n                : null,\n            useOnlyCssZoom: this.useOnlyCssZoom,\n            maxCanvasPixels: this.maxCanvasPixels,\n            pageColors: this.pageColors,\n            l10n: this.l10n,\n          });\n          this._pages.push(pageView);\n        }\n        // Set the first `pdfPage` immediately, since it's already loaded,\n        // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n        // the `this.#ensurePdfPageLoaded` method before rendering can start.\n        const firstPageView = this._pages[0];\n        if (firstPageView) {\n          firstPageView.setPdfPage(firstPdfPage);\n          this.linkService.cachePageRef(1, firstPdfPage.ref);\n        }\n\n        if (this._scrollMode === ScrollMode.PAGE) {\n          // Ensure that the current page becomes visible on document load.\n          this.#ensurePageViewVisible();\n        } else if (this._spreadMode !== SpreadMode.NONE) {\n          this._updateSpreadMode();\n        }\n\n        // Fetch all the pages since the viewport is needed before printing\n        // starts to create the correct size canvas. Wait until one page is\n        // rendered so we don't tie up too many resources early on.\n        this.#onePageRenderedOrForceFetch().then(async () => {\n          this.findController?.setDocument(pdfDocument); // Enable searching.\n          this._scriptingManager?.setDocument(pdfDocument); // Enable scripting.\n\n          if (this.#annotationEditorUIManager) {\n            // Ensure that the Editor buttons, in the toolbar, are updated.\n            this.eventBus.dispatch(\"annotationeditormodechanged\", {\n              source: this,\n              mode: this.#annotationEditorMode,\n            });\n          }\n\n          // In addition to 'disableAutoFetch' being set, also attempt to reduce\n          // resource usage when loading *very* long/large documents.\n          if (\n            pdfDocument.loadingParams.disableAutoFetch ||\n            pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT\n          ) {\n            // XXX: Printing is semi-broken with auto fetch disabled.\n            this._pagesCapability.resolve();\n            return;\n          }\n          let getPagesLeft = pagesCount - 1; // The first page was already loaded.\n\n          if (getPagesLeft <= 0) {\n            this._pagesCapability.resolve();\n            return;\n          }\n          for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {\n            const promise = pdfDocument.getPage(pageNum).then(\n              pdfPage => {\n                const pageView = this._pages[pageNum - 1];\n                if (!pageView.pdfPage) {\n                  pageView.setPdfPage(pdfPage);\n                }\n                this.linkService.cachePageRef(pageNum, pdfPage.ref);\n                if (--getPagesLeft === 0) {\n                  this._pagesCapability.resolve();\n                }\n              },\n              reason => {\n                console.error(\n                  `Unable to get page ${pageNum} to initialize viewer`,\n                  reason\n                );\n                if (--getPagesLeft === 0) {\n                  this._pagesCapability.resolve();\n                }\n              }\n            );\n\n            if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {\n              await promise;\n            }\n          }\n        });\n\n        this.eventBus.dispatch(\"pagesinit\", { source: this });\n\n        pdfDocument.getMetadata().then(({ info }) => {\n          if (pdfDocument !== this.pdfDocument) {\n            return; // The document was closed while the metadata resolved.\n          }\n          if (info.Language) {\n            this.viewer.lang = info.Language;\n          }\n        });\n\n        if (this.defaultRenderingQueue) {\n          this.update();\n        }\n      })\n      .catch(reason => {\n        console.error(\"Unable to initialize viewer\", reason);\n\n        this._pagesCapability.reject(reason);\n      });\n  }\n\n  /**\n   * @param {Array|null} labels\n   */\n  setPageLabels(labels) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    if (!labels) {\n      this._pageLabels = null;\n    } else if (\n      !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n    ) {\n      this._pageLabels = null;\n      console.error(`setPageLabels: Invalid page labels.`);\n    } else {\n      this._pageLabels = labels;\n    }\n    // Update all the `PDFPageView` instances.\n    for (let i = 0, ii = this._pages.length; i < ii; i++) {\n      this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);\n    }\n  }\n\n  _resetView() {\n    this._pages = [];\n    this._currentPageNumber = 1;\n    this._currentScale = UNKNOWN_SCALE;\n    this._currentScaleValue = null;\n    this._pageLabels = null;\n    this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);\n    this._location = null;\n    this._pagesRotation = 0;\n    this._optionalContentConfigPromise = null;\n    this._firstPageCapability = createPromiseCapability();\n    this._onePageRenderedCapability = createPromiseCapability();\n    this._pagesCapability = createPromiseCapability();\n    this._scrollMode = ScrollMode.VERTICAL;\n    this._previousScrollMode = ScrollMode.UNKNOWN;\n    this._spreadMode = SpreadMode.NONE;\n\n    this.#scrollModePageState = {\n      previousPageNumber: 1,\n      scrollDown: true,\n      pages: [],\n    };\n\n    if (this._onBeforeDraw) {\n      this.eventBus._off(\"pagerender\", this._onBeforeDraw);\n      this._onBeforeDraw = null;\n    }\n    if (this._onAfterDraw) {\n      this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n      this._onAfterDraw = null;\n    }\n    if (this.#onVisibilityChange) {\n      document.removeEventListener(\n        \"visibilitychange\",\n        this.#onVisibilityChange\n      );\n      this.#onVisibilityChange = null;\n    }\n    // Remove the pages from the DOM...\n    this.viewer.textContent = \"\";\n    // ... and reset the Scroll mode CSS class(es) afterwards.\n    this._updateScrollMode();\n\n    this.viewer.removeAttribute(\"lang\");\n    // Reset all PDF document permissions.\n    this.viewer.classList.remove(ENABLE_PERMISSIONS_CLASS);\n  }\n\n  #ensurePageViewVisible() {\n    if (this._scrollMode !== ScrollMode.PAGE) {\n      throw new Error(\"#ensurePageViewVisible: Invalid scrollMode value.\");\n    }\n    const pageNumber = this._currentPageNumber,\n      state = this.#scrollModePageState,\n      viewer = this.viewer;\n\n    // Temporarily remove all the pages from the DOM...\n    viewer.textContent = \"\";\n    // ... and clear out the active ones.\n    state.pages.length = 0;\n\n    if (this._spreadMode === SpreadMode.NONE && !this.isInPresentationMode) {\n      // Finally, append the new page to the viewer.\n      const pageView = this._pages[pageNumber - 1];\n      viewer.append(pageView.div);\n\n      state.pages.push(pageView);\n    } else {\n      const pageIndexSet = new Set(),\n        parity = this._spreadMode - 1;\n\n      // Determine the pageIndices in the new spread.\n      if (parity === -1) {\n        // PresentationMode is active, with `SpreadMode.NONE` set.\n        pageIndexSet.add(pageNumber - 1);\n      } else if (pageNumber % 2 !== parity) {\n        // Left-hand side page.\n        pageIndexSet.add(pageNumber - 1);\n        pageIndexSet.add(pageNumber);\n      } else {\n        // Right-hand side page.\n        pageIndexSet.add(pageNumber - 2);\n        pageIndexSet.add(pageNumber - 1);\n      }\n\n      // Finally, append the new pages to the viewer and apply the spreadMode.\n      const spread = document.createElement(\"div\");\n      spread.className = \"spread\";\n\n      if (this.isInPresentationMode) {\n        const dummyPage = document.createElement(\"div\");\n        dummyPage.className = \"dummyPage\";\n        spread.append(dummyPage);\n      }\n\n      for (const i of pageIndexSet) {\n        const pageView = this._pages[i];\n        if (!pageView) {\n          continue;\n        }\n        spread.append(pageView.div);\n\n        state.pages.push(pageView);\n      }\n      viewer.append(spread);\n    }\n\n    state.scrollDown = pageNumber >= state.previousPageNumber;\n    state.previousPageNumber = pageNumber;\n  }\n\n  _scrollUpdate() {\n    if (this.pagesCount === 0) {\n      return;\n    }\n    this.update();\n  }\n\n  #scrollIntoView(pageView, pageSpot = null) {\n    const { div, id } = pageView;\n\n    // Ensure that `this._currentPageNumber` is correct, when `#scrollIntoView`\n    // is called directly (and not from `#resetCurrentPageView`).\n    if (this._currentPageNumber !== id) {\n      this._setCurrentPageNumber(id);\n    }\n    if (this._scrollMode === ScrollMode.PAGE) {\n      this.#ensurePageViewVisible();\n      // Ensure that rendering always occurs, to avoid showing a blank page,\n      // even if the current position doesn't change when the page is scrolled.\n      this.update();\n    }\n\n    if (!pageSpot && !this.isInPresentationMode) {\n      const left = div.offsetLeft + div.clientLeft,\n        right = left + div.clientWidth;\n      const { scrollLeft, clientWidth } = this.container;\n      if (\n        this._scrollMode === ScrollMode.HORIZONTAL ||\n        left < scrollLeft ||\n        right > scrollLeft + clientWidth\n      ) {\n        pageSpot = { left: 0, top: 0 };\n      }\n    }\n    scrollIntoView(div, pageSpot);\n\n    // Ensure that the correct *initial* document position is set, when any\n    // OpenParameters are used, for documents with non-default Scroll/Spread\n    // modes (fixes issue 15695). This is necessary since the scroll-handler\n    // invokes the `update`-method asynchronously, and `this._location` could\n    // thus be wrong when the initial zooming occurs in the default viewer.\n    if (!this._currentScaleValue && this._location) {\n      this._location = null;\n    }\n  }\n\n  /**\n   * Prevent unnecessary re-rendering of all pages when the scale changes\n   * only because of limited numerical precision.\n   */\n  #isSameScale(newScale) {\n    return (\n      newScale === this._currentScale ||\n      Math.abs(newScale - this._currentScale) < 1e-15\n    );\n  }\n\n  _setScaleUpdatePages(newScale, newValue, noScroll = false, preset = false) {\n    this._currentScaleValue = newValue.toString();\n\n    if (this.#isSameScale(newScale)) {\n      if (preset) {\n        this.eventBus.dispatch(\"scalechanging\", {\n          source: this,\n          scale: newScale,\n          presetValue: newValue,\n        });\n      }\n      return;\n    }\n\n    docStyle.setProperty(\n      \"--scale-factor\",\n      newScale * PixelsPerInch.PDF_TO_CSS_UNITS\n    );\n\n    const updateArgs = { scale: newScale };\n    for (const pageView of this._pages) {\n      pageView.update(updateArgs);\n    }\n    this._currentScale = newScale;\n\n    if (!noScroll) {\n      let page = this._currentPageNumber,\n        dest;\n      if (\n        this._location &&\n        !(this.isInPresentationMode || this.isChangingPresentationMode)\n      ) {\n        page = this._location.pageNumber;\n        dest = [\n          null,\n          { name: \"XYZ\" },\n          this._location.left,\n          this._location.top,\n          null,\n        ];\n      }\n      this.scrollPageIntoView({\n        pageNumber: page,\n        destArray: dest,\n        allowNegativeOffset: true,\n      });\n    }\n\n    this.eventBus.dispatch(\"scalechanging\", {\n      source: this,\n      scale: newScale,\n      presetValue: preset ? newValue : undefined,\n    });\n\n    if (this.defaultRenderingQueue) {\n      this.update();\n    }\n    this.updateContainerHeightCss();\n  }\n\n  /**\n   * @private\n   */\n  get _pageWidthScaleFactor() {\n    if (\n      this._spreadMode !== SpreadMode.NONE &&\n      this._scrollMode !== ScrollMode.HORIZONTAL\n    ) {\n      return 2;\n    }\n    return 1;\n  }\n\n  _setScale(value, noScroll = false) {\n    let scale = parseFloat(value);\n\n    if (scale > 0) {\n      this._setScaleUpdatePages(scale, value, noScroll, /* preset = */ false);\n    } else {\n      const currentPage = this._pages[this._currentPageNumber - 1];\n      if (!currentPage) {\n        return;\n      }\n      let hPadding = SCROLLBAR_PADDING,\n        vPadding = VERTICAL_PADDING;\n\n      if (this.isInPresentationMode) {\n        hPadding = vPadding = 4;\n      } else if (this.removePageBorders) {\n        hPadding = vPadding = 0;\n      } else if (this._scrollMode === ScrollMode.HORIZONTAL) {\n        [hPadding, vPadding] = [vPadding, hPadding]; // Swap the padding values.\n      }\n      const pageWidthScale =\n        (((this.container.clientWidth - hPadding) / currentPage.width) *\n          currentPage.scale) /\n        this._pageWidthScaleFactor;\n      const pageHeightScale =\n        ((this.container.clientHeight - vPadding) / currentPage.height) *\n        currentPage.scale;\n      switch (value) {\n        case \"page-actual\":\n          scale = 1;\n          break;\n        case \"page-width\":\n          scale = pageWidthScale;\n          break;\n        case \"page-height\":\n          scale = pageHeightScale;\n          break;\n        case \"page-fit\":\n          scale = Math.min(pageWidthScale, pageHeightScale);\n          break;\n        case \"auto\":\n          // For pages in landscape mode, fit the page height to the viewer\n          // *unless* the page would thus become too wide to fit horizontally.\n          const horizontalScale = isPortraitOrientation(currentPage)\n            ? pageWidthScale\n            : Math.min(pageHeightScale, pageWidthScale);\n          scale = Math.min(MAX_AUTO_SCALE, horizontalScale);\n          break;\n        default:\n          console.error(`_setScale: \"${value}\" is an unknown zoom value.`);\n          return;\n      }\n      this._setScaleUpdatePages(scale, value, noScroll, /* preset = */ true);\n    }\n  }\n\n  /**\n   * Refreshes page view: scrolls to the current page and updates the scale.\n   */\n  #resetCurrentPageView() {\n    const pageView = this._pages[this._currentPageNumber - 1];\n\n    if (this.isInPresentationMode) {\n      // Fixes the case when PDF has different page sizes.\n      this._setScale(this._currentScaleValue, true);\n    }\n    this.#scrollIntoView(pageView);\n  }\n\n  /**\n   * @param {string} label - The page label.\n   * @returns {number|null} The page number corresponding to the page label,\n   *   or `null` when no page labels exist and/or the input is invalid.\n   */\n  pageLabelToPageNumber(label) {\n    if (!this._pageLabels) {\n      return null;\n    }\n    const i = this._pageLabels.indexOf(label);\n    if (i < 0) {\n      return null;\n    }\n    return i + 1;\n  }\n\n  /**\n   * @typedef {Object} ScrollPageIntoViewParameters\n   * @property {number} pageNumber - The page number.\n   * @property {Array} [destArray] - The original PDF destination array, in the\n   *   format: <page-ref> </XYZ|/FitXXX> <args..>\n   * @property {boolean} [allowNegativeOffset] - Allow negative page offsets.\n   *   The default value is `false`.\n   * @property {boolean} [ignoreDestinationZoom] - Ignore the zoom argument in\n   *   the destination array. The default value is `false`.\n   */\n\n  /**\n   * Scrolls page into view.\n   * @param {ScrollPageIntoViewParameters} params\n   */\n  scrollPageIntoView({\n    pageNumber,\n    destArray = null,\n    allowNegativeOffset = false,\n    ignoreDestinationZoom = false,\n  }) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const pageView =\n      Number.isInteger(pageNumber) && this._pages[pageNumber - 1];\n    if (!pageView) {\n      console.error(\n        `scrollPageIntoView: \"${pageNumber}\" is not a valid pageNumber parameter.`\n      );\n      return;\n    }\n\n    if (this.isInPresentationMode || !destArray) {\n      this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n      return;\n    }\n    let x = 0,\n      y = 0;\n    let width = 0,\n      height = 0,\n      widthScale,\n      heightScale;\n    const changeOrientation = pageView.rotation % 180 !== 0;\n    const pageWidth =\n      (changeOrientation ? pageView.height : pageView.width) /\n      pageView.scale /\n      PixelsPerInch.PDF_TO_CSS_UNITS;\n    const pageHeight =\n      (changeOrientation ? pageView.width : pageView.height) /\n      pageView.scale /\n      PixelsPerInch.PDF_TO_CSS_UNITS;\n    let scale = 0;\n    switch (destArray[1].name) {\n      case \"XYZ\":\n        x = destArray[2];\n        y = destArray[3];\n        scale = destArray[4];\n        // If x and/or y coordinates are not supplied, default to\n        // _top_ left of the page (not the obvious bottom left,\n        // since aligning the bottom of the intended page with the\n        // top of the window is rarely helpful).\n        x = x !== null ? x : 0;\n        y = y !== null ? y : pageHeight;\n        break;\n      case \"Fit\":\n      case \"FitB\":\n        scale = \"page-fit\";\n        break;\n      case \"FitH\":\n      case \"FitBH\":\n        y = destArray[2];\n        scale = \"page-width\";\n        // According to the PDF spec, section 12.3.2.2, a `null` value in the\n        // parameter should maintain the position relative to the new page.\n        if (y === null && this._location) {\n          x = this._location.left;\n          y = this._location.top;\n        } else if (typeof y !== \"number\" || y < 0) {\n          // The \"top\" value isn't optional, according to the spec, however some\n          // bad PDF generators will pretend that it is (fixes bug 1663390).\n          y = pageHeight;\n        }\n        break;\n      case \"FitV\":\n      case \"FitBV\":\n        x = destArray[2];\n        width = pageWidth;\n        height = pageHeight;\n        scale = \"page-height\";\n        break;\n      case \"FitR\":\n        x = destArray[2];\n        y = destArray[3];\n        width = destArray[4] - x;\n        height = destArray[5] - y;\n        const hPadding = this.removePageBorders ? 0 : SCROLLBAR_PADDING;\n        const vPadding = this.removePageBorders ? 0 : VERTICAL_PADDING;\n\n        widthScale =\n          (this.container.clientWidth - hPadding) /\n          width /\n          PixelsPerInch.PDF_TO_CSS_UNITS;\n        heightScale =\n          (this.container.clientHeight - vPadding) /\n          height /\n          PixelsPerInch.PDF_TO_CSS_UNITS;\n        scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));\n        break;\n      default:\n        console.error(\n          `scrollPageIntoView: \"${destArray[1].name}\" is not a valid destination type.`\n        );\n        return;\n    }\n\n    if (!ignoreDestinationZoom) {\n      if (scale && scale !== this._currentScale) {\n        this.currentScaleValue = scale;\n      } else if (this._currentScale === UNKNOWN_SCALE) {\n        this.currentScaleValue = DEFAULT_SCALE_VALUE;\n      }\n    }\n\n    if (scale === \"page-fit\" && !destArray[4]) {\n      this.#scrollIntoView(pageView);\n      return;\n    }\n\n    const boundingRect = [\n      pageView.viewport.convertToViewportPoint(x, y),\n      pageView.viewport.convertToViewportPoint(x + width, y + height),\n    ];\n    let left = Math.min(boundingRect[0][0], boundingRect[1][0]);\n    let top = Math.min(boundingRect[0][1], boundingRect[1][1]);\n\n    if (!allowNegativeOffset) {\n      // Some bad PDF generators will create destinations with e.g. top values\n      // that exceeds the page height. Ensure that offsets are not negative,\n      // to prevent a previous page from becoming visible (fixes bug 874482).\n      left = Math.max(left, 0);\n      top = Math.max(top, 0);\n    }\n    this.#scrollIntoView(pageView, /* pageSpot = */ { left, top });\n  }\n\n  _updateLocation(firstPage) {\n    const currentScale = this._currentScale;\n    const currentScaleValue = this._currentScaleValue;\n    const normalizedScaleValue =\n      parseFloat(currentScaleValue) === currentScale\n        ? Math.round(currentScale * 10000) / 100\n        : currentScaleValue;\n\n    const pageNumber = firstPage.id;\n    const currentPageView = this._pages[pageNumber - 1];\n    const container = this.container;\n    const topLeft = currentPageView.getPagePoint(\n      container.scrollLeft - firstPage.x,\n      container.scrollTop - firstPage.y\n    );\n    const intLeft = Math.round(topLeft[0]);\n    const intTop = Math.round(topLeft[1]);\n\n    let pdfOpenParams = `#page=${pageNumber}`;\n    if (!this.isInPresentationMode) {\n      pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;\n    }\n\n    this._location = {\n      pageNumber,\n      scale: normalizedScaleValue,\n      top: intTop,\n      left: intLeft,\n      rotation: this._pagesRotation,\n      pdfOpenParams,\n    };\n  }\n\n  update() {\n    const visible = this._getVisiblePages();\n    const visiblePages = visible.views,\n      numVisiblePages = visiblePages.length;\n\n    if (numVisiblePages === 0) {\n      return;\n    }\n    const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);\n    this.#buffer.resize(newCacheSize, visible.ids);\n\n    this.renderingQueue.renderHighestPriority(visible);\n\n    const isSimpleLayout =\n      this._spreadMode === SpreadMode.NONE &&\n      (this._scrollMode === ScrollMode.PAGE ||\n        this._scrollMode === ScrollMode.VERTICAL);\n    const currentId = this._currentPageNumber;\n    let stillFullyVisible = false;\n\n    for (const page of visiblePages) {\n      if (page.percent < 100) {\n        break;\n      }\n      if (page.id === currentId && isSimpleLayout) {\n        stillFullyVisible = true;\n        break;\n      }\n    }\n    this._setCurrentPageNumber(\n      stillFullyVisible ? currentId : visiblePages[0].id\n    );\n\n    this._updateLocation(visible.first);\n    this.eventBus.dispatch(\"updateviewarea\", {\n      source: this,\n      location: this._location,\n    });\n  }\n\n  containsElement(element) {\n    return this.container.contains(element);\n  }\n\n  focus() {\n    this.container.focus();\n  }\n\n  get _isContainerRtl() {\n    return getComputedStyle(this.container).direction === \"rtl\";\n  }\n\n  get isInPresentationMode() {\n    return this.presentationModeState === PresentationModeState.FULLSCREEN;\n  }\n\n  get isChangingPresentationMode() {\n    return this.presentationModeState === PresentationModeState.CHANGING;\n  }\n\n  get isHorizontalScrollbarEnabled() {\n    return this.isInPresentationMode\n      ? false\n      : this.container.scrollWidth > this.container.clientWidth;\n  }\n\n  get isVerticalScrollbarEnabled() {\n    return this.isInPresentationMode\n      ? false\n      : this.container.scrollHeight > this.container.clientHeight;\n  }\n\n  _getVisiblePages() {\n    const views =\n        this._scrollMode === ScrollMode.PAGE\n          ? this.#scrollModePageState.pages\n          : this._pages,\n      horizontal = this._scrollMode === ScrollMode.HORIZONTAL,\n      rtl = horizontal && this._isContainerRtl;\n\n    return getVisibleElements({\n      scrollEl: this.container,\n      views,\n      sortByVisibility: true,\n      horizontal,\n      rtl,\n    });\n  }\n\n  /**\n   * @param {number} pageNumber\n   */\n  isPageVisible(pageNumber) {\n    if (!this.pdfDocument) {\n      return false;\n    }\n    if (\n      !(\n        Number.isInteger(pageNumber) &&\n        pageNumber > 0 &&\n        pageNumber <= this.pagesCount\n      )\n    ) {\n      console.error(`isPageVisible: \"${pageNumber}\" is not a valid page.`);\n      return false;\n    }\n    return this._getVisiblePages().ids.has(pageNumber);\n  }\n\n  /**\n   * @param {number} pageNumber\n   */\n  isPageCached(pageNumber) {\n    if (!this.pdfDocument) {\n      return false;\n    }\n    if (\n      !(\n        Number.isInteger(pageNumber) &&\n        pageNumber > 0 &&\n        pageNumber <= this.pagesCount\n      )\n    ) {\n      console.error(`isPageCached: \"${pageNumber}\" is not a valid page.`);\n      return false;\n    }\n    const pageView = this._pages[pageNumber - 1];\n    return this.#buffer.has(pageView);\n  }\n\n  cleanup() {\n    for (const pageView of this._pages) {\n      if (pageView.renderingState !== RenderingStates.FINISHED) {\n        pageView.reset();\n      }\n    }\n  }\n\n  /**\n   * @private\n   */\n  _cancelRendering() {\n    for (const pageView of this._pages) {\n      pageView.cancelRendering();\n    }\n  }\n\n  /**\n   * @param {PDFPageView} pageView\n   * @returns {Promise<PDFPageProxy | null>}\n   */\n  async #ensurePdfPageLoaded(pageView) {\n    if (pageView.pdfPage) {\n      return pageView.pdfPage;\n    }\n    try {\n      const pdfPage = await this.pdfDocument.getPage(pageView.id);\n      if (!pageView.pdfPage) {\n        pageView.setPdfPage(pdfPage);\n      }\n      if (!this.linkService._cachedPageNumber?.(pdfPage.ref)) {\n        this.linkService.cachePageRef(pageView.id, pdfPage.ref);\n      }\n      return pdfPage;\n    } catch (reason) {\n      console.error(\"Unable to get page for page view\", reason);\n      return null; // Page error -- there is nothing that can be done.\n    }\n  }\n\n  #getScrollAhead(visible) {\n    if (visible.first?.id === 1) {\n      return true;\n    } else if (visible.last?.id === this.pagesCount) {\n      return false;\n    }\n    switch (this._scrollMode) {\n      case ScrollMode.PAGE:\n        return this.#scrollModePageState.scrollDown;\n      case ScrollMode.HORIZONTAL:\n        return this.scroll.right;\n    }\n    return this.scroll.down;\n  }\n\n  /**\n   * Only show the `loadingIcon`-spinner on visible pages (see issue 14242).\n   */\n  #toggleLoadingIconSpinner(visibleIds) {\n    for (const id of visibleIds) {\n      const pageView = this._pages[id - 1];\n      pageView?.toggleLoadingIconSpinner(/* viewVisible = */ true);\n    }\n    for (const pageView of this.#buffer) {\n      if (visibleIds.has(pageView.id)) {\n        // Handled above, since the \"buffer\" may not contain all visible pages.\n        continue;\n      }\n      pageView.toggleLoadingIconSpinner(/* viewVisible = */ false);\n    }\n  }\n\n  forceRendering(currentlyVisiblePages) {\n    const visiblePages = currentlyVisiblePages || this._getVisiblePages();\n    const scrollAhead = this.#getScrollAhead(visiblePages);\n    const preRenderExtra =\n      this._spreadMode !== SpreadMode.NONE &&\n      this._scrollMode !== ScrollMode.HORIZONTAL;\n\n    const pageView = this.renderingQueue.getHighestPriority(\n      visiblePages,\n      this._pages,\n      scrollAhead,\n      preRenderExtra\n    );\n    this.#toggleLoadingIconSpinner(visiblePages.ids);\n\n    if (pageView) {\n      this.#ensurePdfPageLoaded(pageView).then(() => {\n        this.renderingQueue.renderView(pageView);\n      });\n      return true;\n    }\n    return false;\n  }\n\n  /**\n   * @typedef {Object} CreateTextLayerBuilderParameters\n   * @property {HTMLDivElement} textLayerDiv\n   * @property {number} pageIndex\n   * @property {PageViewport} viewport\n   * @property {EventBus} eventBus\n   * @property {TextHighlighter} highlighter\n   * @property {TextAccessibilityManager} [accessibilityManager]\n   */\n\n  /**\n   * @param {CreateTextLayerBuilderParameters}\n   * @returns {TextLayerBuilder}\n   */\n  createTextLayerBuilder({\n    textLayerDiv,\n    pageIndex,\n    viewport,\n    eventBus,\n    highlighter,\n    accessibilityManager = null,\n  }) {\n    return new TextLayerBuilder({\n      textLayerDiv,\n      eventBus,\n      pageIndex,\n      viewport,\n      highlighter,\n      accessibilityManager,\n    });\n  }\n\n  /**\n   * @typedef {Object} CreateTextHighlighterParameters\n   * @property {number} pageIndex\n   * @property {EventBus} eventBus\n   */\n\n  /**\n   * @param {CreateTextHighlighterParameters}\n   * @returns {TextHighlighter}\n   */\n  createTextHighlighter({ pageIndex, eventBus }) {\n    return new TextHighlighter({\n      eventBus,\n      pageIndex,\n      findController: this.isInPresentationMode ? null : this.findController,\n    });\n  }\n\n  /**\n   * @typedef {Object} CreateAnnotationLayerBuilderParameters\n   * @property {HTMLDivElement} pageDiv\n   * @property {PDFPageProxy} pdfPage\n   * @property {AnnotationStorage} [annotationStorage] - Storage for annotation\n   *   data in forms.\n   * @property {string} [imageResourcesPath] - Path for image resources, mainly\n   *   for annotation icons. Include trailing slash.\n   * @property {boolean} renderForms\n   * @property {IL10n} l10n\n   * @property {boolean} [enableScripting]\n   * @property {Promise<boolean>} [hasJSActionsPromise]\n   * @property {Object} [mouseState]\n   * @property {Promise<Object<string, Array<Object>> | null>}\n   *   [fieldObjectsPromise]\n   * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap] - Map some\n   *   annotation ids with canvases used to render them.\n   * @property {TextAccessibilityManager} [accessibilityManager]\n   */\n\n  /**\n   * @param {CreateAnnotationLayerBuilderParameters}\n   * @returns {AnnotationLayerBuilder}\n   */\n  createAnnotationLayerBuilder({\n    pageDiv,\n    pdfPage,\n    annotationStorage = this.pdfDocument?.annotationStorage,\n    imageResourcesPath = \"\",\n    renderForms = true,\n    l10n = NullL10n,\n    enableScripting = this.enableScripting,\n    hasJSActionsPromise = this.pdfDocument?.hasJSActions(),\n    mouseState = this._scriptingManager?.mouseState,\n    fieldObjectsPromise = this.pdfDocument?.getFieldObjects(),\n    annotationCanvasMap = null,\n    accessibilityManager = null,\n  }) {\n    return new AnnotationLayerBuilder({\n      pageDiv,\n      pdfPage,\n      annotationStorage,\n      imageResourcesPath,\n      renderForms,\n      linkService: this.linkService,\n      downloadManager: this.downloadManager,\n      l10n,\n      enableScripting,\n      hasJSActionsPromise,\n      mouseState,\n      fieldObjectsPromise,\n      annotationCanvasMap,\n      accessibilityManager,\n    });\n  }\n\n  /**\n   * @typedef {Object} CreateAnnotationEditorLayerBuilderParameters\n   * @property {AnnotationEditorUIManager} [uiManager]\n   * @property {HTMLDivElement} pageDiv\n   * @property {PDFPageProxy} pdfPage\n   * @property {IL10n} l10n\n   * @property {AnnotationStorage} [annotationStorage] - Storage for annotation\n   * @property {TextAccessibilityManager} [accessibilityManager]\n   *   data in forms.\n   */\n\n  /**\n   * @param {CreateAnnotationEditorLayerBuilderParameters}\n   * @returns {AnnotationEditorLayerBuilder}\n   */\n  createAnnotationEditorLayerBuilder({\n    uiManager = this.#annotationEditorUIManager,\n    pageDiv,\n    pdfPage,\n    accessibilityManager = null,\n    l10n,\n    annotationStorage = this.pdfDocument?.annotationStorage,\n  }) {\n    return new AnnotationEditorLayerBuilder({\n      uiManager,\n      pageDiv,\n      pdfPage,\n      annotationStorage,\n      accessibilityManager,\n      l10n,\n    });\n  }\n\n  /**\n   * @typedef {Object} CreateXfaLayerBuilderParameters\n   * @property {HTMLDivElement} pageDiv\n   * @property {PDFPageProxy} pdfPage\n   * @property {AnnotationStorage} [annotationStorage] - Storage for annotation\n   *   data in forms.\n   */\n\n  /**\n   * @param {CreateXfaLayerBuilderParameters}\n   * @returns {XfaLayerBuilder}\n   */\n  createXfaLayerBuilder({\n    pageDiv,\n    pdfPage,\n    annotationStorage = this.pdfDocument?.annotationStorage,\n  }) {\n    return new XfaLayerBuilder({\n      pageDiv,\n      pdfPage,\n      annotationStorage,\n      linkService: this.linkService,\n    });\n  }\n\n  /**\n   * @typedef {Object} CreateStructTreeLayerBuilderParameters\n   * @property {PDFPageProxy} pdfPage\n   */\n\n  /**\n   * @param {CreateStructTreeLayerBuilderParameters}\n   * @returns {StructTreeLayerBuilder}\n   */\n  createStructTreeLayerBuilder({ pdfPage }) {\n    return new StructTreeLayerBuilder({\n      pdfPage,\n    });\n  }\n\n  /**\n   * @type {boolean} Whether all pages of the PDF document have identical\n   *   widths and heights.\n   */\n  get hasEqualPageSizes() {\n    const firstPageView = this._pages[0];\n    for (let i = 1, ii = this._pages.length; i < ii; ++i) {\n      const pageView = this._pages[i];\n      if (\n        pageView.width !== firstPageView.width ||\n        pageView.height !== firstPageView.height\n      ) {\n        return false;\n      }\n    }\n    return true;\n  }\n\n  /**\n   * Returns sizes of the pages.\n   * @returns {Array} Array of objects with width/height/rotation fields.\n   */\n  getPagesOverview() {\n    return this._pages.map(pageView => {\n      const viewport = pageView.pdfPage.getViewport({ scale: 1 });\n\n      if (!this.enablePrintAutoRotate || isPortraitOrientation(viewport)) {\n        return {\n          width: viewport.width,\n          height: viewport.height,\n          rotation: viewport.rotation,\n        };\n      }\n      // Landscape orientation.\n      return {\n        width: viewport.height,\n        height: viewport.width,\n        rotation: (viewport.rotation - 90) % 360,\n      };\n    });\n  }\n\n  /**\n   * @type {Promise<OptionalContentConfig | null>}\n   */\n  get optionalContentConfigPromise() {\n    if (!this.pdfDocument) {\n      return Promise.resolve(null);\n    }\n    if (!this._optionalContentConfigPromise) {\n      console.error(\"optionalContentConfigPromise: Not initialized yet.\");\n      // Prevent issues if the getter is accessed *before* the `onePageRendered`\n      // promise has resolved; won't (normally) happen in the default viewer.\n      return this.pdfDocument.getOptionalContentConfig();\n    }\n    return this._optionalContentConfigPromise;\n  }\n\n  /**\n   * @param {Promise<OptionalContentConfig>} promise - A promise that is\n   *   resolved with an {@link OptionalContentConfig} instance.\n   */\n  set optionalContentConfigPromise(promise) {\n    if (!(promise instanceof Promise)) {\n      throw new Error(`Invalid optionalContentConfigPromise: ${promise}`);\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    if (!this._optionalContentConfigPromise) {\n      // Ignore the setter *before* the `onePageRendered` promise has resolved,\n      // since it'll be overwritten anyway; won't happen in the default viewer.\n      return;\n    }\n    this._optionalContentConfigPromise = promise;\n\n    const updateArgs = { optionalContentConfigPromise: promise };\n    for (const pageView of this._pages) {\n      pageView.update(updateArgs);\n    }\n    this.update();\n\n    this.eventBus.dispatch(\"optionalcontentconfigchanged\", {\n      source: this,\n      promise,\n    });\n  }\n\n  /**\n   * @type {number} One of the values in {ScrollMode}.\n   */\n  get scrollMode() {\n    return this._scrollMode;\n  }\n\n  /**\n   * @param {number} mode - The direction in which the document pages should be\n   *   laid out within the scrolling container.\n   *   The constants from {ScrollMode} should be used.\n   */\n  set scrollMode(mode) {\n    if (this._scrollMode === mode) {\n      return; // The Scroll mode didn't change.\n    }\n    if (!isValidScrollMode(mode)) {\n      throw new Error(`Invalid scroll mode: ${mode}`);\n    }\n    if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n      return; // Disabled for performance reasons.\n    }\n    this._previousScrollMode = this._scrollMode;\n\n    this._scrollMode = mode;\n    this.eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n\n    this._updateScrollMode(/* pageNumber = */ this._currentPageNumber);\n  }\n\n  _updateScrollMode(pageNumber = null) {\n    const scrollMode = this._scrollMode,\n      viewer = this.viewer;\n\n    viewer.classList.toggle(\n      \"scrollHorizontal\",\n      scrollMode === ScrollMode.HORIZONTAL\n    );\n    viewer.classList.toggle(\"scrollWrapped\", scrollMode === ScrollMode.WRAPPED);\n\n    if (!this.pdfDocument || !pageNumber) {\n      return;\n    }\n\n    if (scrollMode === ScrollMode.PAGE) {\n      this.#ensurePageViewVisible();\n    } else if (this._previousScrollMode === ScrollMode.PAGE) {\n      // Ensure that the current spreadMode is still applied correctly when\n      // the *previous* scrollMode was `ScrollMode.PAGE`.\n      this._updateSpreadMode();\n    }\n    // Non-numeric scale values can be sensitive to the scroll orientation.\n    // Call this before re-scrolling to the current page, to ensure that any\n    // changes in scale don't move the current page.\n    if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n      this._setScale(this._currentScaleValue, true);\n    }\n    this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n    this.update();\n  }\n\n  /**\n   * @type {number} One of the values in {SpreadMode}.\n   */\n  get spreadMode() {\n    return this._spreadMode;\n  }\n\n  /**\n   * @param {number} mode - Group the pages in spreads, starting with odd- or\n   *   even-number pages (unless `SpreadMode.NONE` is used).\n   *   The constants from {SpreadMode} should be used.\n   */\n  set spreadMode(mode) {\n    if (this._spreadMode === mode) {\n      return; // The Spread mode didn't change.\n    }\n    if (!isValidSpreadMode(mode)) {\n      throw new Error(`Invalid spread mode: ${mode}`);\n    }\n    this._spreadMode = mode;\n    this.eventBus.dispatch(\"spreadmodechanged\", { source: this, mode });\n\n    this._updateSpreadMode(/* pageNumber = */ this._currentPageNumber);\n  }\n\n  _updateSpreadMode(pageNumber = null) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const viewer = this.viewer,\n      pages = this._pages;\n\n    if (this._scrollMode === ScrollMode.PAGE) {\n      this.#ensurePageViewVisible();\n    } else {\n      // Temporarily remove all the pages from the DOM.\n      viewer.textContent = \"\";\n\n      if (this._spreadMode === SpreadMode.NONE) {\n        for (const pageView of this._pages) {\n          viewer.append(pageView.div);\n        }\n      } else {\n        const parity = this._spreadMode - 1;\n        let spread = null;\n        for (let i = 0, ii = pages.length; i < ii; ++i) {\n          if (spread === null) {\n            spread = document.createElement(\"div\");\n            spread.className = \"spread\";\n            viewer.append(spread);\n          } else if (i % 2 === parity) {\n            spread = spread.cloneNode(false);\n            viewer.append(spread);\n          }\n          spread.append(pages[i].div);\n        }\n      }\n    }\n\n    if (!pageNumber) {\n      return;\n    }\n    // Non-numeric scale values can be sensitive to the scroll orientation.\n    // Call this before re-scrolling to the current page, to ensure that any\n    // changes in scale don't move the current page.\n    if (this._currentScaleValue && isNaN(this._currentScaleValue)) {\n      this._setScale(this._currentScaleValue, true);\n    }\n    this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n    this.update();\n  }\n\n  /**\n   * @private\n   */\n  _getPageAdvance(currentPageNumber, previous = false) {\n    switch (this._scrollMode) {\n      case ScrollMode.WRAPPED: {\n        const { views } = this._getVisiblePages(),\n          pageLayout = new Map();\n\n        // Determine the current (visible) page layout.\n        for (const { id, y, percent, widthPercent } of views) {\n          if (percent === 0 || widthPercent < 100) {\n            continue;\n          }\n          let yArray = pageLayout.get(y);\n          if (!yArray) {\n            pageLayout.set(y, (yArray ||= []));\n          }\n          yArray.push(id);\n        }\n        // Find the row of the current page.\n        for (const yArray of pageLayout.values()) {\n          const currentIndex = yArray.indexOf(currentPageNumber);\n          if (currentIndex === -1) {\n            continue;\n          }\n          const numPages = yArray.length;\n          if (numPages === 1) {\n            break;\n          }\n          // Handle documents with varying page sizes.\n          if (previous) {\n            for (let i = currentIndex - 1, ii = 0; i >= ii; i--) {\n              const currentId = yArray[i],\n                expectedId = yArray[i + 1] - 1;\n              if (currentId < expectedId) {\n                return currentPageNumber - expectedId;\n              }\n            }\n          } else {\n            for (let i = currentIndex + 1, ii = numPages; i < ii; i++) {\n              const currentId = yArray[i],\n                expectedId = yArray[i - 1] + 1;\n              if (currentId > expectedId) {\n                return expectedId - currentPageNumber;\n              }\n            }\n          }\n          // The current row is \"complete\", advance to the previous/next one.\n          if (previous) {\n            const firstId = yArray[0];\n            if (firstId < currentPageNumber) {\n              return currentPageNumber - firstId + 1;\n            }\n          } else {\n            const lastId = yArray[numPages - 1];\n            if (lastId > currentPageNumber) {\n              return lastId - currentPageNumber + 1;\n            }\n          }\n          break;\n        }\n        break;\n      }\n      case ScrollMode.HORIZONTAL: {\n        break;\n      }\n      case ScrollMode.PAGE:\n      case ScrollMode.VERTICAL: {\n        if (this._spreadMode === SpreadMode.NONE) {\n          break; // Normal vertical scrolling.\n        }\n        const parity = this._spreadMode - 1;\n\n        if (previous && currentPageNumber % 2 !== parity) {\n          break; // Left-hand side page.\n        } else if (!previous && currentPageNumber % 2 === parity) {\n          break; // Right-hand side page.\n        }\n        const { views } = this._getVisiblePages(),\n          expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;\n\n        for (const { id, percent, widthPercent } of views) {\n          if (id !== expectedId) {\n            continue;\n          }\n          if (percent > 0 && widthPercent === 100) {\n            return 2;\n          }\n          break;\n        }\n        break;\n      }\n    }\n    return 1;\n  }\n\n  /**\n   * Go to the next page, taking scroll/spread-modes into account.\n   * @returns {boolean} Whether navigation occured.\n   */\n  nextPage() {\n    const currentPageNumber = this._currentPageNumber,\n      pagesCount = this.pagesCount;\n\n    if (currentPageNumber >= pagesCount) {\n      return false;\n    }\n    const advance =\n      this._getPageAdvance(currentPageNumber, /* previous = */ false) || 1;\n\n    this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount);\n    return true;\n  }\n\n  /**\n   * Go to the previous page, taking scroll/spread-modes into account.\n   * @returns {boolean} Whether navigation occured.\n   */\n  previousPage() {\n    const currentPageNumber = this._currentPageNumber;\n\n    if (currentPageNumber <= 1) {\n      return false;\n    }\n    const advance =\n      this._getPageAdvance(currentPageNumber, /* previous = */ true) || 1;\n\n    this.currentPageNumber = Math.max(currentPageNumber - advance, 1);\n    return true;\n  }\n\n  /**\n   * Increase the current zoom level one, or more, times.\n   * @param {number} [steps] - Defaults to zooming once.\n   */\n  increaseScale(steps = 1) {\n    let newScale = this._currentScale;\n    do {\n      newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);\n      newScale = Math.ceil(newScale * 10) / 10;\n      newScale = Math.min(MAX_SCALE, newScale);\n    } while (--steps > 0 && newScale < MAX_SCALE);\n    this.currentScaleValue = newScale;\n  }\n\n  /**\n   * Decrease the current zoom level one, or more, times.\n   * @param {number} [steps] - Defaults to zooming once.\n   */\n  decreaseScale(steps = 1) {\n    let newScale = this._currentScale;\n    do {\n      newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);\n      newScale = Math.floor(newScale * 10) / 10;\n      newScale = Math.max(MIN_SCALE, newScale);\n    } while (--steps > 0 && newScale > MIN_SCALE);\n    this.currentScaleValue = newScale;\n  }\n\n  updateContainerHeightCss() {\n    const height = this.container.clientHeight;\n\n    if (height !== this.#previousContainerHeight) {\n      this.#previousContainerHeight = height;\n\n      docStyle.setProperty(\"--viewer-container-height\", `${height}px`);\n    }\n  }\n\n  /**\n   * @type {number}\n   */\n  get annotationEditorMode() {\n    return this.#annotationEditorUIManager\n      ? this.#annotationEditorMode\n      : AnnotationEditorType.DISABLE;\n  }\n\n  /**\n   * @param {number} mode - AnnotationEditor mode (None, FreeText, Ink, ...)\n   */\n  set annotationEditorMode(mode) {\n    if (!this.#annotationEditorUIManager) {\n      throw new Error(`The AnnotationEditor is not enabled.`);\n    }\n    if (this.#annotationEditorMode === mode) {\n      return; // The AnnotationEditor mode didn't change.\n    }\n    if (!isValidAnnotationEditorMode(mode)) {\n      throw new Error(`Invalid AnnotationEditor mode: ${mode}`);\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    this.#annotationEditorMode = mode;\n    this.eventBus.dispatch(\"annotationeditormodechanged\", {\n      source: this,\n      mode,\n    });\n\n    this.#annotationEditorUIManager.updateMode(mode);\n  }\n\n  // eslint-disable-next-line accessor-pairs\n  set annotationEditorParams({ type, value }) {\n    if (!this.#annotationEditorUIManager) {\n      throw new Error(`The AnnotationEditor is not enabled.`);\n    }\n    this.#annotationEditorUIManager.updateParams(type, value);\n  }\n\n  refresh() {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const updateArgs = {};\n    for (const pageView of this._pages) {\n      pageView.update(updateArgs);\n    }\n    this.update();\n  }\n}\n\nexport { PagesCountLimit, PDFPageViewBuffer, PDFViewer };\n","/* Copyright 2022 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/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/editor/tools.js\").AnnotationEditorUIManager} AnnotationEditorUIManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../annotation_storage.js\").AnnotationStorage} AnnotationStorage */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n\nimport { AnnotationEditorLayer } from \"pdfjs-lib\";\nimport { NullL10n } from \"./l10n_utils.js\";\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderOptions\n * @property {number} mode - Editor mode\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPageProxy} pdfPage\n * @property {TextAccessibilityManager} accessibilityManager\n * @property {AnnotationStorage} annotationStorage\n * @property {IL10n} l10n - Localization service.\n * @property {AnnotationEditorUIManager} uiManager\n */\n\nclass AnnotationEditorLayerBuilder {\n  #uiManager;\n\n  /**\n   * @param {AnnotationEditorLayerBuilderOptions} options\n   */\n  constructor(options) {\n    this.pageDiv = options.pageDiv;\n    this.pdfPage = options.pdfPage;\n    this.annotationStorage = options.annotationStorage || null;\n    this.accessibilityManager = options.accessibilityManager;\n    this.l10n = options.l10n || NullL10n;\n    this.annotationEditorLayer = null;\n    this.div = null;\n    this._cancelled = false;\n    this.#uiManager = options.uiManager;\n  }\n\n  /**\n   * @param {PageViewport} viewport\n   * @param {string} intent (default value is 'display')\n   */\n  async render(viewport, intent = \"display\") {\n    if (intent !== \"display\") {\n      return;\n    }\n\n    if (this._cancelled) {\n      return;\n    }\n\n    const clonedViewport = viewport.clone({ dontFlip: true });\n    if (this.div) {\n      this.annotationEditorLayer.update({ viewport: clonedViewport });\n      this.show();\n      return;\n    }\n\n    // Create an AnnotationEditor layer div\n    this.div = document.createElement(\"div\");\n    this.div.className = \"annotationEditorLayer\";\n    this.div.tabIndex = 0;\n    this.pageDiv.append(this.div);\n\n    this.annotationEditorLayer = new AnnotationEditorLayer({\n      uiManager: this.#uiManager,\n      div: this.div,\n      annotationStorage: this.annotationStorage,\n      accessibilityManager: this.accessibilityManager,\n      pageIndex: this.pdfPage._pageIndex,\n      l10n: this.l10n,\n      viewport: clonedViewport,\n    });\n\n    const parameters = {\n      viewport: clonedViewport,\n      div: this.div,\n      annotations: null,\n      intent,\n    };\n\n    this.annotationEditorLayer.render(parameters);\n  }\n\n  cancel() {\n    this._cancelled = true;\n    this.destroy();\n  }\n\n  hide() {\n    if (!this.div) {\n      return;\n    }\n    this.div.hidden = true;\n  }\n\n  show() {\n    if (!this.div) {\n      return;\n    }\n    this.div.hidden = false;\n  }\n\n  destroy() {\n    if (!this.div) {\n      return;\n    }\n    this.pageDiv = null;\n    this.annotationEditorLayer.destroy();\n    this.div.remove();\n  }\n}\n\nexport { AnnotationEditorLayerBuilder };\n","/* Copyright 2021 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/**\n * A subset of the l10n strings in the `l10n/en-US/viewer.properties` file.\n */\nconst DEFAULT_L10N_STRINGS = {\n  of_pages: \"of {{pagesCount}}\",\n  page_of_pages: \"({{pageNumber}} of {{pagesCount}})\",\n\n  document_properties_kb: \"{{size_kb}} KB ({{size_b}} bytes)\",\n  document_properties_mb: \"{{size_mb}} MB ({{size_b}} bytes)\",\n  document_properties_date_string: \"{{date}}, {{time}}\",\n  document_properties_page_size_unit_inches: \"in\",\n  document_properties_page_size_unit_millimeters: \"mm\",\n  document_properties_page_size_orientation_portrait: \"portrait\",\n  document_properties_page_size_orientation_landscape: \"landscape\",\n  document_properties_page_size_name_a3: \"A3\",\n  document_properties_page_size_name_a4: \"A4\",\n  document_properties_page_size_name_letter: \"Letter\",\n  document_properties_page_size_name_legal: \"Legal\",\n  document_properties_page_size_dimension_string:\n    \"{{width}} × {{height}} {{unit}} ({{orientation}})\",\n  document_properties_page_size_dimension_name_string:\n    \"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})\",\n  document_properties_linearized_yes: \"Yes\",\n  document_properties_linearized_no: \"No\",\n\n  additional_layers: \"Additional Layers\",\n  page_landmark: \"Page {{page}}\",\n  thumb_page_title: \"Page {{page}}\",\n  thumb_page_canvas: \"Thumbnail of Page {{page}}\",\n\n  find_reached_top: \"Reached top of document, continued from bottom\",\n  find_reached_bottom: \"Reached end of document, continued from top\",\n  \"find_match_count[one]\": \"{{current}} of {{total}} match\",\n  \"find_match_count[other]\": \"{{current}} of {{total}} matches\",\n  \"find_match_count_limit[one]\": \"More than {{limit}} match\",\n  \"find_match_count_limit[other]\": \"More than {{limit}} matches\",\n  find_not_found: \"Phrase not found\",\n\n  page_scale_width: \"Page Width\",\n  page_scale_fit: \"Page Fit\",\n  page_scale_auto: \"Automatic Zoom\",\n  page_scale_actual: \"Actual Size\",\n  page_scale_percent: \"{{scale}}%\",\n\n  loading: \"Loading…\",\n  loading_error: \"An error occurred while loading the PDF.\",\n  invalid_file_error: \"Invalid or corrupted PDF file.\",\n  missing_file_error: \"Missing PDF file.\",\n  unexpected_response_error: \"Unexpected server response.\",\n  rendering_error: \"An error occurred while rendering the page.\",\n\n  printing_not_supported:\n    \"Warning: Printing is not fully supported by this browser.\",\n  printing_not_ready: \"Warning: The PDF is not fully loaded for printing.\",\n  web_fonts_disabled:\n    \"Web fonts are disabled: unable to use embedded PDF fonts.\",\n\n  free_text2_default_content: \"Start typing…\",\n  editor_free_text2_aria_label: \"Text Editor\",\n  editor_ink2_aria_label: \"Draw Editor\",\n  editor_ink_canvas_aria_label: \"User-created image\",\n};\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n  DEFAULT_L10N_STRINGS.print_progress_percent = \"{{progress}}%\";\n}\n\nfunction getL10nFallback(key, args) {\n  switch (key) {\n    case \"find_match_count\":\n      key = `find_match_count[${args.total === 1 ? \"one\" : \"other\"}]`;\n      break;\n    case \"find_match_count_limit\":\n      key = `find_match_count_limit[${args.limit === 1 ? \"one\" : \"other\"}]`;\n      break;\n  }\n  return DEFAULT_L10N_STRINGS[key] || \"\";\n}\n\nconst PARTIAL_LANG_CODES = {\n  en: \"en-US\",\n  es: \"es-ES\",\n  fy: \"fy-NL\",\n  ga: \"ga-IE\",\n  gu: \"gu-IN\",\n  hi: \"hi-IN\",\n  hy: \"hy-AM\",\n  nb: \"nb-NO\",\n  ne: \"ne-NP\",\n  nn: \"nn-NO\",\n  pa: \"pa-IN\",\n  pt: \"pt-PT\",\n  sv: \"sv-SE\",\n  zh: \"zh-CN\",\n};\n\n// Try to support \"incompletely\" specified language codes (see issue 13689).\nfunction fixupLangCode(langCode) {\n  return PARTIAL_LANG_CODES[langCode?.toLowerCase()] || langCode;\n}\n\n// Replaces {{arguments}} with their values.\nfunction formatL10nValue(text, args) {\n  if (!args) {\n    return text;\n  }\n  return text.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (all, name) => {\n    return name in args ? args[name] : \"{{\" + name + \"}}\";\n  });\n}\n\n/**\n * No-op implementation of the localization service.\n * @implements {IL10n}\n */\nconst NullL10n = {\n  async getLanguage() {\n    return \"en-us\";\n  },\n\n  async getDirection() {\n    return \"ltr\";\n  },\n\n  async get(key, args = null, fallback = getL10nFallback(key, args)) {\n    return formatL10nValue(fallback, args);\n  },\n\n  async translate(element) {},\n};\n\nexport { fixupLangCode, getL10nFallback, NullL10n };\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./textaccessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { AnnotationLayer } from \"pdfjs-lib\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { PresentationModeState } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n *   for annotation icons. Include trailing slash.\n * @property {boolean} renderForms\n * @property {IPDFLinkService} linkService\n * @property {IDownloadManager} downloadManager\n * @property {IL10n} l10n - Localization service.\n * @property {boolean} [enableScripting]\n * @property {Promise<boolean>} [hasJSActionsPromise]\n * @property {Promise<Object<string, Array<Object>> | null>}\n *   [fieldObjectsPromise]\n * @property {Object} [mouseState]\n * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]\n * @property {TextAccessibilityManager} accessibilityManager\n */\n\nclass AnnotationLayerBuilder {\n  #onPresentationModeChanged = null;\n\n  /**\n   * @param {AnnotationLayerBuilderOptions} options\n   */\n  constructor({\n    pageDiv,\n    pdfPage,\n    linkService,\n    downloadManager,\n    annotationStorage = null,\n    imageResourcesPath = \"\",\n    renderForms = true,\n    l10n = NullL10n,\n    enableScripting = false,\n    hasJSActionsPromise = null,\n    fieldObjectsPromise = null,\n    mouseState = null,\n    annotationCanvasMap = null,\n    accessibilityManager = null,\n  }) {\n    this.pageDiv = pageDiv;\n    this.pdfPage = pdfPage;\n    this.linkService = linkService;\n    this.downloadManager = downloadManager;\n    this.imageResourcesPath = imageResourcesPath;\n    this.renderForms = renderForms;\n    this.l10n = l10n;\n    this.annotationStorage = annotationStorage;\n    this.enableScripting = enableScripting;\n    this._hasJSActionsPromise = hasJSActionsPromise;\n    this._fieldObjectsPromise = fieldObjectsPromise;\n    this._mouseState = mouseState;\n    this._annotationCanvasMap = annotationCanvasMap;\n    this._accessibilityManager = accessibilityManager;\n\n    this.div = null;\n    this._cancelled = false;\n    this._eventBus = linkService.eventBus;\n  }\n\n  /**\n   * @param {PageViewport} viewport\n   * @param {string} intent (default value is 'display')\n   * @returns {Promise<void>} A promise that is resolved when rendering of the\n   *   annotations is complete.\n   */\n  async render(viewport, intent = \"display\") {\n    const [annotations, hasJSActions = false, fieldObjects = null] =\n      await Promise.all([\n        this.pdfPage.getAnnotations({ intent }),\n        this._hasJSActionsPromise,\n        this._fieldObjectsPromise,\n      ]);\n\n    if (this._cancelled || annotations.length === 0) {\n      return;\n    }\n\n    const parameters = {\n      viewport: viewport.clone({ dontFlip: true }),\n      div: this.div,\n      annotations,\n      page: this.pdfPage,\n      imageResourcesPath: this.imageResourcesPath,\n      renderForms: this.renderForms,\n      linkService: this.linkService,\n      downloadManager: this.downloadManager,\n      annotationStorage: this.annotationStorage,\n      enableScripting: this.enableScripting,\n      hasJSActions,\n      fieldObjects,\n      mouseState: this._mouseState,\n      annotationCanvasMap: this._annotationCanvasMap,\n      accessibilityManager: this._accessibilityManager,\n    };\n\n    if (this.div) {\n      // If an annotationLayer already exists, refresh its children's\n      // transformation matrices.\n      AnnotationLayer.update(parameters);\n    } else {\n      // Create an annotation layer div and render the annotations\n      // if there is at least one annotation.\n      this.div = document.createElement(\"div\");\n      this.div.className = \"annotationLayer\";\n      this.pageDiv.append(this.div);\n      parameters.div = this.div;\n\n      AnnotationLayer.render(parameters);\n      this.l10n.translate(this.div);\n\n      // Ensure that interactive form elements in the annotationLayer are\n      // disabled while PresentationMode is active (see issue 12232).\n      if (this.linkService.isInPresentationMode) {\n        this.#updatePresentationModeState(PresentationModeState.FULLSCREEN);\n      }\n      if (!this.#onPresentationModeChanged) {\n        this.#onPresentationModeChanged = evt => {\n          this.#updatePresentationModeState(evt.state);\n        };\n        this._eventBus?._on(\n          \"presentationmodechanged\",\n          this.#onPresentationModeChanged\n        );\n      }\n    }\n  }\n\n  cancel() {\n    this._cancelled = true;\n\n    if (this.#onPresentationModeChanged) {\n      this._eventBus?._off(\n        \"presentationmodechanged\",\n        this.#onPresentationModeChanged\n      );\n      this.#onPresentationModeChanged = null;\n    }\n  }\n\n  hide() {\n    if (!this.div) {\n      return;\n    }\n    this.div.hidden = true;\n  }\n\n  #updatePresentationModeState(state) {\n    if (!this.div) {\n      return;\n    }\n    let disableFormElements = false;\n\n    switch (state) {\n      case PresentationModeState.FULLSCREEN:\n        disableFormElements = true;\n        break;\n      case PresentationModeState.NORMAL:\n        break;\n      default:\n        return;\n    }\n    for (const section of this.div.childNodes) {\n      if (section.hasAttribute(\"data-internal-link\")) {\n        continue;\n      }\n      section.inert = disableFormElements;\n    }\n  }\n}\n\nexport { AnnotationLayerBuilder };\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\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces\").IPDFAnnotationLayerFactory} IPDFAnnotationLayerFactory */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces\").IPDFAnnotationEditorLayerFactory} IPDFAnnotationEditorLayerFactory */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces\").IPDFStructTreeLayerFactory} IPDFStructTreeLayerFactory */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./interfaces\").IPDFTextLayerFactory} IPDFTextLayerFactory */\n/** @typedef {import(\"./interfaces\").IPDFXfaLayerFactory} IPDFXfaLayerFactory */\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport {\n  AnnotationMode,\n  createPromiseCapability,\n  PixelsPerInch,\n  RenderingCancelledException,\n  SVGGraphics,\n} from \"pdfjs-lib\";\nimport {\n  approximateFraction,\n  DEFAULT_SCALE,\n  docStyle,\n  OutputScale,\n  RendererType,\n  RenderingStates,\n  roundToDivide,\n  TextLayerMode,\n} from \"./ui_utils.js\";\nimport { compatibilityParams } from \"./app_options.js\";\nimport { NullL10n } from \"./l10n_utils.js\";\nimport { TextAccessibilityManager } from \"./text_accessibility.js\";\n\n/**\n * @typedef {Object} PDFPageViewOptions\n * @property {HTMLDivElement} [container] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} id - The page unique ID (normally its number).\n * @property {number} [scale] - The page scale display.\n * @property {PageViewport} defaultViewport - The page viewport.\n * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise] -\n *   A promise that is resolved with an {@link OptionalContentConfig} instance.\n *   The default value is `null`.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {IPDFTextLayerFactory} [textLayerFactory]\n * @property {number} [textLayerMode] - Controls if the text layer used for\n *   selection and searching is created. The constants from {TextLayerMode}\n *   should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n *   created, and if interactive form elements or `AnnotationStorage`-data are\n *   being rendered. The constants from {@link AnnotationMode} should be used;\n *   see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n *   The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {IPDFAnnotationLayerFactory} [annotationLayerFactory]\n * @property {IPDFAnnotationEditorLayerFactory} [annotationEditorLayerFactory]\n * @property {IPDFXfaLayerFactory} [xfaLayerFactory]\n * @property {IPDFStructTreeLayerFactory} [structTreeLayerFactory]\n * @property {Object} [textHighlighterFactory]\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n *   for annotation icons. Include trailing slash.\n * @property {boolean} [useOnlyCssZoom] - Enables CSS only zooming. The default\n *   value is `false`.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n *   total pixels, i.e. width * height. Use -1 for no limit. The default value\n *   is 4096 * 4096 (16 mega-pixels).\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n *   with user defined ones in order to improve readability in high contrast\n *   mode.\n * @property {IL10n} [l10n] - Localization service.\n */\n\nconst MAX_CANVAS_PIXELS = compatibilityParams.maxCanvasPixels || 16777216;\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFPageView {\n  #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n  #useThumbnailCanvas = {\n    initialOptionalContent: true,\n    regularAnnotations: true,\n  };\n\n  /**\n   * @param {PDFPageViewOptions} options\n   */\n  constructor(options) {\n    const container = options.container;\n    const defaultViewport = options.defaultViewport;\n\n    this.id = options.id;\n    this.renderingId = \"page\" + this.id;\n\n    this.pdfPage = null;\n    this.pageLabel = null;\n    this.rotation = 0;\n    this.scale = options.scale || DEFAULT_SCALE;\n    this.viewport = defaultViewport;\n    this.pdfPageRotate = defaultViewport.rotation;\n    this._optionalContentConfigPromise =\n      options.optionalContentConfigPromise || null;\n    this.hasRestrictedScaling = false;\n    this.textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n    this.#annotationMode =\n      options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n    this.imageResourcesPath = options.imageResourcesPath || \"\";\n    this.useOnlyCssZoom = options.useOnlyCssZoom || false;\n    this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;\n    this.pageColors = options.pageColors || null;\n\n    this.eventBus = options.eventBus;\n    this.renderingQueue = options.renderingQueue;\n    this.textLayerFactory = options.textLayerFactory;\n    this.annotationLayerFactory = options.annotationLayerFactory;\n    this.annotationEditorLayerFactory = options.annotationEditorLayerFactory;\n    this.xfaLayerFactory = options.xfaLayerFactory;\n    this.textHighlighter =\n      options.textHighlighterFactory?.createTextHighlighter({\n        pageIndex: this.id - 1,\n        eventBus: this.eventBus,\n      });\n    this.structTreeLayerFactory = options.structTreeLayerFactory;\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n    ) {\n      this.renderer = options.renderer || RendererType.CANVAS;\n    }\n    this.l10n = options.l10n || NullL10n;\n\n    this.paintTask = null;\n    this.paintedViewportMap = new WeakMap();\n    this.renderingState = RenderingStates.INITIAL;\n    this.resume = null;\n    this._renderError = null;\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n    ) {\n      this._isStandalone = !this.renderingQueue?.hasViewer();\n    }\n\n    this._annotationCanvasMap = null;\n\n    this.annotationLayer = null;\n    this.annotationEditorLayer = null;\n    this.textLayer = null;\n    this.zoomLayer = null;\n    this.xfaLayer = null;\n    this.structTreeLayer = null;\n\n    const div = document.createElement(\"div\");\n    div.className = \"page\";\n    div.style.width = Math.floor(this.viewport.width) + \"px\";\n    div.style.height = Math.floor(this.viewport.height) + \"px\";\n    div.setAttribute(\"data-page-number\", this.id);\n    div.setAttribute(\"role\", \"region\");\n    this.l10n.get(\"page_landmark\", { page: this.id }).then(msg => {\n      div.setAttribute(\"aria-label\", msg);\n    });\n    this.div = div;\n\n    container?.append(div);\n\n    if (\n      (typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n      this._isStandalone\n    ) {\n      const { optionalContentConfigPromise } = options;\n      if (optionalContentConfigPromise) {\n        // Ensure that the thumbnails always display the *initial* document\n        // state, for documents with optional content.\n        optionalContentConfigPromise.then(optionalContentConfig => {\n          if (\n            optionalContentConfigPromise !== this._optionalContentConfigPromise\n          ) {\n            return;\n          }\n          this.#useThumbnailCanvas.initialOptionalContent =\n            optionalContentConfig.hasInitialVisibility;\n        });\n      }\n    }\n  }\n\n  setPdfPage(pdfPage) {\n    this.pdfPage = pdfPage;\n    this.pdfPageRotate = pdfPage.rotate;\n\n    const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n    this.viewport = pdfPage.getViewport({\n      scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n      rotation: totalRotation,\n    });\n    this.reset();\n  }\n\n  destroy() {\n    this.reset();\n    this.pdfPage?.cleanup();\n  }\n\n  /**\n   * @private\n   */\n  async _renderAnnotationLayer() {\n    let error = null;\n    try {\n      await this.annotationLayer.render(this.viewport, \"display\");\n    } catch (ex) {\n      console.error(`_renderAnnotationLayer: \"${ex}\".`);\n      error = ex;\n    } finally {\n      this.eventBus.dispatch(\"annotationlayerrendered\", {\n        source: this,\n        pageNumber: this.id,\n        error,\n      });\n    }\n  }\n\n  /**\n   * @private\n   */\n  async _renderAnnotationEditorLayer() {\n    let error = null;\n    try {\n      await this.annotationEditorLayer.render(this.viewport, \"display\");\n    } catch (ex) {\n      console.error(`_renderAnnotationEditorLayer: \"${ex}\".`);\n      error = ex;\n    } finally {\n      this.eventBus.dispatch(\"annotationeditorlayerrendered\", {\n        source: this,\n        pageNumber: this.id,\n        error,\n      });\n    }\n  }\n\n  /**\n   * @private\n   */\n  async _renderXfaLayer() {\n    let error = null;\n    try {\n      const result = await this.xfaLayer.render(this.viewport, \"display\");\n      if (result?.textDivs && this.textHighlighter) {\n        this._buildXfaTextContentItems(result.textDivs);\n      }\n    } catch (ex) {\n      console.error(`_renderXfaLayer: \"${ex}\".`);\n      error = ex;\n    } finally {\n      this.eventBus.dispatch(\"xfalayerrendered\", {\n        source: this,\n        pageNumber: this.id,\n        error,\n      });\n    }\n  }\n\n  async _buildXfaTextContentItems(textDivs) {\n    const text = await this.pdfPage.getTextContent();\n    const items = [];\n    for (const item of text.items) {\n      items.push(item.str);\n    }\n    this.textHighlighter.setTextMapping(textDivs, items);\n    this.textHighlighter.enable();\n  }\n\n  /**\n   * @private\n   */\n  _resetZoomLayer(removeFromDOM = false) {\n    if (!this.zoomLayer) {\n      return;\n    }\n    const zoomLayerCanvas = this.zoomLayer.firstChild;\n    this.paintedViewportMap.delete(zoomLayerCanvas);\n    // Zeroing the width and height causes Firefox to release graphics\n    // resources immediately, which can greatly reduce memory consumption.\n    zoomLayerCanvas.width = 0;\n    zoomLayerCanvas.height = 0;\n\n    if (removeFromDOM) {\n      // Note: `ChildNode.remove` doesn't throw if the parent node is undefined.\n      this.zoomLayer.remove();\n    }\n    this.zoomLayer = null;\n  }\n\n  reset({\n    keepZoomLayer = false,\n    keepAnnotationLayer = false,\n    keepAnnotationEditorLayer = false,\n    keepXfaLayer = false,\n  } = {}) {\n    this.cancelRendering({\n      keepAnnotationLayer,\n      keepAnnotationEditorLayer,\n      keepXfaLayer,\n    });\n    this.renderingState = RenderingStates.INITIAL;\n\n    const div = this.div;\n    div.style.width = Math.floor(this.viewport.width) + \"px\";\n    div.style.height = Math.floor(this.viewport.height) + \"px\";\n\n    const childNodes = div.childNodes,\n      zoomLayerNode = (keepZoomLayer && this.zoomLayer) || null,\n      annotationLayerNode =\n        (keepAnnotationLayer && this.annotationLayer?.div) || null,\n      annotationEditorLayerNode =\n        (keepAnnotationEditorLayer && this.annotationEditorLayer?.div) || null,\n      xfaLayerNode = (keepXfaLayer && this.xfaLayer?.div) || null;\n    for (let i = childNodes.length - 1; i >= 0; i--) {\n      const node = childNodes[i];\n      switch (node) {\n        case zoomLayerNode:\n        case annotationLayerNode:\n        case annotationEditorLayerNode:\n        case xfaLayerNode:\n          continue;\n      }\n      node.remove();\n    }\n    div.removeAttribute(\"data-loaded\");\n\n    if (annotationLayerNode) {\n      // Hide the annotation layer until all elements are resized\n      // so they are not displayed on the already resized page.\n      this.annotationLayer.hide();\n    }\n\n    if (annotationEditorLayerNode) {\n      this.annotationEditorLayer.hide();\n    } else {\n      this.annotationEditorLayer?.destroy();\n    }\n    if (xfaLayerNode) {\n      // Hide the XFA layer until all elements are resized\n      // so they are not displayed on the already resized page.\n      this.xfaLayer.hide();\n    }\n\n    if (!zoomLayerNode) {\n      if (this.canvas) {\n        this.paintedViewportMap.delete(this.canvas);\n        // Zeroing the width and height causes Firefox to release graphics\n        // resources immediately, which can greatly reduce memory consumption.\n        this.canvas.width = 0;\n        this.canvas.height = 0;\n        delete this.canvas;\n      }\n      this._resetZoomLayer();\n    }\n    if (\n      (typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n      this.svg\n    ) {\n      this.paintedViewportMap.delete(this.svg);\n      delete this.svg;\n    }\n\n    this.loadingIconDiv = document.createElement(\"div\");\n    this.loadingIconDiv.className = \"loadingIcon notVisible\";\n    if (\n      (typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n      this._isStandalone\n    ) {\n      this.toggleLoadingIconSpinner(/* viewVisible = */ true);\n    }\n    this.loadingIconDiv.setAttribute(\"role\", \"img\");\n    this.l10n.get(\"loading\").then(msg => {\n      this.loadingIconDiv?.setAttribute(\"aria-label\", msg);\n    });\n    div.append(this.loadingIconDiv);\n  }\n\n  update({ scale = 0, rotation = null, optionalContentConfigPromise = null }) {\n    this.scale = scale || this.scale;\n    if (typeof rotation === \"number\") {\n      this.rotation = rotation; // The rotation may be zero.\n    }\n    if (optionalContentConfigPromise instanceof Promise) {\n      this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n      // Ensure that the thumbnails always display the *initial* document state,\n      // for documents with optional content.\n      optionalContentConfigPromise.then(optionalContentConfig => {\n        if (\n          optionalContentConfigPromise !== this._optionalContentConfigPromise\n        ) {\n          return;\n        }\n        this.#useThumbnailCanvas.initialOptionalContent =\n          optionalContentConfig.hasInitialVisibility;\n      });\n    }\n\n    const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n    this.viewport = this.viewport.clone({\n      scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n      rotation: totalRotation,\n    });\n\n    if (\n      (typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n      this._isStandalone\n    ) {\n      docStyle.setProperty(\"--scale-factor\", this.viewport.scale);\n    }\n\n    if (\n      (typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n      this.svg\n    ) {\n      this.cssTransform({\n        target: this.svg,\n        redrawAnnotationLayer: true,\n        redrawAnnotationEditorLayer: true,\n        redrawXfaLayer: true,\n      });\n\n      this.eventBus.dispatch(\"pagerendered\", {\n        source: this,\n        pageNumber: this.id,\n        cssTransform: true,\n        timestamp: performance.now(),\n        error: this._renderError,\n      });\n      return;\n    }\n\n    let isScalingRestricted = false;\n    if (this.canvas && this.maxCanvasPixels > 0) {\n      const outputScale = this.outputScale;\n      if (\n        ((Math.floor(this.viewport.width) * outputScale.sx) | 0) *\n          ((Math.floor(this.viewport.height) * outputScale.sy) | 0) >\n        this.maxCanvasPixels\n      ) {\n        isScalingRestricted = true;\n      }\n    }\n\n    if (this.canvas) {\n      if (\n        this.useOnlyCssZoom ||\n        (this.hasRestrictedScaling && isScalingRestricted)\n      ) {\n        this.cssTransform({\n          target: this.canvas,\n          redrawAnnotationLayer: true,\n          redrawAnnotationEditorLayer: true,\n          redrawXfaLayer: true,\n        });\n\n        this.eventBus.dispatch(\"pagerendered\", {\n          source: this,\n          pageNumber: this.id,\n          cssTransform: true,\n          timestamp: performance.now(),\n          error: this._renderError,\n        });\n        return;\n      }\n      if (!this.zoomLayer && !this.canvas.hidden) {\n        this.zoomLayer = this.canvas.parentNode;\n        this.zoomLayer.style.position = \"absolute\";\n      }\n    }\n    if (this.zoomLayer) {\n      this.cssTransform({ target: this.zoomLayer.firstChild });\n    }\n    this.reset({\n      keepZoomLayer: true,\n      keepAnnotationLayer: true,\n      keepAnnotationEditorLayer: true,\n      keepXfaLayer: true,\n    });\n  }\n\n  /**\n   * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n   *              rather than calling this one directly.\n   */\n  cancelRendering({\n    keepAnnotationLayer = false,\n    keepAnnotationEditorLayer = false,\n    keepXfaLayer = false,\n  } = {}) {\n    if (this.paintTask) {\n      this.paintTask.cancel();\n      this.paintTask = null;\n    }\n    this.resume = null;\n\n    if (this.textLayer) {\n      this.textLayer.cancel();\n      this.textLayer = null;\n    }\n    if (\n      this.annotationLayer &&\n      (!keepAnnotationLayer || !this.annotationLayer.div)\n    ) {\n      this.annotationLayer.cancel();\n      this.annotationLayer = null;\n      this._annotationCanvasMap = null;\n    }\n    if (\n      this.annotationEditorLayer &&\n      (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)\n    ) {\n      this.annotationEditorLayer.cancel();\n      this.annotationEditorLayer = null;\n    }\n    if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {\n      this.xfaLayer.cancel();\n      this.xfaLayer = null;\n      this.textHighlighter?.disable();\n    }\n    if (this._onTextLayerRendered) {\n      this.eventBus._off(\"textlayerrendered\", this._onTextLayerRendered);\n      this._onTextLayerRendered = null;\n    }\n  }\n\n  cssTransform({\n    target,\n    redrawAnnotationLayer = false,\n    redrawAnnotationEditorLayer = false,\n    redrawXfaLayer = false,\n  }) {\n    // Scale target (canvas or svg), its wrapper and page container.\n    const width = this.viewport.width;\n    const height = this.viewport.height;\n    const div = this.div;\n    target.style.width =\n      target.parentNode.style.width =\n      div.style.width =\n        Math.floor(width) + \"px\";\n    target.style.height =\n      target.parentNode.style.height =\n      div.style.height =\n        Math.floor(height) + \"px\";\n    // The canvas may have been originally rotated; rotate relative to that.\n    const relativeRotation =\n      this.viewport.rotation - this.paintedViewportMap.get(target).rotation;\n    const absRotation = Math.abs(relativeRotation);\n    let scaleX = 1,\n      scaleY = 1;\n    if (absRotation === 90 || absRotation === 270) {\n      // Scale x and y because of the rotation.\n      scaleX = height / width;\n      scaleY = width / height;\n    }\n    target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;\n\n    if (this.textLayer) {\n      // Rotating the text layer is more complicated since the divs inside the\n      // the text layer are rotated.\n      // TODO: This could probably be simplified by drawing the text layer in\n      // one orientation and then rotating overall.\n      const textLayerViewport = this.textLayer.viewport;\n      const textRelativeRotation =\n        this.viewport.rotation - textLayerViewport.rotation;\n      const textAbsRotation = Math.abs(textRelativeRotation);\n      let scale = width / textLayerViewport.width;\n      if (textAbsRotation === 90 || textAbsRotation === 270) {\n        scale = width / textLayerViewport.height;\n      }\n      const textLayerDiv = this.textLayer.textLayerDiv;\n      let transX, transY;\n      switch (textAbsRotation) {\n        case 0:\n          transX = transY = 0;\n          break;\n        case 90:\n          transX = 0;\n          transY = \"-\" + textLayerDiv.style.height;\n          break;\n        case 180:\n          transX = \"-\" + textLayerDiv.style.width;\n          transY = \"-\" + textLayerDiv.style.height;\n          break;\n        case 270:\n          transX = \"-\" + textLayerDiv.style.width;\n          transY = 0;\n          break;\n        default:\n          console.error(\"Bad rotation value.\");\n          break;\n      }\n\n      textLayerDiv.style.transform =\n        `rotate(${textAbsRotation}deg) ` +\n        `scale(${scale}) ` +\n        `translate(${transX}, ${transY})`;\n      textLayerDiv.style.transformOrigin = \"0% 0%\";\n    }\n\n    if (redrawAnnotationLayer && this.annotationLayer) {\n      this._renderAnnotationLayer();\n    }\n    if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {\n      this._renderAnnotationEditorLayer();\n    }\n    if (redrawXfaLayer && this.xfaLayer) {\n      this._renderXfaLayer();\n    }\n  }\n\n  get width() {\n    return this.viewport.width;\n  }\n\n  get height() {\n    return this.viewport.height;\n  }\n\n  getPagePoint(x, y) {\n    return this.viewport.convertToPdfPoint(x, y);\n  }\n\n  /**\n   * @ignore\n   */\n  toggleLoadingIconSpinner(viewVisible = false) {\n    this.loadingIconDiv?.classList.toggle(\"notVisible\", !viewVisible);\n  }\n\n  draw() {\n    if (this.renderingState !== RenderingStates.INITIAL) {\n      console.error(\"Must be in new state before drawing\");\n      this.reset(); // Ensure that we reset all state to prevent issues.\n    }\n    const { div, pdfPage } = this;\n\n    if (!pdfPage) {\n      this.renderingState = RenderingStates.FINISHED;\n\n      if (this.loadingIconDiv) {\n        this.loadingIconDiv.remove();\n        delete this.loadingIconDiv;\n      }\n      return Promise.reject(new Error(\"pdfPage is not loaded\"));\n    }\n\n    this.renderingState = RenderingStates.RUNNING;\n\n    // Wrap the canvas so that if it has a CSS transform for high DPI the\n    // overflow will be hidden in Firefox.\n    const canvasWrapper = document.createElement(\"div\");\n    canvasWrapper.style.width = div.style.width;\n    canvasWrapper.style.height = div.style.height;\n    canvasWrapper.classList.add(\"canvasWrapper\");\n\n    const lastDivBeforeTextDiv =\n      this.annotationLayer?.div || this.annotationEditorLayer?.div;\n\n    if (lastDivBeforeTextDiv) {\n      // The annotation layer needs to stay on top.\n      lastDivBeforeTextDiv.before(canvasWrapper);\n    } else {\n      div.append(canvasWrapper);\n    }\n\n    let textLayer = null;\n    if (this.textLayerMode !== TextLayerMode.DISABLE && this.textLayerFactory) {\n      this._accessibilityManager ||= new TextAccessibilityManager();\n      const textLayerDiv = document.createElement(\"div\");\n      textLayerDiv.className = \"textLayer\";\n      textLayerDiv.style.width = canvasWrapper.style.width;\n      textLayerDiv.style.height = canvasWrapper.style.height;\n      if (lastDivBeforeTextDiv) {\n        // The annotation layer needs to stay on top.\n        lastDivBeforeTextDiv.before(textLayerDiv);\n      } else {\n        div.append(textLayerDiv);\n      }\n\n      textLayer = this.textLayerFactory.createTextLayerBuilder({\n        textLayerDiv,\n        pageIndex: this.id - 1,\n        viewport: this.viewport,\n        eventBus: this.eventBus,\n        highlighter: this.textHighlighter,\n        accessibilityManager: this._accessibilityManager,\n      });\n    }\n    this.textLayer = textLayer;\n\n    if (\n      this.#annotationMode !== AnnotationMode.DISABLE &&\n      this.annotationLayerFactory\n    ) {\n      this._annotationCanvasMap ||= new Map();\n      this.annotationLayer ||=\n        this.annotationLayerFactory.createAnnotationLayerBuilder({\n          pageDiv: div,\n          pdfPage,\n          imageResourcesPath: this.imageResourcesPath,\n          renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS,\n          l10n: this.l10n,\n          annotationCanvasMap: this._annotationCanvasMap,\n          accessibilityManager: this._accessibilityManager,\n        });\n    }\n\n    if (this.xfaLayer?.div) {\n      // The xfa layer needs to stay on top.\n      div.append(this.xfaLayer.div);\n    }\n\n    let renderContinueCallback = null;\n    if (this.renderingQueue) {\n      renderContinueCallback = cont => {\n        if (!this.renderingQueue.isHighestPriority(this)) {\n          this.renderingState = RenderingStates.PAUSED;\n          this.resume = () => {\n            this.renderingState = RenderingStates.RUNNING;\n            cont();\n          };\n          return;\n        }\n        cont();\n      };\n    }\n\n    const finishPaintTask = async (error = null) => {\n      // The paintTask may have been replaced by a new one, so only remove\n      // the reference to the paintTask if it matches the one that is\n      // triggering this callback.\n      if (paintTask === this.paintTask) {\n        this.paintTask = null;\n      }\n\n      if (error instanceof RenderingCancelledException) {\n        this._renderError = null;\n        return;\n      }\n      this._renderError = error;\n\n      this.renderingState = RenderingStates.FINISHED;\n\n      if (this.loadingIconDiv) {\n        this.loadingIconDiv.remove();\n        delete this.loadingIconDiv;\n      }\n      this._resetZoomLayer(/* removeFromDOM = */ true);\n\n      // Ensure that the thumbnails won't become partially (or fully) blank,\n      // for documents that contain interactive form elements.\n      this.#useThumbnailCanvas.regularAnnotations = !paintTask.separateAnnots;\n\n      this.eventBus.dispatch(\"pagerendered\", {\n        source: this,\n        pageNumber: this.id,\n        cssTransform: false,\n        timestamp: performance.now(),\n        error: this._renderError,\n      });\n\n      if (error) {\n        throw error;\n      }\n    };\n\n    const paintTask =\n      (typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")) &&\n      this.renderer === RendererType.SVG\n        ? this.paintOnSvg(canvasWrapper)\n        : this.paintOnCanvas(canvasWrapper);\n    paintTask.onRenderContinue = renderContinueCallback;\n    this.paintTask = paintTask;\n\n    const resultPromise = paintTask.promise.then(\n      () => {\n        return finishPaintTask(null).then(() => {\n          if (textLayer) {\n            const readableStream = pdfPage.streamTextContent({\n              includeMarkedContent: true,\n            });\n            textLayer.setTextContentStream(readableStream);\n            textLayer.render();\n          }\n\n          if (this.annotationLayer) {\n            this._renderAnnotationLayer().then(() => {\n              if (this.annotationEditorLayerFactory) {\n                this.annotationEditorLayer ||=\n                  this.annotationEditorLayerFactory.createAnnotationEditorLayerBuilder(\n                    {\n                      pageDiv: div,\n                      pdfPage,\n                      l10n: this.l10n,\n                      accessibilityManager: this._accessibilityManager,\n                    }\n                  );\n                this._renderAnnotationEditorLayer();\n              }\n            });\n          }\n        });\n      },\n      function (reason) {\n        return finishPaintTask(reason);\n      }\n    );\n\n    if (this.xfaLayerFactory) {\n      this.xfaLayer ||= this.xfaLayerFactory.createXfaLayerBuilder({\n        pageDiv: div,\n        pdfPage,\n      });\n      this._renderXfaLayer();\n    }\n\n    // The structure tree is currently only supported when the text layer is\n    // enabled and a canvas is used for rendering.\n    if (this.structTreeLayerFactory && this.textLayer && this.canvas) {\n      // The structure tree must be generated after the text layer for the\n      // aria-owns to work.\n      this._onTextLayerRendered = event => {\n        if (event.pageNumber !== this.id) {\n          return;\n        }\n        this.eventBus._off(\"textlayerrendered\", this._onTextLayerRendered);\n        this._onTextLayerRendered = null;\n\n        if (!this.canvas) {\n          return; // The canvas was removed, prevent errors below.\n        }\n        this.pdfPage.getStructTree().then(tree => {\n          if (!tree) {\n            return;\n          }\n          if (!this.canvas) {\n            return; // The canvas was removed, prevent errors below.\n          }\n          const treeDom = this.structTreeLayer.render(tree);\n          treeDom.classList.add(\"structTree\");\n          this.canvas.append(treeDom);\n        });\n      };\n      this.eventBus._on(\"textlayerrendered\", this._onTextLayerRendered);\n      this.structTreeLayer =\n        this.structTreeLayerFactory.createStructTreeLayerBuilder({ pdfPage });\n    }\n\n    div.setAttribute(\"data-loaded\", true);\n\n    this.eventBus.dispatch(\"pagerender\", {\n      source: this,\n      pageNumber: this.id,\n    });\n    return resultPromise;\n  }\n\n  paintOnCanvas(canvasWrapper) {\n    const renderCapability = createPromiseCapability();\n    const result = {\n      promise: renderCapability.promise,\n      onRenderContinue(cont) {\n        cont();\n      },\n      cancel() {\n        renderTask.cancel();\n      },\n      get separateAnnots() {\n        return renderTask.separateAnnots;\n      },\n    };\n\n    const viewport = this.viewport;\n    const canvas = document.createElement(\"canvas\");\n    canvas.setAttribute(\"role\", \"presentation\");\n\n    // Keep the canvas hidden until the first draw callback, or until drawing\n    // is complete when `!this.renderingQueue`, to prevent black flickering.\n    canvas.hidden = true;\n    let isCanvasHidden = true;\n    const showCanvas = function () {\n      if (isCanvasHidden) {\n        canvas.hidden = false;\n        isCanvasHidden = false;\n      }\n    };\n\n    canvasWrapper.append(canvas);\n    this.canvas = canvas;\n\n    const ctx = canvas.getContext(\"2d\", { alpha: false });\n    const outputScale = (this.outputScale = new OutputScale());\n\n    if (this.useOnlyCssZoom) {\n      const actualSizeViewport = viewport.clone({\n        scale: PixelsPerInch.PDF_TO_CSS_UNITS,\n      });\n      // Use a scale that makes the canvas have the originally intended size\n      // of the page.\n      outputScale.sx *= actualSizeViewport.width / viewport.width;\n      outputScale.sy *= actualSizeViewport.height / viewport.height;\n    }\n\n    if (this.maxCanvasPixels > 0) {\n      const pixelsInViewport = viewport.width * viewport.height;\n      const maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);\n      if (outputScale.sx > maxScale || outputScale.sy > maxScale) {\n        outputScale.sx = maxScale;\n        outputScale.sy = maxScale;\n        this.hasRestrictedScaling = true;\n      } else {\n        this.hasRestrictedScaling = false;\n      }\n    }\n\n    const sfx = approximateFraction(outputScale.sx);\n    const sfy = approximateFraction(outputScale.sy);\n    canvas.width = roundToDivide(viewport.width * outputScale.sx, sfx[0]);\n    canvas.height = roundToDivide(viewport.height * outputScale.sy, sfy[0]);\n    canvas.style.width = roundToDivide(viewport.width, sfx[1]) + \"px\";\n    canvas.style.height = roundToDivide(viewport.height, sfy[1]) + \"px\";\n\n    // Add the viewport so it's known what it was originally drawn with.\n    this.paintedViewportMap.set(canvas, viewport);\n\n    // Rendering area\n    const transform = outputScale.scaled\n      ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n      : null;\n    const renderContext = {\n      canvasContext: ctx,\n      transform,\n      viewport: this.viewport,\n      annotationMode: this.#annotationMode,\n      optionalContentConfigPromise: this._optionalContentConfigPromise,\n      annotationCanvasMap: this._annotationCanvasMap,\n      pageColors: this.pageColors,\n    };\n    const renderTask = this.pdfPage.render(renderContext);\n    renderTask.onContinue = function (cont) {\n      showCanvas();\n      if (result.onRenderContinue) {\n        result.onRenderContinue(cont);\n      } else {\n        cont();\n      }\n    };\n\n    renderTask.promise.then(\n      function () {\n        showCanvas();\n        renderCapability.resolve();\n      },\n      function (error) {\n        showCanvas();\n        renderCapability.reject(error);\n      }\n    );\n    return result;\n  }\n\n  paintOnSvg(wrapper) {\n    if (\n      !(\n        typeof PDFJSDev === \"undefined\" ||\n        PDFJSDev.test(\"!PRODUCTION || GENERIC\")\n      )\n    ) {\n      throw new Error(\"Not implemented: paintOnSvg\");\n    }\n    let cancelled = false;\n    const ensureNotCancelled = () => {\n      if (cancelled) {\n        throw new RenderingCancelledException(\n          `Rendering cancelled, page ${this.id}`,\n          \"svg\"\n        );\n      }\n    };\n\n    const pdfPage = this.pdfPage;\n    const actualSizeViewport = this.viewport.clone({\n      scale: PixelsPerInch.PDF_TO_CSS_UNITS,\n    });\n    const promise = pdfPage\n      .getOperatorList({\n        annotationMode: this.#annotationMode,\n      })\n      .then(opList => {\n        ensureNotCancelled();\n        const svgGfx = new SVGGraphics(pdfPage.commonObjs, pdfPage.objs);\n        return svgGfx.getSVG(opList, actualSizeViewport).then(svg => {\n          ensureNotCancelled();\n          this.svg = svg;\n          this.paintedViewportMap.set(svg, actualSizeViewport);\n\n          svg.style.width = wrapper.style.width;\n          svg.style.height = wrapper.style.height;\n          this.renderingState = RenderingStates.FINISHED;\n          wrapper.append(svg);\n        });\n      });\n\n    return {\n      promise,\n      onRenderContinue(cont) {\n        cont();\n      },\n      cancel() {\n        cancelled = true;\n      },\n      get separateAnnots() {\n        return false;\n      },\n    };\n  }\n\n  /**\n   * @param {string|null} label\n   */\n  setPageLabel(label) {\n    this.pageLabel = typeof label === \"string\" ? label : null;\n\n    if (this.pageLabel !== null) {\n      this.div.setAttribute(\"data-page-label\", this.pageLabel);\n    } else {\n      this.div.removeAttribute(\"data-page-label\");\n    }\n  }\n\n  /**\n   * For use by the `PDFThumbnailView.setImage`-method.\n   * @ignore\n   */\n  get thumbnailCanvas() {\n    const { initialOptionalContent, regularAnnotations } =\n      this.#useThumbnailCanvas;\n    return initialOptionalContent && regularAnnotations ? this.canvas : null;\n  }\n}\n\nexport { PDFPageView };\n","/* Copyright 2022 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 { binarySearchFirstItem } from \"./ui_utils.js\";\n\n/**\n * This class aims to provide some methods:\n *  - to reorder elements in the DOM with respect to the visual order;\n *  - to create a link, using aria-owns, between spans in the textLayer and\n *    annotations in the annotationLayer. The goal is to help to know\n *    where the annotations are in the text flow.\n */\nclass TextAccessibilityManager {\n  #enabled = false;\n\n  #textChildren = null;\n\n  #textNodes = new Map();\n\n  #waitingElements = new Map();\n\n  setTextMapping(textDivs) {\n    this.#textChildren = textDivs;\n  }\n\n  /**\n   * Compare the positions of two elements, it must correspond to\n   * the visual ordering.\n   *\n   * @param {HTMLElement} e1\n   * @param {HTMLElement} e2\n   * @returns {number}\n   */\n  static #compareElementPositions(e1, e2) {\n    const rect1 = e1.getBoundingClientRect();\n    const rect2 = e2.getBoundingClientRect();\n\n    if (rect1.width === 0 && rect1.height === 0) {\n      return +1;\n    }\n\n    if (rect2.width === 0 && rect2.height === 0) {\n      return -1;\n    }\n\n    const top1 = rect1.y;\n    const bot1 = rect1.y + rect1.height;\n    const mid1 = rect1.y + rect1.height / 2;\n\n    const top2 = rect2.y;\n    const bot2 = rect2.y + rect2.height;\n    const mid2 = rect2.y + rect2.height / 2;\n\n    if (mid1 <= top2 && mid2 >= bot1) {\n      return -1;\n    }\n\n    if (mid2 <= top1 && mid1 >= bot2) {\n      return +1;\n    }\n\n    const centerX1 = rect1.x + rect1.width / 2;\n    const centerX2 = rect2.x + rect2.width / 2;\n\n    return centerX1 - centerX2;\n  }\n\n  /**\n   * Function called when the text layer has finished rendering.\n   */\n  enable() {\n    if (this.#enabled) {\n      throw new Error(\"TextAccessibilityManager is already enabled.\");\n    }\n    if (!this.#textChildren) {\n      throw new Error(\"Text divs and strings have not been set.\");\n    }\n\n    this.#enabled = true;\n    this.#textChildren = this.#textChildren.slice();\n    this.#textChildren.sort(TextAccessibilityManager.#compareElementPositions);\n\n    if (this.#textNodes.size > 0) {\n      // Some links have been made before this manager has been disabled, hence\n      // we restore them.\n      const textChildren = this.#textChildren;\n      for (const [id, nodeIndex] of this.#textNodes) {\n        const element = document.getElementById(id);\n        if (!element) {\n          // If the page was *fully* reset the element no longer exists, and it\n          // will be re-inserted later (i.e. when the annotationLayer renders).\n          this.#textNodes.delete(id);\n          continue;\n        }\n        this.#addIdToAriaOwns(id, textChildren[nodeIndex]);\n      }\n    }\n\n    for (const [element, isRemovable] of this.#waitingElements) {\n      this.addPointerInTextLayer(element, isRemovable);\n    }\n    this.#waitingElements.clear();\n  }\n\n  disable() {\n    if (!this.#enabled) {\n      return;\n    }\n\n    // Don't clear this.#textNodes which is used to rebuild the aria-owns\n    // in case it's re-enabled at some point.\n\n    this.#waitingElements.clear();\n    this.#textChildren = null;\n    this.#enabled = false;\n  }\n\n  /**\n   * Remove an aria-owns id from a node in the text layer.\n   * @param {HTMLElement} element\n   */\n  removePointerInTextLayer(element) {\n    if (!this.#enabled) {\n      this.#waitingElements.delete(element);\n      return;\n    }\n\n    const children = this.#textChildren;\n    if (!children || children.length === 0) {\n      return;\n    }\n\n    const { id } = element;\n    const nodeIndex = this.#textNodes.get(id);\n    if (nodeIndex === undefined) {\n      return;\n    }\n\n    const node = children[nodeIndex];\n\n    this.#textNodes.delete(id);\n    let owns = node.getAttribute(\"aria-owns\");\n    if (owns?.includes(id)) {\n      owns = owns\n        .split(\" \")\n        .filter(x => x !== id)\n        .join(\" \");\n      if (owns) {\n        node.setAttribute(\"aria-owns\", owns);\n      } else {\n        node.removeAttribute(\"aria-owns\");\n        node.setAttribute(\"role\", \"presentation\");\n      }\n    }\n  }\n\n  #addIdToAriaOwns(id, node) {\n    const owns = node.getAttribute(\"aria-owns\");\n    if (!owns?.includes(id)) {\n      node.setAttribute(\"aria-owns\", owns ? `${owns} ${id}` : id);\n    }\n    node.removeAttribute(\"role\");\n  }\n\n  /**\n   * Find the text node which is the nearest and add an aria-owns attribute\n   * in order to correctly position this editor in the text flow.\n   * @param {HTMLElement} element\n   * @param {boolean} isRemovable\n   */\n  addPointerInTextLayer(element, isRemovable) {\n    const { id } = element;\n    if (!id) {\n      return;\n    }\n\n    if (!this.#enabled) {\n      // The text layer needs to be there, so we postpone the association.\n      this.#waitingElements.set(element, isRemovable);\n      return;\n    }\n\n    if (isRemovable) {\n      this.removePointerInTextLayer(element);\n    }\n\n    const children = this.#textChildren;\n    if (!children || children.length === 0) {\n      return;\n    }\n\n    const index = binarySearchFirstItem(\n      children,\n      node =>\n        TextAccessibilityManager.#compareElementPositions(element, node) < 0\n    );\n\n    const nodeIndex = Math.max(0, index - 1);\n    this.#addIdToAriaOwns(id, children[nodeIndex]);\n    this.#textNodes.set(id, nodeIndex);\n  }\n\n  /**\n   * Move a div in the DOM in order to respect the visual order.\n   * @param {HTMLDivElement} element\n   */\n  moveElementInDOM(container, element, contentElement, isRemovable) {\n    this.addPointerInTextLayer(contentElement, isRemovable);\n\n    if (!container.hasChildNodes()) {\n      container.append(element);\n      return;\n    }\n\n    const children = Array.from(container.childNodes).filter(\n      node => node !== element\n    );\n\n    if (children.length === 0) {\n      return;\n    }\n\n    const elementToCompare = contentElement || element;\n    const index = binarySearchFirstItem(\n      children,\n      node =>\n        TextAccessibilityManager.#compareElementPositions(\n          elementToCompare,\n          node\n        ) < 0\n    );\n\n    if (index === 0) {\n      children[0].before(element);\n    } else {\n      children[index - 1].after(element);\n    }\n  }\n}\n\nexport { TextAccessibilityManager };\n","/* Copyright 2021 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/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n\nconst PDF_ROLE_TO_HTML_ROLE = {\n  // Document level structure types\n  Document: null, // There's a \"document\" role, but it doesn't make sense here.\n  DocumentFragment: null,\n  // Grouping level structure types\n  Part: \"group\",\n  Sect: \"group\", // XXX: There's a \"section\" role, but it's abstract.\n  Div: \"group\",\n  Aside: \"note\",\n  NonStruct: \"none\",\n  // Block level structure types\n  P: null,\n  // H<n>,\n  H: \"heading\",\n  Title: null,\n  FENote: \"note\",\n  // Sub-block level structure type\n  Sub: \"group\",\n  // General inline level structure types\n  Lbl: null,\n  Span: null,\n  Em: null,\n  Strong: null,\n  Link: \"link\",\n  Annot: \"note\",\n  Form: \"form\",\n  // Ruby and Warichu structure types\n  Ruby: null,\n  RB: null,\n  RT: null,\n  RP: null,\n  Warichu: null,\n  WT: null,\n  WP: null,\n  // List standard structure types\n  L: \"list\",\n  LI: \"listitem\",\n  LBody: null,\n  // Table standard structure types\n  Table: \"table\",\n  TR: \"row\",\n  TH: \"columnheader\",\n  TD: \"cell\",\n  THead: \"columnheader\",\n  TBody: null,\n  TFoot: null,\n  // Standard structure type Caption\n  Caption: null,\n  // Standard structure type Figure\n  Figure: \"figure\",\n  // Standard structure type Formula\n  Formula: null,\n  // standard structure type Artifact\n  Artifact: null,\n};\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\n/**\n * @typedef {Object} StructTreeLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n */\n\nclass StructTreeLayerBuilder {\n  /**\n   * @param {StructTreeLayerBuilderOptions} options\n   */\n  constructor({ pdfPage }) {\n    this.pdfPage = pdfPage;\n  }\n\n  render(structTree) {\n    return this._walk(structTree);\n  }\n\n  _setAttributes(structElement, htmlElement) {\n    if (structElement.alt !== undefined) {\n      htmlElement.setAttribute(\"aria-label\", structElement.alt);\n    }\n    if (structElement.id !== undefined) {\n      htmlElement.setAttribute(\"aria-owns\", structElement.id);\n    }\n    if (structElement.lang !== undefined) {\n      htmlElement.setAttribute(\"lang\", structElement.lang);\n    }\n  }\n\n  _walk(node) {\n    if (!node) {\n      return null;\n    }\n\n    const element = document.createElement(\"span\");\n    if (\"role\" in node) {\n      const { role } = node;\n      const match = role.match(HEADING_PATTERN);\n      if (match) {\n        element.setAttribute(\"role\", \"heading\");\n        element.setAttribute(\"aria-level\", match[1]);\n      } else if (PDF_ROLE_TO_HTML_ROLE[role]) {\n        element.setAttribute(\"role\", PDF_ROLE_TO_HTML_ROLE[role]);\n      }\n    }\n\n    this._setAttributes(node, element);\n\n    if (node.children) {\n      if (node.children.length === 1 && \"id\" in node.children[0]) {\n        // Often there is only one content node so just set the values on the\n        // parent node to avoid creating an extra span.\n        this._setAttributes(node.children[0], element);\n      } else {\n        for (const kid of node.children) {\n          element.append(this._walk(kid));\n        }\n      }\n    }\n    return element;\n  }\n}\n\nexport { StructTreeLayerBuilder };\n","/* Copyright 2021 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/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_find_controller\").PDFFindController} PDFFindController */\n\n/**\n * @typedef {Object} TextHighlighterOptions\n * @property {PDFFindController} findController\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} pageIndex - The page index.\n */\n\n/**\n * TextHighlighter handles highlighting matches from the FindController in\n * either the text layer or XFA layer depending on the type of document.\n */\nclass TextHighlighter {\n  /**\n   * @param {TextHighlighterOptions} options\n   */\n  constructor({ findController, eventBus, pageIndex }) {\n    this.findController = findController;\n    this.matches = [];\n    this.eventBus = eventBus;\n    this.pageIdx = pageIndex;\n    this._onUpdateTextLayerMatches = null;\n    this.textDivs = null;\n    this.textContentItemsStr = null;\n    this.enabled = false;\n  }\n\n  /**\n   * Store two arrays that will map DOM nodes to text they should contain.\n   * The arrays should be of equal length and the array element at each index\n   * should correspond to the other. e.g.\n   * `items[0] = \"<span>Item 0</span>\" and texts[0] = \"Item 0\";\n   *\n   * @param {Array<Node>} divs\n   * @param {Array<string>} texts\n   */\n  setTextMapping(divs, texts) {\n    this.textDivs = divs;\n    this.textContentItemsStr = texts;\n  }\n\n  /**\n   * Start listening for events to update the highlighter and check if there are\n   * any current matches that need be highlighted.\n   */\n  enable() {\n    if (!this.textDivs || !this.textContentItemsStr) {\n      throw new Error(\"Text divs and strings have not been set.\");\n    }\n    if (this.enabled) {\n      throw new Error(\"TextHighlighter is already enabled.\");\n    }\n    this.enabled = true;\n    if (!this._onUpdateTextLayerMatches) {\n      this._onUpdateTextLayerMatches = evt => {\n        if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n          this._updateMatches();\n        }\n      };\n      this.eventBus._on(\n        \"updatetextlayermatches\",\n        this._onUpdateTextLayerMatches\n      );\n    }\n    this._updateMatches();\n  }\n\n  disable() {\n    if (!this.enabled) {\n      return;\n    }\n    this.enabled = false;\n    if (this._onUpdateTextLayerMatches) {\n      this.eventBus._off(\n        \"updatetextlayermatches\",\n        this._onUpdateTextLayerMatches\n      );\n      this._onUpdateTextLayerMatches = null;\n    }\n  }\n\n  _convertMatches(matches, matchesLength) {\n    // Early exit if there is nothing to convert.\n    if (!matches) {\n      return [];\n    }\n    const { textContentItemsStr } = this;\n\n    let i = 0,\n      iIndex = 0;\n    const end = textContentItemsStr.length - 1;\n    const result = [];\n\n    for (let m = 0, mm = matches.length; m < mm; m++) {\n      // Calculate the start position.\n      let matchIdx = matches[m];\n\n      // Loop over the divIdxs.\n      while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {\n        iIndex += textContentItemsStr[i].length;\n        i++;\n      }\n\n      if (i === textContentItemsStr.length) {\n        console.error(\"Could not find a matching mapping\");\n      }\n\n      const match = {\n        begin: {\n          divIdx: i,\n          offset: matchIdx - iIndex,\n        },\n      };\n\n      // Calculate the end position.\n      matchIdx += matchesLength[m];\n\n      // Somewhat the same array as above, but use > instead of >= to get\n      // the end position right.\n      while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {\n        iIndex += textContentItemsStr[i].length;\n        i++;\n      }\n\n      match.end = {\n        divIdx: i,\n        offset: matchIdx - iIndex,\n      };\n      result.push(match);\n    }\n    return result;\n  }\n\n  _renderMatches(matches) {\n    // Early exit if there is nothing to render.\n    if (matches.length === 0) {\n      return;\n    }\n    const { findController, pageIdx } = this;\n    const { textContentItemsStr, textDivs } = this;\n\n    const isSelectedPage = pageIdx === findController.selected.pageIdx;\n    const selectedMatchIdx = findController.selected.matchIdx;\n    const highlightAll = findController.state.highlightAll;\n    let prevEnd = null;\n    const infinity = {\n      divIdx: -1,\n      offset: undefined,\n    };\n\n    function beginText(begin, className) {\n      const divIdx = begin.divIdx;\n      textDivs[divIdx].textContent = \"\";\n      return appendTextToDiv(divIdx, 0, begin.offset, className);\n    }\n\n    function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n      let div = textDivs[divIdx];\n      if (div.nodeType === Node.TEXT_NODE) {\n        const span = document.createElement(\"span\");\n        div.before(span);\n        span.append(div);\n        textDivs[divIdx] = span;\n        div = span;\n      }\n      const content = textContentItemsStr[divIdx].substring(\n        fromOffset,\n        toOffset\n      );\n      const node = document.createTextNode(content);\n      if (className) {\n        const span = document.createElement(\"span\");\n        span.className = `${className} appended`;\n        span.append(node);\n        div.append(span);\n        return className.includes(\"selected\") ? span.offsetLeft : 0;\n      }\n      div.append(node);\n      return 0;\n    }\n\n    let i0 = selectedMatchIdx,\n      i1 = i0 + 1;\n    if (highlightAll) {\n      i0 = 0;\n      i1 = matches.length;\n    } else if (!isSelectedPage) {\n      // Not highlighting all and this isn't the selected page, so do nothing.\n      return;\n    }\n\n    for (let i = i0; i < i1; i++) {\n      const match = matches[i];\n      const begin = match.begin;\n      const end = match.end;\n      const isSelected = isSelectedPage && i === selectedMatchIdx;\n      const highlightSuffix = isSelected ? \" selected\" : \"\";\n      let selectedLeft = 0;\n\n      // Match inside new div.\n      if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {\n        // If there was a previous div, then add the text at the end.\n        if (prevEnd !== null) {\n          appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n        }\n        // Clear the divs and set the content until the starting point.\n        beginText(begin);\n      } else {\n        appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);\n      }\n\n      if (begin.divIdx === end.divIdx) {\n        selectedLeft = appendTextToDiv(\n          begin.divIdx,\n          begin.offset,\n          end.offset,\n          \"highlight\" + highlightSuffix\n        );\n      } else {\n        selectedLeft = appendTextToDiv(\n          begin.divIdx,\n          begin.offset,\n          infinity.offset,\n          \"highlight begin\" + highlightSuffix\n        );\n        for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {\n          textDivs[n0].className = \"highlight middle\" + highlightSuffix;\n        }\n        beginText(end, \"highlight end\" + highlightSuffix);\n      }\n      prevEnd = end;\n\n      if (isSelected) {\n        // Attempt to scroll the selected match into view.\n        findController.scrollMatchIntoView({\n          element: textDivs[begin.divIdx],\n          selectedLeft,\n          pageIndex: pageIdx,\n          matchIndex: selectedMatchIdx,\n        });\n      }\n    }\n\n    if (prevEnd) {\n      appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n    }\n  }\n\n  _updateMatches() {\n    if (!this.enabled) {\n      return;\n    }\n    const { findController, matches, pageIdx } = this;\n    const { textContentItemsStr, textDivs } = this;\n    let clearedUntilDivIdx = -1;\n\n    // Clear all current matches.\n    for (const match of matches) {\n      const begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);\n      for (let n = begin, end = match.end.divIdx; n <= end; n++) {\n        const div = textDivs[n];\n        div.textContent = textContentItemsStr[n];\n        div.className = \"\";\n      }\n      clearedUntilDivIdx = match.end.divIdx + 1;\n    }\n\n    if (!findController?.highlightMatches) {\n      return;\n    }\n    // Convert the matches on the `findController` into the match format\n    // used for the textLayer.\n    const pageMatches = findController.pageMatches[pageIdx] || null;\n    const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null;\n\n    this.matches = this._convertMatches(pageMatches, pageMatchesLength);\n    this._renderMatches(this.matches);\n  }\n}\n\nexport { TextHighlighter };\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\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./text_highlighter\").TextHighlighter} TextHighlighter */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { renderTextLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {HTMLDivElement} textLayerDiv - The text layer container.\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} pageIndex - The page index.\n * @property {PageViewport} viewport - The viewport of the text layer.\n * @property {TextHighlighter} highlighter - Optional object that will handle\n *   highlighting text from the find controller.\n * @property {TextAccessibilityManager} [accessibilityManager]\n */\n\n/**\n * The text layer builder provides text selection functionality for the PDF.\n * It does this by creating overlay divs over the PDF's text. These divs\n * contain text that matches the PDF text they are overlaying.\n */\nclass TextLayerBuilder {\n  constructor({\n    textLayerDiv,\n    eventBus,\n    pageIndex,\n    viewport,\n    highlighter = null,\n    accessibilityManager = null,\n  }) {\n    this.textLayerDiv = textLayerDiv;\n    this.eventBus = eventBus;\n    this.textContent = null;\n    this.textContentItemsStr = [];\n    this.textContentStream = null;\n    this.renderingDone = false;\n    this.pageNumber = pageIndex + 1;\n    this.viewport = viewport;\n    this.textDivs = [];\n    this.textLayerRenderTask = null;\n    this.highlighter = highlighter;\n    this.accessibilityManager = accessibilityManager;\n\n    this.#bindMouse();\n  }\n\n  #finishRendering() {\n    this.renderingDone = true;\n\n    const endOfContent = document.createElement(\"div\");\n    endOfContent.className = \"endOfContent\";\n    this.textLayerDiv.append(endOfContent);\n\n    this.eventBus.dispatch(\"textlayerrendered\", {\n      source: this,\n      pageNumber: this.pageNumber,\n      numTextDivs: this.textDivs.length,\n    });\n  }\n\n  /**\n   * Renders the text layer.\n   *\n   * @param {number} [timeout] - Wait for a specified amount of milliseconds\n   *                             before rendering.\n   */\n  render(timeout = 0) {\n    if (!(this.textContent || this.textContentStream) || this.renderingDone) {\n      return;\n    }\n    this.cancel();\n\n    this.textDivs.length = 0;\n    this.highlighter?.setTextMapping(this.textDivs, this.textContentItemsStr);\n    this.accessibilityManager?.setTextMapping(this.textDivs);\n\n    const textLayerFrag = document.createDocumentFragment();\n    this.textLayerRenderTask = renderTextLayer({\n      textContent: this.textContent,\n      textContentStream: this.textContentStream,\n      container: textLayerFrag,\n      viewport: this.viewport,\n      textDivs: this.textDivs,\n      textContentItemsStr: this.textContentItemsStr,\n      timeout,\n    });\n    this.textLayerRenderTask.promise.then(\n      () => {\n        this.textLayerDiv.append(textLayerFrag);\n        this.#finishRendering();\n        this.highlighter?.enable();\n        this.accessibilityManager?.enable();\n      },\n      function (reason) {\n        // Cancelled or failed to render text layer; skipping errors.\n      }\n    );\n  }\n\n  /**\n   * Cancel rendering of the text layer.\n   */\n  cancel() {\n    if (this.textLayerRenderTask) {\n      this.textLayerRenderTask.cancel();\n      this.textLayerRenderTask = null;\n    }\n    this.highlighter?.disable();\n    this.accessibilityManager?.disable();\n  }\n\n  setTextContentStream(readableStream) {\n    this.cancel();\n    this.textContentStream = readableStream;\n  }\n\n  setTextContent(textContent) {\n    this.cancel();\n    this.textContent = textContent;\n  }\n\n  /**\n   * Improves text selection by adding an additional div where the mouse was\n   * clicked. This reduces flickering of the content if the mouse is slowly\n   * dragged up or down.\n   */\n  #bindMouse() {\n    const div = this.textLayerDiv;\n\n    div.addEventListener(\"mousedown\", evt => {\n      const end = div.querySelector(\".endOfContent\");\n      if (!end) {\n        return;\n      }\n      if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n        // On non-Firefox browsers, the selection will feel better if the height\n        // of the `endOfContent` div is adjusted to start at mouse click\n        // location. This avoids flickering when the selection moves up.\n        // However it does not work when selection is started on empty space.\n        let adjustTop = evt.target !== div;\n        if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n          adjustTop &&=\n            getComputedStyle(end).getPropertyValue(\"-moz-user-select\") !==\n            \"none\";\n        }\n        if (adjustTop) {\n          const divBounds = div.getBoundingClientRect();\n          const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);\n          end.style.top = (r * 100).toFixed(2) + \"%\";\n        }\n      }\n      end.classList.add(\"active\");\n    });\n\n    div.addEventListener(\"mouseup\", () => {\n      const end = div.querySelector(\".endOfContent\");\n      if (!end) {\n        return;\n      }\n      if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n        end.style.top = \"\";\n      }\n      end.classList.remove(\"active\");\n    });\n  }\n}\n\nexport { TextLayerBuilder };\n","/* Copyright 2021 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/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { XfaLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} XfaLayerBuilderOptions\n * @property {HTMLDivElement} pageDiv\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {IPDFLinkService} linkService\n * @property {Object} [xfaHtml]\n */\n\nclass XfaLayerBuilder {\n  /**\n   * @param {XfaLayerBuilderOptions} options\n   */\n  constructor({\n    pageDiv,\n    pdfPage,\n    annotationStorage = null,\n    linkService,\n    xfaHtml = null,\n  }) {\n    this.pageDiv = pageDiv;\n    this.pdfPage = pdfPage;\n    this.annotationStorage = annotationStorage;\n    this.linkService = linkService;\n    this.xfaHtml = xfaHtml;\n\n    this.div = null;\n    this._cancelled = false;\n  }\n\n  /**\n   * @param {PageViewport} viewport\n   * @param {string} intent (default value is 'display')\n   * @returns {Promise<Object | void>} A promise that is resolved when rendering\n   *   of the XFA layer is complete. The first rendering will return an object\n   *   with a `textDivs` property that  can be used with the TextHighlighter.\n   */\n  render(viewport, intent = \"display\") {\n    if (intent === \"print\") {\n      const parameters = {\n        viewport: viewport.clone({ dontFlip: true }),\n        div: this.div,\n        xfaHtml: this.xfaHtml,\n        annotationStorage: this.annotationStorage,\n        linkService: this.linkService,\n        intent,\n      };\n\n      // Create an xfa layer div and render the form\n      const div = document.createElement(\"div\");\n      this.pageDiv.append(div);\n      parameters.div = div;\n\n      const result = XfaLayer.render(parameters);\n      return Promise.resolve(result);\n    }\n\n    // intent === \"display\"\n    return this.pdfPage\n      .getXfa()\n      .then(xfaHtml => {\n        if (this._cancelled || !xfaHtml) {\n          return { textDivs: [] };\n        }\n\n        const parameters = {\n          viewport: viewport.clone({ dontFlip: true }),\n          div: this.div,\n          xfaHtml,\n          annotationStorage: this.annotationStorage,\n          linkService: this.linkService,\n          intent,\n        };\n\n        if (this.div) {\n          return XfaLayer.update(parameters);\n        }\n        // Create an xfa layer div and render the form\n        this.div = document.createElement(\"div\");\n        this.pageDiv.append(this.div);\n        parameters.div = this.div;\n        return XfaLayer.render(parameters);\n      })\n      .catch(error => {\n        console.error(error);\n      });\n  }\n\n  cancel() {\n    this._cancelled = true;\n  }\n\n  hide() {\n    if (!this.div) {\n      return;\n    }\n    this.div.hidden = true;\n  }\n}\n\nexport { XfaLayerBuilder };\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 { ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { CursorTool } from \"./pdf_cursor_tools.js\";\nimport { PagesCountLimit } from \"./pdf_viewer.js\";\n\n/**\n * @typedef {Object} SecondaryToolbarOptions\n * @property {HTMLDivElement} toolbar - Container for the secondary toolbar.\n * @property {HTMLButtonElement} toggleButton - Button to toggle the visibility\n *   of the secondary toolbar.\n * @property {HTMLButtonElement} presentationModeButton - Button for entering\n *   presentation mode.\n * @property {HTMLButtonElement} openFileButton - Button to open a file.\n * @property {HTMLButtonElement} printButton - Button to print the document.\n * @property {HTMLButtonElement} downloadButton - Button to download the\n *   document.\n * @property {HTMLAnchorElement} viewBookmarkButton - Button to obtain a\n *   bookmark link to the current location in the document.\n * @property {HTMLButtonElement} firstPageButton - Button to go to the first\n *   page in the document.\n * @property {HTMLButtonElement} lastPageButton - Button to go to the last page\n *   in the document.\n * @property {HTMLButtonElement} pageRotateCwButton - Button to rotate the pages\n *   clockwise.\n * @property {HTMLButtonElement} pageRotateCcwButton - Button to rotate the\n *   pages counterclockwise.\n * @property {HTMLButtonElement} cursorSelectToolButton - Button to enable the\n *   select tool.\n * @property {HTMLButtonElement} cursorHandToolButton - Button to enable the\n *   hand tool.\n * @property {HTMLButtonElement} documentPropertiesButton - Button for opening\n *   the document properties dialog.\n */\n\nclass SecondaryToolbar {\n  /**\n   * @param {SecondaryToolbarOptions} options\n   * @param {EventBus} eventBus\n   */\n  constructor(options, eventBus, externalServices) {\n    this.toolbar = options.toolbar;\n    this.toggleButton = options.toggleButton;\n    this.buttons = [\n      {\n        element: options.presentationModeButton,\n        eventName: \"presentationmode\",\n        close: true,\n      },\n      { element: options.printButton, eventName: \"print\", close: true },\n      { element: options.downloadButton, eventName: \"download\", close: true },\n      { element: options.viewBookmarkButton, eventName: null, close: true },\n      { element: options.firstPageButton, eventName: \"firstpage\", close: true },\n      { element: options.lastPageButton, eventName: \"lastpage\", close: true },\n      {\n        element: options.pageRotateCwButton,\n        eventName: \"rotatecw\",\n        close: false,\n      },\n      {\n        element: options.pageRotateCcwButton,\n        eventName: \"rotateccw\",\n        close: false,\n      },\n      {\n        element: options.cursorSelectToolButton,\n        eventName: \"switchcursortool\",\n        eventDetails: { tool: CursorTool.SELECT },\n        close: true,\n      },\n      {\n        element: options.cursorHandToolButton,\n        eventName: \"switchcursortool\",\n        eventDetails: { tool: CursorTool.HAND },\n        close: true,\n      },\n      {\n        element: options.scrollPageButton,\n        eventName: \"switchscrollmode\",\n        eventDetails: { mode: ScrollMode.PAGE },\n        close: true,\n      },\n      {\n        element: options.scrollVerticalButton,\n        eventName: \"switchscrollmode\",\n        eventDetails: { mode: ScrollMode.VERTICAL },\n        close: true,\n      },\n      {\n        element: options.scrollHorizontalButton,\n        eventName: \"switchscrollmode\",\n        eventDetails: { mode: ScrollMode.HORIZONTAL },\n        close: true,\n      },\n      {\n        element: options.scrollWrappedButton,\n        eventName: \"switchscrollmode\",\n        eventDetails: { mode: ScrollMode.WRAPPED },\n        close: true,\n      },\n      {\n        element: options.spreadNoneButton,\n        eventName: \"switchspreadmode\",\n        eventDetails: { mode: SpreadMode.NONE },\n        close: true,\n      },\n      {\n        element: options.spreadOddButton,\n        eventName: \"switchspreadmode\",\n        eventDetails: { mode: SpreadMode.ODD },\n        close: true,\n      },\n      {\n        element: options.spreadEvenButton,\n        eventName: \"switchspreadmode\",\n        eventDetails: { mode: SpreadMode.EVEN },\n        close: true,\n      },\n      {\n        element: options.documentPropertiesButton,\n        eventName: \"documentproperties\",\n        close: true,\n      },\n    ];\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      this.buttons.push({\n        element: options.openFileButton,\n        eventName: \"openfile\",\n        close: true,\n      });\n    }\n    this.items = {\n      firstPage: options.firstPageButton,\n      lastPage: options.lastPageButton,\n      pageRotateCw: options.pageRotateCwButton,\n      pageRotateCcw: options.pageRotateCcwButton,\n    };\n\n    this.eventBus = eventBus;\n    this.externalServices = externalServices;\n    this.opened = false;\n\n    // Bind the event listeners for click, cursor tool, and scroll/spread mode\n    // actions.\n    this.#bindClickListeners();\n    this.#bindCursorToolsListener(options);\n    this.#bindScrollModeListener(options);\n    this.#bindSpreadModeListener(options);\n\n    this.reset();\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get isOpen() {\n    return this.opened;\n  }\n\n  setPageNumber(pageNumber) {\n    this.pageNumber = pageNumber;\n    this.#updateUIState();\n  }\n\n  setPagesCount(pagesCount) {\n    this.pagesCount = pagesCount;\n    this.#updateUIState();\n  }\n\n  reset() {\n    this.pageNumber = 0;\n    this.pagesCount = 0;\n    this.#updateUIState();\n\n    // Reset the Scroll/Spread buttons too, since they're document specific.\n    this.eventBus.dispatch(\"secondarytoolbarreset\", { source: this });\n  }\n\n  #updateUIState() {\n    this.items.firstPage.disabled = this.pageNumber <= 1;\n    this.items.lastPage.disabled = this.pageNumber >= this.pagesCount;\n    this.items.pageRotateCw.disabled = this.pagesCount === 0;\n    this.items.pageRotateCcw.disabled = this.pagesCount === 0;\n  }\n\n  #bindClickListeners() {\n    // Button to toggle the visibility of the secondary toolbar.\n    this.toggleButton.addEventListener(\"click\", this.toggle.bind(this));\n\n    // All items within the secondary toolbar.\n    for (const { element, eventName, close, eventDetails } of this.buttons) {\n      element.addEventListener(\"click\", evt => {\n        if (eventName !== null) {\n          const details = { source: this };\n          for (const property in eventDetails) {\n            details[property] = eventDetails[property];\n          }\n          this.eventBus.dispatch(eventName, details);\n        }\n        if (close) {\n          this.close();\n        }\n        this.externalServices.reportTelemetry({\n          type: \"buttons\",\n          data: { id: element.id },\n        });\n      });\n    }\n  }\n\n  #bindCursorToolsListener({ cursorSelectToolButton, cursorHandToolButton }) {\n    this.eventBus._on(\"cursortoolchanged\", function ({ tool }) {\n      const isSelect = tool === CursorTool.SELECT,\n        isHand = tool === CursorTool.HAND;\n\n      cursorSelectToolButton.classList.toggle(\"toggled\", isSelect);\n      cursorHandToolButton.classList.toggle(\"toggled\", isHand);\n\n      cursorSelectToolButton.setAttribute(\"aria-checked\", isSelect);\n      cursorHandToolButton.setAttribute(\"aria-checked\", isHand);\n    });\n  }\n\n  #bindScrollModeListener({\n    scrollPageButton,\n    scrollVerticalButton,\n    scrollHorizontalButton,\n    scrollWrappedButton,\n    spreadNoneButton,\n    spreadOddButton,\n    spreadEvenButton,\n  }) {\n    const scrollModeChanged = ({ mode }) => {\n      const isPage = mode === ScrollMode.PAGE,\n        isVertical = mode === ScrollMode.VERTICAL,\n        isHorizontal = mode === ScrollMode.HORIZONTAL,\n        isWrapped = mode === ScrollMode.WRAPPED;\n\n      scrollPageButton.classList.toggle(\"toggled\", isPage);\n      scrollVerticalButton.classList.toggle(\"toggled\", isVertical);\n      scrollHorizontalButton.classList.toggle(\"toggled\", isHorizontal);\n      scrollWrappedButton.classList.toggle(\"toggled\", isWrapped);\n\n      scrollPageButton.setAttribute(\"aria-checked\", isPage);\n      scrollVerticalButton.setAttribute(\"aria-checked\", isVertical);\n      scrollHorizontalButton.setAttribute(\"aria-checked\", isHorizontal);\n      scrollWrappedButton.setAttribute(\"aria-checked\", isWrapped);\n\n      // Permanently *disable* the Scroll buttons when PAGE-scrolling is being\n      // enforced for *very* long/large documents; please see the `BaseViewer`.\n      const forceScrollModePage =\n        this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE;\n      scrollPageButton.disabled = forceScrollModePage;\n      scrollVerticalButton.disabled = forceScrollModePage;\n      scrollHorizontalButton.disabled = forceScrollModePage;\n      scrollWrappedButton.disabled = forceScrollModePage;\n\n      // Temporarily *disable* the Spread buttons when horizontal scrolling is\n      // enabled, since the non-default Spread modes doesn't affect the layout.\n      spreadNoneButton.disabled = isHorizontal;\n      spreadOddButton.disabled = isHorizontal;\n      spreadEvenButton.disabled = isHorizontal;\n    };\n    this.eventBus._on(\"scrollmodechanged\", scrollModeChanged);\n\n    this.eventBus._on(\"secondarytoolbarreset\", evt => {\n      if (evt.source === this) {\n        scrollModeChanged({ mode: ScrollMode.VERTICAL });\n      }\n    });\n  }\n\n  #bindSpreadModeListener({\n    spreadNoneButton,\n    spreadOddButton,\n    spreadEvenButton,\n  }) {\n    function spreadModeChanged({ mode }) {\n      const isNone = mode === SpreadMode.NONE,\n        isOdd = mode === SpreadMode.ODD,\n        isEven = mode === SpreadMode.EVEN;\n\n      spreadNoneButton.classList.toggle(\"toggled\", isNone);\n      spreadOddButton.classList.toggle(\"toggled\", isOdd);\n      spreadEvenButton.classList.toggle(\"toggled\", isEven);\n\n      spreadNoneButton.setAttribute(\"aria-checked\", isNone);\n      spreadOddButton.setAttribute(\"aria-checked\", isOdd);\n      spreadEvenButton.setAttribute(\"aria-checked\", isEven);\n    }\n    this.eventBus._on(\"spreadmodechanged\", spreadModeChanged);\n\n    this.eventBus._on(\"secondarytoolbarreset\", evt => {\n      if (evt.source === this) {\n        spreadModeChanged({ mode: SpreadMode.NONE });\n      }\n    });\n  }\n\n  open() {\n    if (this.opened) {\n      return;\n    }\n    this.opened = true;\n    this.toggleButton.classList.add(\"toggled\");\n    this.toggleButton.setAttribute(\"aria-expanded\", \"true\");\n    this.toolbar.classList.remove(\"hidden\");\n  }\n\n  close() {\n    if (!this.opened) {\n      return;\n    }\n    this.opened = false;\n    this.toolbar.classList.add(\"hidden\");\n    this.toggleButton.classList.remove(\"toggled\");\n    this.toggleButton.setAttribute(\"aria-expanded\", \"false\");\n  }\n\n  toggle() {\n    if (this.opened) {\n      this.close();\n    } else {\n      this.open();\n    }\n  }\n}\n\nexport { SecondaryToolbar };\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\nimport {\n  animationStarted,\n  DEFAULT_SCALE,\n  DEFAULT_SCALE_VALUE,\n  docStyle,\n  MAX_SCALE,\n  MIN_SCALE,\n  noContextMenuHandler,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorType } from \"pdfjs-lib\";\n\nconst PAGE_NUMBER_LOADING_INDICATOR = \"visiblePageIsLoading\";\n\n/**\n * @typedef {Object} ToolbarOptions\n * @property {HTMLDivElement} container - Container for the secondary toolbar.\n * @property {HTMLSpanElement} numPages - Label that contains number of pages.\n * @property {HTMLInputElement} pageNumber - Control for display and user input\n *   of the current page number.\n * @property {HTMLSelectElement} scaleSelect - Scale selection control.\n *   Its width is adjusted, when necessary, on UI localization.\n * @property {HTMLOptionElement} customScaleOption - The item used to display\n *   a non-predefined scale.\n * @property {HTMLButtonElement} previous - Button to go to the previous page.\n * @property {HTMLButtonElement} next - Button to go to the next page.\n * @property {HTMLButtonElement} zoomIn - Button to zoom in the pages.\n * @property {HTMLButtonElement} zoomOut - Button to zoom out the pages.\n * @property {HTMLButtonElement} viewFind - Button to open find bar.\n * @property {HTMLButtonElement} openFile - Button to open a new document.\n * @property {HTMLButtonElement} editorFreeTextButton - Button to switch to\n *   FreeText editing.\n * @property {HTMLButtonElement} download - Button to download the document.\n */\n\nclass Toolbar {\n  #wasLocalized = false;\n\n  /**\n   * @param {ToolbarOptions} options\n   * @param {EventBus} eventBus\n   * @param {IL10n} l10n - Localization service.\n   */\n  constructor(options, eventBus, l10n) {\n    this.toolbar = options.container;\n    this.eventBus = eventBus;\n    this.l10n = l10n;\n    this.buttons = [\n      { element: options.previous, eventName: \"previouspage\" },\n      { element: options.next, eventName: \"nextpage\" },\n      { element: options.zoomIn, eventName: \"zoomin\" },\n      { element: options.zoomOut, eventName: \"zoomout\" },\n      { element: options.print, eventName: \"print\" },\n      { element: options.download, eventName: \"download\" },\n      {\n        element: options.editorFreeTextButton,\n        eventName: \"switchannotationeditormode\",\n        eventDetails: {\n          get mode() {\n            const { classList } = options.editorFreeTextButton;\n            return classList.contains(\"toggled\")\n              ? AnnotationEditorType.NONE\n              : AnnotationEditorType.FREETEXT;\n          },\n        },\n      },\n      {\n        element: options.editorInkButton,\n        eventName: \"switchannotationeditormode\",\n        eventDetails: {\n          get mode() {\n            const { classList } = options.editorInkButton;\n            return classList.contains(\"toggled\")\n              ? AnnotationEditorType.NONE\n              : AnnotationEditorType.INK;\n          },\n        },\n      },\n    ];\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      this.buttons.push({ element: options.openFile, eventName: \"openfile\" });\n    }\n    this.items = {\n      numPages: options.numPages,\n      pageNumber: options.pageNumber,\n      scaleSelect: options.scaleSelect,\n      customScaleOption: options.customScaleOption,\n      previous: options.previous,\n      next: options.next,\n      zoomIn: options.zoomIn,\n      zoomOut: options.zoomOut,\n    };\n\n    // Bind the event listeners for click and various other actions.\n    this.#bindListeners(options);\n\n    this.reset();\n  }\n\n  setPageNumber(pageNumber, pageLabel) {\n    this.pageNumber = pageNumber;\n    this.pageLabel = pageLabel;\n    this.#updateUIState(false);\n  }\n\n  setPagesCount(pagesCount, hasPageLabels) {\n    this.pagesCount = pagesCount;\n    this.hasPageLabels = hasPageLabels;\n    this.#updateUIState(true);\n  }\n\n  setPageScale(pageScaleValue, pageScale) {\n    this.pageScaleValue = (pageScaleValue || pageScale).toString();\n    this.pageScale = pageScale;\n    this.#updateUIState(false);\n  }\n\n  reset() {\n    this.pageNumber = 0;\n    this.pageLabel = null;\n    this.hasPageLabels = false;\n    this.pagesCount = 0;\n    this.pageScaleValue = DEFAULT_SCALE_VALUE;\n    this.pageScale = DEFAULT_SCALE;\n    this.#updateUIState(true);\n    this.updateLoadingIndicatorState();\n\n    // Reset the Editor buttons too, since they're document specific.\n    this.eventBus.dispatch(\"toolbarreset\", { source: this });\n  }\n\n  #bindListeners(options) {\n    const { pageNumber, scaleSelect } = this.items;\n    const self = this;\n\n    // The buttons within the toolbar.\n    for (const { element, eventName, eventDetails } of this.buttons) {\n      element.addEventListener(\"click\", evt => {\n        if (eventName !== null) {\n          const details = { source: this };\n          if (eventDetails) {\n            for (const property in eventDetails) {\n              details[property] = eventDetails[property];\n            }\n          }\n          this.eventBus.dispatch(eventName, details);\n        }\n      });\n    }\n    // The non-button elements within the toolbar.\n    pageNumber.addEventListener(\"click\", function () {\n      this.select();\n    });\n    pageNumber.addEventListener(\"change\", function () {\n      self.eventBus.dispatch(\"pagenumberchanged\", {\n        source: self,\n        value: this.value,\n      });\n    });\n\n    scaleSelect.addEventListener(\"change\", function () {\n      if (this.value === \"custom\") {\n        return;\n      }\n      self.eventBus.dispatch(\"scalechanged\", {\n        source: self,\n        value: this.value,\n      });\n    });\n    // Here we depend on browsers dispatching the \"click\" event *after* the\n    // \"change\" event, when the <select>-element changes.\n    scaleSelect.addEventListener(\"click\", function (evt) {\n      const target = evt.target;\n      // Remove focus when an <option>-element was *clicked*, to improve the UX\n      // for mouse users (fixes bug 1300525 and issue 4923).\n      if (\n        this.value === self.pageScaleValue &&\n        target.tagName.toUpperCase() === \"OPTION\"\n      ) {\n        this.blur();\n      }\n    });\n    // Suppress context menus for some controls.\n    scaleSelect.oncontextmenu = noContextMenuHandler;\n\n    this.eventBus._on(\"localized\", () => {\n      this.#wasLocalized = true;\n      this.#adjustScaleWidth();\n      this.#updateUIState(true);\n    });\n\n    this.#bindEditorToolsListener(options);\n  }\n\n  #bindEditorToolsListener({\n    editorFreeTextButton,\n    editorFreeTextParamsToolbar,\n    editorInkButton,\n    editorInkParamsToolbar,\n  }) {\n    const editorModeChanged = (evt, disableButtons = false) => {\n      const editorButtons = [\n        {\n          mode: AnnotationEditorType.FREETEXT,\n          button: editorFreeTextButton,\n          toolbar: editorFreeTextParamsToolbar,\n        },\n        {\n          mode: AnnotationEditorType.INK,\n          button: editorInkButton,\n          toolbar: editorInkParamsToolbar,\n        },\n      ];\n\n      for (const { mode, button, toolbar } of editorButtons) {\n        const checked = mode === evt.mode;\n        button.classList.toggle(\"toggled\", checked);\n        button.setAttribute(\"aria-checked\", checked);\n        button.disabled = disableButtons;\n        toolbar?.classList.toggle(\"hidden\", !checked);\n      }\n    };\n    this.eventBus._on(\"annotationeditormodechanged\", editorModeChanged);\n\n    this.eventBus._on(\"toolbarreset\", evt => {\n      if (evt.source === this) {\n        editorModeChanged(\n          { mode: AnnotationEditorType.NONE },\n          /* disableButtons = */ true\n        );\n      }\n    });\n  }\n\n  #updateUIState(resetNumPages = false) {\n    if (!this.#wasLocalized) {\n      // Don't update the UI state until we localize the toolbar.\n      return;\n    }\n    const { pageNumber, pagesCount, pageScaleValue, pageScale, items } = this;\n\n    if (resetNumPages) {\n      if (this.hasPageLabels) {\n        items.pageNumber.type = \"text\";\n      } else {\n        items.pageNumber.type = \"number\";\n        this.l10n.get(\"of_pages\", { pagesCount }).then(msg => {\n          items.numPages.textContent = msg;\n        });\n      }\n      items.pageNumber.max = pagesCount;\n    }\n\n    if (this.hasPageLabels) {\n      items.pageNumber.value = this.pageLabel;\n      this.l10n.get(\"page_of_pages\", { pageNumber, pagesCount }).then(msg => {\n        items.numPages.textContent = msg;\n      });\n    } else {\n      items.pageNumber.value = pageNumber;\n    }\n\n    items.previous.disabled = pageNumber <= 1;\n    items.next.disabled = pageNumber >= pagesCount;\n\n    items.zoomOut.disabled = pageScale <= MIN_SCALE;\n    items.zoomIn.disabled = pageScale >= MAX_SCALE;\n\n    this.l10n\n      .get(\"page_scale_percent\", { scale: Math.round(pageScale * 10000) / 100 })\n      .then(msg => {\n        let predefinedValueFound = false;\n        for (const option of items.scaleSelect.options) {\n          if (option.value !== pageScaleValue) {\n            option.selected = false;\n            continue;\n          }\n          option.selected = true;\n          predefinedValueFound = true;\n        }\n        if (!predefinedValueFound) {\n          items.customScaleOption.textContent = msg;\n          items.customScaleOption.selected = true;\n        }\n      });\n  }\n\n  updateLoadingIndicatorState(loading = false) {\n    const { pageNumber } = this.items;\n\n    pageNumber.classList.toggle(PAGE_NUMBER_LOADING_INDICATOR, loading);\n  }\n\n  /**\n   * Increase the width of the zoom dropdown DOM element if, and only if, it's\n   * too narrow to fit the *longest* of the localized strings.\n   */\n  async #adjustScaleWidth() {\n    const { items, l10n } = this;\n\n    const predefinedValuesPromise = Promise.all([\n      l10n.get(\"page_scale_auto\"),\n      l10n.get(\"page_scale_actual\"),\n      l10n.get(\"page_scale_fit\"),\n      l10n.get(\"page_scale_width\"),\n    ]);\n    await animationStarted;\n\n    const style = getComputedStyle(items.scaleSelect);\n    const scaleSelectWidth = parseFloat(\n      style.getPropertyValue(\"--scale-select-width\")\n    );\n\n    // The temporary canvas is used to measure text length in the DOM.\n    const canvas = document.createElement(\"canvas\");\n    const ctx = canvas.getContext(\"2d\", { alpha: false });\n    ctx.font = `${style.fontSize} ${style.fontFamily}`;\n\n    let maxWidth = 0;\n    for (const predefinedValue of await predefinedValuesPromise) {\n      const { width } = ctx.measureText(predefinedValue);\n      if (width > maxWidth) {\n        maxWidth = width;\n      }\n    }\n    // Account for the icon width, and ensure that there's always some spacing\n    // between the text and the icon.\n    maxWidth += 0.3 * scaleSelectWidth;\n\n    if (maxWidth > scaleSelectWidth) {\n      docStyle.setProperty(\"--scale-select-width\", `${maxWidth}px`);\n    }\n    // Zeroing the width and height cause Firefox to release graphics resources\n    // immediately, which can greatly reduce memory consumption.\n    canvas.width = 0;\n    canvas.height = 0;\n  }\n}\n\nexport { Toolbar };\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\nconst DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;\n\n/**\n * View History - This is a utility for saving various view parameters for\n *                recently opened files.\n *\n * The way that the view parameters are stored depends on how PDF.js is built,\n * for 'gulp <flag>' the following cases exist:\n *  - MOZCENTRAL        - uses sessionStorage.\n *  - GENERIC or CHROME - uses localStorage, if it is available.\n */\nclass ViewHistory {\n  constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {\n    this.fingerprint = fingerprint;\n    this.cacheSize = cacheSize;\n\n    this._initializedPromise = this._readFromStorage().then(databaseStr => {\n      const database = JSON.parse(databaseStr || \"{}\");\n      let index = -1;\n      if (!Array.isArray(database.files)) {\n        database.files = [];\n      } else {\n        while (database.files.length >= this.cacheSize) {\n          database.files.shift();\n        }\n\n        for (let i = 0, ii = database.files.length; i < ii; i++) {\n          const branch = database.files[i];\n          if (branch.fingerprint === this.fingerprint) {\n            index = i;\n            break;\n          }\n        }\n      }\n      if (index === -1) {\n        index = database.files.push({ fingerprint: this.fingerprint }) - 1;\n      }\n      this.file = database.files[index];\n      this.database = database;\n    });\n  }\n\n  async _writeToStorage() {\n    const databaseStr = JSON.stringify(this.database);\n\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      sessionStorage.setItem(\"pdfjs.history\", databaseStr);\n      return;\n    }\n    localStorage.setItem(\"pdfjs.history\", databaseStr);\n  }\n\n  async _readFromStorage() {\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      return sessionStorage.getItem(\"pdfjs.history\");\n    }\n    return localStorage.getItem(\"pdfjs.history\");\n  }\n\n  async set(name, val) {\n    await this._initializedPromise;\n    this.file[name] = val;\n    return this._writeToStorage();\n  }\n\n  async setMultiple(properties) {\n    await this._initializedPromise;\n    for (const name in properties) {\n      this.file[name] = properties[name];\n    }\n    return this._writeToStorage();\n  }\n\n  async get(name, defaultValue) {\n    await this._initializedPromise;\n    const val = this.file[name];\n    return val !== undefined ? val : defaultValue;\n  }\n\n  async getMultiple(properties) {\n    await this._initializedPromise;\n    const values = Object.create(null);\n\n    for (const name in properties) {\n      const val = this.file[name];\n      values[name] = val !== undefined ? val : properties[name];\n    }\n    return values;\n  }\n}\n\nexport { ViewHistory };\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\nimport { DefaultExternalServices, PDFViewerApplication } from \"./app.js\";\nimport { BasePreferences } from \"./preferences.js\";\nimport { DownloadManager } from \"./download_manager.js\";\nimport { GenericL10n } from \"./genericl10n.js\";\nimport { GenericScripting } from \"./generic_scripting.js\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"GENERIC\")) {\n  throw new Error(\n    'Module \"pdfjs-web/genericcom\" shall not be used outside GENERIC build.'\n  );\n}\n\nconst GenericCom = {};\n\nclass GenericPreferences extends BasePreferences {\n  async _writeToStorage(prefObj) {\n    localStorage.setItem(\"pdfjs.preferences\", JSON.stringify(prefObj));\n  }\n\n  async _readFromStorage(prefObj) {\n    return JSON.parse(localStorage.getItem(\"pdfjs.preferences\"));\n  }\n}\n\nclass GenericExternalServices extends DefaultExternalServices {\n  static createDownloadManager(options) {\n    return new DownloadManager();\n  }\n\n  static createPreferences() {\n    return new GenericPreferences();\n  }\n\n  static createL10n({ locale = \"en-US\" }) {\n    return new GenericL10n(locale);\n  }\n\n  static createScripting({ sandboxBundleSrc }) {\n    return new GenericScripting(sandboxBundleSrc);\n  }\n}\nPDFViewerApplication.externalServices = GenericExternalServices;\n\nexport { GenericCom };\n","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AppOptions, OptionKind } from \"./app_options.js\";\n\n/**\n * BasePreferences - Abstract base class for storing persistent settings.\n *   Used for settings that should be applied to all opened documents,\n *   or every time the viewer is loaded.\n */\nclass BasePreferences {\n  #defaults = Object.freeze(\n    typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")\n      ? AppOptions.getAll(OptionKind.PREFERENCE)\n      : PDFJSDev.eval(\"DEFAULT_PREFERENCES\")\n  );\n\n  #prefs = Object.create(null);\n\n  #initializedPromise = null;\n\n  constructor() {\n    if (this.constructor === BasePreferences) {\n      throw new Error(\"Cannot initialize BasePreferences.\");\n    }\n\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n      Object.defineProperty(this, \"defaults\", {\n        get() {\n          return this.#defaults;\n        },\n      });\n    }\n\n    this.#initializedPromise = this._readFromStorage(this.#defaults).then(\n      prefs => {\n        for (const name in this.#defaults) {\n          const prefValue = prefs?.[name];\n          // Ignore preferences whose types don't match the default values.\n          if (typeof prefValue === typeof this.#defaults[name]) {\n            this.#prefs[name] = prefValue;\n          }\n        }\n      }\n    );\n  }\n\n  /**\n   * Stub function for writing preferences to storage.\n   * @param {Object} prefObj The preferences that should be written to storage.\n   * @returns {Promise} A promise that is resolved when the preference values\n   *                    have been written.\n   */\n  async _writeToStorage(prefObj) {\n    throw new Error(\"Not implemented: _writeToStorage\");\n  }\n\n  /**\n   * Stub function for reading preferences from storage.\n   * @param {Object} prefObj The preferences that should be read from storage.\n   * @returns {Promise} A promise that is resolved with an {Object} containing\n   *                    the preferences that have been read.\n   */\n  async _readFromStorage(prefObj) {\n    throw new Error(\"Not implemented: _readFromStorage\");\n  }\n\n  /**\n   * Reset the preferences to their default values and update storage.\n   * @returns {Promise} A promise that is resolved when the preference values\n   *                    have been reset.\n   */\n  async reset() {\n    await this.#initializedPromise;\n    const prefs = this.#prefs;\n\n    this.#prefs = Object.create(null);\n    return this._writeToStorage(this.#defaults).catch(reason => {\n      // Revert all preference values, since writing to storage failed.\n      this.#prefs = prefs;\n      throw reason;\n    });\n  }\n\n  /**\n   * Set the value of a preference.\n   * @param {string} name The name of the preference that should be changed.\n   * @param {boolean|number|string} value The new value of the preference.\n   * @returns {Promise} A promise that is resolved when the value has been set,\n   *                    provided that the preference exists and the types match.\n   */\n  async set(name, value) {\n    await this.#initializedPromise;\n    const defaultValue = this.#defaults[name],\n      prefs = this.#prefs;\n\n    if (defaultValue === undefined) {\n      throw new Error(`Set preference: \"${name}\" is undefined.`);\n    } else if (value === undefined) {\n      throw new Error(\"Set preference: no value is specified.\");\n    }\n    const valueType = typeof value,\n      defaultType = typeof defaultValue;\n\n    if (valueType !== defaultType) {\n      if (valueType === \"number\" && defaultType === \"string\") {\n        value = value.toString();\n      } else {\n        throw new Error(\n          `Set preference: \"${value}\" is a ${valueType}, expected a ${defaultType}.`\n        );\n      }\n    } else {\n      if (valueType === \"number\" && !Number.isInteger(value)) {\n        throw new Error(`Set preference: \"${value}\" must be an integer.`);\n      }\n    }\n\n    this.#prefs[name] = value;\n    return this._writeToStorage(this.#prefs).catch(reason => {\n      // Revert all preference values, since writing to storage failed.\n      this.#prefs = prefs;\n      throw reason;\n    });\n  }\n\n  /**\n   * Get the value of a preference.\n   * @param {string} name The name of the preference whose value is requested.\n   * @returns {Promise} A promise resolved with a {boolean|number|string}\n   *                    containing the value of the preference.\n   */\n  async get(name) {\n    await this.#initializedPromise;\n    const defaultValue = this.#defaults[name];\n\n    if (defaultValue === undefined) {\n      throw new Error(`Get preference: \"${name}\" is undefined.`);\n    }\n    return this.#prefs[name] ?? defaultValue;\n  }\n\n  /**\n   * Get the values of all preferences.\n   * @returns {Promise} A promise that is resolved with an {Object} containing\n   *                    the values of all preferences.\n   */\n  async getAll() {\n    await this.#initializedPromise;\n    const obj = Object.create(null);\n\n    for (const name in this.#defaults) {\n      obj[name] = this.#prefs[name] ?? this.#defaults[name];\n    }\n    return obj;\n  }\n}\n\nexport { BasePreferences };\n","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n\nimport { createValidAbsoluteUrl, isPdfFile } from \"pdfjs-lib\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"CHROME || GENERIC\")) {\n  throw new Error(\n    'Module \"pdfjs-web/download_manager\" shall not be used ' +\n      \"outside CHROME and GENERIC builds.\"\n  );\n}\n\nfunction download(blobUrl, filename) {\n  const a = document.createElement(\"a\");\n  if (!a.click) {\n    throw new Error('DownloadManager: \"a.click()\" is not supported.');\n  }\n  a.href = blobUrl;\n  a.target = \"_parent\";\n  // Use a.download if available. This increases the likelihood that\n  // the file is downloaded instead of opened by another PDF plugin.\n  if (\"download\" in a) {\n    a.download = filename;\n  }\n  // <a> must be in the document for recent Firefox versions,\n  // otherwise .click() is ignored.\n  (document.body || document.documentElement).append(a);\n  a.click();\n  a.remove();\n}\n\n/**\n * @implements {IDownloadManager}\n */\nclass DownloadManager {\n  #openBlobUrls = new WeakMap();\n\n  downloadUrl(url, filename) {\n    if (!createValidAbsoluteUrl(url, \"http://example.com\")) {\n      console.error(`downloadUrl - not a valid URL: ${url}`);\n      return; // restricted/invalid URL\n    }\n    download(url + \"#pdfjs.action=download\", filename);\n  }\n\n  downloadData(data, filename, contentType) {\n    const blobUrl = URL.createObjectURL(\n      new Blob([data], { type: contentType })\n    );\n    download(blobUrl, filename);\n  }\n\n  /**\n   * @returns {boolean} Indicating if the data was opened.\n   */\n  openOrDownloadData(element, data, filename) {\n    const isPdfData = isPdfFile(filename);\n    const contentType = isPdfData ? \"application/pdf\" : \"\";\n\n    if (isPdfData) {\n      let blobUrl = this.#openBlobUrls.get(element);\n      if (!blobUrl) {\n        blobUrl = URL.createObjectURL(new Blob([data], { type: contentType }));\n        this.#openBlobUrls.set(element, blobUrl);\n      }\n      let viewerUrl;\n      if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n        // The current URL is the viewer, let's use it and append the file.\n        viewerUrl = \"?file=\" + encodeURIComponent(blobUrl + \"#\" + filename);\n      } else if (PDFJSDev.test(\"CHROME\")) {\n        // In the Chrome extension, the URL is rewritten using the history API\n        // in viewer.js, so an absolute URL must be generated.\n        viewerUrl =\n          // eslint-disable-next-line no-undef\n          chrome.runtime.getURL(\"/content/web/viewer.html\") +\n          \"?file=\" +\n          encodeURIComponent(blobUrl + \"#\" + filename);\n      }\n\n      try {\n        window.open(viewerUrl);\n        return true;\n      } catch (ex) {\n        console.error(`openOrDownloadData: ${ex}`);\n        // Release the `blobUrl`, since opening it failed, and fallback to\n        // downloading the PDF file.\n        URL.revokeObjectURL(blobUrl);\n        this.#openBlobUrls.delete(element);\n      }\n    }\n\n    this.downloadData(data, filename, contentType);\n    return false;\n  }\n\n  download(blob, url, filename) {\n    const blobUrl = URL.createObjectURL(blob);\n    download(blobUrl, filename);\n  }\n}\n\nexport { DownloadManager };\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\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n\nimport \"../external/webL10n/l10n.js\";\nimport { fixupLangCode, getL10nFallback } from \"./l10n_utils.js\";\n\nconst webL10n = document.webL10n;\n\n/**\n * @implements {IL10n}\n */\nclass GenericL10n {\n  constructor(lang) {\n    this._lang = lang;\n    this._ready = new Promise((resolve, reject) => {\n      webL10n.setLanguage(fixupLangCode(lang), () => {\n        resolve(webL10n);\n      });\n    });\n  }\n\n  async getLanguage() {\n    const l10n = await this._ready;\n    return l10n.getLanguage();\n  }\n\n  async getDirection() {\n    const l10n = await this._ready;\n    return l10n.getDirection();\n  }\n\n  async get(key, args = null, fallback = getL10nFallback(key, args)) {\n    const l10n = await this._ready;\n    return l10n.get(key, args, fallback);\n  }\n\n  async translate(element) {\n    const l10n = await this._ready;\n    return l10n.translate(element);\n  }\n}\n\nexport { GenericL10n };\n","/**\n * Copyright (c) 2011-2013 Fabien Cazenave, Mozilla.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n/*\n  Additional modifications for PDF.js project:\n    - Disables language initialization on page loading.\n    - Disables document translation on page loading.\n    - Removes consoleWarn and consoleLog and use console.log/warn directly.\n    - Removes window._ assignment.\n    - Remove compatibility code for OldIE.\n    - Replaces `String.prototype.substr()` with `String.prototype.substring()`.\n    - Replaces one `Node.insertBefore()` with `Element.prepend()`.\n    - Removes `fireL10nReadyEvent` since the \"localized\" event it dispatches\n      is unused and may clash with an identically named event in the viewer.\n*/\n\n/*jshint browser: true, devel: true, es5: true, globalstrict: true */\n'use strict';\n\ndocument.webL10n = (function(window, document, undefined) {\n  var gL10nData = {};\n  var gTextData = '';\n  var gTextProp = 'textContent';\n  var gLanguage = '';\n  var gMacros = {};\n  var gReadyState = 'loading';\n\n\n  /**\n   * Synchronously loading l10n resources significantly minimizes flickering\n   * from displaying the app with non-localized strings and then updating the\n   * strings. Although this will block all script execution on this page, we\n   * expect that the l10n resources are available locally on flash-storage.\n   *\n   * As synchronous XHR is generally considered as a bad idea, we're still\n   * loading l10n resources asynchronously -- but we keep this in a setting,\n   * just in case... and applications using this library should hide their\n   * content until the `localized' event happens.\n   */\n\n  var gAsyncResourceLoading = true; // read-only\n\n\n  /**\n   * DOM helpers for the so-called \"HTML API\".\n   *\n   * These functions are written for modern browsers. For old versions of IE,\n   * they're overridden in the 'startup' section at the end of this file.\n   */\n\n  function getL10nResourceLinks() {\n    return document.querySelectorAll('link[type=\"application/l10n\"]');\n  }\n\n  function getL10nDictionary() {\n    var script = document.querySelector('script[type=\"application/l10n\"]');\n    // TODO: support multiple and external JSON dictionaries\n    return script ? JSON.parse(script.innerHTML) : null;\n  }\n\n  function getTranslatableChildren(element) {\n    return element ? element.querySelectorAll('*[data-l10n-id]') : [];\n  }\n\n  function getL10nAttributes(element) {\n    if (!element)\n      return {};\n\n    var l10nId = element.getAttribute('data-l10n-id');\n    var l10nArgs = element.getAttribute('data-l10n-args');\n    var args = {};\n    if (l10nArgs) {\n      try {\n        args = JSON.parse(l10nArgs);\n      } catch (e) {\n        console.warn('could not parse arguments for #' + l10nId);\n      }\n    }\n    return { id: l10nId, args: args };\n  }\n\n  function xhrLoadText(url, onSuccess, onFailure) {\n    onSuccess = onSuccess || function _onSuccess(data) {};\n    onFailure = onFailure || function _onFailure() {};\n\n    var xhr = new XMLHttpRequest();\n    xhr.open('GET', url, gAsyncResourceLoading);\n    if (xhr.overrideMimeType) {\n      xhr.overrideMimeType('text/plain; charset=utf-8');\n    }\n    xhr.onreadystatechange = function() {\n      if (xhr.readyState == 4) {\n        if (xhr.status == 200 || xhr.status === 0) {\n          onSuccess(xhr.responseText);\n        } else {\n          onFailure();\n        }\n      }\n    };\n    xhr.onerror = onFailure;\n    xhr.ontimeout = onFailure;\n\n    // in Firefox OS with the app:// protocol, trying to XHR a non-existing\n    // URL will raise an exception here -- hence this ugly try...catch.\n    try {\n      xhr.send(null);\n    } catch (e) {\n      onFailure();\n    }\n  }\n\n\n  /**\n   * l10n resource parser:\n   *  - reads (async XHR) the l10n resource matching `lang';\n   *  - imports linked resources (synchronously) when specified;\n   *  - parses the text data (fills `gL10nData' and `gTextData');\n   *  - triggers success/failure callbacks when done.\n   *\n   * @param {string} href\n   *    URL of the l10n resource to parse.\n   *\n   * @param {string} lang\n   *    locale (language) to parse. Must be a lowercase string.\n   *\n   * @param {Function} successCallback\n   *    triggered when the l10n resource has been successfully parsed.\n   *\n   * @param {Function} failureCallback\n   *    triggered when the an error has occurred.\n   *\n   * @return {void}\n   *    uses the following global variables: gL10nData, gTextData, gTextProp.\n   */\n\n  function parseResource(href, lang, successCallback, failureCallback) {\n    var baseURL = href.replace(/[^\\/]*$/, '') || './';\n\n    // handle escaped characters (backslashes) in a string\n    function evalString(text) {\n      if (text.lastIndexOf('\\\\') < 0)\n        return text;\n      return text.replace(/\\\\\\\\/g, '\\\\')\n                 .replace(/\\\\n/g, '\\n')\n                 .replace(/\\\\r/g, '\\r')\n                 .replace(/\\\\t/g, '\\t')\n                 .replace(/\\\\b/g, '\\b')\n                 .replace(/\\\\f/g, '\\f')\n                 .replace(/\\\\{/g, '{')\n                 .replace(/\\\\}/g, '}')\n                 .replace(/\\\\\"/g, '\"')\n                 .replace(/\\\\'/g, \"'\");\n    }\n\n    // parse *.properties text data into an l10n dictionary\n    // If gAsyncResourceLoading is false, then the callback will be called\n    // synchronously. Otherwise it is called asynchronously.\n    function parseProperties(text, parsedPropertiesCallback) {\n      var dictionary = {};\n\n      // token expressions\n      var reBlank = /^\\s*|\\s*$/;\n      var reComment = /^\\s*#|^\\s*$/;\n      var reSection = /^\\s*\\[(.*)\\]\\s*$/;\n      var reImport = /^\\s*@import\\s+url\\((.*)\\)\\s*$/i;\n      var reSplit = /^([^=\\s]*)\\s*=\\s*(.+)$/; // TODO: escape EOLs with '\\'\n\n      // parse the *.properties file into an associative array\n      function parseRawLines(rawText, extendedSyntax, parsedRawLinesCallback) {\n        var entries = rawText.replace(reBlank, '').split(/[\\r\\n]+/);\n        var currentLang = '*';\n        var genericLang = lang.split('-', 1)[0];\n        var skipLang = false;\n        var match = '';\n\n        function nextEntry() {\n          // Use infinite loop instead of recursion to avoid reaching the\n          // maximum recursion limit for content with many lines.\n          while (true) {\n            if (!entries.length) {\n              parsedRawLinesCallback();\n              return;\n            }\n            var line = entries.shift();\n\n            // comment or blank line?\n            if (reComment.test(line))\n              continue;\n\n            // the extended syntax supports [lang] sections and @import rules\n            if (extendedSyntax) {\n              match = reSection.exec(line);\n              if (match) { // section start?\n                // RFC 4646, section 4.4, \"All comparisons MUST be performed\n                // in a case-insensitive manner.\"\n\n                currentLang = match[1].toLowerCase();\n                skipLang = (currentLang !== '*') &&\n                    (currentLang !== lang) && (currentLang !== genericLang);\n                continue;\n              } else if (skipLang) {\n                continue;\n              }\n              match = reImport.exec(line);\n              if (match) { // @import rule?\n                loadImport(baseURL + match[1], nextEntry);\n                return;\n              }\n            }\n\n            // key-value pair\n            var tmp = line.match(reSplit);\n            if (tmp && tmp.length == 3) {\n              dictionary[tmp[1]] = evalString(tmp[2]);\n            }\n          }\n        }\n        nextEntry();\n      }\n\n      // import another *.properties file\n      function loadImport(url, callback) {\n        xhrLoadText(url, function(content) {\n          parseRawLines(content, false, callback); // don't allow recursive imports\n        }, function () {\n          console.warn(url + ' not found.');\n          callback();\n        });\n      }\n\n      // fill the dictionary\n      parseRawLines(text, true, function() {\n        parsedPropertiesCallback(dictionary);\n      });\n    }\n\n    // load and parse l10n data (warning: global variables are used here)\n    xhrLoadText(href, function(response) {\n      gTextData += response; // mostly for debug\n\n      // parse *.properties text data into an l10n dictionary\n      parseProperties(response, function(data) {\n\n        // find attribute descriptions, if any\n        for (var key in data) {\n          var id, prop, index = key.lastIndexOf('.');\n          if (index > 0) { // an attribute has been specified\n            id = key.substring(0, index);\n            prop = key.substring(index + 1);\n          } else { // no attribute: assuming text content by default\n            id = key;\n            prop = gTextProp;\n          }\n          if (!gL10nData[id]) {\n            gL10nData[id] = {};\n          }\n          gL10nData[id][prop] = data[key];\n        }\n\n        // trigger callback\n        if (successCallback) {\n          successCallback();\n        }\n      });\n    }, failureCallback);\n  }\n\n  // load and parse all resources for the specified locale\n  function loadLocale(lang, callback) {\n    // RFC 4646, section 2.1 states that language tags have to be treated as\n    // case-insensitive. Convert to lowercase for case-insensitive comparisons.\n    if (lang) {\n      lang = lang.toLowerCase();\n    }\n\n    callback = callback || function _callback() {};\n\n    clear();\n    gLanguage = lang;\n\n    // check all <link type=\"application/l10n\" href=\"...\" /> nodes\n    // and load the resource files\n    var langLinks = getL10nResourceLinks();\n    var langCount = langLinks.length;\n    if (langCount === 0) {\n      // we might have a pre-compiled dictionary instead\n      var dict = getL10nDictionary();\n      if (dict && dict.locales && dict.default_locale) {\n        console.log('using the embedded JSON directory, early way out');\n        gL10nData = dict.locales[lang];\n        if (!gL10nData) {\n          var defaultLocale = dict.default_locale.toLowerCase();\n          for (var anyCaseLang in dict.locales) {\n            anyCaseLang = anyCaseLang.toLowerCase();\n            if (anyCaseLang === lang) {\n              gL10nData = dict.locales[lang];\n              break;\n            } else if (anyCaseLang === defaultLocale) {\n              gL10nData = dict.locales[defaultLocale];\n            }\n          }\n        }\n        callback();\n      } else {\n        console.log('no resource to load, early way out');\n      }\n      // early way out\n      gReadyState = 'complete';\n      return;\n    }\n\n    // start the callback when all resources are loaded\n    var onResourceLoaded = null;\n    var gResourceCount = 0;\n    onResourceLoaded = function() {\n      gResourceCount++;\n      if (gResourceCount >= langCount) {\n        callback();\n        gReadyState = 'complete';\n      }\n    };\n\n    // load all resource files\n    function L10nResourceLink(link) {\n      var href = link.href;\n      // Note: If |gAsyncResourceLoading| is false, then the following callbacks\n      // are synchronously called.\n      this.load = function(lang, callback) {\n        parseResource(href, lang, callback, function() {\n          console.warn(href + ' not found.');\n          // lang not found, used default resource instead\n          console.warn('\"' + lang + '\" resource not found');\n          gLanguage = '';\n          // Resource not loaded, but we still need to call the callback.\n          callback();\n        });\n      };\n    }\n\n    for (var i = 0; i < langCount; i++) {\n      var resource = new L10nResourceLink(langLinks[i]);\n      resource.load(lang, onResourceLoaded);\n    }\n  }\n\n  // clear all l10n data\n  function clear() {\n    gL10nData = {};\n    gTextData = '';\n    gLanguage = '';\n    // TODO: clear all non predefined macros.\n    // There's no such macro /yet/ but we're planning to have some...\n  }\n\n\n  /**\n   * Get rules for plural forms (shared with JetPack), see:\n   * http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html\n   * https://github.com/mozilla/addon-sdk/blob/master/python-lib/plural-rules-generator.p\n   *\n   * @param {string} lang\n   *    locale (language) used.\n   *\n   * @return {Function}\n   *    returns a function that gives the plural form name for a given integer:\n   *       var fun = getPluralRules('en');\n   *       fun(1)    -> 'one'\n   *       fun(0)    -> 'other'\n   *       fun(1000) -> 'other'.\n   */\n\n  function getPluralRules(lang) {\n    var locales2rules = {\n      'af': 3,\n      'ak': 4,\n      'am': 4,\n      'ar': 1,\n      'asa': 3,\n      'az': 0,\n      'be': 11,\n      'bem': 3,\n      'bez': 3,\n      'bg': 3,\n      'bh': 4,\n      'bm': 0,\n      'bn': 3,\n      'bo': 0,\n      'br': 20,\n      'brx': 3,\n      'bs': 11,\n      'ca': 3,\n      'cgg': 3,\n      'chr': 3,\n      'cs': 12,\n      'cy': 17,\n      'da': 3,\n      'de': 3,\n      'dv': 3,\n      'dz': 0,\n      'ee': 3,\n      'el': 3,\n      'en': 3,\n      'eo': 3,\n      'es': 3,\n      'et': 3,\n      'eu': 3,\n      'fa': 0,\n      'ff': 5,\n      'fi': 3,\n      'fil': 4,\n      'fo': 3,\n      'fr': 5,\n      'fur': 3,\n      'fy': 3,\n      'ga': 8,\n      'gd': 24,\n      'gl': 3,\n      'gsw': 3,\n      'gu': 3,\n      'guw': 4,\n      'gv': 23,\n      'ha': 3,\n      'haw': 3,\n      'he': 2,\n      'hi': 4,\n      'hr': 11,\n      'hu': 0,\n      'id': 0,\n      'ig': 0,\n      'ii': 0,\n      'is': 3,\n      'it': 3,\n      'iu': 7,\n      'ja': 0,\n      'jmc': 3,\n      'jv': 0,\n      'ka': 0,\n      'kab': 5,\n      'kaj': 3,\n      'kcg': 3,\n      'kde': 0,\n      'kea': 0,\n      'kk': 3,\n      'kl': 3,\n      'km': 0,\n      'kn': 0,\n      'ko': 0,\n      'ksb': 3,\n      'ksh': 21,\n      'ku': 3,\n      'kw': 7,\n      'lag': 18,\n      'lb': 3,\n      'lg': 3,\n      'ln': 4,\n      'lo': 0,\n      'lt': 10,\n      'lv': 6,\n      'mas': 3,\n      'mg': 4,\n      'mk': 16,\n      'ml': 3,\n      'mn': 3,\n      'mo': 9,\n      'mr': 3,\n      'ms': 0,\n      'mt': 15,\n      'my': 0,\n      'nah': 3,\n      'naq': 7,\n      'nb': 3,\n      'nd': 3,\n      'ne': 3,\n      'nl': 3,\n      'nn': 3,\n      'no': 3,\n      'nr': 3,\n      'nso': 4,\n      'ny': 3,\n      'nyn': 3,\n      'om': 3,\n      'or': 3,\n      'pa': 3,\n      'pap': 3,\n      'pl': 13,\n      'ps': 3,\n      'pt': 3,\n      'rm': 3,\n      'ro': 9,\n      'rof': 3,\n      'ru': 11,\n      'rwk': 3,\n      'sah': 0,\n      'saq': 3,\n      'se': 7,\n      'seh': 3,\n      'ses': 0,\n      'sg': 0,\n      'sh': 11,\n      'shi': 19,\n      'sk': 12,\n      'sl': 14,\n      'sma': 7,\n      'smi': 7,\n      'smj': 7,\n      'smn': 7,\n      'sms': 7,\n      'sn': 3,\n      'so': 3,\n      'sq': 3,\n      'sr': 11,\n      'ss': 3,\n      'ssy': 3,\n      'st': 3,\n      'sv': 3,\n      'sw': 3,\n      'syr': 3,\n      'ta': 3,\n      'te': 3,\n      'teo': 3,\n      'th': 0,\n      'ti': 4,\n      'tig': 3,\n      'tk': 3,\n      'tl': 4,\n      'tn': 3,\n      'to': 0,\n      'tr': 0,\n      'ts': 3,\n      'tzm': 22,\n      'uk': 11,\n      'ur': 3,\n      've': 3,\n      'vi': 0,\n      'vun': 3,\n      'wa': 4,\n      'wae': 3,\n      'wo': 0,\n      'xh': 3,\n      'xog': 3,\n      'yo': 0,\n      'zh': 0,\n      'zu': 3\n    };\n\n    // utility functions for plural rules methods\n    function isIn(n, list) {\n      return list.indexOf(n) !== -1;\n    }\n    function isBetween(n, start, end) {\n      return start <= n && n <= end;\n    }\n\n    // list of all plural rules methods:\n    // map an integer to the plural form name to use\n    var pluralRules = {\n      '0': function(n) {\n        return 'other';\n      },\n      '1': function(n) {\n        if ((isBetween((n % 100), 3, 10)))\n          return 'few';\n        if (n === 0)\n          return 'zero';\n        if ((isBetween((n % 100), 11, 99)))\n          return 'many';\n        if (n == 2)\n          return 'two';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '2': function(n) {\n        if (n !== 0 && (n % 10) === 0)\n          return 'many';\n        if (n == 2)\n          return 'two';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '3': function(n) {\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '4': function(n) {\n        if ((isBetween(n, 0, 1)))\n          return 'one';\n        return 'other';\n      },\n      '5': function(n) {\n        if ((isBetween(n, 0, 2)) && n != 2)\n          return 'one';\n        return 'other';\n      },\n      '6': function(n) {\n        if (n === 0)\n          return 'zero';\n        if ((n % 10) == 1 && (n % 100) != 11)\n          return 'one';\n        return 'other';\n      },\n      '7': function(n) {\n        if (n == 2)\n          return 'two';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '8': function(n) {\n        if ((isBetween(n, 3, 6)))\n          return 'few';\n        if ((isBetween(n, 7, 10)))\n          return 'many';\n        if (n == 2)\n          return 'two';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '9': function(n) {\n        if (n === 0 || n != 1 && (isBetween((n % 100), 1, 19)))\n          return 'few';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '10': function(n) {\n        if ((isBetween((n % 10), 2, 9)) && !(isBetween((n % 100), 11, 19)))\n          return 'few';\n        if ((n % 10) == 1 && !(isBetween((n % 100), 11, 19)))\n          return 'one';\n        return 'other';\n      },\n      '11': function(n) {\n        if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14)))\n          return 'few';\n        if ((n % 10) === 0 ||\n            (isBetween((n % 10), 5, 9)) ||\n            (isBetween((n % 100), 11, 14)))\n          return 'many';\n        if ((n % 10) == 1 && (n % 100) != 11)\n          return 'one';\n        return 'other';\n      },\n      '12': function(n) {\n        if ((isBetween(n, 2, 4)))\n          return 'few';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '13': function(n) {\n        if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14)))\n          return 'few';\n        if (n != 1 && (isBetween((n % 10), 0, 1)) ||\n            (isBetween((n % 10), 5, 9)) ||\n            (isBetween((n % 100), 12, 14)))\n          return 'many';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '14': function(n) {\n        if ((isBetween((n % 100), 3, 4)))\n          return 'few';\n        if ((n % 100) == 2)\n          return 'two';\n        if ((n % 100) == 1)\n          return 'one';\n        return 'other';\n      },\n      '15': function(n) {\n        if (n === 0 || (isBetween((n % 100), 2, 10)))\n          return 'few';\n        if ((isBetween((n % 100), 11, 19)))\n          return 'many';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '16': function(n) {\n        if ((n % 10) == 1 && n != 11)\n          return 'one';\n        return 'other';\n      },\n      '17': function(n) {\n        if (n == 3)\n          return 'few';\n        if (n === 0)\n          return 'zero';\n        if (n == 6)\n          return 'many';\n        if (n == 2)\n          return 'two';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '18': function(n) {\n        if (n === 0)\n          return 'zero';\n        if ((isBetween(n, 0, 2)) && n !== 0 && n != 2)\n          return 'one';\n        return 'other';\n      },\n      '19': function(n) {\n        if ((isBetween(n, 2, 10)))\n          return 'few';\n        if ((isBetween(n, 0, 1)))\n          return 'one';\n        return 'other';\n      },\n      '20': function(n) {\n        if ((isBetween((n % 10), 3, 4) || ((n % 10) == 9)) && !(\n            isBetween((n % 100), 10, 19) ||\n            isBetween((n % 100), 70, 79) ||\n            isBetween((n % 100), 90, 99)\n            ))\n          return 'few';\n        if ((n % 1000000) === 0 && n !== 0)\n          return 'many';\n        if ((n % 10) == 2 && !isIn((n % 100), [12, 72, 92]))\n          return 'two';\n        if ((n % 10) == 1 && !isIn((n % 100), [11, 71, 91]))\n          return 'one';\n        return 'other';\n      },\n      '21': function(n) {\n        if (n === 0)\n          return 'zero';\n        if (n == 1)\n          return 'one';\n        return 'other';\n      },\n      '22': function(n) {\n        if ((isBetween(n, 0, 1)) || (isBetween(n, 11, 99)))\n          return 'one';\n        return 'other';\n      },\n      '23': function(n) {\n        if ((isBetween((n % 10), 1, 2)) || (n % 20) === 0)\n          return 'one';\n        return 'other';\n      },\n      '24': function(n) {\n        if ((isBetween(n, 3, 10) || isBetween(n, 13, 19)))\n          return 'few';\n        if (isIn(n, [2, 12]))\n          return 'two';\n        if (isIn(n, [1, 11]))\n          return 'one';\n        return 'other';\n      }\n    };\n\n    // return a function that gives the plural form name for a given integer\n    var index = locales2rules[lang.replace(/-.*$/, '')];\n    if (!(index in pluralRules)) {\n      console.warn('plural form unknown for [' + lang + ']');\n      return function() { return 'other'; };\n    }\n    return pluralRules[index];\n  }\n\n  // pre-defined 'plural' macro\n  gMacros.plural = function(str, param, key, prop) {\n    var n = parseFloat(param);\n    if (isNaN(n))\n      return str;\n\n    // TODO: support other properties (l20n still doesn't...)\n    if (prop != gTextProp)\n      return str;\n\n    // initialize _pluralRules\n    if (!gMacros._pluralRules) {\n      gMacros._pluralRules = getPluralRules(gLanguage);\n    }\n    var index = '[' + gMacros._pluralRules(n) + ']';\n\n    // try to find a [zero|one|two] key if it's defined\n    if (n === 0 && (key + '[zero]') in gL10nData) {\n      str = gL10nData[key + '[zero]'][prop];\n    } else if (n == 1 && (key + '[one]') in gL10nData) {\n      str = gL10nData[key + '[one]'][prop];\n    } else if (n == 2 && (key + '[two]') in gL10nData) {\n      str = gL10nData[key + '[two]'][prop];\n    } else if ((key + index) in gL10nData) {\n      str = gL10nData[key + index][prop];\n    } else if ((key + '[other]') in gL10nData) {\n      str = gL10nData[key + '[other]'][prop];\n    }\n\n    return str;\n  };\n\n\n  /**\n   * l10n dictionary functions\n   */\n\n  // fetch an l10n object, warn if not found, apply `args' if possible\n  function getL10nData(key, args, fallback) {\n    var data = gL10nData[key];\n    if (!data) {\n      console.warn('#' + key + ' is undefined.');\n      if (!fallback) {\n        return null;\n      }\n      data = fallback;\n    }\n\n    /** This is where l10n expressions should be processed.\n      * The plan is to support C-style expressions from the l20n project;\n      * until then, only two kinds of simple expressions are supported:\n      *   {[ index ]} and {{ arguments }}.\n      */\n    var rv = {};\n    for (var prop in data) {\n      var str = data[prop];\n      str = substIndexes(str, args, key, prop);\n      str = substArguments(str, args, key);\n      rv[prop] = str;\n    }\n    return rv;\n  }\n\n  // replace {[macros]} with their values\n  function substIndexes(str, args, key, prop) {\n    var reIndex = /\\{\\[\\s*([a-zA-Z]+)\\(([a-zA-Z]+)\\)\\s*\\]\\}/;\n    var reMatch = reIndex.exec(str);\n    if (!reMatch || !reMatch.length)\n      return str;\n\n    // an index/macro has been found\n    // Note: at the moment, only one parameter is supported\n    var macroName = reMatch[1];\n    var paramName = reMatch[2];\n    var param;\n    if (args && paramName in args) {\n      param = args[paramName];\n    } else if (paramName in gL10nData) {\n      param = gL10nData[paramName];\n    }\n\n    // there's no macro parser yet: it has to be defined in gMacros\n    if (macroName in gMacros) {\n      var macro = gMacros[macroName];\n      str = macro(str, param, key, prop);\n    }\n    return str;\n  }\n\n  // replace {{arguments}} with their values\n  function substArguments(str, args, key) {\n    var reArgs = /\\{\\{\\s*(.+?)\\s*\\}\\}/g;\n    return str.replace(reArgs, function(matched_text, arg) {\n      if (args && arg in args) {\n        return args[arg];\n      }\n      if (arg in gL10nData) {\n        return gL10nData[arg];\n      }\n      console.log('argument {{' + arg + '}} for #' + key + ' is undefined.');\n      return matched_text;\n    });\n  }\n\n  // translate an HTML element\n  function translateElement(element) {\n    var l10n = getL10nAttributes(element);\n    if (!l10n.id)\n      return;\n\n    // get the related l10n object\n    var data = getL10nData(l10n.id, l10n.args);\n    if (!data) {\n      console.warn('#' + l10n.id + ' is undefined.');\n      return;\n    }\n\n    // translate element (TODO: security checks?)\n    if (data[gTextProp]) { // XXX\n      if (getChildElementCount(element) === 0) {\n        element[gTextProp] = data[gTextProp];\n      } else {\n        // this element has element children: replace the content of the first\n        // (non-empty) child textNode and clear other child textNodes\n        var children = element.childNodes;\n        var found = false;\n        for (var i = 0, l = children.length; i < l; i++) {\n          if (children[i].nodeType === 3 && /\\S/.test(children[i].nodeValue)) {\n            if (found) {\n              children[i].nodeValue = '';\n            } else {\n              children[i].nodeValue = data[gTextProp];\n              found = true;\n            }\n          }\n        }\n        // if no (non-empty) textNode is found, insert a textNode before the\n        // first element child.\n        if (!found) {\n          var textNode = document.createTextNode(data[gTextProp]);\n          element.prepend(textNode);\n        }\n      }\n      delete data[gTextProp];\n    }\n\n    for (var k in data) {\n      element[k] = data[k];\n    }\n  }\n\n  // webkit browsers don't currently support 'children' on SVG elements...\n  function getChildElementCount(element) {\n    if (element.children) {\n      return element.children.length;\n    }\n    if (typeof element.childElementCount !== 'undefined') {\n      return element.childElementCount;\n    }\n    var count = 0;\n    for (var i = 0; i < element.childNodes.length; i++) {\n      count += element.nodeType === 1 ? 1 : 0;\n    }\n    return count;\n  }\n\n  // translate an HTML subtree\n  function translateFragment(element) {\n    element = element || document.documentElement;\n\n    // check all translatable children (= w/ a `data-l10n-id' attribute)\n    var children = getTranslatableChildren(element);\n    var elementCount = children.length;\n    for (var i = 0; i < elementCount; i++) {\n      translateElement(children[i]);\n    }\n\n    // translate element itself if necessary\n    translateElement(element);\n  }\n\n  return {\n    // get a localized string\n    get: function(key, args, fallbackString) {\n      var index = key.lastIndexOf('.');\n      var prop = gTextProp;\n      if (index > 0) { // An attribute has been specified\n        prop = key.substring(index + 1);\n        key = key.substring(0, index);\n      }\n      var fallback;\n      if (fallbackString) {\n        fallback = {};\n        fallback[prop] = fallbackString;\n      }\n      var data = getL10nData(key, args, fallback);\n      if (data && prop in data) {\n        return data[prop];\n      }\n      return '{{' + key + '}}';\n    },\n\n    // debug\n    getData: function() { return gL10nData; },\n    getText: function() { return gTextData; },\n\n    // get|set the document language\n    getLanguage: function() { return gLanguage; },\n    setLanguage: function(lang, callback) {\n      loadLocale(lang, function() {\n        if (callback)\n          callback();\n      });\n    },\n\n    // get the direction (ltr|rtl) of the current language\n    getDirection: function() {\n      // http://www.w3.org/International/questions/qa-scripts\n      // Arabic, Hebrew, Farsi, Pashto, Urdu\n      var rtlList = ['ar', 'he', 'fa', 'ps', 'ur'];\n      var shortCode = gLanguage.split('-', 1)[0];\n      return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';\n    },\n\n    // translate an element or document fragment\n    translate: translateFragment,\n\n    // this can be used to prevent race conditions\n    getReadyState: function() { return gReadyState; },\n    ready: function(callback) {\n      if (!callback) {\n        return;\n      } else if (gReadyState == 'complete' || gReadyState == 'interactive') {\n        window.setTimeout(function() {\n          callback();\n        });\n      } else if (document.addEventListener) {\n        document.addEventListener('localized', function once() {\n          document.removeEventListener('localized', once);\n          callback();\n        });\n      }\n    }\n  };\n}) (window, document);\n","/* Copyright 2020 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 { getPdfFilenameFromUrl, loadScript } from \"pdfjs-lib\";\n\nasync function docPropertiesLookup(pdfDocument) {\n  const url = \"\",\n    baseUrl = url.split(\"#\")[0];\n  // eslint-disable-next-line prefer-const\n  let { info, metadata, contentDispositionFilename, contentLength } =\n    await pdfDocument.getMetadata();\n\n  if (!contentLength) {\n    const { length } = await pdfDocument.getDownloadInfo();\n    contentLength = length;\n  }\n\n  return {\n    ...info,\n    baseURL: baseUrl,\n    filesize: contentLength,\n    filename: contentDispositionFilename || getPdfFilenameFromUrl(url),\n    metadata: metadata?.getRaw(),\n    authors: metadata?.get(\"dc:creator\"),\n    numPages: pdfDocument.numPages,\n    URL: url,\n  };\n}\n\nclass GenericScripting {\n  constructor(sandboxBundleSrc) {\n    this._ready = loadScript(\n      sandboxBundleSrc,\n      /* removeScriptElement = */ true\n    ).then(() => {\n      return window.pdfjsSandbox.QuickJSSandbox();\n    });\n  }\n\n  async createSandbox(data) {\n    const sandbox = await this._ready;\n    sandbox.create(data);\n  }\n\n  async dispatchEventInSandbox(event) {\n    const sandbox = await this._ready;\n    setTimeout(() => sandbox.dispatchEvent(event), 0);\n  }\n\n  async destroySandbox() {\n    const sandbox = await this._ready;\n    sandbox.nukeSandbox();\n  }\n}\n\nexport { docPropertiesLookup, GenericScripting };\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\nimport { AnnotationMode, PixelsPerInch } from \"pdfjs-lib\";\nimport { PDFPrintServiceFactory, PDFViewerApplication } from \"./app.js\";\nimport { getXfaHtmlForPrinting } from \"./print_utils.js\";\n\nlet activeService = null;\nlet dialog = null;\nlet overlayManager = null;\n\n// Renders the page to the canvas of the given print service, and returns\n// the suggested dimensions of the output page.\nfunction renderPage(\n  activeServiceOnEntry,\n  pdfDocument,\n  pageNumber,\n  size,\n  printResolution,\n  optionalContentConfigPromise,\n  printAnnotationStoragePromise\n) {\n  const scratchCanvas = activeService.scratchCanvas;\n\n  // The size of the canvas in pixels for printing.\n  const PRINT_UNITS = printResolution / PixelsPerInch.PDF;\n  scratchCanvas.width = Math.floor(size.width * PRINT_UNITS);\n  scratchCanvas.height = Math.floor(size.height * PRINT_UNITS);\n\n  const ctx = scratchCanvas.getContext(\"2d\");\n  ctx.save();\n  ctx.fillStyle = \"rgb(255, 255, 255)\";\n  ctx.fillRect(0, 0, scratchCanvas.width, scratchCanvas.height);\n  ctx.restore();\n\n  return Promise.all([\n    pdfDocument.getPage(pageNumber),\n    printAnnotationStoragePromise,\n  ]).then(function ([pdfPage, printAnnotationStorage]) {\n    const renderContext = {\n      canvasContext: ctx,\n      transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],\n      viewport: pdfPage.getViewport({ scale: 1, rotation: size.rotation }),\n      intent: \"print\",\n      annotationMode: AnnotationMode.ENABLE_STORAGE,\n      optionalContentConfigPromise,\n      printAnnotationStorage,\n    };\n    return pdfPage.render(renderContext).promise;\n  });\n}\n\nfunction PDFPrintService(\n  pdfDocument,\n  pagesOverview,\n  printContainer,\n  printResolution,\n  optionalContentConfigPromise = null,\n  printAnnotationStoragePromise = null,\n  l10n\n) {\n  this.pdfDocument = pdfDocument;\n  this.pagesOverview = pagesOverview;\n  this.printContainer = printContainer;\n  this._printResolution = printResolution || 150;\n  this._optionalContentConfigPromise =\n    optionalContentConfigPromise || pdfDocument.getOptionalContentConfig();\n  this._printAnnotationStoragePromise =\n    printAnnotationStoragePromise || Promise.resolve();\n  this.l10n = l10n;\n  this.currentPage = -1;\n  // The temporary canvas where renderPage paints one page at a time.\n  this.scratchCanvas = document.createElement(\"canvas\");\n}\n\nPDFPrintService.prototype = {\n  layout() {\n    this.throwIfInactive();\n\n    const body = document.querySelector(\"body\");\n    body.setAttribute(\"data-pdfjsprinting\", true);\n\n    const hasEqualPageSizes = this.pagesOverview.every(function (size) {\n      return (\n        size.width === this.pagesOverview[0].width &&\n        size.height === this.pagesOverview[0].height\n      );\n    }, this);\n    if (!hasEqualPageSizes) {\n      console.warn(\n        \"Not all pages have the same size. The printed \" +\n          \"result may be incorrect!\"\n      );\n    }\n\n    // Insert a @page + size rule to make sure that the page size is correctly\n    // set. Note that we assume that all pages have the same size, because\n    // variable-size pages are not supported yet (e.g. in Chrome & Firefox).\n    // TODO(robwu): Use named pages when size calculation bugs get resolved\n    // (e.g. https://crbug.com/355116) AND when support for named pages is\n    // added (http://www.w3.org/TR/css3-page/#using-named-pages).\n    // In browsers where @page + size is not supported (such as Firefox,\n    // https://bugzil.la/851441), the next stylesheet will be ignored and the\n    // user has to select the correct paper size in the UI if wanted.\n    this.pageStyleSheet = document.createElement(\"style\");\n    const pageSize = this.pagesOverview[0];\n    this.pageStyleSheet.textContent =\n      \"@page { size: \" + pageSize.width + \"pt \" + pageSize.height + \"pt;}\";\n    body.append(this.pageStyleSheet);\n  },\n\n  destroy() {\n    if (activeService !== this) {\n      // |activeService| cannot be replaced without calling destroy() first,\n      // so if it differs then an external consumer has a stale reference to us.\n      return;\n    }\n    this.printContainer.textContent = \"\";\n\n    const body = document.querySelector(\"body\");\n    body.removeAttribute(\"data-pdfjsprinting\");\n\n    if (this.pageStyleSheet) {\n      this.pageStyleSheet.remove();\n      this.pageStyleSheet = null;\n    }\n    this.scratchCanvas.width = this.scratchCanvas.height = 0;\n    this.scratchCanvas = null;\n    activeService = null;\n    ensureOverlay().then(function () {\n      if (overlayManager.active === dialog) {\n        overlayManager.close(dialog);\n      }\n    });\n  },\n\n  renderPages() {\n    if (this.pdfDocument.isPureXfa) {\n      getXfaHtmlForPrinting(this.printContainer, this.pdfDocument);\n      return Promise.resolve();\n    }\n\n    const pageCount = this.pagesOverview.length;\n    const renderNextPage = (resolve, reject) => {\n      this.throwIfInactive();\n      if (++this.currentPage >= pageCount) {\n        renderProgress(pageCount, pageCount, this.l10n);\n        resolve();\n        return;\n      }\n      const index = this.currentPage;\n      renderProgress(index, pageCount, this.l10n);\n      renderPage(\n        this,\n        this.pdfDocument,\n        /* pageNumber = */ index + 1,\n        this.pagesOverview[index],\n        this._printResolution,\n        this._optionalContentConfigPromise,\n        this._printAnnotationStoragePromise\n      )\n        .then(this.useRenderedPage.bind(this))\n        .then(function () {\n          renderNextPage(resolve, reject);\n        }, reject);\n    };\n    return new Promise(renderNextPage);\n  },\n\n  useRenderedPage() {\n    this.throwIfInactive();\n    const img = document.createElement(\"img\");\n    const scratchCanvas = this.scratchCanvas;\n    if (\"toBlob\" in scratchCanvas) {\n      scratchCanvas.toBlob(function (blob) {\n        img.src = URL.createObjectURL(blob);\n      });\n    } else {\n      img.src = scratchCanvas.toDataURL();\n    }\n\n    const wrapper = document.createElement(\"div\");\n    wrapper.className = \"printedPage\";\n    wrapper.append(img);\n    this.printContainer.append(wrapper);\n\n    return new Promise(function (resolve, reject) {\n      img.onload = resolve;\n      img.onerror = reject;\n    });\n  },\n\n  performPrint() {\n    this.throwIfInactive();\n    return new Promise(resolve => {\n      // Push window.print in the macrotask queue to avoid being affected by\n      // the deprecation of running print() code in a microtask, see\n      // https://github.com/mozilla/pdf.js/issues/7547.\n      setTimeout(() => {\n        if (!this.active) {\n          resolve();\n          return;\n        }\n        print.call(window);\n        // Delay promise resolution in case print() was not synchronous.\n        setTimeout(resolve, 20); // Tidy-up.\n      }, 0);\n    });\n  },\n\n  get active() {\n    return this === activeService;\n  },\n\n  throwIfInactive() {\n    if (!this.active) {\n      throw new Error(\"This print request was cancelled or completed.\");\n    }\n  },\n};\n\nconst print = window.print;\nwindow.print = function () {\n  if (activeService) {\n    console.warn(\"Ignored window.print() because of a pending print job.\");\n    return;\n  }\n  ensureOverlay().then(function () {\n    if (activeService) {\n      overlayManager.open(dialog);\n    }\n  });\n\n  try {\n    dispatchEvent(\"beforeprint\");\n  } finally {\n    if (!activeService) {\n      console.error(\"Expected print service to be initialized.\");\n      ensureOverlay().then(function () {\n        if (overlayManager.active === dialog) {\n          overlayManager.close(dialog);\n        }\n      });\n      return; // eslint-disable-line no-unsafe-finally\n    }\n    const activeServiceOnEntry = activeService;\n    activeService\n      .renderPages()\n      .then(function () {\n        return activeServiceOnEntry.performPrint();\n      })\n      .catch(function () {\n        // Ignore any error messages.\n      })\n      .then(function () {\n        // aborts acts on the \"active\" print request, so we need to check\n        // whether the print request (activeServiceOnEntry) is still active.\n        // Without the check, an unrelated print request (created after aborting\n        // this print request while the pages were being generated) would be\n        // aborted.\n        if (activeServiceOnEntry.active) {\n          abort();\n        }\n      });\n  }\n};\n\nfunction dispatchEvent(eventType) {\n  const event = document.createEvent(\"CustomEvent\");\n  event.initCustomEvent(eventType, false, false, \"custom\");\n  window.dispatchEvent(event);\n}\n\nfunction abort() {\n  if (activeService) {\n    activeService.destroy();\n    dispatchEvent(\"afterprint\");\n  }\n}\n\nfunction renderProgress(index, total, l10n) {\n  dialog ||= document.getElementById(\"printServiceDialog\");\n  const progress = Math.round((100 * index) / total);\n  const progressBar = dialog.querySelector(\"progress\");\n  const progressPerc = dialog.querySelector(\".relative-progress\");\n  progressBar.value = progress;\n  l10n.get(\"print_progress_percent\", { progress }).then(msg => {\n    progressPerc.textContent = msg;\n  });\n}\n\nwindow.addEventListener(\n  \"keydown\",\n  function (event) {\n    // Intercept Cmd/Ctrl + P in all browsers.\n    // Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera\n    if (\n      event.keyCode === /* P= */ 80 &&\n      (event.ctrlKey || event.metaKey) &&\n      !event.altKey &&\n      (!event.shiftKey || window.chrome || window.opera)\n    ) {\n      window.print();\n\n      event.preventDefault();\n      event.stopImmediatePropagation();\n    }\n  },\n  true\n);\n\nif (\"onbeforeprint\" in window) {\n  // Do not propagate before/afterprint events when they are not triggered\n  // from within this polyfill. (FF / Chrome 63+).\n  const stopPropagationIfNeeded = function (event) {\n    if (event.detail !== \"custom\") {\n      event.stopImmediatePropagation();\n    }\n  };\n  window.addEventListener(\"beforeprint\", stopPropagationIfNeeded);\n  window.addEventListener(\"afterprint\", stopPropagationIfNeeded);\n}\n\nlet overlayPromise;\nfunction ensureOverlay() {\n  if (!overlayPromise) {\n    overlayManager = PDFViewerApplication.overlayManager;\n    if (!overlayManager) {\n      throw new Error(\"The overlay manager has not yet been initialized.\");\n    }\n    dialog ||= document.getElementById(\"printServiceDialog\");\n\n    overlayPromise = overlayManager.register(\n      dialog,\n      /* canForceClose = */ true\n    );\n\n    document.getElementById(\"printCancel\").onclick = abort;\n    dialog.addEventListener(\"close\", abort);\n  }\n  return overlayPromise;\n}\n\nPDFPrintServiceFactory.instance = {\n  supportsPrinting: true,\n\n  createPrintService(\n    pdfDocument,\n    pagesOverview,\n    printContainer,\n    printResolution,\n    optionalContentConfigPromise,\n    printAnnotationStoragePromise,\n    l10n\n  ) {\n    if (activeService) {\n      throw new Error(\"The print service is created and active.\");\n    }\n    activeService = new PDFPrintService(\n      pdfDocument,\n      pagesOverview,\n      printContainer,\n      printResolution,\n      optionalContentConfigPromise,\n      printAnnotationStoragePromise,\n      l10n\n    );\n    return activeService;\n  },\n};\n\nexport { PDFPrintService };\n","/* Copyright 2021 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 { getXfaPageViewport, PixelsPerInch } from \"pdfjs-lib\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\nfunction getXfaHtmlForPrinting(printContainer, pdfDocument) {\n  const xfaHtml = pdfDocument.allXfaHtml;\n  const linkService = new SimpleLinkService();\n  const scale = Math.round(PixelsPerInch.PDF_TO_CSS_UNITS * 100) / 100;\n\n  for (const xfaPage of xfaHtml.children) {\n    const page = document.createElement(\"div\");\n    page.className = \"xfaPrintedPage\";\n    printContainer.append(page);\n\n    const builder = new XfaLayerBuilder({\n      pageDiv: page,\n      pdfPage: null,\n      annotationStorage: pdfDocument.annotationStorage,\n      linkService,\n      xfaHtml: xfaPage,\n    });\n    const viewport = getXfaPageViewport(xfaPage, { scale });\n\n    builder.render(viewport, \"print\");\n  }\n}\n\nexport { getXfaHtmlForPrinting };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\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\nimport { RenderingStates, ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { AppOptions } from \"./app_options.js\";\nimport { LinkTarget } from \"./pdf_link_service.js\";\nimport { PDFViewerApplication } from \"./app.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\nconst AppConstants =\n  typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n    ? { LinkTarget, RenderingStates, ScrollMode, SpreadMode }\n    : null;\n\nwindow.PDFViewerApplication = PDFViewerApplication;\nwindow.PDFViewerApplicationConstants = AppConstants;\nwindow.PDFViewerApplicationOptions = AppOptions;\n\nif (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\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    const 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    AppOptions.set(\"defaultUrl\", defaultUrl);\n  })();\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    toolbar: {\n      container: document.getElementById(\"toolbarViewer\"),\n      numPages: document.getElementById(\"numPages\"),\n      pageNumber: document.getElementById(\"pageNumber\"),\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:\n        typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n          ? document.getElementById(\"openFile\")\n          : null,\n      print: document.getElementById(\"print\"),\n      editorFreeTextButton: document.getElementById(\"editorFreeText\"),\n      editorFreeTextParamsToolbar: document.getElementById(\n        \"editorFreeTextParamsToolbar\"\n      ),\n      editorInkButton: document.getElementById(\"editorInk\"),\n      editorInkParamsToolbar: document.getElementById(\"editorInkParamsToolbar\"),\n      download: document.getElementById(\"download\"),\n    },\n    secondaryToolbar: {\n      toolbar: document.getElementById(\"secondaryToolbar\"),\n      toggleButton: document.getElementById(\"secondaryToolbarToggle\"),\n      presentationModeButton: document.getElementById(\"presentationMode\"),\n      openFileButton:\n        typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n          ? document.getElementById(\"secondaryOpenFile\")\n          : null,\n      printButton: document.getElementById(\"secondaryPrint\"),\n      downloadButton: document.getElementById(\"secondaryDownload\"),\n      viewBookmarkButton: document.getElementById(\"viewBookmark\"),\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      scrollPageButton: document.getElementById(\"scrollPage\"),\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    sidebar: {\n      // Divs (and sidebar button)\n      outerContainer: document.getElementById(\"outerContainer\"),\n      sidebarContainer: document.getElementById(\"sidebarContainer\"),\n      toggleButton: document.getElementById(\"sidebarToggle\"),\n      // Buttons\n      thumbnailButton: document.getElementById(\"viewThumbnail\"),\n      outlineButton: document.getElementById(\"viewOutline\"),\n      attachmentsButton: document.getElementById(\"viewAttachments\"),\n      layersButton: document.getElementById(\"viewLayers\"),\n      // Views\n      thumbnailView: document.getElementById(\"thumbnailView\"),\n      outlineView: document.getElementById(\"outlineView\"),\n      attachmentsView: document.getElementById(\"attachmentsView\"),\n      layersView: document.getElementById(\"layersView\"),\n      // View-specific options\n      outlineOptionsContainer: document.getElementById(\n        \"outlineOptionsContainer\"\n      ),\n      currentOutlineItemButton: document.getElementById(\"currentOutlineItem\"),\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      matchDiacriticsCheckbox: document.getElementById(\"findMatchDiacritics\"),\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      dialog: document.getElementById(\"passwordDialog\"),\n      label: document.getElementById(\"passwordText\"),\n      input: document.getElementById(\"password\"),\n      submitButton: document.getElementById(\"passwordSubmit\"),\n      cancelButton: document.getElementById(\"passwordCancel\"),\n    },\n    documentProperties: {\n      dialog: document.getElementById(\"documentPropertiesDialog\"),\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    annotationEditorParams: {\n      editorFreeTextFontSize: document.getElementById(\"editorFreeTextFontSize\"),\n      editorFreeTextColor: document.getElementById(\"editorFreeTextColor\"),\n      editorInkColor: document.getElementById(\"editorInkColor\"),\n      editorInkThickness: document.getElementById(\"editorInkThickness\"),\n      editorInkOpacity: document.getElementById(\"editorInkOpacity\"),\n    },\n    printContainer: document.getElementById(\"printContainer\"),\n    openFileInput:\n      typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n        ? document.getElementById(\"fileInput\")\n        : null,\n    debuggerScriptPath: \"./debugger.js\",\n  };\n}\n\nfunction webViewerLoad() {\n  const config = getViewerConfiguration();\n  if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"PRODUCTION\")) {\n    if (window.chrome) {\n      const link = document.createElement(\"link\");\n      link.rel = \"stylesheet\";\n      link.href = \"../build/dev-css/viewer.css\";\n\n      document.head.append(link);\n    }\n\n    Promise.all([\n      import(\"pdfjs-web/genericcom.js\"),\n      import(\"pdfjs-web/pdf_print_service.js\"),\n    ]).then(function ([genericCom, pdfPrintService]) {\n      PDFViewerApplication.run(config);\n    });\n  } else {\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 <iframe> element.\n        parent.document.dispatchEvent(event);\n      } catch (ex) {\n        // The viewer could be in e.g. a cross-origin <iframe> element,\n        // fallback to dispatching the event at the current `document`.\n        console.error(`webviewerloaded: ${ex}`);\n        document.dispatchEvent(event);\n      }\n    }\n\n    PDFViewerApplication.run(config);\n  }\n}\n\n// Block the \"load\" event until all pages are loaded, to ensure that printing\n// works in Firefox; see https://bugzilla.mozilla.org/show_bug.cgi?id=1618553\ndocument.blockUnblockOnload?.(true);\n\nif (\n  document.readyState === \"interactive\" ||\n  document.readyState === \"complete\"\n) {\n  webViewerLoad();\n} else {\n  document.addEventListener(\"DOMContentLoaded\", webViewerLoad, true);\n}\n\nexport {\n  PDFViewerApplication,\n  AppConstants as PDFViewerApplicationConstants,\n  AppOptions as PDFViewerApplicationOptions,\n};\n"],"names":["DEFAULT_SCALE_VALUE","DEFAULT_SCALE","DEFAULT_SCALE_DELTA","MIN_SCALE","MAX_SCALE","UNKNOWN_SCALE","MAX_AUTO_SCALE","SCROLLBAR_PADDING","VERTICAL_PADDING","RenderingStates","INITIAL","RUNNING","PAUSED","FINISHED","PresentationModeState","UNKNOWN","NORMAL","CHANGING","FULLSCREEN","SidebarView","NONE","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","RendererType","CANVAS","SVG","TextLayerMode","DISABLE","ENABLE","ScrollMode","VERTICAL","HORIZONTAL","WRAPPED","PAGE","SpreadMode","ODD","EVEN","AutoPrintRegExp","OutputScale","constructor","pixelRatio","window","devicePixelRatio","sx","sy","scaled","scrollIntoView","element","spot","scrollMatches","parent","offsetParent","console","error","offsetY","offsetTop","clientTop","offsetX","offsetLeft","clientLeft","clientHeight","scrollHeight","clientWidth","scrollWidth","classList","contains","getComputedStyle","overflow","top","undefined","left","scrollLeft","scrollTop","watchScroll","viewAreaElement","callback","debounceScroll","evt","rAF","requestAnimationFrame","viewAreaElementScrolled","currentX","lastX","state","right","currentY","lastY","down","_eventHandler","addEventListener","parseQueryString","query","params","Map","key","value","URLSearchParams","set","toLowerCase","NullCharactersRegExp","InvisibleCharactersRegExp","removeNullCharacters","str","replaceInvisible","replace","binarySearchFirstItem","items","condition","start","minIndex","maxIndex","length","currentIndex","currentItem","approximateFraction","x","Math","floor","xinv","limit","x_","a","b","c","d","p","q","result","roundToDivide","div","r","round","getPageSizeInches","view","userUnit","rotate","x1","y1","x2","y2","changeOrientation","width","height","backtrackBeforeAllVisibleElements","index","views","elt","pageTop","i","getVisibleElements","scrollEl","sortByVisibility","horizontal","rtl","bottom","isElementBottomAfterViewTop","elementBottom","isElementNextAfterViewHorizontally","elementLeft","elementRight","visible","ids","Set","numViews","firstVisibleElementInd","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","max","hiddenWidth","fractionHeight","fractionWidth","percent","push","id","y","widthPercent","add","first","last","at","sort","pc","abs","noContextMenuHandler","preventDefault","normalizeWheelEventDirection","delta","hypot","deltaX","deltaY","angle","atan2","PI","normalizeWheelEventDelta","MOUSE_DOM_DELTA_PIXEL_MODE","MOUSE_DOM_DELTA_LINE_MODE","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","deltaMode","isValidRotation","Number","isInteger","isValidScrollMode","mode","Object","values","includes","isValidSpreadMode","isPortraitOrientation","size","animationStarted","Promise","resolve","docStyle","document","documentElement","style","clamp","v","min","ProgressBar","bar","getElementById","val","isNaN","remove","setProperty","setWidth","viewer","container","parentNode","scrollbarWidth","offsetWidth","hide","show","getActiveOrFocusedElement","curRoot","curActiveOrFocused","activeElement","querySelector","shadowRoot","apiPageLayoutToViewerModes","layout","scrollMode","spreadMode","apiPageModeToSidebarView","compatibilityParams","create","userAgent","navigator","platform","maxTouchPoints","isAndroid","test","isIOS","checkCanvasSizeLimitation","maxCanvasPixels","OptionKind","VIEWER","API","WORKER","PREFERENCE","defaultOptions","annotationEditorMode","kind","annotationMode","cursorToolOnLoad","defaultZoomValue","disableHistory","disablePageLabels","enablePermissions","enablePrintAutoRotate","enableScripting","externalLinkRel","externalLinkTarget","historyUpdateUrl","ignoreDestinationZoom","imageResourcesPath","forcePageColors","pageColorsBackground","pageColorsForeground","pdfBugEnabled","printResolution","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","textLayerMode","useOnlyCssZoom","viewerCssTheme","viewOnLoad","cMapPacked","cMapUrl","disableAutoFetch","disableFontFace","disableRange","disableStream","docBaseUrl","enableXfa","fontExtraProperties","isEvalSupported","isOffscreenCanvasSupported","maxImageSize","pdfBug","standardFontDataUrl","verbosity","workerPort","workerSrc","defaultUrl","disablePreferences","locale","language","renderer","sandboxBundleSrc","userOptions","AppOptions","Error","get","name","userOption","defaultOption","getAll","options","valueType","setAll","_hasUserOptions","keys","DEFAULT_LINK_REL","LinkTarget","SELF","BLANK","PARENT","TOP","addLinkAttributes","link","url","target","rel","enabled","urlNullRemoved","href","title","onclick","targetStr","PDFLinkService","pagesRefCache","eventBus","externalLinkEnabled","_ignoreDestinationZoom","baseUrl","pdfDocument","pdfViewer","pdfHistory","setDocument","clear","setViewer","setHistory","pagesCount","numPages","page","currentPageNumber","rotation","pagesRotation","isInPresentationMode","goToDestinationHelper","rawDest","namedDest","explicitDest","destRef","pageNumber","_cachedPageNumber","getPageIndex","then","pageIndex","cachePageRef","catch","pushCurrentPosition","scrollPageIntoView","destArray","goToDestination","dest","getDestination","Array","isArray","goToPage","pageLabelToPageNumber","pushPage","newWindow","getDestinationHash","getAnchorUrl","escape","JSON","stringify","anchor","setHash","hash","has","dispatch","source","phraseSearch","zoomArgs","split","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","unescape","parse","toString","ex","isValidExplicitDestination","executeNamedAction","action","back","forward","nextPage","previousPage","executeSetOCGState","optionalContentConfig","optionalContentConfigPromise","operator","elem","setVisibility","group","getGroup","pageNum","pageRef","refStr","gen","num","isPageVisible","isPageCached","destLength","zoom","allowNull","param","SimpleLinkService","DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT","FORCE_PAGES_LOADED_TIMEOUT","WHEEL_ZOOM_DISABLED_TIMEOUT","ViewOnLoad","PREVIOUS","ViewerCssTheme","AUTOMATIC","LIGHT","DARK","KNOWN_VERSIONS","KNOWN_GENERATORS","DefaultExternalServices","updateFindControlState","data","updateFindMatchesCount","initPassiveLoading","callbacks","reportTelemetry","createDownloadManager","createPreferences","createL10n","createScripting","supportsIntegratedFind","shadow","supportsDocumentFonts","supportedMouseWheelZoomModifierKeys","ctrlKey","metaKey","isInAutomation","updateEditorStates","PDFViewerApplication","initialBookmark","location","substring","_initializedCapability","createPromiseCapability","appConfig","pdfLoadingTask","printService","pdfThumbnailViewer","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfSidebar","pdfSidebarResizer","pdfOutlineViewer","pdfAttachmentViewer","pdfLayerViewer","pdfCursorTools","pdfScriptingManager","store","downloadManager","overlayManager","preferences","toolbar","secondaryToolbar","l10n","annotationEditorParams","isInitialViewSet","downloadComplete","isViewerEmbedded","_downloadUrl","externalServices","_boundEvents","documentInfo","metadata","_contentDispositionFilename","_contentLength","_saveInProgress","_docStats","_wheelUnusedTicks","_PDFBug","_hasAnnotationEditors","_title","_printAnnotationStoragePromise","initialize","_readPreferences","_parseHashParameters","_forceCssTheme","_initializeL10n","_initializeViewerComponents","bindEvents","bindWindowEvents","appContainer","translate","warn","reason","message","mainContainer","viewerContainer","loadFakeWorker","loadPDFBug","loadCSS","init","OPS","dir","getDirection","getElementsByTagName","cssTheme","styleSheet","styleSheets","cssRules","ii","rule","CSSMediaRule","media","deleteRule","darkRules","exec","cssText","insertRule","AutomationEventBus","EventBus","OverlayManager","PDFRenderingQueue","onIdle","_cleanup","bind","findController","PDFFindController","linkService","PDFScriptingManager","scriptingFactory","docPropertiesLookup","_scriptingDocProperties","pageColors","matchMedia","matches","background","foreground","PDFViewer","renderingQueue","scriptingManager","PDFThumbnailViewer","sidebar","thumbnailView","setThumbnailViewer","PDFHistory","findBar","PDFFindBar","AnnotationEditorType","AnnotationEditorParams","hidden","PDFDocumentProperties","documentProperties","_docFilename","PDFCursorTools","Toolbar","SecondaryToolbar","supportsFullscreen","PDFPresentationMode","passwordPrompt","PasswordPrompt","passwordOverlay","PDFOutlineViewer","outlineView","PDFAttachmentViewer","attachmentsView","PDFLayerViewer","layersView","PDFSidebar","elements","onToggled","forceRendering","PDFSidebarResizer","sidebarResizer","run","config","webViewerInitialized","initialized","settled","initializedPromise","promise","zoomIn","steps","increaseScale","zoomOut","decreaseScale","zoomReset","currentScaleValue","supportsPrinting","PDFPrintServiceFactory","instance","fullscreenEnabled","loadingBar","setTitleUsingUrl","downloadUrl","getPdfFilenameFromUrl","decodeURIComponent","getFilenameFromUrl","setTitle","editorIndicator","printing","_hideViewBookmark","viewBookmarkButton","close","_unblockDocumentLoadEvent","annotationStorage","_annotationStorageModified","save","promises","destroy","destroyPromise","reset","cleanup","all","open","file","args","workerParameters","GlobalWorkerOptions","parameters","originalUrl","apiParameters","loadingTask","getDocument","onPassword","updateCallback","setUpdateCallback","onProgress","loaded","total","progress","onUnsupportedFeature","fallback","load","InvalidPDFException","MissingPDFException","UnexpectedResponseException","msg","_documentError","_ensureDownloadComplete","download","filename","getData","blob","Blob","type","dispatchWillSave","saveDocument","dispatchDidSave","downloadOrSave","featureId","moreInfo","_otherError","moreInfoText","version","build","stack","lineNumber","join","level","loadingParams","disableAutoFetchLoadingBarTimeout","clearTimeout","setTimeout","getDownloadInfo","firstPagePromise","pageLayoutPromise","getPageLayout","pageModePromise","getPageMode","openActionPromise","getOpenAction","setPagesCount","baseDocumentUrl","onePageRendered","pagesPromise","storedPromise","ViewHistory","fingerprints","getMultiple","sidebarView","pdfPage","_initializeAnnotationStorageCallbacks","timeStamp","stored","pageLayout","pageMode","openAction","_initializePdfHistory","fingerprint","initialDest","parseInt","modes","setInitialView","focus","race","hasEqualPageSizes","update","_initializeAutoPrint","timestamp","getOutline","outline","render","getAttachments","attachments","_initializePageLabels","_initializeMetadata","_on","once","baseURL","filesize","getRaw","authors","URL","javaScript","getJavaScript","triggerAutoPrint","some","js","UNSUPPORTED_FEATURES","triggerPrinting","info","contentDispositionFilename","contentLength","getMetadata","log","PDFFormatVersion","Producer","trim","Creator","pdfTitle","Title","metadataTitle","IsXFAPresent","IsAcroFormPresent","isPureXfa","forms","renderForms","IsSignaturesPresent","signatures","versionId","generatorId","producer","generator","formType","labels","getPageLabels","numLabels","standardLabels","emptyLabels","label","setPageLabels","setPageNumber","currentPageLabel","resetHistory","updateUrl","initialRotation","onSetModified","beforeUnload","onResetModified","removeEventListener","onAnnotationEditor","typeStr","storedHash","setRotation","setViewerModes","scroll","spread","isThumbnailViewEnabled","visibleView","renderHighestPriority","beforePrint","dispatchWillPrint","print","pageViewsReady","alert","pagesOverview","getPagesOverview","printContainer","createPrintService","afterPrint","dispatchDidPrint","resetModified","rotatePages","requestPresentationMode","request","webViewerResize","webViewerHashchange","webViewerPageRendered","webViewerUpdateViewarea","webViewerPageChanging","webViewerScaleChanging","webViewerRotationChanging","webViewerSidebarViewChanged","webViewerPageMode","webViewerNamedAction","webViewerPresentationModeChanged","webViewerPresentationMode","webViewerSwitchAnnotationEditorMode","webViewerSwitchAnnotationEditorParams","webViewerPrint","webViewerDownload","webViewerFirstPage","webViewerLastPage","webViewerNextPage","webViewerPreviousPage","webViewerZoomIn","webViewerZoomOut","webViewerZoomReset","webViewerPageNumberChanged","webViewerScaleChanged","webViewerRotateCw","webViewerRotateCcw","webViewerOptionalContentConfig","webViewerSwitchScrollMode","webViewerScrollModeChanged","webViewerSwitchSpreadMode","webViewerSpreadModeChanged","webViewerDocumentProperties","webViewerFindFromUrlHash","webViewerUpdateFindMatchesCount","webViewerUpdateFindControlState","reportPageStatsPDFBug","webViewerFileInputChange","webViewerOpenFile","addWindowResolutionChange","webViewerResolutionChange","mediaQueryList","removeWindowResolutionChange","windowResize","windowHashChange","windowBeforePrint","windowAfterPrint","windowUpdateFromSandbox","event","detail","webViewerVisibilityChange","webViewerWheel","passive","webViewerTouchStart","webViewerClick","webViewerKeyDown","unbindEvents","_off","unbindWindowEvents","accumulateWheelTicks","ticks","wholeTicks","sign","blockUnblockOnload","_reportDocumentStatsTelemetry","stats","scriptingReady","ready","HOSTED_VIEWER_ORIGINS","validateFileURL","viewerOrigin","origin","fileOrigin","loadScript","PDFWorker","self","debuggerScriptPath","PDFBug","import","globalThis","Stats","pageView","getPageView","queryString","search","fileInput","openFileInput","files","dataTransfer","dropEffect","effectAllowed","printButton","presentationModeButton","viewFind","updateLoadingIndicatorState","getThumbnail","setImage","switchView","select","toggle","presentationModeState","setMultiple","scale","pdfOpenParams","currentPage","loading","renderingState","updateContainerHeightCss","popStateInProgress","createObjectURL","click","caseSensitive","entireWord","highlightAll","findPrevious","matchDiacritics","matchesCount","updateResultsCount","previous","rawQuery","updateUIState","setPageScale","presetValue","pageLabel","scrollThumbnailIntoView","refresh","visibilityState","setZoomDisabledTimeout","zoomDisabledTimeout","previousScale","currentScale","WheelEvent","DOM_DELTA_LINE","DOM_DELTA_PAGE","PIXELS_PER_LINE_SCALE","scaleCorrectionFactor","rect","getBoundingClientRect","dx","clientX","dy","clientY","touches","isOpen","containsElement","toggleButton","active","isViewerInPresentationMode","handled","ensureViewerFocused","cmd","altKey","shiftKey","keyCode","eventState","assign","curElement","curElementTagName","tagName","toUpperCase","isContentEditable","turnPage","turnOnlyIfPageFit","isVerticalScrollbarEnabled","isHorizontalScrollbarEnabled","opened","switchTool","CursorTool","SELECT","HAND","returnValue","webViewerAnnotationEditorStatesChanged","pdfjsLib","__non_webpack_require__","module","exports","WaitOnType","EVENT","TIMEOUT","waitOnEventOrTimeout","delay","reject","handler","eventHandler","timeout","timeoutHandler","listeners","on","eventName","listener","external","off","eventListeners","externalListeners","slice","splice","ZOOM","previouslyActive","handTool","GrabToPan","addEventListeners","activeTool","tool","disableActiveTool","deactivate","activate","dispatchEvent","disableActive","enableActive","CSS_CLASS_GRAB","ownerDocument","ignoreTarget","onActiveChanged","_onMouseDown","onMouseDown","_onMouseMove","onMouseMove","_endPan","endPan","overlay","createElement","className","node","button","originalTarget","e","scrollLeftStart","scrollTopStart","clientXStart","clientYStart","stopPropagation","focusedElement","blur","buttons","xDiff","yDiff","scrollTo","behavior","body","append","bindListeners","editorFreeTextFontSize","editorFreeTextColor","editorInkColor","editorInkThickness","editorInkOpacity","AnnotationEditorParamsType","FREETEXT_SIZE","valueAsNumber","FREETEXT_COLOR","INK_COLOR","INK_THICKNESS","INK_OPACITY","details","overlays","WeakMap","register","dialog","canForceClose","unregister","delete","showModal","activeCapability","input","submitButton","cancelButton","_isViewerEmbedded","verify","cancel","passwordIncorrect","PasswordResponses","INCORRECT_PASSWORD","textContent","password","invokeCallback","BaseTreeViewer","appendAttachment","keepRenderedCapability","_attachments","_renderedCapability","_pendingDispatchEvent","_dispatchEvent","attachmentsCount","_bindLink","content","openOrDownloadData","names","localeCompare","fragment","createDocumentFragment","item","_normalizeTextContent","_finishRendering","renderedPromise","TREEITEM_OFFSET_TOP","TREEITEM_SELECTED_CLASS","_pdfDocument","_lastToggleIsShow","_currentTreeItem","count","_addToggleButton","toggler","shouldShowAll","_toggleTreeItem","prepend","root","querySelectorAll","_toggleAllTreeItems","hasAnyNesting","_updateCurrentTreeItem","treeItem","_scrollToCurrentTreeItem","currentNode","firstElementChild","DEFAULT_FIELD_CONTENT","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","getPageName","isPortrait","pageNames","fieldData","fields","closeButton","fileNameLookup","_fileNameLookup","_currentPageNumber","_pagesRotation","_isNonMetricLocale","getLanguage","_dataAvailableCapability","updateUI","fileName","fileSize","creationDate","modificationDate","pageSize","isLinearized","parseFileSize","parseDate","CreationDate","ModDate","getPage","parsePageSize","parseLinearization","IsLinearized","freeze","author","Author","subject","Subject","keywords","Keywords","creator","pageCount","linearized","kb","mb","size_mb","toPrecision","toLocaleString","size_kb","size_b","pageSizeInches","sizeInches","sizeMillimeters","rawName","exactMillimeters","intMillimeters","unit","orientation","inputDate","dateObject","PDFDateString","toDateObject","date","toLocaleDateString","time","toLocaleTimeString","MATCHES_COUNT_LIMIT","findField","highlightAllCheckbox","caseSensitiveCheckbox","matchDiacriticsCheckbox","entireWordCheckbox","findMsg","findResultsCount","findPreviousButton","findNextButton","adjustWidth","findPrev","checked","status","FindState","FOUND","PENDING","NOT_FOUND","setAttribute","current","matchCountMsg","findbarHeight","inputContainerHeight","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","DIACRITICS_EXCEPTION","DIACRITICS_EXCEPTION_STR","DIACRITICS_REG_EXP","SPECIAL_CHARS_REG_EXP","NOT_DIACRITIC_FROM_END_REG_EXP","NOT_DIACRITIC_FROM_START_REG_EXP","SYLLABLES_REG_EXP","SYLLABLES_LENGTHS","FIRST_CHAR_SYLLABLES_REG_EXP","NFKC_CHARS_TO_NORMALIZE","noSyllablesRegExp","withSyllablesRegExp","normalize","text","syllablePositions","m","char","len","normalizationRegex","toNormalizeWithNFKC","regexp","RegExp","rawDiacriticsPositions","normalized","positions","rawDiacriticsIndex","syllableIndex","shift","shiftOrigin","eol","hasDiacritics","match","p1","p2","p3","p4","p5","p6","p7","replacement","jj","j","hasTrailingDashEOL","endsWith","charAt","newCharLen","getOriginalIndex","diffs","pos","end","_linkService","_eventBus","onFind","onFindBarClose","highlightMatches","_highlightMatches","pageMatches","_pageMatches","pageMatchesLength","_pageMatchesLength","selected","_selected","_state","_firstPageCapability","shouldDirtyMatch","_dirtyMatch","extractText","findbarClosed","pendingTimeout","_findTimeout","nextMatch","updateAllPages","scrollMatchIntoView","selectedLeft","matchIndex","_scrollMatches","matchIdx","pageIdx","_offset","wrapped","_extractTextPromises","_pageContents","_pageDiffs","_hasDiacritics","_matchesCountTotal","_pagesToSearch","_pendingFindMatches","_resumePageIdx","_rawQuery","_normalizedQuery","isEntireWord","startIdx","charCodeAt","getCharacterType","calculateRegExpMatch","pageContent","matchesLength","matchPos","matchLen","convertToRegExpString","isUnicode","trailingSpaces","String","fromCharCode","calculateMatch","reverse","map","isUnicodePart","queryPart","flags","updatePage","nextPageMatch","pageMatchesCount","updateUIResultsCount","extractTextCapability","getTextContent","strBuf","textItem","hasEOL","currentPageIndex","offset","numPageMatches","updateMatch","advanceOffsetPage","matchesReady","numMatches","found","requestMatchesCount","CharacterType","SPACE","ALPHA_LETTER","PUNCT","HAN_LETTER","KATAKANA_LETTER","HIRAGANA_LETTER","HALFWIDTH_KATAKANA_LETTER","THAI_LETTER","isAlphabeticalScript","charCode","isAscii","isAsciiAlpha","isAsciiDigit","isAsciiSpace","isHan","isKatakana","isHiragana","isHalfwidthKatakana","isThai","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","getCurrentHash","_initialized","_fingerprint","_isPagesLoaded","reInitialized","_updateUrl","_bindEvents","history","_popStateInProgress","_blockHashChange","_currentHash","_numPositionUpdates","_uid","_maxUid","_destination","_position","_isValidState","_parseCurrentHash","_pushOrReplaceState","destination","_updateInternalState","uid","_initialRotation","_initialBookmark","_pageHide","_unbindEvents","_updateViewareaTimeout","_isValidPage","forceReplace","isDestHashesEqual","isDestArraysEqual","_tryPushCurrentPosition","shouldReplace","newState","newUrl","startsWith","replaceState","pushState","temporary","position","checkReload","perfEntry","performance","getEntriesByType","removeTemporary","checkNameddest","nameddest","_updateViewarea","_popState","newHash","hashChanged","updateViewarea","popState","pageHide","destHash","pushHash","firstDest","secondDest","isEntryEqual","second","updateLayers","_optionalContentConfig","_optionalContentHash","layersCount","groupId","getHash","_setNestedName","fontStyle","groups","getOrder","queue","levelData","itemsDiv","order","getOptionalContentConfig","_currentOutlineItem","_currentOutlineItemCapability","_sidebarView","_outline","_pageNumberToDestHashCapability","outlineCount","currentOutlineItemPromise","attachment","setOCGState","_setStyles","bold","italic","fontWeight","totalCount","nestedCount","nestedItems","pageNumberToDestHash","_getPageNumberToDestHash","linkElement","pageNumberNesting","nesting","currentNesting","DELAY_BEFORE_HIDING_CONTROLS","ACTIVE_SELECTOR","CONTROLS_SELECTOR","MOUSE_SCROLL_COOLDOWN_TIME","PAGE_SWITCH_THRESHOLD","SWIPE_MIN_DISTANCE_THRESHOLD","SWIPE_ANGLE_THRESHOLD","contextMenuOpen","mouseScrollTimeStamp","mouseScrollDelta","touchSwipeState","requestFullscreen","addFullscreenChangeListeners","notifyStateChange","scaleValue","removeFullscreenChangeListeners","mouseWheel","currentTime","Date","now","storedTime","resetMouseScrollState","totalDelta","success","enter","addWindowListeners","showControls","getSelection","removeAllRanges","exit","removeWindowListeners","hideControls","mouseDown","hasAttribute","contextMenu","controlsTimeout","touchSwipe","startX","pageX","startY","pageY","endX","endY","absAngle","showControlsBind","mouseDownBind","mouseWheelBind","resetMouseScrollStateBind","contextMenuBind","touchSwipeBind","fullscreenChange","fullscreenElement","fullscreenChangeBind","CLEANUP_TIMEOUT","highestPriorityPage","idleTimeout","isHighestPriority","renderingId","hasViewer","currentlyVisiblePages","getHighestPriority","scrolledDown","preRenderExtra","visibleViews","numVisible","isViewFinished","firstId","lastId","visibleIds","holeId","holeView","preRenderIndex","preRenderView","renderView","resume","draw","finally","RenderingCancelledException","_pdfViewer","_closeCapability","_destroyCapability","_scripting","_mouseState","_ready","_sandboxBundleSrc","_scriptingFactory","_docPropertiesLookup","_destroyScripting","objects","calculationOrder","docActions","getFieldObjects","getCalculationOrderIds","getJSActions","_createScripting","_internalEvents","_updateFromSandbox","dispatchEventInSandbox","_dispatchPageClose","_dispatchPageOpen","_pageOpenPending","_domEvents","isDown","docProperties","_getDocProperties","createSandbox","appInfo","docInfo","actions","mouseState","_visitedPages","isChangingPresentationMode","siblings","command","elementId","CustomEvent","setValue","visitedPages","actionsPromise","destroySandbox","UI_NOTIFICATION_CLASS","isInitialEventDispatched","outerContainer","sidebarContainer","thumbnailButton","outlineButton","attachmentsButton","layersButton","_outlineOptionsContainer","outlineOptionsContainer","_currentOutlineItemButton","currentOutlineItemButton","hideUINotification","disabled","forceOpen","isViewChanged","shouldForceRendering","isThumbs","isOutline","isAttachments","isLayers","updateThumbnailViewer","showUINotification","onTreeLoaded","SIDEBAR_WIDTH_VAR","SIDEBAR_MIN_WIDTH","SIDEBAR_RESIZING_CLASS","isRTL","sidebarOpen","_width","_outerContainerWidth","resizer","_addEventListeners","outerContainerWidth","_updateWidth","maxWidth","_mouseMove","_mouseUp","mouseMove","mouseUp","updated","THUMBNAIL_SCROLL_MARGIN","THUMBNAIL_SELECTED_CLASS","CSS","supports","_scrollUpdated","_resetView","_thumbnails","_getVisibleThumbs","prevThumbnailView","shouldScroll","updateArgs","thumbnail","TempImageFactory","destroyCanvas","_pageLabels","_cancelRendering","firstPdfPage","viewport","getViewport","PDFThumbnailView","defaultViewport","clone","setPdfPage","cancelRendering","setPageLabel","ensurePdfPageLoaded","thumbView","getScrollAhead","visibleThumbs","scrollAhead","DRAW_UPSCALE_FACTOR","MAX_NUM_SCALING_STEPS","THUMBNAIL_CANVAS_BORDER_WIDTH","THUMBNAIL_WIDTH","tempCanvas","getCanvas","ctx","getContext","alpha","fillStyle","fillRect","restore","pdfPageRotate","_optionalContentConfigPromise","renderTask","pageWidth","pageHeight","pageRatio","canvasWidth","canvasHeight","_thumbPageTitle","ring","borderAdjustment","totalRotation","removeAttribute","canvas","image","_getPageDrawContext","upscaleFactor","outputScale","transform","_convertCanvasToImage","reducedCanvas","_reduceImage","_thumbPageCanvas","src","toDataURL","finishRenderTask","drawViewport","renderContinueCallback","cont","renderContext","canvasContext","onContinue","resultPromise","pageCached","thumbnailCanvas","img","drawImage","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","DEFAULT_CACHE_SIZE","ENABLE_PERMISSIONS_CLASS","PagesCountLimit","FORCE_SCROLL_MODE_PAGE","FORCE_LAZY_PAGE_INIT","PAUSE_EAGER_PAGE_INIT","isValidAnnotationEditorMode","PDFPageViewBuffer","buf","destroyFirstView","resize","newSize","idsToKeep","Symbol","iterator","firstView","next","buffer","annotationEditorUIManager","AnnotationMode","ENABLE_FORMS","previousContainerHeight","scrollModePageState","onVisibilityChange","viewerVersion","_scriptingManager","removePageBorders","NullL10n","defaultRenderingQueue","_scrollUpdate","_onBeforeDraw","_onAfterDraw","_pages","_pagesCapability","every","_setCurrentPageNumber","resetCurrentPageView","indexOf","_currentScale","_setScale","_currentScaleValue","_onePageRenderedCapability","initializePermissions","permissions","PermissionFlag","COPY","MODIFY_CONTENTS","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","onePageRenderedOrForceFetch","_getVisiblePages","visibilityChangePromise","permissionsPromise","getPermissions","_scrollMode","cssTransform","AnnotationEditorUIManager","updateMode","viewerElement","PixelsPerInch","PDF_TO_CSS_UNITS","textLayerFactory","annotationLayerFactory","xfaLayerFactory","annotationEditorLayerFactory","PDFPageView","textHighlighterFactory","structTreeLayerFactory","firstPageView","ref","ensurePageViewVisible","_spreadMode","_updateSpreadMode","getPagesLeft","Language","lang","_location","_previousScrollMode","previousPageNumber","scrollDown","pages","_updateScrollMode","pageIndexSet","parity","dummyPage","pageSpot","isSameScale","newScale","_setScaleUpdatePages","newValue","noScroll","preset","_pageWidthScaleFactor","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","widthScale","heightScale","boundingRect","convertToViewportPoint","_updateLocation","firstPage","normalizedScaleValue","currentPageView","topLeft","getPagePoint","intLeft","intTop","visiblePages","numVisiblePages","newCacheSize","isSimpleLayout","currentId","stillFullyVisible","_isContainerRtl","direction","toggleLoadingIconSpinner","createTextLayerBuilder","textLayerDiv","highlighter","accessibilityManager","TextLayerBuilder","createTextHighlighter","TextHighlighter","createAnnotationLayerBuilder","pageDiv","hasJSActionsPromise","hasJSActions","fieldObjectsPromise","annotationCanvasMap","AnnotationLayerBuilder","createAnnotationEditorLayerBuilder","uiManager","AnnotationEditorLayerBuilder","createXfaLayerBuilder","XfaLayerBuilder","createStructTreeLayerBuilder","StructTreeLayerBuilder","cloneNode","_getPageAdvance","yArray","expectedId","advance","toFixed","ceil","updateParams","annotationEditorLayer","_cancelled","intent","clonedViewport","dontFlip","tabIndex","AnnotationEditorLayer","_pageIndex","annotations","DEFAULT_L10N_STRINGS","of_pages","page_of_pages","document_properties_kb","document_properties_mb","document_properties_date_string","document_properties_page_size_unit_inches","document_properties_page_size_unit_millimeters","document_properties_page_size_orientation_portrait","document_properties_page_size_orientation_landscape","document_properties_page_size_name_a3","document_properties_page_size_name_a4","document_properties_page_size_name_letter","document_properties_page_size_name_legal","document_properties_page_size_dimension_string","document_properties_page_size_dimension_name_string","document_properties_linearized_yes","document_properties_linearized_no","additional_layers","page_landmark","thumb_page_title","thumb_page_canvas","find_reached_top","find_reached_bottom","find_not_found","page_scale_width","page_scale_fit","page_scale_auto","page_scale_actual","page_scale_percent","loading_error","invalid_file_error","missing_file_error","unexpected_response_error","rendering_error","printing_not_supported","printing_not_ready","web_fonts_disabled","free_text2_default_content","editor_free_text2_aria_label","editor_ink2_aria_label","editor_ink_canvas_aria_label","print_progress_percent","getL10nFallback","PARTIAL_LANG_CODES","en","es","fy","ga","gu","hi","hy","nb","ne","nn","pa","pt","sv","zh","fixupLangCode","langCode","formatL10nValue","onPresentationModeChanged","_hasJSActionsPromise","_fieldObjectsPromise","_annotationCanvasMap","_accessibilityManager","fieldObjects","getAnnotations","AnnotationLayer","updatePresentationModeState","disableFormElements","section","childNodes","inert","MAX_CANVAS_PIXELS","useThumbnailCanvas","initialOptionalContent","regularAnnotations","hasRestrictedScaling","textHighlighter","paintTask","paintedViewportMap","_renderError","_isStandalone","annotationLayer","textLayer","zoomLayer","xfaLayer","structTreeLayer","hasInitialVisibility","_renderAnnotationLayer","_renderAnnotationEditorLayer","_renderXfaLayer","textDivs","_buildXfaTextContentItems","setTextMapping","enable","_resetZoomLayer","removeFromDOM","zoomLayerCanvas","firstChild","keepZoomLayer","keepAnnotationLayer","keepAnnotationEditorLayer","keepXfaLayer","zoomLayerNode","annotationLayerNode","annotationEditorLayerNode","xfaLayerNode","svg","loadingIconDiv","redrawAnnotationLayer","redrawAnnotationEditorLayer","redrawXfaLayer","isScalingRestricted","disable","_onTextLayerRendered","relativeRotation","absRotation","scaleX","scaleY","textLayerViewport","textRelativeRotation","textAbsRotation","transX","transY","transformOrigin","convertToPdfPoint","viewVisible","canvasWrapper","lastDivBeforeTextDiv","before","TextAccessibilityManager","finishPaintTask","separateAnnots","paintOnSvg","paintOnCanvas","onRenderContinue","readableStream","streamTextContent","includeMarkedContent","setTextContentStream","getStructTree","tree","treeDom","renderCapability","isCanvasHidden","showCanvas","actualSizeViewport","pixelsInViewport","maxScale","sqrt","sfx","sfy","wrapper","cancelled","ensureNotCancelled","getOperatorList","opList","svgGfx","SVGGraphics","commonObjs","objs","getSVG","textChildren","textNodes","waitingElements","compareElementPositions","e1","e2","rect1","rect2","top1","bot1","mid1","top2","bot2","mid2","centerX1","centerX2","nodeIndex","addIdToAriaOwns","isRemovable","addPointerInTextLayer","removePointerInTextLayer","children","owns","getAttribute","filter","moveElementInDOM","contentElement","hasChildNodes","from","elementToCompare","after","PDF_ROLE_TO_HTML_ROLE","Document","DocumentFragment","Part","Sect","Div","Aside","NonStruct","P","H","FENote","Sub","Lbl","Span","Em","Strong","Link","Annot","Form","Ruby","RB","RT","RP","Warichu","WT","WP","L","LI","LBody","Table","TR","TH","TD","THead","TBody","TFoot","Caption","Figure","Formula","Artifact","HEADING_PATTERN","structTree","_walk","_setAttributes","structElement","htmlElement","alt","role","kid","_onUpdateTextLayerMatches","textContentItemsStr","divs","texts","_updateMatches","_convertMatches","iIndex","mm","begin","divIdx","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","infinity","beginText","appendTextToDiv","fromOffset","toOffset","nodeType","Node","TEXT_NODE","span","createTextNode","i0","i1","isSelected","highlightSuffix","n0","n1","clearedUntilDivIdx","n","textContentStream","renderingDone","textLayerRenderTask","bindMouse","finishRendering","endOfContent","numTextDivs","textLayerFrag","renderTextLayer","setTextContent","adjustTop","getPropertyValue","divBounds","xfaHtml","XfaLayer","getXfa","downloadButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","eventDetails","cursorHandToolButton","scrollPageButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","documentPropertiesButton","openFileButton","lastPage","pageRotateCw","pageRotateCcw","bindClickListeners","bindCursorToolsListener","bindScrollModeListener","bindSpreadModeListener","property","isSelect","isHand","scrollModeChanged","isPage","isVertical","isHorizontal","isWrapped","forceScrollModePage","spreadModeChanged","isNone","isOdd","isEven","PAGE_NUMBER_LOADING_INDICATOR","wasLocalized","editorFreeTextButton","FREETEXT","editorInkButton","INK","openFile","scaleSelect","customScaleOption","hasPageLabels","pageScaleValue","pageScale","oncontextmenu","adjustScaleWidth","bindEditorToolsListener","editorFreeTextParamsToolbar","editorInkParamsToolbar","editorModeChanged","disableButtons","editorButtons","resetNumPages","predefinedValueFound","option","predefinedValuesPromise","scaleSelectWidth","font","fontSize","fontFamily","predefinedValue","measureText","DEFAULT_VIEW_HISTORY_CACHE_SIZE","cacheSize","_initializedPromise","_readFromStorage","databaseStr","database","branch","_writeToStorage","localStorage","setItem","getItem","properties","defaultValue","GenericCom","GenericPreferences","BasePreferences","prefObj","GenericExternalServices","DownloadManager","GenericL10n","GenericScripting","defaults","prefs","prefValue","defaultType","obj","blobUrl","openBlobUrls","createValidAbsoluteUrl","downloadData","contentType","isPdfData","isPdfFile","viewerUrl","encodeURIComponent","revokeObjectURL","webL10n","_lang","setLanguage","gL10nData","gTextData","gTextProp","gLanguage","gMacros","gReadyState","gAsyncResourceLoading","getL10nResourceLinks","getL10nDictionary","script","innerHTML","getTranslatableChildren","getL10nAttributes","l10nId","l10nArgs","xhrLoadText","onSuccess","onFailure","_onSuccess","_onFailure","xhr","XMLHttpRequest","overrideMimeType","onreadystatechange","readyState","responseText","onerror","ontimeout","send","parseResource","successCallback","failureCallback","evalString","lastIndexOf","parseProperties","parsedPropertiesCallback","dictionary","reBlank","reComment","reSection","reImport","reSplit","parseRawLines","rawText","extendedSyntax","parsedRawLinesCallback","entries","currentLang","genericLang","skipLang","nextEntry","line","loadImport","tmp","response","prop","loadLocale","_callback","langLinks","langCount","dict","locales","default_locale","defaultLocale","anyCaseLang","onResourceLoaded","gResourceCount","L10nResourceLink","resource","getPluralRules","locales2rules","isIn","list","isBetween","pluralRules","plural","_pluralRules","getL10nData","rv","substIndexes","substArguments","reIndex","reMatch","macroName","paramName","macro","reArgs","matched_text","arg","translateElement","getChildElementCount","l","nodeValue","textNode","k","childElementCount","translateFragment","elementCount","fallbackString","getText","rtlList","shortCode","getReadyState","pdfjsSandbox","QuickJSSandbox","sandbox","nukeSandbox","activeService","renderPage","activeServiceOnEntry","printAnnotationStoragePromise","scratchCanvas","PRINT_UNITS","PDF","printAnnotationStorage","ENABLE_STORAGE","PDFPrintService","_printResolution","prototype","throwIfInactive","pageStyleSheet","ensureOverlay","renderPages","getXfaHtmlForPrinting","renderNextPage","renderProgress","useRenderedPage","toBlob","onload","performPrint","call","abort","eventType","createEvent","initCustomEvent","progressBar","progressPerc","chrome","opera","stopImmediatePropagation","stopPropagationIfNeeded","overlayPromise","allXfaHtml","xfaPage","builder","getXfaPageViewport","pdfjsVersion","pdfjsBuild","AppConstants","PDFViewerApplicationConstants","PDFViewerApplicationOptions","require","getViewerConfiguration","webViewerLoad"],"sourceRoot":""}