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,CAAC4hH,UAAU,KAAK,UAAU,EAClC;EACAD,aAAa,CAAC,CAAC;AACjB,CAAC,MAAM;EACL3hH,QAAQ,CAAC3I,gBAAgB,CAAC,kBAAkB,EAAEsqH,aAAa,EAAE,IAAI,CAAC;AACpE","sources":["webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/webpack/runtime/define property getters","webpack://pdf.js/webpack/runtime/hasOwnProperty shorthand","webpack://pdf.js/./web/ui_utils.js","webpack://pdf.js/./web/app_options.js","webpack://pdf.js/./web/pdfjs.js","webpack://pdf.js/./web/pdf_link_service.js","webpack://pdf.js/./web/event_utils.js","webpack://pdf.js/./web/external_services.js","webpack://pdf.js/./web/preferences.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/types.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resolver.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/scope.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/builtins.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/memoizer.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/bundle.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resource.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/index.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/overlay.js","webpack://pdf.js/./node_modules/cached-iterable/src/cached_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_sync_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_async_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/index.mjs","webpack://pdf.js/./node_modules/@fluent/dom/esm/localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/dom_localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/index.js","webpack://pdf.js/./web/l10n.js","webpack://pdf.js/./web/genericl10n.js","webpack://pdf.js/./web/generic_scripting.js","webpack://pdf.js/./web/generic_signature_storage.js","webpack://pdf.js/./web/genericcom.js","webpack://pdf.js/./web/new_alt_text_manager.js","webpack://pdf.js/./web/alt_text_manager.js","webpack://pdf.js/./web/annotation_editor_params.js","webpack://pdf.js/./web/caret_browsing.js","webpack://pdf.js/./web/sidebar.js","webpack://pdf.js/./web/comment_manager.js","webpack://pdf.js/./web/base_download_manager.js","webpack://pdf.js/./web/download_manager.js","webpack://pdf.js/./web/editor_undo_bar.js","webpack://pdf.js/./web/overlay_manager.js","webpack://pdf.js/./web/password_prompt.js","webpack://pdf.js/./web/base_tree_viewer.js","webpack://pdf.js/./web/pdf_attachment_viewer.js","webpack://pdf.js/./web/grab_to_pan.js","webpack://pdf.js/./web/pdf_cursor_tools.js","webpack://pdf.js/./web/pdf_document_properties.js","webpack://pdf.js/./web/pdf_find_utils.js","webpack://pdf.js/./web/pdf_find_controller.js","webpack://pdf.js/./web/pdf_find_bar.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/xfa_layer_builder.js","webpack://pdf.js/./web/print_utils.js","webpack://pdf.js/./web/pdf_print_service.js","webpack://pdf.js/./web/renderable_view.js","webpack://pdf.js/./web/pdf_rendering_queue.js","webpack://pdf.js/./web/pdf_scripting_manager.js","webpack://pdf.js/./web/menu.js","webpack://pdf.js/./web/pdf_thumbnail_view.js","webpack://pdf.js/./web/pdf_thumbnail_viewer.js","webpack://pdf.js/./web/annotation_editor_layer_builder.js","webpack://pdf.js/./web/annotation_layer_builder.js","webpack://pdf.js/./web/autolinker.js","webpack://pdf.js/./web/base_pdf_page_view.js","webpack://pdf.js/./web/draw_layer_builder.js","webpack://pdf.js/./web/pdf_page_detail_view.js","webpack://pdf.js/./web/struct_tree_layer_builder.js","webpack://pdf.js/./web/text_accessibility.js","webpack://pdf.js/./web/text_highlighter.js","webpack://pdf.js/./web/text_layer_builder.js","webpack://pdf.js/./web/pdf_page_view.js","webpack://pdf.js/./web/pdf_viewer.js","webpack://pdf.js/./web/secondary_toolbar.js","webpack://pdf.js/./web/signature_manager.js","webpack://pdf.js/./web/toolbar.js","webpack://pdf.js/./web/view_history.js","webpack://pdf.js/./web/views_manager.js","webpack://pdf.js/./web/app.js","webpack://pdf.js/./web/viewer.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","/* 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 = 25.0;\nconst UNKNOWN_SCALE = 0;\nconst MAX_AUTO_SCALE = 1.25;\nconst SCROLLBAR_PADDING = 40;\nconst VERTICAL_PADDING = 5;\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 TextLayerMode = {\n  DISABLE: 0,\n  ENABLE: 1,\n  ENABLE_PERMISSIONS: 2,\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\nconst CursorTool = {\n  SELECT: 0, // The default value.\n  HAND: 1,\n  ZOOM: 2,\n};\n\n// Used by `PDFViewerApplication`, and by the API unit-tests.\nconst AutoPrintRegExp = /\\bprint\\s*\\(/;\n\n/**\n * Scrolls specified element into view of its parent.\n * @param {HTMLElement} 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 {number} [spot.left]\n * @param {number} [spot.top]\n */\nfunction scrollIntoView(element, spot) {\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  ) {\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, abortSignal = undefined) {\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, {\n    useCapture: true,\n    signal: abortSignal,\n  });\n  abortSignal?.addEventListener(\n    \"abort\",\n    () => window.cancelAnimationFrame(rAF),\n    { once: true }\n  );\n  return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value&param2=...).\n * @param {string} query\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 InvisibleCharsRegExp = /[\\x00-\\x1F]/g;\n\n/**\n * @param {string} str\n * @param {boolean} [replaceInvisible]\n */\nfunction removeNullCharacters(str, replaceInvisible = false) {\n  if (!InvisibleCharsRegExp.test(str)) {\n    return str;\n  }\n  if (replaceInvisible) {\n    return str.replaceAll(InvisibleCharsRegExp, m => (m === \"\\x00\" ? \"\" : \" \"));\n  }\n  return str.replaceAll(\"\\x00\", \"\");\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 *                   They are both natural numbers.\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\n/**\n * @param {number} x - A positive number to round to a multiple of `div`.\n * @param {number} div - A natural number.\n */\nfunction floorToDivide(x, div) {\n  return x - (x % 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} params\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 minY = Math.max(0, top - currentHeight);\n    const minX = Math.max(0, left - currentWidth);\n\n    const hiddenHeight = minY + Math.max(0, viewBottom - bottom);\n    const hiddenWidth = minX + 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      visibleArea:\n        // We only specify which part of the page is visible when it's not\n        // the full page, as there is no point in handling a partial page\n        // rendering otherwise.\n        percent === 100\n          ? null\n          : {\n              minX,\n              minY,\n              maxX: Math.min(viewRight, right) - currentWidth,\n              maxY: Math.min(viewBottom, bottom) - currentHeight,\n            },\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\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  const deltaMode = evt.deltaMode; // Avoid being affected by bug 1392460.\n  let delta = normalizeWheelEventDirection(evt);\n\n  const MOUSE_PIXELS_PER_LINE = 30;\n  const MOUSE_LINES_PER_PAGE = 30;\n\n  // Converts delta to per-page units\n  if (deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n    delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;\n  } else if (deltaMode === WheelEvent.DOM_DELTA_LINE) {\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\nclass ProgressBar {\n  #classList = null;\n\n  #disableAutoFetchTimeout = null;\n\n  #percent = 0;\n\n  #style = null;\n\n  #visible = true;\n\n  constructor(bar) {\n    this.#classList = bar.classList;\n    this.#style = bar.style;\n  }\n\n  get percent() {\n    return this.#percent;\n  }\n\n  set percent(val) {\n    this.#percent = val;\n\n    if (isNaN(val)) {\n      this.#classList.add(\"indeterminate\");\n      return;\n    }\n    this.#classList.remove(\"indeterminate\");\n\n    this.#style.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      this.#style.setProperty(\n        \"--progressBar-end-offset\",\n        `${scrollbarWidth}px`\n      );\n    }\n  }\n\n  setDisableAutoFetch(delay = /* ms = */ 5000) {\n    if (this.#percent === 100 || isNaN(this.#percent)) {\n      return;\n    }\n    if (this.#disableAutoFetchTimeout) {\n      clearTimeout(this.#disableAutoFetchTimeout);\n    }\n    this.show();\n\n    this.#disableAutoFetchTimeout = setTimeout(() => {\n      this.#disableAutoFetchTimeout = null;\n      this.hide();\n    }, delay);\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 * @param {string} layout - 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\nfunction toggleCheckedBtn(button, toggle, view = null) {\n  button.classList.toggle(\"toggled\", toggle);\n  button.setAttribute(\"aria-checked\", toggle);\n\n  view?.classList.toggle(\"hidden\", !toggle);\n}\n\nfunction toggleSelectedBtn(button, toggle, view = null) {\n  button.classList.toggle(\"selected\", toggle);\n  button.setAttribute(\"aria-selected\", toggle);\n\n  view?.classList.toggle(\"hidden\", !toggle);\n}\n\nfunction toggleExpandedBtn(button, toggle, view = null) {\n  button.classList.toggle(\"toggled\", toggle);\n  button.setAttribute(\"aria-expanded\", toggle);\n\n  view?.classList.toggle(\"hidden\", !toggle);\n}\n\n// In Firefox, the css calc function uses f32 precision but the Chrome or Safari\n// are using f64 one. So in order to have the same rendering in all browsers, we\n// need to use the right precision in order to have correct dimensions.\nconst calcRound =\n  typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n    ? Math.fround\n    : (function () {\n        if (\n          typeof PDFJSDev !== \"undefined\" &&\n          PDFJSDev.test(\"LIB\") &&\n          typeof document === \"undefined\"\n        ) {\n          return x => x;\n        }\n        const e = document.createElement(\"div\");\n        e.style.width = \"round(down, calc(1.6666666666666665 * 792px), 1px)\";\n        return e.style.width === \"calc(1320px)\" ? Math.fround : x => x;\n      })();\n\nexport {\n  animationStarted,\n  apiPageLayoutToViewerModes,\n  apiPageModeToSidebarView,\n  approximateFraction,\n  AutoPrintRegExp,\n  backtrackBeforeAllVisibleElements, // only exported for testing\n  binarySearchFirstItem,\n  calcRound,\n  CursorTool,\n  DEFAULT_SCALE,\n  DEFAULT_SCALE_DELTA,\n  DEFAULT_SCALE_VALUE,\n  docStyle,\n  floorToDivide,\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  normalizeWheelEventDelta,\n  normalizeWheelEventDirection,\n  parseQueryString,\n  PresentationModeState,\n  ProgressBar,\n  removeNullCharacters,\n  SCROLLBAR_PADDING,\n  scrollIntoView,\n  ScrollMode,\n  SidebarView,\n  SpreadMode,\n  TextLayerMode,\n  toggleCheckedBtn,\n  toggleExpandedBtn,\n  toggleSelectedBtn,\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\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n  var compatParams = new Map(); // eslint-disable-line no-var\n  const { maxTouchPoints, platform, userAgent } = navigator;\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  if (isIOS || isAndroid) {\n    compatParams.set(\"maxCanvasPixels\", 5242880);\n  }\n\n  // Don't use system fonts on Android (issue 18210).\n  // Support: Android\n  if (isAndroid) {\n    compatParams.set(\"useSystemFonts\", false);\n  }\n}\n\nconst OptionKind = {\n  BROWSER: 0x01,\n  VIEWER: 0x02,\n  API: 0x04,\n  WORKER: 0x08,\n  EVENT_DISPATCH: 0x10,\n  PREFERENCE: 0x80,\n};\n\n// Should only be used with options that allow multiple types.\nconst Type = {\n  BOOLEAN: 0x01,\n  NUMBER: 0x02,\n  OBJECT: 0x04,\n  STRING: 0x08,\n  UNDEFINED: 0x10,\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  allowedGlobalEvents: {\n    /** @type {Object} */\n    value: null,\n    kind: OptionKind.BROWSER,\n  },\n  canvasMaxAreaInBytes: {\n    /** @type {number} */\n    value: -1,\n    kind: OptionKind.BROWSER + OptionKind.API,\n  },\n  isInAutomation: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.BROWSER,\n  },\n  localeProperties: {\n    /** @type {Object} */\n    value:\n      typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n        ? { lang: navigator.language || \"en-US\" }\n        : null,\n    kind: OptionKind.BROWSER,\n  },\n  maxCanvasDim: {\n    /** @type {number} */\n    value: 32767,\n    kind: OptionKind.BROWSER + OptionKind.VIEWER,\n  },\n  nimbusDataStr: {\n    /** @type {string} */\n    value: \"\",\n    kind: OptionKind.BROWSER,\n  },\n  supportsCaretBrowsingMode: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.BROWSER,\n  },\n  supportsDocumentFonts: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.BROWSER,\n  },\n  supportsIntegratedFind: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.BROWSER,\n  },\n  supportsMouseWheelZoomCtrlKey: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.BROWSER,\n  },\n  supportsMouseWheelZoomMetaKey: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.BROWSER,\n  },\n  supportsPinchToZoom: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.BROWSER,\n  },\n  supportsPrinting: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.BROWSER,\n  },\n  toolbarDensity: {\n    /** @type {number} */\n    value: 0, // 0 = \"normal\", 1 = \"compact\", 2 = \"touch\"\n    kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH,\n  },\n\n  altTextLearnMoreUrl: {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n        ? \"https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/pdf-alt-text\"\n        : \"\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\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  capCanvasAreaFactor: {\n    /** @type {number} */\n    value: 200,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  commentLearnMoreUrl: {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"MOZCENTRAL\")\n        ? \"https://support.mozilla.org/%LOCALE%/kb/view-pdf-files-firefox-or-choose-another-viewer#w_add-a-comment-to-a-pdf\"\n        : \"\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  cursorToolOnLoad: {\n    /** @type {number} */\n    value: 0,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  debuggerSrc: {\n    /** @type {string} */\n    value: \"./debugger.mjs\",\n    kind: OptionKind.VIEWER,\n  },\n  defaultZoomDelay: {\n    /** @type {number} */\n    value: 400,\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  enableAltText: {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableAltTextModelDownload: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH,\n  },\n  enableAutoLinking: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableComment: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\",\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableDetailCanvas: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.VIEWER,\n  },\n  enableGuessAltText: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH,\n  },\n  enableHighlightFloatingButton: {\n    // We'll probably want to make some experiments before enabling this\n    // in Firefox release, but it has to be temporary.\n    // TODO: remove it when unnecessary.\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableMerge: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableNewAltTextWhenAddingImage: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableNewBadge: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"MOZCENTRAL\"),\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableOptimizedPartialRendering: {\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  enableSignatureEditor: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableSplitMerge: {\n    /** @type {boolean} */\n    value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  enableUpdatedAddImage: {\n    // We'll probably want to make some experiments before enabling this\n    // in Firefox release, but it has to be temporary.\n    // TODO: remove it when unnecessary.\n    /** @type {boolean} */\n    value: false,\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  highlightEditorColors: {\n    /** @type {string} */\n    value:\n      \"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,\" +\n      \"yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043\",\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:\n      typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n        ? \"resource://pdf.js/web/images/\"\n        : \"./images/\",\n    kind: OptionKind.VIEWER,\n  },\n  imagesRightClickMinSize: {\n    /** @type {number} */\n    value:\n      typeof PDFJSDev !== \"undefined\" &&\n      // Firefox mobile does not support right-clicking on images,\n      // see https://bugzilla.mozilla.org/show_bug.cgi?id=2014081.\n      // This option is disabled by default outside of MOZCENTRAL\n      // because it degrades the text selection experience in Chrome\n      // and Safari.\n      PDFJSDev.test(\"MOZCENTRAL && !GECKOVIEW\")\n        ? 16\n        : -1,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  },\n  maxCanvasPixels: {\n    /** @type {number} */\n    value: 2 ** 25,\n    kind: OptionKind.VIEWER,\n  },\n  minDurationToUpdateCanvas: {\n    /** @type {number} */\n    value: 500, // ms\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(\"TESTING\"),\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  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      // eslint-disable-next-line no-nested-ternary\n      typeof PDFJSDev === \"undefined\"\n        ? \"../external/bcmaps/\"\n        : PDFJSDev.test(\"MOZCENTRAL\")\n          ? \"resource://pdf.js/web/cmaps/\"\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      typeof PDFJSDev === \"undefined\"\n        ? // NOTE: We cannot use the `updateUrlHash` function here, because of\n          // the default preferences generation (see `gulpfile.mjs`).\n          // However, the following line is *only* used in development mode.\n          document.URL.split(\"#\", 1)[0]\n        : \"\",\n    kind: OptionKind.API,\n  },\n  enableHWA: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\n  },\n  enableWebGPU: {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.API + OptionKind.PREFERENCE,\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  iccUrl: {\n    /** @type {string} */\n    value:\n      // eslint-disable-next-line no-nested-ternary\n      typeof PDFJSDev === \"undefined\"\n        ? \"../external/iccs/\"\n        : PDFJSDev.test(\"MOZCENTRAL\")\n          ? \"resource://pdf.js/web/iccs/\"\n          : \"../web/iccs/\",\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      // eslint-disable-next-line no-nested-ternary\n      typeof PDFJSDev === \"undefined\"\n        ? \"../external/standard_fonts/\"\n        : PDFJSDev.test(\"MOZCENTRAL\")\n          ? \"resource://pdf.js/web/standard_fonts/\"\n          : \"../web/standard_fonts/\",\n    kind: OptionKind.API,\n  },\n  useSystemFonts: {\n    // On Android, there is almost no chance to have the font we want so we\n    // don't use the system fonts in this case (bug 1882613).\n    /** @type {boolean|undefined} */\n    value: (\n      typeof PDFJSDev === \"undefined\"\n        ? window.isGECKOVIEW\n        : PDFJSDev.test(\"GECKOVIEW\")\n    )\n      ? false\n      : undefined,\n    kind: OptionKind.API,\n    type: Type.BOOLEAN + Type.UNDEFINED,\n  },\n  verbosity: {\n    /** @type {number} */\n    value: 1,\n    kind: OptionKind.API,\n  },\n  wasmUrl: {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n        ? \"resource://pdf.js/web/wasm/\"\n        : \"../web/wasm/\",\n    kind: OptionKind.API,\n  },\n\n  workerPort: {\n    /** @type {Object} */\n    value:\n      typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n        ? globalThis.pdfjsPreloadedWorker || null\n        : null,\n    kind: OptionKind.WORKER,\n  },\n  workerSrc: {\n    /** @type {string} */\n    value:\n      // eslint-disable-next-line no-nested-ternary\n      typeof PDFJSDev === \"undefined\"\n        ? \"../src/pdf.worker.js\"\n        : PDFJSDev.test(\"MOZCENTRAL\")\n          ? \"resource://pdf.js/build/pdf.worker.mjs\"\n          : \"../build/pdf.worker.mjs\",\n    kind: OptionKind.WORKER,\n  },\n};\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n  defaultOptions.defaultUrl = {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")\n        ? \"\"\n        : \"compressed.tracemonkey-pldi-09.pdf\",\n    kind: OptionKind.VIEWER,\n  };\n  defaultOptions.sandboxBundleSrc = {\n    /** @type {string} */\n    value:\n      typeof PDFJSDev === \"undefined\"\n        ? \"../build/dev-sandbox/pdf.sandbox.mjs\"\n        : \"../build/pdf.sandbox.mjs\",\n    kind: OptionKind.VIEWER,\n  };\n  defaultOptions.enableFakeMLManager = {\n    /** @type {boolean} */\n    value: true,\n    kind: OptionKind.VIEWER,\n  };\n}\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n  defaultOptions.disablePreferences = {\n    /** @type {boolean} */\n    value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\"),\n    kind: OptionKind.VIEWER,\n  };\n} else if (PDFJSDev.test(\"CHROME\")) {\n  defaultOptions.disableTelemetry = {\n    /** @type {boolean} */\n    value: false,\n    kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n  };\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n  // Ensure that the `defaultOptions` are correctly specified.\n  for (const name in defaultOptions) {\n    const { value, kind, type } = defaultOptions[name];\n\n    if (kind & OptionKind.PREFERENCE) {\n      if (kind === OptionKind.PREFERENCE) {\n        throw new Error(`Cannot use only \"PREFERENCE\" kind: ${name}`);\n      }\n      if (kind & OptionKind.BROWSER) {\n        throw new Error(`Cannot mix \"PREFERENCE\" and \"BROWSER\" kind: ${name}`);\n      }\n      if (type !== undefined) {\n        throw new Error(\n          `Cannot have \\`type\\`-field for \"PREFERENCE\" kind: ${name}`\n        );\n      }\n      if (typeof compatParams === \"object\" && compatParams.has(name)) {\n        throw new Error(\n          `Should not have compatibility-value for \"PREFERENCE\" kind: ${name}`\n        );\n      }\n      // Only \"simple\" preference-values are allowed.\n      if (\n        typeof value !== \"boolean\" &&\n        typeof value !== \"string\" &&\n        !Number.isInteger(value)\n      ) {\n        throw new Error(`Invalid value for \"PREFERENCE\" kind: ${name}`);\n      }\n    } else if (kind & OptionKind.BROWSER) {\n      if (type !== undefined) {\n        throw new Error(\n          `Cannot have \\`type\\`-field for \"BROWSER\" kind: ${name}`\n        );\n      }\n      if (typeof compatParams === \"object\" && compatParams.has(name)) {\n        throw new Error(\n          `Should not have compatibility-value for \"BROWSER\" kind: ${name}`\n        );\n      }\n      if (value === undefined) {\n        throw new Error(`Invalid value for \"BROWSER\" kind: ${name}`);\n      }\n    }\n  }\n}\n\nclass AppOptions {\n  static eventBus;\n\n  static #opts = new Map();\n\n  static {\n    // Initialize all the user-options.\n    for (const name in defaultOptions) {\n      this.#opts.set(name, defaultOptions[name].value);\n    }\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      // Apply any compatibility-values to the user-options.\n      for (const [name, value] of compatParams) {\n        this.#opts.set(name, value);\n      }\n      this._hasInvokedSet = false;\n\n      this._checkDisablePreferences = () => {\n        if (this.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 true;\n        }\n        if (this._hasInvokedSet) {\n          console.warn(\n            \"The Preferences may override manually set AppOptions; \" +\n              'please use the \"disablePreferences\"-option to prevent that.'\n          );\n        }\n        return false;\n      };\n    }\n  }\n\n  constructor() {\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n      throw new Error(\"Cannot initialize AppOptions.\");\n    }\n  }\n\n  static get(name) {\n    return this.#opts.get(name);\n  }\n\n  static getAll(kind = null, defaultOnly = false) {\n    const options = Object.create(null);\n    for (const name in defaultOptions) {\n      const defaultOpt = defaultOptions[name];\n\n      if (kind && !(kind & defaultOpt.kind)) {\n        continue;\n      }\n      options[name] = !defaultOnly ? this.#opts.get(name) : defaultOpt.value;\n    }\n    return options;\n  }\n\n  static set(name, value) {\n    this.setAll({ [name]: value });\n  }\n\n  static setAll(options, prefs = false) {\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      this._hasInvokedSet ||= true;\n    }\n    let events;\n\n    for (const name in options) {\n      const defaultOpt = defaultOptions[name],\n        userOpt = options[name];\n\n      if (\n        !defaultOpt ||\n        !(\n          typeof userOpt === typeof defaultOpt.value ||\n          Type[(typeof userOpt).toUpperCase()] & defaultOpt.type\n        )\n      ) {\n        continue;\n      }\n      const { kind } = defaultOpt;\n\n      if (\n        prefs &&\n        !(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)\n      ) {\n        continue;\n      }\n      if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) {\n        (events ||= new Map()).set(name, userOpt);\n      }\n      this.#opts.set(name, userOpt);\n    }\n\n    if (events) {\n      for (const [name, value] of events) {\n        this.eventBus.dispatch(name.toLowerCase(), { source: this, value });\n      }\n    }\n  }\n}\n\nexport { AppOptions, OptionKind };\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\nconst {\n  AbortException,\n  AnnotationEditorLayer,\n  AnnotationEditorParamsType,\n  AnnotationEditorType,\n  AnnotationEditorUIManager,\n  AnnotationLayer,\n  AnnotationMode,\n  AnnotationType,\n  applyOpacity,\n  build,\n  ColorPicker,\n  createValidAbsoluteUrl,\n  CSSConstants,\n  DOMSVGFactory,\n  DrawLayer,\n  FeatureTest,\n  fetchData,\n  findContrastColor,\n  getDocument,\n  getFilenameFromUrl,\n  getPdfFilenameFromUrl,\n  getRGB,\n  getRGBA,\n  getUuid,\n  getXfaPageViewport,\n  GlobalWorkerOptions,\n  ImageKind,\n  InvalidPDFException,\n  isDataScheme,\n  isPdfFile,\n  isValidExplicitDest,\n  makeArr,\n  makeMap,\n  makeObj,\n  MathClamp,\n  noContextMenu,\n  normalizeUnicode,\n  OPS,\n  OutputScale,\n  PasswordResponses,\n  PDFDataRangeTransport,\n  PDFDateString,\n  PDFWorker,\n  PermissionFlag,\n  PixelsPerInch,\n  RenderingCancelledException,\n  renderRichText,\n  ResponseException,\n  setLayerDimensions,\n  shadow,\n  SignatureExtractor,\n  stopEvent,\n  SupportedImageMimeTypes,\n  TextLayer,\n  TextLayerImages,\n  TouchManager,\n  updateUrlHash,\n  Util,\n  VerbosityLevel,\n  version,\n  XfaLayer,\n} = globalThis.pdfjsLib;\n\nexport {\n  AbortException,\n  AnnotationEditorLayer,\n  AnnotationEditorParamsType,\n  AnnotationEditorType,\n  AnnotationEditorUIManager,\n  AnnotationLayer,\n  AnnotationMode,\n  AnnotationType,\n  applyOpacity,\n  build,\n  ColorPicker,\n  createValidAbsoluteUrl,\n  CSSConstants,\n  DOMSVGFactory,\n  DrawLayer,\n  FeatureTest,\n  fetchData,\n  findContrastColor,\n  getDocument,\n  getFilenameFromUrl,\n  getPdfFilenameFromUrl,\n  getRGB,\n  getRGBA,\n  getUuid,\n  getXfaPageViewport,\n  GlobalWorkerOptions,\n  ImageKind,\n  InvalidPDFException,\n  isDataScheme,\n  isPdfFile,\n  isValidExplicitDest,\n  makeArr,\n  makeMap,\n  makeObj,\n  MathClamp,\n  noContextMenu,\n  normalizeUnicode,\n  OPS,\n  OutputScale,\n  PasswordResponses,\n  PDFDataRangeTransport,\n  PDFDateString,\n  PDFWorker,\n  PermissionFlag,\n  PixelsPerInch,\n  RenderingCancelledException,\n  renderRichText,\n  ResponseException,\n  setLayerDimensions,\n  shadow,\n  SignatureExtractor,\n  stopEvent,\n  SupportedImageMimeTypes,\n  TextLayer,\n  TextLayerImages,\n  TouchManager,\n  updateUrlHash,\n  Util,\n  VerbosityLevel,\n  version,\n  XfaLayer,\n};\n","/* Copyright 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n\nimport { isValidExplicitDest } from \"pdfjs-lib\";\nimport { parseQueryString } 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} 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 */\nclass PDFLinkService {\n  externalLinkEnabled = true;\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._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  }\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?.pagesMapper.pagesNumber || 0;\n  }\n\n  /**\n   * @type {number}\n   */\n  get page() {\n    return this.pdfDocument ? this.pdfViewer.currentPageNumber : 1;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set page(value) {\n    if (this.pdfDocument) {\n      this.pdfViewer.currentPageNumber = value;\n    }\n  }\n\n  /**\n   * @type {number}\n   */\n  get rotation() {\n    return this.pdfDocument ? this.pdfViewer.pagesRotation : 0;\n  }\n\n  /**\n   * @param {number} value\n   */\n  set rotation(value) {\n    if (this.pdfDocument) {\n      this.pdfViewer.pagesRotation = value;\n    }\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get isInPresentationMode() {\n    return this.pdfDocument ? this.pdfViewer.isInPresentationMode : false;\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, pageNumber;\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        `goToDestination: \"${explicitDest}\" is not a valid destination array, for dest=\"${dest}\".`\n      );\n      return;\n    }\n    // Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n    const [destRef] = explicitDest;\n\n    if (destRef && typeof destRef === \"object\") {\n      pageNumber = this.pdfDocument.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        try {\n          pageNumber = (await this.pdfDocument.getPageIndex(destRef)) + 1;\n        } catch {\n          console.error(\n            `goToDestination: \"${destRef}\" is not a valid page reference, for dest=\"${dest}\".`\n          );\n          return;\n        }\n      }\n    } else if (Number.isInteger(destRef)) {\n      pageNumber = destRef + 1;\n    }\n    if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n      console.error(\n        `goToDestination: \"${pageNumber}\" is not a valid page number, for dest=\"${dest}\".`\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    const ac = new AbortController();\n    this.eventBus._on(\n      \"textlayerrendered\",\n      evt => {\n        if (evt.pageNumber === pageNumber) {\n          evt.source.textLayer.div.focus();\n          ac.abort();\n        }\n      },\n      { signal: ac.signal }\n    );\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   * Scrolls to a specific location in the PDF document.\n   * @param {number} pageNumber - The page number to scroll to.\n   * @param {number} x - The x-coordinate to scroll to in page coordinates.\n   * @param {number} y - The y-coordinate to scroll to in page coordinates.\n   * @param {Object} [options]\n   */\n  goToXY(pageNumber, x, y, options = {}) {\n    this.pdfViewer.scrollPageIntoView({\n      pageNumber,\n      destArray: [null, { name: \"XYZ\" }, x, y],\n      ignoreDestinationZoom: true,\n      ...options,\n    });\n  }\n\n  /**\n   * Adds various attributes (href, title, target, rel) to hyperlinks.\n   * @param {HTMLAnchorElement} link\n   * @param {string} url\n   * @param {boolean} [newWindow]\n   */\n  addLinkAttributes(link, url, newWindow = false) {\n    if (!url || typeof url !== \"string\") {\n      throw new Error('A valid \"url\" parameter must provided.');\n    }\n    const target = newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n      rel = this.externalLinkRel;\n\n    // Strip userinfo (user:password@) from URLs used for display, to prevent\n    // phishing via hostname-spoofing (e.g. https://trusted.example@attacker.example/).\n    let displayUrl = url;\n    const parsedUrl = URL.parse(url);\n    if (parsedUrl?.username || parsedUrl?.password) {\n      parsedUrl.username = parsedUrl.password = \"\";\n      displayUrl = parsedUrl.href;\n    }\n\n    if (this.externalLinkEnabled) {\n      link.href = url;\n      link.title = displayUrl;\n    } else {\n      link.href = \"\";\n      link.title = `Disabled: ${displayUrl}`;\n      link.onclick = () => false;\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   * @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 ? this.baseUrl + anchor : 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        const query = params.get(\"search\").replaceAll('\"', \"\"),\n          phrase = params.get(\"phrase\") === \"true\";\n\n        this.eventBus.dispatch(\"findfromurlhash\", {\n          source: this,\n          query: phrase ? query : query.match(/\\S+/g),\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 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      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\n      if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n        return;\n      }\n      // Support opening of PDF attachments in the Firefox PDF Viewer,\n      // which uses a couple of non-standard hash parameters; refer to\n      // `DownloadManager._getOpenDataUrl` in the firefoxcom.js file.\n      if (!params.has(\"filename\") || !params.has(\"filedest\")) {\n        return;\n      }\n      hash = params.get(\"filedest\");\n    }\n\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 {}\n\n    if (typeof dest === \"string\" || isValidExplicitDest(dest)) {\n      this.goToDestination(dest);\n      return;\n    }\n    console.error(\n      `PDFLinkService.setHash: \"${unescape(hash)}\" is not a valid destination.`\n    );\n  }\n\n  /**\n   * @param {string} action\n   */\n  executeNamedAction(action) {\n    if (!this.pdfDocument) {\n      return;\n    }\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    if (!this.pdfDocument) {\n      return;\n    }\n    const pdfDocument = this.pdfDocument,\n      optionalContentConfig = await this.pdfViewer.optionalContentConfigPromise;\n\n    if (pdfDocument !== this.pdfDocument) {\n      return; // The document was closed while the optional content resolved.\n    }\n    optionalContentConfig.setOCGState(action);\n\n    this.pdfViewer.optionalContentConfigPromise = Promise.resolve(\n      optionalContentConfig\n    );\n  }\n}\n\nclass SimpleLinkService extends PDFLinkService {\n  setDocument(pdfDocument, baseUrl = null) {}\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\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 */\nasync function waitOnEventOrTimeout({ target, name, delay = 0 }) {\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  const { promise, resolve } = Promise.withResolvers();\n  const ac = new AbortController();\n\n  function handler(type) {\n    ac.abort(); // Remove event listener.\n    clearTimeout(timeout);\n\n    resolve(type);\n  }\n\n  const evtMethod = target instanceof EventBus ? \"_on\" : \"addEventListener\";\n  target[evtMethod](name, handler.bind(null, WaitOnType.EVENT), {\n    signal: ac.signal,\n  });\n\n  const timeout = setTimeout(handler.bind(null, WaitOnType.TIMEOUT), delay);\n\n  return promise;\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      signal: options?.signal,\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  }\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    let rmAbort = null;\n    if (options?.signal instanceof AbortSignal) {\n      const { signal } = options;\n      if (signal.aborted) {\n        console.error(\"Cannot use an `aborted` signal.\");\n        return;\n      }\n      const onAbort = () => this._off(eventName, listener);\n      rmAbort = () => signal.removeEventListener(\"abort\", onAbort);\n\n      signal.addEventListener(\"abort\", onAbort);\n    }\n\n    const eventListeners = (this.#listeners[eventName] ||= []);\n    eventListeners.push({\n      listener,\n      external: options?.external === true,\n      once: options?.once === true,\n      rmAbort,\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      const evt = eventListeners[i];\n      if (evt.listener === listener) {\n        evt.rmAbort?.(); // Ensure that the `AbortSignal` listener is removed.\n        eventListeners.splice(i, 1);\n        return;\n      }\n    }\n  }\n}\n\n/**\n * NOTE: Only used in the Firefox built-in pdf viewer.\n */\nclass FirefoxEventBus extends EventBus {\n  #externalServices;\n\n  #globalEventNames;\n\n  #isInAutomation;\n\n  constructor(globalEventNames, externalServices, isInAutomation) {\n    super();\n    this.#globalEventNames = globalEventNames;\n    this.#externalServices = externalServices;\n    this.#isInAutomation = isInAutomation;\n  }\n\n  dispatch(eventName, data) {\n    if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n      throw new Error(\"Not implemented: FirefoxEventBus.dispatch\");\n    }\n    super.dispatch(eventName, data);\n\n    if (this.#isInAutomation) {\n      const detail = 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          detail[key] = value;\n        }\n      }\n      const event = new CustomEvent(eventName, {\n        bubbles: true,\n        cancelable: true,\n        detail,\n      });\n      document.dispatchEvent(event);\n    }\n\n    if (this.#globalEventNames?.has(eventName)) {\n      this.#externalServices.dispatchGlobalEvent({\n        eventName,\n        detail: data,\n      });\n    }\n  }\n}\n\nexport { EventBus, FirefoxEventBus, waitOnEventOrTimeout, WaitOnType };\n","/* Copyright 2024 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 BaseExternalServices {\n  constructor() {\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n      this.constructor === BaseExternalServices\n    ) {\n      throw new Error(\"Cannot initialize BaseExternalServices.\");\n    }\n  }\n\n  updateFindControlState(data) {}\n\n  updateFindMatchesCount(data) {}\n\n  initPassiveLoading() {}\n\n  reportTelemetry(data) {}\n\n  reportText(data) {}\n\n  /**\n   * @returns {Promise<L10n>}\n   */\n  async createL10n() {\n    throw new Error(\"Not implemented: createL10n\");\n  }\n\n  createScripting() {\n    throw new Error(\"Not implemented: createScripting\");\n  }\n\n  createSignatureStorage() {\n    throw new Error(\"Not implemented: createSignatureStorage\");\n  }\n\n  updateEditorStates(data) {\n    throw new Error(\"Not implemented: updateEditorStates\");\n  }\n\n  dispatchGlobalEvent(_event) {}\n}\n\nexport { BaseExternalServices };\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    AppOptions.getAll(OptionKind.PREFERENCE, /* defaultOnly = */ true)\n  );\n\n  #initializedPromise = null;\n\n  constructor() {\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n      this.constructor === BasePreferences\n    ) {\n      throw new Error(\"Cannot initialize BasePreferences.\");\n    }\n\n    this.#initializedPromise = this._readFromStorage(this.#defaults).then(\n      ({ browserPrefs, prefs }) => {\n        if (\n          (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n          AppOptions._checkDisablePreferences()\n        ) {\n          return;\n        }\n        AppOptions.setAll({ ...browserPrefs, ...prefs }, /* prefs = */ true);\n      }\n    );\n\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      window.addEventListener(\n        \"updatedPreference\",\n        async ({ detail: { name, value } }) => {\n          await this.#initializedPromise;\n          AppOptions.setAll({ [name]: value }, /* prefs = */ true);\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    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      throw new Error(\"Please use `about:config` to change preferences.\");\n    }\n    await this.#initializedPromise;\n    AppOptions.setAll(this.#defaults, /* prefs = */ true);\n\n    await this._writeToStorage(this.#defaults);\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    AppOptions.setAll({ [name]: value }, /* prefs = */ true);\n\n    await this._writeToStorage(\n      typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n        ? { [name]: AppOptions.get(name) }\n        : AppOptions.getAll(OptionKind.PREFERENCE)\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    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      throw new Error(\"Not implemented: get\");\n    }\n    await this.#initializedPromise;\n    return AppOptions.get(name);\n  }\n\n  get defaults() {\n    return this.#defaults;\n  }\n\n  get initializedPromise() {\n    return this.#initializedPromise;\n  }\n}\n\nexport { BasePreferences };\n","/**\n * The `FluentType` class is the base of Fluent's type system.\n *\n * Fluent types wrap JavaScript values and store additional configuration for\n * them, which can then be used in the `toString` method together with a proper\n * `Intl` formatter.\n */\nexport class FluentType {\n    /**\n     * Create a `FluentType` instance.\n     *\n     * @param value The JavaScript value to wrap.\n     */\n    constructor(value) {\n        this.value = value;\n    }\n    /**\n     * Unwrap the raw value stored by this `FluentType`.\n     */\n    valueOf() {\n        return this.value;\n    }\n}\n/**\n * A {@link FluentType} representing no correct value.\n */\nexport class FluentNone extends FluentType {\n    /**\n     * Create an instance of `FluentNone` with an optional fallback value.\n     * @param value The fallback value of this `FluentNone`.\n     */\n    constructor(value = \"???\") {\n        super(value);\n    }\n    /**\n     * Format this `FluentNone` to the fallback string.\n     */\n    toString(scope) {\n        return `{${this.value}}`;\n    }\n}\n/**\n * A {@link FluentType} representing a number.\n *\n * A `FluentNumber` instance stores the number value of the number it\n * represents. It may also store an option bag of options which will be passed\n * to `Intl.NumerFormat` when the `FluentNumber` is formatted to a string.\n */\nexport class FluentNumber extends FluentType {\n    /**\n     * Create an instance of `FluentNumber` with options to the\n     * `Intl.NumberFormat` constructor.\n     *\n     * @param value The number value of this `FluentNumber`.\n     * @param opts Options which will be passed to `Intl.NumberFormat`.\n     */\n    constructor(value, opts = {}) {\n        super(value);\n        this.opts = opts;\n    }\n    /**\n     * Format this `FluentNumber` to a string.\n     */\n    toString(scope) {\n        if (scope) {\n            try {\n                const nf = scope.memoizeIntlObject(Intl.NumberFormat, this.opts);\n                return nf.format(this.value);\n            }\n            catch (err) {\n                scope.reportError(err);\n            }\n        }\n        return this.value.toString(10);\n    }\n}\n/**\n * A {@link FluentType} representing a date and time.\n *\n * A `FluentDateTime` instance stores a Date object, Temporal object, or a number\n * as a numerical timestamp in milliseconds. It may also store an\n * option bag of options which will be passed to `Intl.DateTimeFormat` when the\n * `FluentDateTime` is formatted to a string.\n */\nexport class FluentDateTime extends FluentType {\n    static supportsValue(value) {\n        if (typeof value === \"number\")\n            return true;\n        if (value instanceof Date)\n            return true;\n        if (value instanceof FluentType)\n            return FluentDateTime.supportsValue(value.valueOf());\n        // Temporary workaround to support environments without Temporal\n        if (\"Temporal\" in globalThis) {\n            // for TypeScript, which doesn't know about Temporal yet\n            const _Temporal = globalThis.Temporal;\n            if (value instanceof _Temporal.Instant ||\n                value instanceof _Temporal.PlainDateTime ||\n                value instanceof _Temporal.PlainDate ||\n                value instanceof _Temporal.PlainMonthDay ||\n                value instanceof _Temporal.PlainTime ||\n                value instanceof _Temporal.PlainYearMonth) {\n                return true;\n            }\n        }\n        return false;\n    }\n    /**\n     * Create an instance of `FluentDateTime` with options to the\n     * `Intl.DateTimeFormat` constructor.\n     *\n     * @param value The number value of this `FluentDateTime`, in milliseconds.\n     * @param opts Options which will be passed to `Intl.DateTimeFormat`.\n     */\n    constructor(value, opts = {}) {\n        // unwrap any FluentType value, but only retain the opts from FluentDateTime\n        if (value instanceof FluentDateTime) {\n            opts = { ...value.opts, ...opts };\n            value = value.value;\n        }\n        else if (value instanceof FluentType) {\n            value = value.valueOf();\n        }\n        // Intl.DateTimeFormat defaults to gregorian calendar, but Temporal defaults to iso8601\n        if (typeof value === \"object\" &&\n            \"calendarId\" in value &&\n            opts.calendar === undefined) {\n            opts = { ...opts, calendar: value.calendarId };\n        }\n        super(value);\n        this.opts = opts;\n    }\n    [Symbol.toPrimitive](hint) {\n        return hint === \"string\" ? this.toString() : this.toNumber();\n    }\n    /**\n     * Convert this `FluentDateTime` to a number.\n     * Note that this isn't always possible due to the nature of Temporal objects.\n     * In such cases, a TypeError will be thrown.\n     */\n    toNumber() {\n        const value = this.value;\n        if (typeof value === \"number\")\n            return value;\n        if (value instanceof Date)\n            return value.getTime();\n        if (\"epochMilliseconds\" in value) {\n            return value.epochMilliseconds;\n        }\n        if (\"toZonedDateTime\" in value) {\n            return value.toZonedDateTime(\"UTC\").epochMilliseconds;\n        }\n        throw new TypeError(\"Unwrapping a non-number value as a number\");\n    }\n    /**\n     * Format this `FluentDateTime` to a string.\n     */\n    toString(scope) {\n        if (scope) {\n            try {\n                const dtf = scope.memoizeIntlObject(Intl.DateTimeFormat, this.opts);\n                return dtf.format(this.value);\n            }\n            catch (err) {\n                scope.reportError(err);\n            }\n        }\n        if (typeof this.value === \"number\" || this.value instanceof Date) {\n            return new Date(this.value).toISOString();\n        }\n        return this.value.toString();\n    }\n}\n","/**\n * The role of the Fluent resolver is to format a `Pattern` to an instance of\n * `FluentValue`. For performance reasons, primitive strings are considered\n * such instances, too.\n *\n * Translations can contain references to other messages or variables,\n * conditional logic in form of select expressions, traits which describe their\n * grammatical features, and can use Fluent builtins which make use of the\n * `Intl` formatters to format numbers and dates into the bundle's languages.\n * See the documentation of the Fluent syntax for more information.\n *\n * In case of errors the resolver will try to salvage as much of the\n * translation as possible. In rare situations where the resolver didn't know\n * how to recover from an error it will return an instance of `FluentNone`.\n *\n * All expressions resolve to an instance of `FluentValue`. The caller should\n * use the `toString` method to convert the instance to a native value.\n *\n * Functions in this file pass around an instance of the `Scope` class, which\n * stores the data required for successful resolution and error recovery.\n */\nimport { FluentType, FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\n/**\n * The maximum number of placeables which can be expanded in a single call to\n * `formatPattern`. The limit protects against the Billion Laughs and Quadratic\n * Blowup attacks. See https://msdn.microsoft.com/en-us/magazine/ee335713.aspx.\n */\nconst MAX_PLACEABLES = 100;\n/** Unicode bidi isolation characters. */\nconst FSI = \"\\u2068\";\nconst PDI = \"\\u2069\";\n/** Helper: match a variant key to the given selector. */\nfunction match(scope, selector, key) {\n    if (key === selector) {\n        // Both are strings.\n        return true;\n    }\n    // XXX Consider comparing options too, e.g. minimumFractionDigits.\n    if (key instanceof FluentNumber &&\n        selector instanceof FluentNumber &&\n        key.value === selector.value) {\n        return true;\n    }\n    if (selector instanceof FluentNumber && typeof key === \"string\") {\n        let category = scope\n            .memoizeIntlObject(Intl.PluralRules, selector.opts)\n            .select(selector.value);\n        if (key === category) {\n            return true;\n        }\n    }\n    return false;\n}\n/** Helper: resolve the default variant from a list of variants. */\nfunction getDefault(scope, variants, star) {\n    if (variants[star]) {\n        return resolvePattern(scope, variants[star].value);\n    }\n    scope.reportError(new RangeError(\"No default\"));\n    return new FluentNone();\n}\n/** Helper: resolve arguments to a call expression. */\nfunction getArguments(scope, args) {\n    const positional = [];\n    const named = Object.create(null);\n    for (const arg of args) {\n        if (arg.type === \"narg\") {\n            named[arg.name] = resolveExpression(scope, arg.value);\n        }\n        else {\n            positional.push(resolveExpression(scope, arg));\n        }\n    }\n    return { positional, named };\n}\n/** Resolve an expression to a Fluent type. */\nfunction resolveExpression(scope, expr) {\n    switch (expr.type) {\n        case \"str\":\n            return expr.value;\n        case \"num\":\n            return new FluentNumber(expr.value, {\n                minimumFractionDigits: expr.precision,\n            });\n        case \"var\":\n            return resolveVariableReference(scope, expr);\n        case \"mesg\":\n            return resolveMessageReference(scope, expr);\n        case \"term\":\n            return resolveTermReference(scope, expr);\n        case \"func\":\n            return resolveFunctionReference(scope, expr);\n        case \"select\":\n            return resolveSelectExpression(scope, expr);\n        default:\n            return new FluentNone();\n    }\n}\n/** Resolve a reference to a variable. */\nfunction resolveVariableReference(scope, { name }) {\n    let arg;\n    if (scope.params) {\n        // We're inside a TermReference. It's OK to reference undefined parameters.\n        if (Object.prototype.hasOwnProperty.call(scope.params, name)) {\n            arg = scope.params[name];\n        }\n        else {\n            return new FluentNone(`$${name}`);\n        }\n    }\n    else if (scope.args &&\n        Object.prototype.hasOwnProperty.call(scope.args, name)) {\n        // We're in the top-level Pattern or inside a MessageReference. Missing\n        // variables references produce ReferenceErrors.\n        arg = scope.args[name];\n    }\n    else {\n        scope.reportError(new ReferenceError(`Unknown variable: $${name}`));\n        return new FluentNone(`$${name}`);\n    }\n    // Return early if the argument already is an instance of FluentType.\n    if (arg instanceof FluentType) {\n        return arg;\n    }\n    // Convert the argument to a Fluent type.\n    switch (typeof arg) {\n        case \"string\":\n            return arg;\n        case \"number\":\n            return new FluentNumber(arg);\n        case \"object\":\n            if (FluentDateTime.supportsValue(arg)) {\n                return new FluentDateTime(arg);\n            }\n        // eslint-disable-next-line no-fallthrough\n        default:\n            scope.reportError(new TypeError(`Variable type not supported: $${name}, ${typeof arg}`));\n            return new FluentNone(`$${name}`);\n    }\n}\n/** Resolve a reference to another message. */\nfunction resolveMessageReference(scope, { name, attr }) {\n    const message = scope.bundle._messages.get(name);\n    if (!message) {\n        scope.reportError(new ReferenceError(`Unknown message: ${name}`));\n        return new FluentNone(name);\n    }\n    if (attr) {\n        const attribute = message.attributes[attr];\n        if (attribute) {\n            return resolvePattern(scope, attribute);\n        }\n        scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));\n        return new FluentNone(`${name}.${attr}`);\n    }\n    if (message.value) {\n        return resolvePattern(scope, message.value);\n    }\n    scope.reportError(new ReferenceError(`No value: ${name}`));\n    return new FluentNone(name);\n}\n/** Resolve a call to a Term with key-value arguments. */\nfunction resolveTermReference(scope, { name, attr, args }) {\n    const id = `-${name}`;\n    const term = scope.bundle._terms.get(id);\n    if (!term) {\n        scope.reportError(new ReferenceError(`Unknown term: ${id}`));\n        return new FluentNone(id);\n    }\n    if (attr) {\n        const attribute = term.attributes[attr];\n        if (attribute) {\n            // Every TermReference has its own variables.\n            scope.params = getArguments(scope, args).named;\n            const resolved = resolvePattern(scope, attribute);\n            scope.params = null;\n            return resolved;\n        }\n        scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));\n        return new FluentNone(`${id}.${attr}`);\n    }\n    scope.params = getArguments(scope, args).named;\n    const resolved = resolvePattern(scope, term.value);\n    scope.params = null;\n    return resolved;\n}\n/** Resolve a call to a Function with positional and key-value arguments. */\nfunction resolveFunctionReference(scope, { name, args }) {\n    // Some functions are built-in. Others may be provided by the runtime via\n    // the `FluentBundle` constructor.\n    let func = scope.bundle._functions[name];\n    if (!func) {\n        scope.reportError(new ReferenceError(`Unknown function: ${name}()`));\n        return new FluentNone(`${name}()`);\n    }\n    if (typeof func !== \"function\") {\n        scope.reportError(new TypeError(`Function ${name}() is not callable`));\n        return new FluentNone(`${name}()`);\n    }\n    try {\n        let resolved = getArguments(scope, args);\n        return func(resolved.positional, resolved.named);\n    }\n    catch (err) {\n        scope.reportError(err);\n        return new FluentNone(`${name}()`);\n    }\n}\n/** Resolve a select expression to the member object. */\nfunction resolveSelectExpression(scope, { selector, variants, star }) {\n    let sel = resolveExpression(scope, selector);\n    if (sel instanceof FluentNone) {\n        return getDefault(scope, variants, star);\n    }\n    // Match the selector against keys of each variant, in order.\n    for (const variant of variants) {\n        const key = resolveExpression(scope, variant.key);\n        if (match(scope, sel, key)) {\n            return resolvePattern(scope, variant.value);\n        }\n    }\n    return getDefault(scope, variants, star);\n}\n/** Resolve a pattern (a complex string with placeables). */\nexport function resolveComplexPattern(scope, ptn) {\n    if (scope.dirty.has(ptn)) {\n        scope.reportError(new RangeError(\"Cyclic reference\"));\n        return new FluentNone();\n    }\n    // Tag the pattern as dirty for the purpose of the current resolution.\n    scope.dirty.add(ptn);\n    const result = [];\n    // Wrap interpolations with Directional Isolate Formatting characters\n    // only when the pattern has more than one element.\n    const useIsolating = scope.bundle._useIsolating && ptn.length > 1;\n    for (const elem of ptn) {\n        if (typeof elem === \"string\") {\n            result.push(scope.bundle._transform(elem));\n            continue;\n        }\n        scope.placeables++;\n        if (scope.placeables > MAX_PLACEABLES) {\n            scope.dirty.delete(ptn);\n            // This is a fatal error which causes the resolver to instantly bail out\n            // on this pattern. The length check protects against excessive memory\n            // usage, and throwing protects against eating up the CPU when long\n            // placeables are deeply nested.\n            throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` +\n                `max allowed is ${MAX_PLACEABLES}`);\n        }\n        if (useIsolating) {\n            result.push(FSI);\n        }\n        result.push(resolveExpression(scope, elem).toString(scope));\n        if (useIsolating) {\n            result.push(PDI);\n        }\n    }\n    scope.dirty.delete(ptn);\n    return result.join(\"\");\n}\n/**\n * Resolve a simple or a complex Pattern to a FluentString\n * (which is really the string primitive).\n */\nfunction resolvePattern(scope, value) {\n    // Resolve a simple pattern.\n    if (typeof value === \"string\") {\n        return scope.bundle._transform(value);\n    }\n    return resolveComplexPattern(scope, value);\n}\n","export class Scope {\n    constructor(bundle, errors, args) {\n        /**\n         * The Set of patterns already encountered during this resolution.\n         * Used to detect and prevent cyclic resolutions.\n         * @ignore\n         */\n        this.dirty = new WeakSet();\n        /** A dict of parameters passed to a TermReference. */\n        this.params = null;\n        /**\n         * The running count of placeables resolved so far.\n         * Used to detect the Billion Laughs and Quadratic Blowup attacks.\n         * @ignore\n         */\n        this.placeables = 0;\n        this.bundle = bundle;\n        this.errors = errors;\n        this.args = args;\n    }\n    reportError(error) {\n        if (!this.errors || !(error instanceof Error)) {\n            throw error;\n        }\n        this.errors.push(error);\n    }\n    memoizeIntlObject(ctor, opts) {\n        let cache = this.bundle._intls.get(ctor);\n        if (!cache) {\n            cache = {};\n            this.bundle._intls.set(ctor, cache);\n        }\n        let id = JSON.stringify(opts);\n        if (!cache[id]) {\n            // @ts-expect-error This is fine.\n            // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n            cache[id] = new ctor(this.bundle.locales, opts);\n        }\n        return cache[id];\n    }\n}\n","/**\n * @overview\n *\n * The FTL resolver ships with a number of functions built-in.\n *\n * Each function take two arguments:\n *   - args - an array of positional args\n *   - opts - an object of key-value args\n *\n * Arguments to functions are guaranteed to already be instances of\n * `FluentValue`.  Functions must return `FluentValues` as well.\n */\nimport { FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\nfunction values(opts, allowed) {\n    const unwrapped = Object.create(null);\n    for (const [name, opt] of Object.entries(opts)) {\n        if (allowed.includes(name)) {\n            unwrapped[name] = opt.valueOf();\n        }\n    }\n    return unwrapped;\n}\nconst NUMBER_ALLOWED = [\n    \"unitDisplay\",\n    \"currencyDisplay\",\n    \"useGrouping\",\n    \"minimumIntegerDigits\",\n    \"minimumFractionDigits\",\n    \"maximumFractionDigits\",\n    \"minimumSignificantDigits\",\n    \"maximumSignificantDigits\",\n];\n/**\n * The implementation of the `NUMBER()` builtin available to translations.\n *\n * Translations may call the `NUMBER()` builtin in order to specify formatting\n * options of a number. For example:\n *\n *     pi = The value of π is {NUMBER($pi, maximumFractionDigits: 2)}.\n *\n * The implementation expects an array of {@link FluentValue | FluentValues} representing the\n * positional arguments, and an object of named {@link FluentValue | FluentValues} representing the\n * named parameters.\n *\n * The following options are recognized:\n *\n *     unitDisplay\n *     currencyDisplay\n *     useGrouping\n *     minimumIntegerDigits\n *     minimumFractionDigits\n *     maximumFractionDigits\n *     minimumSignificantDigits\n *     maximumSignificantDigits\n *\n * Other options are ignored.\n *\n * @param args The positional arguments passed to this `NUMBER()`.\n * @param opts The named argments passed to this `NUMBER()`.\n */\nexport function NUMBER(args, opts) {\n    let arg = args[0];\n    if (arg instanceof FluentNone) {\n        return new FluentNone(`NUMBER(${arg.valueOf()})`);\n    }\n    if (arg instanceof FluentNumber) {\n        return new FluentNumber(arg.valueOf(), {\n            ...arg.opts,\n            ...values(opts, NUMBER_ALLOWED),\n        });\n    }\n    if (arg instanceof FluentDateTime) {\n        return new FluentNumber(arg.toNumber(), {\n            ...values(opts, NUMBER_ALLOWED),\n        });\n    }\n    throw new TypeError(\"Invalid argument to NUMBER\");\n}\nconst DATETIME_ALLOWED = [\n    \"dateStyle\",\n    \"timeStyle\",\n    \"fractionalSecondDigits\",\n    \"dayPeriod\",\n    \"hour12\",\n    \"weekday\",\n    \"era\",\n    \"year\",\n    \"month\",\n    \"day\",\n    \"hour\",\n    \"minute\",\n    \"second\",\n    \"timeZoneName\",\n];\n/**\n * The implementation of the `DATETIME()` builtin available to translations.\n *\n * Translations may call the `DATETIME()` builtin in order to specify\n * formatting options of a number. For example:\n *\n *     now = It's {DATETIME($today, month: \"long\")}.\n *\n * The implementation expects an array of {@link FluentValue | FluentValues} representing the\n * positional arguments, and an object of named {@link FluentValue | FluentValues} representing the\n * named parameters.\n *\n * The following options are recognized:\n *\n *     dateStyle\n *     timeStyle\n *     fractionalSecondDigits\n *     dayPeriod\n *     hour12\n *     weekday\n *     era\n *     year\n *     month\n *     day\n *     hour\n *     minute\n *     second\n *     timeZoneName\n *\n * Other options are ignored.\n *\n * @param args The positional arguments passed to this `DATETIME()`.\n * @param opts The named argments passed to this `DATETIME()`.\n */\nexport function DATETIME(args, opts) {\n    let arg = args[0];\n    if (arg instanceof FluentNone) {\n        return new FluentNone(`DATETIME(${arg.valueOf()})`);\n    }\n    if (arg instanceof FluentDateTime || arg instanceof FluentNumber) {\n        return new FluentDateTime(arg, values(opts, DATETIME_ALLOWED));\n    }\n    throw new TypeError(\"Invalid argument to DATETIME\");\n}\n","const cache = new Map();\nexport function getMemoizerForLocale(locales) {\n    const stringLocale = Array.isArray(locales) ? locales.join(\" \") : locales;\n    let memoizer = cache.get(stringLocale);\n    if (memoizer === undefined) {\n        memoizer = new Map();\n        cache.set(stringLocale, memoizer);\n    }\n    return memoizer;\n}\n","import { resolveComplexPattern } from \"./resolver.js\";\nimport { Scope } from \"./scope.js\";\nimport { FluentNone } from \"./types.js\";\nimport { NUMBER, DATETIME } from \"./builtins.js\";\nimport { getMemoizerForLocale } from \"./memoizer.js\";\n/**\n * Message bundles are single-language stores of translation resources. They are\n * responsible for formatting message values and attributes to strings.\n */\nexport class FluentBundle {\n    /**\n     * Create an instance of `FluentBundle`.\n     *\n     * @example\n     * ```js\n     * let bundle = new FluentBundle([\"en-US\", \"en\"]);\n     *\n     * let bundle = new FluentBundle(locales, {useIsolating: false});\n     *\n     * let bundle = new FluentBundle(locales, {\n     *   useIsolating: true,\n     *   functions: {\n     *     NODE_ENV: () => process.env.NODE_ENV\n     *   }\n     * });\n     * ```\n     *\n     * @param locales - Used to instantiate `Intl` formatters used by translations.\n     * @param options - Optional configuration for the bundle.\n     */\n    constructor(locales, { functions, useIsolating = true, transform = (v) => v, } = {}) {\n        /** @ignore */\n        this._terms = new Map();\n        /** @ignore */\n        this._messages = new Map();\n        this.locales = Array.isArray(locales) ? locales : [locales];\n        this._functions = {\n            NUMBER,\n            DATETIME,\n            ...functions,\n        };\n        this._useIsolating = useIsolating;\n        this._transform = transform;\n        this._intls = getMemoizerForLocale(locales);\n    }\n    /**\n     * Check if a message is present in the bundle.\n     *\n     * @param id - The identifier of the message to check.\n     */\n    hasMessage(id) {\n        return this._messages.has(id);\n    }\n    /**\n     * Return a raw unformatted message object from the bundle.\n     *\n     * Raw messages are `{value, attributes}` shapes containing translation units\n     * called `Patterns`. `Patterns` are implementation-specific; they should be\n     * treated as black boxes and formatted with `FluentBundle.formatPattern`.\n     *\n     * @param id - The identifier of the message to check.\n     */\n    getMessage(id) {\n        return this._messages.get(id);\n    }\n    /**\n     * Add a translation resource to the bundle.\n     *\n     * @example\n     * ```js\n     * let res = new FluentResource(\"foo = Foo\");\n     * bundle.addResource(res);\n     * bundle.getMessage(\"foo\");\n     * // → {value: .., attributes: {..}}\n     * ```\n     *\n     * @param res\n     * @param options\n     */\n    addResource(res, { allowOverrides = false, } = {}) {\n        const errors = [];\n        for (let i = 0; i < res.body.length; i++) {\n            let entry = res.body[i];\n            if (entry.id.startsWith(\"-\")) {\n                // Identifiers starting with a dash (-) define terms. Terms are private\n                // and cannot be retrieved from FluentBundle.\n                if (allowOverrides === false && this._terms.has(entry.id)) {\n                    errors.push(new Error(`Attempt to override an existing term: \"${entry.id}\"`));\n                    continue;\n                }\n                this._terms.set(entry.id, entry);\n            }\n            else {\n                if (allowOverrides === false && this._messages.has(entry.id)) {\n                    errors.push(new Error(`Attempt to override an existing message: \"${entry.id}\"`));\n                    continue;\n                }\n                this._messages.set(entry.id, entry);\n            }\n        }\n        return errors;\n    }\n    /**\n     * Format a `Pattern` to a string.\n     *\n     * Format a raw `Pattern` into a string. `args` will be used to resolve\n     * references to variables passed as arguments to the translation.\n     *\n     * In case of errors `formatPattern` will try to salvage as much of the\n     * translation as possible and will still return a string. For performance\n     * reasons, the encountered errors are not returned but instead are appended\n     * to the `errors` array passed as the third argument.\n     *\n     * If `errors` is omitted, the first encountered error will be thrown.\n     *\n     * @example\n     * ```js\n     * let errors = [];\n     * bundle.addResource(\n     *     new FluentResource(\"hello = Hello, {$name}!\"));\n     *\n     * let hello = bundle.getMessage(\"hello\");\n     * if (hello.value) {\n     *     bundle.formatPattern(hello.value, {name: \"Jane\"}, errors);\n     *     // Returns \"Hello, Jane!\" and `errors` is empty.\n     *\n     *     bundle.formatPattern(hello.value, undefined, errors);\n     *     // Returns \"Hello, {$name}!\" and `errors` is now:\n     *     // [<ReferenceError: Unknown variable: name>]\n     * }\n     * ```\n     */\n    formatPattern(pattern, args = null, errors = null) {\n        // Resolve a simple pattern without creating a scope. No error handling is\n        // required; by definition simple patterns don't have placeables.\n        if (typeof pattern === \"string\") {\n            return this._transform(pattern);\n        }\n        // Resolve a complex pattern.\n        let scope = new Scope(this, errors, args);\n        try {\n            let value = resolveComplexPattern(scope, pattern);\n            return value.toString(scope);\n        }\n        catch (err) {\n            if (scope.errors && err instanceof Error) {\n                scope.errors.push(err);\n                return new FluentNone().toString(scope);\n            }\n            throw err;\n        }\n    }\n}\n","// This regex is used to iterate through the beginnings of messages and terms.\n// With the /m flag, the ^ matches at the beginning of every line.\nconst RE_MESSAGE_START = /^(-?[a-zA-Z][\\w-]*) *= */gm;\n// Both Attributes and Variants are parsed in while loops. These regexes are\n// used to break out of them.\nconst RE_ATTRIBUTE_START = /\\.([a-zA-Z][\\w-]*) *= */y;\nconst RE_VARIANT_START = /\\*?\\[/y;\nconst RE_NUMBER_LITERAL = /(-?[0-9]+(?:\\.([0-9]+))?)/y;\nconst RE_IDENTIFIER = /([a-zA-Z][\\w-]*)/y;\nconst RE_REFERENCE = /([$-])?([a-zA-Z][\\w-]*)(?:\\.([a-zA-Z][\\w-]*))?/y;\nconst RE_FUNCTION_NAME = /^[A-Z][A-Z0-9_-]*$/;\n// A \"run\" is a sequence of text or string literal characters which don't\n// require any special handling. For TextElements such special characters are: {\n// (starts a placeable), and line breaks which require additional logic to check\n// if the next line is indented. For StringLiterals they are: \\ (starts an\n// escape sequence), \" (ends the literal), and line breaks which are not allowed\n// in StringLiterals. Note that string runs may be empty; text runs may not.\nconst RE_TEXT_RUN = /([^{}\\n\\r]+)/y;\nconst RE_STRING_RUN = /([^\\\\\"\\n\\r]*)/y;\n// Escape sequences.\nconst RE_STRING_ESCAPE = /\\\\([\\\\\"])/y;\nconst RE_UNICODE_ESCAPE = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{6})/y;\n// Used for trimming TextElements and indents.\nconst RE_LEADING_NEWLINES = /^\\n+/;\nconst RE_TRAILING_SPACES = / +$/;\n// Used in makeIndent to strip spaces from blank lines and normalize CRLF to LF.\nconst RE_BLANK_LINES = / *\\r?\\n/g;\n// Used in makeIndent to measure the indentation.\nconst RE_INDENT = /( *)$/;\n// Common tokens.\nconst TOKEN_BRACE_OPEN = /{\\s*/y;\nconst TOKEN_BRACE_CLOSE = /\\s*}/y;\nconst TOKEN_BRACKET_OPEN = /\\[\\s*/y;\nconst TOKEN_BRACKET_CLOSE = /\\s*] */y;\nconst TOKEN_PAREN_OPEN = /\\s*\\(\\s*/y;\nconst TOKEN_ARROW = /\\s*->\\s*/y;\nconst TOKEN_COLON = /\\s*:\\s*/y;\n// Note the optional comma. As a deviation from the Fluent EBNF, the parser\n// doesn't enforce commas between call arguments.\nconst TOKEN_COMMA = /\\s*,?\\s*/y;\nconst TOKEN_BLANK = /\\s+/y;\n/**\n * Fluent Resource is a structure storing parsed localization entries.\n */\nexport class FluentResource {\n    constructor(source) {\n        this.body = [];\n        RE_MESSAGE_START.lastIndex = 0;\n        let cursor = 0;\n        // Iterate over the beginnings of messages and terms to efficiently skip\n        // comments and recover from errors.\n        while (true) {\n            let next = RE_MESSAGE_START.exec(source);\n            if (next === null) {\n                break;\n            }\n            cursor = RE_MESSAGE_START.lastIndex;\n            try {\n                this.body.push(parseMessage(next[1]));\n            }\n            catch (err) {\n                if (err instanceof SyntaxError) {\n                    // Don't report any Fluent syntax errors. Skip directly to the\n                    // beginning of the next message or term.\n                    continue;\n                }\n                throw err;\n            }\n        }\n        // The parser implementation is inlined below for performance reasons,\n        // as well as for convenience of accessing `source` and `cursor`.\n        // The parser focuses on minimizing the number of false negatives at the\n        // expense of increasing the risk of false positives. In other words, it\n        // aims at parsing valid Fluent messages with a success rate of 100%, but it\n        // may also parse a few invalid messages which the reference parser would\n        // reject. The parser doesn't perform any validation and may produce entries\n        // which wouldn't make sense in the real world. For best results users are\n        // advised to validate translations with the fluent-syntax parser\n        // pre-runtime.\n        // The parser makes an extensive use of sticky regexes which can be anchored\n        // to any offset of the source string without slicing it. Errors are thrown\n        // to bail out of parsing of ill-formed messages.\n        function test(re) {\n            re.lastIndex = cursor;\n            return re.test(source);\n        }\n        // Advance the cursor by the char if it matches. May be used as a predicate\n        // (was the match found?) or, if errorClass is passed, as an assertion.\n        function consumeChar(char, errorClass) {\n            if (source[cursor] === char) {\n                cursor++;\n                return true;\n            }\n            if (errorClass) {\n                throw new errorClass(`Expected ${char}`);\n            }\n            return false;\n        }\n        // Advance the cursor by the token if it matches. May be used as a predicate\n        // (was the match found?) or, if errorClass is passed, as an assertion.\n        function consumeToken(re, errorClass) {\n            if (test(re)) {\n                cursor = re.lastIndex;\n                return true;\n            }\n            if (errorClass) {\n                throw new errorClass(`Expected ${re.toString()}`);\n            }\n            return false;\n        }\n        // Execute a regex, advance the cursor, and return all capture groups.\n        function match(re) {\n            re.lastIndex = cursor;\n            let result = re.exec(source);\n            if (result === null) {\n                throw new SyntaxError(`Expected ${re.toString()}`);\n            }\n            cursor = re.lastIndex;\n            return result;\n        }\n        // Execute a regex, advance the cursor, and return the capture group.\n        function match1(re) {\n            return match(re)[1];\n        }\n        function parseMessage(id) {\n            let value = parsePattern();\n            let attributes = parseAttributes();\n            if (value === null && Object.keys(attributes).length === 0) {\n                throw new SyntaxError(\"Expected message value or attributes\");\n            }\n            return { id, value, attributes };\n        }\n        function parseAttributes() {\n            let attrs = Object.create(null);\n            while (test(RE_ATTRIBUTE_START)) {\n                let name = match1(RE_ATTRIBUTE_START);\n                let value = parsePattern();\n                if (value === null) {\n                    throw new SyntaxError(\"Expected attribute value\");\n                }\n                attrs[name] = value;\n            }\n            return attrs;\n        }\n        function parsePattern() {\n            let first;\n            // First try to parse any simple text on the same line as the id.\n            if (test(RE_TEXT_RUN)) {\n                first = match1(RE_TEXT_RUN);\n            }\n            // If there's a placeable on the first line, parse a complex pattern.\n            if (source[cursor] === \"{\" || source[cursor] === \"}\") {\n                // Re-use the text parsed above, if possible.\n                return parsePatternElements(first ? [first] : [], Infinity);\n            }\n            // RE_TEXT_VALUE stops at newlines. Only continue parsing the pattern if\n            // what comes after the newline is indented.\n            let indent = parseIndent();\n            if (indent) {\n                if (first) {\n                    // If there's text on the first line, the blank block is part of the\n                    // translation content in its entirety.\n                    return parsePatternElements([first, indent], indent.length);\n                }\n                // Otherwise, we're dealing with a block pattern, i.e. a pattern which\n                // starts on a new line. Discrad the leading newlines but keep the\n                // inline indent; it will be used by the dedentation logic.\n                indent.value = trim(indent.value, RE_LEADING_NEWLINES);\n                return parsePatternElements([indent], indent.length);\n            }\n            if (first) {\n                // It was just a simple inline text after all.\n                return trim(first, RE_TRAILING_SPACES);\n            }\n            return null;\n        }\n        // Parse a complex pattern as an array of elements.\n        function parsePatternElements(elements = [], commonIndent) {\n            while (true) {\n                if (test(RE_TEXT_RUN)) {\n                    elements.push(match1(RE_TEXT_RUN));\n                    continue;\n                }\n                if (source[cursor] === \"{\") {\n                    elements.push(parsePlaceable());\n                    continue;\n                }\n                if (source[cursor] === \"}\") {\n                    throw new SyntaxError(\"Unbalanced closing brace\");\n                }\n                let indent = parseIndent();\n                if (indent) {\n                    elements.push(indent);\n                    commonIndent = Math.min(commonIndent, indent.length);\n                    continue;\n                }\n                break;\n            }\n            let lastIndex = elements.length - 1;\n            let lastElement = elements[lastIndex];\n            // Trim the trailing spaces in the last element if it's a TextElement.\n            if (typeof lastElement === \"string\") {\n                elements[lastIndex] = trim(lastElement, RE_TRAILING_SPACES);\n            }\n            let baked = [];\n            for (let element of elements) {\n                if (element instanceof Indent) {\n                    // Dedent indented lines by the maximum common indent.\n                    element = element.value.slice(0, element.value.length - commonIndent);\n                }\n                if (element) {\n                    baked.push(element);\n                }\n            }\n            return baked;\n        }\n        function parsePlaceable() {\n            consumeToken(TOKEN_BRACE_OPEN, SyntaxError);\n            let selector = parseInlineExpression();\n            if (consumeToken(TOKEN_BRACE_CLOSE)) {\n                return selector;\n            }\n            if (consumeToken(TOKEN_ARROW)) {\n                let variants = parseVariants();\n                consumeToken(TOKEN_BRACE_CLOSE, SyntaxError);\n                return {\n                    type: \"select\",\n                    selector,\n                    ...variants,\n                };\n            }\n            throw new SyntaxError(\"Unclosed placeable\");\n        }\n        function parseInlineExpression() {\n            if (source[cursor] === \"{\") {\n                // It's a nested placeable.\n                return parsePlaceable();\n            }\n            if (test(RE_REFERENCE)) {\n                let [, sigil, name, attr = null] = match(RE_REFERENCE);\n                if (sigil === \"$\") {\n                    return { type: \"var\", name };\n                }\n                if (consumeToken(TOKEN_PAREN_OPEN)) {\n                    let args = parseArguments();\n                    if (sigil === \"-\") {\n                        // A parameterized term: -term(...).\n                        return { type: \"term\", name, attr, args };\n                    }\n                    if (RE_FUNCTION_NAME.test(name)) {\n                        return { type: \"func\", name, args };\n                    }\n                    throw new SyntaxError(\"Function names must be all upper-case\");\n                }\n                if (sigil === \"-\") {\n                    // A non-parameterized term: -term.\n                    return {\n                        type: \"term\",\n                        name,\n                        attr,\n                        args: [],\n                    };\n                }\n                return { type: \"mesg\", name, attr };\n            }\n            return parseLiteral();\n        }\n        function parseArguments() {\n            let args = [];\n            while (true) {\n                switch (source[cursor]) {\n                    case \")\": // End of the argument list.\n                        cursor++;\n                        return args;\n                    case undefined: // EOF\n                        throw new SyntaxError(\"Unclosed argument list\");\n                }\n                args.push(parseArgument());\n                // Commas between arguments are treated as whitespace.\n                consumeToken(TOKEN_COMMA);\n            }\n        }\n        function parseArgument() {\n            let expr = parseInlineExpression();\n            if (expr.type !== \"mesg\") {\n                return expr;\n            }\n            if (consumeToken(TOKEN_COLON)) {\n                // The reference is the beginning of a named argument.\n                return {\n                    type: \"narg\",\n                    name: expr.name,\n                    value: parseLiteral(),\n                };\n            }\n            // It's a regular message reference.\n            return expr;\n        }\n        function parseVariants() {\n            let variants = [];\n            let count = 0;\n            let star;\n            while (test(RE_VARIANT_START)) {\n                if (consumeChar(\"*\")) {\n                    star = count;\n                }\n                let key = parseVariantKey();\n                let value = parsePattern();\n                if (value === null) {\n                    throw new SyntaxError(\"Expected variant value\");\n                }\n                variants[count++] = { key, value };\n            }\n            if (count === 0) {\n                return null;\n            }\n            if (star === undefined) {\n                throw new SyntaxError(\"Expected default variant\");\n            }\n            return { variants, star };\n        }\n        function parseVariantKey() {\n            consumeToken(TOKEN_BRACKET_OPEN, SyntaxError);\n            let key;\n            if (test(RE_NUMBER_LITERAL)) {\n                key = parseNumberLiteral();\n            }\n            else {\n                key = {\n                    type: \"str\",\n                    value: match1(RE_IDENTIFIER),\n                };\n            }\n            consumeToken(TOKEN_BRACKET_CLOSE, SyntaxError);\n            return key;\n        }\n        function parseLiteral() {\n            if (test(RE_NUMBER_LITERAL)) {\n                return parseNumberLiteral();\n            }\n            if (source[cursor] === '\"') {\n                return parseStringLiteral();\n            }\n            throw new SyntaxError(\"Invalid expression\");\n        }\n        function parseNumberLiteral() {\n            let [, value, fraction = \"\"] = match(RE_NUMBER_LITERAL);\n            let precision = fraction.length;\n            return {\n                type: \"num\",\n                value: parseFloat(value),\n                precision,\n            };\n        }\n        function parseStringLiteral() {\n            consumeChar('\"', SyntaxError);\n            let value = \"\";\n            while (true) {\n                value += match1(RE_STRING_RUN);\n                if (source[cursor] === \"\\\\\") {\n                    value += parseEscapeSequence();\n                    continue;\n                }\n                if (consumeChar('\"')) {\n                    return { type: \"str\", value };\n                }\n                // We've reached an EOL of EOF.\n                throw new SyntaxError(\"Unclosed string literal\");\n            }\n        }\n        // Unescape known escape sequences.\n        function parseEscapeSequence() {\n            if (test(RE_STRING_ESCAPE)) {\n                return match1(RE_STRING_ESCAPE);\n            }\n            if (test(RE_UNICODE_ESCAPE)) {\n                let [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE);\n                let codepoint = parseInt(codepoint4 || codepoint6, 16);\n                return codepoint <= 0xd7ff || 0xe000 <= codepoint\n                    ? // It's a Unicode scalar value.\n                        String.fromCodePoint(codepoint)\n                    : // Lonely surrogates can cause trouble when the parsing result is\n                        // saved using UTF-8. Use U+FFFD REPLACEMENT CHARACTER instead.\n                        \"�\";\n            }\n            throw new SyntaxError(\"Unknown escape sequence\");\n        }\n        // Parse blank space. Return it if it looks like indent before a pattern\n        // line. Skip it othwerwise.\n        function parseIndent() {\n            let start = cursor;\n            consumeToken(TOKEN_BLANK);\n            // Check the first non-blank character after the indent.\n            switch (source[cursor]) {\n                case \".\":\n                case \"[\":\n                case \"*\":\n                case \"}\":\n                case undefined: // EOF\n                    // A special character. End the Pattern.\n                    return false;\n                case \"{\":\n                    // Placeables don't require indentation (in EBNF: block-placeable).\n                    // Continue the Pattern.\n                    return makeIndent(source.slice(start, cursor));\n            }\n            // If the first character on the line is not one of the special characters\n            // listed above, it's a regular text character. Check if there's at least\n            // one space of indent before it.\n            if (source[cursor - 1] === \" \") {\n                // It's an indented text character (in EBNF: indented-char). Continue\n                // the Pattern.\n                return makeIndent(source.slice(start, cursor));\n            }\n            // A not-indented text character is likely the identifier of the next\n            // message. End the Pattern.\n            return false;\n        }\n        // Trim blanks in text according to the given regex.\n        function trim(text, re) {\n            return text.replace(re, \"\");\n        }\n        // Normalize a blank block and extract the indent details.\n        function makeIndent(blank) {\n            let value = blank.replace(RE_BLANK_LINES, \"\\n\");\n            let length = RE_INDENT.exec(blank)[1].length;\n            return new Indent(value, length);\n        }\n    }\n}\nclass Indent {\n    constructor(value, length) {\n        this.value = value;\n        this.length = length;\n    }\n}\n","/**\n * A JavaScript implementation of Project Fluent, a localization\n * framework designed to unleash the expressive power of the natural language.\n *\n * @module\n */\nexport { FluentBundle } from \"./bundle.js\";\nexport { FluentResource } from \"./resource.js\";\nexport { FluentType, FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\n","/* eslint no-console: [\"error\", {allow: [\"warn\"]}] */\n/* global console */\n// Match the opening angle bracket (<) in HTML tags, and HTML entities like\n// &amp;, &#0038;, &#x0026;.\nconst reOverlay = /<|&#?\\w+;/;\n/**\n * Elements allowed in translations even if they are not present in the source\n * HTML. They are text-level elements as defined by the HTML5 spec:\n * https://www.w3.org/TR/html5/text-level-semantics.html with the exception of:\n *\n *   - a - because we don't allow href on it anyways,\n *   - ruby, rt, rp - because we don't allow nested elements to be inserted.\n */\nconst TEXT_LEVEL_ELEMENTS = {\n    \"http://www.w3.org/1999/xhtml\": [\n        \"em\",\n        \"strong\",\n        \"small\",\n        \"s\",\n        \"cite\",\n        \"q\",\n        \"dfn\",\n        \"abbr\",\n        \"data\",\n        \"time\",\n        \"code\",\n        \"var\",\n        \"samp\",\n        \"kbd\",\n        \"sub\",\n        \"sup\",\n        \"i\",\n        \"b\",\n        \"u\",\n        \"mark\",\n        \"bdi\",\n        \"bdo\",\n        \"span\",\n        \"br\",\n        \"wbr\",\n    ],\n};\nconst LOCALIZABLE_ATTRIBUTES = {\n    \"http://www.w3.org/1999/xhtml\": {\n        global: [\"title\", \"aria-description\", \"aria-label\", \"aria-valuetext\"],\n        a: [\"download\"],\n        area: [\"download\", \"alt\"],\n        // value is special-cased in isAttrNameLocalizable\n        input: [\"alt\", \"placeholder\"],\n        menuitem: [\"label\"],\n        menu: [\"label\"],\n        optgroup: [\"label\"],\n        option: [\"label\"],\n        track: [\"label\"],\n        img: [\"alt\"],\n        textarea: [\"placeholder\"],\n        th: [\"abbr\"],\n    },\n    \"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\": {\n        global: [\n            \"accesskey\",\n            \"aria-label\",\n            \"aria-valuetext\",\n            \"label\",\n            \"title\",\n            \"tooltiptext\",\n        ],\n        description: [\"value\"],\n        key: [\"key\", \"keycode\"],\n        label: [\"value\"],\n        textbox: [\"placeholder\", \"value\"],\n    },\n};\n/**\n * Translate an element.\n *\n * Translate the element's text content and attributes. Some HTML markup is\n * allowed in the translation. The element's children with the data-l10n-name\n * attribute will be treated as arguments to the translation. If the\n * translation defines the same children, their attributes and text contents\n * will be used for translating the matching source child.\n *\n * @param   {Element} element\n * @param   {Object} translation\n * @private\n */\nexport default function translateElement(element, translation) {\n    const { value } = translation;\n    if (typeof value === \"string\") {\n        if (element.localName === \"title\" &&\n            element.namespaceURI === \"http://www.w3.org/1999/xhtml\") {\n            // A special case for the HTML title element whose content must be text.\n            element.textContent = value;\n        }\n        else if (!reOverlay.test(value)) {\n            // If the translation doesn't contain any markup skip the overlay logic.\n            element.textContent = value;\n        }\n        else {\n            // Else parse the translation's HTML using an inert template element,\n            // sanitize it and replace the element's content.\n            const templateElement = element.ownerDocument.createElementNS(\"http://www.w3.org/1999/xhtml\", \"template\");\n            templateElement.innerHTML = value;\n            overlayChildNodes(templateElement.content, element);\n        }\n    }\n    // Even if the translation doesn't define any localizable attributes, run\n    // overlayAttributes to remove any localizable attributes set by previous\n    // translations.\n    overlayAttributes(translation, element);\n}\n/**\n * Replace child nodes of an element with child nodes of another element.\n *\n * The contents of the target element will be cleared and fully replaced with\n * sanitized contents of the source element.\n *\n * @param {DocumentFragment} fromFragment - The source of children to overlay.\n * @param {Element} toElement - The target of the overlay.\n * @private\n */\nfunction overlayChildNodes(fromFragment, toElement) {\n    for (const childNode of fromFragment.childNodes) {\n        if (childNode.nodeType === childNode.TEXT_NODE) {\n            // Keep the translated text node.\n            continue;\n        }\n        if (childNode.hasAttribute(\"data-l10n-name\")) {\n            const sanitized = getNodeForNamedElement(toElement, childNode);\n            fromFragment.replaceChild(sanitized, childNode);\n            continue;\n        }\n        if (isElementAllowed(childNode)) {\n            const sanitized = createSanitizedElement(childNode);\n            fromFragment.replaceChild(sanitized, childNode);\n            continue;\n        }\n        console.warn(`An element of forbidden type \"${childNode.localName}\" was found in ` +\n            \"the translation. Only safe text-level elements and elements with \" +\n            \"data-l10n-name are allowed.\");\n        // If all else fails, replace the element with its text content.\n        fromFragment.replaceChild(createTextNodeFromTextContent(childNode), childNode);\n    }\n    toElement.textContent = \"\";\n    toElement.appendChild(fromFragment);\n}\nfunction hasAttribute(attributes, name) {\n    if (!attributes) {\n        return false;\n    }\n    for (let attr of attributes) {\n        if (attr.name === name) {\n            return true;\n        }\n    }\n    return false;\n}\n/**\n * Transplant localizable attributes of an element to another element.\n *\n * Any localizable attributes already set on the target element will be\n * cleared.\n *\n * @param   {Element|Object} fromElement - The source of child nodes to overlay.\n * @param   {Element} toElement - The target of the overlay.\n * @private\n */\nfunction overlayAttributes(fromElement, toElement) {\n    const explicitlyAllowed = toElement.hasAttribute(\"data-l10n-attrs\")\n        ? toElement\n            .getAttribute(\"data-l10n-attrs\")\n            .split(\",\")\n            .map(i => i.trim())\n        : null;\n    // Remove existing localizable attributes if they\n    // will not be used in the new translation.\n    for (const attr of Array.from(toElement.attributes)) {\n        if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) &&\n            !hasAttribute(fromElement.attributes, attr.name)) {\n            toElement.removeAttribute(attr.name);\n        }\n    }\n    // fromElement might be a {value, attributes} object as returned by\n    // Localization.messageFromBundle. In which case attributes may be null to\n    // save GC cycles.\n    if (!fromElement.attributes) {\n        return;\n    }\n    // Set localizable attributes.\n    for (const attr of Array.from(fromElement.attributes)) {\n        if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) &&\n            toElement.getAttribute(attr.name) !== attr.value) {\n            toElement.setAttribute(attr.name, attr.value);\n        }\n    }\n}\n/**\n * Sanitize a child element created by the translation.\n *\n * Try to find a corresponding child in sourceElement and use it as the base\n * for the sanitization. This will preserve functional attribtues defined on\n * the child element in the source HTML.\n *\n * @param   {Element} sourceElement - The source for data-l10n-name lookups.\n * @param   {Element} translatedChild - The translated child to be sanitized.\n * @returns {Element}\n * @private\n */\nfunction getNodeForNamedElement(sourceElement, translatedChild) {\n    const childName = translatedChild.getAttribute(\"data-l10n-name\");\n    const sourceChild = sourceElement.querySelector(`[data-l10n-name=\"${childName}\"]`);\n    if (!sourceChild) {\n        console.warn(`An element named \"${childName}\" wasn't found in the source.`);\n        return createTextNodeFromTextContent(translatedChild);\n    }\n    if (sourceChild.localName !== translatedChild.localName) {\n        console.warn(`An element named \"${childName}\" was found in the translation ` +\n            `but its type ${translatedChild.localName} didn't match the ` +\n            `element found in the source (${sourceChild.localName}).`);\n        return createTextNodeFromTextContent(translatedChild);\n    }\n    // Remove it from sourceElement so that the translation cannot use\n    // the same reference name again.\n    sourceElement.removeChild(sourceChild);\n    // We can't currently guarantee that a translation won't remove\n    // sourceChild from the element completely, which could break the app if\n    // it relies on an event handler attached to the sourceChild. Let's make\n    // this limitation explicit for now by breaking the identitiy of the\n    // sourceChild by cloning it. This will destroy all event handlers\n    // attached to sourceChild via addEventListener and via on<name>\n    // properties.\n    const clone = sourceChild.cloneNode(false);\n    return shallowPopulateUsing(translatedChild, clone);\n}\n/**\n * Sanitize an allowed element.\n *\n * Text-level elements allowed in translations may only use safe attributes\n * and will have any nested markup stripped to text content.\n *\n * @param   {Element} element - The element to be sanitized.\n * @returns {Element}\n * @private\n */\nfunction createSanitizedElement(element) {\n    // Start with an empty element of the same type to remove nested children\n    // and non-localizable attributes defined by the translation.\n    const clone = element.ownerDocument.createElement(element.localName);\n    return shallowPopulateUsing(element, clone);\n}\n/**\n * Convert an element to a text node.\n *\n * @param   {Element} element - The element to be sanitized.\n * @returns {Node}\n * @private\n */\nfunction createTextNodeFromTextContent(element) {\n    return element.ownerDocument.createTextNode(element.textContent);\n}\n/**\n * Check if element is allowed in the translation.\n *\n * This method is used by the sanitizer when the translation markup contains\n * an element which is not present in the source code.\n *\n * @param   {Element} element\n * @returns {boolean}\n * @private\n */\nfunction isElementAllowed(element) {\n    const allowed = TEXT_LEVEL_ELEMENTS[element.namespaceURI];\n    return allowed && allowed.includes(element.localName);\n}\n/**\n * Check if attribute is allowed for the given element.\n *\n * This method is used by the sanitizer when the translation markup contains\n * DOM attributes, or when the translation has traits which map to DOM\n * attributes.\n *\n * `explicitlyAllowed` can be passed as a list of attributes explicitly\n * allowed on this element.\n *\n * @param   {string}         name\n * @param   {Element}        element\n * @param   {Array}          explicitlyAllowed\n * @returns {boolean}\n * @private\n */\nfunction isAttrNameLocalizable(name, element, explicitlyAllowed = null) {\n    if (explicitlyAllowed && explicitlyAllowed.includes(name)) {\n        return true;\n    }\n    const allowed = LOCALIZABLE_ATTRIBUTES[element.namespaceURI];\n    if (!allowed) {\n        return false;\n    }\n    const attrName = name.toLowerCase();\n    const elemName = element.localName;\n    // Is it a globally safe attribute?\n    if (allowed.global.includes(attrName)) {\n        return true;\n    }\n    // Are there no allowed attributes for this element?\n    if (!allowed[elemName]) {\n        return false;\n    }\n    // Is it allowed on this element?\n    if (allowed[elemName].includes(attrName)) {\n        return true;\n    }\n    // Special case for value on HTML inputs with type button, reset, submit\n    if (element.namespaceURI === \"http://www.w3.org/1999/xhtml\" &&\n        elemName === \"input\" &&\n        attrName === \"value\") {\n        const type = element.type.toLowerCase();\n        if (type === \"submit\" || type === \"button\" || type === \"reset\") {\n            return true;\n        }\n    }\n    return false;\n}\n/**\n * Helper to set textContent and localizable attributes on an element.\n *\n * @param   {Element} fromElement\n * @param   {Element} toElement\n * @returns {Element}\n * @private\n */\nfunction shallowPopulateUsing(fromElement, toElement) {\n    toElement.textContent = fromElement.textContent;\n    overlayAttributes(fromElement, toElement);\n    return toElement;\n}\n","/*\n * Base CachedIterable class.\n */\nexport default class CachedIterable extends Array {\n    /**\n     * Create a `CachedIterable` instance from an iterable or, if another\n     * instance of `CachedIterable` is passed, return it without any\n     * modifications.\n     *\n     * @param {Iterable} iterable\n     * @returns {CachedIterable}\n     */\n    static from(iterable) {\n        if (iterable instanceof this) {\n            return iterable;\n        }\n\n        return new this(iterable);\n    }\n}\n","import CachedIterable from \"./cached_iterable.mjs\";\n\n/*\n * CachedSyncIterable caches the elements yielded by an iterable.\n *\n * It can be used to iterate over an iterable many times without depleting the\n * iterable.\n */\nexport default class CachedSyncIterable extends CachedIterable {\n    /**\n     * Create an `CachedSyncIterable` instance.\n     *\n     * @param {Iterable} iterable\n     * @returns {CachedSyncIterable}\n     */\n    constructor(iterable) {\n        super();\n\n        if (Symbol.iterator in Object(iterable)) {\n            this.iterator = iterable[Symbol.iterator]();\n        } else {\n            throw new TypeError(\"Argument must implement the iteration protocol.\");\n        }\n    }\n\n    [Symbol.iterator]() {\n        const cached = this;\n        let cur = 0;\n\n        return {\n            next() {\n                if (cached.length <= cur) {\n                    cached.push(cached.iterator.next());\n                }\n                return cached[cur++];\n            }\n        };\n    }\n\n    /**\n     * This method allows user to consume the next element from the iterator\n     * into the cache.\n     *\n     * @param {number} count - number of elements to consume\n     */\n    touchNext(count = 1) {\n        let idx = 0;\n        while (idx++ < count) {\n            const last = this[this.length - 1];\n            if (last && last.done) {\n                break;\n            }\n            this.push(this.iterator.next());\n        }\n        // Return the last cached {value, done} object to allow the calling\n        // code to decide if it needs to call touchNext again.\n        return this[this.length - 1];\n    }\n}\n","import CachedIterable from \"./cached_iterable.mjs\";\n\n/*\n * CachedAsyncIterable caches the elements yielded by an async iterable.\n *\n * It can be used to iterate over an iterable many times without depleting the\n * iterable.\n */\nexport default class CachedAsyncIterable extends CachedIterable {\n    /**\n     * Create an `CachedAsyncIterable` instance.\n     *\n     * @param {Iterable} iterable\n     * @returns {CachedAsyncIterable}\n     */\n    constructor(iterable) {\n        super();\n\n        if (Symbol.asyncIterator in Object(iterable)) {\n            this.iterator = iterable[Symbol.asyncIterator]();\n        } else if (Symbol.iterator in Object(iterable)) {\n            this.iterator = iterable[Symbol.iterator]();\n        } else {\n            throw new TypeError(\"Argument must implement the iteration protocol.\");\n        }\n    }\n\n    /**\n     * Asynchronous iterator caching the yielded elements.\n     *\n     * Elements yielded by the original iterable will be cached and available\n     * synchronously. Returns an async generator object implementing the\n     * iterator protocol over the elements of the original (async or sync)\n     * iterable.\n     */\n    [Symbol.asyncIterator]() {\n        const cached = this;\n        let cur = 0;\n\n        return {\n            async next() {\n                if (cached.length <= cur) {\n                    cached.push(cached.iterator.next());\n                }\n                return cached[cur++];\n            }\n        };\n    }\n\n    /**\n     * This method allows user to consume the next element from the iterator\n     * into the cache.\n     *\n     * @param {number} count - number of elements to consume\n     */\n    async touchNext(count = 1) {\n        let idx = 0;\n        while (idx++ < count) {\n            const last = this[this.length - 1];\n            if (last && (await last).done) {\n                break;\n            }\n            this.push(this.iterator.next());\n        }\n        // Return the last cached {value, done} object to allow the calling\n        // code to decide if it needs to call touchNext again.\n        return this[this.length - 1];\n    }\n}\n","export {default as CachedSyncIterable} from \"./cached_sync_iterable.mjs\";\nexport {default as CachedAsyncIterable} from \"./cached_async_iterable.mjs\";\n","/* eslint no-console: [\"error\", { allow: [\"warn\", \"error\"] }] */\n/* global console */\nimport { CachedAsyncIterable } from \"cached-iterable\";\n/**\n * The `Localization` class is a central high-level API for vanilla\n * JavaScript use of Fluent.\n * It combines language negotiation, FluentBundle and I/O to\n * provide a scriptable API to format translations.\n */\nexport default class Localization {\n    /**\n     * @param {Array<String>} resourceIds     - List of resource IDs\n     * @param {Function}      generateBundles - Function that returns a\n     *                                          generator over FluentBundles\n     *\n     * @returns {Localization}\n     */\n    constructor(resourceIds = [], generateBundles) {\n        this.resourceIds = resourceIds;\n        this.generateBundles = generateBundles;\n        this.onChange(true);\n    }\n    addResourceIds(resourceIds, eager = false) {\n        this.resourceIds.push(...resourceIds);\n        this.onChange(eager);\n        return this.resourceIds.length;\n    }\n    removeResourceIds(resourceIds) {\n        this.resourceIds = this.resourceIds.filter(r => !resourceIds.includes(r));\n        this.onChange();\n        return this.resourceIds.length;\n    }\n    /**\n     * Format translations and handle fallback if needed.\n     *\n     * Format translations for `keys` from `FluentBundle` instances on this\n     * DOMLocalization. In case of errors, fetch the next context in the\n     * fallback chain.\n     *\n     * @param   {Array<Object>}         keys    - Translation keys to format.\n     * @param   {Function}              method  - Formatting function.\n     * @returns {Promise<Array<string|Object>>}\n     * @private\n     */\n    async formatWithFallback(keys, method) {\n        const translations = [];\n        let hasAtLeastOneBundle = false;\n        for await (const bundle of this.bundles) {\n            hasAtLeastOneBundle = true;\n            const missingIds = keysFromBundle(method, bundle, keys, translations);\n            if (missingIds.size === 0) {\n                break;\n            }\n            if (typeof console !== \"undefined\") {\n                const locale = bundle.locales[0];\n                const ids = Array.from(missingIds).join(\", \");\n                console.warn(`[fluent] Missing translations in ${locale}: ${ids}`);\n            }\n        }\n        if (!hasAtLeastOneBundle && typeof console !== \"undefined\") {\n            console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n  keys: ${JSON.stringify(keys)}.\n  resourceIds: ${JSON.stringify(this.resourceIds)}.`);\n        }\n        return translations;\n    }\n    /**\n     * Format translations into `{value, attributes}` objects.\n     *\n     * The fallback logic is the same as in `formatValues`\n     * but it returns `{value, attributes}` objects\n     * which are suitable for the translation of DOM elements.\n     *\n     * Returns a Promise resolving to an array of the translation strings.\n     *\n     * @example\n     * ```js\n     * docL10n.formatMessages([\n     *   {id: 'hello', args: { who: 'Mary' }},\n     *   {id: 'welcome'}\n     * ]).then(console.log);\n     *\n     * // [\n     * //   { value: 'Hello, Mary!', attributes: null },\n     * //   {\n     * //     value: 'Welcome!',\n     * //     attributes: [ { name: \"title\", value: 'Hello' } ]\n     * //   }\n     * // ]\n     * ```\n     *\n     * @param   {Array<Object>} keys\n     * @returns {Promise<Array<{value: string, attributes: Object}>>}\n     * @private\n     */\n    formatMessages(keys) {\n        return this.formatWithFallback(keys, messageFromBundle);\n    }\n    /**\n     * Retrieve translations corresponding to the passed keys.\n     *\n     * A generalized version of `DOMLocalization.formatValue`. Keys must\n     * be `{id, args}` objects.\n     *\n     * Returns a Promise resolving to an array of the translation strings.\n     *\n     * @example\n     * ```js\n     * docL10n.formatValues([\n     *   {id: 'hello', args: { who: 'Mary' }},\n     *   {id: 'hello', args: { who: 'John' }},\n     *   {id: 'welcome'}\n     * ]).then(console.log);\n     *\n     * // ['Hello, Mary!', 'Hello, John!', 'Welcome!']\n     * ```\n     *\n     * @param   {Array<Object>} keys\n     * @returns {Promise<Array<string>>}\n     */\n    formatValues(keys) {\n        return this.formatWithFallback(keys, valueFromBundle);\n    }\n    /**\n     * Retrieve the translation corresponding to the `id` identifier.\n     *\n     * If passed, `args` is a simple hash object with a list of variables that\n     * will be interpolated in the value of the translation.\n     *\n     * Returns a Promise resolving to the translation string.\n     *\n     * Use this sparingly for one-off messages which don't need to be\n     * retranslated when the user changes their language preferences, e.g. in\n     * notifications.\n     *\n     * @example\n     * ```js\n     * docL10n.formatValue(\n     *   'hello', { who: 'world' }\n     * ).then(console.log);\n     *\n     * // 'Hello, world!'\n     * ```\n     *\n     * @param   {string}  id     - Identifier of the translation to format\n     * @param   {Object}  [args] - Optional external arguments\n     * @returns {Promise<string>}\n     */\n    async formatValue(id, args) {\n        const [val] = await this.formatValues([{ id, args }]);\n        return val;\n    }\n    handleEvent() {\n        this.onChange();\n    }\n    /**\n     * This method should be called when there's a reason to believe\n     * that language negotiation or available resources changed.\n     */\n    onChange(eager = false) {\n        this.bundles = CachedAsyncIterable.from(this.generateBundles(this.resourceIds));\n        if (eager) {\n            this.bundles.touchNext(2);\n        }\n    }\n}\n/**\n * Format the value of a message into a string or `null`.\n *\n * This function is passed as a method to `keysFromBundle` and resolve\n * a value of a single L10n Entity using provided `FluentBundle`.\n *\n * If the message doesn't have a value, return `null`.\n *\n * @param   {FluentBundle} bundle\n * @param   {Array<Error>} errors\n * @param   {Object} message\n * @param   {Object} args\n * @returns {string|null}\n * @private\n */\nfunction valueFromBundle(bundle, errors, message, args) {\n    if (message.value) {\n        return bundle.formatPattern(message.value, args, errors);\n    }\n    return null;\n}\n/**\n * Format all public values of a message into a {value, attributes} object.\n *\n * This function is passed as a method to `keysFromBundle` and resolve\n * a single L10n Entity using provided `FluentBundle`.\n *\n * The function will return an object with a value and attributes of the\n * entity.\n *\n * @param   {FluentBundle} bundle\n * @param   {Array<Error>} errors\n * @param   {Object} message\n * @param   {Object} args\n * @returns {Object}\n * @private\n */\nfunction messageFromBundle(bundle, errors, message, args) {\n    const formatted = {\n        value: null,\n        attributes: null,\n    };\n    if (message.value) {\n        formatted.value = bundle.formatPattern(message.value, args, errors);\n    }\n    let attrNames = Object.keys(message.attributes);\n    if (attrNames.length > 0) {\n        formatted.attributes = new Array(attrNames.length);\n        for (let [i, name] of attrNames.entries()) {\n            let value = bundle.formatPattern(message.attributes[name], args, errors);\n            formatted.attributes[i] = { name, value };\n        }\n    }\n    return formatted;\n}\n/**\n * This function is an inner function for `Localization.formatWithFallback`.\n *\n * It takes a `FluentBundle`, list of l10n-ids and a method to be used for\n * key resolution (either `valueFromBundle` or `messageFromBundle`) and\n * optionally a value returned from `keysFromBundle` executed against\n * another `FluentBundle`.\n *\n * The idea here is that if the previous `FluentBundle` did not resolve\n * all keys, we're calling this function with the next context to resolve\n * the remaining ones.\n *\n * In the function, we loop over `keys` and check if we have the `prev`\n * passed and if it has an error entry for the position we're in.\n *\n * If it doesn't, it means that we have a good translation for this key and\n * we return it. If it does, we'll try to resolve the key using the passed\n * `FluentBundle`.\n *\n * In the end, we fill the translations array, and return the Set with\n * missing ids.\n *\n * See `Localization.formatWithFallback` for more info on how this is used.\n *\n * @param {Function}       method\n * @param {FluentBundle} bundle\n * @param {Array<string>}  keys\n * @param {{Array<{value: string, attributes: Object}>}} translations\n *\n * @returns {Set<string>}\n * @private\n */\nfunction keysFromBundle(method, bundle, keys, translations) {\n    const messageErrors = [];\n    const missingIds = new Set();\n    keys.forEach(({ id, args }, i) => {\n        if (translations[i] !== undefined) {\n            return;\n        }\n        let message = bundle.getMessage(id);\n        if (message) {\n            messageErrors.length = 0;\n            translations[i] = method(bundle, messageErrors, message, args);\n            if (messageErrors.length > 0 && typeof console !== \"undefined\") {\n                const locale = bundle.locales[0];\n                const errors = messageErrors.join(\", \");\n                console.warn(`[fluent][resolver] errors in ${locale}/${id}: ${errors}.`);\n            }\n        }\n        else {\n            missingIds.add(id);\n        }\n    });\n    return missingIds;\n}\n","import translateElement from \"./overlay.js\";\nimport Localization from \"./localization.js\";\nconst L10NID_ATTR_NAME = \"data-l10n-id\";\nconst L10NARGS_ATTR_NAME = \"data-l10n-args\";\nconst L10N_ELEMENT_QUERY = `[${L10NID_ATTR_NAME}]`;\n/**\n * The `DOMLocalization` class is responsible for fetching resources and\n * formatting translations.\n *\n * It implements the fallback strategy in case of errors encountered during the\n * formatting of translations and methods for observing DOM\n * trees with a `MutationObserver`.\n */\nexport default class DOMLocalization extends Localization {\n    /**\n     * @param {Array<String>}    resourceIds     - List of resource IDs\n     * @param {Function}         generateBundles - Function that returns a\n     *                                             generator over FluentBundles\n     * @returns {DOMLocalization}\n     */\n    constructor(resourceIds, generateBundles) {\n        super(resourceIds, generateBundles);\n        // A Set of DOM trees observed by the `MutationObserver`.\n        this.roots = new Set();\n        // requestAnimationFrame handler.\n        this.pendingrAF = null;\n        // list of elements pending for translation.\n        this.pendingElements = new Set();\n        this.windowElement = null;\n        this.mutationObserver = null;\n        this.observerConfig = {\n            attributes: true,\n            characterData: false,\n            childList: true,\n            subtree: true,\n            attributeFilter: [L10NID_ATTR_NAME, L10NARGS_ATTR_NAME],\n        };\n    }\n    onChange(eager = false) {\n        super.onChange(eager);\n        if (this.roots) {\n            this.translateRoots();\n        }\n    }\n    /**\n     * Set the `data-l10n-id` and `data-l10n-args` attributes on DOM elements.\n     * FluentDOM makes use of mutation observers to detect changes\n     * to `data-l10n-*` attributes and translate elements asynchronously.\n     * `setAttributes` is a convenience method which allows to translate\n     * DOM elements declaratively.\n     *\n     * You should always prefer to use `data-l10n-id` on elements (statically in\n     * HTML or dynamically via `setAttributes`) over manually retrieving\n     * translations with `format`.  The use of attributes ensures that the\n     * elements can be retranslated when the user changes their language\n     * preferences.\n     *\n     * ```javascript\n     * localization.setAttributes(\n     *   document.querySelector('#welcome'), 'hello', { who: 'world' }\n     * );\n     * ```\n     *\n     * This will set the following attributes on the `#welcome` element.\n     * The MutationObserver will pick up this change and will localize the element\n     * asynchronously.\n     *\n     * ```html\n     * <p id='welcome'\n     *   data-l10n-id='hello'\n     *   data-l10n-args='{\"who\": \"world\"}'>\n     * </p>\n     * ```\n     *\n     * @param {Element}                element - Element to set attributes on\n     * @param {string}                 id      - l10n-id string\n     * @param {Object<string, string>} args    - KVP list of l10n arguments\n     * @returns {Element}\n     */\n    setAttributes(element, id, args) {\n        element.setAttribute(L10NID_ATTR_NAME, id);\n        if (args) {\n            element.setAttribute(L10NARGS_ATTR_NAME, JSON.stringify(args));\n        }\n        else {\n            element.removeAttribute(L10NARGS_ATTR_NAME);\n        }\n        return element;\n    }\n    /**\n     * Get the `data-l10n-*` attributes from DOM elements.\n     *\n     * ```javascript\n     * localization.getAttributes(\n     *   document.querySelector('#welcome')\n     * );\n     * // -> { id: 'hello', args: { who: 'world' } }\n     * ```\n     *\n     * @param   {Element}  element - HTML element\n     * @returns {{id: string, args: Object}}\n     */\n    getAttributes(element) {\n        return {\n            id: element.getAttribute(L10NID_ATTR_NAME),\n            args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null),\n        };\n    }\n    /**\n     * Add `newRoot` to the list of roots managed by this `DOMLocalization`.\n     *\n     * Additionally, if this `DOMLocalization` has an observer, start observing\n     * `newRoot` in order to translate mutations in it.\n     *\n     * @param {Element | DocumentFragment}      newRoot - Root to observe.\n     */\n    connectRoot(newRoot) {\n        for (const root of this.roots) {\n            if (root === newRoot ||\n                root.contains(newRoot) ||\n                newRoot.contains(root)) {\n                throw new Error(\"Cannot add a root that overlaps with existing root.\");\n            }\n        }\n        if (this.windowElement) {\n            if (this.windowElement !== newRoot.ownerDocument.defaultView) {\n                throw new Error(`Cannot connect a root:\n          DOMLocalization already has a root from a different window.`);\n            }\n        }\n        else {\n            this.windowElement = newRoot.ownerDocument.defaultView;\n            this.mutationObserver = new this.windowElement.MutationObserver(mutations => this.translateMutations(mutations));\n        }\n        this.roots.add(newRoot);\n        this.mutationObserver.observe(newRoot, this.observerConfig);\n    }\n    /**\n     * Remove `root` from the list of roots managed by this `DOMLocalization`.\n     *\n     * Additionally, if this `DOMLocalization` has an observer, stop observing\n     * `root`.\n     *\n     * Returns `true` if the root was the last one managed by this\n     * `DOMLocalization`.\n     *\n     * @param   {Element | DocumentFragment} root - Root to disconnect.\n     * @returns {boolean}\n     */\n    disconnectRoot(root) {\n        this.roots.delete(root);\n        // Pause the mutation observer to stop observing `root`.\n        this.pauseObserving();\n        if (this.roots.size === 0) {\n            this.mutationObserver = null;\n            if (this.windowElement && this.pendingrAF) {\n                this.windowElement.cancelAnimationFrame(this.pendingrAF);\n            }\n            this.windowElement = null;\n            this.pendingrAF = null;\n            this.pendingElements.clear();\n            return true;\n        }\n        // Resume observing all other roots.\n        this.resumeObserving();\n        return false;\n    }\n    /**\n     * Translate all roots associated with this `DOMLocalization`.\n     *\n     * @returns {Promise}\n     */\n    translateRoots() {\n        const roots = Array.from(this.roots);\n        return Promise.all(roots.map(root => this.translateFragment(root)));\n    }\n    /**\n     * Pauses the `MutationObserver`.\n     */\n    pauseObserving() {\n        if (!this.mutationObserver) {\n            return;\n        }\n        this.translateMutations(this.mutationObserver.takeRecords());\n        this.mutationObserver.disconnect();\n    }\n    /**\n     * Resumes the `MutationObserver`.\n     */\n    resumeObserving() {\n        if (!this.mutationObserver) {\n            return;\n        }\n        for (const root of this.roots) {\n            this.mutationObserver.observe(root, this.observerConfig);\n        }\n    }\n    /**\n     * Translate mutations detected by the `MutationObserver`.\n     *\n     * @private\n     */\n    translateMutations(mutations) {\n        for (const mutation of mutations) {\n            switch (mutation.type) {\n                case \"attributes\":\n                    if (mutation.target.hasAttribute(\"data-l10n-id\")) {\n                        this.pendingElements.add(mutation.target);\n                    }\n                    break;\n                case \"childList\":\n                    for (const addedNode of mutation.addedNodes) {\n                        if (addedNode.nodeType === addedNode.ELEMENT_NODE) {\n                            if (addedNode.childElementCount) {\n                                for (const element of this.getTranslatables(addedNode)) {\n                                    this.pendingElements.add(element);\n                                }\n                            }\n                            else if (addedNode.hasAttribute(L10NID_ATTR_NAME)) {\n                                this.pendingElements.add(addedNode);\n                            }\n                        }\n                    }\n                    break;\n            }\n        }\n        // This fragment allows us to coalesce all pending translations\n        // into a single requestAnimationFrame.\n        if (this.pendingElements.size > 0) {\n            if (this.pendingrAF === null) {\n                this.pendingrAF = this.windowElement.requestAnimationFrame(() => {\n                    this.translateElements(Array.from(this.pendingElements));\n                    this.pendingElements.clear();\n                    this.pendingrAF = null;\n                });\n            }\n        }\n    }\n    /**\n     * Translate a DOM element or fragment asynchronously using this\n     * `DOMLocalization` object.\n     *\n     * Manually trigger the translation (or re-translation) of a DOM fragment.\n     * Use the `data-l10n-id` and `data-l10n-args` attributes to mark up the DOM\n     * with information about which translations to use.\n     *\n     * Returns a `Promise` that gets resolved once the translation is complete.\n     *\n     * @param   {Element | DocumentFragment} frag - Element or DocumentFragment to be translated\n     * @returns {Promise}\n     */\n    translateFragment(frag) {\n        return this.translateElements(this.getTranslatables(frag));\n    }\n    /**\n     * Translate a list of DOM elements asynchronously using this\n     * `DOMLocalization` object.\n     *\n     * Manually trigger the translation (or re-translation) of a list of elements.\n     * Use the `data-l10n-id` and `data-l10n-args` attributes to mark up the DOM\n     * with information about which translations to use.\n     *\n     * Returns a `Promise` that gets resolved once the translation is complete.\n     *\n     * @param   {Array<Element>} elements - List of elements to be translated\n     * @returns {Promise}\n     */\n    async translateElements(elements) {\n        if (!elements.length) {\n            return undefined;\n        }\n        const keys = elements.map(this.getKeysForElement);\n        const translations = await this.formatMessages(keys);\n        return this.applyTranslations(elements, translations);\n    }\n    /**\n     * Applies translations onto elements.\n     *\n     * @param {Array<Element>} elements\n     * @param {Array<Object>}  translations\n     * @private\n     */\n    applyTranslations(elements, translations) {\n        this.pauseObserving();\n        for (let i = 0; i < elements.length; i++) {\n            if (translations[i] !== undefined) {\n                translateElement(elements[i], translations[i]);\n            }\n        }\n        this.resumeObserving();\n    }\n    /**\n     * Collects all translatable child elements of the element.\n     *\n     * @param {Element | DocumentFragment} element\n     * @returns {Array<Element>}\n     * @private\n     */\n    getTranslatables(element) {\n        const nodes = Array.from(element.querySelectorAll(L10N_ELEMENT_QUERY));\n        if (typeof element.hasAttribute === \"function\" &&\n            element.hasAttribute(L10NID_ATTR_NAME)) {\n            nodes.push(element);\n        }\n        return nodes;\n    }\n    /**\n     * Get the `data-l10n-*` attributes from DOM elements as a two-element\n     * array.\n     *\n     * @param {Element} element\n     * @returns {Object}\n     * @private\n     */\n    getKeysForElement(element) {\n        return {\n            id: element.getAttribute(L10NID_ATTR_NAME),\n            args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null),\n        };\n    }\n}\n","export { default as DOMLocalization } from \"./dom_localization.js\";\nexport { default as Localization } from \"./localization.js\";\n","/* Copyright 2023 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 * NOTE: The L10n-implementations should use lowercase language-codes\n *       internally.\n */\nclass L10n {\n  #dir;\n\n  #elements;\n\n  #lang;\n\n  #l10n;\n\n  constructor({ lang, isRTL }, l10n = null) {\n    this.#lang = L10n.#fixupLangCode(lang);\n    this.#l10n = l10n;\n    this.#dir = (isRTL ?? L10n.#isRTL(this.#lang)) ? \"rtl\" : \"ltr\";\n  }\n\n  _setL10n(l10n) {\n    this.#l10n = l10n;\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n      document.l10n = l10n;\n    }\n  }\n\n  /** @inheritdoc */\n  getLanguage() {\n    return this.#lang;\n  }\n\n  /** @inheritdoc */\n  getDirection() {\n    return this.#dir;\n  }\n\n  /** @inheritdoc */\n  async get(ids, args = null, fallback) {\n    if (Array.isArray(ids)) {\n      ids = ids.map(id => ({ id }));\n      const messages = await this.#l10n.formatMessages(ids);\n      return messages.map(message => message.value);\n    }\n\n    const messages = await this.#l10n.formatMessages([\n      {\n        id: ids,\n        args,\n      },\n    ]);\n    return messages[0]?.value || fallback;\n  }\n\n  /** @inheritdoc */\n  async translate(element) {\n    (this.#elements ||= new Set()).add(element);\n    try {\n      this.#l10n.connectRoot(element);\n      await this.#l10n.translateRoots();\n    } catch {\n      // Element is under an existing root, so there is no need to add it again.\n    }\n  }\n\n  /** @inheritdoc */\n  async translateOnce(element) {\n    try {\n      await this.#l10n.translateElements([element]);\n    } catch (ex) {\n      console.error(\"translateOnce:\", ex);\n    }\n  }\n\n  /** @inheritdoc */\n  async destroy() {\n    if (this.#elements) {\n      for (const element of this.#elements) {\n        this.#l10n.disconnectRoot(element);\n      }\n      this.#elements.clear();\n      this.#elements = null;\n    }\n    this.#l10n.pauseObserving();\n  }\n\n  /** @inheritdoc */\n  pause() {\n    this.#l10n.pauseObserving();\n  }\n\n  /** @inheritdoc */\n  resume() {\n    this.#l10n.resumeObserving();\n  }\n\n  static #fixupLangCode(langCode) {\n    // Use only lowercase language-codes internally, and fallback to English.\n    langCode = langCode?.toLowerCase() || \"en-us\";\n\n    // Try to support \"incompletely\" specified language codes (see issue 13689).\n    const 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    return PARTIAL_LANG_CODES[langCode] || langCode;\n  }\n\n  static #isRTL(lang) {\n    const shortCode = lang.split(\"-\", 1)[0];\n    return [\"ar\", \"he\", \"fa\", \"ps\", \"ur\"].includes(shortCode);\n  }\n}\n\nconst GenericL10n = null;\n\nexport { GenericL10n, L10n };\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 { FeatureTest, fetchData } from \"pdfjs-lib\";\nimport { FluentBundle, FluentResource } from \"fluent-bundle\";\nimport { DOMLocalization } from \"fluent-dom\";\nimport { L10n } from \"./l10n.js\";\n\nfunction PLATFORM() {\n  const { isAndroid, isLinux, isMac, isWindows } = FeatureTest.platform;\n  if (isLinux) {\n    return \"linux\";\n  }\n  if (isWindows) {\n    return \"windows\";\n  }\n  if (isMac) {\n    return \"macos\";\n  }\n  if (isAndroid) {\n    return \"android\";\n  }\n  return \"other\";\n}\n\nfunction createBundle(lang, text) {\n  const resource = new FluentResource(text);\n  const bundle = new FluentBundle(lang, {\n    functions: { PLATFORM },\n  });\n  const errors = bundle.addResource(resource);\n  if (errors.length) {\n    console.error(\"L10n errors\", errors);\n  }\n  return bundle;\n}\n\nclass GenericL10n extends L10n {\n  constructor(lang) {\n    super({ lang });\n\n    const generateBundles = !lang\n      ? GenericL10n.#generateBundlesFallback.bind(\n          GenericL10n,\n          this.getLanguage()\n        )\n      : GenericL10n.#generateBundles.bind(\n          GenericL10n,\n          \"en-us\",\n          this.getLanguage()\n        );\n    this._setL10n(new DOMLocalization([], generateBundles));\n  }\n\n  /**\n   * Generate the bundles for Fluent.\n   * @param {String} defaultLang - The fallback language to use for\n   *   translations.\n   * @param {String} baseLang - The base language to use for translations.\n   */\n  static async *#generateBundles(defaultLang, baseLang) {\n    const { baseURL, paths } = await this.#getPaths();\n\n    const langs = [baseLang];\n    if (defaultLang !== baseLang) {\n      // Also fallback to the short-format of the base language\n      // (see issue 17269).\n      const shortLang = baseLang.split(\"-\", 1)[0];\n\n      if (shortLang !== baseLang) {\n        langs.push(shortLang);\n      }\n      langs.push(defaultLang);\n    }\n    // Trigger fetching of bundles in parallel, to reduce overall load time.\n    const bundles = langs.map(lang => [\n      lang,\n      this.#createBundle(lang, baseURL, paths),\n    ]);\n\n    for (const [lang, bundlePromise] of bundles) {\n      const bundle = await bundlePromise;\n      if (bundle) {\n        yield bundle;\n      } else if (lang === \"en-us\") {\n        yield this.#createBundleFallback(lang);\n      }\n    }\n  }\n\n  static async #createBundle(lang, baseURL, paths) {\n    const path = paths[lang];\n    if (!path) {\n      return null;\n    }\n    const url = new URL(path, baseURL);\n    const text = await fetchData(url, /* type = */ \"text\");\n\n    return createBundle(lang, text);\n  }\n\n  static async #getPaths() {\n    try {\n      const { href } = document.querySelector(`link[type=\"application/l10n\"]`);\n      const paths = await fetchData(href, /* type = */ \"json\");\n\n      return {\n        baseURL: href.substring(0, href.lastIndexOf(\"/\") + 1) || \"./\",\n        paths,\n      };\n    } catch {}\n    return { baseURL: \"./\", paths: Object.create(null) };\n  }\n\n  static async *#generateBundlesFallback(lang) {\n    yield this.#createBundleFallback(lang);\n  }\n\n  static async #createBundleFallback(lang) {\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n      throw new Error(\"Not implemented: #createBundleFallback\");\n    }\n    const text =\n      typeof PDFJSDev === \"undefined\"\n        ? await fetchData(\n            new URL(\"../l10n/en-US/viewer.ftl\", window.location.href),\n            /* type = */ \"text\"\n          )\n        : PDFJSDev.eval(\"DEFAULT_FTL\");\n\n    return createBundle(lang, text);\n  }\n}\n\nexport { GenericL10n };\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 } from \"pdfjs-lib\";\n\nasync function docProperties(pdfDocument) {\n  const url = \"\",\n    baseUrl = \"\";\n  const { info, metadata, contentDispositionFilename, contentLength } =\n    await pdfDocument.getMetadata();\n\n  return {\n    ...info,\n    baseURL: baseUrl,\n    filesize: contentLength || (await pdfDocument.getDownloadInfo()).length,\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, wasmUrl) {\n    this._ready = new Promise((resolve, reject) => {\n      const sandbox =\n        typeof PDFJSDev === \"undefined\"\n          ? import(sandboxBundleSrc) // eslint-disable-line no-unsanitized/method\n          : __raw_import__(sandboxBundleSrc);\n      sandbox\n        .then(pdfjsSandbox => {\n          resolve(\n            pdfjsSandbox.QuickJSSandbox(new URL(wasmUrl, location.href).href)\n          );\n        })\n        .catch(reject);\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 { docProperties, GenericScripting };\n","/* Copyright 2025 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 { getUuid } from \"pdfjs-lib\";\n\nconst KEY_STORAGE = \"pdfjs.signature\";\n\nclass SignatureStorage {\n  // TODO: Encrypt the data in using a password and add a UI for entering it.\n  // We could use the Web Crypto API for this (see https://bradyjoslin.com/blog/encryption-webcrypto/\n  // for an example).\n\n  #eventBus;\n\n  #signatures = null;\n\n  #signal = null;\n\n  constructor(eventBus, signal) {\n    this.#eventBus = eventBus;\n    this.#signal = signal;\n  }\n\n  #save() {\n    localStorage.setItem(\n      KEY_STORAGE,\n      JSON.stringify(Object.fromEntries(this.#signatures))\n    );\n  }\n\n  async getAll() {\n    if (this.#signal) {\n      window.addEventListener(\n        \"storage\",\n        ({ key }) => {\n          if (key === KEY_STORAGE) {\n            this.#signatures = null;\n            this.#eventBus?.dispatch(\"storedsignatureschanged\", {\n              source: this,\n            });\n          }\n        },\n        { signal: this.#signal }\n      );\n      this.#signal = null;\n    }\n    if (!this.#signatures) {\n      this.#signatures = new Map();\n      const data = localStorage.getItem(KEY_STORAGE);\n      if (data) {\n        for (const [key, value] of Object.entries(JSON.parse(data))) {\n          this.#signatures.set(key, value);\n        }\n      }\n    }\n    return this.#signatures;\n  }\n\n  async isFull() {\n    // Only allow 5 signatures to be saved.\n    return (await this.size()) === 5;\n  }\n\n  async size() {\n    return (await this.getAll()).size;\n  }\n\n  async create(data) {\n    if (await this.isFull()) {\n      return null;\n    }\n    const uuid = getUuid();\n    this.#signatures.set(uuid, data);\n    this.#save();\n\n    return uuid;\n  }\n\n  async delete(uuid) {\n    const signatures = await this.getAll();\n    if (!signatures.has(uuid)) {\n      return false;\n    }\n    signatures.delete(uuid);\n    this.#save();\n\n    return true;\n  }\n}\n\nexport { SignatureStorage };\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 { AppOptions } from \"./app_options.js\";\nimport { BaseExternalServices } from \"./external_services.js\";\nimport { BasePreferences } from \"./preferences.js\";\nimport { GenericL10n } from \"./genericl10n.js\";\nimport { GenericScripting } from \"./generic_scripting.js\";\nimport { SignatureStorage } from \"./generic_signature_storage.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\nfunction initCom(app) {}\n\nclass Preferences extends BasePreferences {\n  async _writeToStorage(prefObj) {\n    localStorage.setItem(\"pdfjs.preferences\", JSON.stringify(prefObj));\n  }\n\n  async _readFromStorage(prefObj) {\n    return { prefs: JSON.parse(localStorage.getItem(\"pdfjs.preferences\")) };\n  }\n}\n\nclass ExternalServices extends BaseExternalServices {\n  async createL10n() {\n    return new GenericL10n(AppOptions.get(\"localeProperties\")?.lang);\n  }\n\n  createScripting() {\n    return new GenericScripting(\n      AppOptions.get(\"sandboxBundleSrc\"),\n      AppOptions.get(\"wasmUrl\")\n    );\n  }\n\n  createSignatureStorage(eventBus, signal) {\n    return new SignatureStorage(eventBus, signal);\n  }\n}\n\nclass MLManager {\n  static {\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n      this.getFakeMLManager = options => new FakeMLManager(options);\n    }\n  }\n\n  async isEnabledFor(_name) {\n    return false;\n  }\n\n  async deleteModel(_service) {\n    return null;\n  }\n\n  isReady(_name) {\n    return false;\n  }\n\n  guess(_data) {}\n\n  toggleService(_name, _enabled) {}\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n  // eslint-disable-next-line no-var\n  var FakeMLManager = class {\n    eventBus = null;\n\n    hasProgress = false;\n\n    constructor({ enableGuessAltText, enableAltTextModelDownload }) {\n      this.enableGuessAltText = enableGuessAltText;\n      this.enableAltTextModelDownload = enableAltTextModelDownload;\n    }\n\n    setEventBus(eventBus, abortSignal) {\n      this.eventBus = eventBus;\n    }\n\n    async isEnabledFor(_name) {\n      return this.enableGuessAltText;\n    }\n\n    async deleteModel(_name) {\n      this.enableAltTextModelDownload = false;\n      return null;\n    }\n\n    async loadModel(_name) {}\n\n    async downloadModel(_name) {\n      // Simulate downloading the model but with progress.\n      // The progress can be seen in the new alt-text dialog.\n      this.hasProgress = true;\n\n      const { promise, resolve } = Promise.withResolvers();\n      const total = 1e8;\n      const end = 1.5 * total;\n      const increment = 5e6;\n      let loaded = 0;\n      const id = setInterval(() => {\n        loaded += increment;\n        if (loaded <= end) {\n          this.eventBus.dispatch(\"loadaiengineprogress\", {\n            source: this,\n            detail: {\n              total,\n              totalLoaded: loaded,\n              finished: loaded + increment >= end,\n            },\n          });\n          return;\n        }\n        clearInterval(id);\n        this.hasProgress = false;\n        this.enableAltTextModelDownload = true;\n        resolve(true);\n      }, 900);\n      return promise;\n    }\n\n    isReady(_name) {\n      return this.enableAltTextModelDownload;\n    }\n\n    guess({ request: { data } }) {\n      return new Promise(resolve => {\n        setTimeout(() => {\n          resolve(data ? { output: \"Fake alt text.\" } : { error: true });\n        }, 3000);\n      });\n    }\n\n    toggleService(_name, enabled) {\n      this.enableGuessAltText = enabled;\n    }\n  };\n}\n\nexport { ExternalServices, initCom, MLManager, Preferences };\n","/* Copyright 2024 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 { noContextMenu } from \"pdfjs-lib\";\n\nclass NewAltTextManager {\n  #boundCancel = this.#cancel.bind(this);\n\n  #createAutomaticallyButton;\n\n  #currentEditor = null;\n\n  #cancelButton;\n\n  #descriptionContainer;\n\n  #dialog;\n\n  #disclaimer;\n\n  #downloadModel;\n\n  #downloadModelDescription;\n\n  #eventBus;\n\n  #firstTime = false;\n\n  #guessedAltText;\n\n  #hasAI = null;\n\n  #isEditing = null;\n\n  #imagePreview;\n\n  #imageData;\n\n  #isAILoading = false;\n\n  #wasAILoading = false;\n\n  #learnMore;\n\n  #notNowButton;\n\n  #overlayManager;\n\n  #textarea;\n\n  #title;\n\n  #uiManager;\n\n  #previousAltText = null;\n\n  constructor(\n    {\n      descriptionContainer,\n      dialog,\n      imagePreview,\n      cancelButton,\n      disclaimer,\n      notNowButton,\n      saveButton,\n      textarea,\n      learnMore,\n      errorCloseButton,\n      createAutomaticallyButton,\n      downloadModel,\n      downloadModelDescription,\n      title,\n    },\n    overlayManager,\n    eventBus\n  ) {\n    this.#cancelButton = cancelButton;\n    this.#createAutomaticallyButton = createAutomaticallyButton;\n    this.#descriptionContainer = descriptionContainer;\n    this.#dialog = dialog;\n    this.#disclaimer = disclaimer;\n    this.#notNowButton = notNowButton;\n    this.#imagePreview = imagePreview;\n    this.#textarea = textarea;\n    this.#learnMore = learnMore;\n    this.#title = title;\n    this.#downloadModel = downloadModel;\n    this.#downloadModelDescription = downloadModelDescription;\n    this.#overlayManager = overlayManager;\n    this.#eventBus = eventBus;\n\n    dialog.addEventListener(\"close\", this.#close.bind(this));\n    dialog.addEventListener(\"contextmenu\", event => {\n      if (event.target !== this.#textarea) {\n        event.preventDefault();\n      }\n    });\n    cancelButton.addEventListener(\"click\", this.#boundCancel);\n    notNowButton.addEventListener(\"click\", this.#boundCancel);\n    saveButton.addEventListener(\"click\", this.#save.bind(this));\n    errorCloseButton.addEventListener(\"click\", () => {\n      this.#toggleError(false);\n    });\n    createAutomaticallyButton.addEventListener(\"click\", async () => {\n      const checked =\n        createAutomaticallyButton.getAttribute(\"aria-pressed\") !== \"true\";\n      this.#currentEditor._reportTelemetry({\n        action: \"pdfjs.image.alt_text.ai_generation_check\",\n        data: { status: checked },\n      });\n\n      if (this.#uiManager) {\n        const isAltTextEnabled =\n          await this.#uiManager.mlManager.isEnabledFor(\"altText\");\n        this.#createAutomaticallyButton.disabled = true;\n        if (checked && !isAltTextEnabled) {\n          this.#textarea.value = \"\";\n          this.#setProgress();\n          this.#uiManager.setPreference(\"enableGuessAltText\", true);\n          await this.#uiManager.mlManager.downloadModel(\"altText\");\n          this.#setPref(\"enableAltTextModelDownload\", true);\n        } else if (!checked && isAltTextEnabled) {\n          this.#uiManager.setPreference(\"enableGuessAltText\", false);\n          await this.#uiManager.mlManager.deleteModel(\"altText\");\n          this.#setPref(\"enableAltTextModelDownload\", false);\n        }\n        this.#createAutomaticallyButton.disabled = false;\n        await this.#uiManager.mlManager.toggleService(\"altText\", checked);\n      }\n      this.#toggleGuessAltText(checked, /* isInitial = */ false);\n    });\n    textarea.addEventListener(\"focus\", () => {\n      this.#wasAILoading = this.#isAILoading;\n      this.#toggleLoading(false);\n      this.#toggleTitleAndDisclaimer();\n    });\n    textarea.addEventListener(\"blur\", () => {\n      if (!textarea.value) {\n        this.#toggleLoading(this.#wasAILoading);\n      }\n      this.#toggleTitleAndDisclaimer();\n    });\n    textarea.addEventListener(\"input\", () => {\n      this.#toggleTitleAndDisclaimer();\n    });\n    textarea.addEventListener(\"keydown\", e => {\n      if (\n        (e.ctrlKey || e.metaKey) &&\n        e.key === \"Enter\" &&\n        !saveButton.disabled\n      ) {\n        this.#save();\n      }\n    });\n\n    eventBus._on(\"enableguessalttext\", ({ value }) => {\n      this.#toggleGuessAltText(value, /* isInitial = */ false);\n    });\n\n    this.#overlayManager.register(dialog);\n\n    this.#learnMore.addEventListener(\"click\", () => {\n      this.#currentEditor._reportTelemetry({\n        action: \"pdfjs.image.alt_text.info\",\n        data: { topic: \"alt_text\" },\n      });\n    });\n  }\n\n  #setPref(name, value) {\n    this.#eventBus.dispatch(\"setpreference\", {\n      source: this,\n      name,\n      value,\n    });\n  }\n\n  #toggleLoading(value) {\n    if (!this.#uiManager || this.#isAILoading === value) {\n      return;\n    }\n    this.#isAILoading = value;\n    this.#descriptionContainer.classList.toggle(\"loading\", value);\n  }\n\n  #toggleError(value) {\n    if (!this.#uiManager) {\n      return;\n    }\n    this.#dialog.classList.toggle(\"error\", value);\n  }\n\n  async #toggleGuessAltText(value, isInitial) {\n    if (!this.#uiManager) {\n      return;\n    }\n    this.#dialog.classList.toggle(\"aiDisabled\", !value);\n    this.#createAutomaticallyButton.setAttribute(\"aria-pressed\", value);\n\n    if (value) {\n      const { altTextLearnMoreUrl } = this.#uiManager.mlManager;\n      if (altTextLearnMoreUrl) {\n        this.#learnMore.href = altTextLearnMoreUrl;\n      }\n      this.#mlGuessAltText(isInitial);\n    } else {\n      this.#toggleLoading(false);\n      this.#isAILoading = false;\n      this.#toggleTitleAndDisclaimer();\n    }\n  }\n\n  #toggleNotNow() {\n    this.#notNowButton.classList.toggle(\"hidden\", !this.#firstTime);\n    this.#cancelButton.classList.toggle(\"hidden\", this.#firstTime);\n  }\n\n  #toggleAI(value) {\n    if (!this.#uiManager || this.#hasAI === value) {\n      return;\n    }\n    this.#hasAI = value;\n    this.#dialog.classList.toggle(\"noAi\", !value);\n    this.#toggleTitleAndDisclaimer();\n  }\n\n  #toggleTitleAndDisclaimer() {\n    // Disclaimer is visible when the AI is loading or the user didn't change\n    // the guessed alt text.\n    const visible =\n      this.#isAILoading ||\n      (this.#guessedAltText && this.#guessedAltText === this.#textarea.value);\n    this.#disclaimer.hidden = !visible;\n\n    // The title changes depending if the text area is empty or not.\n    const isEditing = this.#isAILoading || !!this.#textarea.value;\n    if (this.#isEditing === isEditing) {\n      return;\n    }\n    this.#isEditing = isEditing;\n    this.#title.setAttribute(\n      \"data-l10n-id\",\n      isEditing\n        ? \"pdfjs-editor-new-alt-text-dialog-edit-label\"\n        : \"pdfjs-editor-new-alt-text-dialog-add-label\"\n    );\n  }\n\n  async #mlGuessAltText(isInitial) {\n    if (this.#isAILoading) {\n      // We're still loading the previous guess.\n      return;\n    }\n\n    if (this.#textarea.value) {\n      // The user has already set an alt text.\n      return;\n    }\n\n    if (isInitial && this.#previousAltText !== null) {\n      // The user has already set an alt text (empty or not).\n      return;\n    }\n\n    this.#guessedAltText = this.#currentEditor.guessedAltText;\n    if (this.#previousAltText === null && this.#guessedAltText) {\n      // We have a guessed alt text and the user didn't change it.\n      this.#addAltText(this.#guessedAltText);\n      return;\n    }\n\n    this.#toggleLoading(true);\n    this.#toggleTitleAndDisclaimer();\n\n    let hasError = false;\n    try {\n      // When calling #mlGuessAltText we don't wait for it, so we must take care\n      // that the alt text dialog can have been closed before the response is.\n\n      const altText = await this.#currentEditor.mlGuessAltText(\n        this.#imageData,\n        /* updateAltTextData = */ false\n      );\n      if (altText) {\n        this.#guessedAltText = altText;\n        this.#wasAILoading = this.#isAILoading;\n        if (this.#isAILoading) {\n          this.#addAltText(altText);\n        }\n      }\n    } catch (e) {\n      console.error(e);\n      hasError = true;\n    }\n\n    this.#toggleLoading(false);\n    this.#toggleTitleAndDisclaimer();\n\n    if (hasError && this.#uiManager) {\n      this.#toggleError(true);\n    }\n  }\n\n  #addAltText(altText) {\n    if (!this.#uiManager || this.#textarea.value) {\n      return;\n    }\n    this.#textarea.value = altText;\n    this.#toggleTitleAndDisclaimer();\n  }\n\n  #setProgress() {\n    // Show the download model progress.\n    this.#downloadModel.classList.toggle(\"hidden\", false);\n\n    const callback = async ({ detail: { finished, total, totalLoaded } }) => {\n      const ONE_MEGA_BYTES = 1e6;\n      // totalLoaded can be greater than total if the download is compressed.\n      // So we cheat to avoid any confusion.\n      totalLoaded = Math.min(0.99 * total, totalLoaded);\n\n      // Update the progress.\n      const totalSize = (this.#downloadModelDescription.ariaValueMax =\n        Math.round(total / ONE_MEGA_BYTES));\n      const downloadedSize = (this.#downloadModelDescription.ariaValueNow =\n        Math.round(totalLoaded / ONE_MEGA_BYTES));\n      this.#downloadModelDescription.setAttribute(\n        \"data-l10n-args\",\n        JSON.stringify({ totalSize, downloadedSize })\n      );\n      if (!finished) {\n        return;\n      }\n\n      // We're done, remove the listener and hide the download model progress.\n      this.#eventBus._off(\"loadaiengineprogress\", callback);\n      this.#downloadModel.classList.toggle(\"hidden\", true);\n\n      this.#toggleAI(true);\n      if (!this.#uiManager) {\n        return;\n      }\n      const { mlManager } = this.#uiManager;\n\n      // The model has been downloaded, we can now enable the AI service.\n      mlManager.toggleService(\"altText\", true);\n      this.#toggleGuessAltText(\n        await mlManager.isEnabledFor(\"altText\"),\n        /* isInitial = */ true\n      );\n    };\n    this.#eventBus._on(\"loadaiengineprogress\", callback);\n  }\n\n  async editAltText(uiManager, editor, firstTime) {\n    if (this.#currentEditor || !editor) {\n      return;\n    }\n\n    if (firstTime && editor.hasAltTextData()) {\n      editor.altTextFinish();\n      return;\n    }\n\n    this.#firstTime = firstTime;\n    const { mlManager } = uiManager;\n    const hasAI = !!mlManager;\n    this.#toggleTitleAndDisclaimer();\n\n    if (mlManager && !mlManager.isReady(\"altText\")) {\n      if (mlManager.hasProgress) {\n        this.#setProgress();\n      } else {\n        this.#createAutomaticallyButton.setAttribute(\"aria-pressed\", false);\n      }\n    } else {\n      this.#downloadModel.classList.toggle(\"hidden\", true);\n    }\n\n    const isAltTextEnabledPromise = mlManager?.isEnabledFor(\"altText\");\n\n    this.#currentEditor = editor;\n    this.#uiManager = uiManager;\n    this.#uiManager.removeEditListeners();\n\n    ({ altText: this.#previousAltText } = editor.altTextData);\n    this.#textarea.value = this.#previousAltText ?? \"\";\n\n    // TODO: get this value from Firefox\n    //   (https://bugzilla.mozilla.org/show_bug.cgi?id=1908184)\n    const AI_MAX_IMAGE_DIMENSION = 224;\n    const MAX_PREVIEW_DIMENSION = 180;\n\n    // The max dimension of the preview in the dialog is 180px, so we keep 224px\n    // and rescale it thanks to css.\n\n    let canvas, width, height;\n    if (mlManager) {\n      ({\n        canvas,\n        width,\n        height,\n        imageData: this.#imageData,\n      } = editor.copyCanvas(\n        AI_MAX_IMAGE_DIMENSION,\n        MAX_PREVIEW_DIMENSION,\n        /* createImageData = */ true\n      ));\n      if (hasAI) {\n        this.#toggleGuessAltText(\n          await isAltTextEnabledPromise,\n          /* isInitial = */ true\n        );\n      }\n    } else {\n      ({ canvas, width, height } = editor.copyCanvas(\n        AI_MAX_IMAGE_DIMENSION,\n        MAX_PREVIEW_DIMENSION,\n        /* createImageData = */ false\n      ));\n    }\n\n    canvas.setAttribute(\"role\", \"presentation\");\n    const { style } = canvas;\n    style.width = `${width}px`;\n    style.height = `${height}px`;\n    this.#imagePreview.append(canvas);\n\n    this.#toggleNotNow();\n    this.#toggleAI(hasAI);\n    this.#toggleError(false);\n\n    try {\n      await this.#overlayManager.open(this.#dialog);\n    } catch (ex) {\n      this.#close();\n      throw ex;\n    }\n  }\n\n  #cancel() {\n    this.#currentEditor.altTextData = {\n      cancel: true,\n    };\n    const altText = this.#textarea.value.trim();\n    this.#currentEditor._reportTelemetry({\n      action: \"pdfjs.image.alt_text.dismiss\",\n      data: {\n        alt_text_type: altText ? \"present\" : \"empty\",\n        flow: this.#firstTime ? \"image_add\" : \"alt_text_edit\",\n      },\n    });\n    this.#currentEditor._reportTelemetry({\n      action: \"pdfjs.image.image_added\",\n      data: { alt_text_modal: true, alt_text_type: \"skipped\" },\n    });\n    this.#finish();\n  }\n\n  #finish() {\n    this.#overlayManager.closeIfActive(this.#dialog);\n  }\n\n  #close() {\n    const canvas = this.#imagePreview.firstElementChild;\n    canvas.remove();\n    canvas.width = canvas.height = 0;\n    this.#imageData = null;\n\n    this.#toggleLoading(false);\n\n    this.#uiManager?.addEditListeners();\n    this.#currentEditor.altTextFinish();\n    this.#uiManager?.setSelected(this.#currentEditor);\n    this.#currentEditor = null;\n    this.#uiManager = null;\n  }\n\n  #extractWords(text) {\n    return new Set(\n      text\n        .toLowerCase()\n        .split(/[^\\p{L}\\p{N}]+/gu)\n        .filter(x => !!x)\n    );\n  }\n\n  #save() {\n    const altText = this.#textarea.value.trim();\n    this.#currentEditor.altTextData = {\n      altText,\n      decorative: false,\n    };\n    this.#currentEditor.altTextData.guessedAltText = this.#guessedAltText;\n\n    if (this.#guessedAltText && this.#guessedAltText !== altText) {\n      const guessedWords = this.#extractWords(this.#guessedAltText);\n      const words = this.#extractWords(altText);\n      this.#currentEditor._reportTelemetry({\n        action: \"pdfjs.image.alt_text.user_edit\",\n        data: {\n          total_words: guessedWords.size,\n          words_removed: guessedWords.difference(words).size,\n          words_added: words.difference(guessedWords).size,\n        },\n      });\n    }\n    this.#currentEditor._reportTelemetry({\n      action: \"pdfjs.image.image_added\",\n      data: {\n        alt_text_modal: true,\n        alt_text_type: altText ? \"present\" : \"empty\",\n      },\n    });\n\n    this.#currentEditor._reportTelemetry({\n      action: \"pdfjs.image.alt_text.save\",\n      data: {\n        alt_text_type: altText ? \"present\" : \"empty\",\n        flow: this.#firstTime ? \"image_add\" : \"alt_text_edit\",\n      },\n    });\n\n    this.#finish();\n  }\n\n  destroy() {\n    this.#uiManager = null; // Avoid re-adding the edit listeners.\n    this.#finish();\n  }\n}\n\nclass ImageAltTextSettings {\n  #createModelButton;\n\n  #dialog;\n\n  #eventBus;\n\n  #mlManager;\n\n  #overlayManager;\n\n  #showAltTextDialogButton;\n\n  constructor(\n    {\n      dialog,\n      createModelButton,\n      learnMore,\n      closeButton,\n      showAltTextDialogButton,\n    },\n    overlayManager,\n    eventBus,\n    mlManager\n  ) {\n    this.#dialog = dialog;\n    this.#createModelButton = createModelButton;\n    this.#showAltTextDialogButton = showAltTextDialogButton;\n    this.#overlayManager = overlayManager;\n    this.#eventBus = eventBus;\n    this.#mlManager = mlManager;\n\n    const { altTextLearnMoreUrl } = mlManager;\n    if (altTextLearnMoreUrl) {\n      learnMore.href = altTextLearnMoreUrl;\n    }\n\n    dialog.addEventListener(\"contextmenu\", noContextMenu);\n\n    createModelButton.addEventListener(\"click\", async e => {\n      const checked = this.#togglePref(\"enableGuessAltText\", e);\n      await (checked ? this.#download(true) : this.#delete(true));\n      await mlManager.toggleService(\"altText\", checked);\n      this.#reportTelemetry({\n        type: \"stamp\",\n        action: \"pdfjs.image.alt_text.settings_ai_generation_check\",\n        data: { status: checked },\n      });\n    });\n\n    showAltTextDialogButton.addEventListener(\"click\", e => {\n      const checked = this.#togglePref(\"enableNewAltTextWhenAddingImage\", e);\n      this.#reportTelemetry({\n        type: \"stamp\",\n        action: \"pdfjs.image.alt_text.settings_edit_alt_text_check\",\n        data: { status: checked },\n      });\n    });\n\n    closeButton.addEventListener(\"click\", this.#finish.bind(this));\n\n    learnMore.addEventListener(\"click\", () => {\n      this.#reportTelemetry({\n        type: \"stamp\",\n        action: \"pdfjs.image.alt_text.info\",\n        data: { topic: \"ai_generation\" },\n      });\n    });\n\n    eventBus._on(\"enablealttextmodeldownload\", ({ value }) => {\n      if (value) {\n        this.#download(false);\n      } else {\n        this.#delete(false);\n      }\n    });\n\n    this.#overlayManager.register(dialog);\n  }\n\n  #reportTelemetry(data) {\n    this.#eventBus.dispatch(\"reporttelemetry\", {\n      source: this,\n      details: {\n        type: \"editing\",\n        data,\n      },\n    });\n  }\n\n  async #download(isFromUI = false) {\n    if (isFromUI) {\n      await this.#mlManager.downloadModel(\"altText\");\n\n      this.#setPref(\"enableGuessAltText\", true);\n      this.#mlManager.toggleService(\"altText\", true);\n      this.#setPref(\"enableAltTextModelDownload\", true);\n    }\n  }\n\n  async #delete(isFromUI = false) {\n    if (isFromUI) {\n      await this.#mlManager.deleteModel(\"altText\");\n      this.#setPref(\"enableGuessAltText\", false);\n      this.#setPref(\"enableAltTextModelDownload\", false);\n    }\n\n    this.#createModelButton.setAttribute(\"aria-pressed\", false);\n  }\n\n  async open({ enableGuessAltText, enableNewAltTextWhenAddingImage }) {\n    const { enableAltTextModelDownload } = this.#mlManager;\n    this.#createModelButton.setAttribute(\n      \"aria-pressed\",\n      enableAltTextModelDownload && enableGuessAltText\n    );\n    this.#showAltTextDialogButton.setAttribute(\n      \"aria-pressed\",\n      enableNewAltTextWhenAddingImage\n    );\n\n    await this.#overlayManager.open(this.#dialog);\n    this.#reportTelemetry({\n      type: \"stamp\",\n      action: \"pdfjs.image.alt_text.settings_displayed\",\n    });\n  }\n\n  #togglePref(name, { target }) {\n    const checked = target.getAttribute(\"aria-pressed\") !== \"true\";\n    this.#setPref(name, checked);\n    target.setAttribute(\"aria-pressed\", checked);\n    return checked;\n  }\n\n  #setPref(name, value) {\n    this.#eventBus.dispatch(\"setpreference\", {\n      source: this,\n      name,\n      value,\n    });\n  }\n\n  #finish() {\n    this.#overlayManager.closeIfActive(this.#dialog);\n  }\n}\n\nexport { ImageAltTextSettings, NewAltTextManager };\n","/* Copyright 2023 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 { DOMSVGFactory } from \"pdfjs-lib\";\n\nclass AltTextManager {\n  #clickAC = null;\n\n  #currentEditor = null;\n\n  #cancelButton;\n\n  #dialog;\n\n  #eventBus;\n\n  #hasUsedPointer = false;\n\n  #optionDescription;\n\n  #optionDecorative;\n\n  #overlayManager;\n\n  #saveButton;\n\n  #textarea;\n\n  #uiManager;\n\n  #previousAltText = null;\n\n  #resizeAC = null;\n\n  #svgElement = null;\n\n  #rectElement = null;\n\n  #container;\n\n  #telemetryData = null;\n\n  constructor(\n    {\n      dialog,\n      optionDescription,\n      optionDecorative,\n      textarea,\n      cancelButton,\n      saveButton,\n    },\n    container,\n    overlayManager,\n    eventBus\n  ) {\n    this.#dialog = dialog;\n    this.#optionDescription = optionDescription;\n    this.#optionDecorative = optionDecorative;\n    this.#textarea = textarea;\n    this.#cancelButton = cancelButton;\n    this.#saveButton = saveButton;\n    this.#overlayManager = overlayManager;\n    this.#eventBus = eventBus;\n    this.#container = container;\n\n    const onUpdateUIState = this.#updateUIState.bind(this);\n\n    dialog.addEventListener(\"close\", this.#close.bind(this));\n    dialog.addEventListener(\"contextmenu\", event => {\n      if (event.target !== this.#textarea) {\n        event.preventDefault();\n      }\n    });\n    cancelButton.addEventListener(\"click\", this.#finish.bind(this));\n    saveButton.addEventListener(\"click\", this.#save.bind(this));\n    optionDescription.addEventListener(\"change\", onUpdateUIState);\n    optionDecorative.addEventListener(\"change\", onUpdateUIState);\n    textarea.addEventListener(\"keydown\", e => {\n      if (\n        (e.ctrlKey || e.metaKey) &&\n        e.key === \"Enter\" &&\n        !saveButton.disabled\n      ) {\n        this.#save();\n      }\n    });\n\n    this.#overlayManager.register(dialog);\n  }\n\n  #createSVGElement() {\n    if (this.#svgElement) {\n      return;\n    }\n\n    // We create a mask to add to the dialog backdrop: the idea is to have a\n    // darken background everywhere except on the editor to clearly see the\n    // picture to describe.\n\n    const svgFactory = new DOMSVGFactory();\n    const svg = (this.#svgElement = svgFactory.createElement(\"svg\"));\n    svg.setAttribute(\"width\", \"0\");\n    svg.setAttribute(\"height\", \"0\");\n    const defs = svgFactory.createElement(\"defs\");\n    svg.append(defs);\n    const mask = svgFactory.createElement(\"mask\");\n    defs.append(mask);\n    mask.setAttribute(\"id\", \"alttext-manager-mask\");\n    mask.setAttribute(\"maskContentUnits\", \"objectBoundingBox\");\n    let rect = svgFactory.createElement(\"rect\");\n    mask.append(rect);\n    rect.setAttribute(\"fill\", \"white\");\n    rect.setAttribute(\"width\", \"1\");\n    rect.setAttribute(\"height\", \"1\");\n    rect.setAttribute(\"x\", \"0\");\n    rect.setAttribute(\"y\", \"0\");\n\n    rect = this.#rectElement = svgFactory.createElement(\"rect\");\n    mask.append(rect);\n    rect.setAttribute(\"fill\", \"black\");\n    this.#dialog.append(svg);\n  }\n\n  async editAltText(uiManager, editor) {\n    if (this.#currentEditor || !editor) {\n      return;\n    }\n    this.#createSVGElement();\n\n    this.#hasUsedPointer = false;\n\n    this.#clickAC = new AbortController();\n    const clickOpts = { signal: this.#clickAC.signal },\n      onClick = this.#onClick.bind(this);\n    for (const element of [\n      this.#optionDescription,\n      this.#optionDecorative,\n      this.#textarea,\n      this.#saveButton,\n      this.#cancelButton,\n    ]) {\n      element.addEventListener(\"click\", onClick, clickOpts);\n    }\n\n    const { altText, decorative } = editor.altTextData;\n    if (decorative === true) {\n      this.#optionDecorative.checked = true;\n      this.#optionDescription.checked = false;\n    } else {\n      this.#optionDecorative.checked = false;\n      this.#optionDescription.checked = true;\n    }\n    this.#previousAltText = this.#textarea.value = altText?.trim() || \"\";\n    this.#updateUIState();\n\n    this.#currentEditor = editor;\n    this.#uiManager = uiManager;\n    this.#uiManager.removeEditListeners();\n\n    this.#resizeAC = new AbortController();\n    this.#eventBus._on(\"resize\", this.#setPosition.bind(this), {\n      signal: this.#resizeAC.signal,\n    });\n\n    try {\n      await this.#overlayManager.open(this.#dialog);\n      this.#setPosition();\n    } catch (ex) {\n      this.#close();\n      throw ex;\n    }\n  }\n\n  #setPosition() {\n    if (!this.#currentEditor) {\n      return;\n    }\n    const dialog = this.#dialog;\n    const { style } = dialog;\n    const {\n      x: containerX,\n      y: containerY,\n      width: containerW,\n      height: containerH,\n    } = this.#container.getBoundingClientRect();\n    const { innerWidth: windowW, innerHeight: windowH } = window;\n    const { width: dialogW, height: dialogH } = dialog.getBoundingClientRect();\n    const { x, y, width, height } = this.#currentEditor.getClientDimensions();\n    const MARGIN = 10;\n    const isLTR = this.#uiManager.direction === \"ltr\";\n\n    const xs = Math.max(x, containerX);\n    const xe = Math.min(x + width, containerX + containerW);\n    const ys = Math.max(y, containerY);\n    const ye = Math.min(y + height, containerY + containerH);\n    this.#rectElement.setAttribute(\"width\", `${(xe - xs) / windowW}`);\n    this.#rectElement.setAttribute(\"height\", `${(ye - ys) / windowH}`);\n    this.#rectElement.setAttribute(\"x\", `${xs / windowW}`);\n    this.#rectElement.setAttribute(\"y\", `${ys / windowH}`);\n\n    let left = null;\n    let top = Math.max(y, 0);\n    top += Math.min(windowH - (top + dialogH), 0);\n\n    if (isLTR) {\n      // Prefer to position the dialog \"after\" (so on the right) the editor.\n      if (x + width + MARGIN + dialogW < windowW) {\n        left = x + width + MARGIN;\n      } else if (x > dialogW + MARGIN) {\n        left = x - dialogW - MARGIN;\n      }\n    } else if (x > dialogW + MARGIN) {\n      left = x - dialogW - MARGIN;\n    } else if (x + width + MARGIN + dialogW < windowW) {\n      left = x + width + MARGIN;\n    }\n\n    if (left === null) {\n      top = null;\n      left = Math.max(x, 0);\n      left += Math.min(windowW - (left + dialogW), 0);\n      if (y > dialogH + MARGIN) {\n        top = y - dialogH - MARGIN;\n      } else if (y + height + MARGIN + dialogH < windowH) {\n        top = y + height + MARGIN;\n      }\n    }\n\n    if (top !== null) {\n      dialog.classList.add(\"positioned\");\n      if (isLTR) {\n        style.left = `${left}px`;\n      } else {\n        style.right = `${windowW - left - dialogW}px`;\n      }\n      style.top = `${top}px`;\n    } else {\n      dialog.classList.remove(\"positioned\");\n      style.left = \"\";\n      style.top = \"\";\n    }\n  }\n\n  #finish() {\n    this.#overlayManager.closeIfActive(this.#dialog);\n  }\n\n  #close() {\n    this.#currentEditor._reportTelemetry(\n      this.#telemetryData || {\n        action: \"alt_text_cancel\",\n        alt_text_keyboard: !this.#hasUsedPointer,\n      }\n    );\n    this.#telemetryData = null;\n\n    this.#removeOnClickListeners();\n    this.#uiManager?.addEditListeners();\n    this.#resizeAC?.abort();\n    this.#resizeAC = null;\n    this.#currentEditor.altTextFinish();\n    this.#currentEditor = null;\n    this.#uiManager = null;\n  }\n\n  #updateUIState() {\n    this.#textarea.disabled = this.#optionDecorative.checked;\n  }\n\n  #save() {\n    const altText = this.#textarea.value.trim();\n    const decorative = this.#optionDecorative.checked;\n    this.#currentEditor.altTextData = {\n      altText,\n      decorative,\n    };\n    this.#telemetryData = {\n      action: \"alt_text_save\",\n      alt_text_description: !!altText,\n      alt_text_edit:\n        !!this.#previousAltText && this.#previousAltText !== altText,\n      alt_text_decorative: decorative,\n      alt_text_keyboard: !this.#hasUsedPointer,\n    };\n    this.#finish();\n  }\n\n  #onClick(evt) {\n    if (evt.detail === 0) {\n      return; // The keyboard was used.\n    }\n    this.#hasUsedPointer = true;\n    this.#removeOnClickListeners();\n  }\n\n  #removeOnClickListeners() {\n    this.#clickAC?.abort();\n    this.#clickAC = null;\n  }\n\n  destroy() {\n    this.#uiManager = null; // Avoid re-adding the edit listeners.\n    this.#finish();\n    this.#svgElement?.remove();\n    this.#svgElement = this.#rectElement = null;\n  }\n}\n\nexport { AltTextManager };\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(\"./event_utils.js\").EventBus} EventBus */\n\nimport {\n  AnnotationEditorParamsType,\n  FeatureTest,\n  getRGBA,\n  Util,\n} from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} AnnotationEditorParamsOptions\n * @property {HTMLInputElement} editorFreeTextFontSize\n * @property {HTMLInputElement} editorFreeTextColor\n * @property {HTMLInputElement} editorInkColor\n * @property {HTMLInputElement} editorInkThickness\n * @property {HTMLInputElement} editorInkOpacity\n * @property {HTMLButtonElement} editorStampAddImage\n * @property {HTMLInputElement} editorFreeHighlightThickness\n * @property {HTMLButtonElement} editorHighlightShowAll\n * @property {HTMLButtonElement} editorSignatureAddSignature\n */\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  /**\n   * @param {AnnotationEditorParamsOptions} options\n   */\n  #bindListeners({\n    editorFreeTextFontSize,\n    editorFreeTextColor,\n    editorInkColor,\n    editorInkThickness,\n    editorInkOpacity,\n    editorStampAddImage,\n    editorFreeHighlightThickness,\n    editorHighlightShowAll,\n    editorSignatureAddSignature,\n  }) {\n    const { eventBus } = this;\n\n    const dispatchEvent = (typeStr, value) => {\n      eventBus.dispatch(\"switchannotationeditorparams\", {\n        source: this,\n        type: AnnotationEditorParamsType[typeStr],\n        value,\n      });\n    };\n    editorFreeTextFontSize.addEventListener(\"input\", function () {\n      dispatchEvent(\"FREETEXT_SIZE\", this.valueAsNumber);\n    });\n    editorFreeTextColor.addEventListener(\"input\", function () {\n      dispatchEvent(\"FREETEXT_COLOR\", this.value);\n    });\n\n    // Handlers for INK_COLOR and INK_OPACITY sync-back, set up differently\n    // depending on whether alpha is supported.\n    let updateInkColor, updateInkOpacity;\n\n    if (FeatureTest.isAlphaColorInputSupported) {\n      // Enable alpha on the color input and remove the now-redundant opacity\n      // slider from the DOM.\n      editorInkColor.setAttribute(\"alpha\", \"\");\n      editorInkOpacity.closest(\".editorParamsSetter\").remove();\n\n      // Track last-known color/opacity so that sync-back events for either\n      // property can reconstruct the full #RRGGBBAA without re-parsing the\n      // input's current (format-varying) value.\n      let currentInkColor = \"#000000\";\n      let currentInkOpacity = 1;\n\n      editorInkColor.addEventListener(\"input\", function () {\n        // The returned value format varies by browser; normalize it.\n        const rgba = getRGBA(this.value);\n        if (!rgba) {\n          return;\n        }\n        const [r, g, b, opacity] = rgba;\n        const hex = Util.makeHexColor(r, g, b);\n        currentInkColor = hex;\n        currentInkOpacity = opacity;\n        dispatchEvent(\"INK_COLOR_AND_OPACITY\", { color: hex, opacity });\n      });\n\n      updateInkColor = value => {\n        currentInkColor = value;\n        const alphaHex = Util.hexNums[Math.round(currentInkOpacity * 255)];\n        editorInkColor.value = currentInkColor + alphaHex;\n      };\n      updateInkOpacity = value => {\n        currentInkOpacity = value;\n        const alphaHex = Util.hexNums[Math.round(currentInkOpacity * 255)];\n        editorInkColor.value = currentInkColor + alphaHex;\n      };\n    } else {\n      editorInkColor.addEventListener(\"input\", function () {\n        dispatchEvent(\"INK_COLOR\", this.value);\n      });\n      editorInkOpacity.addEventListener(\"input\", function () {\n        dispatchEvent(\"INK_OPACITY\", this.valueAsNumber);\n      });\n\n      updateInkColor = value => {\n        editorInkColor.value = value;\n      };\n      updateInkOpacity = value => {\n        editorInkOpacity.value = value;\n      };\n    }\n\n    editorInkThickness.addEventListener(\"input\", function () {\n      dispatchEvent(\"INK_THICKNESS\", this.valueAsNumber);\n    });\n    editorStampAddImage.addEventListener(\"click\", () => {\n      eventBus.dispatch(\"reporttelemetry\", {\n        source: this,\n        details: {\n          type: \"editing\",\n          data: { action: \"pdfjs.image.add_image_click\" },\n        },\n      });\n      dispatchEvent(\"CREATE\");\n    });\n    editorFreeHighlightThickness.addEventListener(\"input\", function () {\n      dispatchEvent(\"HIGHLIGHT_THICKNESS\", this.valueAsNumber);\n    });\n    editorHighlightShowAll.addEventListener(\"click\", function () {\n      const checked = this.getAttribute(\"aria-pressed\") === \"true\";\n      this.setAttribute(\"aria-pressed\", !checked);\n      dispatchEvent(\"HIGHLIGHT_SHOW_ALL\", !checked);\n    });\n    editorSignatureAddSignature.addEventListener(\"click\", () => {\n      dispatchEvent(\"CREATE\");\n    });\n\n    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            updateInkColor(value);\n            break;\n          case AnnotationEditorParamsType.INK_THICKNESS:\n            editorInkThickness.value = value;\n            break;\n          case AnnotationEditorParamsType.INK_OPACITY:\n            updateInkOpacity(value);\n            break;\n          case AnnotationEditorParamsType.HIGHLIGHT_COLOR:\n            eventBus.dispatch(\"mainhighlightcolorpickerupdatecolor\", {\n              source: this,\n              value,\n            });\n            break;\n          case AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:\n            editorFreeHighlightThickness.value = value;\n            break;\n          case AnnotationEditorParamsType.HIGHLIGHT_FREE:\n            editorFreeHighlightThickness.disabled = !value;\n            break;\n          case AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:\n            editorHighlightShowAll.setAttribute(\"aria-pressed\", value);\n            break;\n        }\n      }\n    });\n  }\n}\n\nexport { AnnotationEditorParams };\n","/* Copyright 2024 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// Used to compare floats: there is no exact equality due to rounding errors.\nconst PRECISION = 1e-1;\n\nclass CaretBrowsingMode {\n  #mainContainer;\n\n  #toolBarHeight = 0;\n\n  #viewerContainer;\n\n  constructor(abortSignal, mainContainer, viewerContainer, toolbarContainer) {\n    this.#mainContainer = mainContainer;\n    this.#viewerContainer = viewerContainer;\n\n    if (!toolbarContainer) {\n      return;\n    }\n    this.#toolBarHeight = toolbarContainer.getBoundingClientRect().height;\n\n    const toolbarObserver = new ResizeObserver(entries => {\n      for (const entry of entries) {\n        if (entry.target === toolbarContainer) {\n          this.#toolBarHeight = Math.floor(entry.borderBoxSize[0].blockSize);\n          break;\n        }\n      }\n    });\n    toolbarObserver.observe(toolbarContainer);\n\n    abortSignal.addEventListener(\"abort\", () => toolbarObserver.disconnect(), {\n      once: true,\n    });\n  }\n\n  /**\n   * Return true if the two rectangles are on the same line.\n   * @param {DOMRect} rect1\n   * @param {DOMRect} rect2\n   * @returns {boolean}\n   */\n  #isOnSameLine(rect1, rect2) {\n    const top1 = rect1.y;\n    const bot1 = rect1.bottom;\n    const mid1 = rect1.y + rect1.height / 2;\n\n    const top2 = rect2.y;\n    const bot2 = rect2.bottom;\n    const mid2 = rect2.y + rect2.height / 2;\n\n    return (top1 <= mid2 && mid2 <= bot1) || (top2 <= mid1 && mid1 <= bot2);\n  }\n\n  /**\n   * Return `true` if the rectangle is:\n   *  - under the caret when `isUp === false`.\n   *  - over the caret when `isUp === true`.\n   * @param {DOMRect} rect\n   * @param {number} x\n   * @param {number} y\n   * @param {boolean} isUp\n   * @returns {boolean}\n   */\n  #isUnderOver(rect, x, y, isUp) {\n    const midY = rect.y + rect.height / 2;\n    return (\n      (isUp ? y >= midY : y <= midY) &&\n      rect.x - PRECISION <= x &&\n      x <= rect.right + PRECISION\n    );\n  }\n\n  /**\n   * Check if the rectangle is visible.\n   * @param {DOMRect} rect\n   * @returns {boolean}\n   */\n  #isVisible(rect) {\n    return (\n      rect.top >= this.#toolBarHeight &&\n      rect.left >= 0 &&\n      rect.bottom <=\n        (window.innerHeight || document.documentElement.clientHeight) &&\n      rect.right <= (window.innerWidth || document.documentElement.clientWidth)\n    );\n  }\n\n  /**\n   * Get the position of the caret.\n   * @param {Selection} selection\n   * @param {boolean} isUp\n   * @returns {Array<number>}\n   */\n  #getCaretPosition(selection, isUp) {\n    const { focusNode, focusOffset } = selection;\n    const range = document.createRange();\n    range.setStart(focusNode, focusOffset);\n    range.setEnd(focusNode, focusOffset);\n    const rect = range.getBoundingClientRect();\n\n    return [rect.x, isUp ? rect.top : rect.bottom];\n  }\n\n  static #caretPositionFromPoint(x, y) {\n    if (\n      (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n      !document.caretPositionFromPoint\n    ) {\n      const { startContainer: offsetNode, startOffset: offset } =\n        document.caretRangeFromPoint(x, y);\n      return { offsetNode, offset };\n    }\n    return document.caretPositionFromPoint(x, y);\n  }\n\n  #setCaretPositionHelper(selection, caretX, select, element, rect) {\n    rect ||= element.getBoundingClientRect();\n    if (caretX <= rect.x + PRECISION) {\n      if (select) {\n        selection.extend(element.firstChild, 0);\n      } else {\n        selection.setPosition(element.firstChild, 0);\n      }\n      return;\n    }\n    if (rect.right - PRECISION <= caretX) {\n      const { lastChild } = element;\n      if (select) {\n        selection.extend(lastChild, lastChild.length);\n      } else {\n        selection.setPosition(lastChild, lastChild.length);\n      }\n      return;\n    }\n\n    const midY = rect.y + rect.height / 2;\n    let caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);\n    let parentElement = caretPosition.offsetNode?.parentElement;\n    if (parentElement && parentElement !== element) {\n      // There is an element on top of the one in the text layer, so we\n      // need to hide all the elements (except the one in the text layer)\n      // at this position in order to get the correct caret position.\n      const elementsAtPoint = document.elementsFromPoint(caretX, midY);\n      const savedVisibilities = [];\n      for (const el of elementsAtPoint) {\n        if (el === element) {\n          break;\n        }\n        const { style } = el;\n        savedVisibilities.push([el, style.visibility]);\n        style.visibility = \"hidden\";\n      }\n      caretPosition = CaretBrowsingMode.#caretPositionFromPoint(caretX, midY);\n      parentElement = caretPosition.offsetNode?.parentElement;\n      for (const [el, visibility] of savedVisibilities) {\n        el.style.visibility = visibility;\n      }\n    }\n    if (parentElement !== element) {\n      // The element targeted by caretPositionFromPoint isn't in the text\n      // layer.\n      if (select) {\n        selection.extend(element.firstChild, 0);\n      } else {\n        selection.setPosition(element.firstChild, 0);\n      }\n      return;\n    }\n    if (select) {\n      selection.extend(caretPosition.offsetNode, caretPosition.offset);\n    } else {\n      selection.setPosition(caretPosition.offsetNode, caretPosition.offset);\n    }\n  }\n\n  /**\n   * Set the caret position or extend the selection (it depends on the select\n   * parameter).\n   * @param {boolean} select\n   * @param {Selection} selection\n   * @param {Element} newLineElement\n   * @param {DOMRect} newLineElementRect\n   * @param {number} caretX\n   */\n  #setCaretPosition(\n    select,\n    selection,\n    newLineElement,\n    newLineElementRect,\n    caretX\n  ) {\n    if (this.#isVisible(newLineElementRect)) {\n      this.#setCaretPositionHelper(\n        selection,\n        caretX,\n        select,\n        newLineElement,\n        newLineElementRect\n      );\n      return;\n    }\n    this.#mainContainer.addEventListener(\n      \"scrollend\",\n      this.#setCaretPositionHelper.bind(\n        this,\n        selection,\n        caretX,\n        select,\n        newLineElement,\n        null\n      ),\n      { once: true }\n    );\n    newLineElement.scrollIntoView();\n  }\n\n  /**\n   * Get the node on the next page.\n   * @param {Element} textLayer\n   * @param {boolean} isUp\n   * @returns {Node}\n   */\n  #getNodeOnNextPage(textLayer, isUp) {\n    while (true) {\n      const page = textLayer.closest(\".page\");\n      const pageNumber = parseInt(page.getAttribute(\"data-page-number\"), 10);\n      const nextPage = isUp ? pageNumber - 1 : pageNumber + 1;\n      textLayer = this.#viewerContainer.querySelector(\n        `.page[data-page-number=\"${nextPage}\"] .textLayer`\n      );\n      if (!textLayer) {\n        return null;\n      }\n      const walker = document.createTreeWalker(textLayer, NodeFilter.SHOW_TEXT);\n      const node = isUp ? walker.lastChild() : walker.firstChild();\n      if (node) {\n        return node;\n      }\n    }\n  }\n\n  /**\n   * Move the caret in the given direction.\n   * @param {boolean} isUp\n   * @param {boolean} select\n   */\n  moveCaret(isUp, select) {\n    const selection = document.getSelection();\n    if (selection.rangeCount === 0) {\n      return;\n    }\n    const { focusNode } = selection;\n    const focusElement =\n      focusNode.nodeType !== Node.ELEMENT_NODE\n        ? focusNode.parentElement\n        : focusNode;\n    const root = focusElement.closest(\".textLayer\");\n    if (!root) {\n      return;\n    }\n    const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n    walker.currentNode = focusNode;\n\n    // Move to the next element which is not on the same line as the focus\n    // element.\n    const focusRect = focusElement.getBoundingClientRect();\n    let newLineElement = null;\n    const nodeIterator = (\n      isUp ? walker.previousSibling : walker.nextSibling\n    ).bind(walker);\n    while (nodeIterator()) {\n      const element = walker.currentNode.parentElement;\n      if (!this.#isOnSameLine(focusRect, element.getBoundingClientRect())) {\n        newLineElement = element;\n        break;\n      }\n    }\n\n    if (!newLineElement) {\n      // Need to find the next line on the next page.\n      const node = this.#getNodeOnNextPage(root, isUp);\n      if (!node) {\n        return;\n      }\n      if (select) {\n        const lastNode =\n          (isUp ? walker.firstChild() : walker.lastChild()) || focusNode;\n        selection.extend(lastNode, isUp ? 0 : lastNode.length);\n        const range = document.createRange();\n        range.setStart(node, isUp ? node.length : 0);\n        range.setEnd(node, isUp ? node.length : 0);\n        selection.addRange(range);\n        return;\n      }\n      const [caretX] = this.#getCaretPosition(selection, isUp);\n      const { parentElement } = node;\n      this.#setCaretPosition(\n        select,\n        selection,\n        parentElement,\n        parentElement.getBoundingClientRect(),\n        caretX\n      );\n      return;\n    }\n\n    // We've a candidate for the next line now we want to find the first element\n    // which is under/over the caret.\n    const [caretX, caretY] = this.#getCaretPosition(selection, isUp);\n    const newLineElementRect = newLineElement.getBoundingClientRect();\n\n    // Maybe the element on the new line is a valid candidate.\n    if (this.#isUnderOver(newLineElementRect, caretX, caretY, isUp)) {\n      this.#setCaretPosition(\n        select,\n        selection,\n        newLineElement,\n        newLineElementRect,\n        caretX\n      );\n      return;\n    }\n\n    while (nodeIterator()) {\n      // Search an element on the same line as newLineElement\n      // which could be under/over the caret.\n      const element = walker.currentNode.parentElement;\n      const elementRect = element.getBoundingClientRect();\n      if (!this.#isOnSameLine(newLineElementRect, elementRect)) {\n        break;\n      }\n      if (this.#isUnderOver(elementRect, caretX, caretY, isUp)) {\n        // We found the element.\n        this.#setCaretPosition(select, selection, element, elementRect, caretX);\n        return;\n      }\n    }\n\n    // No element has been found so just put the caret on the element on the new\n    // line.\n    this.#setCaretPosition(\n      select,\n      selection,\n      newLineElement,\n      newLineElementRect,\n      caretX\n    );\n  }\n}\n\nexport { CaretBrowsingMode };\n","/* Copyright 2025 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 { noContextMenu, stopEvent } from \"pdfjs-lib\";\n\n// Timeout before ending resize operation.\nconst RESIZE_TIMEOUT = 400; // ms\n\n/**\n * Viewer control to display a sidebar with resizer functionality.\n */\nclass Sidebar {\n  #initialWidth = 0;\n\n  #width = 0;\n\n  #coefficient;\n\n  #resizeTimeout = null;\n\n  #resizer;\n\n  #isResizerOnTheLeft;\n\n  #isKeyboardResizing = false;\n\n  #resizeObserver;\n\n  #prevX = 0;\n\n  /**\n   * @typedef {Object} SidebarElements\n   * @property {HTMLElement} sidebar - The sidebar element.\n   * @property {HTMLElement} resizer - The sidebar resizer element.\n   * @property {HTMLElement} toggleButton - The button used to toggle the\n   *   sidebar.\n   */\n\n  /**\n   * Create a sidebar with resizer functionality.\n   * @param {SidebarElements} sidebarElements\n   * @param {boolean} ltr\n   * @param {boolean} isResizerOnTheLeft\n   */\n  constructor(\n    { sidebar, resizer, toggleButton },\n    ltr,\n    isResizerOnTheLeft,\n    globalAbortSignal\n  ) {\n    this._sidebar = sidebar;\n    this.#coefficient = ltr === isResizerOnTheLeft ? -1 : 1;\n    this.#resizer = resizer;\n    this.#isResizerOnTheLeft = isResizerOnTheLeft;\n\n    const style = window.getComputedStyle(sidebar);\n    this.#initialWidth = this.#width = parseFloat(\n      style.getPropertyValue(\"--sidebar-width\")\n    );\n    resizer.ariaValueMin =\n      parseFloat(style.getPropertyValue(\"--sidebar-min-width\")) || 0;\n    resizer.ariaValueMax =\n      parseFloat(style.getPropertyValue(\"--sidebar-max-width\")) || Infinity;\n    resizer.ariaValueNow = this.#width;\n\n    this.#makeSidebarResizable();\n    toggleButton.addEventListener(\"click\", this.toggle.bind(this));\n    this._isOpen = false;\n    sidebar.hidden = true;\n    globalAbortSignal?.addEventListener(\"abort\", this.destroy.bind(this), {\n      once: true,\n    });\n\n    this.#resizeObserver = new ResizeObserver(\n      ([\n        {\n          borderBoxSize: [{ inlineSize }],\n        },\n      ]) => {\n        if (!isNaN(this.#prevX)) {\n          this.#prevX += this.#coefficient * (inlineSize - this.#width);\n        }\n        this.#setWidth(inlineSize);\n      }\n    );\n    this.#resizeObserver.observe(sidebar);\n  }\n\n  #makeSidebarResizable() {\n    const sidebarStyle = this._sidebar.style;\n    let pointerMoveAC;\n    const cancelResize = () => {\n      this.#resizeTimeout = null;\n      this._sidebar.classList.remove(\"resizing\");\n      pointerMoveAC?.abort();\n      pointerMoveAC = null;\n      this.#isKeyboardResizing = false;\n      this.onStopResizing();\n      this.#prevX = NaN;\n    };\n    this.#resizer.addEventListener(\"pointerdown\", e => {\n      if (pointerMoveAC) {\n        cancelResize();\n        return;\n      }\n      this.onStartResizing();\n      const { clientX } = e;\n      stopEvent(e);\n      this.#prevX = clientX;\n      pointerMoveAC = new AbortController();\n      const { signal } = pointerMoveAC;\n      const sidebar = this._sidebar;\n      sidebar.classList.add(\"resizing\");\n      const parentStyle = sidebar.parentElement.style;\n      parentStyle.minWidth = 0;\n      window.addEventListener(\"contextmenu\", noContextMenu, { signal });\n      window.addEventListener(\n        \"pointermove\",\n        ev => {\n          if (!pointerMoveAC || Math.abs(ev.clientX - this.#prevX) < 1) {\n            return;\n          }\n          stopEvent(ev);\n          sidebarStyle.width = `${Math.round(this.#width + this.#coefficient * (ev.clientX - this.#prevX))}px`;\n        },\n        { signal, capture: true }\n      );\n      window.addEventListener(\"blur\", cancelResize, { signal });\n      window.addEventListener(\n        \"pointerup\",\n        ev => {\n          if (pointerMoveAC) {\n            cancelResize();\n            stopEvent(ev);\n          }\n        },\n        { signal }\n      );\n    });\n    this.#resizer.addEventListener(\"keydown\", e => {\n      const { key } = e;\n      const isArrowLeft = key === \"ArrowLeft\";\n      if (isArrowLeft || key === \"ArrowRight\") {\n        if (!this.#isKeyboardResizing) {\n          this._sidebar.classList.add(\"resizing\");\n          this.#isKeyboardResizing = true;\n          this.onStartResizing();\n        }\n\n        const base = e.ctrlKey || e.metaKey ? 10 : 1;\n        const dx = base * (isArrowLeft ? -1 : 1);\n        clearTimeout(this.#resizeTimeout);\n        this.#resizeTimeout = setTimeout(cancelResize, RESIZE_TIMEOUT);\n        sidebarStyle.width = `${Math.round(this.#width + this.#coefficient * dx)}px`;\n        stopEvent(e);\n      }\n    });\n  }\n\n  #setWidth(newWidth) {\n    this.#width = newWidth;\n    this.#resizer.ariaValueNow = Math.round(newWidth);\n    if (this.#isResizerOnTheLeft) {\n      this._sidebar.parentElement.style.insetInlineStart = `${(this.#initialWidth - newWidth).toFixed(3)}px`;\n    }\n    this.onResizing(newWidth);\n  }\n\n  /**\n   * Get the current width of the sidebar in pixels.\n   * @returns {number}\n   */\n  get width() {\n    return this.#width;\n  }\n\n  /**\n   * Set the width of the sidebar in pixels.\n   * @param {number} newWidth\n   */\n  set width(newWidth) {\n    this._sidebar.style.width = `${newWidth}px`;\n  }\n\n  /**\n   * Callback to be executed when the user starts resizing the sidebar.\n   */\n  onStartResizing() {}\n\n  /**\n   * Callback to be executed when the user stops resizing the sidebar.\n   */\n  onStopResizing() {}\n\n  /**\n   * Callback to be executed when the sidebar is being resized.\n   * @param {number} newWidth - The new width of the sidebar in pixels.\n   */\n  onResizing(_newWidth) {}\n\n  /**\n   * Toggle the sidebar's visibility.\n   * @param {boolean} [visibility] - The visibility state to set.\n   */\n  toggle(visibility = !this._isOpen) {\n    this._sidebar.hidden = !(this._isOpen = visibility);\n  }\n\n  destroy() {\n    this.#resizeObserver?.disconnect();\n    this.#resizeObserver = null;\n  }\n}\n\nexport { Sidebar };\n","/* Copyright 2025 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  AnnotationEditorType,\n  applyOpacity,\n  CSSConstants,\n  findContrastColor,\n  MathClamp,\n  noContextMenu,\n  PDFDateString,\n  renderRichText,\n  shadow,\n  stopEvent,\n  Util,\n} from \"pdfjs-lib\";\nimport { binarySearchFirstItem } from \"./ui_utils.js\";\nimport { Sidebar } from \"./sidebar.js\";\n\nclass CommentManager {\n  #dialog;\n\n  #popup;\n\n  #sidebar;\n\n  static #hasForcedColors = null;\n\n  constructor(\n    commentDialog,\n    sidebar,\n    eventBus,\n    linkService,\n    overlayManager,\n    ltr,\n    hasForcedColors,\n    globalAbortSignal\n  ) {\n    const dateFormat = new Intl.DateTimeFormat(undefined, {\n      dateStyle: \"long\",\n    });\n    this.dialogElement = commentDialog.dialog;\n    this.#dialog = new CommentDialog(\n      commentDialog,\n      overlayManager,\n      eventBus,\n      ltr\n    );\n    this.#popup = new CommentPopup(\n      eventBus,\n      dateFormat,\n      ltr,\n      this.dialogElement\n    );\n    this.#sidebar = new CommentSidebar(\n      sidebar,\n      eventBus,\n      linkService,\n      this.#popup,\n      dateFormat,\n      ltr,\n      globalAbortSignal\n    );\n    this.#popup.sidebar = this.#sidebar;\n    CommentManager.#hasForcedColors = hasForcedColors;\n  }\n\n  setSidebarUiManager(uiManager) {\n    this.#sidebar.setUIManager(uiManager);\n  }\n\n  showSidebar(annotations) {\n    this.#sidebar.show(annotations);\n  }\n\n  hideSidebar() {\n    this.#sidebar.hide();\n  }\n\n  removeComments(ids) {\n    this.#sidebar.removeComments(ids);\n  }\n\n  selectComment(id) {\n    this.#sidebar.selectComment(null, id);\n  }\n\n  addComment(annotation) {\n    this.#sidebar.addComment(annotation);\n  }\n\n  updateComment(annotation) {\n    this.#sidebar.updateComment(annotation);\n  }\n\n  toggleCommentPopup(editor, isSelected, visibility, isEditable) {\n    if (isSelected) {\n      this.selectComment(editor.uid);\n    }\n    this.#popup.toggle(editor, isSelected, visibility, isEditable);\n  }\n\n  destroyPopup() {\n    this.#popup.destroy();\n  }\n\n  updatePopupColor(editor) {\n    this.#popup.updateColor(editor);\n  }\n\n  showDialog(uiManager, editor, posX, posY, options) {\n    return this.#dialog.open(uiManager, editor, posX, posY, options);\n  }\n\n  makeCommentColor(color, opacity) {\n    return CommentManager._makeCommentColor(color, opacity);\n  }\n\n  static _makeCommentColor(color, opacity) {\n    return this.#hasForcedColors\n      ? null\n      : findContrastColor(\n          applyOpacity(color, opacity ?? 1),\n          CSSConstants.commentForegroundColor\n        );\n  }\n\n  destroy() {\n    this.#dialog.destroy();\n    this.#sidebar.hide();\n    this.#popup.destroy();\n  }\n}\n\nclass CommentSidebar extends Sidebar {\n  #annotations = null;\n\n  #eventBus;\n\n  #boundCommentClick = this.#commentClick.bind(this);\n\n  #boundCommentKeydown = this.#commentKeydown.bind(this);\n\n  #closeButton;\n\n  #commentsList;\n\n  #commentCount;\n\n  #dateFormat;\n\n  #sidebarTitle;\n\n  #learnMoreUrl;\n\n  #linkService;\n\n  #popup;\n\n  #elementsToAnnotations = null;\n\n  #idsToElements = null;\n\n  #uiManager = null;\n\n  constructor(\n    {\n      learnMoreUrl,\n      sidebar,\n      sidebarResizer,\n      commentsList,\n      commentCount,\n      sidebarTitle,\n      closeButton,\n      commentToolbarButton,\n    },\n    eventBus,\n    linkService,\n    popup,\n    dateFormat,\n    ltr,\n    globalAbortSignal\n  ) {\n    super(\n      { sidebar, resizer: sidebarResizer, toggleButton: commentToolbarButton },\n      ltr,\n      /* isResizerOnTheLeft = */ true,\n      globalAbortSignal\n    );\n    this.#sidebarTitle = sidebarTitle;\n    this.#commentsList = commentsList;\n    this.#commentCount = commentCount;\n    this.#learnMoreUrl = learnMoreUrl;\n    this.#linkService = linkService;\n    this.#closeButton = closeButton;\n    this.#popup = popup;\n    this.#dateFormat = dateFormat;\n    this.#eventBus = eventBus;\n\n    closeButton.addEventListener(\"click\", () => {\n      eventBus.dispatch(\"switchannotationeditormode\", {\n        source: this,\n        mode: AnnotationEditorType.NONE,\n      });\n    });\n    const keyDownCallback = e => {\n      if (e.key === \"ArrowDown\" || e.key === \"Home\" || e.key === \"F6\") {\n        this.#commentsList.firstElementChild.focus();\n        stopEvent(e);\n      } else if (e.key === \"ArrowUp\" || e.key === \"End\") {\n        this.#commentsList.lastElementChild.focus();\n        stopEvent(e);\n      }\n    };\n    commentToolbarButton.addEventListener(\"keydown\", keyDownCallback);\n    sidebar.addEventListener(\"keydown\", keyDownCallback);\n  }\n\n  setUIManager(uiManager) {\n    this.#uiManager = uiManager;\n  }\n\n  show(annotations) {\n    this.#elementsToAnnotations = new WeakMap();\n    this.#idsToElements = new Map();\n    this.#annotations = annotations;\n    annotations.sort(this.#sortComments.bind(this));\n    if (annotations.length !== 0) {\n      const fragment = document.createDocumentFragment();\n      for (const annotation of annotations) {\n        fragment.append(this.#createCommentElement(annotation));\n      }\n\n      this.#setCommentsCount(fragment);\n      this.#commentsList.append(fragment);\n    } else {\n      this.#setCommentsCount();\n    }\n    this._sidebar.hidden = false;\n    this.#eventBus.dispatch(\"reporttelemetry\", {\n      source: this,\n      details: {\n        type: \"commentSidebar\",\n        data: { numberOfAnnotations: annotations.length },\n      },\n    });\n  }\n\n  hide() {\n    this._sidebar.hidden = true;\n    this.#commentsList.replaceChildren();\n    this.#elementsToAnnotations = null;\n    this.#idsToElements = null;\n    this.#annotations = null;\n  }\n\n  removeComments(ids) {\n    if (ids.length === 0 || !this.#idsToElements) {\n      return;\n    }\n    if (\n      new Set(this.#idsToElements.keys()).difference(new Set(ids)).size === 0\n    ) {\n      this.#removeAll();\n      return;\n    }\n    for (const id of ids) {\n      this.#removeComment(id);\n    }\n  }\n\n  focusComment(id) {\n    const element = this.#idsToElements.get(id);\n    if (!element) {\n      return;\n    }\n    this._sidebar.scrollTop = element.offsetTop - this._sidebar.offsetTop;\n    for (const el of this.#commentsList.children) {\n      el.classList.toggle(\"selected\", el === element);\n    }\n  }\n\n  updateComment(annotation) {\n    if (!this.#idsToElements) {\n      return;\n    }\n    const {\n      id,\n      creationDate,\n      modificationDate,\n      richText,\n      contentsObj,\n      popupRef,\n    } = annotation;\n\n    if (!popupRef || (!richText && !contentsObj?.str)) {\n      this.#removeComment(id);\n    }\n\n    const element = this.#idsToElements.get(id);\n    if (!element) {\n      return;\n    }\n    const prevAnnotation = this.#elementsToAnnotations.get(element);\n    let index = binarySearchFirstItem(\n      this.#annotations,\n      a => this.#sortComments(a, prevAnnotation) >= 0\n    );\n    if (index >= this.#annotations.length) {\n      return;\n    }\n\n    this.#setDate(element.firstElementChild, modificationDate || creationDate);\n    this.#setText(element.lastElementChild, richText, contentsObj);\n\n    this.#annotations.splice(index, 1);\n    index = binarySearchFirstItem(\n      this.#annotations,\n      a => this.#sortComments(a, annotation) >= 0\n    );\n    this.#annotations.splice(index, 0, annotation);\n    if (index >= this.#commentsList.children.length) {\n      this.#commentsList.append(element);\n    } else {\n      this.#commentsList.insertBefore(\n        element,\n        this.#commentsList.children[index]\n      );\n    }\n  }\n\n  #removeComment(id) {\n    const element = this.#idsToElements?.get(id);\n    if (!element) {\n      return;\n    }\n    const annotation = this.#elementsToAnnotations.get(element);\n    const index = binarySearchFirstItem(\n      this.#annotations,\n      a => this.#sortComments(a, annotation) >= 0\n    );\n    if (index >= this.#annotations.length) {\n      return;\n    }\n    this.#annotations.splice(index, 1);\n    element.remove();\n    this.#idsToElements.delete(id);\n    this.#setCommentsCount();\n  }\n\n  #removeAll() {\n    this.#commentsList.replaceChildren();\n    this.#elementsToAnnotations = new WeakMap();\n    this.#idsToElements.clear();\n    this.#annotations.length = 0;\n    this.#setCommentsCount();\n  }\n\n  selectComment(element, id = null) {\n    if (!this.#idsToElements) {\n      return;\n    }\n    const hasNoElement = !element;\n    element ||= this.#idsToElements.get(id);\n    for (const el of this.#commentsList.children) {\n      el.classList.toggle(\"selected\", el === element);\n    }\n    if (hasNoElement) {\n      element?.scrollIntoView({ behavior: \"instant\", block: \"center\" });\n    }\n  }\n\n  addComment(annotation) {\n    if (this.#idsToElements?.has(annotation.id)) {\n      return;\n    }\n    const { popupRef, contentsObj } = annotation;\n    if (!popupRef || !contentsObj?.str) {\n      return;\n    }\n    const commentItem = this.#createCommentElement(annotation);\n    if (this.#annotations.length === 0) {\n      this.#commentsList.replaceChildren(commentItem);\n      this.#annotations.push(annotation);\n      this.#setCommentsCount();\n      return;\n    }\n    const index = binarySearchFirstItem(\n      this.#annotations,\n      a => this.#sortComments(a, annotation) >= 0\n    );\n    this.#annotations.splice(index, 0, annotation);\n    if (index >= this.#commentsList.children.length) {\n      this.#commentsList.append(commentItem);\n    } else {\n      this.#commentsList.insertBefore(\n        commentItem,\n        this.#commentsList.children[index]\n      );\n    }\n    this.#setCommentsCount();\n  }\n\n  #setCommentsCount(container = this.#commentsList) {\n    const count = this.#idsToElements.size;\n    this.#sidebarTitle.setAttribute(\n      \"data-l10n-args\",\n      JSON.stringify({ count })\n    );\n    this.#commentCount.textContent = count;\n    if (count === 0) {\n      container.append(this.#createZeroCommentElement());\n    }\n  }\n\n  #createZeroCommentElement() {\n    const commentItem = document.createElement(\"li\");\n    commentItem.classList.add(\"sidebarComment\", \"noComments\");\n    const textDiv = document.createElement(\"div\");\n    textDiv.className = \"sidebarCommentText\";\n    textDiv.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-editor-comments-sidebar-no-comments1\"\n    );\n    commentItem.append(textDiv);\n    if (this.#learnMoreUrl) {\n      const a = document.createElement(\"a\");\n      a.setAttribute(\n        \"data-l10n-id\",\n        \"pdfjs-editor-comments-sidebar-no-comments-link\"\n      );\n      a.href = this.#learnMoreUrl;\n      a.target = \"_blank\";\n      a.rel = \"noopener noreferrer\";\n      commentItem.append(a);\n    }\n    return commentItem;\n  }\n\n  #setDate(element, date) {\n    date = PDFDateString.toDateObject(date);\n    element.dateTime = date.toISOString();\n    element.textContent = this.#dateFormat.format(date);\n  }\n\n  #setText(element, richText, contentsObj) {\n    element.replaceChildren();\n    const html =\n      richText?.str && (!contentsObj?.str || richText.str === contentsObj.str)\n        ? richText.html\n        : contentsObj?.str;\n    renderRichText(\n      {\n        html,\n        dir: contentsObj?.dir || \"auto\",\n        className: \"richText\",\n      },\n      element\n    );\n  }\n\n  #createCommentElement(annotation) {\n    const {\n      id,\n      creationDate,\n      modificationDate,\n      richText,\n      contentsObj,\n      color,\n      opacity,\n    } = annotation;\n    const commentItem = document.createElement(\"li\");\n    commentItem.role = \"button\";\n    commentItem.className = \"sidebarComment\";\n    commentItem.tabIndex = -1;\n    commentItem.style.backgroundColor =\n      (color && CommentManager._makeCommentColor(color, opacity)) || \"\";\n    const dateDiv = document.createElement(\"time\");\n    this.#setDate(dateDiv, modificationDate || creationDate);\n\n    const textDiv = document.createElement(\"div\");\n    textDiv.className = \"sidebarCommentText\";\n    this.#setText(textDiv, richText, contentsObj);\n\n    commentItem.append(dateDiv, textDiv);\n    commentItem.addEventListener(\"click\", this.#boundCommentClick);\n    commentItem.addEventListener(\"keydown\", this.#boundCommentKeydown);\n\n    this.#elementsToAnnotations.set(commentItem, annotation);\n    this.#idsToElements.set(id, commentItem);\n    return commentItem;\n  }\n\n  async #commentClick({ currentTarget }) {\n    if (currentTarget.classList.contains(\"selected\")) {\n      currentTarget.classList.remove(\"selected\");\n      this.#popup._hide();\n      return;\n    }\n    const annotation = this.#elementsToAnnotations.get(currentTarget);\n    if (!annotation) {\n      return;\n    }\n    this.#popup._hide();\n    const { id, pageIndex, rect } = annotation;\n    const pageNumber = pageIndex + 1;\n    const pageVisiblePromise =\n      this.#uiManager?.waitForEditorsRendered(pageNumber);\n    this.#linkService?.goToXY(pageNumber, rect[0], rect[3], {\n      center: \"both\",\n    });\n    this.selectComment(currentTarget);\n    await pageVisiblePromise;\n    this.#uiManager?.selectComment(pageIndex, id);\n  }\n\n  #commentKeydown(e) {\n    const { key, currentTarget } = e;\n    switch (key) {\n      case \"ArrowDown\":\n        (\n          currentTarget.nextElementSibling ||\n          this.#commentsList.firstElementChild\n        ).focus();\n        stopEvent(e);\n        break;\n      case \"ArrowUp\":\n        (\n          currentTarget.previousElementSibling ||\n          this.#commentsList.lastElementChild\n        ).focus();\n        stopEvent(e);\n        break;\n      case \"Home\":\n        this.#commentsList.firstElementChild.focus();\n        stopEvent(e);\n        break;\n      case \"End\":\n        this.#commentsList.lastElementChild.focus();\n        stopEvent(e);\n        break;\n      case \"Enter\":\n      case \" \":\n        this.#commentClick(e);\n        stopEvent(e);\n        break;\n      case \"ShiftTab\":\n        this.#closeButton.focus();\n        stopEvent(e);\n        break;\n    }\n  }\n\n  #sortComments(a, b) {\n    const dateA = PDFDateString.toDateObject(\n      a.modificationDate || a.creationDate\n    );\n    const dateB = PDFDateString.toDateObject(\n      b.modificationDate || b.creationDate\n    );\n    if (dateA !== dateB) {\n      if (dateA !== null && dateB !== null) {\n        return dateB - dateA;\n      }\n      return dateA !== null ? -1 : 1;\n    }\n    if (a.pageIndex !== b.pageIndex) {\n      return a.pageIndex - b.pageIndex;\n    }\n    if (a.rect[3] !== b.rect[3]) {\n      return b.rect[3] - a.rect[3];\n    }\n    if (a.rect[0] !== b.rect[0]) {\n      return a.rect[0] - b.rect[0];\n    }\n    if (a.rect[1] !== b.rect[1]) {\n      return b.rect[1] - a.rect[1];\n    }\n    if (a.rect[2] !== b.rect[2]) {\n      return a.rect[2] - b.rect[2];\n    }\n    return a.id.localeCompare(b.id);\n  }\n}\n\nclass CommentDialog {\n  #dialog;\n\n  #editor;\n\n  #overlayManager;\n\n  #previousText = \"\";\n\n  #commentText = \"\";\n\n  #textInput;\n\n  #title;\n\n  #saveButton;\n\n  #uiManager;\n\n  #prevDragX = 0;\n\n  #prevDragY = 0;\n\n  #dialogX = 0;\n\n  #dialogY = 0;\n\n  #isLTR;\n\n  #eventBus;\n\n  constructor(\n    { dialog, toolbar, title, textInput, cancelButton, saveButton },\n    overlayManager,\n    eventBus,\n    ltr\n  ) {\n    this.#dialog = dialog;\n    this.#textInput = textInput;\n    this.#overlayManager = overlayManager;\n    this.#eventBus = eventBus;\n    this.#saveButton = saveButton;\n    this.#title = title;\n    this.#isLTR = ltr;\n\n    const finishBound = this.#finish.bind(this);\n    dialog.addEventListener(\"close\", finishBound);\n    dialog.addEventListener(\"contextmenu\", e => {\n      if (e.target !== this.#textInput) {\n        e.preventDefault();\n      }\n    });\n    cancelButton.addEventListener(\"click\", finishBound);\n    saveButton.addEventListener(\"click\", this.#save.bind(this));\n\n    textInput.addEventListener(\"input\", () => {\n      saveButton.disabled = textInput.value === this.#previousText;\n    });\n    textInput.addEventListener(\"keydown\", e => {\n      if (\n        (e.ctrlKey || e.metaKey) &&\n        e.key === \"Enter\" &&\n        !saveButton.disabled\n      ) {\n        this.#save();\n      }\n    });\n\n    // Make the dialog draggable.\n    let pointerMoveAC;\n    const cancelDrag = () => {\n      dialog.classList.remove(\"dragging\");\n      pointerMoveAC?.abort();\n      pointerMoveAC = null;\n    };\n    toolbar.addEventListener(\"pointerdown\", e => {\n      if (pointerMoveAC) {\n        cancelDrag();\n        return;\n      }\n      const { clientX, clientY } = e;\n      stopEvent(e);\n      this.#prevDragX = clientX;\n      this.#prevDragY = clientY;\n      pointerMoveAC = new AbortController();\n      const { signal } = pointerMoveAC;\n      const { innerHeight, innerWidth } = window;\n      dialog.classList.add(\"dragging\");\n      window.addEventListener(\n        \"pointermove\",\n        ev => {\n          if (!pointerMoveAC) {\n            return;\n          }\n          const { clientX: x, clientY: y } = ev;\n          this.#setPosition(\n            this.#dialogX + (x - this.#prevDragX) / innerWidth,\n            this.#dialogY + (y - this.#prevDragY) / innerHeight\n          );\n          this.#prevDragX = x;\n          this.#prevDragY = y;\n          stopEvent(ev);\n        },\n        { signal }\n      );\n      window.addEventListener(\"blur\", cancelDrag, { signal });\n      window.addEventListener(\n        \"pointerup\",\n        ev => {\n          if (pointerMoveAC) {\n            cancelDrag();\n            stopEvent(ev);\n          }\n        },\n        { signal }\n      );\n    });\n\n    overlayManager.register(dialog);\n  }\n\n  async open(uiManager, editor, posX, posY, options) {\n    if (editor) {\n      this.#uiManager = uiManager;\n      this.#editor = editor;\n    }\n    const {\n      contentsObj: { str },\n      color,\n      opacity,\n    } = editor.getData();\n    const { style: dialogStyle } = this.#dialog;\n    if (color) {\n      dialogStyle.backgroundColor = CommentManager._makeCommentColor(\n        color,\n        opacity\n      );\n      dialogStyle.borderColor = Util.makeHexColor(...color);\n    } else {\n      dialogStyle.backgroundColor = dialogStyle.borderColor = \"\";\n    }\n    this.#commentText = str || \"\";\n    const textInput = this.#textInput;\n    textInput.value = this.#previousText = this.#commentText;\n    if (str) {\n      this.#title.setAttribute(\n        \"data-l10n-id\",\n        \"pdfjs-editor-edit-comment-dialog-title-when-editing\"\n      );\n      this.#saveButton.setAttribute(\n        \"data-l10n-id\",\n        \"pdfjs-editor-edit-comment-dialog-save-button-when-editing\"\n      );\n    } else {\n      this.#title.setAttribute(\n        \"data-l10n-id\",\n        \"pdfjs-editor-edit-comment-dialog-title-when-adding\"\n      );\n      this.#saveButton.setAttribute(\n        \"data-l10n-id\",\n        \"pdfjs-editor-edit-comment-dialog-save-button-when-adding\"\n      );\n    }\n    if (options?.height) {\n      textInput.style.height = `${options.height}px`;\n    }\n    this.#uiManager?.removeEditListeners();\n    this.#saveButton.disabled = true;\n    const parentDimensions = options?.parentDimensions;\n    const { innerHeight, innerWidth } = window;\n    if (editor.hasDefaultPopupPosition()) {\n      const { dialogWidth, dialogHeight } = this._dialogDimensions;\n      if (parentDimensions) {\n        if (\n          this.#isLTR &&\n          posX + dialogWidth >\n            Math.min(parentDimensions.x + parentDimensions.width, innerWidth)\n        ) {\n          const buttonWidth = this.#editor.commentButtonWidth;\n          posX -= dialogWidth - buttonWidth * parentDimensions.width;\n        } else if (!this.#isLTR) {\n          const buttonWidth =\n            this.#editor.commentButtonWidth * parentDimensions.width;\n          if (posX - dialogWidth < Math.max(0, parentDimensions.x)) {\n            posX = Math.max(0, posX);\n          } else {\n            posX -= dialogWidth - buttonWidth;\n          }\n        }\n      }\n      const height = Math.max(dialogHeight, options?.height || 0);\n      if (posY + height > innerHeight) {\n        posY = innerHeight - height;\n      }\n      if (posY < 0) {\n        posY = 0;\n      }\n    }\n\n    posX = MathClamp(posX / innerWidth, 0, 1);\n    posY = MathClamp(posY / innerHeight, 0, 1);\n    this.#setPosition(posX, posY);\n\n    await this.#overlayManager.open(this.#dialog);\n    textInput.focus();\n  }\n\n  async #save() {\n    this.#editor.comment = this.#textInput.value;\n    this.#finish();\n  }\n\n  get _dialogDimensions() {\n    const dialog = this.#dialog;\n    const { style } = dialog;\n    style.opacity = \"0\";\n    style.display = \"block\";\n    const { width, height } = dialog.getBoundingClientRect();\n    style.opacity = style.display = \"\";\n    return shadow(this, \"_dialogDimensions\", {\n      dialogWidth: width,\n      dialogHeight: height,\n    });\n  }\n\n  #setPosition(x, y) {\n    this.#dialogX = x;\n    this.#dialogY = y;\n    const { style } = this.#dialog;\n    style.left = `${100 * x}%`;\n    style.top = `${100 * y}%`;\n  }\n\n  #finish() {\n    if (!this.#editor) {\n      return;\n    }\n    const edited = this.#textInput.value !== this.#commentText;\n    this.#eventBus.dispatch(\"reporttelemetry\", {\n      source: this,\n      details: {\n        type: \"comment\",\n        data: {\n          edited,\n        },\n      },\n    });\n\n    this.#editor?.focusCommentButton();\n    this.#editor = null;\n    this.#textInput.value = this.#previousText = this.#commentText = \"\";\n    this.#overlayManager.closeIfActive(this.#dialog);\n    this.#textInput.style.height = \"\";\n    this.#uiManager?.addEditListeners();\n    this.#uiManager = null;\n  }\n\n  destroy() {\n    this.#uiManager = null;\n    this.#editor = null;\n    this.#finish();\n  }\n}\n\nclass CommentPopup {\n  #buttonsContainer = null;\n\n  #eventBus;\n\n  #commentDialog;\n\n  #dateFormat;\n\n  #editor = null;\n\n  #isLTR;\n\n  #container = null;\n\n  #text = null;\n\n  #time = null;\n\n  #prevDragX = 0;\n\n  #prevDragY = 0;\n\n  #posX = 0;\n\n  #posY = 0;\n\n  #previousFocusedElement = null;\n\n  #selected = false;\n\n  #visible = false;\n\n  constructor(eventBus, dateFormat, ltr, commentDialog) {\n    this.#eventBus = eventBus;\n    this.#dateFormat = dateFormat;\n    this.#isLTR = ltr;\n    this.#commentDialog = commentDialog;\n    this.sidebar = null;\n  }\n\n  get _popupWidth() {\n    const container = this.#createPopup();\n    const { style } = container;\n    style.opacity = \"0\";\n    style.display = \"block\";\n    document.body.append(container);\n    const width = container.getBoundingClientRect().width;\n    container.remove();\n    style.opacity = style.display = \"\";\n    return shadow(this, \"_popupWidth\", width);\n  }\n\n  #createPopup() {\n    if (this.#container) {\n      return this.#container;\n    }\n    const container = (this.#container = document.createElement(\"div\"));\n    container.className = \"commentPopup\";\n    container.id = \"commentPopup\";\n    container.tabIndex = -1;\n    container.role = \"dialog\";\n    container.ariaModal = \"false\";\n    container.addEventListener(\"contextmenu\", noContextMenu);\n    container.addEventListener(\"keydown\", e => {\n      if (e.key === \"Escape\") {\n        this.toggle(this.#editor, true, false);\n        this.#previousFocusedElement?.focus();\n        stopEvent(e);\n      }\n    });\n    container.addEventListener(\"click\", () => {\n      container.focus();\n    });\n\n    const top = document.createElement(\"div\");\n    top.className = \"commentPopupTop\";\n    const time = (this.#time = document.createElement(\"time\"));\n    time.className = \"commentPopupTime\";\n\n    const buttons = (this.#buttonsContainer = document.createElement(\"div\"));\n    buttons.className = \"commentPopupButtons\";\n    const edit = document.createElement(\"button\");\n    edit.classList.add(\"commentPopupEdit\", \"toolbarButton\");\n    edit.tabIndex = 0;\n    edit.setAttribute(\"data-l10n-id\", \"pdfjs-editor-edit-comment-popup-button\");\n    edit.ariaHasPopup = \"dialog\";\n    edit.ariaControlsElements = [this.#commentDialog];\n    const editLabel = document.createElement(\"span\");\n    editLabel.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-editor-edit-comment-popup-button-label\"\n    );\n    edit.append(editLabel);\n    edit.addEventListener(\"click\", () => {\n      const editor = this.#editor;\n      const height = parseFloat(getComputedStyle(this.#text).height);\n      this.toggle(editor, /* isSelected */ true, /* visibility */ false);\n      editor.editComment({\n        height,\n      });\n    });\n    edit.addEventListener(\"contextmenu\", noContextMenu);\n\n    const del = document.createElement(\"button\");\n    del.classList.add(\"commentPopupDelete\", \"toolbarButton\");\n    del.tabIndex = 0;\n    del.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-editor-delete-comment-popup-button\"\n    );\n    const delLabel = document.createElement(\"span\");\n    delLabel.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-editor-delete-comment-popup-button-label\"\n    );\n    del.append(delLabel);\n    del.addEventListener(\"click\", () => {\n      this.#eventBus.dispatch(\"reporttelemetry\", {\n        source: this,\n        details: {\n          type: \"comment\",\n          data: {\n            deleted: true,\n          },\n        },\n      });\n      const editor = this.#editor;\n      const savedData = editor.comment;\n      this.destroy();\n      if (savedData?.text) {\n        editor._uiManager.deleteComment(editor, savedData);\n      } else {\n        editor.comment = null;\n      }\n      editor.focus();\n    });\n    del.addEventListener(\"contextmenu\", noContextMenu);\n    buttons.append(edit, del);\n\n    top.append(time, buttons);\n\n    const separator = document.createElement(\"hr\");\n\n    const text = (this.#text = document.createElement(\"div\"));\n    text.className = \"commentPopupText\";\n    container.append(top, separator, text);\n\n    // Make the dialog draggable.\n    let pointerMoveAC;\n    const cancelDrag = () => {\n      container.classList.remove(\"dragging\");\n      pointerMoveAC?.abort();\n      pointerMoveAC = null;\n    };\n    top.addEventListener(\"pointerdown\", e => {\n      if (pointerMoveAC) {\n        cancelDrag();\n        return;\n      }\n      const { target, clientX, clientY } = e;\n      if (buttons.contains(target)) {\n        return;\n      }\n      stopEvent(e);\n      const { width: parentWidth, height: parentHeight } =\n        this.#editor.parentBoundingClientRect;\n      this.#prevDragX = clientX;\n      this.#prevDragY = clientY;\n      pointerMoveAC = new AbortController();\n      const { signal } = pointerMoveAC;\n      container.classList.add(\"dragging\");\n      window.addEventListener(\n        \"pointermove\",\n        ev => {\n          if (!pointerMoveAC) {\n            return; // Not dragging.\n          }\n          const { clientX: x, clientY: y } = ev;\n          this.#setPosition(\n            this.#posX + (x - this.#prevDragX) / parentWidth,\n            this.#posY + (y - this.#prevDragY) / parentHeight,\n            /* correctPosition = */ false\n          );\n          this.#prevDragX = x;\n          this.#prevDragY = y;\n          stopEvent(ev);\n        },\n        { signal }\n      );\n      window.addEventListener(\"blur\", cancelDrag, { signal });\n      window.addEventListener(\n        \"pointerup\",\n        ev => {\n          if (pointerMoveAC) {\n            cancelDrag();\n            stopEvent(ev);\n          }\n        },\n        { signal }\n      );\n    });\n\n    return container;\n  }\n\n  updateColor(editor) {\n    if (this.#editor !== editor || !this.#visible) {\n      return;\n    }\n    const { color, opacity } = editor.getData();\n    this.#container.style.backgroundColor =\n      (color && CommentManager._makeCommentColor(color, opacity)) || \"\";\n  }\n\n  _hide(editor) {\n    const container = this.#createPopup();\n\n    container.classList.toggle(\"hidden\", true);\n    container.classList.toggle(\"selected\", false);\n    (editor || this.#editor)?.setCommentButtonStates({\n      selected: false,\n      hasPopup: false,\n    });\n    this.#editor = null;\n    this.#selected = false;\n    this.#visible = false;\n    this.#text.replaceChildren();\n    this.sidebar.selectComment(null);\n  }\n\n  toggle(editor, isSelected, visibility = undefined, isEditable = true) {\n    if (!editor) {\n      this.destroy();\n      return;\n    }\n\n    if (isSelected) {\n      visibility ??=\n        this.#editor === editor ? !this.#selected || !this.#visible : true;\n    } else {\n      if (this.#selected) {\n        return;\n      }\n      visibility ??= !this.#visible;\n    }\n\n    if (!visibility) {\n      this._hide(editor);\n      return;\n    }\n\n    this.#visible = true;\n    if (this.#editor !== editor) {\n      this.#editor?.setCommentButtonStates({\n        selected: false,\n        hasPopup: false,\n      });\n    }\n\n    const container = this.#createPopup();\n    this.#buttonsContainer.classList.toggle(\"hidden\", !isEditable);\n    container.classList.toggle(\"hidden\", false);\n    container.classList.toggle(\"selected\", isSelected);\n    this.#selected = isSelected;\n    this.#editor = editor;\n    editor.setCommentButtonStates({\n      selected: isSelected,\n      hasPopup: true,\n    });\n\n    const {\n      contentsObj,\n      richText,\n      creationDate,\n      modificationDate,\n      color,\n      opacity,\n    } = editor.getData();\n    container.style.backgroundColor =\n      (color && CommentManager._makeCommentColor(color, opacity)) || \"\";\n    this.#text.replaceChildren();\n    const html =\n      richText?.str && (!contentsObj?.str || richText.str === contentsObj.str)\n        ? richText.html\n        : contentsObj?.str;\n    if (html) {\n      renderRichText(\n        {\n          html,\n          dir: contentsObj?.dir || \"auto\",\n          className: \"richText\",\n        },\n        this.#text\n      );\n    }\n    this.#time.textContent = this.#dateFormat.format(\n      PDFDateString.toDateObject(modificationDate || creationDate)\n    );\n    this.#setPosition(\n      ...editor.commentPopupPosition,\n      /* correctPosition = */ editor.hasDefaultPopupPosition()\n    );\n    editor.elementBeforePopup.after(container);\n    container.addEventListener(\n      \"focus\",\n      ({ relatedTarget }) => {\n        this.#previousFocusedElement = relatedTarget;\n      },\n      { once: true }\n    );\n    if (isSelected) {\n      setTimeout(() => container.focus(), 0);\n    }\n  }\n\n  #setPosition(x, y, correctPosition) {\n    if (!correctPosition) {\n      this.#editor.commentPopupPosition = [x, y];\n    } else {\n      const parentRect = this.#editor.parentBoundingClientRect;\n      const widthRatio = this._popupWidth / parentRect.width;\n      if (\n        (this.#isLTR && x + widthRatio > 1) ||\n        (!this.#isLTR && x - widthRatio >= 0)\n      ) {\n        const buttonWidth = this.#editor.commentButtonWidth;\n        x -= widthRatio - buttonWidth;\n      }\n      const margin = 0.01;\n      if (this.#isLTR) {\n        x = Math.max(x, -parentRect.x / parentRect.width + margin);\n      } else {\n        x = Math.min(\n          x,\n          (window.innerWidth - parentRect.x) / parentRect.width -\n            widthRatio -\n            margin\n        );\n      }\n    }\n    this.#posX = x;\n    this.#posY = y;\n    const { style } = this.#container;\n    style.left = `${100 * x}%`;\n    style.top = `${100 * y}%`;\n  }\n\n  destroy() {\n    this._hide();\n    this.#container?.remove();\n    this.#container = this.#text = this.#time = null;\n    this.#prevDragX = this.#prevDragY = Infinity;\n    this.#posX = this.#posY = 0;\n    this.#previousFocusedElement = null;\n  }\n}\n\nexport { CommentManager };\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 { isPdfFile } from \"pdfjs-lib\";\n\nclass BaseDownloadManager {\n  #openBlobUrls = new WeakMap();\n\n  constructor() {\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n      this.constructor === BaseDownloadManager\n    ) {\n      throw new Error(\"Cannot initialize BaseDownloadManager.\");\n    }\n  }\n\n  _triggerDownload(blobUrl, originalUrl, filename, isAttachment = false) {\n    throw new Error(\"Not implemented: _triggerDownload\");\n  }\n\n  _getOpenDataUrl(blobUrl, filename, dest = null) {\n    throw new Error(\"Not implemented: _getOpenDataUrl\");\n  }\n\n  /**\n   * @param {Uint8Array} data\n   * @param {string} filename\n   * @param {string} [contentType]\n   */\n  downloadData(data, filename, contentType) {\n    const blobUrl = URL.createObjectURL(\n      new Blob([data], { type: contentType })\n    );\n\n    this._triggerDownload(\n      blobUrl,\n      /* originalUrl = */ blobUrl,\n      filename,\n      /* isAttachment = */ true\n    );\n  }\n\n  /**\n   * @param {Uint8Array} data\n   * @param {string} filename\n   * @param {string | null} [dest]\n   * @returns {boolean} Indicating if the data was opened.\n   */\n  openOrDownloadData(data, filename, dest = null) {\n    const isPdfData = isPdfFile(filename);\n    const contentType = isPdfData ? \"application/pdf\" : \"\";\n\n    if (isPdfData) {\n      const blobUrl = this.#openBlobUrls.getOrInsertComputed(data, () =>\n        URL.createObjectURL(new Blob([data], { type: contentType }))\n      );\n      try {\n        const viewerUrl = this._getOpenDataUrl(blobUrl, filename, dest);\n\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(data);\n      }\n    }\n\n    this.downloadData(data, filename, contentType);\n    return false;\n  }\n\n  /**\n   * @param {Uint8Array} data\n   * @param {string} url\n   * @param {string} filename\n   */\n  download(data, url, filename) {\n    const blobUrl = data\n      ? URL.createObjectURL(new Blob([data], { type: \"application/pdf\" }))\n      : null;\n\n    this._triggerDownload(blobUrl, /* originalUrl = */ url, filename);\n  }\n}\n\nexport { BaseDownloadManager };\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 { BaseDownloadManager } from \"./base_download_manager.js\";\nimport { createValidAbsoluteUrl } 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\nclass DownloadManager extends BaseDownloadManager {\n  _triggerDownload(blobUrl, originalUrl, filename, isAttachment = false) {\n    if (!blobUrl && !isAttachment) {\n      // Fallback to downloading non-attachments by their URL.\n      if (!createValidAbsoluteUrl(originalUrl, \"http://example.com\")) {\n        throw new Error(`_triggerDownload - not a valid URL: ${originalUrl}`);\n      }\n      blobUrl = originalUrl + \"#pdfjs.action=download\";\n    }\n\n    const a = document.createElement(\"a\");\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  _getOpenDataUrl(blobUrl, filename, dest = null) {\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"COMPONENTS\")) {\n      throw new Error(\"Opening data is not supported in `COMPONENTS` builds.\");\n    }\n    // The current URL is the viewer, let's use it and append the file.\n    let url = \"?file=\" + encodeURIComponent(blobUrl + \"#\" + filename);\n    if (dest) {\n      url += `#${escape(dest)}`;\n    }\n    return url;\n  }\n}\n\nexport { DownloadManager };\n","/* Copyright 2024 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 { noContextMenu } from \"pdfjs-lib\";\n\nclass EditorUndoBar {\n  #closeButton = null;\n\n  #container;\n\n  #eventBus = null;\n\n  #focusTimeout = null;\n\n  #initController = null;\n\n  isOpen = false;\n\n  #message;\n\n  #showController = null;\n\n  #undoButton;\n\n  static #l10nMessages = Object.freeze({\n    highlight: \"pdfjs-editor-undo-bar-message-highlight\",\n    freetext: \"pdfjs-editor-undo-bar-message-freetext\",\n    stamp: \"pdfjs-editor-undo-bar-message-stamp\",\n    ink: \"pdfjs-editor-undo-bar-message-ink\",\n    signature: \"pdfjs-editor-undo-bar-message-signature\",\n    comment: \"pdfjs-editor-undo-bar-message-comment\",\n    _multiple: \"pdfjs-editor-undo-bar-message-multiple\",\n  });\n\n  constructor({ container, message, undoButton, closeButton }, eventBus) {\n    this.#container = container;\n    this.#message = message;\n    this.#undoButton = undoButton;\n    this.#closeButton = closeButton;\n    this.#eventBus = eventBus;\n  }\n\n  destroy() {\n    this.#initController?.abort();\n    this.#initController = null;\n\n    this.hide();\n  }\n\n  show(undoAction, messageData) {\n    if (!this.#initController) {\n      this.#initController = new AbortController();\n      const opts = { signal: this.#initController.signal };\n      const boundHide = this.hide.bind(this);\n\n      this.#container.addEventListener(\"contextmenu\", noContextMenu, opts);\n      this.#closeButton.addEventListener(\"click\", boundHide, opts);\n      this.#eventBus._on(\"beforeprint\", boundHide, opts);\n      this.#eventBus._on(\"download\", boundHide, opts);\n    }\n\n    this.hide();\n\n    if (typeof messageData === \"string\") {\n      this.#message.setAttribute(\n        \"data-l10n-id\",\n        EditorUndoBar.#l10nMessages[messageData]\n      );\n    } else {\n      this.#message.setAttribute(\n        \"data-l10n-id\",\n        EditorUndoBar.#l10nMessages._multiple\n      );\n      this.#message.setAttribute(\n        \"data-l10n-args\",\n        JSON.stringify({ count: messageData })\n      );\n    }\n    this.isOpen = true;\n    this.#container.hidden = false;\n\n    this.#showController = new AbortController();\n\n    this.#undoButton.addEventListener(\n      \"click\",\n      () => {\n        undoAction();\n        this.hide();\n      },\n      { signal: this.#showController.signal }\n    );\n\n    // Without the setTimeout, VoiceOver will read out the document title\n    // instead of the popup label.\n    this.#focusTimeout = setTimeout(() => {\n      if (!this.#container.contains(document.activeElement)) {\n        this.#container.focus();\n      }\n      this.#focusTimeout = null;\n    }, 100);\n  }\n\n  hide() {\n    if (!this.isOpen) {\n      return;\n    }\n    this.isOpen = false;\n    this.#container.hidden = true;\n\n    this.#showController?.abort();\n    this.#showController = null;\n\n    if (this.#focusTimeout) {\n      clearTimeout(this.#focusTimeout);\n      this.#focusTimeout = null;\n    }\n  }\n}\n\nexport { EditorUndoBar };\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    dialog.addEventListener(\"cancel\", ({ target }) => {\n      if (this.#active === target) {\n        this.#active = null;\n      }\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   *                    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  /**\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 closeIfActive(dialog) {\n    if (this.#active === dialog) {\n      await this.close(dialog);\n    }\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\n/** @typedef {import(\"./overlay_manager.js\").OverlayManager} OverlayManager */\n\nimport { 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 {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, 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._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    await this.#activeCapability?.promise;\n    this.#activeCapability = Promise.withResolvers();\n\n    try {\n      await this.overlayManager.open(this.dialog);\n    } catch (ex) {\n      this.#activeCapability.resolve();\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.setAttribute(\n      \"data-l10n-id\",\n      passwordIncorrect ? \"pdfjs-password-invalid\" : \"pdfjs-password-label\"\n    );\n  }\n\n  async close() {\n    this.overlayManager.closeIfActive(this.dialog);\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 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\";\nimport { stopEvent } from \"pdfjs-lib\";\n\nconst TREEITEM_SELECTED_CLASS = \"selected\";\n\nclass BaseTreeViewer {\n  constructor(options) {\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n      this.constructor === BaseTreeViewer\n    ) {\n      throw new Error(\"Cannot initialize BaseTreeViewer.\");\n    }\n    this.container = options.container;\n    this.eventBus = options.eventBus;\n    this._l10n = options.l10n;\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.replaceChildren();\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(\"withNesting\");\n  }\n\n  /**\n   * @protected\n   */\n  _dispatchEvent(count) {\n    throw new Error(\"Not implemented: _dispatchEvent\");\n  }\n\n  /**\n   * @protected\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   * @param {HTMLDivElement} div\n   * @param {boolean|object} [hidden]\n   * @protected\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    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    // Pause translation when collapsing/expanding the subtree.\n    this._l10n.pause();\n\n    this._lastToggleIsShow = show;\n    for (const toggler of root.querySelectorAll(\".treeItemToggler\")) {\n      toggler.classList.toggle(\"treeItemsHidden\", !show);\n    }\n    this._l10n.resume();\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(\"withNesting\");\n      this._lastToggleIsShow = !fragment.querySelector(\".treeItemsHidden\");\n      this.container.addEventListener(\"click\", e => {\n        const { target } = e;\n        if (!target.classList.contains(\"treeItemToggler\")) {\n          return;\n        }\n        stopEvent(e);\n        target.classList.toggle(\"treeItemsHidden\");\n        if (e.shiftKey) {\n          const shouldShowAll = !target.classList.contains(\"treeItemsHidden\");\n          this._toggleTreeItem(target.parentNode, shouldShowAll);\n        }\n      });\n    }\n    // Pause translation when inserting the tree into the DOM.\n    this._l10n.pause();\n    this.container.append(fragment);\n    this._l10n.resume();\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    // Pause translation when expanding the treeItem.\n    this._l10n.pause();\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._l10n.resume();\n\n    this._updateCurrentTreeItem(treeItem);\n\n    treeItem.scrollIntoView({\n      behavior: \"instant\",\n      block: \"center\",\n      inline: \"center\",\n      container: \"nearest\",\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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./download_manager.js\").DownloadManager} DownloadManager */\n\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 * @property {boolean} [keepRenderedCapability]\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 = Promise.withResolvers();\n    }\n    this._pendingDispatchEvent = false;\n  }\n\n  /**\n   * @protected\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   * @protected\n   */\n  _bindLink(element, { content, description, filename }) {\n    if (description) {\n      element.title = description;\n    }\n    element.onclick = () => {\n      this.downloadManager.openOrDownloadData(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\n    const fragment = document.createDocumentFragment();\n    const ul = document.createElement(\"ul\");\n    fragment.append(ul);\n    let attachmentsCount = 0;\n    for (const name in attachments) {\n      const item = attachments[name];\n      const li = document.createElement(\"li\");\n      ul.append(li);\n      const element = document.createElement(\"a\");\n      li.append(element);\n      this._bindLink(element, item);\n      element.textContent = this._normalizeTextContent(item.filename);\n\n      attachmentsCount++;\n    }\n\n    this._finishRendering(fragment, attachmentsCount);\n  }\n\n  /**\n   * Used to append FileAttachment annotations to the sidebar.\n   */\n  #appendAttachment(item) {\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 (item.filename === name) {\n          return; // Ignore the new attachment if it already exists.\n        }\n      }\n      attachments[item.filename] = item;\n\n      this.render({\n        attachments,\n        keepRenderedCapability: true,\n      });\n    });\n  }\n}\n\nexport { PDFAttachmentViewer };\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\nimport { stopEvent } from \"pdfjs-lib\";\n\n// Class name of element which can be grabbed.\nconst CSS_CLASS_GRAB = \"grab-to-pan-grab\";\n\n/**\n * @typedef {Object} GrabToPanOptions\n * @property {HTMLElement} element\n */\n\nclass GrabToPan {\n  #activateAC = null;\n\n  #mouseDownAC = null;\n\n  #scrollAC = null;\n\n  /**\n   * Construct a GrabToPan instance for a given HTML element.\n   * @param {GrabToPanOptions} options\n   */\n  constructor({ element }) {\n    this.element = element;\n    this.document = element.ownerDocument;\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.#activateAC) {\n      this.#activateAC = new AbortController();\n\n      this.element.addEventListener(\"mousedown\", this.#onMouseDown.bind(this), {\n        capture: true,\n        signal: this.#activateAC.signal,\n      });\n      this.element.classList.add(CSS_CLASS_GRAB);\n    }\n  }\n\n  /**\n   * Removes all events. Any pending pan session is immediately stopped.\n   */\n  deactivate() {\n    if (this.#activateAC) {\n      this.#activateAC.abort();\n      this.#activateAC = null;\n\n      this.#endPan();\n      this.element.classList.remove(CSS_CLASS_GRAB);\n    }\n  }\n\n  toggle() {\n    if (this.#activateAC) {\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 {\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\n    this.#mouseDownAC = new AbortController();\n    const boundEndPan = this.#endPan.bind(this),\n      mouseOpts = { capture: true, signal: this.#mouseDownAC.signal };\n\n    this.document.addEventListener(\n      \"mousemove\",\n      this.#onMouseMove.bind(this),\n      mouseOpts\n    );\n    this.document.addEventListener(\"mouseup\", boundEndPan, mouseOpts);\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.#scrollAC = new AbortController();\n\n    this.element.addEventListener(\"scroll\", boundEndPan, {\n      capture: true,\n      signal: this.#scrollAC.signal,\n    });\n    stopEvent(event);\n\n    const focusedElement = document.activeElement;\n    if (focusedElement && !focusedElement.contains(event.target)) {\n      focusedElement.blur();\n    }\n  }\n\n  #onMouseMove(event) {\n    this.#scrollAC?.abort();\n    this.#scrollAC = null;\n\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    this.element.scrollTo({\n      top: this.scrollTopStart - yDiff,\n      left: this.scrollLeftStart - xDiff,\n      behavior: \"instant\",\n    });\n\n    if (!this.overlay.parentNode) {\n      document.body.append(this.overlay);\n    }\n  }\n\n  #endPan() {\n    this.#mouseDownAC?.abort();\n    this.#mouseDownAC = null;\n    this.#scrollAC?.abort();\n    this.#scrollAC = null;\n    // Note: ChildNode.remove doesn't throw if the parentNode is undefined.\n    this.overlay.remove();\n  }\n}\n\nexport { GrabToPan };\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.js\").EventBus} EventBus */\n\nimport { AnnotationEditorType, shadow } from \"pdfjs-lib\";\nimport { CursorTool, PresentationModeState } from \"./ui_utils.js\";\nimport { GrabToPan } from \"./grab_to_pan.js\";\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  #active = CursorTool.SELECT;\n\n  #prevActive = null;\n\n  /**\n   * @param {PDFCursorToolsOptions} options\n   */\n  constructor({ container, eventBus, cursorToolOnLoad = CursorTool.SELECT }) {\n    this.container = container;\n    this.eventBus = eventBus;\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.#prevActive !== null) {\n      // Cursor tools cannot be used in PresentationMode/AnnotationEditor.\n      return;\n    }\n    this.#switchTool(tool);\n  }\n\n  #switchTool(tool, disabled = false) {\n    if (tool === this.#active) {\n      if (this.#prevActive !== null) {\n        // Ensure that the `disabled`-attribute of the buttons will be updated.\n        this.eventBus.dispatch(\"cursortoolchanged\", {\n          source: this,\n          tool,\n          disabled,\n        });\n      }\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.eventBus.dispatch(\"cursortoolchanged\", {\n      source: this,\n      tool,\n      disabled,\n    });\n  }\n\n  #addEventListeners() {\n    this.eventBus._on(\"switchcursortool\", evt => {\n      if (!evt.reset) {\n        this.switchTool(evt.tool);\n      } else if (this.#prevActive !== null) {\n        annotationEditorMode = AnnotationEditorType.NONE;\n        presentationModeState = PresentationModeState.NORMAL;\n\n        enableActive();\n      }\n    });\n\n    let annotationEditorMode = AnnotationEditorType.NONE,\n      presentationModeState = PresentationModeState.NORMAL;\n\n    const disableActive = () => {\n      this.#prevActive ??= this.#active; // Keep track of the first one.\n      this.#switchTool(CursorTool.SELECT, /* disabled = */ true);\n    };\n    const enableActive = () => {\n      if (\n        this.#prevActive !== null &&\n        annotationEditorMode === AnnotationEditorType.NONE &&\n        presentationModeState === PresentationModeState.NORMAL\n      ) {\n        this.#switchTool(this.#prevActive);\n        this.#prevActive = null;\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  /**\n   * @private\n   */\n  get _handTool() {\n    return shadow(\n      this,\n      \"_handTool\",\n      new GrabToPan({\n        element: this.container,\n      })\n    );\n  }\n}\n\nexport { PDFCursorTools };\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(\"./event_utils.js\").EventBus} EventBus */\n/** @typedef {import(\"./overlay_manager.js\").OverlayManager} OverlayManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n\nimport { getPageSizeInches, isPortraitOrientation } from \"./ui_utils.js\";\nimport { PDFDateString } from \"pdfjs-lib\";\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. The names,\n// which are l10n-ids, should be lowercase.\n// See https://en.wikipedia.org/wiki/Paper_size\nconst US_PAGE_NAMES = {\n  \"8.5x11\": \"pdfjs-document-properties-page-size-name-letter\",\n  \"8.5x14\": \"pdfjs-document-properties-page-size-name-legal\",\n};\nconst METRIC_PAGE_NAMES = {\n  \"297x420\": \"pdfjs-document-properties-page-size-name-a-three\",\n  \"210x297\": \"pdfjs-document-properties-page-size-name-a-four\",\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 {L10n} 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    titleLookup\n  ) {\n    this.dialog = dialog;\n    this.fields = fields;\n    this.overlayManager = overlayManager;\n    this.l10n = l10n;\n    this._fileNameLookup = fileNameLookup;\n    this._titleLookup = titleLookup;\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\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, metadata, /* contentDispositionFilename, */ contentLength },\n      pdfPage,\n    ] = await Promise.all([\n      this.pdfDocument.getMetadata(),\n      this.pdfDocument.getPage(currentPageNumber),\n    ]);\n\n    const [\n      fileName,\n      fileSize,\n      title,\n      creationDate,\n      modificationDate,\n      pageSize,\n      isLinearized,\n    ] = await Promise.all([\n      this._fileNameLookup(),\n      this.#parseFileSize(contentLength),\n      this._titleLookup(),\n      this.#parseDate(metadata?.get(\"xmp:createdate\"), info.CreationDate),\n      this.#parseDate(metadata?.get(\"xmp:modifydate\"), info.ModDate),\n      this.#parsePageSize(getPageSizeInches(pdfPage), pagesRotation),\n      this.#parseLinearization(info.IsLinearized),\n    ]);\n\n    this.#fieldData = Object.freeze({\n      fileName,\n      fileSize,\n      title,\n      author: metadata?.get(\"dc:creator\")?.join(\"\\n\") || info.Author,\n      subject: metadata?.get(\"dc:subject\")?.join(\"\\n\") || info.Subject,\n      keywords: metadata?.get(\"pdf:keywords\") || info.Keywords,\n      creationDate,\n      modificationDate,\n      creator: metadata?.get(\"xmp:creatortool\") || info.Creator,\n      producer: metadata?.get(\"pdf: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();\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 = Promise.withResolvers();\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 \"-\".\n   */\n  #updateUI() {\n    if (this.#fieldData && this.overlayManager.active !== this.dialog) {\n      // Don't bother updating the dialog if it's already been closed,\n      // unless it's being reset (i.e. `this.#fieldData === null`),\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 = content || content === 0 ? content : \"-\";\n    }\n  }\n\n  async #parseFileSize(b = 0) {\n    const kb = b / 1024,\n      mb = kb / 1024;\n    return kb\n      ? this.l10n.get(\n          mb >= 1\n            ? \"pdfjs-document-properties-size-mb\"\n            : \"pdfjs-document-properties-size-kb\",\n          { mb, kb, b }\n        )\n      : undefined;\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      nonMetric = NON_METRIC_LOCALES.includes(this.l10n.getLanguage());\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 nameId =\n      getPageName(sizeInches, isPortrait, US_PAGE_NAMES) ||\n      getPageName(sizeMillimeters, isPortrait, METRIC_PAGE_NAMES);\n\n    if (\n      !nameId &&\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        nameId = getPageName(intMillimeters, isPortrait, METRIC_PAGE_NAMES);\n        if (nameId) {\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      nonMetric ? sizeInches : sizeMillimeters,\n      this.l10n.get(\n        nonMetric\n          ? \"pdfjs-document-properties-page-size-unit-inches\"\n          : \"pdfjs-document-properties-page-size-unit-millimeters\"\n      ),\n      nameId && this.l10n.get(nameId),\n      this.l10n.get(\n        isPortrait\n          ? \"pdfjs-document-properties-page-size-orientation-portrait\"\n          : \"pdfjs-document-properties-page-size-orientation-landscape\"\n      ),\n    ]);\n\n    return this.l10n.get(\n      name\n        ? \"pdfjs-document-properties-page-size-dimension-name-string\"\n        : \"pdfjs-document-properties-page-size-dimension-string\",\n      { width, height, unit, name, orientation }\n    );\n  }\n\n  async #parseDate(metadataDate, infoDate) {\n    const dateObj =\n      Date.parse(metadataDate) || PDFDateString.toDateObject(infoDate);\n    return dateObj\n      ? this.l10n.get(\"pdfjs-document-properties-date-time-string\", {\n          dateObj: dateObj.valueOf(),\n        })\n      : undefined;\n  }\n\n  #parseLinearization(isLinearized) {\n    return this.l10n.get(\n      isLinearized\n        ? \"pdfjs-document-properties-linearized-yes\"\n        : \"pdfjs-document-properties-linearized-no\"\n    );\n  }\n}\n\nexport { PDFDocumentProperties };\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\nimport { FeatureTest } from \"pdfjs-lib\";\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\nlet NormalizeWithNFKC;\nfunction getNormalizeWithNFKC() {\n  if (\n    (typeof PDFJSDev === \"undefined\" && FeatureTest.platform.isFirefox) ||\n    (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\"))\n  ) {\n    // The `NormalizeWithNFKC` string is generated with the for loop below.\n    // Because of a small difference between Chrome and Firefox, the string is\n    // only hardcoded for Firefox, and Chrome (or others) will generate it at\n    // runtime.\n    // In order to detect if the string is up to date, a check is performed in\n    // the loop below, and if a difference is detected, an error is thrown.\n    /* eslint-disable no-irregular-whitespace */\n    NormalizeWithNFKC ||= `\\xA0¨ª¯²-µ¸-º¼-¾Ĳ-ĳĿ-ŀŉſǄ-ǌǱ-ǳʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕　〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰ꟱-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ﬀ-ﬆﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ！-ﾾￂ-ￇￊ-ￏￒ-ￗￚ-ￜ￠-￦`;\n  }\n\n  if (\n    typeof PDFJSDev === \"undefined\" ||\n    PDFJSDev.test(\"TESTING\") ||\n    (!PDFJSDev.test(\"MOZCENTRAL\") && !NormalizeWithNFKC)\n  ) {\n    const ranges = [];\n    const range = [];\n    const diacriticsRegex = /^\\p{M}$/u;\n    // Some chars must be replaced by their NFKC counterpart during a search.\n    for (let i = 0; i < 65536; i++) {\n      if (i >= 0xd800 && i <= 0xdfff) {\n        continue; // Skip surrogates since they're not valid Unicode scalar values.\n      }\n      const c = String.fromCharCode(i);\n      if (c.normalize(\"NFKC\") !== c && !diacriticsRegex.test(c)) {\n        if (range.length !== 2) {\n          range[0] = range[1] = i;\n          continue;\n        }\n        if (range[1] + 1 !== i) {\n          if (range[0] === range[1]) {\n            ranges.push(String.fromCharCode(range[0]));\n          } else {\n            ranges.push(\n              `${String.fromCharCode(range[0])}-${String.fromCharCode(\n                range[1]\n              )}`\n            );\n          }\n          range[0] = range[1] = i;\n        } else {\n          range[1] = i;\n        }\n      }\n    }\n\n    const rangesStr = ranges.join(\"\");\n    if (!NormalizeWithNFKC) {\n      NormalizeWithNFKC = rangesStr;\n    } else if (rangesStr !== NormalizeWithNFKC) {\n      for (let i = 1; i < rangesStr.length; i++) {\n        if (rangesStr[i] !== NormalizeWithNFKC[i]) {\n          console.log(\n            `Difference at index ${i}: ` +\n              `U+${rangesStr.charCodeAt(i).toString(16).toUpperCase().padStart(4, \"0\")}` +\n              `!== U+${NormalizeWithNFKC.charCodeAt(i)\n                .toString(16)\n                .toUpperCase()\n                .padStart(4, \"0\")}`\n          );\n          break;\n        }\n      }\n      throw new Error(\n        \"getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.\"\n      );\n    }\n  }\n  return NormalizeWithNFKC;\n}\n\nexport { CharacterType, getCharacterType, getNormalizeWithNFKC };\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(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n\nimport { getCharacterType, getNormalizeWithNFKC } from \"./pdf_find_utils.js\";\nimport { binarySearchFirstItem } from \"./ui_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\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 = /([+^$|])|(\\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, options = {}) {\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  const hasSyllables = syllablePositions.length > 0;\n  const ignoreDashEOL = options.ignoreDashEOL ?? false;\n\n  let normalizationRegex;\n  if (!hasSyllables && noSyllablesRegExp) {\n    normalizationRegex = noSyllablesRegExp;\n  } else if (hasSyllables && 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 = getNormalizeWithNFKC();\n\n    // 3040-309F: Hiragana\n    // 30A0-30FF: Katakana\n    const CJK = \"(?:\\\\p{Ideographic}|[\\u3040-\\u30FF])\";\n    const HKDiacritics = \"(?:\\u3099|\\u309A)\";\n    const BrokenWord = `\\\\p{Ll}-\\\\n(?=\\\\p{Ll})|\\\\p{Lu}-\\\\n(?=\\\\p{L})`;\n\n    const regexps = [\n      /* p1 */ `[${replace}]`,\n      /* p2 */ `[${toNormalizeWithNFKC}]`,\n      /* p3 */ `${HKDiacritics}\\\\n`,\n      /* p4 */ \"\\\\p{M}+(?:-\\\\n)?\",\n      /* p5 */ `${BrokenWord}`,\n      /* p6 */ \"\\\\S-\\\\n\",\n      /* p7 */ `${CJK}\\\\n`,\n      /* p8 */ \"\\\\n\",\n      /* p9 */ hasSyllables\n        ? FIRST_CHAR_SYLLABLES_REG_EXP\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          \"\\\\u0000\",\n    ];\n    normalizationRegex = new RegExp(\n      regexps.map(r => `(${r})`).join(\"|\"),\n      \"gum\"\n    );\n\n    if (hasSyllables) {\n      withSyllablesRegExp = normalizationRegex;\n    } else {\n      noSyllablesRegExp = normalizationRegex;\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, p8, p9, 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        // We've a Katakana-Hiragana diacritic followed by a \\n so don't replace\n        // the \\n by a whitespace.\n        hasDiacritics = true;\n\n        // Diacritic.\n        if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n          ++rawDiacriticsIndex;\n        } else {\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 + 1, shift - 1);\n          shift -= 1;\n          shiftOrigin += 1;\n        }\n\n        // End-of-line.\n        positions.push(i - shift + 1, shift);\n        shiftOrigin += 1;\n        eol += 1;\n\n        return p3.charAt(0);\n      }\n\n      if (p4) {\n        const hasTrailingDashEOL = p4.endsWith(\"\\n\");\n        const len = hasTrailingDashEOL ? p4.length - 2 : p4.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 (p6)` block.\n          i += len - 1;\n          positions.push(i - shift + 1, 1 + shift);\n          shift += 1;\n          shiftOrigin += 1;\n          eol += 1;\n          return p4.slice(0, len);\n        }\n\n        return p4;\n      }\n\n      if (p5) {\n        if (ignoreDashEOL) {\n          // Keep the - but remove the EOL.\n          shiftOrigin += 1;\n          eol += 1;\n          return p5.slice(0, -1);\n        }\n        // In \"X-\\ny\", \"-\\n\" is removed because an hyphen at the end of a line\n        // between two letters is likely here to mark a break in a word.\n        // If X is encoded with UTF-32 then it can have a length greater than 1.\n        // The \\n isn't in the original text so here y = i, n = X.len - 2 and\n        // o = X.len - 1.\n        const len = p5.length - 2;\n        positions.push(i - shift + len, 1 + shift);\n        shift += 1;\n        shiftOrigin += 1;\n        eol += 1;\n        return p5.slice(0, -2);\n      }\n\n      if (p6) {\n        // A - following a non-space character that is not detected as the\n        // hyphen breaking a word in two lines needs to be preserved. It could\n        // be, for example, in a compound word or in a date.\n        // Only remove the newline.\n        shiftOrigin += 1;\n        eol += 1;\n        return p6.slice(0, -1);\n      }\n\n      if (p7) {\n        // An ideographic at the end of a line doesn't imply adding an extra\n        // white space.\n        // A CJK can be encoded in UTF-32, hence their length isn't always 1.\n        const len = p7.length - 1;\n        positions.push(i - shift + len, shift);\n        shiftOrigin += 1;\n        eol += 1;\n        return p7.slice(0, -1);\n      }\n\n      if (p8) {\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      // p9\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 p9;\n    }\n  );\n\n  positions.push(normalized.length, shift);\n  const starts = new Uint32Array(positions.length >> 1);\n  const shifts = new Int32Array(positions.length >> 1);\n  for (let i = 0, ii = positions.length; i < ii; i += 2) {\n    starts[i >> 1] = positions[i];\n    shifts[i >> 1] = positions[i + 1];\n  }\n\n  return [normalized, [starts, shifts], 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 [starts, shifts] = diffs;\n  // First char in the new string.\n  const start = pos;\n  // Last char in the new string.\n  const end = pos + len - 1;\n  let i = binarySearchFirstItem(starts, x => x >= start);\n  if (starts[i] > start) {\n    --i;\n  }\n\n  let j = binarySearchFirstItem(starts, x => x >= end, i);\n  if (starts[j] > end) {\n    --j;\n  }\n\n  // First char in the old string.\n  const oldStart = start + shifts[i];\n\n  // Last char in the old string.\n  const oldEnd = end + shifts[j];\n  const oldLen = oldEnd + 1 - oldStart;\n\n  return [oldStart, oldLen];\n}\n\n/**\n * @typedef {Object} PDFFindControllerOptions\n * @property {PDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n * @property {boolean} [updateMatchesCountOnProgress] - True if the matches\n *   count must be updated on progress or only when the last page is reached.\n *   The default value is `true`.\n */\n\n/**\n * Provides search functionality to find a given string in a PDF document.\n */\nclass PDFFindController {\n  #state = null;\n\n  #updateMatchesCountOnProgress = true;\n\n  #visitedPagesCount = 0;\n\n  #copiedPageData = null;\n\n  #savedPageData = null;\n\n  /**\n   * @param {PDFFindControllerOptions} options\n   */\n  constructor({ linkService, eventBus, updateMatchesCountOnProgress = true }) {\n    this._linkService = linkService;\n    this._eventBus = eventBus;\n    this.#updateMatchesCountOnProgress = updateMatchesCountOnProgress;\n\n    /**\n     * Callback used to check if a `pageNumber` is currently visible.\n     * @type {function}\n     */\n    this.onIsPageVisible = null;\n\n    this.#reset();\n    eventBus._on(\"find\", this.#onFind.bind(this));\n    eventBus._on(\"findbarclose\", this.#onFindBarClose.bind(this));\n    eventBus._on(\"pagesedited\", this.#onPagesEdited.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  /**\n   * @typedef {Object} PDFFindControllerScrollMatchIntoViewParams\n   * @property {HTMLElement} element\n   * @property {number} pageIndex\n   * @property {number} matchIndex\n   */\n\n  /**\n   * Scroll the current match into view.\n   * @param {PDFFindControllerScrollMatchIntoViewParams}\n   */\n  scrollMatchIntoView({ element = null, pageIndex = -1, matchIndex = -1 }) {\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    element.scrollIntoView({ block: \"start\", inline: \"center\" });\n  }\n\n  #reset() {\n    this._highlightMatches = false;\n    this._scrollMatches = false;\n    this._pdfDocument = null;\n    this._pageMatches = [];\n    this._pageMatchesLength = [];\n    this.#visitedPagesCount = 0;\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    this.#copiedPageData = null;\n\n    this._firstPageCapability = Promise.withResolvers();\n  }\n\n  /**\n   * @type {string|Array} The (current) normalized search query.\n   */\n  get #query() {\n    const { query } = this.#state;\n    if (typeof query === \"string\") {\n      if (query !== this._rawQuery) {\n        this._rawQuery = query;\n        [this._normalizedQuery] = normalize(query);\n      }\n      return this._normalizedQuery;\n    }\n    // We don't bother caching the normalized search query in the Array-case,\n    // since this code-path is *essentially* unused in the default viewer.\n    return (query || []).filter(q => !!q).map(q => normalize(q)[0]);\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    const newQuery = state.query,\n      prevQuery = this.#state.query;\n    const newType = typeof newQuery,\n      prevType = typeof prevQuery;\n\n    if (newType !== prevType) {\n      return true;\n    }\n    if (newType === \"string\") {\n      if (newQuery !== prevQuery) {\n        return true;\n      }\n    } else if (\n      /* isArray && */ JSON.stringify(newQuery) !== JSON.stringify(prevQuery)\n    ) {\n      return true;\n    }\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        return (\n          pageNumber >= 1 &&\n          pageNumber <= linkService.pagesCount &&\n          pageNumber !== linkService.page &&\n          !(this.onIsPageVisible?.(pageNumber) ?? true)\n        );\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  #convertToRegExpString(query, hasDiacritics) {\n    const { matchDiacritics } = this.#state;\n    let isUnicode = false;\n    const addExtraWhitespaces = (original, fixed) => {\n      if (original === query) {\n        return fixed;\n      }\n      if (query.startsWith(original)) {\n        return `${fixed}[ ]*`;\n      }\n      if (query.endsWith(original)) {\n        return `[ ]*${fixed}`;\n      }\n      return `[ ]*${fixed}[ ]*`;\n    };\n    query = query.replaceAll(\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 interfere with regexp syntax.\n          return addExtraWhitespaces(p1, RegExp.escape(p1));\n        }\n        if (p2) {\n          // Allow whitespaces around group of punctuation signs.\n          return addExtraWhitespaces(p2, RegExp.escape(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    if (!this.#state) {\n      return;\n    }\n    const query = this.#query;\n    if (query.length === 0) {\n      return; // Do nothing: the matches should be wiped out already.\n    }\n    const pageContent = this._pageContents[pageIndex];\n    const matcherResult = this.match(query, pageContent, pageIndex);\n\n    const matches = (this._pageMatches[pageIndex] = []);\n    const matchesLength = (this._pageMatchesLength[pageIndex] = []);\n    const diffs = this._pageDiffs[pageIndex];\n\n    matcherResult?.forEach(({ index, length }) => {\n      const [matchPos, matchLen] = getOriginalIndex(diffs, index, length);\n      if (matchLen) {\n        matches.push(matchPos);\n        matchesLength.push(matchLen);\n      }\n    });\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 = matches.length;\n    this._matchesCountTotal += pageMatchesCount;\n    if (this.#updateMatchesCountOnProgress) {\n      if (pageMatchesCount > 0) {\n        this.#updateUIResultsCount();\n      }\n    } else if (++this.#visitedPagesCount === this._linkService.pagesCount) {\n      // For example, in GeckoView we want to have only the final update because\n      // the Java side provides only one object to update the counts.\n      this.#updateUIResultsCount();\n    }\n  }\n\n  /**\n   * @typedef {Object} FindMatch\n   * @property {number} index - The start of the matched text in the page's\n   *   string contents.\n   * @property {number} length - The length of the matched text.\n   */\n\n  /**\n   * @param {string | string[]} query - The search query.\n   * @param {string} pageContent - The text content of the page to search in.\n   * @param {number} pageIndex - The index of the page that is being processed.\n   * @returns {FindMatch[] | undefined} An array of matches in the provided\n   *   page.\n   */\n  match(query, pageContent, pageIndex) {\n    const hasDiacritics = this._hasDiacritics[pageIndex];\n\n    let isUnicode = false;\n    if (typeof query === \"string\") {\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      query = query\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    if (!query) {\n      // The query can be empty because some chars like diacritics could have\n      // been stripped out.\n      return undefined;\n    }\n\n    const { caseSensitive, entireWord } = this.#state;\n    const flags = `g${isUnicode ? \"u\" : \"\"}${caseSensitive ? \"\" : \"i\"}`;\n    query = new RegExp(query, flags);\n\n    const matches = [];\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      matches.push({ index: match.index, length: match[0].length });\n    }\n    return matches;\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 deferred = Promise.resolve();\n    const textOptions = { disableNormalization: true };\n    const pdfDoc = this._pdfDocument;\n    for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n      const { promise, resolve } = Promise.withResolvers();\n      this._extractTextPromises[i] = promise;\n\n      deferred = deferred.then(async () => {\n        if (pdfDoc !== this._pdfDocument) {\n          resolve();\n          return;\n        }\n        await pdfDoc\n          .getPage(i + 1)\n          .then(pdfPage => pdfPage.getTextContent(textOptions))\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              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              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.#visitedPagesCount = 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    const query = this.#query;\n    if (query.length === 0) {\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  #onPagesEdited({ pagesMapper, type, pageNumbers }) {\n    if (this._extractTextPromises.length === 0) {\n      return;\n    }\n\n    if (type === \"copy\") {\n      const promises = new Map();\n      const contents = new Map();\n      const diffs = new Map();\n      const diacritics = new Map();\n      for (const pageNum of pageNumbers) {\n        promises.set(pageNum, this._extractTextPromises[pageNum - 1]);\n        contents.set(pageNum, this._pageContents[pageNum - 1]);\n        diffs.set(pageNum, this._pageDiffs[pageNum - 1]);\n        diacritics.set(pageNum, this._hasDiacritics[pageNum - 1]);\n      }\n      this.#copiedPageData = { promises, contents, diffs, diacritics };\n      return;\n    }\n\n    if (type === \"cancelCopy\") {\n      this.#copiedPageData = null;\n      return;\n    }\n\n    if (type === \"delete\") {\n      this.#savedPageData = {\n        promises: this._extractTextPromises,\n        contents: this._pageContents,\n        diffs: this._pageDiffs,\n        diacritics: this._hasDiacritics,\n      };\n    }\n\n    if (type === \"cancelDelete\") {\n      this._extractTextPromises = this.#savedPageData.promises;\n      this._pageContents = this.#savedPageData.contents;\n      this._pageDiffs = this.#savedPageData.diffs;\n      this._hasDiacritics = this.#savedPageData.diacritics;\n      return;\n    }\n\n    if (type === \"cleanSavedData\") {\n      this.#savedPageData = null;\n      return;\n    }\n\n    // Cancel any pending find timeout and clear a pending resume page index\n    // synchronously. Calling #onFindBarClose() here would schedule its cleanup\n    // asynchronously.\n    if (this._findTimeout) {\n      clearTimeout(this._findTimeout);\n      this._findTimeout = null;\n    }\n    this._resumePageIdx = null;\n    this._dirtyMatch = true;\n    const prevPromises = this._extractTextPromises;\n    const prevContents = this._pageContents;\n    const prevDiffs = this._pageDiffs;\n    const prevDiacritics = this._hasDiacritics;\n    const extractTextPromises = (this._extractTextPromises = []);\n    const pageContents = (this._pageContents = []);\n    const pageDiffs = (this._pageDiffs = []);\n    const hasDiacritics = (this._hasDiacritics = []);\n    for (let i = 1, ii = pagesMapper.pagesNumber; i <= ii; i++) {\n      const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n      if (prevPageNumber < 0) {\n        const src = -prevPageNumber;\n        extractTextPromises.push(\n          this.#copiedPageData?.promises.get(src) || Promise.resolve()\n        );\n        pageContents.push(this.#copiedPageData?.contents.get(src) ?? \"\");\n        pageDiffs.push(this.#copiedPageData?.diffs.get(src) ?? null);\n        hasDiacritics.push(this.#copiedPageData?.diacritics.get(src) ?? false);\n        continue;\n      }\n      extractTextPromises.push(\n        prevPromises[prevPageNumber - 1] || Promise.resolve()\n      );\n      pageContents.push(prevContents[prevPageNumber - 1] ?? \"\");\n      pageDiffs.push(prevDiffs[prevPageNumber - 1] ?? null);\n      hasDiacritics.push(prevDiacritics[prevPageNumber - 1] ?? false);\n    }\n    if (this.#state) {\n      this.#nextMatch();\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    if (\n      !this.#updateMatchesCountOnProgress &&\n      (this.#visitedPagesCount !== this._linkService.pagesCount ||\n        state === FindState.PENDING)\n    ) {\n      // When this.#updateMatchesCountOnProgress is false we only send an update\n      // when everything is ready.\n      return;\n    }\n\n    this._eventBus.dispatch(\"updatefindcontrolstate\", {\n      source: this,\n      state,\n      previous,\n      entireWord: this.#state?.entireWord ?? null,\n      matchesCount: this.#requestMatchesCount(),\n      rawQuery: this.#state?.query ?? null,\n    });\n  }\n}\n\nexport { FindState, getOriginalIndex, normalize, PDFFindController };\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\";\nimport { toggleExpandedBtn } from \"./ui_utils.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  #mainContainer;\n\n  #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n\n  opened = false;\n\n  constructor(options, mainContainer, eventBus) {\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.#mainContainer = mainContainer;\n\n    const checkedInputs = new Map([\n      [this.highlightAll, \"highlightallchange\"],\n      [this.caseSensitive, \"casesensitivitychange\"],\n      [this.entireWord, \"entirewordchange\"],\n      [this.matchDiacritics, \"diacriticmatchingchange\"],\n    ]);\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\", ({ keyCode, shiftKey, target }) => {\n      switch (keyCode) {\n        case 13: // Enter\n          if (target === this.findField) {\n            this.dispatchEvent(\"again\", shiftKey);\n          } else if (checkedInputs.has(target)) {\n            target.checked = !target.checked;\n            this.dispatchEvent(/* evtName = */ checkedInputs.get(target));\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    this.findNextButton.addEventListener(\"click\", () => {\n      this.dispatchEvent(\"again\", false);\n    });\n\n    for (const [elem, evtName] of checkedInputs) {\n      elem.addEventListener(\"click\", () => {\n        this.dispatchEvent(evtName);\n      });\n    }\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      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    const { findField, findMsg } = this;\n    let findMsgId = \"\",\n      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        findMsgId = \"pdfjs-find-not-found\";\n        status = \"notFound\";\n        break;\n      case FindState.WRAPPED:\n        findMsgId = previous\n          ? \"pdfjs-find-reached-top\"\n          : \"pdfjs-find-reached-bottom\";\n        break;\n    }\n    findField.setAttribute(\"data-status\", status);\n    findField.setAttribute(\"aria-invalid\", state === FindState.NOT_FOUND);\n\n    findMsg.setAttribute(\"data-status\", status);\n    if (findMsgId) {\n      findMsg.setAttribute(\"data-l10n-id\", findMsgId);\n    } else {\n      findMsg.removeAttribute(\"data-l10n-id\");\n      findMsg.textContent = \"\";\n    }\n\n    this.updateResultsCount(matchesCount);\n  }\n\n  updateResultsCount({ current = 0, total = 0 } = {}) {\n    const { findResultsCount } = this;\n\n    if (total > 0) {\n      const limit = MATCHES_COUNT_LIMIT;\n\n      findResultsCount.setAttribute(\n        \"data-l10n-id\",\n        total > limit\n          ? \"pdfjs-find-match-count-limit\"\n          : \"pdfjs-find-match-count\"\n      );\n      findResultsCount.setAttribute(\n        \"data-l10n-args\",\n        JSON.stringify({ limit, current, total })\n      );\n    } else {\n      findResultsCount.removeAttribute(\"data-l10n-id\");\n      findResultsCount.textContent = \"\";\n    }\n  }\n\n  open() {\n    if (!this.opened) {\n      // Potentially update the findbar layout, row vs column, when:\n      //  - The width of the viewer itself changes.\n      //  - The width of the findbar changes, by toggling the visibility\n      //    (or localization) of find count/status messages.\n      this.#resizeObserver.observe(this.#mainContainer);\n      this.#resizeObserver.observe(this.bar);\n\n      this.opened = true;\n      toggleExpandedBtn(this.toggleButton, true, this.bar);\n    }\n    this.findField.select();\n    this.findField.focus();\n  }\n\n  close() {\n    if (!this.opened) {\n      return;\n    }\n    this.#resizeObserver.disconnect();\n\n    this.opened = false;\n    toggleExpandedBtn(this.toggleButton, false, this.bar);\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  #resizeObserverCallback() {\n    const { bar } = this;\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    bar.classList.remove(\"wrapContainers\");\n\n    const findbarHeight = bar.clientHeight;\n    const inputContainerHeight = 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      bar.classList.add(\"wrapContainers\");\n    }\n  }\n}\n\nexport { PDFFindBar };\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(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n\nimport { isValidRotation, parseQueryString } from \"./ui_utils.js\";\nimport { updateUrlHash } from \"pdfjs-lib\";\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 {PDFLinkService} 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  #eventAbortController = null;\n\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    // 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  #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 { href, protocol } = document.location;\n      if (protocol !== \"file:\") {\n        newUrl = updateUrlHash(href, destination.hash);\n      }\n    }\n    if (shouldReplace) {\n      window.history.replaceState(newState, \"\", newUrl);\n    } else {\n      window.history.pushState(newState, \"\", newUrl);\n    }\n  }\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  #isValidPage(val) {\n    return (\n      Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n    );\n  }\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  #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  #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  #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  #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  #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  #bindEvents() {\n    if (this.#eventAbortController) {\n      return; // The event listeners were already added.\n    }\n    this.#eventAbortController = new AbortController();\n    const { signal } = this.#eventAbortController;\n\n    this.eventBus._on(\"updateviewarea\", this.#updateViewarea.bind(this), {\n      signal,\n    });\n    window.addEventListener(\"popstate\", this.#popState.bind(this), { signal });\n    window.addEventListener(\"pagehide\", this.#pageHide.bind(this), { signal });\n  }\n\n  #unbindEvents() {\n    this.#eventAbortController?.abort();\n    this.#eventAbortController = 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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/optional_content_config.js\").OptionalContentConfig} OptionalContentConfig */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\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 */\n\n/**\n * @typedef {Object} PDFLayerViewerRenderParameters\n * @property {OptionalContentConfig|null} optionalContentConfig - An\n *   {OptionalContentConfig} instance.\n * @property {PDFDocumentProxy} pdfDocument - A {PDFDocument} instance.\n */\n\nclass PDFLayerViewer extends BaseTreeViewer {\n  constructor(options) {\n    super(options);\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\n    this._optionalContentVisibility?.clear();\n    this._optionalContentVisibility = null;\n  }\n\n  /**\n   * @protected\n   */\n  _dispatchEvent(layersCount) {\n    this.eventBus.dispatch(\"layersloaded\", {\n      source: this,\n      layersCount,\n    });\n  }\n\n  /**\n   * @protected\n   */\n  _bindLink(element, { groupId, input }) {\n    const setVisibility = () => {\n      const visible = input.checked;\n      this._optionalContentConfig.setVisibility(groupId, visible);\n\n      const cached = this._optionalContentVisibility.get(groupId);\n      if (cached) {\n        cached.visible = visible;\n      }\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  _setNestedName(element, { name = null }) {\n    if (typeof name === \"string\") {\n      element.textContent = this._normalizeTextContent(name);\n      return;\n    }\n    element.setAttribute(\"data-l10n-id\", \"pdfjs-additional-layers\");\n    element.style.fontStyle = \"italic\";\n    // Trigger translation manually, since translation is paused when\n    // the final layer-tree is appended to the DOM.\n    this._l10n.translateOnce(element);\n  }\n\n  /**\n   * @protected\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._optionalContentVisibility = new Map();\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          const label = document.createElement(\"label\");\n          const input = document.createElement(\"input\");\n          label.append(\n            input,\n            document.createTextNode(this._normalizeTextContent(group.name))\n          );\n          this._bindLink(element, { groupId, input });\n          input.type = \"checkbox\";\n          input.checked = group.visible;\n\n          this._optionalContentVisibility.set(groupId, {\n            input,\n            visible: input.checked,\n          });\n\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({ intent: \"display\" }));\n\n    if (pdfDocument !== this._pdfDocument) {\n      return; // The document was closed while the optional content resolved.\n    }\n    if (promise) {\n      // Ensure that the UI displays the correct state (e.g. with RBGroups).\n      for (const [groupId, cached] of this._optionalContentVisibility) {\n        const group = optionalContentConfig.getGroup(groupId);\n\n        if (group && cached.visible !== group.visible) {\n          cached.input.checked = cached.visible = !cached.visible;\n        }\n      }\n      return;\n    }\n    this.eventBus.dispatch(\"optionalcontentconfig\", {\n      source: this,\n      promise: Promise.resolve(optionalContentConfig),\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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./download_manager.js\").DownloadManager} DownloadManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n\nimport { BaseTreeViewer } from \"./base_tree_viewer.js\";\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 {PDFLinkService} 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 {PDFDocumentProxy} 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      this._currentOutlineItemCapability?.resolve(\n        /* enabled = */ this._isPagesLoaded\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    this._currentOutlineItemCapability?.resolve(/* enabled = */ false);\n    this._currentOutlineItemCapability = null;\n  }\n\n  /**\n   * @protected\n   */\n  _dispatchEvent(outlineCount) {\n    this._currentOutlineItemCapability = Promise.withResolvers();\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   * @protected\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          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   * @protected\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 = Promise.withResolvers();\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 (destRef && typeof destRef === \"object\") {\n            // The page reference must be available, since the current method\n            // won't be invoked until all pages have been loaded.\n            pageNumber = pdfDocument.cachedPageNumber(destRef);\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\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n/** @typedef {import(\"./pdf_viewer.js\").PDFViewer} PDFViewer */\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  #fullscreenChangeAbortController = null;\n\n  #windowAbortController = 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 {\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 = {\n          mode: AnnotationEditorType.NONE,\n        };\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    document.getSelection().empty();\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 = {\n          mode: this.#args.annotationEditorMode,\n        };\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    if (this.#windowAbortController) {\n      return;\n    }\n    this.#windowAbortController = new AbortController();\n    const { signal } = this.#windowAbortController;\n\n    const touchSwipeBind = this.#touchSwipe.bind(this);\n\n    window.addEventListener(\"mousemove\", this.#showControls.bind(this), {\n      signal,\n    });\n    window.addEventListener(\"mousedown\", this.#mouseDown.bind(this), {\n      signal,\n    });\n    window.addEventListener(\"wheel\", this.#mouseWheel.bind(this), {\n      passive: false,\n      signal,\n    });\n    window.addEventListener(\"keydown\", this.#resetMouseScrollState.bind(this), {\n      signal,\n    });\n    window.addEventListener(\"contextmenu\", this.#contextMenu.bind(this), {\n      signal,\n    });\n    window.addEventListener(\"touchstart\", touchSwipeBind, { signal });\n    window.addEventListener(\"touchmove\", touchSwipeBind, { signal });\n    window.addEventListener(\"touchend\", touchSwipeBind, { signal });\n  }\n\n  #removeWindowListeners() {\n    this.#windowAbortController?.abort();\n    this.#windowAbortController = null;\n  }\n\n  #addFullscreenChangeListeners() {\n    if (this.#fullscreenChangeAbortController) {\n      return;\n    }\n    this.#fullscreenChangeAbortController = new AbortController();\n\n    window.addEventListener(\n      \"fullscreenchange\",\n      () => {\n        if (/* isFullscreen = */ document.fullscreenElement) {\n          this.#enter();\n        } else {\n          this.#exit();\n        }\n      },\n      { signal: this.#fullscreenChangeAbortController.signal }\n    );\n  }\n\n  #removeFullscreenChangeListeners() {\n    this.#fullscreenChangeAbortController?.abort();\n    this.#fullscreenChangeAbortController = null;\n  }\n}\n\nexport { PDFPresentationMode };\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/annotation_storage\").AnnotationStorage} AnnotationStorage */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n\nimport { XfaLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} XfaLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {PDFLinkService} linkService\n * @property {Object} [xfaHtml]\n */\n\n/**\n * @typedef {Object} XfaLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass XfaLayerBuilder {\n  /**\n   * @param {XfaLayerBuilderOptions} options\n   */\n  constructor({\n    pdfPage,\n    annotationStorage = null,\n    linkService,\n    xfaHtml = null,\n  }) {\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 {XfaLayerBuilderRenderOptions} viewport\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  async 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      this.div = document.createElement(\"div\");\n      parameters.div = this.div;\n\n      return XfaLayer.render(parameters);\n    }\n\n    // intent === \"display\"\n    const xfaHtml = await this.pdfPage.getXfa();\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    parameters.div = this.div;\n\n    return XfaLayer.render(parameters);\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 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\nclass BasePrintServiceFactory {\n  constructor() {\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n      throw new Error(\"Cannot initialize BasePrintServiceFactory.\");\n    }\n  }\n\n  static initGlobals(app) {}\n\n  static get supportsPrinting() {\n    throw new Error(\"Not implemented: supportsPrinting\");\n  }\n\n  static createPrintService(params) {\n    throw new Error(\"Not implemented: createPrintService\");\n  }\n}\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      pdfPage: null,\n      annotationStorage: pdfDocument.annotationStorage,\n      linkService,\n      xfaHtml: xfaPage,\n    });\n    const viewport = getXfaPageViewport(xfaPage, { scale });\n\n    builder.render({ viewport, intent: \"print\" });\n    page.append(builder.div);\n  }\n}\n\nexport { BasePrintServiceFactory, getXfaHtmlForPrinting };\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  AnnotationMode,\n  PixelsPerInch,\n  RenderingCancelledException,\n  shadow,\n} from \"pdfjs-lib\";\nimport {\n  BasePrintServiceFactory,\n  getXfaHtmlForPrinting,\n} from \"./print_utils.js\";\n\nlet activeService = null;\nlet dialog = null;\nlet overlayManager = null;\nlet viewerApp = { initialized: false };\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      canvas: scratchCanvas,\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    const renderTask = pdfPage.render(renderContext);\n\n    return renderTask.promise.catch(reason => {\n      if (!(reason instanceof RenderingCancelledException)) {\n        console.error(reason);\n      }\n      throw reason;\n    });\n  });\n}\n\nclass PDFPrintService {\n  constructor({\n    pdfDocument,\n    pagesOverview,\n    printContainer,\n    printResolution,\n    printAnnotationStoragePromise = null,\n  }) {\n    this.pdfDocument = pdfDocument;\n    this.pagesOverview = pagesOverview;\n    this.printContainer = printContainer;\n    this._printResolution = printResolution || 150;\n    this._optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n      intent: \"print\",\n    });\n    this._printAnnotationStoragePromise =\n      printAnnotationStoragePromise || Promise.resolve();\n    this.currentPage = -1;\n    // The temporary canvas where renderPage paints one page at a time.\n    this.scratchCanvas = document.createElement(\"canvas\");\n  }\n\n  layout() {\n    this.throwIfInactive();\n\n    const body = document.querySelector(\"body\");\n    body.setAttribute(\"data-pdfjsprinting\", true);\n\n    const { width, height } = this.pagesOverview[0];\n    const hasEqualPageSizes = this.pagesOverview.every(\n      size => size.width === width && size.height === height\n    );\n    if (!hasEqualPageSizes) {\n      console.warn(\n        \"Not all pages have the same size. The printed 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, the next stylesheet\n    // will be ignored and the user has to select the correct paper size in\n    // the UI if wanted.\n    this.pageStyleSheet = document.createElement(\"style\");\n    this.pageStyleSheet.textContent = `@page { size: ${width}pt ${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    if (this._blobURLs) {\n      for (const url of this._blobURLs) {\n        URL.revokeObjectURL(url);\n      }\n      this._blobURLs = null;\n    }\n    this.scratchCanvas.width = this.scratchCanvas.height = 0;\n    this.scratchCanvas = null;\n    activeService = null;\n    ensureOverlay().then(function () {\n      overlayManager.closeIfActive(dialog);\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);\n        resolve();\n        return;\n      }\n      const index = this.currentPage;\n      renderProgress(index, pageCount);\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    this.scratchCanvas.toBlob(blob => {\n      const blobURL = URL.createObjectURL(blob);\n      img.src = blobURL;\n      // Defer revocation until after printing completes (in destroy()) to avoid\n      // broken print images in Firefox when a service worker is registered,\n      // since Firefox re-fetches blob URLs when rendering the print dialog.\n      // See https://github.com/mozilla/pdf.js/issues/19988\n      (this._blobURLs ??= []).push(blobURL);\n    });\n\n    const wrapper = document.createElement(\"div\");\n    wrapper.className = \"printedPage\";\n    wrapper.append(img);\n    this.printContainer.append(wrapper);\n\n    const { promise, resolve, reject } = Promise.withResolvers();\n    img.onload = resolve;\n    img.onerror = reject;\n\n    promise.catch(() => {\n      // Avoid \"Uncaught promise\" messages in the console.\n    });\n    return promise;\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      if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n        // eslint-disable-next-line no-unsafe-finally\n        throw new Error(\"window.print() is not supported\");\n      }\n      console.error(\"Expected print service to be initialized.\");\n      ensureOverlay().then(function () {\n        overlayManager.closeIfActive(dialog);\n      });\n    } else {\n      const activeServiceOnEntry = activeService;\n      activeService\n        .renderPages()\n        .then(() => activeServiceOnEntry.performPrint())\n        .catch(() => {\n          // Ignore any error messages.\n        })\n        .then(() => {\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\n          // aborting this print request while the pages were being generated)\n          // would be aborted.\n          if (activeServiceOnEntry.active) {\n            abort();\n          }\n        });\n    }\n  }\n};\n\nfunction dispatchEvent(eventType) {\n  const event = new CustomEvent(eventType, {\n    bubbles: false,\n    cancelable: false,\n    detail: \"custom\",\n  });\n  window.dispatchEvent(event);\n}\n\nfunction abort() {\n  if (activeService) {\n    activeService.destroy();\n    dispatchEvent(\"afterprint\");\n  }\n}\n\nfunction renderProgress(index, total) {\n  if (typeof PDFJSDev === \"undefined\" && window.isGECKOVIEW) {\n    return;\n  }\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  progressPerc.setAttribute(\"data-l10n-args\", JSON.stringify({ progress }));\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 (typeof PDFJSDev === \"undefined\" && window.isGECKOVIEW) {\n    return Promise.reject(\n      new Error(\"ensureOverlay not implemented in GECKOVIEW development mode.\")\n    );\n  }\n  if (!overlayPromise) {\n    overlayManager = viewerApp.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\nclass PDFPrintServiceFactory extends BasePrintServiceFactory {\n  static initGlobals(app) {\n    viewerApp = app;\n  }\n\n  static get supportsPrinting() {\n    return shadow(this, \"supportsPrinting\", true);\n  }\n\n  static createPrintService(params) {\n    if (activeService) {\n      throw new Error(\"The print service is created and active.\");\n    }\n    return (activeService = new PDFPrintService(params));\n  }\n}\n\nexport { PDFPrintServiceFactory };\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 RenderingStates = {\n  INITIAL: 0,\n  RUNNING: 1,\n  PAUSED: 2,\n  FINISHED: 3,\n};\n\nclass RenderableView {\n  /**\n   * Unique ID for rendering queue.\n   * @type {string}\n   */\n  renderingId = \"\";\n\n  /**\n   * @type {import(\"../src/display/api\").RenderTask | null}\n   */\n  renderTask = null;\n\n  /**\n   * @type {function | null}\n   */\n  resume = null;\n\n  constructor() {\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n      this.constructor === RenderableView\n    ) {\n      throw new Error(\"Cannot initialize RenderableView.\");\n    }\n  }\n\n  /**\n   * @type {number}\n   */\n  get renderingState() {\n    throw new Error(\"Abstract getter `renderingState` accessed\");\n  }\n\n  /**\n   * @param {number} state\n   */\n  set renderingState(state) {\n    throw new Error(\"Abstract setter `renderingState` accessed\");\n  }\n\n  /**\n   * @returns {Promise} Resolved on draw completion.\n   */\n  async draw() {\n    throw new Error(\"Not implemented: draw\");\n  }\n}\n\nexport { RenderableView, RenderingStates };\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(\"./pdf_viewer\").PDFViewer} PDFViewer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_thumbnail_viewer\").PDFThumbnailViewer} PDFThumbnailViewer */\n/** @typedef {import(\"./renderable_view\").RenderableView} RenderableView */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./renderable_view.js\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n  #highestPriorityPage = null;\n\n  #idleTimeout = null;\n\n  #pdfThumbnailViewer = null;\n\n  #pdfViewer = null;\n\n  isThumbnailViewEnabled = false;\n\n  onIdle = null;\n\n  printing = false;\n\n  constructor() {\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      Object.defineProperty(this, \"hasViewer\", {\n        value: () => !!this.#pdfViewer,\n      });\n    }\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 {RenderableView} view\n   * @returns {boolean}\n   */\n  isHighestPriority(view) {\n    return this.#highestPriorityPage === view.renderingId;\n  }\n\n  /**\n   * @param {Object} currentlyVisiblePages\n   */\n  renderHighestPriority(currentlyVisiblePages) {\n    if (this.#idleTimeout) {\n      clearTimeout(this.#idleTimeout);\n      this.#idleTimeout = null;\n    }\n\n    // Pages have a higher priority than thumbnails, so check them first.\n    if (this.#pdfViewer.forceRendering(currentlyVisiblePages)) {\n      return;\n    }\n    // No pages needed rendering, so check thumbnails.\n    if (\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   * @param {boolean} [ignoreDetailViews]\n   */\n  getHighestPriority(\n    visible,\n    views,\n    scrolledDown,\n    preRenderExtra = false,\n    ignoreDetailViews = false\n  ) {\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. zoomed-in partial views of visible pages, unless `ignoreDetailViews`\n     * 3. 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\n    if (!ignoreDetailViews) {\n      for (let i = 0; i < numVisible; i++) {\n        const { detailView } = visibleViews[i].view;\n        if (detailView && !this.isViewFinished(detailView)) {\n          return detailView;\n        }\n      }\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 {RenderableView} 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 {RenderableView} 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 } from \"./ui_utils.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\nimport { 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\n *   scripting bundle.\n * @property {Object} [externalServices] - 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} [docProperties] - The function that is used to lookup\n *   the necessary document properties.\n */\n\nclass PDFScriptingManager {\n  #closeCapability = null;\n\n  #destroyCapability = null;\n\n  #docProperties = null;\n\n  #eventAbortController = null;\n\n  #eventBus = null;\n\n  #externalServices = null;\n\n  #pdfDocument = null;\n\n  #pdfViewer = null;\n\n  #ready = false;\n\n  #scripting = null;\n\n  #willPrintCapability = null;\n\n  /**\n   * @param {PDFScriptingManagerOptions} options\n   */\n  constructor({ eventBus, externalServices = null, docProperties = null }) {\n    this.#eventBus = eventBus;\n    this.#externalServices = externalServices;\n    this.#docProperties = docProperties;\n\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n      Object.defineProperty(this, \"sandboxTrip\", {\n        value: () =>\n          setTimeout(\n            () =>\n              this.#scripting?.dispatchEventInSandbox({\n                name: \"sandboxtripbegin\",\n              }),\n            0\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.#initScripting();\n    } catch (error) {\n      console.error(\"setDocument:\", error);\n\n      await this.#destroyScripting();\n      return;\n    }\n    const eventBus = this.#eventBus;\n\n    this.#eventAbortController = new AbortController();\n    const { signal } = this.#eventAbortController;\n\n    eventBus._on(\n      \"updatefromsandbox\",\n      event => {\n        if (event?.source === window) {\n          this.#updateFromSandbox(event.detail);\n        }\n      },\n      { signal }\n    );\n    eventBus._on(\n      \"dispatcheventinsandbox\",\n      event => {\n        this.#scripting?.dispatchEventInSandbox(event.detail);\n      },\n      { signal }\n    );\n\n    eventBus._on(\n      \"pagechanging\",\n      ({ 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      { signal }\n    );\n    eventBus._on(\n      \"pagerendered\",\n      ({ 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      { signal }\n    );\n    eventBus._on(\n      \"pagesdestroy\",\n      async () => {\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      { signal }\n    );\n\n    try {\n      const docProperties = await this.#docProperties(pdfDocument);\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      eventBus.dispatch(\"sandboxcreated\", { source: this });\n    } catch (error) {\n      console.error(\"setDocument:\", error);\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() {\n    return this.#scripting?.dispatchEventInSandbox({\n      id: \"doc\",\n      name: \"WillSave\",\n    });\n  }\n\n  async dispatchDidSave() {\n    return this.#scripting?.dispatchEventInSandbox({\n      id: \"doc\",\n      name: \"DidSave\",\n    });\n  }\n\n  async dispatchWillPrint() {\n    if (!this.#scripting) {\n      return;\n    }\n    await this.#willPrintCapability?.promise;\n    this.#willPrintCapability = Promise.withResolvers();\n    try {\n      await this.#scripting.dispatchEventInSandbox({\n        id: \"doc\",\n        name: \"WillPrint\",\n      });\n    } catch (ex) {\n      this.#willPrintCapability.resolve();\n      this.#willPrintCapability = null;\n      throw ex;\n    }\n\n    await this.#willPrintCapability.promise;\n  }\n\n  async dispatchDidPrint() {\n    return this.#scripting?.dispatchEventInSandbox({\n      id: \"doc\",\n      name: \"DidPrint\",\n    });\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 _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  async #updateFromSandbox(detail) {\n    const pdfViewer = this.#pdfViewer;\n    // Ignore some events, see below, that don't make sense in PresentationMode.\n    const isInPresentationMode =\n      pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode;\n\n    const { id, siblings, command, value } = detail;\n    if (!id) {\n      if (\n        typeof PDFJSDev !== \"undefined\" &&\n        PDFJSDev.test(\"TESTING\") &&\n        command === \"sandboxTripEnd\"\n      ) {\n        window.setTimeout(() => {\n          window.dispatchEvent(new CustomEvent(\"sandboxtripend\"));\n        }, 0);\n        return;\n      }\n\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            const modes = apiPageLayoutToViewerModes(value);\n            pdfViewer.spreadMode = modes.spreadMode;\n          }\n          break;\n        case \"page-num\":\n          pdfViewer.currentPageNumber = value + 1;\n          break;\n        case \"print\":\n          await 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            pdfViewer.currentScaleValue = value;\n          }\n          break;\n        case \"SaveAs\":\n          this.#eventBus.dispatch(\"download\", { source: this });\n          break;\n        case \"FirstPage\":\n          pdfViewer.currentPageNumber = 1;\n          break;\n        case \"LastPage\":\n          pdfViewer.currentPageNumber = pdfViewer.pagesCount;\n          break;\n        case \"NextPage\":\n          pdfViewer.nextPage();\n          break;\n        case \"PrevPage\":\n          pdfViewer.previousPage();\n          break;\n        case \"ZoomViewIn\":\n          if (!isInPresentationMode) {\n            pdfViewer.increaseScale();\n          }\n          break;\n        case \"ZoomViewOut\":\n          if (!isInPresentationMode) {\n            pdfViewer.decreaseScale();\n          }\n          break;\n        case \"WillPrintFinished\":\n          this.#willPrintCapability?.resolve();\n          this.#willPrintCapability = null;\n          break;\n      }\n      return;\n    }\n\n    if (isInPresentationMode && detail.focus) {\n      return;\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  async #dispatchPageOpen(pageNumber, initialize = false) {\n    const pdfDocument = this.#pdfDocument,\n      visitedPages = this._visitedPages;\n\n    if (initialize) {\n      this.#closeCapability = Promise.withResolvers();\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  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  #initScripting() {\n    this.#destroyCapability = Promise.withResolvers();\n\n    if (this.#scripting) {\n      throw new Error(\"#initScripting: Scripting already exists.\");\n    }\n    return this.#externalServices.createScripting();\n  }\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(() => {\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 {}\n\n    this.#willPrintCapability?.reject(new Error(\"Scripting destroyed.\"));\n    this.#willPrintCapability = null;\n\n    this.#eventAbortController?.abort();\n    this.#eventAbortController = null;\n\n    this._pageOpenPending.clear();\n    this._visitedPages.clear();\n\n    this.#scripting = null;\n    this.#ready = false;\n\n    this.#destroyCapability?.resolve();\n  }\n}\n\nexport { PDFScriptingManager };\n","/* Copyright 2025 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 { noContextMenu, stopEvent } from \"pdfjs-lib\";\n\nclass Menu {\n  #triggeringButton;\n\n  #menu;\n\n  #menuItems;\n\n  #openMenuAC = null;\n\n  #menuAC = new AbortController();\n\n  #lastIndex = -1;\n\n  #onFocusOutBound = this.#onFocusOut.bind(this);\n\n  /**\n   * Create a menu for the given button.\n   * @param {HTMLElement} menuContainer\n   * @param {HTMLElement} triggeringButton\n   * @param {Array<HTMLElement>|null} menuItems\n   */\n  constructor(menuContainer, triggeringButton, menuItems) {\n    this.#menu = menuContainer;\n    this.#triggeringButton = triggeringButton;\n    if (Array.isArray(menuItems)) {\n      this.#menuItems = menuItems;\n    } else {\n      this.#menuItems = [];\n      for (const button of this.#menu.querySelectorAll(\"button\")) {\n        this.#menuItems.push(button);\n      }\n    }\n    this.#setUpMenu();\n  }\n\n  /**\n   * Close the menu.\n   */\n  #closeMenu() {\n    if (!this.#openMenuAC) {\n      return;\n    }\n    const menu = this.#menu;\n    this.#triggeringButton.ariaExpanded = \"false\";\n    this.#openMenuAC.abort();\n    this.#openMenuAC = null;\n    if (menu.contains(document.activeElement)) {\n      // If the menu is closed while focused, focus the actions button.\n      setTimeout(() => {\n        if (!menu.contains(document.activeElement)) {\n          this.#triggeringButton.focus();\n        }\n      }, 0);\n    }\n    this.#lastIndex = -1;\n  }\n\n  /**\n   * Open the menu.\n   */\n  #openMenu() {\n    if (this.#openMenuAC) {\n      return;\n    }\n\n    const menu = this.#menu;\n    this.#triggeringButton.ariaExpanded = \"true\";\n    this.#openMenuAC = new AbortController();\n    const signal = AbortSignal.any([\n      this.#menuAC.signal,\n      this.#openMenuAC.signal,\n    ]);\n    window.addEventListener(\n      \"pointerdown\",\n      ({ target }) => {\n        if (\n          !this.#triggeringButton.contains(target) &&\n          !menu.contains(target)\n        ) {\n          this.#closeMenu();\n        }\n      },\n      { signal }\n    );\n    const closeMenu = this.#closeMenu.bind(this);\n    window.addEventListener(\"blur\", closeMenu, { signal });\n    menu.addEventListener(\"focusout\", this.#onFocusOutBound, { signal });\n  }\n\n  #onFocusOut({ relatedTarget }) {\n    if (\n      !this.#triggeringButton.contains(relatedTarget) &&\n      !this.#menu.contains(relatedTarget)\n    ) {\n      this.#closeMenu();\n    }\n  }\n\n  /**\n   * Set up the menu.\n   */\n  #setUpMenu() {\n    this.#triggeringButton.addEventListener(\"click\", e => {\n      if (this.#openMenuAC) {\n        this.#closeMenu();\n        return;\n      }\n\n      this.#openMenu();\n    });\n    this.#triggeringButton.addEventListener(\"focusout\", this.#onFocusOutBound);\n\n    const { signal } = this.#menuAC;\n\n    this.#menu.addEventListener(\n      \"keydown\",\n      e => {\n        switch (e.key) {\n          case \"Escape\":\n            this.#closeMenu();\n            stopEvent(e);\n            break;\n          case \"ArrowDown\":\n            this.#goToNextItem(e.target, true);\n            stopEvent(e);\n            break;\n          case \"ArrowUp\":\n            this.#goToNextItem(e.target, false);\n            stopEvent(e);\n            break;\n          case \"Home\":\n            this.#menuItems\n              .find(\n                item => !item.disabled && !item.classList.contains(\"hidden\")\n              )\n              ?.focus();\n            stopEvent(e);\n            break;\n          case \"End\":\n            this.#menuItems\n              .findLast(\n                item => !item.disabled && !item.classList.contains(\"hidden\")\n              )\n              ?.focus();\n            stopEvent(e);\n            break;\n          default:\n            const { key } = e;\n            if (!/^\\p{L}$/u.test(key)) {\n              // It isn't a single letter, so ignore it.\n              break;\n            }\n            const char = key.toLocaleLowerCase();\n            this.#goToNextItem(e.target, true, item =>\n              item.textContent.trim().toLowerCase().startsWith(char)\n            );\n            stopEvent(e);\n            break;\n        }\n      },\n      { signal, capture: true }\n    );\n    this.#menu.addEventListener(\"contextmenu\", noContextMenu, { signal });\n    this.#menu.addEventListener(\"click\", this.#closeMenu.bind(this), {\n      signal,\n      capture: true,\n    });\n    this.#triggeringButton.addEventListener(\n      \"keydown\",\n      e => {\n        switch (e.key) {\n          case \" \":\n          case \"Enter\":\n          case \"ArrowDown\":\n          case \"Home\":\n            stopEvent(e);\n            if (!this.#openMenuAC) {\n              this.#openMenu();\n            }\n            this.#menuItems\n              .find(\n                item => !item.disabled && !item.classList.contains(\"hidden\")\n              )\n              ?.focus();\n            break;\n          case \"ArrowUp\":\n          case \"End\":\n            stopEvent(e);\n            if (!this.#openMenuAC) {\n              this.#openMenu();\n            }\n            this.#menuItems\n              .findLast(\n                item => !item.disabled && !item.classList.contains(\"hidden\")\n              )\n              ?.focus();\n            break;\n          case \"Escape\":\n            this.#closeMenu();\n            stopEvent(e);\n            break;\n        }\n      },\n      { signal }\n    );\n  }\n\n  /**\n   * Go to the next/previous menu item.\n   * @param {HTMLElement} element\n   * @param {boolean} forward\n   */\n  #goToNextItem(element, forward, check = () => true) {\n    const index =\n      this.#lastIndex === -1\n        ? this.#menuItems.indexOf(element)\n        : this.#lastIndex;\n    const len = this.#menuItems.length;\n    const increment = forward ? 1 : len - 1;\n    for (\n      let i = (index + increment) % len;\n      i !== index;\n      i = (i + increment) % len\n    ) {\n      const menuItem = this.#menuItems[i];\n      if (\n        !menuItem.disabled &&\n        !menuItem.classList.contains(\"hidden\") &&\n        check(menuItem)\n      ) {\n        menuItem.focus();\n        this.#lastIndex = i;\n        break;\n      }\n    }\n  }\n\n  destroy() {\n    this.#closeMenu();\n    this.#menuAC?.abort();\n    this.#menuAC = null;\n  }\n}\n\nexport { Menu };\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/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport { OutputScale, RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderableView, RenderingStates } from \"./renderable_view.js\";\nimport { AppOptions } from \"./app_options.js\";\n\nconst DRAW_UPSCALE_FACTOR = 2; // See comment in `PDFThumbnailView.draw` below.\nconst MAX_NUM_SCALING_STEPS = 3;\nconst THUMBNAIL_WIDTH = 126; // px\n\n/**\n * @typedef {Object} PDFThumbnailViewOptions\n * @property {HTMLDivElement} container - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\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 {PDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n *   total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n *   CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n *   in either width or height. Use `-1` for no limit.\n *   The default value is 32767.\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\nfunction getTempCanvas(width, height) {\n  const canvas = new OffscreenCanvas(width, height);\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 = canvas.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 [canvas, ctx];\n}\n\nclass PDFThumbnailView extends RenderableView {\n  #renderingState = RenderingStates.INITIAL;\n\n  /**\n   * @param {PDFThumbnailViewOptions} options\n   */\n  constructor({\n    container,\n    eventBus,\n    id,\n    defaultViewport,\n    optionalContentConfigPromise,\n    linkService,\n    renderingQueue,\n    maxCanvasPixels,\n    maxCanvasDim,\n    pageColors,\n    enableSplitMerge = false,\n  }) {\n    super();\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.maxCanvasPixels = maxCanvasPixels ?? AppOptions.get(\"maxCanvasPixels\");\n    this.maxCanvasDim = maxCanvasDim || AppOptions.get(\"maxCanvasDim\");\n    this.pageColors = pageColors || null;\n\n    this.eventBus = eventBus;\n    this.linkService = linkService;\n    this.renderingQueue = renderingQueue;\n\n    this.placeholder = null;\n\n    const thumbnailContainer = (this.div = document.createElement(\"div\"));\n    thumbnailContainer.className = \"thumbnail\";\n    thumbnailContainer.setAttribute(\"page-number\", id);\n\n    const imageContainer = (this.imageContainer =\n      document.createElement(\"div\"));\n    thumbnailContainer.append(imageContainer);\n    imageContainer.classList.add(\n      \"thumbnailImageContainer\",\n      \"missingThumbnailImage\"\n    );\n    imageContainer.role = \"button\";\n    imageContainer.tabIndex = -1;\n    imageContainer.draggable = false;\n    imageContainer.setAttribute(\"page-number\", id);\n    imageContainer.setAttribute(\"data-l10n-id\", \"pdfjs-thumb-page-title1\");\n    imageContainer.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs(true));\n\n    const image = (this.image = document.createElement(\"img\"));\n    imageContainer.append(image);\n\n    if (enableSplitMerge) {\n      const checkbox = (this.checkbox = document.createElement(\"input\"));\n      checkbox.type = \"checkbox\";\n      checkbox.tabIndex = -1;\n      checkbox.setAttribute(\"data-l10n-id\", \"pdfjs-thumb-page-checkbox1\");\n      checkbox.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs());\n      thumbnailContainer.append(checkbox);\n      this.pasteButton = null;\n    }\n\n    this.#updateDims();\n\n    container.append(thumbnailContainer);\n  }\n\n  clone(container, id) {\n    const thumbnailView = new PDFThumbnailView({\n      container,\n      id,\n      eventBus: this.eventBus,\n      defaultViewport: this.viewport,\n      optionalContentConfigPromise: this._optionalContentConfigPromise,\n      linkService: this.linkService,\n      renderingQueue: this.renderingQueue,\n      maxCanvasPixels: this.maxCanvasPixels,\n      maxCanvasDim: this.maxCanvasDim,\n      pageColors: this.pageColors,\n      enableSplitMerge: !!this.checkbox,\n    });\n    const { imageContainer } = this;\n    if (!imageContainer.classList.contains(\"missingThumbnailImage\")) {\n      thumbnailView.image.replaceWith(this.image.cloneNode(true));\n      thumbnailView.imageContainer.classList.remove(\"missingThumbnailImage\");\n    }\n    return thumbnailView;\n  }\n\n  addPasteButton(pasteCallback) {\n    if (this.pasteButton) {\n      return;\n    }\n    const pasteButton = (this.pasteButton = document.createElement(\"button\"));\n    pasteButton.classList.add(\"thumbnailPasteButton\", \"viewsManagerButton\");\n    pasteButton.tabIndex = 0;\n    pasteButton.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-views-manager-paste-button-after\"\n    );\n    pasteButton.setAttribute(\n      \"data-l10n-args\",\n      JSON.stringify({\n        page: this.pageLabel ?? this.id,\n      })\n    );\n    const span = document.createElement(\"span\");\n    span.setAttribute(\"data-l10n-id\", \"pdfjs-views-manager-paste-button-label\");\n    pasteButton.append(span);\n    pasteButton.addEventListener(\"click\", () => {\n      pasteCallback(this.id);\n    });\n    if (this.id === 1) {\n      const prevPasteButton = (this.prevPasteButton =\n        pasteButton.cloneNode(true));\n      prevPasteButton.setAttribute(\n        \"data-l10n-id\",\n        \"pdfjs-views-manager-paste-button-before\"\n      );\n      prevPasteButton.addEventListener(\"click\", () => {\n        pasteCallback(0);\n      });\n      this.imageContainer.before(prevPasteButton);\n    }\n\n    this.imageContainer.after(pasteButton);\n  }\n\n  removePasteButton() {\n    this.pasteButton?.remove();\n    this.pasteButton = null;\n    this.prevPasteButton?.remove();\n    this.prevPasteButton = null;\n  }\n\n  toggleSelected(isSelected) {\n    if (this.checkbox) {\n      this.checkbox.checked = isSelected;\n    }\n  }\n\n  updateId(newId) {\n    this.id = newId;\n    this.renderingId = `thumbnail${newId}`;\n    this.div.setAttribute(\"page-number\", newId);\n    this.imageContainer.setAttribute(\"page-number\", newId);\n    // TODO: do we set the page label ?\n    this.setPageLabel(this.pageLabel);\n  }\n\n  #updateDims() {\n    const { width, height } = this.viewport;\n    const ratio = width / height;\n\n    const canvasWidth = (this.canvasWidth = THUMBNAIL_WIDTH);\n    const canvasHeight = (this.canvasHeight = (canvasWidth / ratio) | 0);\n    this.scale = canvasWidth / width;\n\n    this.imageContainer.style.height = `${canvasHeight}px`;\n  }\n\n  get renderingState() {\n    return this.#renderingState;\n  }\n\n  set renderingState(state) {\n    this.#renderingState = state;\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    this.#updateDims();\n\n    const { image, imageContainer } = this;\n    const url = image.src;\n    if (url) {\n      URL.revokeObjectURL(url);\n      image.src = \"\";\n      imageContainer.removeAttribute(\"data-l10n-id\");\n      imageContainer.removeAttribute(\"data-l10n-args\");\n      imageContainer.classList.add(\"missingThumbnailImage\");\n    }\n  }\n\n  destroy() {\n    this.reset();\n    this.toggleCurrent(false);\n    this.div.remove();\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  toggleCurrent(isCurrent) {\n    const { imageContainer } = this;\n    if (isCurrent) {\n      imageContainer.ariaCurrent = \"page\";\n      imageContainer.tabIndex = 0;\n      if (this.checkbox) {\n        this.checkbox.tabIndex = 0;\n      }\n    } else {\n      imageContainer.ariaCurrent = false;\n      imageContainer.tabIndex = -1;\n      if (this.checkbox) {\n        this.checkbox.tabIndex = -1;\n      }\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    if (this.renderTask) {\n      this.renderTask.cancel();\n      this.renderTask = null;\n    }\n    this.resume = null;\n  }\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 outputScale = new OutputScale();\n    const width = upscaleFactor * this.canvasWidth,\n      height = upscaleFactor * this.canvasHeight;\n\n    outputScale.limitCanvas(\n      width,\n      height,\n      this.maxCanvasPixels,\n      this.maxCanvasDim\n    );\n    // Because of: https://bugzilla.mozilla.org/show_bug.cgi?id=2003060\n    // we need use a HTMLCanvasElement here.\n    const canvas = document.createElement(\"canvas\");\n    canvas.width = (width * outputScale.sx) | 0;\n    canvas.height = (height * outputScale.sy) | 0;\n\n    const transform = outputScale.scaled\n      ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n      : null;\n\n    return { canvas, transform };\n  }\n\n  async #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    const { imageContainer, image } = this;\n    const { promise, resolve } = Promise.withResolvers();\n    reducedCanvas.toBlob(resolve);\n    const blob = await promise;\n    image.src = URL.createObjectURL(blob);\n    image.setAttribute(\"data-l10n-id\", \"pdfjs-thumb-page-canvas\");\n    image.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs());\n    imageContainer.classList.remove(\"missingThumbnailImage\");\n  }\n\n  async draw() {\n    if (this.renderingState !== RenderingStates.INITIAL) {\n      console.error(\"Must be in new state before drawing\");\n      return;\n    }\n    const { pageColors, pdfPage } = this;\n\n    if (!pdfPage) {\n      this.renderingState = RenderingStates.FINISHED;\n      throw new Error(\"pdfPage is not loaded\");\n    }\n\n    this.renderingState = RenderingStates.RUNNING;\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 { canvas, transform } = 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      canvas,\n      transform,\n      viewport: drawViewport,\n      optionalContentConfigPromise: this._optionalContentConfigPromise,\n      pageColors,\n    };\n    const renderTask = (this.renderTask = pdfPage.render(renderContext));\n    renderTask.onContinue = renderContinueCallback;\n\n    let error = null;\n    try {\n      await renderTask.promise;\n    } catch (e) {\n      if (e instanceof RenderingCancelledException) {\n        return;\n      }\n      error = e;\n    } finally {\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    this.renderingState = RenderingStates.FINISHED;\n\n    await this.#convertCanvasToImage(canvas);\n\n    this.eventBus.dispatch(\"thumbnailrendered\", {\n      source: this,\n      pageNumber: this.id,\n      pdfPage,\n    });\n\n    if (error) {\n      throw error;\n    }\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  #getReducedImageDims(canvas) {\n    const width = canvas.width << MAX_NUM_SCALING_STEPS,\n      height = canvas.height << MAX_NUM_SCALING_STEPS;\n\n    const outputScale = new OutputScale();\n    // Here we're not actually \"rendering\" to the canvas and the `OutputScale`\n    // is thus only used to limit the canvas size, hence the identity scale.\n    outputScale.sx = outputScale.sy = 1;\n\n    outputScale.limitCanvas(\n      width,\n      height,\n      this.maxCanvasPixels,\n      this.maxCanvasDim\n    );\n    return [(width * outputScale.sx) | 0, (height * outputScale.sy) | 0];\n  }\n\n  #reduceImage(img) {\n    const { canvas } = this.#getPageDrawContext(1);\n    const ctx = canvas.getContext(\"2d\", {\n      alpha: false,\n      willReadFrequently: false,\n    });\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, reducedHeight] = this.#getReducedImageDims(canvas);\n    const [reducedImage, reducedImageCtx] = getTempCanvas(\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  #getPageL10nArgs(hasTotal = false) {\n    return JSON.stringify({\n      page: this.pageLabel ?? this.id,\n      total: hasTotal ? this.linkService.pagesCount : undefined,\n    });\n  }\n\n  /**\n   * @param {string|null} label\n   */\n  setPageLabel(label) {\n    this.pageLabel = typeof label === \"string\" ? label : null;\n    this.imageContainer.setAttribute(\n      \"data-l10n-args\",\n      this.#getPageL10nArgs(true)\n    );\n    this.image.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs());\n    this.checkbox?.setAttribute(\"data-l10n-args\", this.#getPageL10nArgs());\n  }\n}\n\nexport { PDFThumbnailView };\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(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n/** @typedef {import(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n\nimport {\n  binarySearchFirstItem,\n  getVisibleElements,\n  isValidRotation,\n  watchScroll,\n} from \"./ui_utils.js\";\nimport { MathClamp, noContextMenu, stopEvent } from \"pdfjs-lib\";\nimport { Menu } from \"./menu.js\";\nimport { PDFThumbnailView } from \"./pdf_thumbnail_view.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\n\nconst SCROLL_OPTIONS = {\n  behavior: \"instant\",\n  block: \"nearest\",\n  inline: \"nearest\",\n  container: \"nearest\",\n};\n\n// This value is based on the one used in Firefox.\n// See\n// https://searchfox.org/firefox-main/rev/04cf27582307a9c351e991c740828d54cf786b76/dom/events/EventStateManager.cpp#2675-2698\n// This threshold is used to distinguish between a click and a drag.\nconst DRAG_THRESHOLD_IN_PIXELS = 5;\nconst PIXELS_TO_SCROLL_WHEN_DRAGGING = 20;\nconst SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT = 15;\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 {PDFLinkService} linkService - The navigation/linking service.\n * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n *   total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n *   CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n *   in either width or height. Use `-1` for no limit.\n *   The default value is 32767.\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 {AbortSignal} [abortSignal] - The AbortSignal for the window\n *   events.\n * @property {boolean} [enableNewBadge] - Enables the \"new\" badge for the split\n *   and merge features.\n * @property {boolean} [enableMerge] - Enables the merge feature.\n *   The default value is `false`.\n * @property {boolean} [enableSplitMerge] - Enables split and merge features.\n *   The default value is `false`.\n * @property {Object} [statusBar] - The status bar elements to manage the status\n *   label and action when editing pages.\n * @property {Object} [undoBar] - The undo bar elements to manage the undo\n *   action.\n * @property {Object} [manageMenu] - The menu elements to manage saving edited\n *   PDF.\n * @property {Object} [waitingBar] - The waiting bar elements shown during\n *   long-running operations.\n * @property {Object} [addFileComponent] - The file picker and button used to\n *   add a PDF file to merge with the current one.\n */\n\n/**\n * Viewer control to display thumbnails for pages in a PDF document.\n */\nclass PDFThumbnailViewer {\n  static #draggingScaleFactor = 0;\n\n  #enableMerge = false;\n\n  #enableSplitMerge = false;\n\n  #dragAC = null;\n\n  #draggedContainer = null;\n\n  #thumbnailsPositions = null;\n\n  #lastDraggedOverIndex = NaN;\n\n  #selectedPages = null;\n\n  #draggedImageX = 0;\n\n  #draggedImageY = 0;\n\n  #draggedImageWidth = 0;\n\n  #draggedImageHeight = 0;\n\n  #draggedImageOffsetX = 0;\n\n  #draggedImageOffsetY = 0;\n\n  #dragMarker = null;\n\n  #pageNumberToRemove = NaN;\n\n  #currentScrollBottom = 0;\n\n  #currentScrollTop = 0;\n\n  #pagesMapper = null;\n\n  #manageExportButton = null;\n\n  #manageDeleteButton = null;\n\n  #manageCopyButton = null;\n\n  #manageCutButton = null;\n\n  #copiedThumbnails = null;\n\n  #savedThumbnails = null;\n\n  #deletedPageNumbers = null;\n\n  #copiedPageNumbers = null;\n\n  #boundPastePages = this.#pastePages.bind(this);\n\n  #isCut = false;\n\n  #isOneColumnView = false;\n\n  #scrollableContainerWidth = 0;\n\n  #scrollableContainerHeight = 0;\n\n  #statusLabel = null;\n\n  #statusBar = null;\n\n  #deselectButton = null;\n\n  #undoBar = null;\n\n  #undoLabel = null;\n\n  #undoButton = null;\n\n  #undoCloseButton = null;\n\n  #waitingBar = null;\n\n  #isInPasteMode = false;\n\n  #hasUndoBarVisible = false;\n\n  #newBadge = null;\n\n  /**\n   * @param {PDFThumbnailViewerOptions} options\n   */\n  constructor({\n    container,\n    eventBus,\n    linkService,\n    renderingQueue,\n    maxCanvasPixels,\n    maxCanvasDim,\n    pageColors,\n    abortSignal,\n    enableMerge,\n    enableSplitMerge,\n    enableNewBadge,\n    statusBar,\n    undoBar,\n    waitingBar,\n    manageMenu,\n    addFileComponent,\n  }) {\n    this.scrollableContainer = container.parentElement;\n    this.container = container;\n    this.eventBus = eventBus;\n    this.linkService = linkService;\n    this.renderingQueue = renderingQueue;\n    this.maxCanvasPixels = maxCanvasPixels;\n    this.maxCanvasDim = maxCanvasDim;\n    this.pageColors = pageColors || null;\n    this.#enableMerge = enableMerge || false;\n    this.#enableSplitMerge = enableSplitMerge || false;\n    this.#statusLabel = statusBar?.viewsManagerStatusActionLabel || null;\n    this.#deselectButton =\n      statusBar?.viewsManagerStatusActionDeselectButton || null;\n    this.#statusBar = statusBar?.viewsManagerStatusAction || null;\n    this.#undoBar = undoBar?.viewsManagerStatusUndo || null;\n    this.#undoLabel = undoBar?.viewsManagerStatusUndoLabel || null;\n    this.#undoButton = undoBar?.viewsManagerStatusUndoButton || null;\n    this.#undoCloseButton = undoBar?.viewsManagerStatusUndoCloseButton || null;\n    this.#waitingBar = waitingBar || null;\n\n    if (this.#enableSplitMerge && manageMenu) {\n      const {\n        button: menuButton,\n        menu,\n        copy,\n        cut,\n        delete: del,\n        exportSelected,\n      } = manageMenu;\n\n      if (enableNewBadge) {\n        const newSpan = document.createElement(\"span\");\n        newSpan.setAttribute(\"data-l10n-id\", \"pdfjs-new-badge-content\");\n        newSpan.classList.add(\"newBadge\");\n        menuButton.parentElement.before(newSpan);\n        this.#newBadge = newSpan;\n      }\n\n      this.eventBus.on(\n        \"pagesloaded\",\n        () => {\n          menuButton.disabled = false;\n        },\n        { once: true }\n      );\n\n      this._manageMenu = new Menu(menu, menuButton, [\n        copy,\n        cut,\n        del,\n        exportSelected,\n      ]);\n      this.#manageExportButton = exportSelected;\n      exportSelected.addEventListener(\n        \"click\",\n        this.#saveExtractedPages.bind(this)\n      );\n      this.#manageDeleteButton = del;\n      del.addEventListener(\"click\", this.#deletePages.bind(this, \"delete\"));\n      this.#manageCopyButton = copy;\n      copy.addEventListener(\"click\", this.#copyPages.bind(this));\n      this.#manageCutButton = cut;\n      cut.addEventListener(\"click\", this.#cutPages.bind(this));\n\n      this.#toggleMenuEntries(false);\n      menuButton.disabled = true;\n\n      this.eventBus.on(\"editingaction\", ({ name }) => {\n        switch (name) {\n          case \"copyPage\":\n            this.#copyPages();\n            break;\n          case \"cutPage\":\n            this.#cutPages();\n            break;\n          case \"deletePage\":\n            this.#deletePages(\"delete\");\n            break;\n          case \"savePage\":\n            this.#saveExtractedPages();\n            break;\n        }\n      });\n\n      this.container.addEventListener(\n        \"contextmenu\",\n        e => {\n          this.eventBus.dispatch(\"editingstateschanged\", {\n            source: this,\n            details: {\n              thumbnailId:\n                parseInt(\n                  e.target\n                    .closest(\".thumbnailImageContainer\")\n                    ?.parentElement.getAttribute(\"page-number\"),\n                  10\n                ) ?? -1,\n              hasSelectedPages: !!this.#selectedPages?.size,\n              canDeletePages: this.#canDelete(),\n            },\n          });\n        },\n        {\n          signal: abortSignal,\n          passive: true,\n        }\n      );\n\n      this.#undoButton?.addEventListener(\"click\", this.#undo.bind(this));\n      this.#undoCloseButton?.addEventListener(\n        \"click\",\n        this.#dismissUndo.bind(this, /* mustUpdateStatus = */ true)\n      );\n      this.#deselectButton?.addEventListener(\"click\", () => {\n        this.#clearSelection();\n        this.#toggleMenuEntries(false);\n        this.#updateStatus(\"select\");\n      });\n      this.#deselectButton.classList.toggle(\"hidden\", true);\n\n      if (this.#enableMerge && addFileComponent) {\n        const { picker, button } = addFileComponent;\n        picker.addEventListener(\"change\", async () => {\n          const file = picker.files?.[0];\n          if (!file) {\n            return;\n          }\n          if (file.type !== \"application/pdf\") {\n            const magic = await file.slice(0, 5).text();\n            if (magic !== \"%PDF-\") {\n              return;\n            }\n          }\n          this.#toggleBar(\"waiting\", \"pdfjs-views-manager-waiting-for-file\");\n          const currentPageIndex = this._currentPageNumber - 1;\n          const buffer = await file.bytes();\n          const pagesCount = this.#pagesMapper.pagesNumber;\n          const data = this.hasStructuralChanges()\n            ? this.getStructuralChanges()\n            : [{ document: null }];\n          data.push({\n            document: buffer,\n            insertAfter: currentPageIndex ?? -1,\n          });\n          this.eventBus._on(\n            \"thumbnailsloaded\",\n            () => {\n              // Clear any pre-merge selection: thumbnails are rebuilt fresh\n              // (all unchecked), so the old set would cause a label/visual\n              // mismatch.\n              this.#selectedPages = null;\n              this.#updateMenuEntries();\n              this.#toggleBar(\"status\");\n              const newPagesCount = this.#pagesMapper.pagesNumber;\n              const insertedPagesCount = newPagesCount - pagesCount;\n              for (\n                let i = currentPageIndex + 1,\n                  ii = currentPageIndex + 1 + insertedPagesCount;\n                i < ii;\n                i++\n              ) {\n                this._thumbnails[i].checkbox.checked = true;\n                this.#selectPage(i + 1, true);\n              }\n              if (insertedPagesCount) {\n                this.#updateCurrentPage(currentPageIndex + 2);\n              }\n            },\n            { once: true }\n          );\n          this.#reportTelemetry({ action: \"merge\" });\n          this.eventBus.dispatch(\"saveandload\", {\n            source: this,\n            data,\n          });\n        });\n        button.addEventListener(\"click\", () => {\n          picker.click();\n        });\n        this.#waitingBar.closeButton?.addEventListener(\"click\", () => {\n          this.#toggleBar(\"status\");\n          picker.value = \"\";\n        });\n      }\n    } else {\n      manageMenu.button.hidden = true;\n    }\n\n    this.scroll = watchScroll(\n      this.scrollableContainer,\n      this.#scrollUpdated.bind(this),\n      abortSignal\n    );\n    this.#resetView();\n    this.#addEventListeners();\n  }\n\n  #scrollUpdated() {\n    this.renderingQueue.renderHighestPriority();\n  }\n\n  getThumbnail(index) {\n    return this._thumbnails[index];\n  }\n\n  #getVisibleThumbs() {\n    return getVisibleElements({\n      scrollEl: this.scrollableContainer,\n      views: this._thumbnails,\n    });\n  }\n\n  #resetCurrentThumbnail(newPageNumber) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const thumbnailView = this._thumbnails[this._currentPageNumber - 1];\n    thumbnailView?.toggleCurrent(/* isCurrent = */ false);\n    this._currentPageNumber = newPageNumber;\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    if (pageNumber !== this._currentPageNumber) {\n      this.#resetCurrentThumbnail(pageNumber);\n      thumbnailView.toggleCurrent(/* isCurrent = */ true);\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        thumbnailView.div.scrollIntoView(SCROLL_OPTIONS);\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  }\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    this.#pagesMapper = pdfDocument.pagesMapper;\n    const firstPagePromise = pdfDocument.getPage(1);\n    const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({\n      intent: \"display\",\n    });\n\n    firstPagePromise\n      .then(firstPdfPage => {\n        const pagesCount = pdfDocument.numPages;\n        const viewport = firstPdfPage.getViewport({ scale: 1 });\n        const fragment = document.createDocumentFragment();\n\n        for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n          const thumbnail = new PDFThumbnailView({\n            container: fragment,\n            eventBus: this.eventBus,\n            id: pageNum,\n            defaultViewport: viewport.clone(),\n            optionalContentConfigPromise,\n            linkService: this.linkService,\n            renderingQueue: this.renderingQueue,\n            maxCanvasPixels: this.maxCanvasPixels,\n            maxCanvasDim: this.maxCanvasDim,\n            pageColors: this.pageColors,\n            enableSplitMerge: this.#enableSplitMerge,\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.toggleCurrent(/* isCurrent = */ true);\n        this.container.append(fragment);\n        this.eventBus.dispatch(\"thumbnailsloaded\", {\n          source: this,\n        });\n      })\n      .catch(reason => {\n        console.error(\"Unable to initialize thumbnail viewer\", reason);\n      });\n  }\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      /* preRenderExtra */ false,\n      /* ignoreDetailViews */ true\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  hasStructuralChanges() {\n    return this.#pagesMapper?.hasBeenAltered() || false;\n  }\n\n  getStructuralChanges() {\n    return this.#pagesMapper?.getPageMappingForSaving() || null;\n  }\n\n  static #getScaleFactor(image) {\n    return (PDFThumbnailViewer.#draggingScaleFactor ||= parseFloat(\n      getComputedStyle(image).getPropertyValue(\"--thumbnail-dragging-scale\")\n    ));\n  }\n\n  #updateThumbnails(currentPageNumber) {\n    this.#resetCurrentThumbnail(0);\n    let newCurrentPageNumber = 0;\n    const pagesMapper = this.#pagesMapper;\n    const prevThumbnails = (this.#savedThumbnails = this._thumbnails);\n    const newThumbnails = (this._thumbnails = []);\n    const fragment = document.createDocumentFragment();\n    const isCut = this.#isCut;\n    for (let i = 1, ii = pagesMapper.pagesNumber; i <= ii; i++) {\n      const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n      if (prevPageNumber < 0) {\n        let thumbnail = this.#copiedThumbnails.get(-prevPageNumber);\n        thumbnail.checkbox.checked = false;\n        if (isCut) {\n          thumbnail.updateId(i);\n          fragment.append(thumbnail.div);\n        } else {\n          thumbnail = thumbnail.clone(fragment, i);\n        }\n        newThumbnails.push(thumbnail);\n        continue;\n      }\n      if (prevPageNumber === currentPageNumber) {\n        newCurrentPageNumber = i;\n      }\n      const newThumbnail = prevThumbnails[prevPageNumber - 1];\n      newThumbnails.push(newThumbnail);\n      newThumbnail.updateId(i);\n      newThumbnail.checkbox.checked = false;\n      fragment.append(newThumbnail.div);\n    }\n    this.container.replaceChildren(fragment);\n    return newCurrentPageNumber;\n  }\n\n  #onStartDragging(draggedThumbnail) {\n    this.#currentScrollTop = this.scrollableContainer.scrollTop;\n    this.#currentScrollBottom =\n      this.#currentScrollTop + this.scrollableContainer.clientHeight;\n    this.#dragAC = new AbortController();\n    this.container.classList.add(\"isDragging\");\n    this.#newBadge?.classList.add(\"hidden\");\n    const startPageNumber = parseInt(\n      draggedThumbnail.getAttribute(\"page-number\"),\n      10\n    );\n    this.#lastDraggedOverIndex = startPageNumber - 1;\n    if (!this.#selectedPages?.has(startPageNumber)) {\n      this.#pageNumberToRemove = startPageNumber;\n      this.#selectPage(startPageNumber, true);\n    }\n\n    for (const selected of this.#selectedPages) {\n      const thumbnail = this._thumbnails[selected - 1];\n      const placeholder = (thumbnail.placeholder =\n        document.createElement(\"div\"));\n      placeholder.classList.add(\"thumbnailImageContainer\", \"placeholder\");\n      const { div, imageContainer } = thumbnail;\n      div.classList.add(\"isDragging\");\n      placeholder.style.height = getComputedStyle(imageContainer).height;\n      imageContainer.after(placeholder);\n      if (selected !== startPageNumber) {\n        imageContainer.classList.add(\"hidden\");\n        continue;\n      }\n      if (this.#selectedPages.size === 1) {\n        imageContainer.classList.add(\"draggingThumbnail\");\n        this.#draggedContainer = imageContainer;\n        continue;\n      }\n      // For multiple selected thumbnails, only the one being dragged is shown\n      // (with the dragging style), while the others are hidden.\n      const draggedContainer = (this.#draggedContainer =\n        document.createElement(\"div\"));\n      draggedContainer.classList.add(\n        \"draggingThumbnail\",\n        \"thumbnailImageContainer\",\n        \"multiple\"\n      );\n      draggedContainer.style.height = getComputedStyle(imageContainer).height;\n      imageContainer.replaceWith(draggedContainer);\n      imageContainer.classList.remove(\"thumbnailImageContainer\");\n      draggedContainer.append(imageContainer);\n      draggedContainer.setAttribute(\n        \"data-multiple-count\",\n        this.#selectedPages.size\n      );\n    }\n  }\n\n  #onStopDragging(isDropping = false) {\n    const draggedContainer = this.#draggedContainer;\n    this.#draggedContainer = null;\n    const lastDraggedOverIndex = this.#lastDraggedOverIndex;\n    this.#lastDraggedOverIndex = NaN;\n    this.#dragMarker?.remove();\n    this.#dragMarker = null;\n    this.#dragAC.abort();\n    this.#dragAC = null;\n    this.#newBadge?.classList.remove(\"hidden\");\n\n    this.container.classList.remove(\"isDragging\");\n    for (const selected of this.#selectedPages) {\n      const thumbnail = this._thumbnails[selected - 1];\n      const { div, placeholder, imageContainer } = thumbnail;\n      placeholder.remove();\n      imageContainer.classList.remove(\"draggingThumbnail\", \"hidden\");\n      div.classList.remove(\"isDragging\");\n    }\n\n    if (draggedContainer.classList.contains(\"multiple\")) {\n      // Restore the dragged image to its thumbnail.\n      const originalImageContainer = draggedContainer.firstElementChild;\n      draggedContainer.replaceWith(originalImageContainer);\n      originalImageContainer.classList.add(\"thumbnailImageContainer\");\n    } else {\n      draggedContainer.style.translate = \"\";\n    }\n\n    const selectedPages = this.#selectedPages;\n    if (\n      !isNaN(lastDraggedOverIndex) &&\n      isDropping &&\n      !(\n        selectedPages.size === 1 &&\n        (selectedPages.has(lastDraggedOverIndex + 1) ||\n          selectedPages.has(lastDraggedOverIndex + 2))\n      )\n    ) {\n      this._thumbnails[this._currentPageNumber - 1]?.toggleCurrent(\n        /* isCurrent = */ false\n      );\n      this._currentPageNumber = -1;\n\n      const newIndex = lastDraggedOverIndex + 1;\n      const pagesToMove = Array.from(selectedPages).sort((a, b) => a - b);\n      const pagesMapper = this.#pagesMapper;\n      const currentPageNumber = isNaN(this.#pageNumberToRemove)\n        ? pagesToMove[0]\n        : this.#pageNumberToRemove;\n\n      pagesMapper.movePages(selectedPages, pagesToMove, newIndex);\n\n      this.#updateCurrentPage(this.#updateThumbnails(currentPageNumber));\n      this.#thumbnailsPositions = null;\n\n      selectedPages.clear();\n      this.#pageNumberToRemove = NaN;\n      this.#toggleMenuEntries(false);\n      this.#updateStatus(\"select\");\n\n      this.#reportTelemetry({ action: \"move\" });\n      this.eventBus.dispatch(\"pagesedited\", {\n        source: this,\n        pagesMapper,\n        type: \"move\",\n      });\n    }\n\n    if (!isNaN(this.#pageNumberToRemove)) {\n      this.#selectPage(this.#pageNumberToRemove, false);\n      this.#pageNumberToRemove = NaN;\n    }\n  }\n\n  #clearSelection() {\n    for (const pageNumber of this.#selectedPages) {\n      this._thumbnails[pageNumber - 1].toggleSelected(false);\n    }\n    this.#selectedPages.clear();\n  }\n\n  #updateCurrentPage(currentPageNumber, forceFocus = false) {\n    setTimeout(() => {\n      this.forceRendering();\n      const newPageNumber = currentPageNumber || 1;\n      this.linkService.goToPage(newPageNumber);\n      const thumbnailView = this._thumbnails[newPageNumber - 1];\n      if (forceFocus || !this.container.contains(document.activeElement)) {\n        thumbnailView.imageContainer.focus();\n      }\n    }, 0);\n  }\n\n  #undo() {\n    this.#clearSelection();\n    this.#toggleMenuEntries(false);\n    this.#updateStatus(\"select\");\n    if (this.#copiedThumbnails) {\n      // We undo a copy or a cut.\n      this.#copiedThumbnails = null;\n      this.#pagesMapper.cancelCopy();\n      this.#togglePasteMode(false);\n\n      this.eventBus.dispatch(\"pagesedited\", {\n        source: this,\n        pagesMapper: this.#pagesMapper,\n        type: \"cancelCopy\",\n      });\n    }\n\n    this.#isCut = false;\n    if (this.#savedThumbnails) {\n      // The thumbnail objects are shared between the post-operation list and\n      // the saved (pre-operation) list. The object marked current in the\n      // post-operation list may reappear at a different index in the restored\n      // list.\n      const currentThumb = this._thumbnails[this._currentPageNumber - 1];\n      currentThumb?.toggleCurrent(false);\n\n      const fragment = document.createDocumentFragment();\n      for (let i = 1, ii = this.#savedThumbnails.length; i <= ii; i++) {\n        const thumbnail = this.#savedThumbnails[i - 1];\n        thumbnail.updateId(i);\n        thumbnail.checkbox.checked = false;\n        fragment.append(thumbnail.div);\n      }\n      this.container.replaceChildren(fragment);\n      this._thumbnails = this.#savedThumbnails;\n      this.#savedThumbnails = null;\n\n      // Re-establish the current-page indicator at the position the current\n      // thumbnail now occupies in the restored list.\n      const newIdx = currentThumb ? this._thumbnails.indexOf(currentThumb) : -1;\n      this._currentPageNumber = newIdx + 1;\n      currentThumb?.toggleCurrent(newIdx !== -1);\n\n      this.#pagesMapper.cancelDelete();\n\n      this.eventBus.dispatch(\"pagesedited\", {\n        source: this,\n        pagesMapper: this.#pagesMapper,\n        type: \"cancelDelete\",\n      });\n    }\n  }\n\n  #dismissUndo(mustUpdateStatus) {\n    this.#copiedThumbnails = null;\n    if (this.#deletedPageNumbers) {\n      if (this.#savedThumbnails) {\n        for (const pageNumber of this.#deletedPageNumbers) {\n          this.#savedThumbnails[pageNumber - 1].destroy();\n        }\n        this.#savedThumbnails = null;\n      }\n      this.#deletedPageNumbers = null;\n    }\n    this.#isCut = false;\n    if (mustUpdateStatus) {\n      this.#updateStatus(\"select\");\n    }\n    this.#togglePasteMode(false);\n    this.#pagesMapper.cleanSavedData();\n\n    this.eventBus.dispatch(\"pagesedited\", {\n      source: this,\n      pagesMapper: this.#pagesMapper,\n      type: \"cleanSavedData\",\n    });\n  }\n\n  #canDelete() {\n    const size = this.#selectedPages?.size || 0;\n    return size > 0 && size < this._thumbnails.length;\n  }\n\n  #toggleBar(type, message, args) {\n    this.#statusBar.classList.toggle(\"hidden\", type !== \"status\");\n    this.#waitingBar.container.classList.toggle(\"hidden\", type !== \"waiting\");\n    this.#undoBar.classList.toggle(\"hidden\", type !== \"undo\");\n    this.#hasUndoBarVisible = type === \"undo\";\n\n    switch (type) {\n      case \"waiting\":\n        this.#waitingBar.label.setAttribute(\"data-l10n-id\", message);\n        break;\n      case \"undo\":\n        this.#undoLabel.setAttribute(\"data-l10n-id\", message);\n        if (args) {\n          this.#undoLabel.setAttribute(\"data-l10n-args\", JSON.stringify(args));\n        }\n        break;\n      case \"status\":\n        if (args) {\n          this.#statusLabel.setAttribute(\n            \"data-l10n-args\",\n            JSON.stringify(args)\n          );\n        } else {\n          this.#statusLabel.removeAttribute(\"data-l10n-args\");\n        }\n        this.#newBadge?.classList.toggle(\"hidden\", !!args);\n        this.#deselectButton.classList.toggle(\"hidden\", !args);\n        break;\n    }\n  }\n\n  #togglePasteMode(enable) {\n    this.#isInPasteMode = enable;\n    if (enable) {\n      this.container.classList.add(\"pasteMode\");\n      for (const thumbnail of this._thumbnails) {\n        thumbnail.addPasteButton(this.#boundPastePages);\n      }\n    } else {\n      this.container.classList.remove(\"pasteMode\");\n      for (const thumbnail of this._thumbnails) {\n        thumbnail.removePasteButton();\n      }\n    }\n  }\n\n  #reportTelemetry(data) {\n    this.eventBus.dispatch(\"reporttelemetry\", {\n      source: this,\n      details: {\n        type: \"pageOrganization\",\n        data,\n      },\n    });\n  }\n\n  #saveExtractedPages() {\n    this.#reportTelemetry({ action: \"exportSelected\" });\n    this.eventBus.dispatch(\"saveextractedpages\", {\n      source: this,\n      data: this.#pagesMapper.extractPages(this.#selectedPages),\n    });\n    this.#clearSelection();\n    this.#toggleMenuEntries(false);\n    this.#updateStatus(\"select\");\n  }\n\n  #copyPages(clearSelection = true) {\n    if (!this.#isCut) {\n      // Entering pure copy mode \"commits\" any pending paste/delete state so\n      // that clicking the \"Done\" button later only cancels the copy and does\n      // not accidentally restore a previous paste or delete.\n      this.#savedThumbnails = null;\n      this.#reportTelemetry({ action: \"copy\" });\n    }\n    this.#updateStatus(this.#isCut ? \"cut\" : \"copy\");\n    const pageNumbersToCopy = (this.#copiedPageNumbers = Uint32Array.from(\n      this.#selectedPages\n    ).sort((a, b) => a - b));\n    const pagesMapper = this.#pagesMapper;\n    pagesMapper.copyPages(pageNumbersToCopy);\n    this.#copiedThumbnails = new Map();\n    for (const pageNumber of pageNumbersToCopy) {\n      this.#copiedThumbnails.set(pageNumber, this._thumbnails[pageNumber - 1]);\n    }\n    this.eventBus.dispatch(\"pagesedited\", {\n      source: this,\n      pagesMapper,\n      pageNumbers: pageNumbersToCopy,\n      type: \"copy\",\n    });\n    if (clearSelection) {\n      this.#clearSelection();\n    }\n    this.#togglePasteMode(true);\n    this.#toggleMenuEntries(false);\n  }\n\n  #cutPages() {\n    if (!this.#canDelete()) {\n      return;\n    }\n\n    this.#reportTelemetry({ action: \"cut\" });\n    this.#isCut = true;\n    this.#copyPages(false);\n    this.#deletePages(/* type = */ \"cut\");\n  }\n\n  #pastePages(index) {\n    this.#reportTelemetry({ action: \"paste\" });\n    const pagesMapper = this.#pagesMapper;\n    const currentPageNumber = this.#copiedPageNumbers.includes(\n      this._currentPageNumber\n    )\n      ? 0\n      : this._currentPageNumber;\n\n    pagesMapper.pastePages(index);\n    this.#updateThumbnails(currentPageNumber);\n    this.#updateCurrentPage(index + 1, /* forceFocus = */ true);\n    this.#thumbnailsPositions = null;\n\n    this.eventBus.dispatch(\"pagesedited\", {\n      source: this,\n      pagesMapper,\n      hasBeenCut: this.#isCut,\n      type: \"paste\",\n    });\n\n    this.#copiedThumbnails = null;\n    this.#isCut = false;\n    this.#togglePasteMode(false);\n    this.#toggleMenuEntries(false);\n    this.#updateStatus(\"select\");\n  }\n\n  #deletePages(type = \"delete\") {\n    if (!this.#canDelete()) {\n      return;\n    }\n\n    const selectedPages = this.#selectedPages;\n    if (type === \"delete\") {\n      this.#reportTelemetry({ action: \"delete\" });\n      this.#updateStatus(\"delete\");\n    }\n    const pagesMapper = this.#pagesMapper;\n    const currentPageNumber = selectedPages.has(this._currentPageNumber)\n      ? 0\n      : this._currentPageNumber;\n    const pagesToDelete = (this.#deletedPageNumbers = Uint32Array.from(\n      selectedPages\n    ).sort((a, b) => a - b));\n\n    pagesMapper.deletePages(pagesToDelete);\n    this.#updateCurrentPage(this.#updateThumbnails(currentPageNumber));\n    this.#thumbnailsPositions = null;\n\n    selectedPages.clear();\n    this.#updateMenuEntries();\n\n    this.eventBus.dispatch(\"pagesedited\", {\n      source: this,\n      pagesMapper,\n      pageNumbers: pagesToDelete,\n      type,\n    });\n  }\n\n  #updateMenuEntries() {\n    const size = this.#selectedPages?.size || 0;\n    this.#manageExportButton.disabled = this.#manageCopyButton.disabled = !size;\n    this.#manageDeleteButton.disabled = this.#manageCutButton.disabled =\n      !this.#canDelete();\n  }\n\n  #toggleMenuEntries(enable) {\n    this.#manageExportButton.disabled =\n      this.#manageDeleteButton.disabled =\n      this.#manageCopyButton.disabled =\n      this.#manageCutButton.disabled =\n        !enable;\n  }\n\n  #updateStatus(type) {\n    if (!this.#statusBar || !this.#undoBar) {\n      return;\n    }\n    const count = this.#selectedPages?.size || 0;\n    if (type === \"select\") {\n      this.#statusLabel.setAttribute(\n        \"data-l10n-id\",\n        count\n          ? \"pdfjs-views-manager-pages-status-action-label\"\n          : \"pdfjs-views-manager-pages-status-none-action-label\"\n      );\n      this.#toggleBar(\"status\", \"\", count ? { count } : null);\n      return;\n    }\n\n    let l10nId;\n    switch (type) {\n      case \"copy\":\n        l10nId = \"pdfjs-views-manager-pages-status-undo-copy-label\";\n        break;\n      case \"cut\":\n        l10nId = \"pdfjs-views-manager-status-undo-cut-label\";\n        break;\n      case \"delete\":\n        l10nId = \"pdfjs-views-manager-pages-status-undo-delete-label\";\n        break;\n    }\n    this.#toggleBar(\"undo\", l10nId, { count });\n\n    if (type === \"copy\") {\n      this.#undoButton.firstElementChild.setAttribute(\n        \"data-l10n-id\",\n        \"pdfjs-views-manager-status-done-button-label\"\n      );\n      this.#undoCloseButton.classList.toggle(\"hidden\", true);\n    } else {\n      this.#undoButton.firstElementChild.setAttribute(\n        \"data-l10n-id\",\n        \"pdfjs-views-manager-status-undo-button-label\"\n      );\n      this.#undoCloseButton.classList.toggle(\"hidden\", false);\n    }\n  }\n\n  #moveDraggedContainer(dx, dy) {\n    if (this.#isOneColumnView) {\n      dx = 0;\n    }\n    if (\n      this.#draggedImageX + dx < 0 ||\n      this.#draggedImageX + this.#draggedImageWidth + dx >\n        this.#scrollableContainerWidth\n    ) {\n      dx = 0;\n    }\n    if (\n      this.#draggedImageY + dy < 0 ||\n      this.#draggedImageY + this.#draggedImageHeight + dy >\n        this.#scrollableContainerHeight\n    ) {\n      dy = 0;\n    }\n\n    this.#draggedImageX += dx;\n    this.#draggedImageY += dy;\n    this.#draggedImageOffsetX += dx;\n    this.#draggedImageOffsetY += dy;\n    this.#draggedContainer.style.translate = `${this.#draggedImageOffsetX}px ${this.#draggedImageOffsetY}px`;\n    if (\n      this.#draggedImageY + this.#draggedImageHeight >\n      this.#currentScrollBottom\n    ) {\n      this.scrollableContainer.scrollTop = Math.min(\n        this.scrollableContainer.scrollTop + PIXELS_TO_SCROLL_WHEN_DRAGGING,\n        this.#scrollableContainerHeight\n      );\n    } else if (this.#draggedImageY < this.#currentScrollTop) {\n      this.scrollableContainer.scrollTop = Math.max(\n        this.scrollableContainer.scrollTop - PIXELS_TO_SCROLL_WHEN_DRAGGING,\n        0\n      );\n    }\n\n    const positionData = this.#findClosestThumbnail(\n      this.#draggedImageX + this.#draggedImageWidth / 2,\n      this.#draggedImageY + this.#draggedImageHeight / 2\n    );\n    if (!positionData) {\n      return;\n    }\n    let dragMarker = this.#dragMarker;\n    if (!dragMarker) {\n      dragMarker = this.#dragMarker = document.createElement(\"div\");\n      dragMarker.className = \"dragMarker\";\n      this.container.firstChild.before(dragMarker);\n    }\n\n    const [index, space] = positionData;\n    const dragMarkerStyle = dragMarker.style;\n    const { bbox, x: xPos } = this.#thumbnailsPositions;\n    let x, y, width, height;\n    if (index < 0) {\n      if (xPos.length === 1) {\n        y = bbox[1] - SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT;\n        x = bbox[4];\n        width = bbox[2];\n      } else {\n        y = bbox[1];\n        x = bbox[0] - SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT;\n        height = bbox[3];\n      }\n    } else if (xPos.length === 1) {\n      y = bbox[index * 4 + 1] + bbox[index * 4 + 3] + space;\n      x = bbox[index * 4];\n      width = bbox[index * 4 + 2];\n    } else {\n      y = bbox[index * 4 + 1];\n      x = bbox[index * 4] + bbox[index * 4 + 2] + space;\n      height = bbox[index * 4 + 3];\n    }\n    dragMarkerStyle.translate = `${x}px ${y}px`;\n    dragMarkerStyle.width = width ? `${width}px` : \"\";\n    dragMarkerStyle.height = height ? `${height}px` : \"\";\n  }\n\n  #computeThumbnailsPosition() {\n    // Collect the center of each thumbnail.\n    // This is used to determine the closest thumbnail when dragging.\n    // TODO: handle the RTL case.\n    const positionsX = [];\n    const positionsY = [];\n    const positionsLastX = [];\n    const bbox = new Float32Array(this._thumbnails.length * 4);\n    let prevX = -Infinity;\n    let prevY = -Infinity;\n    let reminder = -1;\n    let firstRightX;\n    let lastRightX;\n    let firstBottomY;\n    for (let i = 0, ii = this._thumbnails.length; i < ii; i++) {\n      const { div } = this._thumbnails[i];\n      const {\n        offsetTop: y,\n        offsetLeft: x,\n        offsetWidth: w,\n        offsetHeight: h,\n      } = div;\n      if (w === 0) {\n        // The thumbnail view isn't visible.\n        return;\n      }\n      bbox[i * 4] = x;\n      bbox[i * 4 + 1] = y;\n      bbox[i * 4 + 2] = w;\n      bbox[i * 4 + 3] = h;\n      if (x > prevX) {\n        prevX = x + w / 2;\n        firstRightX ??= prevX + w;\n        positionsX.push(prevX);\n      }\n      if (y > prevY) {\n        if (reminder === -1 && positionsX.length > 1) {\n          reminder = ii % positionsX.length;\n        }\n        prevY = y + h / 2;\n        firstBottomY ??= prevY + h;\n        positionsY.push(prevY);\n      }\n      if (reminder > 0 && i >= ii - reminder) {\n        const cx = x + w / 2;\n        positionsLastX.push(cx);\n        lastRightX ??= cx + w;\n      }\n    }\n    const space =\n      positionsX.length > 1\n        ? (positionsX[1] - firstRightX) / 2\n        : (positionsY[1] - firstBottomY) / 2;\n    this.#thumbnailsPositions = {\n      x: positionsX,\n      y: positionsY,\n      lastX: positionsLastX,\n      space,\n      lastSpace: (positionsLastX.at(-1) - lastRightX) / 2,\n      bbox,\n    };\n    this.#isOneColumnView = positionsX.length === 1;\n    ({\n      clientWidth: this.#scrollableContainerWidth,\n      scrollHeight: this.#scrollableContainerHeight,\n    } = this.scrollableContainer);\n  }\n\n  #addEventListeners() {\n    this.eventBus.on(\"resize\", ({ source }) => {\n      if (source.thumbnailsView === this.container) {\n        this.#computeThumbnailsPosition();\n      }\n    });\n    this.container.addEventListener(\"keydown\", e => {\n      const { target } = e;\n      const isCheckbox =\n        target instanceof HTMLInputElement && target.type === \"checkbox\";\n\n      switch (e.key) {\n        case \"ArrowLeft\":\n          this.#goToNextItem(target, false, true, isCheckbox);\n          stopEvent(e);\n          break;\n        case \"ArrowRight\":\n          this.#goToNextItem(target, true, true, isCheckbox);\n          stopEvent(e);\n          break;\n        case \"ArrowDown\":\n          this.#goToNextItem(target, true, false, isCheckbox);\n          stopEvent(e);\n          break;\n        case \"ArrowUp\":\n          this.#goToNextItem(target, false, false, isCheckbox);\n          stopEvent(e);\n          break;\n        case \"Home\":\n          this.#focusThumbnailElement(this._thumbnails[0], isCheckbox);\n          stopEvent(e);\n          break;\n        case \"End\":\n          this.#focusThumbnailElement(this._thumbnails.at(-1), isCheckbox);\n          stopEvent(e);\n          break;\n        case \"Enter\":\n        case \" \":\n          if (!isCheckbox) {\n            this.#goToPage(e);\n          }\n          // For checkboxes, let the default behavior handle toggling\n          break;\n        case \"c\":\n          if (\n            this.#enableSplitMerge &&\n            (e.ctrlKey || e.metaKey) &&\n            this.#selectedPages?.size\n          ) {\n            this.#copyPages();\n            stopEvent(e);\n          }\n          break;\n        case \"x\":\n          if (\n            this.#enableSplitMerge &&\n            (e.ctrlKey || e.metaKey) &&\n            this.#selectedPages?.size\n          ) {\n            this.#cutPages();\n            stopEvent(e);\n          }\n          break;\n        case \"Delete\":\n        case \"Backspace\":\n          if (\n            this.#enableSplitMerge &&\n            !this.#isInPasteMode &&\n            this.#selectedPages?.size\n          ) {\n            this.#deletePages();\n            stopEvent(e);\n          }\n          break;\n      }\n    });\n    this.container.addEventListener(\"click\", e => {\n      const { target } = e;\n      if (target instanceof HTMLInputElement) {\n        const pageNumber = parseInt(\n          target.parentElement.getAttribute(\"page-number\"),\n          10\n        );\n        this.#selectPage(pageNumber, target.checked);\n        return;\n      }\n      this.#goToPage(e);\n    });\n    this.#addDragListeners();\n  }\n\n  #selectPage(pageNumber, checked) {\n    if (this.#hasUndoBarVisible) {\n      this.#dismissUndo(/* mustUpdateStatus = */ false);\n    }\n    const set = (this.#selectedPages ??= new Set());\n    if (checked) {\n      set.add(pageNumber);\n    } else {\n      set.delete(pageNumber);\n    }\n\n    this.#updateMenuEntries();\n    this.#updateStatus(\"select\");\n  }\n\n  #addDragListeners() {\n    if (!this.#enableSplitMerge) {\n      return;\n    }\n    this.container.addEventListener(\"pointerdown\", e => {\n      const {\n        target: draggedImage,\n        clientX: clickX,\n        clientY: clickY,\n        pointerId: dragPointerId,\n      } = e;\n      if (\n        e.button !== 0 || // Skip right click.\n        this.#isInPasteMode ||\n        this._thumbnails.length === 1 ||\n        !isNaN(this.#lastDraggedOverIndex) ||\n        !draggedImage.classList.contains(\"thumbnailImageContainer\")\n      ) {\n        // We're already handling a drag, or the target is not draggable.\n        return;\n      }\n\n      const thumbnail = draggedImage.parentElement;\n      const pointerDownAC = new AbortController();\n      const { signal: pointerDownSignal } = pointerDownAC;\n      let prevDragX = clickX;\n      let prevDragY = clickY;\n      let prevScrollTop = this.scrollableContainer.scrollTop;\n\n      // When dragging, the thumbnail is scaled down. To keep the cursor at the\n      // same position on the thumbnail, we need to adjust the offset\n      // accordingly.\n      const scaleFactor = PDFThumbnailViewer.#getScaleFactor(draggedImage);\n      this.#draggedImageOffsetY =\n        ((scaleFactor - 1) * e.layerY + draggedImage.offsetTop) / scaleFactor;\n\n      if (this.#isOneColumnView) {\n        this.#draggedImageOffsetX =\n          draggedImage.offsetLeft +\n          ((scaleFactor - 1) * 0.5 * draggedImage.offsetWidth) / scaleFactor;\n      } else {\n        this.#draggedImageOffsetX =\n          ((scaleFactor - 1) * e.layerX + draggedImage.offsetLeft) /\n          scaleFactor;\n      }\n      this.#draggedImageX = thumbnail.offsetLeft + this.#draggedImageOffsetX;\n      this.#draggedImageY = thumbnail.offsetTop + this.#draggedImageOffsetY;\n      this.#draggedImageWidth = draggedImage.offsetWidth / scaleFactor;\n      this.#draggedImageHeight = draggedImage.offsetHeight / scaleFactor;\n\n      this.container.addEventListener(\n        \"pointermove\",\n        ev => {\n          const { clientX: x, clientY: y, pointerId } = ev;\n          if (isNaN(this.#lastDraggedOverIndex)) {\n            if (\n              pointerId !== dragPointerId ||\n              (Math.abs(x - clickX) <= DRAG_THRESHOLD_IN_PIXELS &&\n                Math.abs(y - clickY) <= DRAG_THRESHOLD_IN_PIXELS)\n            ) {\n              // Not enough movement to be considered a drag.\n              return;\n            }\n\n            // First movement while dragging.\n            this.#onStartDragging(thumbnail);\n            const stopDragging = (_e, isDropping = false) => {\n              this.#onStopDragging(isDropping);\n              pointerDownAC.abort();\n            };\n            const { signal } = this.#dragAC;\n            window.addEventListener(\n              \"touchmove\",\n              stopEvent /* Prevent the container from scrolling */,\n              { passive: false, signal }\n            );\n            window.addEventListener(\"contextmenu\", noContextMenu, { signal });\n            this.scrollableContainer.addEventListener(\n              \"scrollend\",\n              () => {\n                const {\n                  scrollableContainer: { clientHeight, scrollTop },\n                } = this;\n                this.#currentScrollTop = scrollTop;\n                this.#currentScrollBottom = scrollTop + clientHeight;\n                const dy = scrollTop - prevScrollTop;\n                prevScrollTop = scrollTop;\n                this.#moveDraggedContainer(0, dy);\n              },\n              { passive: true, signal }\n            );\n            window.addEventListener(\n              \"pointerup\",\n              upEv => {\n                if (upEv.pointerId !== dragPointerId) {\n                  return;\n                }\n                // Prevent the subsequent click event after pointerup.\n                window.addEventListener(\"click\", stopEvent, {\n                  capture: true,\n                  once: true,\n                  signal,\n                });\n                stopEvent(upEv);\n                stopDragging(upEv, /* isDropping = */ true);\n              },\n              { signal }\n            );\n            window.addEventListener(\"blur\", stopDragging, { signal });\n            window.addEventListener(\"pointercancel\", stopDragging, { signal });\n            window.addEventListener(\"wheel\", stopEvent, {\n              passive: false,\n              signal,\n            });\n            window.addEventListener(\n              \"keydown\",\n              kEv => {\n                if (\n                  kEv.key === \"Escape\" &&\n                  !isNaN(this.#lastDraggedOverIndex)\n                ) {\n                  stopDragging(kEv);\n                }\n              },\n              { signal }\n            );\n          }\n\n          const dx = x - prevDragX;\n          const dy = y - prevDragY;\n          prevDragX = x;\n          prevDragY = y;\n          this.#moveDraggedContainer(dx, dy);\n        },\n        { passive: true, signal: pointerDownSignal }\n      );\n      window.addEventListener(\n        \"pointerup\",\n        ({ pointerId }) => {\n          if (pointerId !== dragPointerId) {\n            return;\n          }\n          pointerDownAC.abort();\n        },\n        { signal: pointerDownSignal }\n      );\n      window.addEventListener(\"dragstart\", stopEvent, {\n        capture: true,\n        signal: pointerDownSignal,\n      });\n    });\n  }\n\n  #goToPage(e) {\n    const container = e.target.closest(\".thumbnailImageContainer\");\n    if (container) {\n      const pageNumber = parseInt(container.getAttribute(\"page-number\"), 10);\n      this.linkService.goToPage(pageNumber);\n      stopEvent(e);\n    }\n  }\n\n  /**\n   * Focus either the checkbox or image of a thumbnail.\n   * @param {PDFThumbnailView} thumbnail\n   * @param {boolean} focusCheckbox - If true, focus checkbox; otherwise focus\n   *   image\n   */\n  #focusThumbnailElement(thumbnail, focusCheckbox) {\n    if (focusCheckbox && thumbnail.checkbox) {\n      thumbnail.checkbox.focus();\n    } else {\n      thumbnail.imageContainer.focus();\n    }\n  }\n\n  /**\n   * Go to the next/previous menu item.\n   * @param {HTMLElement} element\n   * @param {boolean} forward\n   * @param {boolean} horizontal\n   * @param {boolean} navigateCheckboxes - If true, focus checkboxes;\n   *   otherwise focus images\n   */\n  #goToNextItem(element, forward, horizontal, navigateCheckboxes = false) {\n    let currentPageNumber = parseInt(\n      element.parentElement.getAttribute(\"page-number\"),\n      10\n    );\n    if (isNaN(currentPageNumber)) {\n      currentPageNumber = this._currentPageNumber;\n    }\n\n    const increment = forward ? 1 : -1;\n    let nextThumbnail;\n    if (horizontal) {\n      const nextPageNumber = MathClamp(\n        currentPageNumber + increment,\n        1,\n        this._thumbnails.length + 1\n      );\n      nextThumbnail = this._thumbnails[nextPageNumber - 1];\n    } else {\n      const currentThumbnail = this._thumbnails[currentPageNumber - 1];\n      const { x: currentX, y: currentY } =\n        currentThumbnail.div.getBoundingClientRect();\n      let firstWithDifferentY;\n      for (\n        let i = currentPageNumber - 1 + increment;\n        i >= 0 && i < this._thumbnails.length;\n        i += increment\n      ) {\n        const thumbnail = this._thumbnails[i];\n        const { x, y } = thumbnail.div.getBoundingClientRect();\n        if (!firstWithDifferentY && y !== currentY) {\n          firstWithDifferentY = thumbnail;\n        }\n        if (x === currentX) {\n          nextThumbnail = thumbnail;\n          break;\n        }\n      }\n      if (!nextThumbnail) {\n        nextThumbnail = firstWithDifferentY;\n      }\n    }\n    if (nextThumbnail) {\n      this.#focusThumbnailElement(nextThumbnail, navigateCheckboxes);\n    }\n  }\n\n  // Given the drag center (x, y), find the drop slot index: the drag marker\n  // will be placed after thumbnail[index], or before all thumbnails if index\n  // is -1. Returns null when the drop slot hasn't changed (no marker update\n  // needed), or [index, space] where space is the gap (in px) between\n  // thumbnails at that slot, used to position the marker.\n  //\n  // positionsX holds the x-center of each column, positionsY the y-center of\n  // each row. positionsLastX holds the x-centers for an incomplete last row\n  // (when the total number of thumbnails is not a multiple of the column\n  // count).\n  #findClosestThumbnail(x, y) {\n    if (!this.#thumbnailsPositions) {\n      this.#computeThumbnailsPosition();\n    }\n    const {\n      x: positionsX,\n      y: positionsY,\n      lastX: positionsLastX,\n      space: spaceBetweenThumbnails,\n      lastSpace: lastSpaceBetweenThumbnails,\n    } = this.#thumbnailsPositions;\n    const lastDraggedOverIndex = this.#lastDraggedOverIndex;\n\n    // Fast-path: reconstruct the row/col of the previous drop slot and check\n    // whether (x, y) still falls inside the same cell's bounds.\n    let xPos = lastDraggedOverIndex % positionsX.length;\n    let yPos = Math.floor(lastDraggedOverIndex / positionsX.length);\n    let xArray = yPos === positionsY.length - 1 ? positionsLastX : positionsX;\n    if (\n      positionsY[yPos] <= y &&\n      y < (positionsY[yPos + 1] ?? Infinity) &&\n      xArray[xPos] <= x &&\n      x < (xArray[xPos + 1] ?? Infinity)\n    ) {\n      // Fast-path: we're still in the same thumbnail.\n      return null;\n    }\n\n    let index;\n    // binarySearchFirstItem returns the first row index whose center is below\n    // y, i.e. the first i such that positionsY[i] > y.\n    yPos = binarySearchFirstItem(positionsY, cy => y < cy);\n    if (this.#isOneColumnView) {\n      // In a single column the drop slot is simply the row boundary: the marker\n      // goes after row (yPos - 1), meaning before row yPos. index = -1 when y\n      // is above the first thumbnail's center (drop before thumbnail 0).\n      index = yPos - 1;\n    } else {\n      // Grid layout: first pick the nearest row, then the nearest column.\n\n      if (yPos === positionsY.length) {\n        // y is below the last row's center — clamp to the last row.\n        yPos = positionsY.length - 1;\n      } else {\n        // Choose between the row just above (yPos - 1) and the row at yPos by\n        // comparing distances, so the marker snaps to whichever row center is\n        // closer to y.\n        const dist1 = Math.abs(positionsY[yPos - 1] - y);\n        const dist2 = Math.abs(positionsY[yPos] - y);\n        yPos = dist1 < dist2 ? yPos - 1 : yPos;\n      }\n      // The last row may be incomplete, so use its own x-center array.\n      xArray =\n        yPos === positionsY.length - 1 && positionsLastX.length > 0\n          ? positionsLastX\n          : positionsX;\n      // Find the column: the first column whose center is to the right of x,\n      // minus 1, gives the column the cursor is in (or -1 if before column 0).\n      xPos = binarySearchFirstItem(xArray, cx => x < cx) - 1;\n      if (yPos < 0) {\n        // y is above the first row: force drop before the very first thumbnail.\n        if (xPos <= 0) {\n          xPos = -1;\n        }\n        yPos = 0;\n      }\n      // Convert (row, col) to a flat thumbnail index, clamped to\n      // [-1, length-1].\n      index = MathClamp(\n        yPos * positionsX.length + xPos,\n        -1,\n        this._thumbnails.length - 1\n      );\n    }\n    if (index === lastDraggedOverIndex) {\n      // No change.\n      return null;\n    }\n    this.#lastDraggedOverIndex = index;\n    // Use the last-row gap when the drop slot is in the incomplete last row.\n    const space =\n      yPos === positionsY.length - 1 && positionsLastX.length > 0 && xPos >= 0\n        ? lastSpaceBetweenThumbnails\n        : spaceBetweenThumbnails;\n\n    return [index, space];\n  }\n}\n\nexport { PDFThumbnailViewer };\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// 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(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/annotation_layer.js\").AnnotationLayer} AnnotationLayer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/struct_tree_layer_builder.js\").StructTreeLayerBuilder} StructTreeLayerBuilder */\n\nimport { AnnotationEditorLayer } from \"pdfjs-lib\";\nimport { GenericL10n } from \"web-null_l10n\";\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderOptions\n * @property {AnnotationEditorUIManager} [uiManager]\n * @property {number} pageIndex\n * @property {L10n} [l10n]\n * @property {StructTreeLayerBuilder} [structTreeLayer]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationLayer} [annotationLayer]\n * @property {TextLayer} [textLayer]\n * @property {DrawLayer} [drawLayer]\n * @property {function} [onAppend]\n */\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass AnnotationEditorLayerBuilder {\n  #annotationLayer = null;\n\n  #drawLayer = null;\n\n  #onAppend = null;\n\n  #structTreeLayer = null;\n\n  #textLayer = null;\n\n  #uiManager;\n\n  /**\n   * @param {AnnotationEditorLayerBuilderOptions} options\n   */\n  constructor(options) {\n    this.pageIndex = options.pageIndex;\n    this.accessibilityManager = options.accessibilityManager;\n    this.l10n = options.l10n;\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      this.l10n ||= new GenericL10n();\n    }\n    this.annotationEditorLayer = null;\n    this.div = null;\n    this._cancelled = false;\n    this.#uiManager = options.uiManager;\n    this.#annotationLayer = options.annotationLayer || null;\n    this.#textLayer = options.textLayer || null;\n    this.#drawLayer = options.drawLayer || null;\n    this.#onAppend = options.onAppend || null;\n    this.#structTreeLayer = options.structTreeLayer || null;\n  }\n\n  updatePageIndex(newPageIndex) {\n    this.pageIndex = newPageIndex;\n    this.annotationEditorLayer?.updatePageIndex(newPageIndex);\n  }\n\n  /**\n   * @param {AnnotationEditorLayerBuilderRenderOptions} options\n   * @returns {Promise<void>}\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    const div = (this.div = document.createElement(\"div\"));\n    div.className = \"annotationEditorLayer\";\n    div.hidden = true;\n    div.dir = this.#uiManager.direction;\n    this.#onAppend?.(div);\n\n    this.annotationEditorLayer = new AnnotationEditorLayer({\n      uiManager: this.#uiManager,\n      div,\n      structTreeLayer: this.#structTreeLayer,\n      accessibilityManager: this.accessibilityManager,\n      pageIndex: this.pageIndex,\n      l10n: this.l10n,\n      viewport: clonedViewport,\n      annotationLayer: this.#annotationLayer,\n      textLayer: this.#textLayer,\n      drawLayer: this.#drawLayer,\n    });\n\n    const parameters = {\n      viewport: clonedViewport,\n      div,\n      annotations: null,\n      intent,\n    };\n\n    await this.annotationEditorLayer.render(parameters);\n    this.show();\n  }\n\n  cancel() {\n    this._cancelled = true;\n\n    if (!this.div) {\n      return;\n    }\n    this.annotationEditorLayer.destroy();\n  }\n\n  hide() {\n    if (!this.div) {\n      return;\n    }\n    this.annotationEditorLayer.pause(/* on */ true);\n    this.div.hidden = true;\n  }\n\n  show() {\n    if (!this.div || this.annotationEditorLayer.isInvisible) {\n      return;\n    }\n    this.div.hidden = false;\n    this.annotationEditorLayer.pause(/* on */ false);\n  }\n}\n\nexport { AnnotationEditorLayerBuilder };\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// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/annotation_storage\").AnnotationStorage} AnnotationStorage */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./struct_tree_layer_builder.js\").StructTreeLayerBuilder} StructTreeLayerBuilder */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/editor/tools.js\").AnnotationEditorUIManager} AnnotationEditorUIManager */\n/** @typedef {import(\"./comment_manager.js\").CommentManager} CommentManager */\n/** @typedef {import(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./base_download_manager.js\").BaseDownloadManager} BaseDownloadManager */\n\nimport {\n  AnnotationLayer,\n  AnnotationType,\n  setLayerDimensions,\n  Util,\n} from \"pdfjs-lib\";\nimport { PresentationModeState } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\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 {PDFLinkService} linkService\n * @property {BaseDownloadManager} [downloadManager]\n * @property {boolean} [enableComment]\n * @property {boolean} [enableScripting]\n * @property {Promise<boolean>} [hasJSActionsPromise]\n * @property {Promise<Object<string, Array<Object>> | null>}\n *   [fieldObjectsPromise]\n * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationEditorUIManager} [annotationEditorUIManager]\n * @property {function} [onAppend]\n * @property {CommentManager} [commentManager]\n */\n\n/**\n * @typedef {Object} AnnotationLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n * @property {StructTreeLayerBuilder} [structTreeLayer]\n */\n\nclass AnnotationLayerBuilder {\n  #annotations = null;\n\n  #commentManager = null;\n\n  #externalHide = false;\n\n  #onAppend = null;\n\n  #eventAbortController = null;\n\n  #linksInjected = false;\n\n  /**\n   * @param {AnnotationLayerBuilderOptions} options\n   */\n  constructor({\n    pdfPage,\n    linkService,\n    downloadManager,\n    annotationStorage = null,\n    imageResourcesPath = \"\",\n    renderForms = true,\n    enableComment = false,\n    commentManager = null,\n    enableScripting = false,\n    hasJSActionsPromise = null,\n    fieldObjectsPromise = null,\n    annotationCanvasMap = null,\n    accessibilityManager = null,\n    annotationEditorUIManager = null,\n    onAppend = null,\n  }) {\n    this.pdfPage = pdfPage;\n    this.linkService = linkService;\n    this.downloadManager = downloadManager;\n    this.imageResourcesPath = imageResourcesPath;\n    this.renderForms = renderForms;\n    this.annotationStorage = annotationStorage;\n    this.enableComment = enableComment;\n    this.#commentManager = commentManager;\n    this.enableScripting = enableScripting;\n    this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false);\n    this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null);\n    this._annotationCanvasMap = annotationCanvasMap;\n    this._accessibilityManager = accessibilityManager;\n    this._annotationEditorUIManager = annotationEditorUIManager;\n    this.#onAppend = onAppend;\n\n    this.annotationLayer = null;\n    this.div = null;\n    this._cancelled = false;\n    this._eventBus = linkService.eventBus;\n  }\n\n  /**\n   * @param {AnnotationLayerBuilderRenderOptions} options\n   * @returns {Promise<void>} A promise that is resolved when rendering of the\n   *   annotations is complete.\n   */\n  async render({ viewport, intent = \"display\", structTreeLayer = null }) {\n    if (this.div) {\n      if (this._cancelled || !this.annotationLayer) {\n        return;\n      }\n      // If an annotationLayer already exists, refresh its children's\n      // transformation matrices.\n      this.annotationLayer.update({\n        viewport: viewport.clone({ dontFlip: true }),\n      });\n      return;\n    }\n\n    const [annotations, hasJSActions, fieldObjects] = await Promise.all([\n      this.pdfPage.getAnnotations({ intent }),\n      this._hasJSActionsPromise,\n      this._fieldObjectsPromise,\n    ]);\n    if (this._cancelled) {\n      return;\n    }\n\n    // Create an annotation layer div and render the annotations\n    // if there is at least one annotation.\n    const div = (this.div = document.createElement(\"div\"));\n    div.className = \"annotationLayer\";\n    this.#onAppend?.(div);\n    this.#initAnnotationLayer(viewport, structTreeLayer);\n\n    if (annotations.length === 0) {\n      this.#annotations = annotations;\n      setLayerDimensions(this.div, viewport);\n      return;\n    }\n\n    await this.annotationLayer.render({\n      annotations,\n      imageResourcesPath: this.imageResourcesPath,\n      renderForms: this.renderForms,\n      downloadManager: this.downloadManager,\n      enableComment: this.enableComment,\n      enableScripting: this.enableScripting,\n      hasJSActions,\n      fieldObjects,\n    });\n\n    this.#annotations = annotations;\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.#eventAbortController) {\n      this.#eventAbortController = new AbortController();\n\n      this._eventBus?._on(\n        \"presentationmodechanged\",\n        evt => {\n          this.#updatePresentationModeState(evt.state);\n        },\n        { signal: this.#eventAbortController.signal }\n      );\n    }\n  }\n\n  #initAnnotationLayer(viewport, structTreeLayer) {\n    this.annotationLayer = new AnnotationLayer({\n      div: this.div,\n      accessibilityManager: this._accessibilityManager,\n      annotationCanvasMap: this._annotationCanvasMap,\n      annotationEditorUIManager: this._annotationEditorUIManager,\n      annotationStorage: this.annotationStorage,\n      page: this.pdfPage,\n      viewport: viewport.clone({ dontFlip: true }),\n      structTreeLayer,\n      commentManager: this.#commentManager,\n      linkService: this.linkService,\n    });\n  }\n\n  cancel() {\n    this._cancelled = true;\n\n    this.#eventAbortController?.abort();\n    this.#eventAbortController = null;\n  }\n\n  hide(internal = false) {\n    this.#externalHide = !internal;\n    if (!this.div) {\n      return;\n    }\n    this.div.hidden = true;\n  }\n\n  hasEditableAnnotations() {\n    return !!this.annotationLayer?.hasEditableAnnotations();\n  }\n\n  /**\n   * @param {Array<Object>} inferredLinks\n   * @returns {Promise<void>} A promise that is resolved when the inferred links\n   *   are added to the annotation layer.\n   */\n  async injectLinkAnnotations(inferredLinks) {\n    if (this.#annotations === null) {\n      throw new Error(\n        \"`render` method must be called before `injectLinkAnnotations`.\"\n      );\n    }\n    if (this._cancelled || this.#linksInjected) {\n      return;\n    }\n    this.#linksInjected = true;\n\n    const newLinks = this.#annotations.length\n      ? this.#checkInferredLinks(inferredLinks)\n      : inferredLinks;\n\n    if (!newLinks.length) {\n      return;\n    }\n\n    await this.annotationLayer.addLinkAnnotations(newLinks);\n    // Don't show the annotation layer if it was explicitly hidden previously.\n    if (!this.#externalHide) {\n      this.div.hidden = false;\n    }\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  #checkInferredLinks(inferredLinks) {\n    function annotationRects(annot) {\n      if (!annot.quadPoints) {\n        return [annot.rect];\n      }\n      const rects = [];\n      for (let i = 2, ii = annot.quadPoints.length; i < ii; i += 8) {\n        const trX = annot.quadPoints[i];\n        const trY = annot.quadPoints[i + 1];\n        const blX = annot.quadPoints[i + 2];\n        const blY = annot.quadPoints[i + 3];\n        rects.push([blX, blY, trX, trY]);\n      }\n      return rects;\n    }\n\n    function intersectAnnotations(annot1, annot2) {\n      const intersections = [];\n      const annot1Rects = annotationRects(annot1);\n      const annot2Rects = annotationRects(annot2);\n      for (const rect1 of annot1Rects) {\n        for (const rect2 of annot2Rects) {\n          const intersection = Util.intersect(rect1, rect2);\n          if (intersection) {\n            intersections.push(intersection);\n          }\n        }\n      }\n      return intersections;\n    }\n\n    function areaRects(rects) {\n      let totalArea = 0;\n      for (const rect of rects) {\n        totalArea += Math.abs((rect[2] - rect[0]) * (rect[3] - rect[1]));\n      }\n      return totalArea;\n    }\n\n    return inferredLinks.filter(link => {\n      let linkAreaRects;\n\n      for (const annotation of this.#annotations) {\n        if (\n          annotation.annotationType !== AnnotationType.LINK ||\n          !annotation.url\n        ) {\n          continue;\n        }\n        // TODO: Add a test case to verify that we can find the intersection\n        //       between two annotations with quadPoints properly.\n        const intersections = intersectAnnotations(annotation, link);\n\n        if (intersections.length === 0) {\n          continue;\n        }\n        linkAreaRects ??= areaRects(annotationRects(link));\n\n        if (\n          areaRects(intersections) / linkAreaRects >\n          0.5 /* If the overlap is more than 50%. */\n        ) {\n          return false;\n        }\n      }\n      return true;\n    });\n  }\n}\n\nexport { AnnotationLayerBuilder };\n","/* Copyright 2025 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 { AnnotationType, createValidAbsoluteUrl, Util } from \"pdfjs-lib\";\nimport { getOriginalIndex, normalize } from \"./pdf_find_controller.js\";\n\nfunction DOMRectToPDF({ width, height, left, top }, pdfPageView) {\n  if (width === 0 || height === 0) {\n    return null;\n  }\n\n  const pageBox = pdfPageView.textLayer.div.getBoundingClientRect();\n  const bottomLeft = pdfPageView.getPagePoint(\n    left - pageBox.left,\n    top - pageBox.top\n  );\n  const topRight = pdfPageView.getPagePoint(\n    left - pageBox.left + width,\n    top - pageBox.top + height\n  );\n\n  return Util.normalizeRect([\n    bottomLeft[0],\n    bottomLeft[1],\n    topRight[0],\n    topRight[1],\n  ]);\n}\n\nfunction calculateLinkPosition(range, pdfPageView) {\n  const rangeRects = range.getClientRects();\n  if (rangeRects.length === 1) {\n    return { rect: DOMRectToPDF(rangeRects[0], pdfPageView) };\n  }\n\n  const rect = [Infinity, Infinity, -Infinity, -Infinity];\n  const quadPoints = [];\n  let i = 0;\n  for (const domRect of rangeRects) {\n    const normalized = DOMRectToPDF(domRect, pdfPageView);\n    if (normalized === null) {\n      continue;\n    }\n\n    quadPoints[i] = quadPoints[i + 4] = normalized[0];\n    quadPoints[i + 1] = quadPoints[i + 3] = normalized[3];\n    quadPoints[i + 2] = quadPoints[i + 6] = normalized[2];\n    quadPoints[i + 5] = quadPoints[i + 7] = normalized[1];\n\n    Util.rectBoundingBox(...normalized, rect);\n    i += 8;\n  }\n  return { quadPoints, rect };\n}\n\n/**\n * Given a DOM node `container` and an index into its text contents `offset`,\n * returns a pair consisting of text node that the `offset` actually points\n * to, together with the offset relative to that text node.\n * When the offset points at the boundary between two node, the result will\n * point to the first text node in depth-first traversal order.\n *\n * For example, given this DOM:\n * <p>abc<span>def</span>ghi</p>\n *\n * textPosition(p, 0) -> [#text \"abc\", 0] (before `a`)\n * textPosition(p, 2) -> [#text \"abc\", 2] (between `b` and `c`)\n * textPosition(p, 3) -> [#text \"abc\", 3] (after `c`)\n * textPosition(p, 5) -> [#text \"def\", 2] (between `e` and `f`)\n * textPosition(p, 6) -> [#text \"def\", 3] (after `f`)\n */\nfunction textPosition(container, offset) {\n  let currentContainer = container;\n  do {\n    if (currentContainer.nodeType === Node.TEXT_NODE) {\n      const currentLength = currentContainer.textContent.length;\n      if (offset <= currentLength) {\n        return [currentContainer, offset];\n      }\n      offset -= currentLength;\n    } else if (currentContainer.firstChild) {\n      currentContainer = currentContainer.firstChild;\n      continue;\n    }\n\n    while (!currentContainer.nextSibling && currentContainer !== container) {\n      currentContainer = currentContainer.parentNode;\n    }\n    if (currentContainer !== container) {\n      currentContainer = currentContainer.nextSibling;\n    }\n  } while (currentContainer !== container);\n  throw new Error(\"Offset is bigger than container's contents length.\");\n}\n\nfunction createLinkAnnotation({ url, index, length }, pdfPageView, id) {\n  const highlighter = pdfPageView._textHighlighter;\n  const [{ begin, end }] = highlighter._convertMatches([index], [length]);\n\n  const range = new Range();\n  range.setStart(\n    ...textPosition(highlighter.textDivs[begin.divIdx], begin.offset)\n  );\n  range.setEnd(...textPosition(highlighter.textDivs[end.divIdx], end.offset));\n\n  return {\n    id: `inferred_link_${id}`,\n    unsafeUrl: url,\n    url,\n    annotationType: AnnotationType.LINK,\n    rotation: 0,\n    ...calculateLinkPosition(range, pdfPageView),\n    // Populated in the annotationLayer to avoid unnecessary object creation,\n    // since most inferred links overlap existing LinkAnnotations:\n    borderStyle: null,\n  };\n}\n\nclass Autolinker {\n  static #index = 0;\n\n  static #regex;\n\n  static #numericTLDRegex;\n\n  static findLinks(text) {\n    // Regex can be tested and verified at https://regex101.com/r/rXoLiT/2.\n    this.#regex ??=\n      /\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\S--[\\p{P}<>]]|\\/|[\\S--[\\[\\]]]+[\\S--[\\p{P}<>]])+|(?=\\p{L})[\\S--[@\\p{Ps}\\p{Pe}<>]]+@([\\S--[[\\p{P}--\\-]<>]]+(?:\\.[\\S--[[\\p{P}--\\-]<>]]+)+)/gmv;\n\n    const [normalizedText, diffs] = normalize(text, { ignoreDashEOL: true });\n    const matches = normalizedText.matchAll(this.#regex);\n    const links = [];\n    for (const match of matches) {\n      const [url, emailDomain] = match;\n      let raw;\n      if (\n        url.startsWith(\"www.\") ||\n        url.startsWith(\"http://\") ||\n        url.startsWith(\"https://\")\n      ) {\n        raw = url;\n      } else if (emailDomain) {\n        const hostname = URL.parse(`http://${emailDomain}`)?.hostname;\n        if (!hostname) {\n          continue;\n        }\n        this.#numericTLDRegex ??= /\\.\\d+$/;\n        if (this.#numericTLDRegex.test(hostname)) {\n          // Skip emails with a numeric TLD as domain.\n          continue;\n        }\n      }\n      raw ??= url.startsWith(\"mailto:\") ? url : `mailto:${url}`;\n\n      const absoluteURL = createValidAbsoluteUrl(raw, null, {\n        addDefaultProtocol: true,\n      });\n      if (absoluteURL) {\n        const [index, length] = getOriginalIndex(\n          diffs,\n          match.index,\n          url.length\n        );\n        links.push({ url: absoluteURL.href, index, length });\n      }\n    }\n    return links;\n  }\n\n  static processLinks(pdfPageView) {\n    return this.findLinks(\n      pdfPageView._textHighlighter.textContentItemsStr.join(\"\\n\")\n    ).map(link => createLinkAnnotation(link, pdfPageView, this.#index++));\n  }\n}\n\nexport { Autolinker };\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 { RenderableView, RenderingStates } from \"./renderable_view.js\";\nimport { RenderingCancelledException } from \"pdfjs-lib\";\n\nclass BasePDFPageView extends RenderableView {\n  #loadingId = null;\n\n  #renderError = null;\n\n  #renderingState = RenderingStates.INITIAL;\n\n  #showCanvas = null;\n\n  #startTime = 0;\n\n  #tempCanvas = null;\n\n  canvas = null;\n\n  /** @type {null | HTMLDivElement} */\n  div = null;\n\n  enableOptimizedPartialRendering = false;\n\n  imagesRightClickMinSize = -1;\n\n  eventBus = null;\n\n  id = null;\n\n  imageCoordinates = null;\n\n  pageColors = null;\n\n  recordedBBoxes = null;\n\n  renderingQueue = null;\n\n  constructor(options) {\n    super();\n    this.eventBus = options.eventBus;\n    this.id = options.id;\n    this.pageColors = options.pageColors || null;\n    this.renderingQueue = options.renderingQueue;\n    this.enableOptimizedPartialRendering =\n      options.enableOptimizedPartialRendering ?? false;\n    this.imagesRightClickMinSize = options.imagesRightClickMinSize ?? -1;\n    this.minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500;\n  }\n\n  get renderingState() {\n    return this.#renderingState;\n  }\n\n  set renderingState(state) {\n    if (state === this.#renderingState) {\n      return;\n    }\n    this.#renderingState = state;\n\n    if (this.#loadingId) {\n      clearTimeout(this.#loadingId);\n      this.#loadingId = null;\n    }\n\n    switch (state) {\n      case RenderingStates.PAUSED:\n        this.div.classList.remove(\"loading\");\n        // Display the canvas as it has been drawn.\n        this.#startTime = 0;\n        this.#showCanvas?.(false);\n        break;\n      case RenderingStates.RUNNING:\n        this.div.classList.add(\"loadingIcon\");\n        this.#loadingId = setTimeout(() => {\n          // Adding the loading class is slightly postponed in order to not have\n          // it with loadingIcon.\n          // If we don't do that the visibility of the background is changed but\n          // the transition isn't triggered.\n          this.div.classList.add(\"loading\");\n          this.#loadingId = null;\n        }, 0);\n        this.#startTime = Date.now();\n        break;\n      case RenderingStates.INITIAL:\n      case RenderingStates.FINISHED:\n        this.div.classList.remove(\"loadingIcon\", \"loading\");\n        this.#startTime = 0;\n        break;\n    }\n  }\n\n  _createCanvas(onShow, hideUntilComplete = false) {\n    const { pageColors } = this;\n    const hasHCM = !!(pageColors?.background && pageColors?.foreground);\n    const prevCanvas = this.canvas;\n\n    // In HCM, a final filter is applied on the canvas which means that\n    // before it's applied we've normal colors. Consequently, to avoid to\n    // have a final flash we just display it once all the drawing is done.\n    const updateOnFirstShow = !prevCanvas && !hasHCM && !hideUntilComplete;\n\n    let canvas = (this.canvas = document.createElement(\"canvas\"));\n\n    this.#showCanvas = isLastShow => {\n      if (updateOnFirstShow) {\n        let tempCanvas = this.#tempCanvas;\n        if (!isLastShow && this.minDurationToUpdateCanvas > 0) {\n          // We draw on the canvas at 60fps (in using `requestAnimationFrame`),\n          // so if the canvas is large, updating it at 60fps can be a way too\n          // much and can cause some serious performance issues.\n          // To avoid that we only update the canvas every\n          // `this.#minDurationToUpdateCanvas` ms.\n\n          if (Date.now() - this.#startTime < this.minDurationToUpdateCanvas) {\n            return;\n          }\n          if (!tempCanvas) {\n            tempCanvas = this.#tempCanvas = canvas;\n            canvas = this.canvas = canvas.cloneNode(false);\n            onShow(canvas);\n          }\n        }\n\n        if (tempCanvas) {\n          const ctx = canvas.getContext(\"2d\", {\n            alpha: false,\n          });\n          ctx.drawImage(tempCanvas, 0, 0);\n          if (isLastShow) {\n            this.#resetTempCanvas();\n          } else {\n            this.#startTime = Date.now();\n          }\n          return;\n        }\n\n        // Don't add the canvas until the first draw callback, or until\n        // drawing is complete when `!this.renderingQueue`, to prevent black\n        // flickering.\n        onShow(canvas);\n        this.#showCanvas = null;\n        return;\n      }\n      if (!isLastShow) {\n        return;\n      }\n\n      if (prevCanvas) {\n        prevCanvas.replaceWith(canvas);\n        prevCanvas.width = prevCanvas.height = 0;\n      } else {\n        onShow(canvas);\n      }\n    };\n\n    return { canvas, prevCanvas };\n  }\n\n  #renderContinueCallback = cont => {\n    this.#showCanvas?.(false);\n    if (this.renderingQueue && !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  _resetCanvas() {\n    const { canvas } = this;\n    if (!canvas) {\n      return;\n    }\n    canvas.remove();\n    canvas.width = canvas.height = 0;\n    this.canvas = null;\n    this.#resetTempCanvas();\n  }\n\n  #resetTempCanvas() {\n    if (this.#tempCanvas) {\n      this.#tempCanvas.width = this.#tempCanvas.height = 0;\n      this.#tempCanvas = null;\n    }\n  }\n\n  async _drawCanvas(options, onCancel, onFinish) {\n    const renderTask = (this.renderTask = this.pdfPage.render(options));\n    renderTask.onContinue = this.#renderContinueCallback;\n    renderTask.onError = error => {\n      if (error instanceof RenderingCancelledException) {\n        onCancel();\n        this.#renderError = null;\n      }\n    };\n\n    let error = null;\n    try {\n      await renderTask.promise;\n      this.#showCanvas?.(true);\n    } catch (e) {\n      // When zooming with a `drawingDelay` set, avoid temporarily showing\n      // a black canvas if rendering was cancelled before the `onContinue`-\n      // callback had been invoked at least once.\n      if (e instanceof RenderingCancelledException) {\n        return;\n      }\n      error = e;\n\n      this.#showCanvas?.(true);\n    } finally {\n      this.#renderError = error;\n\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        if (this.enableOptimizedPartialRendering) {\n          this.recordedBBoxes ??= renderTask.recordedBBoxes;\n        }\n        if (this.imagesRightClickMinSize !== -1) {\n          this.imageCoordinates ??= this.pdfPage.imageCoordinates;\n        }\n      }\n    }\n    this.renderingState = RenderingStates.FINISHED;\n\n    onFinish(renderTask);\n\n    if (error) {\n      throw error;\n    }\n  }\n\n  cancelRendering({ cancelExtraDelay = 0 } = {}) {\n    if (this.renderTask) {\n      this.renderTask.cancel(cancelExtraDelay);\n      this.renderTask = null;\n    }\n    this.resume = null;\n  }\n\n  dispatchPageRender() {\n    this.eventBus.dispatch(\"pagerender\", {\n      source: this,\n      pageNumber: this.id,\n    });\n  }\n\n  dispatchPageRendered(cssTransform, isDetailView) {\n    this.eventBus.dispatch(\"pagerendered\", {\n      source: this,\n      pageNumber: this.id,\n      cssTransform,\n      isDetailView,\n      timestamp: performance.now(),\n      error: this.#renderError,\n    });\n  }\n}\n\nexport { BasePDFPageView };\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 { DrawLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} DrawLayerBuilderRenderOptions\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass DrawLayerBuilder {\n  #drawLayer = null;\n\n  /**\n   * @param {DrawLayerBuilderRenderOptions} options\n   * @returns {Promise<void>}\n   */\n  async render({ intent = \"display\" }) {\n    if (intent !== \"display\" || this.#drawLayer || this._cancelled) {\n      return;\n    }\n    this.#drawLayer = new DrawLayer();\n  }\n\n  cancel() {\n    this._cancelled = true;\n\n    if (!this.#drawLayer) {\n      return;\n    }\n    this.#drawLayer.destroy();\n    this.#drawLayer = null;\n  }\n\n  setParent(parent) {\n    this.#drawLayer?.setParent(parent);\n  }\n\n  getDrawLayer() {\n    return this.#drawLayer;\n  }\n}\n\nexport { DrawLayerBuilder };\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 { BasePDFPageView } from \"./base_pdf_page_view.js\";\nimport { OutputScale } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./renderable_view.js\";\n\nclass PDFPageDetailView extends BasePDFPageView {\n  #detailArea = null;\n\n  /**\n   * @type {boolean} True when the last rendering attempt of the view was\n   *                 cancelled due to a `.reset()` call. This will happen when\n   *                 the visible area changes so much during the rendering that\n   *                 we need to cancel the rendering and start over.\n   */\n  renderingCancelled = false;\n\n  constructor({ pageView }) {\n    super(pageView);\n\n    this.pageView = pageView;\n    this.renderingId = \"detail\" + this.id;\n\n    this.div = pageView.div;\n  }\n\n  setPdfPage(pdfPage) {\n    this.pageView.setPdfPage(pdfPage);\n  }\n\n  get pdfPage() {\n    return this.pageView.pdfPage;\n  }\n\n  get renderingState() {\n    return super.renderingState;\n  }\n\n  set renderingState(state) {\n    this.renderingCancelled = false;\n    super.renderingState = state;\n  }\n\n  reset({ keepCanvas = false } = {}) {\n    const renderingCancelled =\n      this.renderingCancelled ||\n      this.renderingState === RenderingStates.RUNNING ||\n      this.renderingState === RenderingStates.PAUSED;\n    this.cancelRendering();\n    this.renderingState = RenderingStates.INITIAL;\n    this.renderingCancelled = renderingCancelled;\n\n    if (!keepCanvas) {\n      this._resetCanvas();\n    }\n  }\n\n  #shouldRenderDifferentArea(visibleArea) {\n    if (!this.#detailArea) {\n      return true;\n    }\n\n    const minDetailX = this.#detailArea.minX;\n    const minDetailY = this.#detailArea.minY;\n    const maxDetailX = this.#detailArea.width + minDetailX;\n    const maxDetailY = this.#detailArea.height + minDetailY;\n\n    if (\n      visibleArea.minX < minDetailX ||\n      visibleArea.minY < minDetailY ||\n      visibleArea.maxX > maxDetailX ||\n      visibleArea.maxY > maxDetailY\n    ) {\n      return true;\n    }\n\n    const {\n      width: maxWidth,\n      height: maxHeight,\n      scale,\n    } = this.pageView.viewport;\n\n    if (this.#detailArea.scale !== scale) {\n      return true;\n    }\n\n    const paddingLeftSize = visibleArea.minX - minDetailX;\n    const paddingRightSize = maxDetailX - visibleArea.maxX;\n    const paddingTopSize = visibleArea.minY - minDetailY;\n    const paddingBottomSize = maxDetailY - visibleArea.maxY;\n\n    // If the user is moving in any direction such that the remaining area\n    // rendered outside of the screen is less than MOVEMENT_THRESHOLD of the\n    // padding we render on each side, trigger a re-render. This is so that if\n    // the user then keeps scrolling in that direction, we have a chance of\n    // finishing rendering the new detail before they get past the rendered\n    // area.\n\n    const MOVEMENT_THRESHOLD = 0.5;\n    const ratio = (1 + MOVEMENT_THRESHOLD) / MOVEMENT_THRESHOLD;\n\n    if (\n      (minDetailX > 0 && paddingRightSize / paddingLeftSize > ratio) ||\n      (maxDetailX < maxWidth && paddingLeftSize / paddingRightSize > ratio) ||\n      (minDetailY > 0 && paddingBottomSize / paddingTopSize > ratio) ||\n      (maxDetailY < maxHeight && paddingTopSize / paddingBottomSize > ratio)\n    ) {\n      return true;\n    }\n\n    return false;\n  }\n\n  update({ visibleArea = null, underlyingViewUpdated = false } = {}) {\n    if (underlyingViewUpdated) {\n      this.cancelRendering();\n      this.renderingState = RenderingStates.INITIAL;\n      return;\n    }\n\n    if (!this.#shouldRenderDifferentArea(visibleArea)) {\n      return;\n    }\n\n    const { viewport, maxCanvasPixels, capCanvasAreaFactor } = this.pageView;\n\n    const visibleWidth = visibleArea.maxX - visibleArea.minX;\n    const visibleHeight = visibleArea.maxY - visibleArea.minY;\n\n    // \"overflowScale\" represents which percentage of the width and of the\n    // height the detail area extends outside of the visible area. We want to\n    // draw a larger area so that we don't have to constantly re-draw while\n    // scrolling. The detail area's dimensions thus become\n    // visibleLength * (2 * overflowScale + 1).\n    // We default to adding a whole height/length of detail area on each side,\n    // but we can reduce it to make sure that we stay within the maxCanvasPixels\n    // limit.\n    const visiblePixels =\n      visibleWidth * visibleHeight * OutputScale.pixelRatio ** 2;\n    const maxDetailToVisibleLinearRatio = Math.sqrt(\n      OutputScale.capPixels(maxCanvasPixels, capCanvasAreaFactor) /\n        visiblePixels\n    );\n    const maxOverflowScale = (maxDetailToVisibleLinearRatio - 1) / 2;\n    let overflowScale = Math.min(1, maxOverflowScale);\n    if (overflowScale < 0) {\n      overflowScale = 0;\n      // In this case, we render a detail view that is exactly as big as the\n      // visible area, but we ignore the .maxCanvasPixels limit.\n      // TODO: We should probably instead give up and not render the detail view\n      // in this case. It's quite rare to hit it though, because usually\n      // .maxCanvasPixels will at least have enough pixels to cover the visible\n      // screen.\n    }\n\n    const overflowWidth = visibleWidth * overflowScale;\n    const overflowHeight = visibleHeight * overflowScale;\n\n    const minX = Math.max(0, visibleArea.minX - overflowWidth);\n    const maxX = Math.min(viewport.width, visibleArea.maxX + overflowWidth);\n    const minY = Math.max(0, visibleArea.minY - overflowHeight);\n    const maxY = Math.min(viewport.height, visibleArea.maxY + overflowHeight);\n    const width = maxX - minX;\n    const height = maxY - minY;\n\n    this.#detailArea = { minX, minY, width, height, scale: viewport.scale };\n\n    this.reset({ keepCanvas: true });\n  }\n\n  _getRenderingContext(canvas, transform) {\n    const baseContext = this.pageView._getRenderingContext(\n      canvas,\n      transform,\n      false\n    );\n    const recordedBBoxes = this.pdfPage.recordedBBoxes;\n\n    if (!recordedBBoxes || !this.enableOptimizedPartialRendering) {\n      return baseContext;\n    }\n\n    const {\n      viewport: { width: vWidth, height: vHeight },\n    } = this.pageView;\n    const {\n      width: aWidth,\n      height: aHeight,\n      minX: aMinX,\n      minY: aMinY,\n    } = this.#detailArea;\n\n    const detailMinX = aMinX / vWidth;\n    const detailMinY = aMinY / vHeight;\n    const detailMaxX = (aMinX + aWidth) / vWidth;\n    const detailMaxY = (aMinY + aHeight) / vHeight;\n\n    return {\n      ...baseContext,\n      operationsFilter(index) {\n        if (recordedBBoxes.isEmpty(index)) {\n          return false;\n        }\n        return (\n          recordedBBoxes.minX(index) <= detailMaxX &&\n          recordedBBoxes.maxX(index) >= detailMinX &&\n          recordedBBoxes.minY(index) <= detailMaxY &&\n          recordedBBoxes.maxY(index) >= detailMinY\n        );\n      },\n    };\n  }\n\n  async draw() {\n    // The PDFPageView might have already dropped this PDFPageDetailView. In\n    // that case, simply do nothing.\n    if (this.pageView.detailView !== this) {\n      return undefined;\n    }\n\n    // If there is already the lower resolution canvas behind,\n    // we don't show the new one until when it's fully ready.\n    const hideUntilComplete =\n      this.pageView.renderingState === RenderingStates.FINISHED ||\n      this.renderingState === RenderingStates.FINISHED;\n\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, viewport } = this.pageView;\n\n    if (!pdfPage) {\n      this.renderingState = RenderingStates.FINISHED;\n      throw new Error(\"pdfPage is not loaded\");\n    }\n\n    this.renderingState = RenderingStates.RUNNING;\n\n    const canvasWrapper = this.pageView._ensureCanvasWrapper();\n\n    const { canvas, prevCanvas } = this._createCanvas(newCanvas => {\n      // If there is already the background canvas, inject this new canvas\n      // after it. We cannot simply use .append because all canvases must\n      // be before the SVG elements used for drawings.\n      if (canvasWrapper.firstElementChild?.tagName === \"CANVAS\") {\n        canvasWrapper.firstElementChild.after(newCanvas);\n      } else {\n        canvasWrapper.prepend(newCanvas);\n      }\n    }, hideUntilComplete);\n    canvas.ariaHidden = true;\n    if (this.enableOptimizedPartialRendering) {\n      canvas.className = \"detailView\";\n    }\n\n    const { width, height } = viewport;\n\n    const area = this.#detailArea;\n\n    const { pixelRatio } = OutputScale;\n    const transform = [\n      pixelRatio,\n      0,\n      0,\n      pixelRatio,\n      -area.minX * pixelRatio,\n      -area.minY * pixelRatio,\n    ];\n\n    canvas.width = area.width * pixelRatio;\n    canvas.height = area.height * pixelRatio;\n    const { style } = canvas;\n    style.width = `${(area.width * 100) / width}%`;\n    style.height = `${(area.height * 100) / height}%`;\n    style.top = `${(area.minY * 100) / height}%`;\n    style.left = `${(area.minX * 100) / width}%`;\n\n    const renderingPromise = this._drawCanvas(\n      this._getRenderingContext(canvas, transform),\n      () => {\n        // If the rendering is cancelled, keep the old canvas visible.\n        this.canvas?.remove();\n        this.canvas = prevCanvas;\n      },\n      () => {\n        this.dispatchPageRendered(\n          /* cssTransform */ false,\n          /* isDetailView */ true\n        );\n      }\n    );\n\n    div.setAttribute(\"data-loaded\", true);\n\n    this.dispatchPageRender();\n\n    return renderingPromise;\n  }\n}\n\nexport { PDFPageDetailView };\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\nimport { FeatureTest, makeMap, shadow } from \"pdfjs-lib\";\nimport { removeNullCharacters } from \"./ui_utils.js\";\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: \"rowgroup\",\n  TBody: \"rowgroup\",\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 MathMLElements = new Set([\n  \"math\",\n  \"merror\",\n  \"mfrac\",\n  \"mi\",\n  \"mmultiscripts\",\n  \"mn\",\n  \"mo\",\n  \"mover\",\n  \"mpadded\",\n  \"mprescripts\",\n  \"mroot\",\n  \"mrow\",\n  \"ms\",\n  \"mspace\",\n  \"msqrt\",\n  \"mstyle\",\n  \"msub\",\n  \"msubsup\",\n  \"msup\",\n  \"mtable\",\n  \"mtd\",\n  \"mtext\",\n  \"mtr\",\n  \"munder\",\n  \"munderover\",\n  \"semantics\",\n]);\nconst MathMLNamespace = \"http://www.w3.org/1998/Math/MathML\";\n\nclass MathMLSanitizer {\n  static get sanitizer() {\n    // From https://w3c.github.io/mathml-docs/mathml-safe-list.\n\n    return shadow(\n      this,\n      \"sanitizer\",\n      FeatureTest.isSanitizerSupported\n        ? new Sanitizer({\n            elements: [...MathMLElements].map(name => ({\n              name,\n              namespace: MathMLNamespace,\n            })),\n            replaceWithChildrenElements: [\n              {\n                name: \"maction\",\n                namespace: MathMLNamespace,\n              },\n            ],\n            attributes: [\n              \"dir\",\n              \"displaystyle\",\n              \"mathbackground\",\n              \"mathcolor\",\n              \"mathsize\",\n              \"scriptlevel\",\n              \"encoding\",\n              \"display\",\n              \"linethickness\",\n              \"intent\",\n              \"arg\",\n              \"form\",\n              \"fence\",\n              \"separator\",\n              \"lspace\",\n              \"rspace\",\n              \"stretchy\",\n              \"symmetric\",\n              \"maxsize\",\n              \"minsize\",\n              \"largeop\",\n              \"movablelimits\",\n              \"width\",\n              \"height\",\n              \"depth\",\n              \"voffset\",\n              \"accent\",\n              \"accentunder\",\n              \"columnspan\",\n              \"rowspan\",\n            ],\n            comments: false,\n          })\n        : null\n    );\n  }\n}\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\n/**\n * @typedef {Object} StructTreeLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {Object} rawDims\n */\n\nclass StructTreeLayerBuilder {\n  #promise;\n\n  #treeDom = null;\n\n  #treePromise;\n\n  #elementAttributes = new Map();\n\n  #rawDims;\n\n  #elementsToAddToTextLayer = null;\n\n  #elementsToHideInTextLayer = null;\n\n  #elementsToStealFromTextLayer = null;\n\n  /**\n   * @param {StructTreeLayerBuilderOptions} options\n   */\n  constructor(pdfPage, rawDims) {\n    this.#promise = pdfPage.getStructTree();\n    this.#rawDims = rawDims;\n  }\n\n  /**\n   * @returns {Promise<void>}\n   */\n  async render() {\n    if (this.#treePromise) {\n      return this.#treePromise;\n    }\n    const { promise, resolve, reject } = Promise.withResolvers();\n    this.#treePromise = promise;\n\n    try {\n      this.#treeDom = this.#walk(await this.#promise);\n    } catch (ex) {\n      reject(ex);\n    }\n    this.#promise = null;\n\n    this.#treeDom?.classList.add(\"structTree\");\n    resolve(this.#treeDom);\n\n    return promise;\n  }\n\n  async getAriaAttributes(annotationId) {\n    try {\n      await this.render();\n      return this.#elementAttributes.get(annotationId);\n    } catch {\n      // If the structTree cannot be fetched, parsed, and/or rendered,\n      // ensure that e.g. the AnnotationLayer won't break completely.\n    }\n    return null;\n  }\n\n  hide() {\n    if (this.#treeDom && !this.#treeDom.hidden) {\n      this.#treeDom.hidden = true;\n    }\n  }\n\n  show() {\n    if (this.#treeDom?.hidden) {\n      this.#treeDom.hidden = false;\n    }\n  }\n\n  #setAttributes(structElement, htmlElement) {\n    const { alt, id, lang } = structElement;\n    if (alt !== undefined) {\n      // Don't add the label in the struct tree layer but on the annotation\n      // in the annotation layer.\n      let added = false;\n      const label = removeNullCharacters(alt);\n      for (const child of structElement.children) {\n        if (child.type === \"annotation\") {\n          this.#elementAttributes\n            .getOrInsertComputed(child.id, makeMap)\n            .set(\"aria-label\", label);\n          added = true;\n        }\n      }\n      if (!added) {\n        htmlElement.setAttribute(\"aria-label\", label);\n      }\n    }\n    if (id !== undefined) {\n      htmlElement.setAttribute(\"aria-owns\", id);\n    }\n    if (lang !== undefined) {\n      htmlElement.setAttribute(\n        \"lang\",\n        removeNullCharacters(lang, /* replaceInvisible = */ true)\n      );\n    }\n  }\n\n  #addImageInTextLayer(node, element) {\n    const { alt, bbox, children } = node;\n    const child = children?.[0];\n    if (!this.#rawDims || !alt || !bbox || child?.type !== \"content\") {\n      return false;\n    }\n\n    const { id } = child;\n    if (!id) {\n      return false;\n    }\n\n    // We cannot add the created element to the text layer immediately, as the\n    // text layer might not be ready yet. Instead, we store the element and add\n    // it later in `addElementsToTextLayer`.\n\n    element.setAttribute(\"aria-owns\", id);\n    const img = document.createElement(\"span\");\n    (this.#elementsToAddToTextLayer ||= new Map()).set(id, img);\n    img.setAttribute(\"role\", \"img\");\n    img.setAttribute(\"aria-label\", removeNullCharacters(alt));\n\n    const { pageHeight, pageX, pageY } = this.#rawDims;\n    const calc = \"calc(var(--total-scale-factor) *\";\n    const { style } = img;\n    style.width = `${calc}${bbox[2] - bbox[0]}px)`;\n    style.height = `${calc}${bbox[3] - bbox[1]}px)`;\n    style.left = `${calc}${bbox[0] - pageX}px)`;\n    style.top = `${calc}${pageHeight - bbox[3] + pageY}px)`;\n\n    return true;\n  }\n\n  updateTextLayer() {\n    if (this.#elementsToAddToTextLayer) {\n      for (const [id, img] of this.#elementsToAddToTextLayer) {\n        document.getElementById(id)?.append(img);\n      }\n      this.#elementsToAddToTextLayer.clear();\n      this.#elementsToAddToTextLayer = null;\n    }\n    if (this.#elementsToHideInTextLayer) {\n      for (const id of this.#elementsToHideInTextLayer) {\n        const elem = document.getElementById(id);\n        if (elem) {\n          elem.ariaHidden = true;\n        }\n      }\n      this.#elementsToHideInTextLayer.length = 0;\n      this.#elementsToHideInTextLayer = null;\n    }\n    if (this.#elementsToStealFromTextLayer) {\n      for (\n        let i = 0, ii = this.#elementsToStealFromTextLayer.length;\n        i < ii;\n        i += 2\n      ) {\n        const element = this.#elementsToStealFromTextLayer[i];\n        const ids = this.#elementsToStealFromTextLayer[i + 1];\n        let textContent = \"\";\n        for (const id of ids) {\n          const elem = document.getElementById(id);\n          if (elem) {\n            textContent += elem.textContent.trim() || \"\";\n            // Aria-hide the element in order to avoid duplicate reading of the\n            // math content by screen readers.\n            elem.ariaHidden = \"true\";\n          }\n        }\n        if (textContent) {\n          element.textContent = textContent;\n        }\n      }\n      this.#elementsToStealFromTextLayer.length = 0;\n      this.#elementsToStealFromTextLayer = null;\n    }\n  }\n\n  #collectIds(node, ids) {\n    if (!node) {\n      return;\n    }\n    if (\"id\" in node) {\n      ids.push(node.id);\n    }\n    for (const kid of node.children || []) {\n      this.#collectIds(kid, ids);\n    }\n  }\n\n  #walk(node, parentNodes = []) {\n    if (!node) {\n      return null;\n    }\n\n    let element;\n    let visitChildren = true;\n    if (\"role\" in node) {\n      const { role } = node;\n      if (MathMLElements.has(role)) {\n        element = document.createElementNS(MathMLNamespace, role);\n        const ids = [];\n        (this.#elementsToStealFromTextLayer ||= []).push(element, ids);\n        for (const { type, id } of node.children || []) {\n          if (type === \"content\" && id) {\n            ids.push(id);\n          }\n        }\n      } else {\n        element = document.createElement(\"span\");\n      }\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(\n          \"role\",\n          role === \"TH\" &&\n            parentNodes.at(-1)?.role === \"TR\" &&\n            parentNodes.at(-2)?.role === \"TBody\"\n            ? \"rowheader\" // TH inside TR itself in TBody is a rowheader.\n            : PDF_ROLE_TO_HTML_ROLE[role]\n        );\n      }\n      if (role === \"Figure\" && this.#addImageInTextLayer(node, element)) {\n        return element;\n      }\n      if (role === \"Formula\") {\n        if (node.mathML && MathMLSanitizer.sanitizer) {\n          visitChildren = false;\n          element.setHTML(node.mathML, {\n            sanitizer: MathMLSanitizer.sanitizer,\n          });\n          // Hide all the corresponding content elements in the text layer in\n          // order to avoid screen readers reading both the MathML and the\n          // text content.\n          this.#collectIds(node, (this.#elementsToHideInTextLayer ||= []));\n          // For now, we don't want to keep the alt text if there's valid\n          // MathML (see https://github.com/w3c/mathml-aam/issues/37).\n          // TODO: Revisit this decision in the future.\n          delete node.alt;\n        }\n        if (\n          !node.mathML &&\n          node.children.length === 1 &&\n          node.children[0].role !== \"math\"\n        ) {\n          element = document.createElementNS(MathMLNamespace, \"math\");\n          delete node.alt;\n        }\n      }\n    }\n\n    element ||= document.createElement(\"span\");\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 if (visitChildren) {\n        parentNodes.push(node);\n        for (const kid of node.children) {\n          element.append(this.#walk(kid, parentNodes));\n        }\n        parentNodes.pop();\n      }\n    }\n    return element;\n  }\n}\n\nexport { StructTreeLayerBuilder };\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   * @returns {string|null} The id in the struct tree if any.\n   */\n  addPointerInTextLayer(element, isRemovable) {\n    const { id } = element;\n    if (!id) {\n      return null;\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 null;\n    }\n\n    if (isRemovable) {\n      this.removePointerInTextLayer(element);\n    }\n\n    const children = this.#textChildren;\n    if (!children || children.length === 0) {\n      return null;\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    const child = children[nodeIndex];\n    this.#addIdToAriaOwns(id, child);\n    this.#textNodes.set(id, nodeIndex);\n\n    const parent = child.parentNode;\n    return parent?.classList.contains(\"markedContent\") ? parent.id : null;\n  }\n\n  /**\n   * Move a div in the DOM in order to respect the visual order.\n   * @param {HTMLDivElement} element\n   * @returns {string|null} The id in the struct tree if any.\n   */\n  moveElementInDOM(container, element, contentElement, isRemovable) {\n    const id = this.addPointerInTextLayer(contentElement, isRemovable);\n\n    if (!container.hasChildNodes()) {\n      container.append(element);\n      return id;\n    }\n\n    const children = Array.from(container.childNodes).filter(\n      node => node !== element\n    );\n\n    if (children.length === 0) {\n      return id;\n    }\n\n    const index = binarySearchFirstItem(\n      children,\n      node =>\n        TextAccessibilityManager.#compareElementPositions(element, node) < 0\n    );\n\n    if (index === 0) {\n      children[0].before(element);\n    } else {\n      children[index - 1].after(element);\n    }\n\n    return id;\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(\"./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  #eventAbortController = null;\n\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.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\n    if (!this.#eventAbortController) {\n      this.#eventAbortController = new AbortController();\n\n      this.eventBus._on(\n        \"updatetextlayermatches\",\n        evt => {\n          if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n            this._updateMatches();\n          }\n        },\n        { signal: this.#eventAbortController.signal }\n      );\n    }\n    this._updateMatches();\n  }\n\n  disable() {\n    if (!this.enabled) {\n      return;\n    }\n    this.enabled = false;\n\n    this.#eventAbortController?.abort();\n    this.#eventAbortController = null;\n\n    this._updateMatches(/* reset = */ true);\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\n        if (className.includes(\"selected\")) {\n          return span;\n        }\n        return null;\n      }\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    let lastDivIdx = -1;\n    let lastOffset = -1;\n    for (let i = i0; i < i1; i++) {\n      const match = matches[i];\n      const begin = match.begin;\n      if (begin.divIdx === lastDivIdx && begin.offset === lastOffset) {\n        // It's possible to be in this situation if we searched for a 'f' and we\n        // have a ligature 'ff' in the text. The 'ff' has to be highlighted two\n        // times.\n        continue;\n      }\n      lastDivIdx = begin.divIdx;\n      lastOffset = begin.offset;\n\n      const end = match.end;\n      const isSelected = isSelectedPage && i === selectedMatchIdx;\n      const highlightSuffix = isSelected ? \" selected\" : \"\";\n      let selectedSpan = null;\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        selectedSpan = appendTextToDiv(\n          begin.divIdx,\n          begin.offset,\n          end.offset,\n          \"highlight\" + highlightSuffix\n        );\n      } else {\n        selectedSpan = 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: selectedSpan,\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(reset = false) {\n    if (!this.enabled && !reset) {\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 || reset) {\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/** @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/text_layer_images.js\").TextLayerImages} TextLayerImages */\n/** @typedef {import(\"./text_highlighter\").TextHighlighter} TextHighlighter */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { normalizeUnicode, stopEvent, TextLayer } from \"pdfjs-lib\";\nimport { removeNullCharacters } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {TextHighlighter} [highlighter] - Optional object that will handle\n *   highlighting text from the find controller.\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {boolean} [enablePermissions]\n * @property {function} [onAppend]\n * @property {AbortSignal} [abortSignal]\n */\n\n/**\n * @typedef {Object} TextLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {TextLayerImages} images\n * @property {Object} [textContentParams]\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  #abortSignal = null;\n\n  #enablePermissions = false;\n\n  #onAppend = null;\n\n  #renderingDone = false;\n\n  #textLayer = null;\n\n  static #textLayers = new Map();\n\n  static #selectionChangeAbortController = null;\n\n  /**\n   * @param {TextLayerBuilderOptions} options\n   */\n  constructor({\n    pdfPage,\n    highlighter = null,\n    accessibilityManager = null,\n    enablePermissions = false,\n    onAppend = null,\n    abortSignal = null,\n  }) {\n    this.pdfPage = pdfPage;\n    this.highlighter = highlighter;\n    this.accessibilityManager = accessibilityManager;\n    this.#enablePermissions = enablePermissions === true;\n    this.#onAppend = onAppend;\n    this.#abortSignal = abortSignal;\n\n    this.div = document.createElement(\"div\");\n    this.div.tabIndex = 0;\n    this.div.className = \"textLayer\";\n  }\n\n  /**\n   * Renders the text layer.\n   * @param {TextLayerBuilderRenderOptions} options\n   * @returns {Promise<void>}\n   */\n  async render({ viewport, images, textContentParams = null }) {\n    if (this.#renderingDone && this.#textLayer) {\n      this.#textLayer.update({\n        viewport,\n        onBefore: this.hide.bind(this),\n      });\n      this.show();\n      return;\n    }\n\n    this.cancel();\n    this.#textLayer = new TextLayer({\n      textContentSource: this.pdfPage.streamTextContent(\n        textContentParams || {\n          includeMarkedContent: true,\n          disableNormalization: true,\n        }\n      ),\n      images,\n      container: this.div,\n      viewport,\n    });\n\n    const { textDivs, textContentItemsStr } = this.#textLayer;\n    this.highlighter?.setTextMapping(textDivs, textContentItemsStr);\n    this.accessibilityManager?.setTextMapping(textDivs);\n\n    await this.#textLayer.render();\n    this.#renderingDone = true;\n\n    const endOfContent = document.createElement(\"div\");\n    endOfContent.className = \"endOfContent\";\n    this.div.append(endOfContent);\n\n    this.#bindMouse(endOfContent);\n    // Ensure that the textLayer is appended to the DOM *before* handling\n    // e.g. a pending search operation.\n    this.#onAppend?.(this.div);\n    this.highlighter?.enable();\n    this.accessibilityManager?.enable();\n  }\n\n  hide() {\n    if (!this.div.hidden && this.#renderingDone) {\n      // We turn off the highlighter in order to avoid to scroll into view an\n      // element of the text layer which could be hidden.\n      this.highlighter?.disable();\n      this.div.hidden = true;\n    }\n  }\n\n  show() {\n    if (this.div.hidden && this.#renderingDone) {\n      this.div.hidden = false;\n      this.highlighter?.enable();\n    }\n  }\n\n  /**\n   * Cancel rendering of the text layer.\n   */\n  cancel() {\n    this.#textLayer?.cancel();\n    this.#textLayer = null;\n\n    this.highlighter?.disable();\n    this.accessibilityManager?.disable();\n    TextLayerBuilder.#removeGlobalSelectionListener(this.div);\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(end) {\n    const { div } = this;\n    const abortSignal = this.#abortSignal;\n    const opts = abortSignal ? { signal: abortSignal } : null;\n\n    div.addEventListener(\n      \"mousedown\",\n      () => {\n        div.classList.add(\"selecting\");\n      },\n      opts\n    );\n\n    div.addEventListener(\n      \"copy\",\n      event => {\n        if (!this.#enablePermissions) {\n          const selection = document.getSelection();\n          event.clipboardData.setData(\n            \"text/plain\",\n            removeNullCharacters(normalizeUnicode(selection.toString()))\n          );\n        }\n        stopEvent(event);\n      },\n      opts\n    );\n\n    TextLayerBuilder.#textLayers.set(div, end);\n    TextLayerBuilder.#enableGlobalSelectionListener(abortSignal);\n  }\n\n  static #removeGlobalSelectionListener(textLayerDiv) {\n    this.#textLayers.delete(textLayerDiv);\n\n    if (this.#textLayers.size === 0) {\n      this.#selectionChangeAbortController?.abort();\n      this.#selectionChangeAbortController = null;\n    }\n  }\n\n  static #enableGlobalSelectionListener(globalAbortSignal) {\n    if (this.#selectionChangeAbortController) {\n      // document-level event listeners already installed\n      return;\n    }\n    this.#selectionChangeAbortController = new AbortController();\n    const signal = globalAbortSignal\n      ? AbortSignal.any([\n          this.#selectionChangeAbortController.signal,\n          globalAbortSignal,\n        ])\n      : this.#selectionChangeAbortController.signal;\n\n    const reset = (end, textLayer) => {\n      if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n        textLayer.append(end);\n        end.style.width = \"\";\n        end.style.height = \"\";\n      }\n      textLayer.classList.remove(\"selecting\");\n    };\n\n    let isPointerDown = false;\n    document.addEventListener(\n      \"pointerdown\",\n      () => {\n        isPointerDown = true;\n      },\n      { signal }\n    );\n    document.addEventListener(\n      \"pointerup\",\n      () => {\n        isPointerDown = false;\n        this.#textLayers.forEach(reset);\n      },\n      { signal }\n    );\n    window.addEventListener(\n      \"blur\",\n      () => {\n        isPointerDown = false;\n        this.#textLayers.forEach(reset);\n      },\n      { signal }\n    );\n    document.addEventListener(\n      \"keyup\",\n      () => {\n        if (!isPointerDown) {\n          this.#textLayers.forEach(reset);\n        }\n      },\n      { signal }\n    );\n\n    if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n      // eslint-disable-next-line no-var\n      var isFirefox, prevRange;\n    }\n\n    document.addEventListener(\n      \"selectionchange\",\n      () => {\n        const selection = document.getSelection();\n        if (selection.rangeCount === 0) {\n          this.#textLayers.forEach(reset);\n          return;\n        }\n\n        // Even though the spec says that .rangeCount should be 0 or 1, Firefox\n        // creates multiple ranges when selecting across multiple pages.\n        // Make sure to collect all the .textLayer elements where the selection\n        // is happening.\n        const activeTextLayers = new Set();\n        for (let i = 0; i < selection.rangeCount; i++) {\n          const range = selection.getRangeAt(i);\n          for (const textLayerDiv of this.#textLayers.keys()) {\n            if (\n              !activeTextLayers.has(textLayerDiv) &&\n              range.intersectsNode(textLayerDiv)\n            ) {\n              activeTextLayers.add(textLayerDiv);\n            }\n          }\n        }\n\n        for (const [textLayerDiv, endDiv] of this.#textLayers) {\n          if (activeTextLayers.has(textLayerDiv)) {\n            textLayerDiv.classList.add(\"selecting\");\n          } else {\n            reset(endDiv, textLayerDiv);\n          }\n        }\n\n        if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n          return;\n        }\n        if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\")) {\n          isFirefox ??=\n            getComputedStyle(\n              this.#textLayers.values().next().value\n            ).getPropertyValue(\"-moz-user-select\") === \"none\";\n\n          if (isFirefox) {\n            return;\n          }\n        }\n        // In non-Firefox browsers, when hovering over an empty space (thus,\n        // on .endOfContent), the selection will expand to cover all the\n        // text between the current selection and .endOfContent. By moving\n        // .endOfContent to right after (or before, depending on which side\n        // of the selection the user is moving), we limit the selection jump\n        // to at most cover the enteirety of the <span> where the selection\n        // is being modified.\n        const range = selection.getRangeAt(0);\n        const modifyStart =\n          prevRange &&\n          (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 ||\n            range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);\n        let anchor = modifyStart ? range.startContainer : range.endContainer;\n        if (anchor.nodeType === Node.TEXT_NODE) {\n          anchor = anchor.parentNode;\n        }\n        if (anchor.classList?.contains(\"highlight\")) {\n          anchor = anchor.parentNode;\n        }\n        if (!modifyStart && range.endOffset === 0) {\n          do {\n            while (!anchor.previousSibling) {\n              anchor = anchor.parentNode;\n            }\n            anchor = anchor.previousSibling;\n          } while (!anchor.childNodes.length);\n        }\n\n        const parentTextLayer = anchor.parentElement?.closest(\".textLayer\");\n        const endDiv = this.#textLayers.get(parentTextLayer);\n        if (endDiv) {\n          endDiv.style.width = parentTextLayer.style.width;\n          endDiv.style.height = parentTextLayer.style.height;\n          endDiv.style.userSelect = \"text\";\n          anchor.parentElement.insertBefore(\n            endDiv,\n            modifyStart ? anchor : anchor.nextSibling\n          );\n        }\n\n        prevRange = range.cloneRange();\n      },\n      { signal }\n    );\n  }\n}\n\nexport { TextLayerBuilder };\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// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n/** @typedef {import(\"./comment_manager.js\").CommentManager} CommentManager */\n/** @typedef {import(\"./l10n.js\").L10n} L10n */\n\nimport {\n  AbortException,\n  AnnotationMode,\n  OutputScale,\n  PixelsPerInch,\n  setLayerDimensions,\n  shadow,\n  TextLayerImages,\n} from \"pdfjs-lib\";\nimport {\n  approximateFraction,\n  calcRound,\n  DEFAULT_SCALE,\n  floorToDivide,\n  TextLayerMode,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorLayerBuilder } from \"./annotation_editor_layer_builder.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { AppOptions } from \"./app_options.js\";\nimport { Autolinker } from \"./autolinker.js\";\nimport { BasePDFPageView } from \"./base_pdf_page_view.js\";\nimport { DrawLayerBuilder } from \"./draw_layer_builder.js\";\nimport { GenericL10n } from \"web-null_l10n\";\nimport { PDFPageDetailView } from \"./pdf_page_detail_view.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\nimport { StructTreeLayerBuilder } from \"./struct_tree_layer_builder.js\";\nimport { TextAccessibilityManager } from \"./text_accessibility.js\";\nimport { TextHighlighter } from \"./text_highlighter.js\";\nimport { TextLayerBuilder } from \"./text_layer_builder.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.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 {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 {string} [imageResourcesPath] - Path for image resources, mainly\n *   for annotation icons. Include trailing slash.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n *   total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n *   CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n *   in either width or height. Use `-1` for no limit.\n *   The default value is 32767.\n * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the\n *   viewport increased by the value in percent. Use `-1` for no limit.\n *   The default value is 200%.\n * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered\n *   pages would need a canvas that is larger than `maxCanvasPixels` or\n *   `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,\n *   that only renders the part of the page that is close to the viewport.\n *   The default value is `true`.\n * @property {number} [imagesRightClickMinSize] - All images whose width and\n *  height are at least this value (in pixels) will be lazily inserted in the\n *  dom to allow right-clicking and saving them. Use `-1` to disable this.\n * @property {boolean} [enableOptimizedPartialRendering] - When enabled, PDF\n *   rendering will keep track of which areas of the page each PDF operation\n *   affects. Then, when rendering a partial page (if `enableDetailCanvas` is\n *   enabled), it will only run through the operations that affect that portion.\n *   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 * @property {L10n} [l10n] - Localization service.\n * @property {Object} [layerProperties] - The object that is used to lookup\n *   the necessary layer-properties.\n * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from\n *   text that look like URLs. The default value is `true`.\n * @property {CommentManager} [commentManager] - The comment manager instance.\n *   to.\n * @property {AbortSignal} [abortSignal]\n */\n\nconst DEFAULT_LAYER_PROPERTIES =\n  typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"COMPONENTS\")\n    ? null\n    : {\n        annotationEditorUIManager: null,\n        annotationStorage: null,\n        downloadManager: null,\n        enableScripting: false,\n        fieldObjectsPromise: null,\n        findController: null,\n        hasJSActionsPromise: null,\n        get linkService() {\n          return new SimpleLinkService();\n        },\n      };\n\nconst LAYERS_ORDER = new Map([\n  [\"canvasWrapper\", 0],\n  [\"textLayer\", 1],\n  [\"annotationLayer\", 2],\n  [\"annotationEditorLayer\", 3],\n  [\"xfaLayer\", 3],\n]);\n\nclass PDFPageView extends BasePDFPageView {\n  #abortSignal = null;\n\n  #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n  #canvasWrapper = null;\n\n  #commentManager = null;\n\n  #enableAutoLinking = true;\n\n  #hasRestrictedScaling = false;\n\n  #isEditing = false;\n\n  #layerProperties = null;\n\n  #needsRestrictedScaling = false;\n\n  #originalViewport = null;\n\n  #previousRotation = null;\n\n  #scaleRoundX = 1;\n\n  #scaleRoundY = 1;\n\n  #textLayerMode = TextLayerMode.ENABLE;\n\n  #userUnit = 1;\n\n  #useThumbnailCanvas = {\n    directDrawing: true,\n    initialOptionalContent: true,\n    regularAnnotations: true,\n  };\n\n  #layers = [null, null, null, null];\n\n  /**\n   * @param {PDFPageViewOptions} options\n   */\n  constructor(options) {\n    super(options);\n\n    const { container, defaultViewport } = options;\n\n    this.renderingId = \"page\" + this.id;\n    this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES;\n    this.#abortSignal = options.abortSignal || null;\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.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n    this.#annotationMode =\n      options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n    this.imageResourcesPath = options.imageResourcesPath || \"\";\n    this.enableDetailCanvas = options.enableDetailCanvas ?? true;\n    this.maxCanvasPixels =\n      options.maxCanvasPixels ?? AppOptions.get(\"maxCanvasPixels\");\n    this.maxCanvasDim = options.maxCanvasDim || AppOptions.get(\"maxCanvasDim\");\n    this.capCanvasAreaFactor =\n      options.capCanvasAreaFactor ?? AppOptions.get(\"capCanvasAreaFactor\");\n    this.#enableAutoLinking = options.enableAutoLinking !== false;\n    this.#commentManager = options.commentManager || null;\n\n    this.l10n = options.l10n;\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      this.l10n ||= new GenericL10n();\n    }\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      this._isStandalone = !this.renderingQueue?.hasViewer();\n      this._container = container;\n    }\n\n    this._annotationCanvasMap = null;\n\n    this.annotationLayer = null;\n    this.annotationEditorLayer = null;\n    this.textLayer = null;\n    this.xfaLayer = null;\n    this.structTreeLayer = null;\n    this.drawLayer = null;\n\n    this.detailView = null;\n\n    const div = document.createElement(\"div\");\n    div.className = \"page\";\n    div.setAttribute(\"data-page-number\", this.id);\n    div.setAttribute(\"role\", \"region\");\n    div.setAttribute(\"data-l10n-id\", \"pdfjs-page-landmark\");\n    div.setAttribute(\"data-l10n-args\", JSON.stringify({ page: this.id }));\n    this.div = div;\n    this.#setDimensions();\n    container?.append(div);\n\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      this._isStandalone\n    ) {\n      // Ensure that the various layers always get the correct initial size,\n      // see issue 15795.\n      container?.style.setProperty(\n        \"--scale-factor\",\n        this.scale * PixelsPerInch.PDF_TO_CSS_UNITS\n      );\n\n      if (this.pageColors?.background) {\n        container?.style.setProperty(\n          \"--page-bg-color\",\n          this.pageColors.background\n        );\n      }\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      // Ensure that Fluent is connected in e.g. the COMPONENTS build.\n      if (!options.l10n) {\n        this.l10n.translate(this.div);\n      }\n    }\n  }\n\n  clone(id) {\n    const clone = new PDFPageView({\n      container: null,\n      eventBus: this.eventBus,\n      pagesColors: this.pageColors,\n      renderingQueue: this.renderingQueue,\n      enableOptimizedPartialRendering: this.enableOptimizedPartialRendering,\n      minDurationToUpdateCanvas: this.minDurationToUpdateCanvas,\n      defaultViewport: this.viewport,\n      id,\n      layerProperties: this.#layerProperties,\n      abortSignal: this.#abortSignal,\n      scale: this.scale,\n      optionalContentConfigPromise: this._optionalContentConfigPromise,\n      textLayerMode: this.#textLayerMode,\n      annotationMode: this.#annotationMode,\n      imageResourcesPath: this.imageResourcesPath,\n      enableDetailCanvas: this.enableDetailCanvas,\n      maxCanvasPixels: this.maxCanvasPixels,\n      maxCanvasDim: this.maxCanvasDim,\n      capCanvasAreaFactor: this.capCanvasAreaFactor,\n      enableAutoLinking: this.#enableAutoLinking,\n      commentManager: this.#commentManager,\n      l10n: this.l10n,\n    });\n    clone.setPdfPage(this.pdfPage.clone(id - 1));\n    return clone;\n  }\n\n  #addLayer(div, name) {\n    const pos = LAYERS_ORDER.get(name);\n    const oldDiv = this.#layers[pos];\n    this.#layers[pos] = div;\n    if (oldDiv) {\n      oldDiv.replaceWith(div);\n      return;\n    }\n    for (let i = pos - 1; i >= 0; i--) {\n      const layer = this.#layers[i];\n      if (layer) {\n        layer.after(div);\n        return;\n      }\n    }\n    this.div.prepend(div);\n  }\n\n  #setDimensions() {\n    const { div, viewport } = this;\n\n    if (viewport.userUnit !== this.#userUnit) {\n      if (viewport.userUnit !== 1) {\n        div.style.setProperty(\"--user-unit\", viewport.userUnit);\n      } else {\n        div.style.removeProperty(\"--user-unit\");\n      }\n      this.#userUnit = viewport.userUnit;\n    }\n    if (this.pdfPage) {\n      if (this.#previousRotation === viewport.rotation) {\n        return;\n      }\n      this.#previousRotation = viewport.rotation;\n    }\n\n    setLayerDimensions(\n      div,\n      viewport,\n      /* mustFlip = */ true,\n      /* mustRotate = */ false\n    );\n  }\n\n  updatePageNumber(newPageNumber) {\n    if (this.id === newPageNumber) {\n      return;\n    }\n    const oldPageNumber = this.id;\n    this.id = newPageNumber;\n    this.renderingId = `page${newPageNumber}`;\n    if (this.pdfPage) {\n      this.pdfPage.pageNumber = newPageNumber;\n    }\n    // TODO: do we set the page label ?\n    this.setPageLabel(this.pageLabel);\n    const { div } = this;\n    div.setAttribute(\"data-page-number\", newPageNumber);\n    div.setAttribute(\"data-l10n-args\", JSON.stringify({ page: newPageNumber }));\n    this._textHighlighter.pageIdx = newPageNumber - 1;\n    // Don't update the page index for the draw layer, since it's just used as\n    // an identifier.\n\n    this.#layerProperties.annotationEditorUIManager?.updatePageIndex(\n      oldPageNumber - 1,\n      newPageNumber - 1\n    );\n  }\n\n  setPdfPage(pdfPage) {\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      this._isStandalone &&\n      (this.pageColors?.foreground === \"CanvasText\" ||\n        this.pageColors?.background === \"Canvas\")\n    ) {\n      this._container?.style.setProperty(\n        \"--hcm-highlight-filter\",\n        pdfPage.filterFactory.addHighlightHCMFilter(\n          \"highlight\",\n          \"CanvasText\",\n          \"Canvas\",\n          \"HighlightText\",\n          \"Highlight\"\n        )\n      );\n      this._container?.style.setProperty(\n        \"--hcm-highlight-selected-filter\",\n        pdfPage.filterFactory.addHighlightHCMFilter(\n          \"highlight_selected\",\n          \"CanvasText\",\n          \"Canvas\",\n          \"HighlightText\",\n          \"Highlight\"\n        )\n      );\n    }\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.#setDimensions();\n    this.reset();\n  }\n\n  destroy() {\n    this.reset();\n    this.pdfPage?.cleanup();\n  }\n\n  deleteMe(isCut) {\n    if (isCut) {\n      this.div.remove();\n      return;\n    }\n    this.destroy();\n    this.#layerProperties.annotationEditorUIManager?.deletePage(this.id);\n  }\n\n  hasEditableAnnotations() {\n    return !!this.annotationLayer?.hasEditableAnnotations();\n  }\n\n  get _textHighlighter() {\n    return shadow(\n      this,\n      \"_textHighlighter\",\n      new TextHighlighter({\n        pageIndex: this.id - 1,\n        eventBus: this.eventBus,\n        findController: this.#layerProperties.findController,\n      })\n    );\n  }\n\n  #dispatchLayerRendered(name, error) {\n    this.eventBus.dispatch(name, {\n      source: this,\n      pageNumber: this.id,\n      error,\n    });\n  }\n\n  async #renderAnnotationLayer() {\n    let error = null;\n    try {\n      await this.annotationLayer.render({\n        viewport: this.viewport,\n        intent: \"display\",\n        structTreeLayer: this.structTreeLayer,\n      });\n    } catch (ex) {\n      console.error(\"#renderAnnotationLayer:\", ex);\n      error = ex;\n    } finally {\n      this.#dispatchLayerRendered(\"annotationlayerrendered\", error);\n    }\n  }\n\n  async #renderAnnotationEditorLayer() {\n    let error = null;\n    try {\n      await this.annotationEditorLayer.render({\n        viewport: this.viewport,\n        intent: \"display\",\n      });\n    } catch (ex) {\n      console.error(\"#renderAnnotationEditorLayer:\", ex);\n      error = ex;\n    } finally {\n      this.#dispatchLayerRendered(\"annotationeditorlayerrendered\", error);\n    }\n  }\n\n  async #renderDrawLayer() {\n    try {\n      await this.drawLayer.render({\n        intent: \"display\",\n      });\n    } catch (ex) {\n      console.error(\"#renderDrawLayer:\", ex);\n    }\n  }\n\n  async #renderXfaLayer() {\n    let error = null;\n    try {\n      const result = await this.xfaLayer.render({\n        viewport: this.viewport,\n        intent: \"display\",\n      });\n      if (result?.textDivs && this._textHighlighter) {\n        // Given that the following method fetches the text asynchronously we\n        // can invoke it *before* appending the xfaLayer to the DOM (below),\n        // since a pending search-highlight/scroll operation thus won't run\n        // until after the xfaLayer is available in the viewer.\n        this.#buildXfaTextContentItems(result.textDivs);\n      }\n    } catch (ex) {\n      console.error(\"#renderXfaLayer:\", ex);\n      error = ex;\n    } finally {\n      if (this.xfaLayer?.div) {\n        // Pause translation when inserting the xfaLayer in the DOM.\n        this.l10n.pause();\n        this.#addLayer(this.xfaLayer.div, \"xfaLayer\");\n        this.l10n.resume();\n      }\n      this.#dispatchLayerRendered(\"xfalayerrendered\", error);\n    }\n  }\n\n  async #renderTextLayer() {\n    if (!this.textLayer) {\n      return;\n    }\n    let error = null;\n    try {\n      await this.textLayer.render({\n        viewport: this.viewport,\n        images: this.imageCoordinates\n          ? new TextLayerImages(\n              this.imagesRightClickMinSize,\n              this.imageCoordinates,\n              this.viewport,\n              () => this.canvas\n            )\n          : null,\n      });\n    } catch (ex) {\n      if (ex instanceof AbortException) {\n        return;\n      }\n      console.error(\"#renderTextLayer:\", ex);\n      error = ex;\n    }\n    this.#dispatchLayerRendered(\"textlayerrendered\", error);\n\n    this.#renderStructTreeLayer();\n  }\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   *\n   * The structure tree must be generated after the text layer for the\n   * aria-owns to work.\n   */\n  async #renderStructTreeLayer() {\n    if (!this.textLayer) {\n      return;\n    }\n\n    const treeDom = await this.structTreeLayer?.render();\n    if (treeDom) {\n      this.l10n.pause();\n      this.structTreeLayer?.updateTextLayer();\n      if (this.canvas && treeDom.parentNode !== this.canvas) {\n        // Pause translation when inserting the structTree in the DOM.\n        this.canvas.append(treeDom);\n      }\n      this.l10n.resume();\n    }\n    this.structTreeLayer?.show();\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  async #injectLinkAnnotations(textLayerPromise) {\n    let error = null;\n    try {\n      await textLayerPromise;\n\n      if (!this.annotationLayer) {\n        return; // Rendering was cancelled while the textLayerPromise resolved.\n      }\n      await this.annotationLayer.injectLinkAnnotations(\n        Autolinker.processLinks(this)\n      );\n    } catch (ex) {\n      console.error(\"#injectLinkAnnotations:\", ex);\n      error = ex;\n    }\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n      this.#dispatchLayerRendered(\"linkannotationsadded\", error);\n    }\n  }\n\n  _resetCanvas() {\n    super._resetCanvas();\n    this.#originalViewport = null;\n  }\n\n  reset({\n    keepAnnotationLayer = false,\n    keepAnnotationEditorLayer = false,\n    keepXfaLayer = false,\n    keepTextLayer = false,\n    keepCanvasWrapper = false,\n    preserveDetailViewState = false,\n  } = {}) {\n    const keepPdfBugGroups = this.pdfPage?._pdfBug ?? false;\n\n    this.cancelRendering({\n      keepAnnotationLayer,\n      keepAnnotationEditorLayer,\n      keepXfaLayer,\n      keepTextLayer,\n    });\n    this.renderingState = RenderingStates.INITIAL;\n\n    const div = this.div;\n\n    const childNodes = div.childNodes,\n      annotationLayerNode =\n        (keepAnnotationLayer && this.annotationLayer?.div) || null,\n      annotationEditorLayerNode =\n        (keepAnnotationEditorLayer && this.annotationEditorLayer?.div) || null,\n      xfaLayerNode = (keepXfaLayer && this.xfaLayer?.div) || null,\n      textLayerNode = (keepTextLayer && this.textLayer?.div) || null,\n      canvasWrapperNode = (keepCanvasWrapper && this.#canvasWrapper) || null;\n    for (let i = childNodes.length - 1; i >= 0; i--) {\n      const node = childNodes[i];\n      switch (node) {\n        case annotationLayerNode:\n        case annotationEditorLayerNode:\n        case xfaLayerNode:\n        case textLayerNode:\n        case canvasWrapperNode:\n          continue;\n      }\n      if (keepPdfBugGroups && node.classList.contains(\"pdfBugGroupsLayer\")) {\n        continue;\n      }\n      node.remove();\n      const layerIndex = this.#layers.indexOf(node);\n      if (layerIndex >= 0) {\n        this.#layers[layerIndex] = null;\n      }\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    if (annotationEditorLayerNode) {\n      this.annotationEditorLayer.hide();\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    if (textLayerNode) {\n      this.textLayer.hide();\n    }\n    this.structTreeLayer?.hide();\n\n    if (!keepCanvasWrapper && this.#canvasWrapper) {\n      this.#canvasWrapper = null;\n      this._resetCanvas();\n    }\n\n    if (!preserveDetailViewState) {\n      this.detailView?.reset({ keepCanvas: keepCanvasWrapper });\n\n      // If we are keeping the canvas around we must also keep the `detailView`\n      // object, so that next time we need a detail view we'll update the\n      // existing canvas rather than creating a new one.\n      if (!keepCanvasWrapper) {\n        this.detailView = null;\n      }\n    }\n  }\n\n  toggleEditingMode(isEditing) {\n    // The page can be invisible, consequently there's no annotation layer and\n    // we can't know if there are editable annotations.\n    // So to avoid any issue when the page is rendered the #isEditing flag must\n    // be set.\n    this.#isEditing = isEditing;\n    if (!this.hasEditableAnnotations()) {\n      return;\n    }\n    this.reset({\n      keepAnnotationLayer: true,\n      keepAnnotationEditorLayer: true,\n      keepXfaLayer: true,\n      keepTextLayer: true,\n      keepCanvasWrapper: true,\n    });\n  }\n\n  updateVisibleArea(visibleArea) {\n    if (this.enableDetailCanvas) {\n      if (\n        this.#needsRestrictedScaling &&\n        this.maxCanvasPixels > 0 &&\n        visibleArea\n      ) {\n        this.detailView ??= new PDFPageDetailView({\n          pageView: this,\n          enableOptimizedPartialRendering: this.enableOptimizedPartialRendering,\n          imagesRightClickMinSize: -1,\n        });\n        this.detailView.update({ visibleArea });\n      } else if (this.detailView) {\n        this.detailView.reset();\n        this.detailView = null;\n      }\n    }\n  }\n\n  /**\n   * @typedef {Object} PDFPageViewUpdateParameters\n   * @property {number} [scale] The new scale, if specified.\n   * @property {number} [rotation] The new rotation, if specified.\n   * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise]\n   *   A promise that is resolved with an {@link OptionalContentConfig}\n   *   instance. The default value is `null`.\n   * @property {number} [drawingDelay]\n   */\n\n  /**\n   * Update e.g. the scale and/or rotation of the page.\n   * @param {PDFPageViewUpdateParameters} params\n   */\n  update({\n    scale = 0,\n    rotation = null,\n    optionalContentConfigPromise = null,\n    drawingDelay = -1,\n  }) {\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    this.#useThumbnailCanvas.directDrawing = true;\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    this.#setDimensions();\n\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      this._isStandalone\n    ) {\n      this._container?.style.setProperty(\"--scale-factor\", this.viewport.scale);\n    }\n\n    this.#computeScale();\n\n    if (this.canvas) {\n      const onlyCssZoom =\n        this.#hasRestrictedScaling && this.#needsRestrictedScaling;\n      const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n\n      if (postponeDrawing || onlyCssZoom) {\n        if (\n          postponeDrawing &&\n          !onlyCssZoom &&\n          this.renderingState !== RenderingStates.FINISHED\n        ) {\n          this.cancelRendering({\n            keepAnnotationLayer: true,\n            keepAnnotationEditorLayer: true,\n            keepXfaLayer: true,\n            keepTextLayer: true,\n            cancelExtraDelay: drawingDelay,\n          });\n          // It isn't really finished, but once we have finished\n          // to postpone, we'll call this.reset(...) which will set\n          // the rendering state to INITIAL, hence the next call to\n          // PDFViewer.update() will trigger a redraw (if it's mandatory).\n          this.renderingState = RenderingStates.FINISHED;\n          // Ensure that the thumbnails won't become partially (or fully) blank,\n          // if the sidebar is opened before the actual rendering is done.\n          this.#useThumbnailCanvas.directDrawing = false;\n        }\n\n        this.cssTransform({\n          redrawAnnotationLayer: true,\n          redrawAnnotationEditorLayer: true,\n          redrawXfaLayer: true,\n          redrawTextLayer: !postponeDrawing,\n          hideTextLayer: postponeDrawing,\n        });\n\n        // The \"pagerendered\"-event will be dispatched once the actual\n        // rendering is done, hence don't dispatch it here as well.\n        if (!postponeDrawing) {\n          this.detailView?.update({ underlyingViewUpdated: true });\n\n          this.dispatchPageRendered(\n            /* cssTransform */ true,\n            /* isDetailView */ false\n          );\n        }\n        return;\n      }\n    }\n    this.cssTransform({});\n    this.reset({\n      keepAnnotationLayer: true,\n      keepAnnotationEditorLayer: true,\n      keepXfaLayer: true,\n      keepTextLayer: true,\n      keepCanvasWrapper: true,\n      // It will be reset by the .update call below\n      preserveDetailViewState: true,\n    });\n\n    this.detailView?.update({ underlyingViewUpdated: true });\n  }\n\n  #computeScale() {\n    const { width, height } = this.viewport;\n    const outputScale = (this.outputScale = new OutputScale());\n\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      this.maxCanvasPixels === 0\n    ) {\n      const invScale = 1 / this.scale;\n      // Use a scale that makes the canvas have the originally intended size\n      // of the page.\n      outputScale.sx *= invScale;\n      outputScale.sy *= invScale;\n      this.#needsRestrictedScaling = true;\n    } else {\n      this.#needsRestrictedScaling = outputScale.limitCanvas(\n        width,\n        height,\n        this.maxCanvasPixels,\n        this.maxCanvasDim,\n        this.capCanvasAreaFactor\n      );\n      if (this.#needsRestrictedScaling && this.enableDetailCanvas) {\n        // If we are going to have a high-res detail view, further reduce\n        // the canvas resolution to improve rendering performance.\n        // When enableOptimizedPartialRendering is enabled the factor can be\n        // higher since less data will be rendered and it's more acceptable to\n        // have a lower quality (the canvas is exposed less time to the user).\n        const factor = this.enableOptimizedPartialRendering ? 4 : 2;\n        outputScale.sx /= factor;\n        outputScale.sy /= factor;\n      }\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    keepTextLayer = false,\n    cancelExtraDelay = 0,\n  } = {}) {\n    super.cancelRendering({ cancelExtraDelay });\n\n    if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {\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 (this.structTreeLayer && !this.textLayer) {\n      this.structTreeLayer = null;\n    }\n    if (\n      this.annotationEditorLayer &&\n      (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)\n    ) {\n      if (this.drawLayer) {\n        this.drawLayer.cancel();\n        this.drawLayer = null;\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  }\n\n  cssTransform({\n    redrawAnnotationLayer = false,\n    redrawAnnotationEditorLayer = false,\n    redrawXfaLayer = false,\n    redrawTextLayer = false,\n    hideTextLayer = false,\n  }) {\n    const { canvas } = this;\n    if (!canvas) {\n      return;\n    }\n\n    const originalViewport = this.#originalViewport;\n    if (this.viewport !== originalViewport) {\n      // The canvas may have been originally rotated; rotate relative to that.\n      const relativeRotation =\n        (360 + this.viewport.rotation - originalViewport.rotation) % 360;\n      if (relativeRotation === 90 || relativeRotation === 270) {\n        const { width, height } = this.viewport;\n        // Scale x and y because of the rotation.\n        const scaleX = height / width;\n        const scaleY = width / height;\n        canvas.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX},${scaleY})`;\n      } else {\n        canvas.style.transform =\n          relativeRotation === 0 ? \"\" : `rotate(${relativeRotation}deg)`;\n      }\n    }\n\n    if (redrawAnnotationLayer && this.annotationLayer) {\n      this.#renderAnnotationLayer();\n    }\n    if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {\n      if (this.drawLayer) {\n        this.#renderDrawLayer();\n      }\n      this.#renderAnnotationEditorLayer();\n    }\n    if (redrawXfaLayer && this.xfaLayer) {\n      this.#renderXfaLayer();\n    }\n\n    if (this.textLayer) {\n      if (hideTextLayer) {\n        this.textLayer.hide();\n        this.structTreeLayer?.hide();\n      } else if (redrawTextLayer) {\n        this.#renderTextLayer();\n      }\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  // Wrap the canvas so that if it has a CSS transform for high DPI the\n  // overflow will be hidden in Firefox.\n  _ensureCanvasWrapper() {\n    let canvasWrapper = this.#canvasWrapper;\n    if (!canvasWrapper) {\n      canvasWrapper = this.#canvasWrapper = document.createElement(\"div\");\n      canvasWrapper.classList.add(\"canvasWrapper\");\n      this.#addLayer(canvasWrapper, \"canvasWrapper\");\n    }\n    return canvasWrapper;\n  }\n\n  _getRenderingContext(canvas, transform, recordOperations, recordImages) {\n    return {\n      canvas,\n      transform,\n      viewport: this.viewport,\n      annotationMode: this.#annotationMode,\n      optionalContentConfigPromise: this._optionalContentConfigPromise,\n      annotationCanvasMap: this._annotationCanvasMap,\n      pageColors: this.pageColors,\n      isEditing: this.#isEditing,\n      recordOperations,\n      recordImages,\n    };\n  }\n\n  async 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, l10n, pdfPage, viewport } = this;\n\n    if (!pdfPage) {\n      this.renderingState = RenderingStates.FINISHED;\n      throw new Error(\"pdfPage is not loaded\");\n    }\n\n    this.renderingState = RenderingStates.RUNNING;\n\n    const canvasWrapper = this._ensureCanvasWrapper();\n\n    if (\n      !this.textLayer &&\n      this.#textLayerMode !== TextLayerMode.DISABLE &&\n      !pdfPage.isPureXfa\n    ) {\n      this._accessibilityManager ||= new TextAccessibilityManager();\n\n      this.textLayer = new TextLayerBuilder({\n        pdfPage,\n        highlighter: this._textHighlighter,\n        accessibilityManager: this._accessibilityManager,\n        enablePermissions:\n          this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,\n        onAppend: textLayerDiv => {\n          // Pause translation when inserting the textLayer in the DOM.\n          this.l10n.pause();\n          this.#addLayer(textLayerDiv, \"textLayer\");\n          this.l10n.resume();\n        },\n        abortSignal: this.#abortSignal,\n      });\n    }\n\n    if (\n      !this.annotationLayer &&\n      this.#annotationMode !== AnnotationMode.DISABLE\n    ) {\n      const {\n        annotationStorage,\n        annotationEditorUIManager,\n        downloadManager,\n        enableComment,\n        enableScripting,\n        fieldObjectsPromise,\n        hasJSActionsPromise,\n        linkService,\n      } = this.#layerProperties;\n\n      this._annotationCanvasMap ||= new Map();\n      this.annotationLayer = new AnnotationLayerBuilder({\n        pdfPage,\n        annotationStorage,\n        imageResourcesPath: this.imageResourcesPath,\n        renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS,\n        linkService,\n        downloadManager,\n        enableComment,\n        enableScripting,\n        hasJSActionsPromise,\n        fieldObjectsPromise,\n        annotationCanvasMap: this._annotationCanvasMap,\n        accessibilityManager: this._accessibilityManager,\n        annotationEditorUIManager,\n        commentManager: this.#commentManager,\n        onAppend: annotationLayerDiv => {\n          this.#addLayer(annotationLayerDiv, \"annotationLayer\");\n        },\n      });\n    }\n\n    const { width, height } = viewport;\n    this.#originalViewport = viewport;\n\n    const { canvas, prevCanvas } = this._createCanvas(newCanvas => {\n      // Always inject the canvas as the first element in the wrapper.\n      canvasWrapper.prepend(newCanvas);\n    });\n    canvas.setAttribute(\"role\", \"presentation\");\n\n    if (!this.outputScale) {\n      this.#computeScale();\n    }\n    const { outputScale } = this;\n    this.#hasRestrictedScaling = this.#needsRestrictedScaling;\n\n    const sfx = approximateFraction(outputScale.sx);\n    const sfy = approximateFraction(outputScale.sy);\n\n    const canvasWidth = (canvas.width = floorToDivide(\n      calcRound(width * outputScale.sx),\n      sfx[0]\n    ));\n    const canvasHeight = (canvas.height = floorToDivide(\n      calcRound(height * outputScale.sy),\n      sfy[0]\n    ));\n    const pageWidth = floorToDivide(calcRound(width), sfx[1]);\n    const pageHeight = floorToDivide(calcRound(height), sfy[1]);\n    outputScale.sx = canvasWidth / pageWidth;\n    outputScale.sy = canvasHeight / pageHeight;\n\n    if (this.#scaleRoundX !== sfx[1]) {\n      div.style.setProperty(\"--scale-round-x\", `${sfx[1]}px`);\n      this.#scaleRoundX = sfx[1];\n    }\n    if (this.#scaleRoundY !== sfy[1]) {\n      div.style.setProperty(\"--scale-round-y\", `${sfy[1]}px`);\n      this.#scaleRoundY = sfy[1];\n    }\n\n    const recordBBoxes =\n      this.enableOptimizedPartialRendering &&\n      this.#hasRestrictedScaling &&\n      !this.recordedBBoxes;\n\n    const recordImages =\n      this.imagesRightClickMinSize !== -1 && !this.imageCoordinates;\n\n    // Rendering area\n    const transform = outputScale.scaled\n      ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n      : null;\n    const resultPromise = this._drawCanvas(\n      this._getRenderingContext(canvas, transform, recordBBoxes, recordImages),\n      () => {\n        prevCanvas?.remove();\n        this._resetCanvas();\n      },\n      renderTask => {\n        // Ensure that the thumbnails won't become partially (or fully) blank,\n        // for documents that contain interactive form elements.\n        this.#useThumbnailCanvas.regularAnnotations =\n          !renderTask.separateAnnots;\n\n        this.dispatchPageRendered(\n          /* cssTransform */ false,\n          /* isDetailView */ false\n        );\n      }\n    ).then(async () => {\n      if (this.renderingState !== RenderingStates.FINISHED) {\n        // The rendering has been cancelled.\n        return;\n      }\n      this.structTreeLayer ||= new StructTreeLayerBuilder(\n        pdfPage,\n        viewport.rawDims\n      );\n\n      const textLayerPromise = this.#renderTextLayer();\n\n      if (this.annotationLayer) {\n        await this.#renderAnnotationLayer();\n\n        if (this.#enableAutoLinking && this.annotationLayer && this.textLayer) {\n          await this.#injectLinkAnnotations(textLayerPromise);\n        }\n      }\n\n      const { annotationEditorUIManager } = this.#layerProperties;\n\n      if (!annotationEditorUIManager) {\n        return;\n      }\n      this.drawLayer ||= new DrawLayerBuilder();\n      await this.#renderDrawLayer();\n      this.drawLayer.setParent(canvasWrapper);\n\n      if (\n        this.annotationLayer ||\n        this.#annotationMode === AnnotationMode.DISABLE\n      ) {\n        this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({\n          uiManager: annotationEditorUIManager,\n          pageIndex: this.id - 1,\n          l10n,\n          structTreeLayer: this.structTreeLayer,\n          accessibilityManager: this._accessibilityManager,\n          annotationLayer: this.annotationLayer?.annotationLayer,\n          textLayer: this.textLayer,\n          drawLayer: this.drawLayer.getDrawLayer(),\n          onAppend: annotationEditorLayerDiv => {\n            this.#addLayer(annotationEditorLayerDiv, \"annotationEditorLayer\");\n          },\n        });\n        this.#renderAnnotationEditorLayer();\n      }\n    });\n\n    if (pdfPage.isPureXfa) {\n      if (!this.xfaLayer) {\n        const { annotationStorage, linkService } = this.#layerProperties;\n\n        this.xfaLayer = new XfaLayerBuilder({\n          pdfPage,\n          annotationStorage,\n          linkService,\n        });\n      }\n      this.#renderXfaLayer();\n    }\n\n    div.setAttribute(\"data-loaded\", true);\n\n    this.dispatchPageRender();\n\n    return resultPromise;\n  }\n\n  /**\n   * @param {string|null} label\n   */\n  setPageLabel(label) {\n    this.pageLabel = typeof label === \"string\" ? label : null;\n\n    this.div.setAttribute(\n      \"data-l10n-args\",\n      JSON.stringify({ page: this.pageLabel ?? this.id })\n    );\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 { directDrawing, initialOptionalContent, regularAnnotations } =\n      this.#useThumbnailCanvas;\n    return directDrawing && initialOptionalContent && regularAnnotations\n      ? this.canvas\n      : null;\n  }\n}\n\nexport { PDFPageView };\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// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_find_controller\").PDFFindController} PDFFindController */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_scripting_manager\").PDFScriptingManager} PDFScriptingManager */\n/** @typedef {import(\"./pdf_link_service.js\").PDFLinkService} PDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./base_download_manager.js\").BaseDownloadManager} BaseDownloadManager */\n/** @typedef {import(\"./l10n.js\").L10n} L10n */\n\nimport {\n  AnnotationEditorType,\n  AnnotationEditorUIManager,\n  AnnotationMode,\n  makeArr,\n  MathClamp,\n  PermissionFlag,\n  PixelsPerInch,\n  shadow,\n  stopEvent,\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  removeNullCharacters,\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 { GenericL10n } from \"web-null_l10n\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\n\nconst DEFAULT_CACHE_SIZE = 10;\n\nconst PagesCountLimit = {\n  FORCE_SCROLL_MODE_PAGE: 10000,\n  FORCE_LAZY_PAGE_INIT: 5000,\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 {PDFLinkService} [linkService] - The navigation/linking service.\n * @property {BaseDownloadManager} [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} [annotationEditorHighlightColors] - A comma separated list\n *   of colors to propose to highlight some text in the pdf.\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 {number} [maxCanvasPixels] - The maximum supported canvas size in\n *   total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n *   CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n *   in either width or height. Use `-1` for no limit.\n *   The default value is 32767.\n * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the\n *   viewport increased by the value in percent. Use `-1` for no limit.\n *   The default value is 200%.\n * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered\n *   pages would need a canvas that is larger than `maxCanvasPixels` or\n *   `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,\n *   that only renders the part of the page that is close to the viewport.\n *   The default value is `true`.\n * @property {number} [imagesRightClickMinSize] - All images whose width and\n *  height are at least this value (in pixels) will be lazily inserted in the\n *  dom to allow right-clicking and saving them. Use `-1` to disable this.\n * @property {boolean} [enableOptimizedPartialRendering] - When enabled, PDF\n *   rendering will keep track of which areas of the page each PDF operation\n *   affects. Then, when rendering a partial page (if `enableDetailCanvas` is\n *   enabled), it will only run through the operations that affect that portion.\n * @property {L10n} [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 * @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.\n *   The default value is `true`.\n * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from\n *   text that look like URLs. The default value is `true`.\n * @property {number} [minDurationToUpdateCanvas] - Minimum duration to wait\n *   before updating the canvas. The default value is `500`.\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 */\nclass PDFViewer {\n  #buffer = null;\n\n  #altTextManager = null;\n\n  #annotationEditorHighlightColors = null;\n\n  #annotationEditorMode = AnnotationEditorType.NONE;\n\n  #annotationEditorUIManager = null;\n\n  #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n  #commentManager = null;\n\n  #containerTopLeft = null;\n\n  #editorUndoBar = null;\n\n  #enableHighlightFloatingButton = false;\n\n  #enablePermissions = false;\n\n  #enableUpdatedAddImage = false;\n\n  #enableNewAltTextWhenAddingImage = false;\n\n  #enableAutoLinking = true;\n\n  #abortSignal = null;\n\n  #eventAbortController = null;\n\n  #minDurationToUpdateCanvas = 0;\n\n  #mlManager = null;\n\n  #printingAllowed = true;\n\n  #scrollTimeoutId = null;\n\n  #switchAnnotationEditorModeAC = null;\n\n  #switchAnnotationEditorModeTimeoutId = null;\n\n  #copyAllInProgress = false;\n\n  #hiddenCopyElement = null;\n\n  #previousContainerHeight = 0;\n\n  #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n\n  #scrollModePageState = null;\n\n  #scaleTimeoutId = null;\n\n  #signatureManager = null;\n\n  #supportsPinchToZoom = true;\n\n  #textLayerMode = TextLayerMode.ENABLE;\n\n  #viewerAlert = null;\n\n  #copiedPageViews = null;\n\n  #savedPageViews = null;\n\n  #deletedPageNumbers = 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\n    this.container = options.container;\n    this.viewer = options.viewer || options.container.firstElementChild;\n    this.#viewerAlert = options.viewerAlert || null;\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      if (this.container?.tagName !== \"DIV\" || this.viewer?.tagName !== \"DIV\") {\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.#resizeObserver.observe(this.container);\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.#altTextManager = options.altTextManager || null;\n    this.#commentManager = options.commentManager || null;\n    this.#signatureManager = options.signatureManager || null;\n    this.#editorUndoBar = options.editorUndoBar || null;\n\n    if (this.findController) {\n      this.findController.onIsPageVisible = pageNumber =>\n        this._getVisiblePages().ids.has(pageNumber);\n    }\n    this._scriptingManager = options.scriptingManager || null;\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.#annotationEditorHighlightColors =\n      options.annotationEditorHighlightColors || null;\n    this.#enableHighlightFloatingButton =\n      options.enableHighlightFloatingButton === true;\n    this.#enableUpdatedAddImage = options.enableUpdatedAddImage === true;\n    this.#enableNewAltTextWhenAddingImage =\n      options.enableNewAltTextWhenAddingImage === true;\n    this.imageResourcesPath = options.imageResourcesPath || \"\";\n    this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      this.removePageBorders = options.removePageBorders || false;\n    }\n    this.maxCanvasPixels = options.maxCanvasPixels;\n    this.maxCanvasDim = options.maxCanvasDim;\n    this.capCanvasAreaFactor = options.capCanvasAreaFactor;\n    this.enableDetailCanvas = options.enableDetailCanvas ?? true;\n    this.enableOptimizedPartialRendering =\n      options.enableOptimizedPartialRendering ?? false;\n    this.imagesRightClickMinSize = options.imagesRightClickMinSize ?? -1;\n    this.l10n = options.l10n;\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      this.l10n ||= new GenericL10n();\n    }\n    this.#enablePermissions = options.enablePermissions || false;\n    this.pageColors = options.pageColors || null;\n    this.#mlManager = options.mlManager || null;\n    this.#supportsPinchToZoom = options.supportsPinchToZoom !== false;\n    this.#enableAutoLinking = options.enableAutoLinking !== false;\n    this.#minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500;\n\n    this.defaultRenderingQueue = !options.renderingQueue;\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      this.defaultRenderingQueue\n    ) {\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    const { abortSignal } = options;\n    this.#abortSignal = abortSignal || null;\n    abortSignal?.addEventListener(\n      \"abort\",\n      () => {\n        this.#resizeObserver.disconnect();\n        this.#resizeObserver = null;\n      },\n      { once: true }\n    );\n\n    this.scroll = watchScroll(\n      this.container,\n      this._scrollUpdate.bind(this),\n      abortSignal\n    );\n    this.presentationModeState = PresentationModeState.UNKNOWN;\n    this._resetView();\n\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      this.removePageBorders\n    ) {\n      this.viewer.classList.add(\"removePageBorders\");\n    }\n\n    this.#updateContainerHeightCss();\n\n    // Trigger API-cleanup, once thumbnail rendering has finished,\n    // if the relevant pageView is *not* cached in the buffer.\n    this.eventBus._on(\"thumbnailrendered\", ({ pageNumber, pdfPage }) => {\n      const pageView = this._pages[pageNumber - 1];\n      if (!this.#buffer.has(pageView)) {\n        pdfPage?.cleanup();\n      }\n    });\n\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      !options.l10n\n    ) {\n      // Ensure that Fluent is connected in e.g. the COMPONENTS build.\n      this.l10n.translate(this.container);\n    }\n  }\n\n  get printingAllowed() {\n    return this.#printingAllowed;\n  }\n\n  get pagesCount() {\n    return this._pages.length;\n  }\n\n  getPageView(index) {\n    return this._pages[index];\n  }\n\n  getCachedPageViews() {\n    return new Set(this.#buffer);\n  }\n\n  /**\n   * @type {boolean} - True if all {PDFPageView} objects are initialized.\n   */\n  get pageViewsReady() {\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(pageView => pageView?.pdfPage);\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, { noScroll: 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, { noScroll: 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    this.refresh(true, { rotation });\n\n    // Prevent errors in case the rotation changes *before* the scale has been\n    // set to a non-default value.\n    if (this._currentScaleValue) {\n      this.#setScale(this._currentScaleValue, { noScroll: 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  get _layerProperties() {\n    const self = this;\n    return shadow(this, \"_layerProperties\", {\n      get annotationEditorUIManager() {\n        return self.#annotationEditorUIManager;\n      },\n      get annotationStorage() {\n        return self.pdfDocument?.annotationStorage;\n      },\n      get downloadManager() {\n        return self.downloadManager;\n      },\n      get enableComment() {\n        return !!self.#commentManager;\n      },\n      get enableScripting() {\n        return !!self._scriptingManager;\n      },\n      get fieldObjectsPromise() {\n        return self.pdfDocument?.getFieldObjects();\n      },\n      get findController() {\n        return self.findController;\n      },\n      get hasJSActionsPromise() {\n        return self.pdfDocument?.hasJSActions();\n      },\n      get linkService() {\n        return self.linkService;\n      },\n    });\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      this.#printingAllowed = true;\n      this.eventBus.dispatch(\"printingallowed\", {\n        source: this,\n        isAllowed: this.#printingAllowed,\n      });\n\n      return params;\n    }\n\n    this.#printingAllowed =\n      permissions.includes(PermissionFlag.PRINT_HIGH_QUALITY) ||\n      permissions.includes(PermissionFlag.PRINT);\n    this.eventBus.dispatch(\"printingallowed\", {\n      source: this,\n      isAllowed: this.#printingAllowed,\n    });\n\n    if (\n      !permissions.includes(PermissionFlag.COPY) &&\n      this.#textLayerMode === TextLayerMode.ENABLE\n    ) {\n      params.textLayerMode = TextLayerMode.ENABLE_PERMISSIONS;\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  async #onePageRenderedOrForceFetch(signal) {\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;\n    }\n\n    // Handle the window/tab becoming inactive *after* rendering has started;\n    // fixes (another part of) bug 1746213.\n    const hiddenCapability = Promise.withResolvers(),\n      ac = new AbortController();\n    document.addEventListener(\n      \"visibilitychange\",\n      () => {\n        if (document.visibilityState === \"hidden\") {\n          hiddenCapability.resolve();\n        }\n      },\n      { signal: AbortSignal.any([signal, ac.signal]) }\n    );\n\n    await Promise.race([\n      this._onePageRenderedCapability.promise,\n      hiddenCapability.promise,\n    ]);\n    ac.abort(); // Remove the \"visibilitychange\" listener immediately.\n  }\n\n  async getAllText(interruptSignal = null) {\n    const texts = [];\n    const buffer = [];\n    for (\n      let pageNum = 1, pagesCount = this.pdfDocument.numPages;\n      pageNum <= pagesCount;\n      ++pageNum\n    ) {\n      if (interruptSignal?.aborted) {\n        return null;\n      }\n      buffer.length = 0;\n      const page = await this.pdfDocument.getPage(pageNum);\n      // By default getTextContent pass disableNormalization equals to false\n      // which is fine because we want a normalized string.\n      const { items } = await page.getTextContent();\n      for (const item of items) {\n        if (item.str) {\n          buffer.push(item.str);\n        }\n        if (item.hasEOL) {\n          buffer.push(\"\\n\");\n        }\n      }\n      texts.push(removeNullCharacters(buffer.join(\"\")));\n    }\n\n    return texts.join(\"\\n\");\n  }\n\n  #copyCallback(textLayerMode, event) {\n    const selection = document.getSelection();\n    const { focusNode, anchorNode } = selection;\n    if (\n      anchorNode &&\n      focusNode &&\n      selection.containsNode(this.#hiddenCopyElement)\n    ) {\n      // About the condition above:\n      //  - having non-null anchorNode and focusNode are here to guaranty that\n      //    we have at least a kind of selection.\n      //  - this.#hiddenCopyElement is an invisible element which is impossible\n      //    to select manually (its display is none) but ctrl+A will select all\n      //    including this element so having it in the selection means that all\n      //    has been selected.\n\n      if (\n        this.#copyAllInProgress ||\n        textLayerMode === TextLayerMode.ENABLE_PERMISSIONS\n      ) {\n        stopEvent(event);\n        return;\n      }\n      this.#copyAllInProgress = true;\n\n      // TODO: if all the pages are rendered we don't need to wait for\n      // getAllText and we could just get text from the Selection object.\n\n      // Select all the document.\n      const { classList } = this.viewer;\n      classList.add(\"copyAll\");\n\n      const keydownAC = new AbortController(),\n        interruptAC = new AbortController();\n      window.addEventListener(\n        \"keydown\",\n        ev => {\n          if (ev.key === \"Escape\") {\n            interruptAC.abort();\n          }\n        },\n        { signal: keydownAC.signal }\n      );\n\n      this.getAllText(interruptAC.signal)\n        .then(async text => {\n          if (text !== null) {\n            await navigator.clipboard.writeText(text);\n          }\n        })\n        .catch(reason => {\n          console.warn(\n            `Something goes wrong when extracting the text: ${reason.message}`\n          );\n        })\n        .finally(() => {\n          this.#copyAllInProgress = false;\n          keydownAC.abort();\n          classList.remove(\"copyAll\");\n        });\n\n      stopEvent(event);\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      this.#annotationEditorUIManager?.destroy();\n      this.#annotationEditorUIManager = null;\n\n      this.#annotationEditorMode = AnnotationEditorType.NONE;\n\n      this.#printingAllowed = true;\n    }\n\n    this.pdfDocument = pdfDocument;\n    if (!pdfDocument) {\n      return;\n    }\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      intent: \"display\",\n    });\n    const permissionsPromise = this.#enablePermissions\n      ? pdfDocument.getPermissions()\n      : Promise.resolve();\n\n    const { eventBus, pageColors, viewer } = this;\n\n    this.#eventAbortController = new AbortController();\n    const { signal } = this.#eventAbortController;\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      eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n    }\n\n    this._pagesCapability.promise.then(\n      () => {\n        eventBus.dispatch(\"pagesloaded\", { source: this, pagesCount });\n      },\n      () => {\n        /* Prevent \"Uncaught (in promise)\"-messages in the console. */\n      }\n    );\n\n    const 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    eventBus._on(\"pagerender\", onBeforeDraw, { signal });\n\n    const onAfterDraw = evt => {\n      if (evt.cssTransform || evt.isDetailView) {\n        return;\n      }\n      this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });\n\n      eventBus._off(\"pagerendered\", onAfterDraw); // Remove immediately.\n    };\n    eventBus._on(\"pagerendered\", onAfterDraw, { signal });\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 (textLayerMode !== TextLayerMode.DISABLE) {\n          const element = (this.#hiddenCopyElement =\n            document.createElement(\"div\"));\n          element.id = \"hiddenCopyElement\";\n          viewer.before(element);\n        }\n\n        if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n          const mode = annotationEditorMode;\n\n          if (pdfDocument.isPureXfa) {\n            console.warn(\"Warning: XFA-editing is not implemented.\");\n          } else if (isValidAnnotationEditorMode(mode)) {\n            this.#annotationEditorUIManager = new AnnotationEditorUIManager(\n              this.container,\n              viewer,\n              this.#viewerAlert,\n              this.#altTextManager,\n              this.#commentManager,\n              this.#signatureManager,\n              eventBus,\n              pdfDocument,\n              pageColors,\n              this.#annotationEditorHighlightColors,\n              this.#enableHighlightFloatingButton,\n              this.#enableUpdatedAddImage,\n              this.#enableNewAltTextWhenAddingImage,\n              this.#mlManager,\n              this.#editorUndoBar,\n              this.#supportsPinchToZoom\n            );\n            eventBus.dispatch(\"annotationeditoruimanager\", {\n              source: this,\n              uiManager: this.#annotationEditorUIManager,\n            });\n            if (mode !== AnnotationEditorType.NONE) {\n              this.#preloadEditingData(mode);\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 : viewer;\n        const scale = this.currentScale;\n        const viewport = firstPdfPage.getViewport({\n          scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n        });\n        // Ensure that the various layers always get the correct initial size,\n        // see issue 15795.\n        viewer.style.setProperty(\"--scale-factor\", viewport.scale);\n\n        if (pageColors?.background) {\n          viewer.style.setProperty(\"--page-bg-color\", pageColors.background);\n        }\n        if (\n          pageColors?.foreground === \"CanvasText\" ||\n          pageColors?.background === \"Canvas\"\n        ) {\n          viewer.style.setProperty(\n            \"--hcm-highlight-filter\",\n            pdfDocument.filterFactory.addHighlightHCMFilter(\n              \"highlight\",\n              \"CanvasText\",\n              \"Canvas\",\n              \"HighlightText\",\n              \"Highlight\"\n            )\n          );\n          viewer.style.setProperty(\n            \"--hcm-highlight-selected-filter\",\n            pdfDocument.filterFactory.addHighlightHCMFilter(\n              \"highlight_selected\",\n              \"CanvasText\",\n              \"Canvas\",\n              \"HighlightText\",\n              \"ButtonText\"\n            )\n          );\n        }\n\n        for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {\n          const pageView = new PDFPageView({\n            container: viewerElement,\n            eventBus,\n            id: pageNum,\n            scale,\n            defaultViewport: viewport.clone(),\n            optionalContentConfigPromise,\n            renderingQueue: this.renderingQueue,\n            textLayerMode,\n            annotationMode,\n            imageResourcesPath: this.imageResourcesPath,\n            maxCanvasPixels: this.maxCanvasPixels,\n            maxCanvasDim: this.maxCanvasDim,\n            capCanvasAreaFactor: this.capCanvasAreaFactor,\n            enableDetailCanvas: this.enableDetailCanvas,\n            enableOptimizedPartialRendering:\n              this.enableOptimizedPartialRendering,\n            imagesRightClickMinSize: this.imagesRightClickMinSize,\n            pageColors,\n            l10n: this.l10n,\n            layerProperties: this._layerProperties,\n            enableAutoLinking: this.#enableAutoLinking,\n            minDurationToUpdateCanvas: this.#minDurationToUpdateCanvas,\n            commentManager: this.#commentManager,\n            abortSignal: this.#abortSignal,\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        this._pages[0]?.setPdfPage(firstPdfPage);\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        eventBus._on(\n          \"annotationeditorlayerrendered\",\n          evt => {\n            if (this.#annotationEditorUIManager) {\n              // Ensure that the Editor buttons, in the toolbar, are updated.\n              eventBus.dispatch(\"annotationeditormodechanged\", {\n                source: this,\n                mode: this.#annotationEditorMode,\n              });\n            }\n          },\n          { once: true, signal }\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(signal).then(async () => {\n          if (pdfDocument !== this.pdfDocument) {\n            return; // The document was closed while the first page rendered.\n          }\n          this.findController?.setDocument(pdfDocument); // Enable searching.\n          this._scriptingManager?.setDocument(pdfDocument); // Enable scripting.\n\n          if (this.#hiddenCopyElement) {\n            document.addEventListener(\n              \"copy\",\n              this.#copyCallback.bind(this, textLayerMode),\n              { signal }\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                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        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            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  onPagesEdited({ pagesMapper, type, hasBeenCut, pageNumbers }) {\n    if (type === \"copy\") {\n      this.#copiedPageViews = new Map();\n      for (const pageNum of pageNumbers) {\n        this.#copiedPageViews.set(pageNum, this._pages[pageNum - 1]);\n      }\n      return;\n    }\n\n    if (type === \"cancelCopy\") {\n      this.#copiedPageViews = null;\n      return;\n    }\n\n    const isCut = type === \"cut\";\n    if (isCut || type === \"delete\") {\n      this.#savedPageViews = this._pages;\n      this.#deletedPageNumbers = pageNumbers;\n    }\n\n    if (type === \"cancelDelete\") {\n      this.#deletedPageNumbers = null;\n      if (!this.#savedPageViews) {\n        return;\n      }\n      const viewerElement =\n        this._scrollMode === ScrollMode.PAGE ? null : this.viewer;\n      if (viewerElement) {\n        this.#annotationEditorUIManager?.startUpdatePages();\n        const fragment = document.createDocumentFragment();\n        for (let i = 0, ii = this.#savedPageViews.length; i < ii; i++) {\n          const page = this.#savedPageViews[i];\n          page.updatePageNumber(i + 1);\n          fragment.append(page.div);\n        }\n        viewerElement.replaceChildren(fragment);\n        this.#annotationEditorUIManager?.endUpdatePages();\n      }\n      this._pages = this.#savedPageViews;\n      this.#savedPageViews = null;\n      return;\n    }\n\n    if (type === \"cleanSavedData\") {\n      if (this.#deletedPageNumbers) {\n        if (this.#savedPageViews) {\n          for (const pageNum of this.#deletedPageNumbers) {\n            this.#savedPageViews[pageNum - 1].deleteMe();\n          }\n          this.#savedPageViews = null;\n        }\n        this.#deletedPageNumbers = null;\n      }\n      return;\n    }\n\n    this._currentPageNumber = 0;\n    const prevPages = this._pages;\n    const newPages = (this._pages = []);\n\n    this.#annotationEditorUIManager?.startUpdatePages();\n\n    for (let i = 1, ii = pagesMapper.pagesNumber; i <= ii; i++) {\n      const prevPageNumber = pagesMapper.getPrevPageNumber(i);\n      if (prevPageNumber < 0) {\n        let page = this.#copiedPageViews.get(-prevPageNumber);\n        if (hasBeenCut) {\n          page.updatePageNumber(i);\n        } else {\n          this.#annotationEditorUIManager?.clonePage(\n            -prevPageNumber - 1,\n            i - 1\n          );\n          page = page.clone(i);\n        }\n        newPages.push(page);\n        continue;\n      }\n      const page = prevPages[prevPageNumber - 1];\n      newPages.push(page);\n      page.updatePageNumber(i);\n    }\n\n    this.#annotationEditorUIManager?.endUpdatePages();\n\n    if (type === \"paste\") {\n      this.#copiedPageViews = null;\n    }\n\n    const viewerElement =\n      this._scrollMode === ScrollMode.PAGE ? null : this.viewer;\n    if (viewerElement) {\n      const fragment = document.createDocumentFragment();\n      for (const { div } of newPages) {\n        fragment.append(div);\n      }\n      viewerElement.replaceChildren(fragment);\n    }\n\n    setTimeout(() => {\n      this.forceRendering();\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 = Promise.withResolvers();\n    this._onePageRenderedCapability = Promise.withResolvers();\n    this._pagesCapability = Promise.withResolvers();\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    this.#eventAbortController?.abort();\n    this.#eventAbortController = 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\n    this.#hiddenCopyElement?.remove();\n    this.#hiddenCopyElement = null;\n\n    this.#cleanupTimeouts();\n    this.#cleanupSwitchAnnotationEditorMode();\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\n    if (this.#scrollTimeoutId) {\n      clearTimeout(this.#scrollTimeoutId);\n    }\n    this.#scrollTimeoutId = setTimeout(() => {\n      this.#scrollTimeoutId = null;\n      this.update();\n    }, 100);\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(\n    newScale,\n    newValue,\n    { noScroll = false, preset = false, drawingDelay = -1, origin = null }\n  ) {\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    this.viewer.style.setProperty(\n      \"--scale-factor\",\n      newScale * PixelsPerInch.PDF_TO_CSS_UNITS\n    );\n\n    const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n    this.refresh(true, {\n      scale: newScale,\n      drawingDelay: postponeDrawing ? drawingDelay : -1,\n    });\n\n    if (postponeDrawing) {\n      this.#scaleTimeoutId = setTimeout(() => {\n        this.#scaleTimeoutId = null;\n        this.refresh();\n      }, drawingDelay);\n    }\n\n    const previousScale = this._currentScale;\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      if (Array.isArray(origin)) {\n        // If the origin of the scaling transform is specified, preserve its\n        // location on screen. If not specified, scaling will fix the top-left\n        // corner of the visible PDF area.\n        const scaleDiff = newScale / previousScale - 1;\n        const [top, left] = this.containerTopLeft;\n        this.container.scrollLeft += (origin[0] - left) * scaleDiff;\n        this.container.scrollTop += (origin[1] - top) * scaleDiff;\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  }\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, options) {\n    let scale = parseFloat(value);\n\n    if (scale > 0) {\n      options.preset = false;\n      this.#setScaleUpdatePages(scale, value, options);\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        // Pages have a 2px (transparent) border in PresentationMode, see\n        // the `web/pdf_viewer.css` file.\n        hPadding = vPadding = 4; // 2 * 2px\n        if (this._spreadMode !== SpreadMode.NONE) {\n          // Account for two pages being visible in PresentationMode, thus\n          // \"doubling\" the total border width.\n          hPadding *= 2;\n        }\n      } else if (\n        (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n        this.removePageBorders\n      ) {\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      options.preset = true;\n      this.#setScaleUpdatePages(scale, value, options);\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, { noScroll: 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   * @property {string} [center] - Center the view on the specified coordinates.\n   *   The default value is `null`. Possible values are: `null` (don't center),\n   *  `horizontal`, `vertical` and `both`.\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    center = null,\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        let hPadding = SCROLLBAR_PADDING,\n          vPadding = VERTICAL_PADDING;\n\n        if (\n          (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n          this.removePageBorders\n        ) {\n          hPadding = vPadding = 0;\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 (center) {\n      if (center === \"both\" || center === \"vertical\") {\n        top -=\n          (this.container.clientHeight -\n            Math.abs(boundingRect[1][1] - boundingRect[0][1])) /\n          2;\n      }\n      if (center === \"both\" || center === \"horizontal\") {\n        left -=\n          (this.container.clientWidth -\n            Math.abs(boundingRect[1][0] - boundingRect[0][0])) /\n          2;\n      }\n    } else 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    for (const { view, visibleArea } of visiblePages) {\n      view.updateVisibleArea(visibleArea);\n    }\n    for (const view of this.#buffer) {\n      if (!visible.ids.has(view.id)) {\n        view.updateVisibleArea(null);\n      }\n    }\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 currentPageNumber = 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 === currentPageNumber && isSimpleLayout) {\n        stillFullyVisible = true;\n        break;\n      }\n    }\n    this._setCurrentPageNumber(\n      stillFullyVisible ? this._currentPageNumber : 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  #switchToEditAnnotationMode() {\n    const visible = this._getVisiblePages();\n    const pagesToRefresh = [];\n    const { ids, views } = visible;\n    for (const page of views) {\n      const { view } = page;\n      if (!view.hasEditableAnnotations()) {\n        ids.delete(view.id);\n        continue;\n      }\n      pagesToRefresh.push(page);\n    }\n\n    if (pagesToRefresh.length === 0) {\n      return null;\n    }\n    this.renderingQueue.renderHighestPriority({\n      first: pagesToRefresh[0],\n      last: pagesToRefresh.at(-1),\n      views: pagesToRefresh,\n      ids,\n    });\n\n    return ids;\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  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      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  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 ignoreDetailViews =\n      // If we are zooming, do not re-render the detail views. Re-renders on\n      // zoom happen with a delay, and once the rendering happens it will also\n      // trigger rendering of the detail views.\n      this.#scaleTimeoutId !== null ||\n      // If we are scrolling and the rendering of a detail view was just\n      // cancelled, it's because the user is scrolling too quickly and so\n      // we constantly need to re-render a different area.\n      // Don't attempt to re-render it: this will be done once the user\n      // stops scrolling.\n      (this.#scrollTimeoutId !== null &&\n        visiblePages.views.some(page => page.detailView?.renderingCancelled));\n\n    const pageView = this.renderingQueue.getHighestPriority(\n      visiblePages,\n      this._pages,\n      scrollAhead,\n      preRenderExtra,\n      ignoreDetailViews\n    );\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   * @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    let initialOrientation;\n    return this._pages.map(pageView => {\n      const viewport = pageView.pdfPage.getViewport({ scale: 1 });\n      const orientation = isPortraitOrientation(viewport);\n      if (initialOrientation === undefined) {\n        initialOrientation = orientation;\n      } else if (\n        this.enablePrintAutoRotate &&\n        orientation !== initialOrientation\n      ) {\n        // Rotate to fit the initial orientation.\n        return {\n          width: viewport.height,\n          height: viewport.width,\n          rotation: (viewport.rotation - 90) % 360,\n        };\n      }\n      return {\n        width: viewport.width,\n        height: viewport.height,\n        rotation: viewport.rotation,\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({ intent: \"display\" });\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    this.refresh(false, { optionalContentConfigPromise: promise });\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 (\n      typeof PDFJSDev === \"undefined\"\n        ? window.isGECKOVIEW\n        : PDFJSDev.test(\"GECKOVIEW\")\n    ) {\n      // NOTE: Always ignore the pageLayout in GeckoView since there's\n      // no UI available to change Scroll/Spread modes for the user.\n      return;\n    }\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, { noScroll: 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 (\n      typeof PDFJSDev === \"undefined\"\n        ? window.isGECKOVIEW\n        : PDFJSDev.test(\"GECKOVIEW\")\n    ) {\n      // NOTE: Always ignore the pageLayout in GeckoView since there's\n      // no UI available to change Scroll/Spread modes for the user.\n      return;\n    }\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, { noScroll: true });\n    }\n    this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n    this.update();\n  }\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          pageLayout.getOrInsertComputed(y, makeArr).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 occurred.\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 occurred.\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   * @typedef {Object} ChangeScaleOptions\n   * @property {number} [drawingDelay]\n   * @property {number} [scaleFactor]\n   * @property {number} [steps]\n   * @property {Array} [origin] x and y coordinates of the scale\n   *                            transformation origin.\n   */\n\n  /**\n   * Changes the current zoom level by the specified amount.\n   * @param {ChangeScaleOptions} [options]\n   */\n  updateScale({ drawingDelay, scaleFactor = null, steps = null, origin }) {\n    if (steps === null && scaleFactor === null) {\n      throw new Error(\n        \"Invalid updateScale options: either `steps` or `scaleFactor` must be provided.\"\n      );\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    let newScale = this._currentScale;\n    if (scaleFactor > 0 && scaleFactor !== 1) {\n      newScale = Math.round(newScale * scaleFactor * 100) / 100;\n    } else if (steps) {\n      const delta = steps > 0 ? DEFAULT_SCALE_DELTA : 1 / DEFAULT_SCALE_DELTA;\n      const round = steps > 0 ? Math.ceil : Math.floor;\n      steps = Math.abs(steps);\n      do {\n        newScale = round((newScale * delta).toFixed(2) * 10) / 10;\n      } while (--steps > 0);\n    }\n    newScale = MathClamp(newScale, MIN_SCALE, MAX_SCALE);\n    this.#setScale(newScale, { noScroll: false, drawingDelay, origin });\n  }\n\n  /**\n   * Increase the current zoom level one, or more, times.\n   * @param {ChangeScaleOptions} [options]\n   */\n  increaseScale(options = {}) {\n    this.updateScale({ ...options, steps: options.steps ?? 1 });\n  }\n\n  /**\n   * Decrease the current zoom level one, or more, times.\n   * @param {ChangeScaleOptions} [options]\n   */\n  decreaseScale(options = {}) {\n    this.updateScale({ ...options, steps: -(options.steps ?? 1) });\n  }\n\n  #updateContainerHeightCss(height = this.container.clientHeight) {\n    if (height !== this.#previousContainerHeight) {\n      this.#previousContainerHeight = height;\n      docStyle.setProperty(\"--viewer-container-height\", `${height}px`);\n    }\n  }\n\n  #resizeObserverCallback(entries) {\n    for (const entry of entries) {\n      if (entry.target === this.container) {\n        this.#updateContainerHeightCss(\n          Math.floor(entry.borderBoxSize[0].blockSize)\n        );\n        this.#containerTopLeft = null;\n        break;\n      }\n    }\n  }\n\n  get containerTopLeft() {\n    return (this.#containerTopLeft ||= [\n      this.container.offsetTop,\n      this.container.offsetLeft,\n    ]);\n  }\n\n  #cleanupTimeouts() {\n    if (this.#scaleTimeoutId !== null) {\n      clearTimeout(this.#scaleTimeoutId);\n      this.#scaleTimeoutId = null;\n    }\n    if (this.#scrollTimeoutId !== null) {\n      clearTimeout(this.#scrollTimeoutId);\n      this.#scrollTimeoutId = null;\n    }\n  }\n\n  #cleanupSwitchAnnotationEditorMode() {\n    this.#switchAnnotationEditorModeAC?.abort();\n    this.#switchAnnotationEditorModeAC = null;\n\n    if (this.#switchAnnotationEditorModeTimeoutId !== null) {\n      clearTimeout(this.#switchAnnotationEditorModeTimeoutId);\n      this.#switchAnnotationEditorModeTimeoutId = null;\n    }\n  }\n\n  #preloadEditingData(mode) {\n    switch (mode) {\n      case AnnotationEditorType.STAMP:\n        this.#mlManager?.loadModel(\"altText\");\n        break;\n      case AnnotationEditorType.SIGNATURE:\n        // Start to load the signature data.\n        this.#signatureManager?.loadSignatures();\n        break;\n    }\n  }\n\n  get annotationEditorMode() {\n    return this.#annotationEditorUIManager\n      ? this.#annotationEditorMode\n      : AnnotationEditorType.DISABLE;\n  }\n\n  /**\n   * @typedef {Object} AnnotationEditorModeOptions\n   * @property {number} mode - The editor mode (none, FreeText, ink, ...).\n   * @property {string|null} [editId] - ID of the existing annotation to edit.\n   * @property {boolean} [isFromKeyboard] - True if the mode change is due to a\n   *   keyboard action.\n   * @property {boolean} [mustEnterInEditMode] - True if the editor must enter\n   *   edit mode.\n   * @property {boolean} [editComment] - True if the editor must enter\n   *   comment edit mode.\n   */\n\n  /**\n   * @param {AnnotationEditorModeOptions} options\n   */\n  set annotationEditorMode({\n    mode,\n    editId = null,\n    isFromKeyboard = false,\n    mustEnterInEditMode = false,\n    editComment = false,\n  }) {\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.#preloadEditingData(mode);\n\n    const { eventBus, pdfDocument } = this;\n    const updater = async () => {\n      this.#cleanupSwitchAnnotationEditorMode();\n      this.#annotationEditorMode = mode;\n      await this.#annotationEditorUIManager.updateMode(\n        mode,\n        editId,\n        /* isFromUser = */ true,\n        isFromKeyboard,\n        mustEnterInEditMode,\n        editComment\n      );\n      if (\n        mode !== this.#annotationEditorMode ||\n        pdfDocument !== this.pdfDocument\n      ) {\n        // Since `updateMode` is async, the active mode could have changed.\n        return;\n      }\n      eventBus.dispatch(\"annotationeditormodechanged\", {\n        source: this,\n        mode,\n      });\n    };\n\n    if (\n      mode === AnnotationEditorType.NONE ||\n      this.#annotationEditorMode === AnnotationEditorType.NONE\n    ) {\n      const isEditing = mode !== AnnotationEditorType.NONE;\n      if (!isEditing) {\n        this.pdfDocument.annotationStorage.resetModifiedIds();\n      }\n      // We need to cleanup whatever pages being rendered.\n      this.cleanup();\n      for (const pageView of this._pages) {\n        pageView.toggleEditingMode(isEditing);\n      }\n      // We must call #switchToEditAnnotationMode unconditionally to ensure that\n      // page is rendered if it's useful or not.\n      const idsToRefresh = this.#switchToEditAnnotationMode();\n      if (isEditing && idsToRefresh) {\n        // We're editing so we must switch to editing mode when the rendering is\n        // done.\n        this.#cleanupSwitchAnnotationEditorMode();\n        this.#switchAnnotationEditorModeAC = new AbortController();\n        const signal = AbortSignal.any([\n          this.#eventAbortController.signal,\n          this.#switchAnnotationEditorModeAC.signal,\n        ]);\n\n        eventBus._on(\n          \"pagerendered\",\n          ({ pageNumber }) => {\n            idsToRefresh.delete(pageNumber);\n            if (idsToRefresh.size === 0) {\n              this.#switchAnnotationEditorModeTimeoutId = setTimeout(\n                updater,\n                0\n              );\n            }\n          },\n          { signal }\n        );\n        return;\n      }\n    }\n    updater();\n  }\n\n  refresh(noUpdate = false, updateArgs = Object.create(null)) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    for (const pageView of this._pages) {\n      pageView.update(updateArgs);\n    }\n    this.#cleanupTimeouts();\n\n    if (!noUpdate) {\n      this.update();\n    }\n  }\n}\n\nexport { PagesCountLimit, PDFPageViewBuffer, PDFViewer };\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(\"./event_utils.js\").EventBus} EventBus */\n\nimport {\n  CursorTool,\n  ScrollMode,\n  SpreadMode,\n  toggleCheckedBtn,\n  toggleExpandedBtn,\n} from \"./ui_utils.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} imageAltTextSettingsButton - Button for opening\n *   the image alt-text settings dialog.\n * @property {HTMLButtonElement} documentPropertiesButton - Button for opening\n *   the document properties dialog.\n */\n\nclass SecondaryToolbar {\n  #opts;\n\n  /**\n   * @param {SecondaryToolbarOptions} options\n   * @param {EventBus} eventBus\n   */\n  constructor(options, eventBus) {\n    this.#opts = options;\n    const 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.imageAltTextSettingsButton,\n        eventName: \"imagealttextsettings\",\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      buttons.push({\n        element: options.openFileButton,\n        eventName: \"openfile\",\n        close: true,\n      });\n    }\n\n    this.eventBus = eventBus;\n    this.opened = false;\n\n    // Bind the event listeners for click, cursor tool, and scroll/spread mode\n    // actions.\n    this.#bindListeners(buttons);\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(\"switchcursortool\", { source: this, reset: true });\n    this.#scrollModeChanged({ mode: ScrollMode.VERTICAL });\n    this.#spreadModeChanged({ mode: SpreadMode.NONE });\n  }\n\n  #updateUIState() {\n    const {\n      firstPageButton,\n      lastPageButton,\n      pageRotateCwButton,\n      pageRotateCcwButton,\n    } = this.#opts;\n\n    firstPageButton.disabled = this.pageNumber <= 1;\n    lastPageButton.disabled = this.pageNumber >= this.pagesCount;\n    pageRotateCwButton.disabled = this.pagesCount === 0;\n    pageRotateCcwButton.disabled = this.pagesCount === 0;\n  }\n\n  #bindListeners(buttons) {\n    const { eventBus } = this;\n    const { toggleButton } = this.#opts;\n    // Button to toggle the visibility of the secondary toolbar.\n    toggleButton.addEventListener(\"click\", this.toggle.bind(this));\n\n    // All items within the secondary toolbar.\n    for (const { element, eventName, close, eventDetails } of buttons) {\n      element.addEventListener(\"click\", evt => {\n        if (eventName !== null) {\n          eventBus.dispatch(eventName, { source: this, ...eventDetails });\n        }\n        if (close) {\n          this.close();\n        }\n        eventBus.dispatch(\"reporttelemetry\", {\n          source: this,\n          details: {\n            type: \"buttons\",\n            data: { id: element.id },\n          },\n        });\n      });\n    }\n\n    eventBus._on(\"cursortoolchanged\", this.#cursorToolChanged.bind(this));\n    eventBus._on(\"scrollmodechanged\", this.#scrollModeChanged.bind(this));\n    eventBus._on(\"spreadmodechanged\", this.#spreadModeChanged.bind(this));\n  }\n\n  #cursorToolChanged({ tool, disabled }) {\n    const { cursorSelectToolButton, cursorHandToolButton } = this.#opts;\n\n    toggleCheckedBtn(cursorSelectToolButton, tool === CursorTool.SELECT);\n    toggleCheckedBtn(cursorHandToolButton, tool === CursorTool.HAND);\n\n    cursorSelectToolButton.disabled = disabled;\n    cursorHandToolButton.disabled = disabled;\n  }\n\n  #scrollModeChanged({ mode }) {\n    const {\n      scrollPageButton,\n      scrollVerticalButton,\n      scrollHorizontalButton,\n      scrollWrappedButton,\n      spreadNoneButton,\n      spreadOddButton,\n      spreadEvenButton,\n    } = this.#opts;\n\n    toggleCheckedBtn(scrollPageButton, mode === ScrollMode.PAGE);\n    toggleCheckedBtn(scrollVerticalButton, mode === ScrollMode.VERTICAL);\n    toggleCheckedBtn(scrollHorizontalButton, mode === ScrollMode.HORIZONTAL);\n    toggleCheckedBtn(scrollWrappedButton, mode === ScrollMode.WRAPPED);\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    const isHorizontal = mode === ScrollMode.HORIZONTAL;\n    spreadNoneButton.disabled = isHorizontal;\n    spreadOddButton.disabled = isHorizontal;\n    spreadEvenButton.disabled = isHorizontal;\n  }\n\n  #spreadModeChanged({ mode }) {\n    const { spreadNoneButton, spreadOddButton, spreadEvenButton } = this.#opts;\n\n    toggleCheckedBtn(spreadNoneButton, mode === SpreadMode.NONE);\n    toggleCheckedBtn(spreadOddButton, mode === SpreadMode.ODD);\n    toggleCheckedBtn(spreadEvenButton, mode === SpreadMode.EVEN);\n  }\n\n  open() {\n    if (this.opened) {\n      return;\n    }\n    this.opened = true;\n\n    const { toggleButton, toolbar } = this.#opts;\n    toggleExpandedBtn(toggleButton, true, toolbar);\n  }\n\n  close() {\n    if (!this.opened) {\n      return;\n    }\n    this.opened = false;\n\n    const { toggleButton, toolbar } = this.#opts;\n    toggleExpandedBtn(toggleButton, false, toolbar);\n  }\n\n  toggle() {\n    if (this.opened) {\n      this.close();\n    } else {\n      this.open();\n    }\n  }\n}\n\nexport { SecondaryToolbar };\n","/* Copyright 2025 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  AnnotationEditorParamsType,\n  DOMSVGFactory,\n  noContextMenu,\n  SignatureExtractor,\n  stopEvent,\n  SupportedImageMimeTypes,\n} from \"pdfjs-lib\";\n\n// Default height of the added signature in page coordinates.\nconst DEFAULT_HEIGHT_IN_PAGE = 40;\n\nclass SignatureManager {\n  #addButton;\n\n  #tabsToAltText = null;\n\n  #clearButton;\n\n  #clearDescription;\n\n  #currentEditor;\n\n  #description;\n\n  #dialog;\n\n  #drawCurves = null;\n\n  #drawPlaceholder;\n\n  #drawPath = null;\n\n  #drawPathString = \"\";\n\n  #drawPoints = null;\n\n  #drawSVG;\n\n  #drawThickness;\n\n  #errorBar;\n\n  #errorDescription;\n\n  #errorTitle;\n\n  #extractedSignatureData = null;\n\n  #imagePath = null;\n\n  #imagePicker;\n\n  #imagePickerLink;\n\n  #imagePlaceholder;\n\n  #imageSVG;\n\n  #saveCheckbox;\n\n  #saveContainer;\n\n  #tabButtons;\n\n  #addSignatureToolbarButton;\n\n  #loadSignaturesPromise = null;\n\n  #typeInput;\n\n  #currentTab = null;\n\n  #currentTabAC = null;\n\n  #hasDescriptionChanged = false;\n\n  #eventBus;\n\n  #isStorageFull = false;\n\n  #l10n;\n\n  #overlayManager;\n\n  #editDescriptionDialog;\n\n  #signatureStorage;\n\n  #uiManager = null;\n\n  static #l10nDescription = null;\n\n  constructor(\n    {\n      dialog,\n      panels,\n      typeButton,\n      typeInput,\n      drawButton,\n      drawPlaceholder,\n      drawSVG,\n      drawThickness,\n      imageButton,\n      imageSVG,\n      imagePlaceholder,\n      imagePicker,\n      imagePickerLink,\n      description,\n      clearButton,\n      cancelButton,\n      addButton,\n      errorCloseButton,\n      errorBar,\n      errorTitle,\n      errorDescription,\n      saveCheckbox,\n      saveContainer,\n    },\n    editSignatureElements,\n    addSignatureToolbarButton,\n    overlayManager,\n    l10n,\n    signatureStorage,\n    eventBus\n  ) {\n    this.#addButton = addButton;\n    this.#clearButton = clearButton;\n    this.#clearDescription = description.lastElementChild;\n    this.#description = description.firstElementChild;\n    this.#dialog = dialog;\n    this.#drawSVG = drawSVG;\n    this.#drawPlaceholder = drawPlaceholder;\n    this.#drawThickness = drawThickness;\n    this.#errorBar = errorBar;\n    this.#errorTitle = errorTitle;\n    this.#errorDescription = errorDescription;\n    this.#imageSVG = imageSVG;\n    this.#imagePlaceholder = imagePlaceholder;\n    this.#imagePicker = imagePicker;\n    this.#imagePickerLink = imagePickerLink;\n    this.#overlayManager = overlayManager;\n    this.#saveCheckbox = saveCheckbox;\n    this.#saveContainer = saveContainer;\n    this.#addSignatureToolbarButton = addSignatureToolbarButton;\n    this.#typeInput = typeInput;\n    this.#l10n = l10n;\n    this.#signatureStorage = signatureStorage;\n    this.#eventBus = eventBus;\n    this.#editDescriptionDialog = new EditDescriptionDialog(\n      editSignatureElements,\n      overlayManager\n    );\n\n    SignatureManager.#l10nDescription ||= Object.freeze({\n      signature: \"pdfjs-editor-add-signature-description-default-when-drawing\",\n      errorUploadTitle: \"pdfjs-editor-add-signature-image-upload-error-title\",\n      errorUploadDescription:\n        \"pdfjs-editor-add-signature-image-upload-error-description\",\n      errorNoDataTitle: \"pdfjs-editor-add-signature-image-no-data-error-title\",\n      errorNoDataDescription:\n        \"pdfjs-editor-add-signature-image-no-data-error-description\",\n    });\n\n    dialog.addEventListener(\"close\", this.#close.bind(this));\n    dialog.addEventListener(\"contextmenu\", e => {\n      const { target } = e;\n      if (target !== this.#typeInput && target !== this.#description) {\n        e.preventDefault();\n      }\n    });\n    dialog.addEventListener(\"drop\", e => {\n      stopEvent(e);\n    });\n    cancelButton.addEventListener(\"click\", this.#cancel.bind(this));\n    addButton.addEventListener(\"click\", this.#add.bind(this));\n    clearButton.addEventListener(\n      \"click\",\n      () => {\n        this.#reportTelemetry({\n          type: \"signature\",\n          action: \"pdfjs.signature.clear\",\n          data: {\n            type: this.#currentTab,\n          },\n        });\n        this.#initTab(null);\n      },\n      { passive: true }\n    );\n    this.#description.addEventListener(\n      \"input\",\n      () => {\n        this.#clearDescription.disabled = this.#description.value === \"\";\n      },\n      { passive: true }\n    );\n    this.#clearDescription.addEventListener(\n      \"click\",\n      () => {\n        this.#description.value = \"\";\n        this.#clearDescription.disabled = true;\n      },\n      { passive: true }\n    );\n    errorCloseButton.addEventListener(\n      \"click\",\n      () => {\n        errorBar.hidden = true;\n      },\n      { passive: true }\n    );\n\n    this.#initTabButtons(typeButton, drawButton, imageButton, panels);\n    imagePicker.accept = SupportedImageMimeTypes.join(\",\");\n\n    eventBus._on(\"storedsignatureschanged\", this.#signaturesChanged.bind(this));\n\n    overlayManager.register(dialog);\n  }\n\n  #initTabButtons(typeButton, drawButton, imageButton, panels) {\n    const buttons = (this.#tabButtons = new Map([\n      [\"type\", typeButton],\n      [\"draw\", drawButton],\n      [\"image\", imageButton],\n    ]));\n    const tabCallback = e => {\n      for (const [name, button] of buttons) {\n        if (button === e.target) {\n          button.setAttribute(\"aria-selected\", true);\n          button.setAttribute(\"tabindex\", 0);\n          panels.setAttribute(\"data-selected\", name);\n          this.#initTab(name);\n        } else {\n          button.setAttribute(\"aria-selected\", false);\n          // Only the active tab is focusable: the others can be\n          // reached by keyboard navigation (left/right arrows).\n          button.setAttribute(\"tabindex\", -1);\n        }\n      }\n    };\n\n    const buttonsArray = Array.from(buttons.values());\n    for (let i = 0, ii = buttonsArray.length; i < ii; i++) {\n      const button = buttonsArray[i];\n      button.addEventListener(\"click\", tabCallback, { passive: true });\n      button.addEventListener(\n        \"keydown\",\n        ({ key }) => {\n          if (key !== \"ArrowLeft\" && key !== \"ArrowRight\") {\n            return;\n          }\n          buttonsArray[i + (key === \"ArrowLeft\" ? -1 : 1)]?.focus();\n        },\n        { passive: true }\n      );\n    }\n  }\n\n  #resetCommon() {\n    this.#hasDescriptionChanged = false;\n    this.#description.value = \"\";\n    if (this.#currentTab) {\n      this.#tabsToAltText.get(this.#currentTab).value = \"\";\n    }\n  }\n\n  #resetTab(name) {\n    switch (name) {\n      case \"type\":\n        this.#typeInput.value = \"\";\n        break;\n      case \"draw\":\n        this.#drawCurves = null;\n        this.#drawPoints = null;\n        this.#drawPathString = \"\";\n        this.#drawPath?.remove();\n        this.#drawPath = null;\n        this.#drawPlaceholder.hidden = false;\n        this.#drawThickness.value = 1;\n        break;\n      case \"image\":\n        this.#imagePlaceholder.hidden = false;\n        this.#imagePath?.remove();\n        this.#imagePath = null;\n        break;\n    }\n  }\n\n  #initTab(name) {\n    if (name && this.#currentTab === name) {\n      return;\n    }\n    if (this.#currentTab) {\n      this.#tabsToAltText.get(this.#currentTab).value = this.#description.value;\n    }\n    if (name) {\n      this.#currentTab = name;\n    }\n\n    this.#errorBar.hidden = true;\n    const reset = !name;\n    if (reset) {\n      this.#resetCommon();\n    } else {\n      this.#description.value = this.#tabsToAltText.get(this.#currentTab).value;\n    }\n    this.#clearDescription.disabled = this.#description.value === \"\";\n    this.#currentTabAC?.abort();\n    this.#currentTabAC = new AbortController();\n    switch (this.#currentTab) {\n      case \"type\":\n        this.#initTypeTab(reset);\n        break;\n      case \"draw\":\n        this.#initDrawTab(reset);\n        break;\n      case \"image\":\n        this.#initImageTab(reset);\n        break;\n    }\n  }\n\n  #disableButtons(value) {\n    if (!value || !this.#isStorageFull) {\n      this.#saveCheckbox.disabled = !value;\n    }\n    this.#clearButton.disabled =\n      this.#addButton.disabled =\n      this.#description.disabled =\n        !value;\n  }\n\n  #initTypeTab(reset) {\n    if (reset) {\n      this.#resetTab(\"type\");\n    }\n\n    this.#disableButtons(this.#typeInput.value);\n\n    const { signal } = this.#currentTabAC;\n    const options = { passive: true, signal };\n    this.#typeInput.addEventListener(\n      \"input\",\n      () => {\n        const { value } = this.#typeInput;\n        if (!this.#hasDescriptionChanged) {\n          this.#tabsToAltText.get(\"type\").default = this.#description.value =\n            value;\n          this.#clearDescription.disabled = value === \"\";\n        }\n        this.#disableButtons(value);\n      },\n      options\n    );\n    this.#description.addEventListener(\n      \"input\",\n      () => {\n        this.#hasDescriptionChanged =\n          this.#typeInput.value !== this.#description.value;\n      },\n      options\n    );\n  }\n\n  #initDrawTab(reset) {\n    if (reset) {\n      this.#resetTab(\"draw\");\n    }\n\n    this.#disableButtons(this.#drawPath);\n\n    const { signal } = this.#currentTabAC;\n    const options = { signal };\n    let currentPointerId = NaN;\n    const drawCallback = e => {\n      const { pointerId } = e;\n      if (!isNaN(currentPointerId) && currentPointerId !== pointerId) {\n        return;\n      }\n      currentPointerId = pointerId;\n      e.preventDefault();\n      this.#drawSVG.setPointerCapture(pointerId);\n\n      const { width: drawWidth, height: drawHeight } =\n        this.#drawSVG.getBoundingClientRect();\n      let { offsetX, offsetY } = e;\n      offsetX = Math.round(offsetX);\n      offsetY = Math.round(offsetY);\n      if (e.target === this.#drawPlaceholder) {\n        this.#drawPlaceholder.hidden = true;\n      }\n      if (!this.#drawCurves) {\n        this.#drawCurves = {\n          width: drawWidth,\n          height: drawHeight,\n          thickness: parseInt(this.#drawThickness.value, 10),\n          curves: [],\n        };\n        this.#disableButtons(true);\n\n        const svgFactory = new DOMSVGFactory();\n        const path = (this.#drawPath = svgFactory.createElement(\"path\"));\n        path.setAttribute(\"stroke-width\", this.#drawThickness.value);\n        this.#drawSVG.append(path);\n        this.#drawSVG.addEventListener(\"pointerdown\", drawCallback, options);\n        this.#drawPlaceholder.removeEventListener(\"pointerdown\", drawCallback);\n        if (this.#description.value === \"\") {\n          this.#l10n\n            .get(SignatureManager.#l10nDescription.signature)\n            .then(description => {\n              this.#tabsToAltText.get(\"draw\").default = description;\n              this.#description.value ||= description;\n              this.#clearDescription.disabled = this.#description.value === \"\";\n            });\n        }\n      }\n\n      this.#drawPoints = [offsetX, offsetY];\n      this.#drawCurves.curves.push({ points: this.#drawPoints });\n      this.#drawPathString += `M ${offsetX} ${offsetY}`;\n      this.#drawPath.setAttribute(\"d\", this.#drawPathString);\n\n      const finishDrawAC = new AbortController();\n      const listenerDrawOptions = {\n        signal: AbortSignal.any([signal, finishDrawAC.signal]),\n      };\n      this.#drawSVG.addEventListener(\n        \"contextmenu\",\n        noContextMenu,\n        listenerDrawOptions\n      );\n      this.#drawSVG.addEventListener(\n        \"pointermove\",\n        evt => {\n          evt.preventDefault();\n          let { offsetX: x, offsetY: y } = evt;\n          x = Math.round(x);\n          y = Math.round(y);\n          const drawPoints = this.#drawPoints;\n          if (\n            x < 0 ||\n            y < 0 ||\n            x > drawWidth ||\n            y > drawHeight ||\n            (x === drawPoints.at(-2) && y === drawPoints.at(-1))\n          ) {\n            return;\n          }\n          if (drawPoints.length >= 4) {\n            const [x1, y1, x2, y2] = drawPoints.slice(-4);\n            this.#drawPathString += `C${(x1 + 5 * x2) / 6} ${(y1 + 5 * y2) / 6} ${(5 * x2 + x) / 6} ${(5 * y2 + y) / 6} ${(x2 + x) / 2} ${(y2 + y) / 2}`;\n          } else {\n            this.#drawPathString += `L${x} ${y}`;\n          }\n          drawPoints.push(x, y);\n          this.#drawPath.setAttribute(\"d\", this.#drawPathString);\n        },\n        listenerDrawOptions\n      );\n      this.#drawSVG.addEventListener(\n        \"pointerup\",\n        evt => {\n          const { pointerId: pId } = evt;\n          if (!isNaN(currentPointerId) && currentPointerId !== pId) {\n            return;\n          }\n          currentPointerId = NaN;\n          evt.preventDefault();\n          this.#drawSVG.releasePointerCapture(pId);\n          finishDrawAC.abort();\n          if (this.#drawPoints.length === 2) {\n            this.#drawPathString += `L${this.#drawPoints[0]} ${this.#drawPoints[1]}`;\n            this.#drawPath.setAttribute(\"d\", this.#drawPathString);\n          }\n        },\n        listenerDrawOptions\n      );\n    };\n    if (this.#drawCurves) {\n      this.#drawSVG.addEventListener(\"pointerdown\", drawCallback, options);\n    } else {\n      this.#drawPlaceholder.addEventListener(\n        \"pointerdown\",\n        drawCallback,\n        options\n      );\n    }\n    this.#drawThickness.addEventListener(\n      \"input\",\n      () => {\n        const { value: thickness } = this.#drawThickness;\n        this.#drawThickness.setAttribute(\n          \"data-l10n-args\",\n          JSON.stringify({ thickness })\n        );\n        if (!this.#drawCurves) {\n          return;\n        }\n        this.#drawPath.setAttribute(\"stroke-width\", thickness);\n        this.#drawCurves.thickness = thickness;\n      },\n      options\n    );\n  }\n\n  #showError(type) {\n    this.#errorTitle.setAttribute(\n      \"data-l10n-id\",\n      SignatureManager.#l10nDescription[`error${type}Title`]\n    );\n    this.#errorDescription.setAttribute(\n      \"data-l10n-id\",\n      SignatureManager.#l10nDescription[`error${type}Description`]\n    );\n    this.#errorBar.hidden = false;\n  }\n\n  #initImageTab(reset) {\n    if (reset) {\n      this.#resetTab(\"image\");\n    }\n\n    this.#disableButtons(this.#imagePath);\n\n    const { signal } = this.#currentTabAC;\n    const options = { signal };\n    const passiveOptions = { passive: true, signal };\n    this.#imagePickerLink.addEventListener(\n      \"keydown\",\n      e => {\n        const { key } = e;\n        if (key === \"Enter\" || key === \" \") {\n          stopEvent(e);\n          this.#imagePicker.click();\n        }\n      },\n      options\n    );\n    this.#imagePicker.addEventListener(\n      \"click\",\n      () => {\n        this.#dialog.classList.toggle(\"waiting\", true);\n      },\n      passiveOptions\n    );\n    this.#imagePicker.addEventListener(\n      \"change\",\n      async () => {\n        const file = this.#imagePicker.files?.[0];\n        if (!file || !SupportedImageMimeTypes.includes(file.type)) {\n          this.#showError(\"Upload\");\n          this.#dialog.classList.toggle(\"waiting\", false);\n          return;\n        }\n        await this.#extractSignature(file);\n      },\n      passiveOptions\n    );\n    this.#imagePicker.addEventListener(\n      \"cancel\",\n      () => {\n        this.#dialog.classList.toggle(\"waiting\", false);\n      },\n      passiveOptions\n    );\n    this.#imagePlaceholder.addEventListener(\n      \"dragover\",\n      e => {\n        const { dataTransfer } = e;\n        for (const { type } of dataTransfer.items) {\n          if (!SupportedImageMimeTypes.includes(type)) {\n            continue;\n          }\n          dataTransfer.dropEffect =\n            dataTransfer.effectAllowed === \"copy\" ? \"copy\" : \"move\";\n          stopEvent(e);\n          return;\n        }\n        dataTransfer.dropEffect = \"none\";\n      },\n      options\n    );\n    this.#imagePlaceholder.addEventListener(\n      \"drop\",\n      e => {\n        const {\n          dataTransfer: { files },\n        } = e;\n        if (!files?.length) {\n          return;\n        }\n        for (const file of files) {\n          if (SupportedImageMimeTypes.includes(file.type)) {\n            this.#extractSignature(file);\n            break;\n          }\n        }\n        stopEvent(e);\n        this.#dialog.classList.toggle(\"waiting\", true);\n      },\n      options\n    );\n  }\n\n  async #extractSignature(file) {\n    let data;\n    try {\n      data = await this.#uiManager.imageManager.getFromFile(file);\n    } catch (e) {\n      console.error(\"SignatureManager.#extractSignature.\", e);\n    }\n    if (!data) {\n      this.#showError(\"Upload\");\n      this.#dialog.classList.toggle(\"waiting\", false);\n      return;\n    }\n\n    const lineData = (this.#extractedSignatureData =\n      this.#currentEditor.getFromImage(data.bitmap));\n    if (!lineData) {\n      this.#showError(\"NoData\");\n      this.#dialog.classList.toggle(\"waiting\", false);\n      return;\n    }\n    const { outline } = lineData;\n\n    this.#imagePlaceholder.hidden = true;\n    this.#disableButtons(true);\n\n    const svgFactory = new DOMSVGFactory();\n    const path = (this.#imagePath = svgFactory.createElement(\"path\"));\n    this.#imageSVG.setAttribute(\"viewBox\", outline.viewBox);\n    this.#imageSVG.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n    this.#imageSVG.append(path);\n    path.setAttribute(\"d\", outline.toSVGPath());\n    this.#tabsToAltText.get(\"image\").default = file.name;\n    if (this.#description.value === \"\") {\n      this.#description.value = file.name || \"\";\n      this.#clearDescription.disabled = this.#description.value === \"\";\n    }\n\n    this.#dialog.classList.toggle(\"waiting\", false);\n  }\n\n  #getOutlineForType() {\n    return this.#currentEditor.getFromText(\n      this.#typeInput.value,\n      window.getComputedStyle(this.#typeInput)\n    );\n  }\n\n  #getOutlineForDraw() {\n    const { width, height } = this.#drawSVG.getBoundingClientRect();\n    return this.#currentEditor.getDrawnSignature(\n      this.#drawCurves,\n      width,\n      height\n    );\n  }\n\n  #reportTelemetry(data) {\n    this.#eventBus.dispatch(\"reporttelemetry\", {\n      source: this,\n      details: {\n        type: \"editing\",\n        data,\n      },\n    });\n  }\n\n  #addToolbarButton(signatureData, uuid, description) {\n    const { curves, areContours, thickness, width, height } = signatureData;\n    const maxDim = Math.max(width, height);\n    const outlineData = SignatureExtractor.processDrawnLines({\n      lines: {\n        curves,\n        thickness,\n        width,\n        height,\n      },\n      pageWidth: maxDim,\n      pageHeight: maxDim,\n      rotation: 0,\n      innerMargin: 0,\n      mustSmooth: false,\n      areContours,\n    });\n    if (!outlineData) {\n      return;\n    }\n\n    const { outline } = outlineData;\n    const svgFactory = new DOMSVGFactory();\n\n    const div = document.createElement(\"div\");\n    const button = document.createElement(\"button\");\n\n    button.addEventListener(\"click\", () => {\n      this.#eventBus.dispatch(\"switchannotationeditorparams\", {\n        source: this,\n        type: AnnotationEditorParamsType.CREATE,\n        value: {\n          signatureData: {\n            lines: {\n              curves,\n              thickness,\n              width,\n              height,\n            },\n            mustSmooth: false,\n            areContours,\n            description,\n            uuid,\n            heightInPage: DEFAULT_HEIGHT_IN_PAGE,\n          },\n        },\n      });\n    });\n    div.append(button);\n    div.classList.add(\"toolbarAddSignatureButtonContainer\");\n\n    const svg = svgFactory.create(1, 1, true);\n    button.append(svg);\n\n    const span = document.createElement(\"span\");\n    span.ariaHidden = true;\n    button.append(span);\n\n    button.classList.add(\"toolbarAddSignatureButton\");\n    button.type = \"button\";\n    span.textContent = description;\n    button.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-editor-add-saved-signature-button\"\n    );\n    button.setAttribute(\"data-l10n-args\", JSON.stringify({ description }));\n    button.tabIndex = 0;\n\n    const path = svgFactory.createElement(\"path\");\n    svg.append(path);\n    svg.setAttribute(\"viewBox\", outline.viewBox);\n    svg.setAttribute(\"preserveAspectRatio\", \"xMidYMid meet\");\n    if (areContours) {\n      path.classList.add(\"contours\");\n    }\n    path.setAttribute(\"d\", outline.toSVGPath());\n\n    const deleteButton = document.createElement(\"button\");\n    div.append(deleteButton);\n    deleteButton.classList.add(\"toolbarButton\", \"deleteButton\");\n    deleteButton.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-editor-delete-signature-button1\"\n    );\n    deleteButton.type = \"button\";\n    deleteButton.tabIndex = 0;\n    deleteButton.addEventListener(\"click\", async () => {\n      if (await this.#signatureStorage.delete(uuid)) {\n        div.remove();\n        this.#reportTelemetry({\n          type: \"signature\",\n          action: \"pdfjs.signature.delete_saved\",\n          data: {\n            savedCount: await this.#signatureStorage.size(),\n          },\n        });\n      }\n    });\n    const deleteSpan = document.createElement(\"span\");\n    deleteButton.append(deleteSpan);\n    deleteSpan.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-editor-delete-signature-button-label1\"\n    );\n\n    this.#addSignatureToolbarButton.before(div);\n  }\n\n  async #signaturesChanged() {\n    const parent = this.#addSignatureToolbarButton.parentElement;\n    while (parent.firstElementChild !== this.#addSignatureToolbarButton) {\n      parent.firstElementChild.remove();\n    }\n    this.#loadSignaturesPromise = null;\n    await this.loadSignatures(/* reload = */ true);\n  }\n\n  getSignature(params) {\n    return this.open(params);\n  }\n\n  async loadSignatures(reload = false) {\n    if (\n      !this.#addSignatureToolbarButton ||\n      (!reload && this.#addSignatureToolbarButton.previousElementSibling) ||\n      !this.#signatureStorage\n    ) {\n      return;\n    }\n\n    if (!this.#loadSignaturesPromise) {\n      // The first call of loadSignatures() starts loading the signatures.\n      // The second one will wait until the signatures are loaded in the DOM.\n      this.#loadSignaturesPromise = this.#signatureStorage\n        .getAll()\n        .then(async signatures => [\n          signatures,\n          await Promise.all(\n            Array.from(signatures.values(), ({ signatureData }) =>\n              SignatureExtractor.decompressSignature(signatureData)\n            )\n          ),\n        ]);\n      if (!reload) {\n        return;\n      }\n    }\n    const [signatures, signaturesData] = await this.#loadSignaturesPromise;\n    this.#loadSignaturesPromise = null;\n\n    let i = 0;\n    for (const [uuid, { description }] of signatures) {\n      const data = signaturesData[i++];\n      if (!data) {\n        continue;\n      }\n      data.curves = data.outlines.map(points => ({ points }));\n      delete data.outlines;\n      this.#addToolbarButton(data, uuid, description);\n    }\n  }\n\n  async renderEditButton(editor) {\n    const button = document.createElement(\"button\");\n    button.classList.add(\"altText\", \"editDescription\");\n    button.tabIndex = 0;\n    if (editor.description) {\n      button.title = editor.description;\n    }\n    const span = document.createElement(\"span\");\n    button.append(span);\n    span.setAttribute(\n      \"data-l10n-id\",\n      \"pdfjs-editor-add-signature-edit-button-label\"\n    );\n    button.addEventListener(\n      \"click\",\n      () => {\n        this.#editDescriptionDialog.open(editor);\n      },\n      { passive: true }\n    );\n    return button;\n  }\n\n  async open({ uiManager, editor }) {\n    this.#tabsToAltText ||= new Map(\n      this.#tabButtons.keys().map(name => [name, { value: \"\", default: \"\" }])\n    );\n    this.#uiManager = uiManager;\n    this.#currentEditor = editor;\n    this.#uiManager.removeEditListeners();\n\n    const isStorageFull = (this.#isStorageFull =\n      await this.#signatureStorage.isFull());\n    this.#saveContainer.classList.toggle(\"fullStorage\", isStorageFull);\n    this.#saveCheckbox.checked = !isStorageFull;\n\n    await this.#overlayManager.open(this.#dialog);\n\n    const tabType = this.#tabButtons.get(\"type\");\n    tabType.focus();\n    tabType.click();\n  }\n\n  #cancel() {\n    this.#finish();\n  }\n\n  #finish() {\n    this.#overlayManager.closeIfActive(this.#dialog);\n  }\n\n  #close() {\n    if (this.#currentEditor._drawId === null) {\n      this.#currentEditor.remove();\n    }\n    this.#uiManager?.addEditListeners();\n    this.#currentTabAC?.abort();\n    this.#currentTabAC = null;\n    this.#uiManager = null;\n    this.#currentEditor = null;\n\n    this.#resetCommon();\n    for (const [name] of this.#tabButtons) {\n      this.#resetTab(name);\n    }\n    this.#disableButtons(false);\n    this.#currentTab = null;\n    this.#tabsToAltText = null;\n  }\n\n  async #add() {\n    let data;\n    const type = this.#currentTab;\n    switch (type) {\n      case \"type\":\n        data = this.#getOutlineForType();\n        break;\n      case \"draw\":\n        data = this.#getOutlineForDraw();\n        break;\n      case \"image\":\n        data = this.#extractedSignatureData;\n        break;\n    }\n    let uuid = null;\n    const description = this.#description.value;\n    if (this.#saveCheckbox.checked) {\n      const { newCurves, areContours, thickness, width, height } = data;\n      const signatureData = await SignatureExtractor.compressSignature({\n        outlines: newCurves,\n        areContours,\n        thickness,\n        width,\n        height,\n      });\n      uuid = await this.#signatureStorage.create({\n        description,\n        signatureData,\n      });\n      if (uuid) {\n        this.#addToolbarButton(\n          {\n            curves: newCurves.map(points => ({ points })),\n            areContours,\n            thickness,\n            width,\n            height,\n          },\n          uuid,\n          description\n        );\n      } else {\n        console.warn(\"SignatureManager.add: cannot save the signature.\");\n      }\n    }\n\n    const altText = this.#tabsToAltText.get(type);\n    this.#reportTelemetry({\n      type: \"signature\",\n      action: \"pdfjs.signature.created\",\n      data: {\n        type,\n        saved: !!uuid,\n        savedCount: await this.#signatureStorage.size(),\n        descriptionChanged: description !== altText.default,\n      },\n    });\n\n    this.#currentEditor.addSignature(\n      data,\n      DEFAULT_HEIGHT_IN_PAGE,\n      this.#description.value,\n      uuid\n    );\n\n    this.#finish();\n  }\n\n  destroy() {\n    this.#uiManager = null;\n    this.#finish();\n  }\n}\n\nclass EditDescriptionDialog {\n  #currentEditor;\n\n  #previousDescription;\n\n  #description;\n\n  #dialog;\n\n  #overlayManager;\n\n  #signatureSVG;\n\n  #uiManager;\n\n  constructor(\n    { dialog, description, cancelButton, updateButton, editSignatureView },\n    overlayManager\n  ) {\n    const descriptionInput = (this.#description =\n      description.firstElementChild);\n    this.#signatureSVG = editSignatureView;\n    this.#dialog = dialog;\n    this.#overlayManager = overlayManager;\n\n    dialog.addEventListener(\"close\", this.#close.bind(this));\n    dialog.addEventListener(\"contextmenu\", e => {\n      if (e.target !== this.#description) {\n        e.preventDefault();\n      }\n    });\n    cancelButton.addEventListener(\"click\", this.#cancel.bind(this));\n    updateButton.addEventListener(\"click\", this.#update.bind(this));\n\n    const clearDescription = description.lastElementChild;\n    clearDescription.addEventListener(\"click\", () => {\n      descriptionInput.value = \"\";\n      clearDescription.disabled = true;\n      updateButton.disabled = this.#previousDescription === \"\";\n    });\n    descriptionInput.addEventListener(\n      \"input\",\n      () => {\n        const { value } = descriptionInput;\n        clearDescription.disabled = value === \"\";\n        updateButton.disabled = value === this.#previousDescription;\n        editSignatureView.setAttribute(\"aria-label\", value);\n      },\n      { passive: true }\n    );\n\n    overlayManager.register(dialog);\n  }\n\n  async open(editor) {\n    this.#uiManager = editor._uiManager;\n    this.#currentEditor = editor;\n    this.#previousDescription = this.#description.value = editor.description;\n    this.#description.dispatchEvent(new Event(\"input\"));\n    this.#uiManager.removeEditListeners();\n    const { areContours, outline } = editor.getSignaturePreview();\n    const svgFactory = new DOMSVGFactory();\n    const path = svgFactory.createElement(\"path\");\n    this.#signatureSVG.append(path);\n    this.#signatureSVG.setAttribute(\"viewBox\", outline.viewBox);\n    path.setAttribute(\"d\", outline.toSVGPath());\n    if (areContours) {\n      path.classList.add(\"contours\");\n    }\n\n    await this.#overlayManager.open(this.#dialog);\n  }\n\n  async #update() {\n    // The description has been changed because the button isn't disabled.\n    this.#currentEditor._reportTelemetry({\n      action: \"pdfjs.signature.edit_description\",\n      data: {\n        hasBeenChanged: true,\n      },\n    });\n    this.#currentEditor.description = this.#description.value;\n    this.#finish();\n  }\n\n  #cancel() {\n    this.#currentEditor._reportTelemetry({\n      action: \"pdfjs.signature.edit_description\",\n      data: {\n        hasBeenChanged: false,\n      },\n    });\n    this.#finish();\n  }\n\n  #finish() {\n    this.#overlayManager.closeIfActive(this.#dialog);\n  }\n\n  #close() {\n    this.#uiManager?.addEditListeners();\n    this.#uiManager = null;\n    this.#currentEditor = null;\n    this.#signatureSVG.firstElementChild.remove();\n  }\n}\n\nexport { SignatureManager };\n","/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n\nimport { AnnotationEditorType, ColorPicker, noContextMenu } from \"pdfjs-lib\";\nimport {\n  DEFAULT_SCALE,\n  DEFAULT_SCALE_VALUE,\n  MAX_SCALE,\n  MIN_SCALE,\n  toggleExpandedBtn,\n} from \"./ui_utils.js\";\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} editorFreeTextButton - Button to switch to\n *   FreeText editing.\n * @property {HTMLButtonElement} download - Button to download the document.\n */\n\nclass Toolbar {\n  #colorPicker = null;\n\n  #opts;\n\n  /**\n   * @param {ToolbarOptions} options\n   * @param {EventBus} eventBus\n   * @param {number} toolbarDensity - The toolbar density value.\n   *   The possible values are:\n   *    - 0 (default) - The regular toolbar size.\n   *    - 1 (compact) - The small toolbar size.\n   *    - 2 (touch) - The large toolbar size.\n   */\n  constructor(options, eventBus, toolbarDensity = 0) {\n    this.#opts = options;\n    this.eventBus = eventBus;\n    const 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.editorCommentButton,\n        eventName: \"switchannotationeditormode\",\n        eventDetails: {\n          get mode() {\n            const { classList } = options.editorCommentButton;\n            return classList.contains(\"toggled\")\n              ? AnnotationEditorType.NONE\n              : AnnotationEditorType.POPUP;\n          },\n        },\n      },\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.editorHighlightButton,\n        eventName: \"switchannotationeditormode\",\n        eventDetails: {\n          get mode() {\n            const { classList } = options.editorHighlightButton;\n            return classList.contains(\"toggled\")\n              ? AnnotationEditorType.NONE\n              : AnnotationEditorType.HIGHLIGHT;\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        element: options.editorStampButton,\n        eventName: \"switchannotationeditormode\",\n        eventDetails: {\n          get mode() {\n            const { classList } = options.editorStampButton;\n            return classList.contains(\"toggled\")\n              ? AnnotationEditorType.NONE\n              : AnnotationEditorType.STAMP;\n          },\n        },\n        telemetry: {\n          type: \"editing\",\n          data: { action: \"pdfjs.image.icon_click\" },\n        },\n      },\n      {\n        element: options.editorSignatureButton,\n        eventName: \"switchannotationeditormode\",\n        eventDetails: {\n          get mode() {\n            const { classList } = options.editorSignatureButton;\n            return classList.contains(\"toggled\")\n              ? AnnotationEditorType.NONE\n              : AnnotationEditorType.SIGNATURE;\n          },\n        },\n      },\n    ];\n\n    // Bind the event listeners for click and various other actions.\n    this.#bindListeners(buttons);\n\n    this.#updateToolbarDensity({ value: toolbarDensity });\n    this.reset();\n  }\n\n  #updateToolbarDensity({ value }) {\n    let name = \"normal\";\n    switch (value) {\n      case 1:\n        name = \"compact\";\n        break;\n      case 2:\n        name = \"touch\";\n        break;\n    }\n    document.documentElement.setAttribute(\"data-toolbar-density\", name);\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.#colorPicker = null;\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.#editorModeChanged({ mode: AnnotationEditorType.DISABLE });\n  }\n\n  #bindListeners(buttons) {\n    const { eventBus } = this;\n    const {\n      editorHighlightColorPicker,\n      editorHighlightButton,\n      pageNumber,\n      scaleSelect,\n    } = this.#opts;\n    const self = this;\n\n    // The buttons within the toolbar.\n    for (const { element, eventName, eventDetails, telemetry } of buttons) {\n      element.addEventListener(\"click\", evt => {\n        if (eventName !== null) {\n          eventBus.dispatch(eventName, {\n            source: this,\n            ...eventDetails,\n            // evt.detail is the number of clicks.\n            isFromKeyboard: evt.detail === 0,\n          });\n        }\n        if (telemetry) {\n          eventBus.dispatch(\"reporttelemetry\", {\n            source: this,\n            details: telemetry,\n          });\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      eventBus.dispatch(\"pagenumberchanged\", {\n        source: self,\n        value: this.value,\n      });\n    });\n    eventBus._on(\"pagesedited\", ({ pagesMapper }) => {\n      const pagesCount = pagesMapper.pagesNumber;\n      if (pagesCount !== this.pagesCount) {\n        this.setPagesCount(pagesCount, this.hasPageLabels);\n      }\n    });\n\n    scaleSelect.addEventListener(\"change\", function () {\n      if (this.value === \"custom\") {\n        return;\n      }\n      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 ({ 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 = noContextMenu;\n\n    eventBus._on(\n      \"annotationeditormodechanged\",\n      this.#editorModeChanged.bind(this)\n    );\n    eventBus._on(\"showannotationeditorui\", ({ mode }) => {\n      switch (mode) {\n        case AnnotationEditorType.HIGHLIGHT:\n          editorHighlightButton.click();\n          break;\n      }\n    });\n    eventBus._on(\"toolbardensity\", this.#updateToolbarDensity.bind(this));\n\n    if (editorHighlightColorPicker) {\n      eventBus._on(\"annotationeditoruimanager\", ({ uiManager }) => {\n        const cp = (this.#colorPicker = new ColorPicker({ uiManager }));\n        uiManager.setMainHighlightColorPicker(cp);\n        editorHighlightColorPicker.append(cp.renderMainDropdown());\n      });\n\n      eventBus._on(\"mainhighlightcolorpickerupdatecolor\", ({ value }) => {\n        this.#colorPicker?.updateColor(value);\n      });\n    }\n  }\n\n  #editorModeChanged({ mode }) {\n    const {\n      editorCommentButton,\n      editorCommentParamsToolbar,\n      editorFreeTextButton,\n      editorFreeTextParamsToolbar,\n      editorHighlightButton,\n      editorHighlightParamsToolbar,\n      editorInkButton,\n      editorInkParamsToolbar,\n      editorStampButton,\n      editorStampParamsToolbar,\n      editorSignatureButton,\n      editorSignatureParamsToolbar,\n    } = this.#opts;\n\n    toggleExpandedBtn(\n      editorCommentButton,\n      mode === AnnotationEditorType.POPUP,\n      editorCommentParamsToolbar\n    );\n    toggleExpandedBtn(\n      editorFreeTextButton,\n      mode === AnnotationEditorType.FREETEXT,\n      editorFreeTextParamsToolbar\n    );\n    toggleExpandedBtn(\n      editorHighlightButton,\n      mode === AnnotationEditorType.HIGHLIGHT,\n      editorHighlightParamsToolbar\n    );\n    toggleExpandedBtn(\n      editorInkButton,\n      mode === AnnotationEditorType.INK,\n      editorInkParamsToolbar\n    );\n    toggleExpandedBtn(\n      editorStampButton,\n      mode === AnnotationEditorType.STAMP,\n      editorStampParamsToolbar\n    );\n    toggleExpandedBtn(\n      editorSignatureButton,\n      mode === AnnotationEditorType.SIGNATURE,\n      editorSignatureParamsToolbar\n    );\n\n    editorCommentButton.disabled =\n      editorFreeTextButton.disabled =\n      editorHighlightButton.disabled =\n      editorInkButton.disabled =\n      editorStampButton.disabled =\n      editorSignatureButton.disabled =\n        mode === AnnotationEditorType.DISABLE;\n  }\n\n  #updateUIState(resetNumPages = false) {\n    const { pageNumber, pagesCount, pageScaleValue, pageScale } = this;\n    const opts = this.#opts;\n\n    if (resetNumPages) {\n      if (this.hasPageLabels) {\n        opts.pageNumber.type = \"text\";\n\n        opts.numPages.setAttribute(\"data-l10n-id\", \"pdfjs-page-of-pages\");\n      } else {\n        opts.pageNumber.type = \"number\";\n\n        opts.numPages.setAttribute(\"data-l10n-id\", \"pdfjs-of-pages\");\n        opts.numPages.setAttribute(\n          \"data-l10n-args\",\n          JSON.stringify({ pagesCount })\n        );\n      }\n      opts.pageNumber.max = pagesCount;\n    }\n\n    if (this.hasPageLabels) {\n      opts.pageNumber.value = this.pageLabel;\n\n      opts.numPages.setAttribute(\n        \"data-l10n-args\",\n        JSON.stringify({ pageNumber, pagesCount })\n      );\n    } else {\n      opts.pageNumber.value = pageNumber;\n    }\n\n    opts.previous.disabled = pageNumber <= 1;\n    opts.next.disabled = pageNumber >= pagesCount;\n\n    opts.zoomOut.disabled = pageScale <= MIN_SCALE;\n    opts.zoomIn.disabled = pageScale >= MAX_SCALE;\n\n    let predefinedValueFound = false;\n    for (const option of opts.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      opts.customScaleOption.selected = true;\n      opts.customScaleOption.setAttribute(\n        \"data-l10n-args\",\n        JSON.stringify({\n          scale: Math.round(pageScale * 10000) / 100,\n        })\n      );\n    }\n  }\n\n  updateLoadingIndicatorState(loading = false) {\n    const { pageNumber } = this.#opts;\n    pageNumber.classList.toggle(\"loading\", loading);\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 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils.js\").EventBus} EventBus */\n\nimport {\n  docStyle,\n  PresentationModeState,\n  SidebarView,\n  toggleExpandedBtn,\n  toggleSelectedBtn,\n} from \"./ui_utils.js\";\nimport { Menu } from \"./menu.js\";\nimport { Sidebar } from \"./sidebar.js\";\n\nconst SIDEBAR_WIDTH_VAR = \"--viewsManager-width\";\nconst SIDEBAR_RESIZING_CLASS = \"viewsManagerResizing\";\nconst UI_NOTIFICATION_CLASS = \"pdfSidebarNotification\";\n\n/**\n * @typedef {Object} PDFSidebarOptions\n * @property {PDFSidebarElements} elements - The DOM elements.\n * @property {EventBus} eventBus - The application event bus.\n * @property {L10n} 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 {HTMLDivElement} resizer - The DOM element that can be dragged in\n *   order to adjust the width of 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 {HTMLButtonElement} currentOutlineItemButton - The button used to\n *   find the current outline item.\n */\n\nclass ViewsManager extends Sidebar {\n  static #l10nDescription = null;\n\n  #hasAnimations = !window.matchMedia(\"(prefers-reduced-motion: reduce)\")\n    .matches;\n\n  /**\n   * @param {PDFSidebarOptions} options\n   */\n  constructor({\n    elements: {\n      outerContainer,\n      sidebarContainer,\n      toggleButton,\n      resizer,\n      thumbnailButton,\n      outlineButton,\n      attachmentsButton,\n      layersButton,\n      thumbnailsView,\n      outlinesView,\n      attachmentsView,\n      layersView,\n      viewsManagerAddFile: { button: viewsManagerAddFileButton },\n      viewsManagerCurrentOutlineButton,\n      viewsManagerSelectorButton,\n      viewsManagerSelectorOptions,\n      viewsManagerHeaderLabel,\n      viewsManagerStatus,\n    },\n    eventBus,\n    l10n,\n    enableMerge = false,\n    enableSplitMerge = false,\n    globalAbortSignal,\n  }) {\n    super(\n      {\n        sidebar: sidebarContainer,\n        resizer,\n        toggleButton,\n      },\n      l10n.getDirection() === \"ltr\",\n      /* isResizerOnTheLeft = */ false,\n      globalAbortSignal\n    );\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    this.onUpdateThumbnails = null;\n\n    this.outerContainer = outerContainer;\n    this.sidebarContainer = sidebarContainer;\n    this.toggleButton = toggleButton;\n    this.resizer = resizer;\n\n    this.thumbnailButton = thumbnailButton;\n    this.outlineButton = outlineButton;\n    this.attachmentsButton = attachmentsButton;\n    this.layersButton = layersButton;\n\n    this.thumbnailsView = thumbnailsView;\n    this.outlinesView = outlinesView;\n    this.attachmentsView = attachmentsView;\n    this.layersView = layersView;\n\n    this.viewsManagerAddFileButton = viewsManagerAddFileButton;\n    this.viewsManagerCurrentOutlineButton = viewsManagerCurrentOutlineButton;\n    this.viewsManagerHeaderLabel = viewsManagerHeaderLabel;\n    this.viewsManagerStatus = viewsManagerStatus;\n\n    this.eventBus = eventBus;\n\n    if (!enableSplitMerge) {\n      viewsManagerStatus.hidden = true;\n    }\n    this._enableSplitMerge = enableSplitMerge;\n    this._enableMerge = enableMerge;\n    if (!enableMerge) {\n      viewsManagerAddFileButton.hidden = true;\n    }\n\n    this.menu = new Menu(\n      viewsManagerSelectorOptions,\n      viewsManagerSelectorButton,\n      [thumbnailButton, outlineButton, attachmentsButton, layersButton]\n    );\n\n    ViewsManager.#l10nDescription ||= Object.freeze({\n      pagesTitle: \"pdfjs-views-manager-pages-title\",\n      outlinesTitle: \"pdfjs-views-manager-outlines-title1\",\n      attachmentsTitle: \"pdfjs-views-manager-attachments-title\",\n      layersTitle: \"pdfjs-views-manager-layers-title1\",\n      notificationButton: \"pdfjs-toggle-views-manager-notification-button\",\n      toggleButton: \"pdfjs-toggle-views-manager-button1\",\n    });\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 =\n      this.attachmentsButton.disabled =\n      this.layersButton.disabled =\n        false;\n    this.viewsManagerCurrentOutlineButton.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 forceRendering = false;\n    let titleL10nId = null;\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        titleL10nId = \"pagesTitle\";\n        if (this.isOpen && isViewChanged) {\n          forceRendering = true;\n        }\n        break;\n      case SidebarView.OUTLINE:\n        titleL10nId = \"outlinesTitle\";\n        if (this.outlineButton.disabled) {\n          return;\n        }\n        break;\n      case SidebarView.ATTACHMENTS:\n        titleL10nId = \"attachmentsTitle\";\n        if (this.attachmentsButton.disabled) {\n          return;\n        }\n        break;\n      case SidebarView.LAYERS:\n        titleL10nId = \"layersTitle\";\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\n    this.viewsManagerStatus.hidden =\n      !this._enableSplitMerge || view !== SidebarView.THUMBS;\n    this.viewsManagerAddFileButton.hidden =\n      !this._enableMerge || view !== SidebarView.THUMBS;\n    this.viewsManagerCurrentOutlineButton.hidden = view !== SidebarView.OUTLINE;\n    this.viewsManagerHeaderLabel.setAttribute(\n      \"data-l10n-id\",\n      ViewsManager.#l10nDescription[titleL10nId] || \"\"\n    );\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    // Update the CSS classes (and aria attributes), for all buttons and views.\n    toggleSelectedBtn(\n      this.thumbnailButton,\n      view === SidebarView.THUMBS,\n      this.thumbnailsView\n    );\n    toggleSelectedBtn(\n      this.outlineButton,\n      view === SidebarView.OUTLINE,\n      this.outlinesView\n    );\n    toggleSelectedBtn(\n      this.attachmentsButton,\n      view === SidebarView.ATTACHMENTS,\n      this.attachmentsView\n    );\n    toggleSelectedBtn(\n      this.layersButton,\n      view === SidebarView.LAYERS,\n      this.layersView\n    );\n\n    if (forceOpen && !this.isOpen) {\n      this.open();\n      return; // Opening will trigger rendering and dispatch the event.\n    }\n    if (forceRendering) {\n      this.onUpdateThumbnails();\n      this.onToggled();\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.onResizing(this.width);\n    this._sidebar.hidden = false;\n    toggleExpandedBtn(this.toggleButton, true);\n    this.switchView(this.active);\n\n    if (this.#hasAnimations) {\n      // Changing `hidden` above may cause a reflow which would prevent the\n      // CSS transition from being applied correctly, so we need to delay\n      // adding the relevant CSS classes.\n      queueMicrotask(() => {\n        this.outerContainer.classList.add(\n          \"viewsManagerMoving\",\n          \"viewsManagerOpen\"\n        );\n      });\n    } else {\n      this.outerContainer.classList.add(\"viewsManagerOpen\");\n      this.eventBus.dispatch(\"resize\", { source: this });\n    }\n    if (this.active === SidebarView.THUMBS) {\n      this.onUpdateThumbnails();\n    }\n    this.onToggled();\n    this.#dispatchEvent();\n\n    this.#hideUINotification();\n  }\n\n  close(evt = null) {\n    if (!this.isOpen) {\n      return;\n    }\n    this.isOpen = false;\n    this._sidebar.hidden = true;\n    toggleExpandedBtn(this.toggleButton, false);\n\n    this.outerContainer.classList.add(\"viewsManagerMoving\");\n    this.outerContainer.classList.remove(\"viewsManagerOpen\");\n\n    this.onToggled();\n    this.#dispatchEvent();\n\n    if (evt?.detail > 0) {\n      // Remove focus from the toggleButton if it's clicked (see issue 17361).\n      this.toggleButton.blur();\n    }\n  }\n\n  toggle(evt = null) {\n    super.toggle();\n    if (this.isOpen) {\n      this.close(evt);\n    } else {\n      this.open();\n    }\n  }\n\n  #dispatchEvent() {\n    if (this.isInitialViewSet) {\n      this.isInitialEventDispatched ||= true;\n    }\n\n    this.eventBus.dispatch(\"sidebarviewchanged\", {\n      source: this,\n      view: this.visibleView,\n    });\n  }\n\n  #showUINotification() {\n    this.toggleButton.setAttribute(\n      \"data-l10n-id\",\n      ViewsManager.#l10nDescription.notificationButton\n    );\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(\n        \"data-l10n-id\",\n        ViewsManager.#l10nDescription.toggleButton\n      );\n    }\n  }\n\n  #addEventListeners() {\n    const { eventBus, outerContainer } = this;\n\n    if (this.#hasAnimations) {\n      this.sidebarContainer.addEventListener(\"transitionend\", evt => {\n        if (evt.target === this.sidebarContainer) {\n          outerContainer.classList.remove(\"viewsManagerMoving\");\n          // Ensure that rendering is triggered after opening/closing the\n          // sidebar.\n          eventBus.dispatch(\"resize\", { source: this });\n        }\n      });\n    }\n\n    this.viewsManagerHeaderLabel.addEventListener(\"dblclick\", e => {\n      if (this.active === SidebarView.OUTLINE) {\n        eventBus.dispatch(\"toggleoutlinetree\", { source: this });\n        return;\n      }\n      if (this.active === SidebarView.LAYERS) {\n        eventBus.dispatch(\"resetlayers\", { source: this });\n      }\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\n    this.attachmentsButton.addEventListener(\"click\", () => {\n      this.switchView(SidebarView.ATTACHMENTS);\n    });\n\n    this.layersButton.addEventListener(\"click\", () => {\n      this.switchView(SidebarView.LAYERS);\n    });\n\n    // Buttons for view-specific options.\n    this.viewsManagerCurrentOutlineButton.addEventListener(\"click\", () => {\n      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    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.viewsManagerCurrentOutlineButton.disabled = !enabled;\n      });\n    });\n\n    eventBus._on(\"attachmentsloaded\", evt => {\n      onTreeLoaded(\n        evt.attachmentsCount,\n        this.attachmentsButton,\n        SidebarView.ATTACHMENTS\n      );\n    });\n\n    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    eventBus._on(\"presentationmodechanged\", evt => {\n      if (\n        evt.state === PresentationModeState.NORMAL &&\n        this.visibleView === SidebarView.THUMBS\n      ) {\n        this.onUpdateThumbnails();\n      }\n    });\n  }\n\n  onStartResizing() {\n    this.outerContainer.classList.add(SIDEBAR_RESIZING_CLASS);\n  }\n\n  onStopResizing() {\n    this.eventBus.dispatch(\"resize\", { source: this });\n    this.outerContainer.classList.remove(SIDEBAR_RESIZING_CLASS);\n  }\n\n  onResizing(newWidth) {\n    docStyle.setProperty(SIDEBAR_WIDTH_VAR, `${newWidth}px`);\n  }\n}\n\nexport { ViewsManager };\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/api.js\").PDFDocumentProxy} PDFDocumentProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/api.js\").PDFDocumentLoadingTask} PDFDocumentLoadingTask */\n\nimport {\n  animationStarted,\n  apiPageLayoutToViewerModes,\n  apiPageModeToSidebarView,\n  AutoPrintRegExp,\n  CursorTool,\n  DEFAULT_SCALE_VALUE,\n  docStyle,\n  getActiveOrFocusedElement,\n  isValidRotation,\n  isValidScrollMode,\n  isValidSpreadMode,\n  normalizeWheelEventDirection,\n  parseQueryString,\n  ProgressBar,\n  ScrollMode,\n  SidebarView,\n  SpreadMode,\n  TextLayerMode,\n} from \"./ui_utils.js\";\nimport {\n  AnnotationEditorType,\n  build,\n  FeatureTest,\n  getDocument,\n  getFilenameFromUrl,\n  getPdfFilenameFromUrl,\n  GlobalWorkerOptions,\n  InvalidPDFException,\n  isDataScheme,\n  isPdfFile,\n  OutputScale,\n  PDFWorker,\n  ResponseException,\n  shadow,\n  stopEvent,\n  TouchManager,\n  updateUrlHash,\n  version,\n} from \"pdfjs-lib\";\nimport { AppOptions, OptionKind } from \"./app_options.js\";\nimport { EventBus, FirefoxEventBus } from \"./event_utils.js\";\nimport { ExternalServices, initCom, MLManager } from \"web-external_services\";\nimport {\n  ImageAltTextSettings,\n  NewAltTextManager,\n} from \"web-new_alt_text_manager\";\nimport { LinkTarget, PDFLinkService } from \"./pdf_link_service.js\";\nimport { AltTextManager } from \"web-alt_text_manager\";\nimport { AnnotationEditorParams } from \"web-annotation_editor_params\";\nimport { CaretBrowsingMode } from \"./caret_browsing.js\";\nimport { CommentManager } from \"./comment_manager.js\";\nimport { DownloadManager } from \"web-download_manager\";\nimport { EditorUndoBar } from \"./editor_undo_bar.js\";\nimport { OverlayManager } from \"./overlay_manager.js\";\nimport { PasswordPrompt } from \"./password_prompt.js\";\nimport { PDFAttachmentViewer } from \"web-pdf_attachment_viewer\";\nimport { PDFCursorTools } from \"web-pdf_cursor_tools\";\nimport { PDFDocumentProperties } from \"web-pdf_document_properties\";\nimport { PDFFindBar } from \"web-pdf_find_bar\";\nimport { PDFFindController } from \"./pdf_find_controller.js\";\nimport { PDFHistory } from \"./pdf_history.js\";\nimport { PDFLayerViewer } from \"web-pdf_layer_viewer\";\nimport { PDFOutlineViewer } from \"web-pdf_outline_viewer\";\nimport { PDFPresentationMode } from \"web-pdf_presentation_mode\";\nimport { PDFPrintServiceFactory } from \"web-print_service\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\nimport { PdfTextExtractor } from \"./pdf_text_extractor.js\";\nimport { PDFThumbnailViewer } from \"web-pdf_thumbnail_viewer\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\nimport { Preferences } from \"web-preferences\";\nimport { RenderingStates } from \"./renderable_view.js\";\nimport { SecondaryToolbar } from \"web-secondary_toolbar\";\nimport { SignatureManager } from \"web-signature_manager\";\nimport { Toolbar } from \"web-toolbar\";\nimport { ViewHistory } from \"./view_history.js\";\nimport { ViewsManager } from \"web-views_manager\";\n\nconst FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms\n\nconst ViewOnLoad = {\n  UNKNOWN: -1,\n  PREVIOUS: 0, // Default value.\n  INITIAL: 1,\n};\n\nconst PDFViewerApplication = {\n  initialBookmark: document.location.hash.substring(1),\n  _initializedCapability: {\n    ...Promise.withResolvers(),\n    settled: false,\n  },\n  appConfig: null,\n  /** @type {PDFDocumentProxy} */\n  pdfDocument: null,\n  /** @type {PDFDocumentLoadingTask} */\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 {PdfTextExtractor|null} */\n  pdfTextExtractor: null,\n  /** @type {PDFHistory} */\n  pdfHistory: null,\n  /** @type {ViewsManager} */\n  viewsManager: 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: new Preferences(),\n  /** @type {Toolbar} */\n  toolbar: null,\n  /** @type {SecondaryToolbar} */\n  secondaryToolbar: null,\n  /** @type {EventBus} */\n  eventBus: null,\n  /** @type {L10n} */\n  l10n: null,\n  /** @type {AnnotationEditorParams} */\n  annotationEditorParams: null,\n  /** @type {ImageAltTextSettings} */\n  imageAltTextSettings: null,\n  isInitialViewSet: false,\n  isViewerEmbedded: window.parent !== window,\n  url: \"\",\n  baseUrl: \"\",\n  mlManager: null,\n  _downloadUrl: \"\",\n  _eventBusAbortController: null,\n  _windowAbortController: null,\n  _globalAbortController: new AbortController(),\n  documentInfo: null,\n  metadata: null,\n  _contentDispositionFilename: null,\n  _contentLength: null,\n  _saveInProgress: false,\n  _wheelUnusedTicks: 0,\n  _wheelUnusedFactor: 1,\n  _touchManager: null,\n  _touchUnusedTicks: 0,\n  _touchUnusedFactor: 1,\n  _PDFBug: null,\n  _hasAnnotationEditors: false,\n  _title: document.title,\n  _printAnnotationStoragePromise: null,\n  _isCtrlKeyDown: false,\n  _caretBrowsing: null,\n  _isScrolling: false,\n  editorUndoBar: null,\n  _printPermissionPromise: null,\n\n  // Called once when the document is loaded.\n  async initialize(appConfig) {\n    this.appConfig = appConfig;\n\n    // Ensure that `Preferences`, and indirectly `AppOptions`, have initialized\n    // before creating e.g. the various viewer components.\n    try {\n      await this.preferences.initializedPromise;\n    } catch (ex) {\n      console.error(\"initialize:\", ex);\n    }\n    if (AppOptions.get(\"pdfBugEnabled\")) {\n      await this._parseHashParams();\n    }\n\n    let mode;\n    switch (AppOptions.get(\"viewerCssTheme\")) {\n      case 1:\n        mode = \"light\";\n        break;\n      case 2:\n        mode = \"dark\";\n        break;\n    }\n    if (mode) {\n      docStyle.setProperty(\"color-scheme\", mode);\n    }\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n      if (AppOptions.get(\"enableFakeMLManager\")) {\n        this.mlManager =\n          MLManager.getFakeMLManager?.({\n            enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n            enableAltTextModelDownload: AppOptions.get(\n              \"enableAltTextModelDownload\"\n            ),\n          }) || null;\n      }\n    } else if (PDFJSDev.test(\"MOZCENTRAL\")) {\n      if (AppOptions.get(\"enableAltText\")) {\n        // We want to load the image-to-text AI engine as soon as possible.\n        this.mlManager = new MLManager({\n          enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n          enableAltTextModelDownload: AppOptions.get(\n            \"enableAltTextModelDownload\"\n          ),\n          altTextLearnMoreUrl: AppOptions.get(\"altTextLearnMoreUrl\"),\n        });\n      }\n    }\n\n    // Ensure that the `L10n`-instance has been initialized before creating\n    // e.g. the various viewer components.\n    this.l10n = await this.externalServices.createL10n();\n    document.getElementsByTagName(\"html\")[0].dir = this.l10n.getDirection();\n    // Connect Fluent, when necessary, and translate what we already have.\n    if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n      this.l10n.translate(appConfig.appContainer || document.documentElement);\n    }\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    this._initializedCapability.settled = true;\n    this._initializedCapability.resolve();\n  },\n\n  /**\n   * Potentially parse special debugging flags in the hash section of the URL.\n   * @private\n   */\n  async _parseHashParams() {\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    const loadPDFBug = async () => {\n      if (this._PDFBug) {\n        return;\n      }\n      const { PDFBug } =\n        typeof PDFJSDev === \"undefined\"\n          ? await import(AppOptions.get(\"debuggerSrc\")) // eslint-disable-line no-unsanitized/method\n          : await __raw_import__(AppOptions.get(\"debuggerSrc\"));\n\n      this._PDFBug = PDFBug;\n    };\n\n    // Parameters that need to be handled manually.\n    if (params.get(\"disableworker\") === \"true\") {\n      try {\n        GlobalWorkerOptions.workerSrc ||= AppOptions.get(\"workerSrc\");\n\n        typeof PDFJSDev === \"undefined\" // eslint-disable-line no-unused-expressions\n          ? await import(\"pdfjs/pdf.worker.js\")\n          : await __raw_import__(PDFWorker.workerSrc);\n\n        // Ensure that the \"fake\" worker won't be ignored.\n        AppOptions.set(\"workerPort\", null);\n      } catch (ex) {\n        console.error(\"_parseHashParams:\", ex);\n      }\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();\n            this._PDFBug.loadCSS();\n          } catch (ex) {\n            console.error(\"_parseHashParams:\", ex);\n          }\n          break;\n      }\n    }\n    if (params.has(\"pdfbug\")) {\n      const enabled = params.get(\"pdfbug\").split(\",\");\n      try {\n        await loadPDFBug();\n        this._PDFBug.init(mainContainer, enabled);\n      } catch (ex) {\n        console.error(\"_parseHashParams:\", ex);\n      }\n\n      const debugOpts = { pdfBug: true, fontExtraProperties: true };\n      if (globalThis.StepperManager?.enabled) {\n        debugOpts.minDurationToUpdateCanvas = 0;\n      }\n      AppOptions.setAll(debugOpts);\n    }\n    // It is not possible to change locale for the (various) extension builds.\n    if (\n      (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n      params.has(\"locale\")\n    ) {\n      AppOptions.set(\"localeProperties\", { lang: params.get(\"locale\") });\n    }\n\n    // Parameters that can be handled automatically.\n    const opts = {\n      disableAutoFetch: x => x === \"true\",\n      disableFontFace: x => x === \"true\",\n      disableHistory: x => x === \"true\",\n      disableRange: x => x === \"true\",\n      disableStream: x => x === \"true\",\n      verbosity: x => x | 0,\n    };\n\n    // Set some specific preferences for tests.\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n      Object.assign(opts, {\n        capCanvasAreaFactor: x => parseInt(x, 10),\n        docBaseUrl: x => x,\n        enableAltText: x => x === \"true\",\n        enableAutoLinking: x => x === \"true\",\n        enableComment: x => x === \"true\",\n        enableFakeMLManager: x => x === \"true\",\n        enableGuessAltText: x => x === \"true\",\n        enableNewBadge: x => x === \"true\",\n        enablePermissions: x => x === \"true\",\n        enableMerge: x => x === \"true\",\n        enableSplitMerge: x => x === \"true\",\n        enableUpdatedAddImage: x => x === \"true\",\n        highlightEditorColors: x => x,\n        imagesRightClickMinSize: x => parseInt(x, 10),\n        maxCanvasPixels: x => parseInt(x, 10),\n        spreadModeOnLoad: x => parseInt(x, 10),\n        supportsCaretBrowsingMode: x => x === \"true\",\n        viewerCssTheme: x => parseInt(x, 10),\n        forcePageColors: x => x === \"true\",\n        pageColorsBackground: x => x,\n        pageColorsForeground: x => x,\n        sidebarViewOnLoad: x => parseInt(x, 10),\n      });\n    }\n\n    for (const name in opts) {\n      const check = opts[name],\n        key = name.toLowerCase();\n\n      if (params.has(key)) {\n        AppOptions.set(name, check(params.get(key)));\n      }\n    }\n  },\n\n  /**\n   * @private\n   */\n  async _initializeViewerComponents() {\n    const { appConfig, externalServices, l10n, mlManager } = this;\n    const abortSignal = this._globalAbortController.signal;\n\n    const eventBus =\n      typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n        ? new FirefoxEventBus(\n            AppOptions.get(\"allowedGlobalEvents\"),\n            externalServices,\n            AppOptions.get(\"isInAutomation\")\n          )\n        : new EventBus();\n    this.eventBus = AppOptions.eventBus = eventBus;\n\n    mlManager?.setEventBus(eventBus, abortSignal);\n\n    const overlayManager = (this.overlayManager = new OverlayManager());\n\n    const renderingQueue = (this.pdfRenderingQueue = new PDFRenderingQueue());\n    renderingQueue.onIdle = this._cleanup.bind(this);\n\n    const linkService = (this.pdfLinkService = new PDFLinkService({\n      eventBus,\n      externalLinkTarget: AppOptions.get(\"externalLinkTarget\"),\n      externalLinkRel: AppOptions.get(\"externalLinkRel\"),\n      ignoreDestinationZoom: AppOptions.get(\"ignoreDestinationZoom\"),\n    }));\n\n    const downloadManager = (this.downloadManager = new DownloadManager());\n\n    const findController = (this.findController = new PDFFindController({\n      linkService,\n      eventBus,\n      updateMatchesCountOnProgress:\n        typeof PDFJSDev === \"undefined\"\n          ? !window.isGECKOVIEW\n          : !PDFJSDev.test(\"GECKOVIEW\"),\n    }));\n\n    const pdfScriptingManager = (this.pdfScriptingManager =\n      new PDFScriptingManager({\n        eventBus,\n        externalServices,\n        docProperties: this._scriptingDocProperties.bind(this),\n      }));\n\n    const container = appConfig.mainContainer,\n      viewer = appConfig.viewerContainer;\n    const annotationEditorMode = AppOptions.get(\"annotationEditorMode\");\n    const hasForcedColors =\n      AppOptions.get(\"forcePageColors\") ||\n      window.matchMedia(\"(forced-colors: active)\").matches;\n    const pageColors = hasForcedColors\n      ? {\n          background: AppOptions.get(\"pageColorsBackground\"),\n          foreground: AppOptions.get(\"pageColorsForeground\"),\n        }\n      : null;\n    const enableMerge = AppOptions.get(\"enableMerge\");\n    const enableSplitMerge = AppOptions.get(\"enableSplitMerge\");\n\n    let altTextManager;\n    if (AppOptions.get(\"enableUpdatedAddImage\")) {\n      altTextManager = appConfig.newAltTextDialog\n        ? new NewAltTextManager(\n            appConfig.newAltTextDialog,\n            overlayManager,\n            eventBus\n          )\n        : null;\n    } else {\n      altTextManager = appConfig.altTextDialog\n        ? new AltTextManager(\n            appConfig.altTextDialog,\n            container,\n            overlayManager,\n            eventBus\n          )\n        : null;\n    }\n\n    if (appConfig.editorUndoBar) {\n      this.editorUndoBar = new EditorUndoBar(appConfig.editorUndoBar, eventBus);\n    }\n\n    const signatureManager =\n      AppOptions.get(\"enableSignatureEditor\") && appConfig.addSignatureDialog\n        ? new SignatureManager(\n            appConfig.addSignatureDialog,\n            appConfig.editSignatureDialog,\n            appConfig.annotationEditorParams?.editorSignatureAddSignature ||\n              null,\n            overlayManager,\n            l10n,\n            externalServices.createSignatureStorage(eventBus, abortSignal),\n            eventBus\n          )\n        : null;\n\n    const commentManager =\n      AppOptions.get(\"enableComment\") && appConfig.editCommentDialog\n        ? new CommentManager(\n            appConfig.editCommentDialog,\n            {\n              learnMoreUrl: AppOptions.get(\"commentLearnMoreUrl\"),\n              sidebar:\n                appConfig.annotationEditorParams?.editorCommentsSidebar || null,\n              sidebarResizer:\n                appConfig.annotationEditorParams\n                  ?.editorCommentsSidebarResizer || null,\n              commentsList:\n                appConfig.annotationEditorParams?.editorCommentsSidebarList ||\n                null,\n              commentCount:\n                appConfig.annotationEditorParams?.editorCommentsSidebarCount ||\n                null,\n              sidebarTitle:\n                appConfig.annotationEditorParams?.editorCommentsSidebarTitle ||\n                null,\n              closeButton:\n                appConfig.annotationEditorParams\n                  ?.editorCommentsSidebarCloseButton || null,\n              commentToolbarButton:\n                appConfig.toolbar?.editorCommentButton || null,\n            },\n            eventBus,\n            linkService,\n            overlayManager,\n            /* ltr = */ l10n.getDirection() === \"ltr\",\n            hasForcedColors,\n            abortSignal\n          )\n        : null;\n\n    const maxCanvasPixels = AppOptions.get(\"maxCanvasPixels\"),\n      maxCanvasDim = AppOptions.get(\"maxCanvasDim\"),\n      capCanvasAreaFactor = AppOptions.get(\"capCanvasAreaFactor\");\n    const pdfViewer = (this.pdfViewer = new PDFViewer({\n      container,\n      viewer,\n      viewerAlert: appConfig.viewerAlert,\n      eventBus,\n      renderingQueue,\n      linkService,\n      downloadManager,\n      altTextManager,\n      commentManager,\n      signatureManager,\n      editorUndoBar: this.editorUndoBar,\n      findController,\n      scriptingManager:\n        AppOptions.get(\"enableScripting\") && pdfScriptingManager,\n      l10n,\n      textLayerMode: AppOptions.get(\"textLayerMode\"),\n      annotationMode: AppOptions.get(\"annotationMode\"),\n      annotationEditorMode,\n      annotationEditorHighlightColors: AppOptions.get(\"highlightEditorColors\"),\n      enableHighlightFloatingButton: AppOptions.get(\n        \"enableHighlightFloatingButton\"\n      ),\n      enableUpdatedAddImage: AppOptions.get(\"enableUpdatedAddImage\"),\n      enableNewAltTextWhenAddingImage: AppOptions.get(\n        \"enableNewAltTextWhenAddingImage\"\n      ),\n      imageResourcesPath: AppOptions.get(\"imageResourcesPath\"),\n      enablePrintAutoRotate: AppOptions.get(\"enablePrintAutoRotate\"),\n      maxCanvasPixels,\n      maxCanvasDim,\n      capCanvasAreaFactor,\n      enableDetailCanvas: AppOptions.get(\"enableDetailCanvas\"),\n      enablePermissions: AppOptions.get(\"enablePermissions\"),\n      enableOptimizedPartialRendering: AppOptions.get(\n        \"enableOptimizedPartialRendering\"\n      ),\n      imagesRightClickMinSize: AppOptions.get(\"imagesRightClickMinSize\"),\n      pageColors,\n      mlManager,\n      abortSignal,\n      supportsPinchToZoom: this.supportsPinchToZoom,\n      enableAutoLinking: AppOptions.get(\"enableAutoLinking\"),\n      minDurationToUpdateCanvas: AppOptions.get(\"minDurationToUpdateCanvas\"),\n    }));\n\n    renderingQueue.setViewer(pdfViewer);\n    linkService.setViewer(pdfViewer);\n    pdfScriptingManager.setViewer(pdfViewer);\n\n    if (appConfig.viewsManager?.thumbnailsView) {\n      const { viewsManager } = appConfig;\n      this.pdfThumbnailViewer = new PDFThumbnailViewer({\n        container: viewsManager.thumbnailsView,\n        eventBus,\n        renderingQueue,\n        linkService,\n        maxCanvasPixels,\n        maxCanvasDim,\n        pageColors,\n        abortSignal,\n        enableSplitMerge,\n        enableMerge,\n        enableNewBadge: AppOptions.get(\"enableNewBadge\"),\n        statusBar: viewsManager.viewsManagerStatusBar,\n        undoBar: viewsManager.viewsManagerUndoBar,\n        manageMenu: viewsManager.manageMenu,\n        waitingBar: viewsManager.viewsManagerWaitingBar,\n        addFileComponent: viewsManager.viewsManagerAddFile,\n      });\n      renderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);\n    }\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,\n        eventBus,\n      });\n      linkService.setHistory(this.pdfHistory);\n    }\n\n    if (!this.supportsIntegratedFind && appConfig.findBar) {\n      this.findBar = new PDFFindBar(\n        appConfig.findBar,\n        appConfig.principalContainer,\n        eventBus\n      );\n    }\n\n    if (appConfig.annotationEditorParams) {\n      if (annotationEditorMode !== AnnotationEditorType.DISABLE) {\n        const editorSignatureButton = appConfig.toolbar?.editorSignatureButton;\n        if (editorSignatureButton && AppOptions.get(\"enableSignatureEditor\")) {\n          editorSignatureButton.parentElement.hidden = false;\n        }\n        const editorCommentButton = appConfig.toolbar?.editorCommentButton;\n        if (editorCommentButton && AppOptions.get(\"enableComment\")) {\n          editorCommentButton.parentElement.hidden = false;\n        }\n        this.annotationEditorParams = new AnnotationEditorParams(\n          appConfig.annotationEditorParams,\n          eventBus\n        );\n      } else {\n        for (const id of [\"editorModeButtons\", \"editorModeSeparator\"]) {\n          document.getElementById(id)?.classList.add(\"hidden\");\n        }\n      }\n    }\n\n    if (mlManager && appConfig.secondaryToolbar?.imageAltTextSettingsButton) {\n      this.imageAltTextSettings = new ImageAltTextSettings(\n        appConfig.altTextSettingsDialog,\n        overlayManager,\n        eventBus,\n        mlManager\n      );\n    }\n\n    if (appConfig.documentProperties) {\n      this.pdfDocumentProperties = new PDFDocumentProperties(\n        appConfig.documentProperties,\n        overlayManager,\n        eventBus,\n        l10n,\n        /* fileNameLookup = */ () => this._docFilename,\n        /* titleLookup = */ () => this._docTitle\n      );\n    }\n\n    // NOTE: The cursor-tools are unlikely to be helpful/useful in GeckoView,\n    // in particular the `HandTool` which basically simulates touch scrolling.\n    if (appConfig.secondaryToolbar?.cursorHandToolButton) {\n      this.pdfCursorTools = new PDFCursorTools({\n        container,\n        eventBus,\n        cursorToolOnLoad: AppOptions.get(\"cursorToolOnLoad\"),\n      });\n    }\n\n    if (appConfig.toolbar) {\n      if (\n        typeof PDFJSDev === \"undefined\"\n          ? window.isGECKOVIEW\n          : PDFJSDev.test(\"GECKOVIEW\")\n      ) {\n        const nimbusData = JSON.parse(\n          AppOptions.get(\"nimbusDataStr\") || \"null\"\n        );\n        this.toolbar = new Toolbar(appConfig.toolbar, eventBus, nimbusData);\n      } else {\n        this.toolbar = new Toolbar(\n          appConfig.toolbar,\n          eventBus,\n          AppOptions.get(\"toolbarDensity\")\n        );\n      }\n    }\n\n    if (appConfig.secondaryToolbar) {\n      if (AppOptions.get(\"enableAltText\")) {\n        appConfig.secondaryToolbar.imageAltTextSettingsButton?.classList.remove(\n          \"hidden\"\n        );\n        appConfig.secondaryToolbar.imageAltTextSettingsSeparator?.classList.remove(\n          \"hidden\"\n        );\n      }\n\n      this.secondaryToolbar = new SecondaryToolbar(\n        appConfig.secondaryToolbar,\n        eventBus\n      );\n    }\n\n    if (\n      this.supportsFullscreen &&\n      appConfig.secondaryToolbar?.presentationModeButton\n    ) {\n      this.pdfPresentationMode = new PDFPresentationMode({\n        container,\n        pdfViewer,\n        eventBus,\n      });\n    }\n\n    if (appConfig.passwordOverlay) {\n      this.passwordPrompt = new PasswordPrompt(\n        appConfig.passwordOverlay,\n        overlayManager,\n        this.isViewerEmbedded\n      );\n    }\n\n    if (appConfig.viewsManager?.outlinesView) {\n      this.pdfOutlineViewer = new PDFOutlineViewer({\n        container: appConfig.viewsManager.outlinesView,\n        eventBus,\n        l10n,\n        linkService,\n        downloadManager,\n      });\n    }\n\n    if (appConfig.viewsManager?.attachmentsView) {\n      this.pdfAttachmentViewer = new PDFAttachmentViewer({\n        container: appConfig.viewsManager.attachmentsView,\n        eventBus,\n        l10n,\n        downloadManager,\n      });\n    }\n\n    if (appConfig.viewsManager?.layersView) {\n      this.pdfLayerViewer = new PDFLayerViewer({\n        container: appConfig.viewsManager.layersView,\n        eventBus,\n        l10n,\n      });\n    }\n\n    if (appConfig.viewsManager) {\n      this.viewsManager = new ViewsManager({\n        elements: appConfig.viewsManager,\n        eventBus,\n        l10n,\n        enableMerge,\n        enableSplitMerge,\n        globalAbortSignal: abortSignal,\n      });\n      this.viewsManager.onToggled = this.forceRendering.bind(this);\n      this.viewsManager.onUpdateThumbnails = () => {\n        // Use the rendered pages to set the corresponding thumbnail images.\n        for (const pageView of pdfViewer.getCachedPageViews()) {\n          if (pageView.renderingState === RenderingStates.FINISHED) {\n            this.pdfThumbnailViewer\n              .getThumbnail(pageView.id - 1)\n              ?.setImage(pageView);\n          }\n        }\n        this.pdfThumbnailViewer.scrollThumbnailIntoView(\n          pdfViewer.currentPageNumber\n        );\n      };\n    }\n\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      PDFJSDev.test(\"TESTING || MOZCENTRAL\")\n    ) {\n      this.pdfTextExtractor = new PdfTextExtractor(\n        externalServices,\n        pdfViewer,\n        eventBus\n      );\n    }\n  },\n\n  async run(config) {\n    await this.initialize(config);\n\n    const { appConfig, eventBus } = this;\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      try {\n        file = new URL(file).href;\n      } catch {\n        file = encodeURIComponent(file).replaceAll(\"%2F\", \"/\");\n      }\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 = (this._openFileInput = document.createElement(\"input\"));\n      fileInput.id = \"fileInput\";\n      fileInput.hidden = true;\n      fileInput.type = \"file\";\n      fileInput.value = null;\n      document.body.append(fileInput);\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        for (const item of evt.dataTransfer.items) {\n          if (item.type === \"application/pdf\") {\n            evt.dataTransfer.dropEffect =\n              evt.dataTransfer.effectAllowed === \"copy\" ? \"copy\" : \"move\";\n            stopEvent(evt);\n            return;\n          }\n        }\n      });\n      appConfig.mainContainer.addEventListener(\"drop\", function (evt) {\n        if (evt.dataTransfer.files?.[0].type !== \"application/pdf\") {\n          return;\n        }\n        stopEvent(evt);\n        eventBus.dispatch(\"fileinputchange\", {\n          source: this,\n          fileInput: evt.dataTransfer,\n        });\n      });\n    }\n\n    if (!AppOptions.get(\"supportsDocumentFonts\")) {\n      AppOptions.set(\"disableFontFace\", true);\n      this.l10n.get(\"pdfjs-web-fonts-disabled\").then(msg => {\n        console.warn(msg);\n      });\n    }\n\n    const togglePrintingButtons = visible => {\n      appConfig.toolbar?.print?.classList.toggle(\"hidden\", !visible);\n      appConfig.secondaryToolbar?.printButton.classList.toggle(\n        \"hidden\",\n        !visible\n      );\n    };\n    if (!this.supportsPrinting) {\n      togglePrintingButtons(false);\n    } else {\n      eventBus.on(\"printingallowed\", ({ isAllowed }) =>\n        togglePrintingButtons(isAllowed)\n      );\n    }\n\n    if (!this.supportsFullscreen) {\n      appConfig.secondaryToolbar?.presentationModeButton.classList.add(\n        \"hidden\"\n      );\n    }\n\n    if (this.supportsIntegratedFind) {\n      appConfig.findBar?.toggleButton?.classList.add(\"hidden\");\n    }\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      if (file) {\n        this.open({ url: file });\n      } else {\n        this._hideViewBookmark();\n      }\n    } else if (PDFJSDev.test(\"MOZCENTRAL || CHROME\")) {\n      this.setTitleUsingUrl(file, /* downloadUrl = */ file);\n\n      this.externalServices.initPassiveLoading();\n    } else {\n      throw new Error(\"Not implemented: run\");\n    }\n  },\n\n  get externalServices() {\n    return shadow(this, \"externalServices\", new ExternalServices());\n  },\n\n  get initialized() {\n    return this._initializedCapability.settled;\n  },\n\n  get initializedPromise() {\n    return this._initializedCapability.promise;\n  },\n\n  updateZoom(steps, scaleFactor, origin) {\n    if (this.pdfViewer.isInPresentationMode) {\n      return;\n    }\n    this.pdfViewer.updateScale({\n      drawingDelay: AppOptions.get(\"defaultZoomDelay\"),\n      steps,\n      scaleFactor,\n      origin,\n    });\n  },\n\n  zoomIn() {\n    this.updateZoom(1);\n  },\n\n  zoomOut() {\n    this.updateZoom(-1);\n  },\n\n  zoomReset() {\n    if (this.pdfViewer.isInPresentationMode) {\n      return;\n    }\n    this.pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;\n  },\n\n  touchPinchCallback(origin, prevDistance, distance) {\n    if (this.supportsPinchToZoom) {\n      const newScaleFactor = this._accumulateFactor(\n        this.pdfViewer.currentScale,\n        distance / prevDistance,\n        \"_touchUnusedFactor\"\n      );\n      this.updateZoom(null, newScaleFactor, origin);\n    } else {\n      const PIXELS_PER_LINE_SCALE = 30;\n      const ticks = this._accumulateTicks(\n        (distance - prevDistance) / PIXELS_PER_LINE_SCALE,\n        \"_touchUnusedTicks\"\n      );\n      this.updateZoom(ticks, null, origin);\n    }\n  },\n\n  touchPinchEndCallback() {\n    this._touchUnusedTicks = 0;\n    this._touchUnusedFactor = 1;\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 shadow(\n      this,\n      \"supportsPrinting\",\n      AppOptions.get(\"supportsPrinting\") &&\n        PDFPrintServiceFactory.supportsPrinting\n    );\n  },\n\n  get supportsFullscreen() {\n    return shadow(this, \"supportsFullscreen\", document.fullscreenEnabled);\n  },\n\n  get supportsPinchToZoom() {\n    return shadow(\n      this,\n      \"supportsPinchToZoom\",\n      AppOptions.get(\"supportsPinchToZoom\")\n    );\n  },\n\n  get supportsIntegratedFind() {\n    return shadow(\n      this,\n      \"supportsIntegratedFind\",\n      AppOptions.get(\"supportsIntegratedFind\")\n    );\n  },\n\n  get loadingBar() {\n    const barElement = document.getElementById(\"loadingBar\");\n    const bar = barElement ? new ProgressBar(barElement) : null;\n    return shadow(this, \"loadingBar\", bar);\n  },\n\n  get supportsMouseWheelZoomCtrlKey() {\n    return shadow(\n      this,\n      \"supportsMouseWheelZoomCtrlKey\",\n      AppOptions.get(\"supportsMouseWheelZoomCtrlKey\")\n    );\n  },\n\n  get supportsMouseWheelZoomMetaKey() {\n    return shadow(\n      this,\n      \"supportsMouseWheelZoomMetaKey\",\n      AppOptions.get(\"supportsMouseWheelZoomMetaKey\")\n    );\n  },\n\n  get supportsCaretBrowsingMode() {\n    return AppOptions.get(\"supportsCaretBrowsingMode\");\n  },\n\n  moveCaret(isUp, select) {\n    this._caretBrowsing ||= new CaretBrowsingMode(\n      this._globalAbortController.signal,\n      this.appConfig.mainContainer,\n      this.appConfig.viewerContainer,\n      this.appConfig.toolbar?.container\n    );\n    this._caretBrowsing.moveCaret(isUp, select);\n  },\n\n  setTitleUsingUrl(url = \"\", downloadUrl = null) {\n    this.url = url;\n    this.baseUrl =\n      typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n        ? updateUrlHash(url, \"\", /* allowRel = */ true)\n        : updateUrlHash(url, \"\");\n    if (downloadUrl) {\n      this._downloadUrl =\n        // eslint-disable-next-line no-nested-ternary\n        downloadUrl === url\n          ? this.baseUrl\n          : typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n            ? updateUrlHash(downloadUrl, \"\", /* allowRel = */ true)\n            : updateUrlHash(downloadUrl, \"\");\n    }\n    if (isDataScheme(url)) {\n      this._hideViewBookmark();\n    } else if (\n      typeof PDFJSDev !== \"undefined\" &&\n      PDFJSDev.test(\"MOZCENTRAL || CHROME\")\n    ) {\n      AppOptions.set(\"docBaseUrl\", this.baseUrl);\n    }\n\n    let title = getPdfFilenameFromUrl(url, \"\");\n    if (!title) {\n      try {\n        title = decodeURIComponent(getFilenameFromUrl(url));\n      } catch {\n        // decodeURIComponent may throw URIError.\n      }\n    }\n    this.setTitle(title || url); // Always fallback to the raw URL.\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 hasChangesIndicator =\n      this._hasChanges() && !this.pdfRenderingQueue.printing;\n    document.title = `${hasChangesIndicator ? \"* \" : \"\"}${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  get _docTitle() {\n    const { documentInfo, metadata } = this;\n\n    const title = metadata?.get(\"dc:title\");\n    if (title) {\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 (title !== \"Untitled\" && !/[\\uFFF0-\\uFFFF]/g.test(title)) {\n        return title;\n      }\n    }\n    return documentInfo.Title;\n  },\n\n  /**\n   * @private\n   */\n  _hideViewBookmark() {\n    const { secondaryToolbar } = this.appConfig;\n    // URL does not reflect proper document location - hiding some buttons.\n    secondaryToolbar?.viewBookmarkButton.classList.add(\"hidden\");\n\n    // Avoid displaying multiple consecutive separators in the secondaryToolbar.\n    if (secondaryToolbar?.presentationModeButton.classList.contains(\"hidden\")) {\n      document.getElementById(\"viewBookmarkSeparator\")?.classList.add(\"hidden\");\n    }\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\" ||\n        PDFJSDev.test(\"GENERIC && !TESTING\")) &&\n      this._hasChanges() &&\n      this._annotationStorageModified\n    ) {\n      try {\n        // Trigger saving, to prevent data loss in forms; see issue 12257.\n        await this.downloadOrSave();\n      } catch {\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.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._hasAnnotationEditors = false;\n\n    promises.push(\n      this.pdfScriptingManager.destroyPromise,\n      this.passwordPrompt.close()\n    );\n\n    this.setTitle();\n    this.viewsManager?.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 a new PDF document.\n   * @param {Object} args - Accepts any/all of the properties from\n   *   {@link DocumentInitParameters}, and also a `originalUrl` string.\n   * @returns {Promise} - Promise that is resolved when the document is opened.\n   */\n  async open(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 workerParams = AppOptions.getAll(OptionKind.WORKER);\n    Object.assign(GlobalWorkerOptions, workerParams);\n\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      if (args.data && isPdfFile(args.filename)) {\n        this._contentDispositionFilename = args.filename;\n      }\n    } else if (args.url) {\n      // The Firefox built-in viewer always calls `setTitleUsingUrl`, before\n      // `initPassiveLoading`, and it never provides an `originalUrl` here.\n      this.setTitleUsingUrl(\n        args.originalUrl || args.url,\n        /* downloadUrl = */ args.url\n      );\n    }\n\n    // Set the necessary API parameters, using all the available options.\n    const apiParams = AppOptions.getAll(OptionKind.API);\n    const loadingTask = getDocument({\n      ...apiParams,\n      ...args,\n    });\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 = evt => this.progress(evt.percent);\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        if (this.loadingBar) {\n          // Avoid the \"indeterminate\" loadingBar being displayed on error.\n          this.loadingBar.percent ||= 0;\n        }\n\n        let key = \"pdfjs-loading-error\";\n        if (reason instanceof InvalidPDFException) {\n          key = \"pdfjs-invalid-file-error\";\n        } else if (reason instanceof ResponseException) {\n          key = reason.missing\n            ? \"pdfjs-missing-file-error\"\n            : \"pdfjs-unexpected-response-error\";\n        }\n        return this._documentError(key, { message: reason.message }).then(\n          () => {\n            throw reason;\n          }\n        );\n      }\n    );\n  },\n\n  async download() {\n    let data;\n    try {\n      data = await (this.pdfDocument\n        ? this.pdfDocument.getData()\n        : this.pdfLoadingTask.getData());\n    } catch {\n      // When the PDF document isn't ready, simply download using the URL.\n    }\n    this.downloadManager.download(data, this._downloadUrl, this._docFilename);\n  },\n\n  async save() {\n    if (this._saveInProgress) {\n      return;\n    }\n    this._saveInProgress = true;\n    await this.pdfScriptingManager.dispatchWillSave();\n\n    try {\n      const data = await this.pdfDocument.saveDocument();\n      this.downloadManager.download(data, this._downloadUrl, this._docFilename);\n    } catch (reason) {\n      // When the PDF document isn't ready, fallback to a \"regular\" download.\n      console.error(`Error when saving the document:`, reason);\n      await this.download();\n    } finally {\n      await this.pdfScriptingManager.dispatchDidSave();\n      this._saveInProgress = false;\n    }\n\n    const editorStats = this.pdfDocument?.annotationStorage.editorStats;\n    if (editorStats) {\n      this.externalServices.reportTelemetry({\n        type: \"editing\",\n        data: {\n          type: \"save\",\n          stats: editorStats,\n        },\n      });\n    }\n  },\n\n  async downloadOrSave() {\n    // In the Firefox case, this method MUST always trigger a download.\n    // When the user is closing a modified and unsaved document, we display a\n    // prompt asking for saving or not. In case they save, we must wait for\n    // saving to complete before closing the tab.\n    // So in case this function does not trigger a download, we must trigger a\n    // a message and change PdfjsChild.sys.mjs to take it into account.\n    const { classList } = this.appConfig.appContainer;\n    classList.add(\"wait\");\n\n    if (this.pdfThumbnailViewer?.hasStructuralChanges()) {\n      this.externalServices.reportTelemetry({\n        type: \"pageOrganization\",\n        data: { action: \"save\" },\n      });\n      await this.onSavePages({\n        data: this.pdfThumbnailViewer.getStructuralChanges(),\n      });\n    } else {\n      await (this.pdfDocument?.annotationStorage.size > 0\n        ? this.save()\n        : this.download());\n    }\n    delete this._mergedDocumentNeedsSaving;\n    this.setTitle();\n    classList.remove(\"wait\");\n  },\n\n  /**\n   * Report the error; used for errors affecting loading and/or parsing of\n   * the entire PDF document.\n   */\n  async _documentError(key, moreInfo = null) {\n    this._unblockDocumentLoadEvent();\n\n    const message = await this._otherError(\n      key || \"pdfjs-loading-error\",\n      moreInfo\n    );\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} key - The localization key for the error.\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   * @returns {string} A (localized) error message that is human readable.\n   */\n  async _otherError(key, moreInfo = null) {\n    const message = await this.l10n.get(key);\n\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    return message;\n  },\n\n  progress(percent) {\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 (!this.loadingBar || 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    if (\n      this.pdfDocument?.loadingParams.disableAutoFetch ??\n      AppOptions.get(\"disableAutoFetch\")\n    ) {\n      this.loadingBar.setDisableAutoFetch();\n    }\n  },\n\n  load(pdfDocument) {\n    this.pdfDocument = pdfDocument;\n\n    this._printPermissionPromise = new Promise(resolve => {\n      this.eventBus.on(\n        \"printingallowed\",\n        ({ isAllowed }) => {\n          if (\n            typeof PDFJSDev !== \"undefined\" &&\n            PDFJSDev.test(\"MOZCENTRAL\") &&\n            !isAllowed\n          ) {\n            window.print = () => {\n              console.warn(\"Printing is not allowed.\");\n            };\n          }\n          resolve(isAllowed);\n        },\n        { once: true }\n      );\n    });\n\n    pdfDocument.getDownloadInfo().then(({ length }) => {\n      this._contentLength = length; // Ensure that the correct length is used.\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(() => {\n      /* Avoid breaking initial rendering; ignoring errors. */\n    });\n    const pageModePromise = pdfDocument.getPageMode().catch(() => {\n      /* Avoid breaking initial rendering; ignoring errors. */\n    });\n    const openActionPromise = pdfDocument.getOpenAction().catch(() => {\n      /* Avoid breaking initial rendering; ignoring errors. */\n    });\n\n    this.toolbar?.setPagesCount(pdfDocument.numPages, false);\n    this.secondaryToolbar?.setPagesCount(pdfDocument.numPages);\n\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")) {\n      const baseUrl = updateUrlHash(location, \"\");\n      // Ignore \"data:\"-URLs for performance reasons, even though it may cause\n      // internal links to not work perfectly in all cases (see bug 1803050).\n      this.pdfLinkService.setDocument(\n        pdfDocument,\n        isDataScheme(baseUrl) ? null : baseUrl\n      );\n    } else {\n      this.pdfLinkService.setDocument(pdfDocument);\n    }\n    this.pdfDocumentProperties?.setDocument(pdfDocument);\n\n    const pdfViewer = this.pdfViewer;\n    pdfViewer.setDocument(pdfDocument);\n    const { firstPagePromise, onePageRendered, pagesPromise } = pdfViewer;\n\n    this.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      });\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\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._documentError(\"pdfjs-loading-error\", { message: reason.message });\n      }\n    );\n\n    onePageRendered.then(data => {\n      this.externalServices.reportTelemetry({\n        type: \"pageInfo\",\n        timestamp: data.timestamp,\n      });\n\n      if (this.pdfOutlineViewer) {\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      }\n      if (this.pdfAttachmentViewer) {\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      }\n      if (this.pdfLayerViewer) {\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\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, jsActions] = await Promise.all([\n      openActionPromise,\n      this.pdfViewer.enableScripting ? null : pdfDocument.getJSActions(),\n    ]);\n\n    if (pdfDocument !== this.pdfDocument) {\n      return; // The document was closed while the auto print data resolved.\n    }\n    let triggerAutoPrint = openAction?.action === \"Print\";\n\n    if (jsActions) {\n      console.warn(\"Warning: JavaScript support is not enabled\");\n\n      // Hack to support auto printing.\n      for (const name in jsActions) {\n        if (triggerAutoPrint) {\n          break;\n        }\n        switch (name) {\n          case \"WillClose\":\n          case \"WillSave\":\n          case \"DidSave\":\n          case \"WillPrint\":\n          case \"DidPrint\":\n            continue;\n        }\n        triggerAutoPrint = jsActions[name].some(js => AutoPrintRegExp.test(js));\n      }\n    }\n\n    if (triggerAutoPrint) {\n      this.triggerPrinting();\n    }\n  },\n\n  /**\n   * @private\n   */\n  async _initializeMetadata(pdfDocument) {\n    const {\n      info,\n      metadata,\n      contentDispositionFilename,\n      contentLength,\n      hasStructTree,\n    } = await pdfDocument.getMetadata();\n\n    if (pdfDocument !== this.pdfDocument) {\n      return; // The document was closed while the metadata resolved.\n    }\n    this.externalServices.reportTelemetry({\n      type: \"taggedPDF\",\n      data: hasStructTree,\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        `${(metadata?.get(\"pdf:producer\") || info.Producer || \"-\").trim()} / ` +\n        `${(metadata?.get(\"xmp:creatortool\") || info.Creator || \"-\").trim()}` +\n        `] (PDF.js: ${version || \"?\"} [${build || \"?\"}])`\n    );\n    const pdfTitle = this._docTitle;\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    } else if (\n      (info.IsAcroFormPresent || info.IsXFAPresent) &&\n      !this.pdfViewer.renderForms\n    ) {\n      console.warn(\"Warning: Interactive form support is not enabled\");\n    }\n\n    if (info.IsSignaturesPresent) {\n      console.warn(\"Warning: Digital signatures validation is not supported\");\n    }\n\n    this.eventBus.dispatch(\"metadataloaded\", { source: this });\n  },\n\n  /**\n   * @private\n   */\n  async _initializePageLabels(pdfDocument) {\n    if (\n      typeof PDFJSDev === \"undefined\"\n        ? window.isGECKOVIEW\n        : PDFJSDev.test(\"GECKOVIEW\")\n    ) {\n      return;\n    }\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  _hasChanges() {\n    return (\n      this.pdfDocument?.annotationStorage.size > 0 ||\n      this.pdfThumbnailViewer?.hasStructuralChanges() ||\n      this._mergedDocumentNeedsSaving === true\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      if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n        this._annotationStorageModified = true;\n      }\n    };\n    annotationStorage.onResetModified = () => {\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  },\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.viewsManager?.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    this.pdfDocument.cleanup(\n      /* keepLoadedFonts = */ AppOptions.get(\"fontExtraProperties\")\n    );\n  },\n\n  forceRendering() {\n    this.pdfRenderingQueue.printing = !!this.printService;\n    this.pdfRenderingQueue.isThumbnailViewEnabled =\n      this.viewsManager?.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(() => this.pdfDocument?.annotationStorage.print);\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 || !this.pdfViewer.printingAllowed) {\n      this._otherError(\"pdfjs-printing-not-supported\");\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(\"pdfjs-printing-not-ready\").then(msg => {\n        // eslint-disable-next-line no-alert\n        window.alert(msg);\n      });\n      return;\n    }\n\n    this.printService = PDFPrintServiceFactory.createPrintService({\n      pdfDocument: this.pdfDocument,\n      pagesOverview: this.pdfViewer.getPagesOverview(),\n      printContainer: this.appConfig.printContainer,\n      printResolution: AppOptions.get(\"printResolution\"),\n      printAnnotationStoragePromise: this._printAnnotationStoragePromise,\n    });\n    this.forceRendering();\n    // Disable the editor-indicator during printing (fixes bug 1790552).\n    this.setTitle();\n\n    this.printService.layout();\n\n    if (this._hasAnnotationEditors) {\n      this.externalServices.reportTelemetry({\n        type: \"editing\",\n        data: {\n          type: \"print\",\n          stats: this.pdfDocument?.annotationStorage.editorStats,\n        },\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  async triggerPrinting() {\n    if (this.supportsPrinting && (await this._printPermissionPromise)) {\n      window.print();\n    }\n  },\n\n  bindEvents() {\n    if (this._eventBusAbortController) {\n      return;\n    }\n    const ac = (this._eventBusAbortController = new AbortController());\n    const opts = { signal: ac.signal };\n\n    const {\n      eventBus,\n      externalServices,\n      pdfDocumentProperties,\n      pdfViewer,\n      preferences,\n    } = this;\n\n    eventBus._on(\"resize\", onResize.bind(this), opts);\n    eventBus._on(\"hashchange\", onHashchange.bind(this), opts);\n    eventBus._on(\"beforeprint\", this.beforePrint.bind(this), opts);\n    eventBus._on(\"afterprint\", this.afterPrint.bind(this), opts);\n    eventBus._on(\"pagerender\", onPageRender.bind(this), opts);\n    eventBus._on(\"pagerendered\", onPageRendered.bind(this), opts);\n    eventBus._on(\"updateviewarea\", onUpdateViewarea.bind(this), opts);\n    eventBus._on(\"pagechanging\", onPageChanging.bind(this), opts);\n    eventBus._on(\"scalechanging\", onScaleChanging.bind(this), opts);\n    eventBus._on(\"rotationchanging\", onRotationChanging.bind(this), opts);\n    eventBus._on(\"sidebarviewchanged\", onSidebarViewChanged.bind(this), opts);\n    eventBus._on(\"pagemode\", onPageMode.bind(this), opts);\n    eventBus._on(\"namedaction\", onNamedAction.bind(this), opts);\n    eventBus._on(\n      \"presentationmodechanged\",\n      evt => (pdfViewer.presentationModeState = evt.state),\n      opts\n    );\n    eventBus._on(\n      \"presentationmode\",\n      this.requestPresentationMode.bind(this),\n      opts\n    );\n    eventBus._on(\n      \"switchannotationeditormode\",\n      evt => (pdfViewer.annotationEditorMode = evt),\n      opts\n    );\n    eventBus._on(\"print\", this.triggerPrinting.bind(this), opts);\n    eventBus._on(\"download\", this.downloadOrSave.bind(this), opts);\n    eventBus._on(\"firstpage\", () => (this.page = 1), opts);\n    eventBus._on(\"lastpage\", () => (this.page = this.pagesCount), opts);\n    eventBus._on(\"nextpage\", () => pdfViewer.nextPage(), opts);\n    eventBus._on(\"previouspage\", () => pdfViewer.previousPage(), opts);\n    eventBus._on(\"zoomin\", this.zoomIn.bind(this), opts);\n    eventBus._on(\"zoomout\", this.zoomOut.bind(this), opts);\n    eventBus._on(\"zoomreset\", this.zoomReset.bind(this), opts);\n    eventBus._on(\"pagenumberchanged\", onPageNumberChanged.bind(this), opts);\n    eventBus._on(\n      \"scalechanged\",\n      evt => (pdfViewer.currentScaleValue = evt.value),\n      opts\n    );\n    eventBus._on(\"rotatecw\", this.rotatePages.bind(this, 90), opts);\n    eventBus._on(\"rotateccw\", this.rotatePages.bind(this, -90), opts);\n    eventBus._on(\n      \"optionalcontentconfig\",\n      evt => (pdfViewer.optionalContentConfigPromise = evt.promise),\n      opts\n    );\n    eventBus._on(\n      \"switchscrollmode\",\n      evt => (pdfViewer.scrollMode = evt.mode),\n      opts\n    );\n    eventBus._on(\n      \"scrollmodechanged\",\n      onViewerModesChanged.bind(this, \"scrollMode\"),\n      opts\n    );\n    eventBus._on(\n      \"switchspreadmode\",\n      evt => (pdfViewer.spreadMode = evt.mode),\n      opts\n    );\n    eventBus._on(\n      \"spreadmodechanged\",\n      onViewerModesChanged.bind(this, \"spreadMode\"),\n      opts\n    );\n    eventBus._on(\n      \"imagealttextsettings\",\n      onImageAltTextSettings.bind(this),\n      opts\n    );\n    eventBus._on(\n      \"documentproperties\",\n      () => pdfDocumentProperties?.open(),\n      opts\n    );\n    eventBus._on(\"findfromurlhash\", onFindFromUrlHash.bind(this), opts);\n    eventBus._on(\n      \"updatefindmatchescount\",\n      onUpdateFindMatchesCount.bind(this),\n      opts\n    );\n    eventBus._on(\n      \"updatefindcontrolstate\",\n      onUpdateFindControlState.bind(this),\n      opts\n    );\n\n    if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n      eventBus._on(\"fileinputchange\", onFileInputChange.bind(this), opts);\n      eventBus._on(\"openfile\", onOpenFile.bind(this), opts);\n    }\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n      eventBus._on(\n        \"editingstateschanged\",\n        evt => externalServices.updateEditorStates(evt),\n        opts\n      );\n      eventBus._on(\n        \"reporttelemetry\",\n        evt => externalServices.reportTelemetry(evt.details),\n        opts\n      );\n    }\n    if (\n      typeof PDFJSDev === \"undefined\" ||\n      PDFJSDev.test(\"TESTING || MOZCENTRAL\")\n    ) {\n      eventBus._on(\n        \"setpreference\",\n        evt => preferences.set(evt.name, evt.value),\n        opts\n      );\n    }\n    eventBus._on(\"pagesedited\", this.onPagesEdited.bind(this), opts);\n    eventBus._on(\"saveextractedpages\", this.onSavePages.bind(this), opts);\n    eventBus._on(\"saveandload\", this.onSaveAndLoad.bind(this), opts);\n  },\n\n  bindWindowEvents() {\n    if (this._windowAbortController) {\n      return;\n    }\n    this._windowAbortController = new AbortController();\n\n    const {\n      eventBus,\n      appConfig: { mainContainer },\n      pdfViewer,\n      _windowAbortController: { signal },\n    } = this;\n\n    this._touchManager = new TouchManager({\n      container: window,\n      isPinchingDisabled: () => pdfViewer.isInPresentationMode,\n      isPinchingStopped: () => this.overlayManager?.active,\n      onPinching: this.touchPinchCallback.bind(this),\n      onPinchEnd: this.touchPinchEndCallback.bind(this),\n      signal,\n    });\n\n    function addWindowResolutionChange(evt = null) {\n      if (evt) {\n        pdfViewer.refresh();\n      }\n      const mediaQueryList = window.matchMedia(\n        `(resolution: ${OutputScale.pixelRatio}dppx)`\n      );\n      mediaQueryList.addEventListener(\"change\", addWindowResolutionChange, {\n        once: true,\n        signal,\n      });\n    }\n    addWindowResolutionChange();\n\n    window.addEventListener(\"wheel\", onWheel.bind(this), {\n      passive: false,\n      signal,\n    });\n    window.addEventListener(\"click\", onClick.bind(this), { signal });\n    window.addEventListener(\"keydown\", onKeyDown.bind(this), { signal });\n    window.addEventListener(\"keyup\", onKeyUp.bind(this), { signal });\n    window.addEventListener(\n      \"resize\",\n      () => eventBus.dispatch(\"resize\", { source: window }),\n      { signal }\n    );\n    window.addEventListener(\n      \"hashchange\",\n      () => {\n        eventBus.dispatch(\"hashchange\", {\n          source: window,\n          hash: document.location.hash.substring(1),\n        });\n      },\n      { signal }\n    );\n    window.addEventListener(\n      \"beforeprint\",\n      () => eventBus.dispatch(\"beforeprint\", { source: window }),\n      { signal }\n    );\n    window.addEventListener(\n      \"afterprint\",\n      () => eventBus.dispatch(\"afterprint\", { source: window }),\n      { signal }\n    );\n    window.addEventListener(\n      \"updatefromsandbox\",\n      evt => {\n        eventBus.dispatch(\"updatefromsandbox\", {\n          source: window,\n          detail: evt.detail,\n        });\n      },\n      { signal }\n    );\n    window.addEventListener(\"beforeunload\", onBeforeUnload.bind(this), {\n      signal,\n    });\n\n    if (\n      (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n      !(\"onscrollend\" in document.documentElement)\n    ) {\n      return;\n    }\n    if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n      // Using the values lastScrollTop and lastScrollLeft is a workaround to\n      // https://bugzilla.mozilla.org/show_bug.cgi?id=1881974.\n      // TODO: remove them once the bug is fixed.\n      ({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =\n        mainContainer);\n    }\n\n    let scrollendTimeoutID, scrollAbortController;\n    const scrollend = () => {\n      if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n        ({ scrollTop: this._lastScrollTop, scrollLeft: this._lastScrollLeft } =\n          mainContainer);\n      }\n      clearTimeout(scrollendTimeoutID);\n      if (this._isScrolling) {\n        scrollAbortController.abort();\n        scrollAbortController = null;\n        this._isScrolling = false;\n      }\n    };\n    const scroll = () => {\n      if (this._isCtrlKeyDown) {\n        return;\n      }\n      if (\n        (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) &&\n        this._lastScrollTop === mainContainer.scrollTop &&\n        this._lastScrollLeft === mainContainer.scrollLeft\n      ) {\n        return;\n      }\n\n      if (!this._isScrolling) {\n        scrollAbortController = new AbortController();\n        const abortSignal = AbortSignal.any([\n          scrollAbortController.signal,\n          signal,\n        ]);\n\n        mainContainer.addEventListener(\"scrollend\", scrollend, {\n          signal: abortSignal,\n        });\n        mainContainer.addEventListener(\"blur\", scrollend, {\n          signal: abortSignal,\n        });\n        this._isScrolling = true;\n      }\n      clearTimeout(scrollendTimeoutID);\n      // Why 100 ? Because of:\n      // https://developer.chrome.com/blog/scrollend-a-new-javascript-event\n      // Maybe we could find a better value... ideally the `scrollend` event\n      // should be correctly fired.\n      scrollendTimeoutID = setTimeout(scrollend, 100);\n    };\n    mainContainer.addEventListener(\"scroll\", scroll, {\n      passive: true,\n      signal,\n    });\n  },\n\n  unbindEvents() {\n    this._eventBusAbortController?.abort();\n    this._eventBusAbortController = null;\n  },\n\n  unbindWindowEvents() {\n    this._windowAbortController?.abort();\n    this._windowAbortController = null;\n    this._touchManager = null;\n  },\n\n  /**\n   * @ignore\n   */\n  async testingClose() {\n    this.unbindEvents();\n    this.unbindWindowEvents();\n\n    this._globalAbortController?.abort();\n    this._globalAbortController = null;\n\n    this.findBar?.close();\n\n    await Promise.all([this.l10n?.destroy(), this.close()]);\n  },\n\n  onPagesEdited(data) {\n    this.pdfViewer.onPagesEdited(data);\n  },\n\n  async onSavePages({ data: extractParams }) {\n    if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n      return;\n    }\n    if (!this.pdfDocument) {\n      return;\n    }\n    const modifiedPdfBytes = await this.pdfDocument.extractPages(extractParams);\n    if (!modifiedPdfBytes) {\n      console.error(\n        \"Something wrong happened when saving the edited PDF.\\nPlease file a bug.\"\n      );\n      return;\n    }\n    this.downloadManager.download(\n      modifiedPdfBytes,\n      this._downloadUrl,\n      this._docFilename\n    );\n  },\n\n  async onSaveAndLoad({ data: extractParams }) {\n    if (!this.pdfDocument) {\n      return;\n    }\n    const modifiedPdfBytes = await this.pdfDocument.extractPages(extractParams);\n    if (!modifiedPdfBytes) {\n      console.error(\n        \"Something wrong happened when saving the edited PDF.\\nPlease file a bug.\"\n      );\n      return;\n    }\n    this._mergedDocumentNeedsSaving = true;\n    this.open({\n      data: modifiedPdfBytes,\n      filename: this._docFilename,\n    });\n  },\n\n  _accumulateTicks(ticks, prop) {\n    // If the direction changed, reset the accumulated ticks.\n    if ((this[prop] > 0 && ticks < 0) || (this[prop] < 0 && ticks > 0)) {\n      this[prop] = 0;\n    }\n    this[prop] += ticks;\n    const wholeTicks = Math.trunc(this[prop]);\n    this[prop] -= wholeTicks;\n    return wholeTicks;\n  },\n\n  _accumulateFactor(previousScale, factor, prop) {\n    if (factor === 1) {\n      return 1;\n    }\n    // If the direction changed, reset the accumulated factor.\n    if ((this[prop] > 1 && factor < 1) || (this[prop] < 1 && factor > 1)) {\n      this[prop] = 1;\n    }\n\n    const newFactor =\n      Math.floor(previousScale * factor * this[prop] * 100) /\n      (100 * previousScale);\n    this[prop] = factor / newFactor;\n\n    return newFactor;\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   * 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\ninitCom(PDFViewerApplication);\nPDFPrintServiceFactory.initGlobals(PDFViewerApplication);\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n  const HOSTED_VIEWER_ORIGINS = new Set([\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    const viewerOrigin = URL.parse(window.location)?.origin || \"null\";\n    if (HOSTED_VIEWER_ORIGINS.has(viewerOrigin)) {\n      // Hosted or local viewer, allow for any file locations\n      return;\n    }\n    const fileOrigin = URL.parse(file, window.location)?.origin;\n    if (fileOrigin === viewerOrigin) {\n      return;\n    }\n    const ex = new Error(\"file origin does not match viewer's\");\n\n    PDFViewerApplication._documentError(\"pdfjs-loading-error\", {\n      message: ex.message,\n    });\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    throw ex;\n  };\n\n  // eslint-disable-next-line no-var\n  var onFileInputChange = function (evt) {\n    if (this.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    this.open({\n      url: URL.createObjectURL(file),\n      originalUrl: encodeURIComponent(file.name),\n    });\n  };\n\n  // eslint-disable-next-line no-var\n  var onOpenFile = function (evt) {\n    this._openFileInput?.click();\n  };\n}\n\nfunction onPageRender({ pageNumber }) {\n  // If the page is (the most) visible when it starts rendering,\n  // ensure that the page number input loading indicator is displayed.\n  if (pageNumber === this.page) {\n    this.toolbar?.updateLoadingIndicatorState(true);\n  }\n}\n\nfunction onPageRendered({ pageNumber, isDetailView, 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 === this.page) {\n    this.toolbar?.updateLoadingIndicatorState(false);\n  }\n\n  // Use the rendered page to set the corresponding thumbnail image.\n  if (!isDetailView && this.viewsManager?.visibleView === SidebarView.THUMBS) {\n    const pageView = this.pdfViewer.getPageView(/* index = */ pageNumber - 1);\n    const thumbnailView = this.pdfThumbnailViewer?.getThumbnail(\n      /* index = */ pageNumber - 1\n    );\n    if (pageView) {\n      thumbnailView?.setImage(pageView);\n    }\n  }\n\n  if (error) {\n    this._otherError(\"pdfjs-rendering-error\", error);\n  }\n}\n\nfunction onPageMode({ 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  this.viewsManager?.switchView(view, /* forceOpen = */ true);\n}\n\nfunction onNamedAction(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      this.appConfig.toolbar?.pageNumber.select();\n      break;\n\n    case \"Find\":\n      if (!this.supportsIntegratedFind) {\n        this.findBar?.toggle();\n      }\n      break;\n\n    case \"Print\":\n      this.triggerPrinting();\n      break;\n\n    case \"SaveAs\":\n      this.downloadOrSave();\n      break;\n  }\n}\n\nfunction onSidebarViewChanged({ view }) {\n  this.pdfRenderingQueue.isThumbnailViewEnabled = view === SidebarView.THUMBS;\n\n  if (this.isInitialViewSet) {\n    // Only update the storage when the document has been loaded *and* rendered.\n    this.store?.set(\"sidebarView\", view).catch(() => {\n      // Unable to write to storage.\n    });\n  }\n}\n\nfunction onUpdateViewarea({ location }) {\n  if (this.isInitialViewSet) {\n    // Only update the storage when the document has been loaded *and* rendered.\n    this.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  if (this.appConfig.secondaryToolbar) {\n    this.appConfig.secondaryToolbar.viewBookmarkButton.href =\n      this.pdfLinkService.getAnchorUrl(location.pdfOpenParams);\n  }\n}\n\nfunction onViewerModesChanged(name, evt) {\n  if (this.isInitialViewSet && !this.pdfViewer.isInPresentationMode) {\n    // Only update the storage when the document has been loaded *and* rendered.\n    this.store?.set(name, evt.mode).catch(() => {\n      // Unable to write to storage.\n    });\n  }\n}\n\nfunction onResize() {\n  const { pdfDocument, pdfViewer, pdfRenderingQueue } = this;\n\n  if (pdfRenderingQueue.printing && window.matchMedia(\"print\").matches) {\n    // Work-around issue 15324 by ignoring \"resize\" events during printing.\n    return;\n  }\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 onHashchange(evt) {\n  const hash = evt.hash;\n  if (!hash) {\n    return;\n  }\n  if (!this.isInitialViewSet) {\n    this.initialBookmark = hash;\n  } else if (!this.pdfHistory?.popStateInProgress) {\n    this.pdfLinkService.setHash(hash);\n  }\n}\n\nfunction onPageNumberChanged(evt) {\n  const { pdfViewer } = this;\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    this.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    this.toolbar?.setPageNumber(\n      pdfViewer.currentPageNumber,\n      pdfViewer.currentPageLabel\n    );\n  }\n}\n\nfunction onImageAltTextSettings() {\n  this.imageAltTextSettings?.open({\n    enableGuessAltText: AppOptions.get(\"enableGuessAltText\"),\n    enableNewAltTextWhenAddingImage: AppOptions.get(\n      \"enableNewAltTextWhenAddingImage\"\n    ),\n  });\n}\n\nfunction onFindFromUrlHash(evt) {\n  this.eventBus.dispatch(\"find\", {\n    source: evt.source,\n    type: \"\",\n    query: evt.query,\n    caseSensitive: false,\n    entireWord: false,\n    highlightAll: true,\n    findPrevious: false,\n    matchDiacritics: true,\n  });\n}\n\nfunction onUpdateFindMatchesCount({ matchesCount }) {\n  if (this.supportsIntegratedFind) {\n    this.externalServices.updateFindMatchesCount(matchesCount);\n  } else {\n    this.findBar?.updateResultsCount(matchesCount);\n  }\n}\n\nfunction onUpdateFindControlState({\n  state,\n  previous,\n  entireWord,\n  matchesCount,\n  rawQuery,\n}) {\n  if (this.supportsIntegratedFind) {\n    this.externalServices.updateFindControlState({\n      result: state,\n      findPrevious: previous,\n      entireWord,\n      matchesCount,\n      rawQuery,\n    });\n  } else {\n    this.findBar?.updateUIState(state, previous, matchesCount);\n  }\n}\n\nfunction onScaleChanging(evt) {\n  this.toolbar?.setPageScale(evt.presetValue, evt.scale);\n\n  this.pdfViewer.update();\n}\n\nfunction onRotationChanging(evt) {\n  if (this.pdfThumbnailViewer) {\n    this.pdfThumbnailViewer.pagesRotation = evt.pagesRotation;\n  }\n\n  this.forceRendering();\n  // Ensure that the active page doesn't change during rotation.\n  this.pdfViewer.currentPageNumber = evt.pageNumber;\n}\n\nfunction onPageChanging({ pageNumber, pageLabel }) {\n  this.toolbar?.setPageNumber(pageNumber, pageLabel);\n  this.secondaryToolbar?.setPageNumber(pageNumber);\n\n  if (this.viewsManager?.visibleView === SidebarView.THUMBS) {\n    this.pdfThumbnailViewer?.scrollThumbnailIntoView(pageNumber);\n  }\n\n  // Show/hide the loading indicator in the page number input element.\n  const currentPage = this.pdfViewer.getPageView(/* index = */ pageNumber - 1);\n  this.toolbar?.updateLoadingIndicatorState(\n    currentPage?.renderingState === RenderingStates.RUNNING\n  );\n}\n\nfunction onWheel(evt) {\n  const {\n    pdfViewer,\n    supportsMouseWheelZoomCtrlKey,\n    supportsMouseWheelZoomMetaKey,\n    supportsPinchToZoom,\n  } = this;\n\n  if (pdfViewer.isInPresentationMode) {\n    return;\n  }\n\n  // Pinch-to-zoom on a trackpad maps to a wheel event with ctrlKey set to true\n  // https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent#browser_compatibility\n  // Hence if ctrlKey is true but ctrl key hasn't been pressed then we can\n  // infer that we have a pinch-to-zoom.\n  // But the ctrlKey could have been pressed outside of the browser window,\n  // hence we try to do some magic to guess if the scaleFactor is likely coming\n  // from a pinch-to-zoom or not.\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\n  // The following formula is a bit strange but it comes from:\n  // https://searchfox.org/mozilla-central/rev/d62c4c4d5547064487006a1506287da394b64724/widget/InputData.cpp#618-626\n  let scaleFactor = Math.exp(-evt.deltaY / 100);\n\n  const isBuiltInMac =\n    typeof PDFJSDev !== \"undefined\" &&\n    PDFJSDev.test(\"MOZCENTRAL\") &&\n    FeatureTest.platform.isMac;\n  const isPinchToZoom =\n    evt.ctrlKey &&\n    !this._isCtrlKeyDown &&\n    deltaMode === WheelEvent.DOM_DELTA_PIXEL &&\n    evt.deltaX === 0 &&\n    (Math.abs(scaleFactor - 1) < 0.05 || isBuiltInMac) &&\n    evt.deltaZ === 0;\n  const origin = [evt.clientX, evt.clientY];\n\n  if (\n    isPinchToZoom ||\n    (evt.ctrlKey && supportsMouseWheelZoomCtrlKey) ||\n    (evt.metaKey && supportsMouseWheelZoomMetaKey)\n  ) {\n    // Only zoom the pages, not the entire viewer.\n    evt.preventDefault();\n    // NOTE: this check must be placed *after* preventDefault.\n    if (\n      this._isScrolling ||\n      document.visibilityState === \"hidden\" ||\n      this.overlayManager.active\n    ) {\n      return;\n    }\n\n    if (isPinchToZoom && supportsPinchToZoom) {\n      scaleFactor = this._accumulateFactor(\n        pdfViewer.currentScale,\n        scaleFactor,\n        \"_wheelUnusedFactor\"\n      );\n      this.updateZoom(null, scaleFactor, origin);\n    } else {\n      const delta = normalizeWheelEventDirection(evt);\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        //\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 =\n          Math.abs(delta) >= 1\n            ? Math.sign(delta)\n            : this._accumulateTicks(delta, \"_wheelUnusedTicks\");\n      } else {\n        // pixel-based devices\n        const PIXELS_PER_LINE_SCALE = 30;\n        ticks = this._accumulateTicks(\n          delta / PIXELS_PER_LINE_SCALE,\n          \"_wheelUnusedTicks\"\n        );\n      }\n\n      this.updateZoom(ticks, null, origin);\n    }\n  }\n}\n\nfunction closeSecondaryToolbar({ target }) {\n  if (!this.secondaryToolbar?.isOpen) {\n    return;\n  }\n  const { toolbar, secondaryToolbar } = this.appConfig;\n  if (\n    this.pdfViewer.containsElement(target) ||\n    (toolbar?.container.contains(target) &&\n      !secondaryToolbar?.toolbar.contains(target) &&\n      // TODO: change the `contains` for an equality check when the bug:\n      //  https://bugzilla.mozilla.org/show_bug.cgi?id=1921984\n      // is fixed.\n      !secondaryToolbar?.toggleButton.contains(target))\n  ) {\n    this.secondaryToolbar.close();\n  }\n}\n\nfunction closeEditorUndoBar(evt) {\n  if (!this.editorUndoBar?.isOpen) {\n    return;\n  }\n  if (this.appConfig.secondaryToolbar?.toolbar.contains(evt.target)) {\n    this.editorUndoBar.hide();\n  }\n}\n\nfunction onBeforeUnload(evt) {\n  if (this._hasChanges()) {\n    evt.preventDefault();\n    evt.returnValue = \"\";\n    return false;\n  }\n  return true;\n}\n\nfunction onClick(evt) {\n  closeSecondaryToolbar.call(this, evt);\n  closeEditorUndoBar.call(this, evt);\n}\n\nfunction onKeyUp(evt) {\n  // evt.ctrlKey is false hence we use evt.key.\n  if (evt.key === \"Control\") {\n    this._isCtrlKeyDown = false;\n  }\n}\n\nfunction onKeyDown(evt) {\n  this._isCtrlKeyDown = evt.key === \"Control\";\n\n  if (\n    this.editorUndoBar?.isOpen &&\n    evt.keyCode !== 9 &&\n    evt.keyCode !== 16 &&\n    !(\n      (evt.keyCode === 13 || evt.keyCode === 32) &&\n      getActiveOrFocusedElement() === this.appConfig.editorUndoBar.undoButton\n    )\n  ) {\n    // Hide undo bar on keypress except for Shift, Tab, Shift+Tab.\n    // Also avoid hiding if the undo button is triggered.\n    this.editorUndoBar.hide();\n  }\n\n  if (this.overlayManager.active) {\n    return;\n  }\n  const { eventBus, pdfViewer } = this;\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 (!this.supportsIntegratedFind && !evt.shiftKey) {\n          this.findBar?.open();\n          handled = true;\n        }\n        break;\n      case 71: // g\n        if (!this.supportsIntegratedFind) {\n          const { state } = this.findController;\n          if (state) {\n            const newState = {\n              source: window,\n              type: \"again\",\n              findPrevious: cmd === 5 || cmd === 12,\n            };\n            eventBus.dispatch(\"find\", { ...state, ...newState });\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        this.zoomIn();\n        handled = true;\n        break;\n      case 173: // FF/Mac '-'\n      case 109: // FF '-'\n      case 189: // Chrome '-'\n        this.zoomOut();\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(() => {\n            // ... and resetting the scale after browser adjusts its scale\n            this.zoomReset();\n          });\n          handled = false;\n        }\n        break;\n\n      case 38: // up arrow\n        if (isViewerInPresentationMode || this.page > 1) {\n          this.page = 1;\n          handled = true;\n          ensureViewerFocused = true;\n        }\n        break;\n      case 40: // down arrow\n        if (isViewerInPresentationMode || this.page < this.pagesCount) {\n          this.page = this.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        this.requestPresentationMode();\n        handled = true;\n        this.externalServices.reportTelemetry({\n          type: \"buttons\",\n          data: { id: \"presentationModeKeyboard\" },\n        });\n        break;\n      case 71: // g\n        // focuses input#pageNumber field\n        if (this.appConfig.toolbar) {\n          this.appConfig.toolbar.pageNumber.select();\n          handled = true;\n        }\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    (curElementTagName === \"BUTTON\" && evt.keyCode === /* Space = */ 32) ||\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        if (this.supportsCaretBrowsingMode) {\n          this.moveCaret(/* isUp = */ true, /* select = */ false);\n          handled = true;\n          break;\n        }\n      /* falls through */\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        if (this.supportsCaretBrowsingMode) {\n          return;\n        }\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 (this.secondaryToolbar?.isOpen) {\n          this.secondaryToolbar.close();\n          handled = true;\n        }\n        if (!this.supportsIntegratedFind && this.findBar?.opened) {\n          this.findBar.close();\n          handled = true;\n        }\n        break;\n      case 40: // down arrow\n        if (this.supportsCaretBrowsingMode) {\n          this.moveCaret(/* isUp = */ false, /* select = */ false);\n          handled = true;\n          break;\n        }\n      /* falls through */\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 32: // spacebar\n        if (!isViewerInPresentationMode) {\n          turnOnlyIfPageFit = true;\n        }\n        turnPage = 1;\n        break;\n      case 39: // right arrow\n        if (this.supportsCaretBrowsingMode) {\n          return;\n        }\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 || this.page > 1) {\n          this.page = 1;\n          handled = true;\n          ensureViewerFocused = true;\n        }\n        break;\n      case 35: // end\n        if (isViewerInPresentationMode || this.page < this.pagesCount) {\n          this.page = this.pagesCount;\n          handled = true;\n          ensureViewerFocused = true;\n        }\n        break;\n\n      case 83: // 's'\n        this.pdfCursorTools?.switchTool(CursorTool.SELECT);\n        break;\n      case 72: // 'h'\n        this.pdfCursorTools?.switchTool(CursorTool.HAND);\n        break;\n\n      case 82: // 'r'\n        this.rotatePages(90);\n        break;\n\n      case 115: // F4\n        this.viewsManager?.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 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 38: // up arrow\n        this.moveCaret(/* isUp = */ true, /* select = */ true);\n        handled = true;\n        break;\n      case 40: // down arrow\n        this.moveCaret(/* isUp = */ false, /* select = */ true);\n        handled = true;\n        break;\n      case 82: // 'r'\n        this.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\nexport { PDFViewerApplication };\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 { ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { AppOptions } from \"./app_options.js\";\nimport { LinkTarget } from \"./pdf_link_service.js\";\nimport { PDFViewerApplication } from \"./app.js\";\nimport { RenderingStates } from \"./renderable_view.js\";\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\nfunction getViewerConfiguration() {\n  return {\n    appContainer: document.body,\n    principalContainer: document.getElementById(\"mainContainer\"),\n    mainContainer: document.getElementById(\"viewerContainer\"),\n    viewerContainer: document.getElementById(\"viewer\"),\n    viewerAlert: document.getElementById(\"viewer-alert\"),\n    toolbar: {\n      container: document.getElementById(\"toolbarContainer\"),\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(\"zoomInButton\"),\n      zoomOut: document.getElementById(\"zoomOutButton\"),\n      print: document.getElementById(\"printButton\"),\n      editorCommentButton: document.getElementById(\"editorCommentButton\"),\n      editorCommentParamsToolbar: document.getElementById(\n        \"editorCommentParamsToolbar\"\n      ),\n      editorFreeTextButton: document.getElementById(\"editorFreeTextButton\"),\n      editorFreeTextParamsToolbar: document.getElementById(\n        \"editorFreeTextParamsToolbar\"\n      ),\n      editorHighlightButton: document.getElementById(\"editorHighlightButton\"),\n      editorHighlightParamsToolbar: document.getElementById(\n        \"editorHighlightParamsToolbar\"\n      ),\n      editorHighlightColorPicker: document.getElementById(\n        \"editorHighlightColorPicker\"\n      ),\n      editorInkButton: document.getElementById(\"editorInkButton\"),\n      editorInkParamsToolbar: document.getElementById(\"editorInkParamsToolbar\"),\n      editorStampButton: document.getElementById(\"editorStampButton\"),\n      editorStampParamsToolbar: document.getElementById(\n        \"editorStampParamsToolbar\"\n      ),\n      editorSignatureButton: document.getElementById(\"editorSignatureButton\"),\n      editorSignatureParamsToolbar: document.getElementById(\n        \"editorSignatureParamsToolbar\"\n      ),\n      download: document.getElementById(\"downloadButton\"),\n    },\n    secondaryToolbar: {\n      toolbar: document.getElementById(\"secondaryToolbar\"),\n      toggleButton: document.getElementById(\"secondaryToolbarToggleButton\"),\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      imageAltTextSettingsButton: document.getElementById(\n        \"imageAltTextSettings\"\n      ),\n      imageAltTextSettingsSeparator: document.getElementById(\n        \"imageAltTextSettingsSeparator\"\n      ),\n      documentPropertiesButton: document.getElementById(\"documentProperties\"),\n    },\n    viewsManager: {\n      outerContainer: document.getElementById(\"outerContainer\"),\n      toggleButton: document.getElementById(\"viewsManagerToggleButton\"),\n      sidebarContainer: document.getElementById(\"viewsManager\"),\n      resizer: document.getElementById(\"viewsManagerResizer\"),\n      thumbnailButton: document.getElementById(\"thumbnailsViewMenu\"),\n      outlineButton: document.getElementById(\"outlinesViewMenu\"),\n      attachmentsButton: document.getElementById(\"attachmentsViewMenu\"),\n      layersButton: document.getElementById(\"layersViewMenu\"),\n      viewsManagerSelectorButton: document.getElementById(\n        \"viewsManagerSelectorButton\"\n      ),\n      viewsManagerSelectorOptions: document.getElementById(\n        \"viewsManagerSelectorOptions\"\n      ),\n      thumbnailsView: document.getElementById(\"thumbnailsView\"),\n      outlinesView: document.getElementById(\"outlinesView\"),\n      attachmentsView: document.getElementById(\"attachmentsView\"),\n      layersView: document.getElementById(\"layersView\"),\n      viewsManagerAddFile: {\n        button: document.getElementById(\"viewsManagerAddFileButton\"),\n        picker: document.getElementById(\"viewsManagerAddFilePicker\"),\n      },\n      viewsManagerCurrentOutlineButton: document.getElementById(\n        \"viewsManagerCurrentOutlineButton\"\n      ),\n      viewsManagerHeaderLabel: document.getElementById(\n        \"viewsManagerHeaderLabel\"\n      ),\n      viewsManagerStatus: document.getElementById(\"viewsManagerStatus\"),\n      viewsManagerStatusBar: {\n        viewsManagerStatusAction: document.getElementById(\n          \"viewsManagerStatusAction\"\n        ),\n        viewsManagerStatusActionDeselectButton: document.getElementById(\n          \"viewsManagerStatusActionDeselectButton\"\n        ),\n        viewsManagerStatusActionLabel: document.getElementById(\n          \"viewsManagerStatusActionLabel\"\n        ),\n      },\n      viewsManagerUndoBar: {\n        viewsManagerStatusUndo: document.getElementById(\n          \"viewsManagerStatusUndo\"\n        ),\n        viewsManagerStatusUndoLabel: document.getElementById(\n          \"viewsManagerStatusUndoLabel\"\n        ),\n        viewsManagerStatusUndoButton: document.getElementById(\n          \"viewsManagerStatusUndoButton\"\n        ),\n        viewsManagerStatusUndoCloseButton: document.getElementById(\n          \"viewsManagerStatusUndoCloseButton\"\n        ),\n      },\n      viewsManagerWaitingBar: {\n        container: document.getElementById(\"viewsManagerStatusWaiting\"),\n        closeButton: document.getElementById(\n          \"viewsManagerStatusWaitingCloseButton\"\n        ),\n        label: document.getElementById(\"viewsManagerStatusWaitingLabel\"),\n      },\n      manageMenu: {\n        button: document.getElementById(\"viewsManagerStatusActionButton\"),\n        menu: document.getElementById(\"viewsManagerStatusActionOptions\"),\n        copy: document.getElementById(\"viewsManagerStatusActionCopy\"),\n        cut: document.getElementById(\"viewsManagerStatusActionCut\"),\n        delete: document.getElementById(\"viewsManagerStatusActionDelete\"),\n        exportSelected: document.getElementById(\n          \"viewsManagerStatusActionExport\"\n        ),\n      },\n    },\n    findBar: {\n      bar: document.getElementById(\"findbar\"),\n      toggleButton: document.getElementById(\"viewFindButton\"),\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(\"findPreviousButton\"),\n      findNextButton: document.getElementById(\"findNextButton\"),\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    altTextDialog: {\n      dialog: document.getElementById(\"altTextDialog\"),\n      optionDescription: document.getElementById(\"descriptionButton\"),\n      optionDecorative: document.getElementById(\"decorativeButton\"),\n      textarea: document.getElementById(\"descriptionTextarea\"),\n      cancelButton: document.getElementById(\"altTextCancel\"),\n      saveButton: document.getElementById(\"altTextSave\"),\n    },\n    newAltTextDialog: {\n      dialog: document.getElementById(\"newAltTextDialog\"),\n      title: document.getElementById(\"newAltTextTitle\"),\n      descriptionContainer: document.getElementById(\n        \"newAltTextDescriptionContainer\"\n      ),\n      textarea: document.getElementById(\"newAltTextDescriptionTextarea\"),\n      disclaimer: document.getElementById(\"newAltTextDisclaimer\"),\n      learnMore: document.getElementById(\"newAltTextLearnMore\"),\n      imagePreview: document.getElementById(\"newAltTextImagePreview\"),\n      createAutomatically: document.getElementById(\n        \"newAltTextCreateAutomatically\"\n      ),\n      createAutomaticallyButton: document.getElementById(\n        \"newAltTextCreateAutomaticallyButton\"\n      ),\n      downloadModel: document.getElementById(\"newAltTextDownloadModel\"),\n      downloadModelDescription: document.getElementById(\n        \"newAltTextDownloadModelDescription\"\n      ),\n      error: document.getElementById(\"newAltTextError\"),\n      errorCloseButton: document.getElementById(\"newAltTextCloseButton\"),\n      cancelButton: document.getElementById(\"newAltTextCancel\"),\n      notNowButton: document.getElementById(\"newAltTextNotNow\"),\n      saveButton: document.getElementById(\"newAltTextSave\"),\n    },\n    altTextSettingsDialog: {\n      dialog: document.getElementById(\"altTextSettingsDialog\"),\n      createModelButton: document.getElementById(\"createModelButton\"),\n      learnMore: document.getElementById(\"altTextSettingsLearnMore\"),\n      showAltTextDialogButton: document.getElementById(\n        \"showAltTextDialogButton\"\n      ),\n      altTextSettingsCloseButton: document.getElementById(\n        \"altTextSettingsCloseButton\"\n      ),\n      closeButton: document.getElementById(\"altTextSettingsCloseButton\"),\n    },\n    addSignatureDialog: {\n      dialog: document.getElementById(\"addSignatureDialog\"),\n      panels: document.getElementById(\"addSignatureActionContainer\"),\n      typeButton: document.getElementById(\"addSignatureTypeButton\"),\n      typeInput: document.getElementById(\"addSignatureTypeInput\"),\n      drawButton: document.getElementById(\"addSignatureDrawButton\"),\n      drawSVG: document.getElementById(\"addSignatureDraw\"),\n      drawPlaceholder: document.getElementById(\"addSignatureDrawPlaceholder\"),\n      drawThickness: document.getElementById(\"addSignatureDrawThickness\"),\n      imageButton: document.getElementById(\"addSignatureImageButton\"),\n      imageSVG: document.getElementById(\"addSignatureImage\"),\n      imagePlaceholder: document.getElementById(\"addSignatureImagePlaceholder\"),\n      imagePicker: document.getElementById(\"addSignatureFilePicker\"),\n      imagePickerLink: document.getElementById(\"addSignatureImageBrowse\"),\n      description: document.getElementById(\"addSignatureDescription\"),\n      clearButton: document.getElementById(\"clearSignatureButton\"),\n      saveContainer: document.getElementById(\"addSignatureSaveContainer\"),\n      saveCheckbox: document.getElementById(\"addSignatureSaveCheckbox\"),\n      errorBar: document.getElementById(\"addSignatureError\"),\n      errorTitle: document.getElementById(\"addSignatureErrorTitle\"),\n      errorDescription: document.getElementById(\"addSignatureErrorDescription\"),\n      errorCloseButton: document.getElementById(\"addSignatureErrorCloseButton\"),\n      cancelButton: document.getElementById(\"addSignatureCancelButton\"),\n      addButton: document.getElementById(\"addSignatureAddButton\"),\n    },\n    editSignatureDialog: {\n      dialog: document.getElementById(\"editSignatureDescriptionDialog\"),\n      description: document.getElementById(\"editSignatureDescription\"),\n      editSignatureView: document.getElementById(\"editSignatureView\"),\n      cancelButton: document.getElementById(\"editSignatureCancelButton\"),\n      updateButton: document.getElementById(\"editSignatureUpdateButton\"),\n    },\n    annotationEditorParams: {\n      editorCommentsSidebar: document.getElementById(\"editorCommentsSidebar\"),\n      editorCommentsSidebarCount: document.getElementById(\n        \"editorCommentsSidebarCount\"\n      ),\n      editorCommentsSidebarTitle: document.getElementById(\n        \"editorCommentsSidebarTitle\"\n      ),\n      editorCommentsSidebarCloseButton: document.getElementById(\n        \"editorCommentsSidebarCloseButton\"\n      ),\n      editorCommentsSidebarList: document.getElementById(\n        \"editorCommentsSidebarList\"\n      ),\n      editorCommentsSidebarResizer: document.getElementById(\n        \"editorCommentsSidebarResizer\"\n      ),\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      editorStampAddImage: document.getElementById(\"editorStampAddImage\"),\n      editorSignatureAddSignature: document.getElementById(\n        \"editorSignatureAddSignature\"\n      ),\n      editorFreeHighlightThickness: document.getElementById(\n        \"editorFreeHighlightThickness\"\n      ),\n      editorHighlightShowAll: document.getElementById(\"editorHighlightShowAll\"),\n    },\n    printContainer: document.getElementById(\"printContainer\"),\n    editorUndoBar: {\n      container: document.getElementById(\"editorUndoBar\"),\n      message: document.getElementById(\"editorUndoBarMessage\"),\n      undoButton: document.getElementById(\"editorUndoBarUndoButton\"),\n      closeButton: document.getElementById(\"editorUndoBarCloseButton\"),\n    },\n    editCommentDialog: {\n      dialog: document.getElementById(\"commentManagerDialog\"),\n      toolbar: document.getElementById(\"commentManagerToolbar\"),\n      title: document.getElementById(\"commentManagerTitle\"),\n      textInput: document.getElementById(\"commentManagerTextInput\"),\n      cancelButton: document.getElementById(\"commentManagerCancelButton\"),\n      saveButton: document.getElementById(\"commentManagerSaveButton\"),\n    },\n  };\n}\n\nfunction webViewerLoad() {\n  const config = getViewerConfiguration();\n\n  if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"GENERIC\")) {\n    // Give custom implementations of the default viewer a simpler way to\n    // set various `AppOptions`, by dispatching an event once all viewer\n    // files are loaded but *before* the viewer initialization has run.\n    const event = new CustomEvent(\"webviewerloaded\", {\n      bubbles: true,\n      cancelable: true,\n      detail: {\n        source: window,\n      },\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  PDFViewerApplication.run(config);\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","PresentationModeState","UNKNOWN","NORMAL","CHANGING","FULLSCREEN","SidebarView","NONE","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","TextLayerMode","DISABLE","ENABLE","ENABLE_PERMISSIONS","ScrollMode","VERTICAL","HORIZONTAL","WRAPPED","PAGE","SpreadMode","ODD","EVEN","CursorTool","SELECT","HAND","ZOOM","AutoPrintRegExp","scrollIntoView","element","spot","parent","offsetParent","console","error","offsetY","offsetTop","clientTop","offsetX","offsetLeft","clientLeft","clientHeight","scrollHeight","clientWidth","scrollWidth","top","undefined","left","scrollLeft","scrollTop","watchScroll","viewAreaElement","callback","abortSignal","debounceScroll","evt","rAF","window","requestAnimationFrame","viewAreaElementScrolled","currentX","lastX","state","right","currentY","lastY","down","_eventHandler","addEventListener","useCapture","signal","cancelAnimationFrame","once","parseQueryString","query","params","Map","key","value","URLSearchParams","set","toLowerCase","InvisibleCharsRegExp","removeNullCharacters","str","replaceInvisible","test","replaceAll","m","binarySearchFirstItem","items","condition","start","minIndex","maxIndex","length","currentIndex","currentItem","approximateFraction","x","Math","floor","xinv","limit","x_","a","b","c","d","p","q","result","floorToDivide","div","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","minY","max","minX","hiddenHeight","hiddenWidth","fractionHeight","fractionWidth","percent","push","id","y","visibleArea","maxX","min","maxY","widthPercent","add","first","last","at","sort","pc","abs","normalizeWheelEventDirection","delta","hypot","deltaX","deltaY","angle","atan2","PI","normalizeWheelEventDelta","deltaMode","MOUSE_PIXELS_PER_LINE","MOUSE_LINES_PER_PAGE","WheelEvent","DOM_DELTA_PIXEL","DOM_DELTA_LINE","isValidRotation","Number","isInteger","isValidScrollMode","mode","Object","values","includes","isValidSpreadMode","isPortraitOrientation","size","animationStarted","Promise","resolve","docStyle","document","documentElement","style","ProgressBar","classList","disableAutoFetchTimeout","constructor","bar","val","isNaN","remove","setProperty","setWidth","viewer","container","parentNode","scrollbarWidth","offsetWidth","setDisableAutoFetch","delay","clearTimeout","show","setTimeout","hide","getActiveOrFocusedElement","curRoot","curActiveOrFocused","activeElement","querySelector","shadowRoot","apiPageLayoutToViewerModes","layout","scrollMode","spreadMode","apiPageModeToSidebarView","toggleCheckedBtn","button","toggle","setAttribute","toggleSelectedBtn","toggleExpandedBtn","calcRound","e","createElement","fround","compatParams","maxTouchPoints","platform","userAgent","navigator","isAndroid","isIOS","OptionKind","BROWSER","VIEWER","API","WORKER","EVENT_DISPATCH","PREFERENCE","Type","BOOLEAN","NUMBER","OBJECT","STRING","UNDEFINED","defaultOptions","allowedGlobalEvents","kind","canvasMaxAreaInBytes","isInAutomation","localeProperties","lang","language","maxCanvasDim","nimbusDataStr","supportsCaretBrowsingMode","supportsDocumentFonts","supportsIntegratedFind","supportsMouseWheelZoomCtrlKey","supportsMouseWheelZoomMetaKey","supportsPinchToZoom","supportsPrinting","toolbarDensity","altTextLearnMoreUrl","annotationEditorMode","annotationMode","capCanvasAreaFactor","commentLearnMoreUrl","cursorToolOnLoad","debuggerSrc","defaultZoomDelay","defaultZoomValue","disableHistory","disablePageLabels","enableAltText","enableAltTextModelDownload","enableAutoLinking","enableComment","enableDetailCanvas","enableGuessAltText","enableHighlightFloatingButton","enableMerge","enableNewAltTextWhenAddingImage","enableNewBadge","enableOptimizedPartialRendering","enablePermissions","enablePrintAutoRotate","enableScripting","enableSignatureEditor","enableSplitMerge","enableUpdatedAddImage","externalLinkRel","externalLinkTarget","highlightEditorColors","historyUpdateUrl","ignoreDestinationZoom","imageResourcesPath","imagesRightClickMinSize","maxCanvasPixels","minDurationToUpdateCanvas","forcePageColors","pageColorsBackground","pageColorsForeground","pdfBugEnabled","printResolution","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","textLayerMode","viewerCssTheme","viewOnLoad","cMapPacked","cMapUrl","disableAutoFetch","disableFontFace","disableRange","disableStream","docBaseUrl","enableHWA","enableWebGPU","enableXfa","fontExtraProperties","iccUrl","isOffscreenCanvasSupported","maxImageSize","pdfBug","standardFontDataUrl","useSystemFonts","type","verbosity","wasmUrl","workerPort","workerSrc","defaultUrl","sandboxBundleSrc","enableFakeMLManager","disablePreferences","AppOptions","eventBus","opts","name","_hasInvokedSet","_checkDisablePreferences","get","warn","getAll","defaultOnly","options","create","defaultOpt","setAll","prefs","events","userOpt","toUpperCase","dispatch","source","AbortException","AnnotationEditorLayer","AnnotationEditorParamsType","AnnotationEditorType","AnnotationEditorUIManager","AnnotationLayer","AnnotationMode","AnnotationType","applyOpacity","build","ColorPicker","createValidAbsoluteUrl","CSSConstants","DOMSVGFactory","DrawLayer","FeatureTest","fetchData","findContrastColor","getDocument","getFilenameFromUrl","getPdfFilenameFromUrl","getRGB","getRGBA","getUuid","getXfaPageViewport","GlobalWorkerOptions","ImageKind","InvalidPDFException","isDataScheme","isPdfFile","isValidExplicitDest","makeArr","makeMap","makeObj","MathClamp","noContextMenu","normalizeUnicode","OPS","OutputScale","PasswordResponses","PDFDataRangeTransport","PDFDateString","PDFWorker","PermissionFlag","PixelsPerInch","RenderingCancelledException","renderRichText","ResponseException","setLayerDimensions","shadow","SignatureExtractor","stopEvent","SupportedImageMimeTypes","TextLayer","TextLayerImages","TouchManager","updateUrlHash","Util","VerbosityLevel","version","XfaLayer","globalThis","pdfjsLib","DEFAULT_LINK_REL","LinkTarget","SELF","BLANK","PARENT","TOP","PDFLinkService","externalLinkEnabled","_ignoreDestinationZoom","baseUrl","pdfDocument","pdfViewer","pdfHistory","setDocument","setViewer","setHistory","pagesCount","pagesMapper","pagesNumber","page","currentPageNumber","rotation","pagesRotation","isInPresentationMode","goToDestination","dest","namedDest","explicitDest","pageNumber","getDestination","Array","isArray","destRef","cachedPageNumber","getPageIndex","pushCurrentPosition","scrollPageIntoView","destArray","ac","AbortController","_on","textLayer","focus","abort","goToPage","pageLabelToPageNumber","pushPage","goToXY","addLinkAttributes","link","url","newWindow","Error","target","rel","displayUrl","parsedUrl","URL","parse","username","password","href","title","onclick","targetStr","getDestinationHash","getAnchorUrl","escape","JSON","stringify","anchor","setHash","hash","has","phrase","match","zoomArgs","split","zoomArg","zoomArgNumber","parseFloat","allowNegativeOffset","unescape","toString","executeNamedAction","action","back","forward","nextPage","previousPage","executeSetOCGState","optionalContentConfig","optionalContentConfigPromise","setOCGState","SimpleLinkService","WaitOnType","EVENT","TIMEOUT","waitOnEventOrTimeout","promise","withResolvers","handler","timeout","evtMethod","EventBus","bind","listeners","on","eventName","listener","external","off","_off","data","eventListeners","externalListeners","slice","rmAbort","AbortSignal","aborted","onAbort","removeEventListener","ii","splice","FirefoxEventBus","externalServices","globalEventNames","BaseExternalServices","updateFindControlState","updateFindMatchesCount","initPassiveLoading","reportTelemetry","reportText","createL10n","createScripting","createSignatureStorage","updateEditorStates","dispatchGlobalEvent","_event","BasePreferences","defaults","freeze","initializedPromise","_readFromStorage","then","browserPrefs","_writeToStorage","prefObj","reset","FluentType","valueOf","FluentNone","scope","FluentNumber","nf","memoizeIntlObject","Intl","NumberFormat","format","err","reportError","FluentDateTime","supportsValue","Date","_Temporal","Temporal","Instant","PlainDateTime","PlainDate","PlainMonthDay","PlainTime","PlainYearMonth","calendar","calendarId","Symbol","toPrimitive","hint","toNumber","getTime","epochMilliseconds","toZonedDateTime","TypeError","dtf","DateTimeFormat","toISOString","MAX_PLACEABLES","FSI","PDI","selector","category","PluralRules","select","getDefault","variants","star","resolvePattern","RangeError","getArguments","args","positional","named","arg","resolveExpression","expr","minimumFractionDigits","precision","resolveVariableReference","resolveMessageReference","resolveTermReference","resolveFunctionReference","resolveSelectExpression","prototype","hasOwnProperty","call","ReferenceError","attr","message","bundle","_messages","attribute","attributes","term","_terms","resolved","func","_functions","sel","variant","resolveComplexPattern","ptn","dirty","useIsolating","_useIsolating","elem","_transform","placeables","delete","join","Scope","errors","WeakSet","ctor","cache","_intls","locales","allowed","unwrapped","opt","entries","NUMBER_ALLOWED","DATETIME_ALLOWED","DATETIME","getMemoizerForLocale","stringLocale","memoizer","FluentBundle","functions","transform","v","hasMessage","getMessage","addResource","res","allowOverrides","body","entry","startsWith","formatPattern","pattern","RE_MESSAGE_START","RE_ATTRIBUTE_START","RE_VARIANT_START","RE_NUMBER_LITERAL","RE_IDENTIFIER","RE_REFERENCE","RE_FUNCTION_NAME","RE_TEXT_RUN","RE_STRING_RUN","RE_STRING_ESCAPE","RE_UNICODE_ESCAPE","RE_LEADING_NEWLINES","RE_TRAILING_SPACES","RE_BLANK_LINES","RE_INDENT","TOKEN_BRACE_OPEN","TOKEN_BRACE_CLOSE","TOKEN_BRACKET_OPEN","TOKEN_BRACKET_CLOSE","TOKEN_PAREN_OPEN","TOKEN_ARROW","TOKEN_COLON","TOKEN_COMMA","TOKEN_BLANK","FluentResource","lastIndex","cursor","next","exec","parseMessage","SyntaxError","re","consumeChar","char","errorClass","consumeToken","match1","parsePattern","parseAttributes","keys","attrs","parsePatternElements","Infinity","indent","parseIndent","trim","elements","commonIndent","parsePlaceable","lastElement","baked","Indent","parseInlineExpression","parseVariants","sigil","parseArguments","parseLiteral","parseArgument","count","parseVariantKey","parseNumberLiteral","parseStringLiteral","fraction","parseEscapeSequence","codepoint4","codepoint6","codepoint","parseInt","String","fromCodePoint","makeIndent","text","replace","blank","reOverlay","TEXT_LEVEL_ELEMENTS","LOCALIZABLE_ATTRIBUTES","global","area","input","menuitem","menu","optgroup","option","track","img","textarea","th","description","label","textbox","translateElement","translation","localName","namespaceURI","textContent","templateElement","ownerDocument","createElementNS","innerHTML","overlayChildNodes","content","overlayAttributes","fromFragment","toElement","childNode","childNodes","nodeType","TEXT_NODE","hasAttribute","sanitized","getNodeForNamedElement","replaceChild","isElementAllowed","createSanitizedElement","createTextNodeFromTextContent","appendChild","fromElement","explicitlyAllowed","getAttribute","map","from","isAttrNameLocalizable","removeAttribute","sourceElement","translatedChild","childName","sourceChild","removeChild","clone","cloneNode","shallowPopulateUsing","createTextNode","attrName","elemName","CachedIterable","iterable","CachedSyncIterable","iterator","cached","cur","touchNext","idx","done","CachedAsyncIterable","asyncIterator","default","Localization","resourceIds","generateBundles","onChange","addResourceIds","eager","removeResourceIds","filter","r","formatWithFallback","method","translations","hasAtLeastOneBundle","bundles","missingIds","keysFromBundle","locale","formatMessages","messageFromBundle","formatValues","valueFromBundle","formatValue","handleEvent","formatted","attrNames","messageErrors","forEach","L10NID_ATTR_NAME","L10NARGS_ATTR_NAME","L10N_ELEMENT_QUERY","DOMLocalization","roots","pendingrAF","pendingElements","windowElement","mutationObserver","observerConfig","characterData","childList","subtree","attributeFilter","translateRoots","setAttributes","getAttributes","connectRoot","newRoot","root","contains","defaultView","MutationObserver","mutations","translateMutations","observe","disconnectRoot","pauseObserving","clear","resumeObserving","all","translateFragment","takeRecords","disconnect","mutation","addedNode","addedNodes","ELEMENT_NODE","childElementCount","getTranslatables","translateElements","frag","getKeysForElement","applyTranslations","nodes","querySelectorAll","L10n","dir","l10n","isRTL","fixupLangCode","_setL10n","getLanguage","getDirection","fallback","messages","translate","translateOnce","ex","destroy","pause","resume","#fixupLangCode","langCode","PARTIAL_LANG_CODES","en","es","fy","ga","gu","hi","hy","nb","ne","nn","pa","pt","sv","zh","#isRTL","shortCode","GenericL10n","PLATFORM","isLinux","isMac","isWindows","createBundle","resource","generateBundlesFallback","#generateBundles","defaultLang","baseLang","baseURL","paths","getPaths","langs","shortLang","bundlePromise","createBundleFallback","#createBundle","path","#getPaths","substring","lastIndexOf","#generateBundlesFallback","#createBundleFallback","docProperties","info","metadata","contentDispositionFilename","contentLength","getMetadata","filesize","getDownloadInfo","filename","getRaw","authors","numPages","GenericScripting","_ready","reject","sandbox","pdfjsSandbox","QuickJSSandbox","location","catch","createSandbox","dispatchEventInSandbox","event","dispatchEvent","destroySandbox","nukeSandbox","KEY_STORAGE","SignatureStorage","signatures","save","#save","localStorage","setItem","fromEntries","getItem","isFull","uuid","initCom","app","Preferences","ExternalServices","MLManager","isEnabledFor","_name","deleteModel","_service","isReady","guess","_data","toggleService","_enabled","NewAltTextManager","boundCancel","cancel","createAutomaticallyButton","currentEditor","cancelButton","descriptionContainer","dialog","disclaimer","downloadModel","downloadModelDescription","firstTime","guessedAltText","hasAI","isEditing","imagePreview","imageData","isAILoading","wasAILoading","learnMore","notNowButton","overlayManager","uiManager","previousAltText","saveButton","errorCloseButton","close","preventDefault","toggleError","checked","_reportTelemetry","status","isAltTextEnabled","mlManager","disabled","setProgress","setPreference","setPref","toggleGuessAltText","toggleLoading","toggleTitleAndDisclaimer","ctrlKey","metaKey","register","topic","#setPref","#toggleLoading","#toggleError","#toggleGuessAltText","isInitial","mlGuessAltText","toggleNotNow","#toggleNotNow","toggleAI","#toggleAI","#toggleTitleAndDisclaimer","hidden","#mlGuessAltText","addAltText","hasError","altText","#addAltText","#setProgress","detail","finished","total","totalLoaded","ONE_MEGA_BYTES","totalSize","ariaValueMax","round","downloadedSize","ariaValueNow","editAltText","editor","hasAltTextData","altTextFinish","hasProgress","isAltTextEnabledPromise","removeEditListeners","altTextData","AI_MAX_IMAGE_DIMENSION","MAX_PREVIEW_DIMENSION","canvas","copyCanvas","append","open","#cancel","alt_text_type","flow","alt_text_modal","finish","#finish","closeIfActive","#close","firstElementChild","addEditListeners","setSelected","extractWords","#extractWords","decorative","guessedWords","words","total_words","words_removed","difference","words_added","ImageAltTextSettings","createModelButton","showAltTextDialogButton","closeButton","togglePref","download","#reportTelemetry","details","#download","isFromUI","#delete","#togglePref","AltTextManager","clickAC","hasUsedPointer","optionDescription","optionDecorative","resizeAC","svgElement","rectElement","telemetryData","onUpdateUIState","updateUIState","createSVGElement","#createSVGElement","svgFactory","svg","defs","mask","rect","clickOpts","onClick","setPosition","#setPosition","containerX","containerY","containerW","containerH","getBoundingClientRect","innerWidth","windowW","innerHeight","windowH","dialogW","dialogH","getClientDimensions","MARGIN","isLTR","direction","xs","xe","ys","ye","alt_text_keyboard","removeOnClickListeners","#updateUIState","alt_text_description","alt_text_edit","alt_text_decorative","#onClick","#removeOnClickListeners","AnnotationEditorParams","bindListeners","#bindListeners","editorFreeTextFontSize","editorFreeTextColor","editorInkColor","editorInkThickness","editorInkOpacity","editorStampAddImage","editorFreeHighlightThickness","editorHighlightShowAll","editorSignatureAddSignature","typeStr","valueAsNumber","updateInkColor","updateInkOpacity","isAlphaColorInputSupported","closest","currentInkColor","currentInkOpacity","rgba","g","opacity","hex","makeHexColor","color","alphaHex","hexNums","FREETEXT_SIZE","FREETEXT_COLOR","INK_COLOR","INK_THICKNESS","INK_OPACITY","HIGHLIGHT_COLOR","HIGHLIGHT_THICKNESS","HIGHLIGHT_FREE","HIGHLIGHT_SHOW_ALL","PRECISION","CaretBrowsingMode","mainContainer","toolBarHeight","viewerContainer","toolbarContainer","toolbarObserver","ResizeObserver","borderBoxSize","blockSize","isOnSameLine","#isOnSameLine","rect1","rect2","top1","bot1","mid1","top2","bot2","mid2","isUnderOver","#isUnderOver","isUp","midY","isVisible","#isVisible","getCaretPosition","#getCaretPosition","selection","focusNode","focusOffset","range","createRange","setStart","setEnd","caretPositionFromPoint","#caretPositionFromPoint","startContainer","offsetNode","startOffset","offset","caretRangeFromPoint","setCaretPositionHelper","#setCaretPositionHelper","caretX","extend","firstChild","lastChild","caretPosition","parentElement","elementsAtPoint","elementsFromPoint","savedVisibilities","el","visibility","setCaretPosition","#setCaretPosition","newLineElement","newLineElementRect","getNodeOnNextPage","#getNodeOnNextPage","walker","createTreeWalker","NodeFilter","SHOW_TEXT","node","moveCaret","getSelection","rangeCount","focusElement","Node","currentNode","focusRect","nodeIterator","previousSibling","nextSibling","lastNode","addRange","caretY","elementRect","RESIZE_TIMEOUT","Sidebar","initialWidth","coefficient","resizeTimeout","resizer","isResizerOnTheLeft","isKeyboardResizing","resizeObserver","prevX","sidebar","toggleButton","ltr","globalAbortSignal","_sidebar","getComputedStyle","getPropertyValue","ariaValueMin","makeSidebarResizable","_isOpen","inlineSize","#makeSidebarResizable","sidebarStyle","pointerMoveAC","cancelResize","onStopResizing","NaN","onStartResizing","clientX","parentStyle","minWidth","ev","capture","isArrowLeft","base","dx","#setWidth","newWidth","insetInlineStart","toFixed","onResizing","_newWidth","CommentManager","popup","hasForcedColors","commentDialog","linkService","dateFormat","dateStyle","dialogElement","CommentDialog","CommentPopup","CommentSidebar","setSidebarUiManager","setUIManager","showSidebar","annotations","hideSidebar","removeComments","selectComment","addComment","annotation","updateComment","toggleCommentPopup","isSelected","isEditable","uid","destroyPopup","updatePopupColor","updateColor","showDialog","posX","posY","makeCommentColor","_makeCommentColor","commentForegroundColor","boundCommentClick","commentClick","boundCommentKeydown","commentKeydown","commentsList","commentCount","sidebarTitle","learnMoreUrl","elementsToAnnotations","idsToElements","sidebarResizer","commentToolbarButton","keyDownCallback","lastElementChild","WeakMap","sortComments","fragment","createDocumentFragment","createCommentElement","setCommentsCount","numberOfAnnotations","replaceChildren","removeAll","removeComment","focusComment","children","creationDate","modificationDate","richText","contentsObj","popupRef","prevAnnotation","setDate","setText","insertBefore","#removeComment","#removeAll","hasNoElement","behavior","block","commentItem","#setCommentsCount","createZeroCommentElement","#createZeroCommentElement","textDiv","className","#setDate","date","toDateObject","dateTime","#setText","html","#createCommentElement","role","tabIndex","backgroundColor","dateDiv","#commentClick","currentTarget","_hide","pageIndex","pageVisiblePromise","waitForEditorsRendered","center","#commentKeydown","nextElementSibling","previousElementSibling","#sortComments","dateA","dateB","localeCompare","previousText","commentText","textInput","prevDragX","prevDragY","dialogX","dialogY","toolbar","finishBound","cancelDrag","clientY","getData","dialogStyle","borderColor","parentDimensions","hasDefaultPopupPosition","dialogWidth","dialogHeight","_dialogDimensions","buttonWidth","commentButtonWidth","comment","display","edited","focusCommentButton","buttonsContainer","time","previousFocusedElement","selected","_popupWidth","createPopup","#createPopup","ariaModal","buttons","edit","ariaHasPopup","ariaControlsElements","editLabel","editComment","del","delLabel","deleted","savedData","_uiManager","deleteComment","separator","parentWidth","parentHeight","parentBoundingClientRect","setCommentButtonStates","hasPopup","commentPopupPosition","elementBeforePopup","after","relatedTarget","correctPosition","parentRect","widthRatio","margin","BaseDownloadManager","openBlobUrls","_triggerDownload","blobUrl","originalUrl","isAttachment","_getOpenDataUrl","downloadData","contentType","createObjectURL","Blob","openOrDownloadData","isPdfData","getOrInsertComputed","viewerUrl","revokeObjectURL","DownloadManager","click","encodeURIComponent","EditorUndoBar","focusTimeout","initController","isOpen","showController","undoButton","l10nMessages","highlight","freetext","stamp","ink","signature","_multiple","undoAction","messageData","boundHide","OverlayManager","overlays","active","canForceClose","showModal","PasswordPrompt","activeCapability","updateCallback","reason","isViewerEmbedded","submitButton","_isViewerEmbedded","verify","keyCode","passwordIncorrect","INCORRECT_PASSWORD","#verify","invokeCallback","#invokeCallback","setUpdateCallback","TREEITEM_SELECTED_CLASS","BaseTreeViewer","_l10n","_pdfDocument","_lastToggleIsShow","_currentTreeItem","_dispatchEvent","_bindLink","_normalizeTextContent","_addToggleButton","toggler","prepend","_toggleTreeItem","_toggleAllTreeItems","_finishRendering","hasAnyNesting","shiftKey","shouldShowAll","render","_updateCurrentTreeItem","treeItem","_scrollToCurrentTreeItem","inline","PDFAttachmentViewer","downloadManager","appendAttachment","keepRenderedCapability","_attachments","_renderedCapability","_pendingDispatchEvent","attachmentsCount","attachments","ul","item","li","#appendAttachment","renderedPromise","CSS_CLASS_GRAB","GrabToPan","activateAC","mouseDownAC","scrollAC","overlay","activate","onMouseDown","deactivate","endPan","ignoreTarget","matches","#onMouseDown","originalTarget","tagName","scrollLeftStart","scrollTopStart","clientXStart","clientYStart","boundEndPan","mouseOpts","onMouseMove","focusedElement","blur","#onMouseMove","xDiff","yDiff","scrollTo","#endPan","PDFCursorTools","prevActive","addEventListeners","switchTool","activeTool","tool","#switchTool","disableActiveTool","_handTool","#addEventListeners","presentationModeState","enableActive","disableActive","NON_METRIC_LOCALES","US_PAGE_NAMES","METRIC_PAGE_NAMES","getPageName","isPortrait","pageNames","PDFDocumentProperties","fieldData","fields","fileNameLookup","titleLookup","_fileNameLookup","_titleLookup","_currentPageNumber","_pagesRotation","_dataAvailableCapability","updateUI","pdfPage","getPage","fileName","fileSize","pageSize","isLinearized","parseFileSize","parseDate","CreationDate","ModDate","parsePageSize","parseLinearization","IsLinearized","author","Author","subject","Subject","keywords","Keywords","creator","Creator","producer","Producer","PDFFormatVersion","pageCount","linearized","assign","#reset","#updateUI","#parseFileSize","kb","mb","#parsePageSize","pageSizeInches","nonMetric","sizeInches","sizeMillimeters","nameId","exactMillimeters","intMillimeters","unit","orientation","#parseDate","metadataDate","infoDate","dateObj","#parseLinearization","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","getCharacterType","NormalizeWithNFKC","getNormalizeWithNFKC","ranges","diacriticsRegex","fromCharCode","normalize","rangesStr","log","charCodeAt","padStart","FindState","FOUND","NOT_FOUND","PENDING","FIND_TIMEOUT","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","syllablePositions","len","hasSyllables","ignoreDashEOL","normalizationRegex","toNormalizeWithNFKC","CJK","HKDiacritics","BrokenWord","regexps","RegExp","rawDiacriticsPositions","normalized","positions","rawDiacriticsIndex","syllableIndex","shift","shiftOrigin","eol","hasDiacritics","p1","p2","p3","p4","p5","p6","p7","p8","p9","replacement","jj","j","charAt","hasTrailingDashEOL","endsWith","newCharLen","starts","Uint32Array","shifts","Int32Array","getOriginalIndex","diffs","pos","end","oldStart","oldEnd","oldLen","PDFFindController","updateMatchesCountOnProgress","visitedPagesCount","copiedPageData","savedPageData","_linkService","_eventBus","onIsPageVisible","onFind","onFindBarClose","onPagesEdited","highlightMatches","_highlightMatches","pageMatches","_pageMatches","pageMatchesLength","_pageMatchesLength","_selected","_firstPageCapability","#onFind","shouldDirtyMatch","_dirtyMatch","extractText","findbarClosed","pendingTimeout","_findTimeout","nextMatch","highlightAll","updateAllPages","scrollMatchIntoView","matchIndex","_scrollMatches","matchIdx","pageIdx","_offset","wrapped","_extractTextPromises","_pageContents","_pageDiffs","_hasDiacritics","_matchesCountTotal","_pagesToSearch","_pendingFindMatches","_resumePageIdx","#query","_rawQuery","_normalizedQuery","#shouldDirtyMatch","newQuery","prevQuery","newType","prevType","isEntireWord","#isEntireWord","startIdx","convertToRegExpString","#convertToRegExpString","matchDiacritics","isUnicode","addExtraWhitespaces","original","fixed","trailingSpaces","calculateMatch","#calculateMatch","pageContent","matcherResult","matchesLength","matchPos","matchLen","updatePage","nextPageMatch","pageMatchesCount","updateUIResultsCount","reverse","isUnicodePart","queryPart","caseSensitive","entireWord","flags","#extractText","deferred","textOptions","disableNormalization","pdfDoc","getTextContent","strBuf","textItem","hasEOL","#updatePage","#updateAllPages","#nextMatch","previous","findPrevious","currentPageIndex","numPageMatches","updateMatch","advanceOffsetPage","matchesReady","#matchesReady","numMatches","#nextPageMatch","#advanceOffsetPage","#updateMatch","found","#onPagesEdited","pageNumbers","promises","contents","diacritics","pageNum","prevPromises","prevContents","prevDiffs","prevDiacritics","extractTextPromises","pageContents","pageDiffs","prevPageNumber","getPrevPageNumber","src","#onFindBarClose","requestMatchesCount","#requestMatchesCount","current","#updateUIResultsCount","matchesCount","rawQuery","MATCHES_COUNT_LIMIT","PDFFindBar","resizeObserverCallback","opened","findField","highlightAllCheckbox","caseSensitiveCheckbox","matchDiacriticsCheckbox","entireWordCheckbox","findMsg","findResultsCount","findPreviousButton","findNextButton","checkedInputs","evtName","findPrev","findMsgId","updateResultsCount","#resizeObserverCallback","findbarHeight","inputContainerHeight","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","getCurrentHash","PDFHistory","eventAbortController","_initialized","_fingerprint","_isPagesLoaded","initialize","fingerprint","resetHistory","updateUrl","reInitialized","_updateUrl","bindEvents","history","_popStateInProgress","_blockHashChange","_currentHash","_numPositionUpdates","_uid","_maxUid","_destination","_position","isValidState","parseCurrentHash","pushOrReplaceState","destination","updateInternalState","_initialRotation","_initialBookmark","pageHide","unbindEvents","_updateViewareaTimeout","isValidPage","forceReplace","isDestHashesEqual","isDestArraysEqual","tryPushCurrentPosition","popStateInProgress","initialBookmark","initialRotation","#pushOrReplaceState","shouldReplace","newState","newUrl","protocol","replaceState","pushState","#tryPushCurrentPosition","temporary","position","#isValidPage","#isValidState","checkReload","perfEntry","performance","getEntriesByType","#updateInternalState","removeTemporary","#parseCurrentHash","checkNameddest","nameddest","updateViewarea","#updateViewarea","pdfOpenParams","popState","#popState","newHash","hashChanged","#pageHide","#bindEvents","#unbindEvents","destHash","pushHash","firstDest","secondDest","isEntryEqual","second","PDFLayerViewer","updateLayers","_optionalContentConfig","_optionalContentVisibility","layersCount","groupId","setVisibility","_setNestedName","fontStyle","groups","getOrder","queue","levelData","itemsDiv","order","group","getGroup","#updateLayers","getOptionalContentConfig","intent","PDFOutlineViewer","_currentOutlineItem","_currentOutlineItemCapability","_sidebarView","_outline","_pageNumberToDestHashCapability","outlineCount","loadingParams","currentOutlineItemPromise","attachment","_setStyles","bold","italic","fontWeight","totalCount","nestedCount","nestedItems","outline","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","PDFPresentationMode","fullscreenChangeAbortController","windowAbortController","contextMenuOpen","mouseScrollTimeStamp","mouseScrollDelta","touchSwipeState","request","requestFullscreen","addFullscreenChangeListeners","notifyStateChange","scaleValue","currentScaleValue","pageViewsReady","hasEqualPageSizes","removeFullscreenChangeListeners","mouseWheel","#mouseWheel","currentTime","now","storedTime","resetMouseScrollState","totalDelta","success","#notifyStateChange","enter","#enter","addWindowListeners","showControls","empty","exit","#exit","removeWindowListeners","hideControls","mouseDown","#mouseDown","contextMenu","#contextMenu","#showControls","controlsTimeout","#hideControls","#resetMouseScrollState","touchSwipe","#touchSwipe","touches","startX","pageX","startY","pageY","endX","endY","dy","absAngle","#addWindowListeners","touchSwipeBind","passive","#removeWindowListeners","#addFullscreenChangeListeners","fullscreenElement","#removeFullscreenChangeListeners","XfaLayerBuilder","annotationStorage","xfaHtml","_cancelled","viewport","parameters","dontFlip","getXfa","textDivs","update","BasePrintServiceFactory","initGlobals","createPrintService","getXfaHtmlForPrinting","printContainer","allXfaHtml","scale","PDF_TO_CSS_UNITS","xfaPage","builder","activeService","viewerApp","initialized","renderPage","activeServiceOnEntry","printAnnotationStoragePromise","scratchCanvas","PRINT_UNITS","PDF","ctx","getContext","fillStyle","fillRect","restore","printAnnotationStorage","renderContext","getViewport","ENABLE_STORAGE","renderTask","PDFPrintService","pagesOverview","_printResolution","_optionalContentConfigPromise","_printAnnotationStoragePromise","currentPage","throwIfInactive","every","pageStyleSheet","_blobURLs","ensureOverlay","renderPages","isPureXfa","renderNextPage","renderProgress","useRenderedPage","toBlob","blob","blobURL","wrapper","onload","onerror","performPrint","print","eventType","CustomEvent","bubbles","cancelable","getElementById","progress","progressBar","progressPerc","altKey","chrome","opera","stopImmediatePropagation","stopPropagationIfNeeded","overlayPromise","PDFPrintServiceFactory","RenderingStates","INITIAL","RUNNING","PAUSED","FINISHED","RenderableView","renderingId","renderingState","draw","CLEANUP_TIMEOUT","PDFRenderingQueue","highestPriorityPage","idleTimeout","pdfThumbnailViewer","isThumbnailViewEnabled","onIdle","printing","defineProperty","setThumbnailViewer","isHighestPriority","renderHighestPriority","currentlyVisiblePages","forceRendering","getHighestPriority","scrolledDown","preRenderExtra","ignoreDetailViews","visibleViews","numVisible","isViewFinished","detailView","firstId","lastId","visibleIds","holeId","holeView","preRenderIndex","preRenderView","renderView","finally","PDFScriptingManager","closeCapability","destroyCapability","ready","scripting","willPrintCapability","destroyScripting","objects","calculationOrder","docActions","getFieldObjects","getCalculationOrderIds","getJSActions","initScripting","updateFromSandbox","dispatchPageClose","dispatchPageOpen","_pageOpenPending","appInfo","docInfo","actions","dispatchWillSave","dispatchDidSave","dispatchWillPrint","dispatchDidPrint","destroyPromise","_visitedPages","#updateFromSandbox","isChangingPresentationMode","siblings","command","modes","pagesPromise","increaseScale","decreaseScale","elementId","setValue","#dispatchPageOpen","visitedPages","pageView","getPageView","actionsPromise","#dispatchPageClose","#initScripting","#destroyScripting","race","Menu","triggeringButton","menuItems","openMenuAC","menuAC","onFocusOutBound","onFocusOut","menuContainer","setUpMenu","closeMenu","#closeMenu","ariaExpanded","openMenu","#openMenu","any","#onFocusOut","#setUpMenu","goToNextItem","find","findLast","toLocaleLowerCase","#goToNextItem","check","indexOf","increment","menuItem","DRAW_UPSCALE_FACTOR","MAX_NUM_SCALING_STEPS","THUMBNAIL_WIDTH","getTempCanvas","OffscreenCanvas","alpha","PDFThumbnailView","defaultViewport","renderingQueue","pageColors","pageLabel","pdfPageRotate","placeholder","thumbnailContainer","imageContainer","draggable","getPageL10nArgs","image","checkbox","pasteButton","updateDims","thumbnailView","replaceWith","addPasteButton","pasteCallback","span","prevPasteButton","before","removePasteButton","toggleSelected","updateId","newId","setPageLabel","#updateDims","ratio","canvasWidth","canvasHeight","setPdfPage","totalRotation","cancelRendering","toggleCurrent","isCurrent","ariaCurrent","getPageDrawContext","#getPageDrawContext","upscaleFactor","outputScale","limitCanvas","sx","sy","scaled","convertCanvasToImage","#convertCanvasToImage","reducedCanvas","reduceImage","drawViewport","renderContinueCallback","cont","onContinue","setImage","thumbnailCanvas","getReducedImageDims","#getReducedImageDims","#reduceImage","willReadFrequently","drawImage","reducedWidth","reducedHeight","reducedImage","reducedImageCtx","#getPageL10nArgs","hasTotal","SCROLL_OPTIONS","DRAG_THRESHOLD_IN_PIXELS","PIXELS_TO_SCROLL_WHEN_DRAGGING","SPACE_FOR_DRAG_MARKER_WHEN_NO_NEXT_ELEMENT","PDFThumbnailViewer","draggingScaleFactor","dragAC","draggedContainer","thumbnailsPositions","lastDraggedOverIndex","selectedPages","draggedImageX","draggedImageY","draggedImageWidth","draggedImageHeight","draggedImageOffsetX","draggedImageOffsetY","dragMarker","pageNumberToRemove","currentScrollBottom","currentScrollTop","manageExportButton","manageDeleteButton","manageCopyButton","manageCutButton","copiedThumbnails","savedThumbnails","deletedPageNumbers","copiedPageNumbers","boundPastePages","pastePages","isCut","isOneColumnView","scrollableContainerWidth","scrollableContainerHeight","statusLabel","statusBar","deselectButton","undoBar","undoLabel","undoCloseButton","waitingBar","isInPasteMode","hasUndoBarVisible","newBadge","manageMenu","addFileComponent","scrollableContainer","viewsManagerStatusActionLabel","viewsManagerStatusActionDeselectButton","viewsManagerStatusAction","viewsManagerStatusUndo","viewsManagerStatusUndoLabel","viewsManagerStatusUndoButton","viewsManagerStatusUndoCloseButton","menuButton","copy","cut","exportSelected","newSpan","_manageMenu","saveExtractedPages","deletePages","copyPages","cutPages","toggleMenuEntries","thumbnailId","hasSelectedPages","canDeletePages","canDelete","undo","dismissUndo","clearSelection","updateStatus","picker","file","files","magic","toggleBar","buffer","bytes","hasStructuralChanges","getStructuralChanges","insertAfter","updateMenuEntries","newPagesCount","insertedPagesCount","_thumbnails","selectPage","updateCurrentPage","scroll","scrollUpdated","resetView","#scrollUpdated","getThumbnail","getVisibleThumbs","#getVisibleThumbs","resetCurrentThumbnail","#resetCurrentThumbnail","newPageNumber","scrollThumbnailIntoView","shouldScroll","updateArgs","thumbnail","cleanup","#resetView","_pageLabels","firstPagePromise","firstPdfPage","#cancelRendering","setPageLabels","labels","ensurePdfPageLoaded","#ensurePdfPageLoaded","thumbView","getScrollAhead","#getScrollAhead","visibleThumbs","scrollAhead","hasBeenAltered","getPageMappingForSaving","getScaleFactor","#getScaleFactor","updateThumbnails","#updateThumbnails","newCurrentPageNumber","prevThumbnails","newThumbnails","newThumbnail","onStartDragging","#onStartDragging","draggedThumbnail","startPageNumber","onStopDragging","#onStopDragging","isDropping","originalImageContainer","newIndex","pagesToMove","movePages","#clearSelection","#updateCurrentPage","forceFocus","#undo","cancelCopy","togglePasteMode","currentThumb","newIdx","cancelDelete","#dismissUndo","mustUpdateStatus","cleanSavedData","#canDelete","#toggleBar","#togglePasteMode","enable","#saveExtractedPages","extractPages","#copyPages","pageNumbersToCopy","#cutPages","#pastePages","hasBeenCut","#deletePages","pagesToDelete","#updateMenuEntries","#toggleMenuEntries","#updateStatus","l10nId","moveDraggedContainer","#moveDraggedContainer","positionData","findClosestThumbnail","space","dragMarkerStyle","bbox","xPos","computeThumbnailsPosition","#computeThumbnailsPosition","positionsX","positionsY","positionsLastX","Float32Array","prevY","reminder","firstRightX","lastRightX","firstBottomY","w","offsetHeight","h","cx","lastSpace","thumbnailsView","isCheckbox","HTMLInputElement","focusThumbnailElement","addDragListeners","#selectPage","#addDragListeners","draggedImage","clickX","clickY","pointerId","dragPointerId","pointerDownAC","pointerDownSignal","prevScrollTop","scaleFactor","layerY","layerX","stopDragging","_e","upEv","kEv","#goToPage","#focusThumbnailElement","focusCheckbox","navigateCheckboxes","nextThumbnail","nextPageNumber","currentThumbnail","firstWithDifferentY","#findClosestThumbnail","spaceBetweenThumbnails","lastSpaceBetweenThumbnails","yPos","xArray","cy","dist1","dist2","AnnotationEditorLayerBuilder","annotationLayer","drawLayer","onAppend","structTreeLayer","accessibilityManager","annotationEditorLayer","updatePageIndex","newPageIndex","clonedViewport","isInvisible","AnnotationLayerBuilder","commentManager","externalHide","linksInjected","renderForms","hasJSActionsPromise","fieldObjectsPromise","annotationCanvasMap","annotationEditorUIManager","_hasJSActionsPromise","_fieldObjectsPromise","_annotationCanvasMap","_accessibilityManager","_annotationEditorUIManager","hasJSActions","fieldObjects","getAnnotations","initAnnotationLayer","updatePresentationModeState","#initAnnotationLayer","internal","hasEditableAnnotations","injectLinkAnnotations","inferredLinks","newLinks","checkInferredLinks","addLinkAnnotations","#updatePresentationModeState","disableFormElements","section","inert","#checkInferredLinks","annotationRects","annot","quadPoints","rects","trX","trY","blX","blY","intersectAnnotations","annot1","annot2","intersections","annot1Rects","annot2Rects","intersection","intersect","areaRects","totalArea","linkAreaRects","annotationType","LINK","DOMRectToPDF","pdfPageView","pageBox","bottomLeft","getPagePoint","topRight","normalizeRect","calculateLinkPosition","rangeRects","getClientRects","domRect","rectBoundingBox","textPosition","currentContainer","currentLength","createLinkAnnotation","highlighter","_textHighlighter","begin","_convertMatches","Range","divIdx","unsafeUrl","borderStyle","Autolinker","regex","numericTLDRegex","findLinks","normalizedText","matchAll","links","emailDomain","raw","hostname","absoluteURL","addDefaultProtocol","processLinks","textContentItemsStr","BasePDFPageView","loadingId","renderError","showCanvas","startTime","tempCanvas","imageCoordinates","recordedBBoxes","_createCanvas","onShow","hideUntilComplete","hasHCM","background","foreground","prevCanvas","updateOnFirstShow","isLastShow","resetTempCanvas","_resetCanvas","#resetTempCanvas","_drawCanvas","onCancel","onFinish","onError","cancelExtraDelay","dispatchPageRender","dispatchPageRendered","cssTransform","isDetailView","timestamp","DrawLayerBuilder","setParent","getDrawLayer","PDFPageDetailView","detailArea","renderingCancelled","keepCanvas","shouldRenderDifferentArea","#shouldRenderDifferentArea","minDetailX","minDetailY","maxDetailX","maxDetailY","maxWidth","maxHeight","paddingLeftSize","paddingRightSize","paddingTopSize","paddingBottomSize","MOVEMENT_THRESHOLD","underlyingViewUpdated","visibleWidth","visibleHeight","visiblePixels","pixelRatio","maxDetailToVisibleLinearRatio","sqrt","capPixels","maxOverflowScale","overflowScale","overflowWidth","overflowHeight","_getRenderingContext","baseContext","vWidth","vHeight","aWidth","aHeight","aMinX","aMinY","detailMinX","detailMinY","detailMaxX","detailMaxY","operationsFilter","isEmpty","canvasWrapper","_ensureCanvasWrapper","newCanvas","ariaHidden","renderingPromise","PDF_ROLE_TO_HTML_ROLE","Document","DocumentFragment","Part","Sect","Div","Aside","NonStruct","P","H","Title","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","MathMLElements","MathMLNamespace","MathMLSanitizer","sanitizer","isSanitizerSupported","Sanitizer","namespace","replaceWithChildrenElements","comments","HEADING_PATTERN","StructTreeLayerBuilder","treeDom","treePromise","elementAttributes","rawDims","elementsToAddToTextLayer","elementsToHideInTextLayer","elementsToStealFromTextLayer","getStructTree","walk","getAriaAttributes","annotationId","#setAttributes","structElement","htmlElement","alt","added","child","addImageInTextLayer","#addImageInTextLayer","pageHeight","calc","updateTextLayer","collectIds","#collectIds","kid","#walk","parentNodes","visitChildren","mathML","setHTML","pop","TextAccessibilityManager","enabled","textChildren","textNodes","waitingElements","setTextMapping","compareElementPositions","#compareElementPositions","e1","e2","centerX1","centerX2","nodeIndex","addIdToAriaOwns","isRemovable","addPointerInTextLayer","disable","removePointerInTextLayer","owns","#addIdToAriaOwns","moveElementInDOM","contentElement","hasChildNodes","TextHighlighter","findController","divs","texts","_updateMatches","iIndex","mm","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","infinity","beginText","appendTextToDiv","fromOffset","toOffset","i0","i1","lastDivIdx","lastOffset","highlightSuffix","selectedSpan","n0","n1","clearedUntilDivIdx","n","TextLayerBuilder","renderingDone","textLayers","selectionChangeAbortController","images","textContentParams","onBefore","textContentSource","streamTextContent","includeMarkedContent","endOfContent","bindMouse","removeGlobalSelectionListener","#bindMouse","clipboardData","setData","enableGlobalSelectionListener","#removeGlobalSelectionListener","textLayerDiv","#enableGlobalSelectionListener","isPointerDown","isFirefox","prevRange","activeTextLayers","getRangeAt","intersectsNode","endDiv","modifyStart","compareBoundaryPoints","END_TO_END","START_TO_END","endContainer","endOffset","parentTextLayer","userSelect","cloneRange","DEFAULT_LAYER_PROPERTIES","LAYERS_ORDER","PDFPageView","ENABLE_FORMS","hasRestrictedScaling","layerProperties","needsRestrictedScaling","originalViewport","previousRotation","scaleRoundX","scaleRoundY","useThumbnailCanvas","directDrawing","initialOptionalContent","regularAnnotations","layers","_isStandalone","hasViewer","_container","xfaLayer","setDimensions","hasInitialVisibility","pagesColors","addLayer","#addLayer","oldDiv","layer","#setDimensions","removeProperty","updatePageNumber","oldPageNumber","filterFactory","addHighlightHCMFilter","deleteMe","deletePage","dispatchLayerRendered","#dispatchLayerRendered","renderAnnotationLayer","#renderAnnotationLayer","renderAnnotationEditorLayer","#renderAnnotationEditorLayer","renderDrawLayer","#renderDrawLayer","renderXfaLayer","#renderXfaLayer","buildXfaTextContentItems","renderTextLayer","#renderTextLayer","renderStructTreeLayer","#renderStructTreeLayer","#buildXfaTextContentItems","#injectLinkAnnotations","textLayerPromise","keepAnnotationLayer","keepAnnotationEditorLayer","keepXfaLayer","keepTextLayer","keepCanvasWrapper","preserveDetailViewState","keepPdfBugGroups","_pdfBug","annotationLayerNode","annotationEditorLayerNode","xfaLayerNode","textLayerNode","canvasWrapperNode","layerIndex","toggleEditingMode","updateVisibleArea","drawingDelay","computeScale","onlyCssZoom","postponeDrawing","redrawAnnotationLayer","redrawAnnotationEditorLayer","redrawXfaLayer","redrawTextLayer","hideTextLayer","#computeScale","invScale","factor","relativeRotation","scaleX","scaleY","convertToPdfPoint","recordOperations","recordImages","annotationLayerDiv","sfx","sfy","pageWidth","recordBBoxes","resultPromise","separateAnnots","annotationEditorLayerDiv","DEFAULT_CACHE_SIZE","PagesCountLimit","FORCE_SCROLL_MODE_PAGE","FORCE_LAZY_PAGE_INIT","PAUSE_EAGER_PAGE_INIT","isValidAnnotationEditorMode","PDFPageViewBuffer","buf","destroyFirstView","resize","newSize","idsToKeep","#destroyFirstView","firstView","PDFViewer","altTextManager","annotationEditorHighlightColors","containerTopLeft","editorUndoBar","printingAllowed","scrollTimeoutId","switchAnnotationEditorModeAC","switchAnnotationEditorModeTimeoutId","copyAllInProgress","hiddenCopyElement","previousContainerHeight","scrollModePageState","scaleTimeoutId","signatureManager","viewerAlert","copiedPageViews","savedPageViews","viewerVersion","_getVisiblePages","_scriptingManager","scriptingManager","removePageBorders","defaultRenderingQueue","_scrollUpdate","_resetView","updateContainerHeightCss","_pages","getCachedPageViews","_setCurrentPageNumber","resetCurrentPageView","currentPageLabel","currentScale","_currentScale","setScale","noScroll","_currentScaleValue","refresh","onePageRendered","_onePageRenderedCapability","_pagesCapability","_layerProperties","self","initializePermissions","#initializePermissions","permissions","isAllowed","PRINT_HIGH_QUALITY","PRINT","COPY","MODIFY_CONTENTS","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","onePageRenderedOrForceFetch","#onePageRenderedOrForceFetch","visibilityState","hiddenCapability","getAllText","interruptSignal","copyCallback","#copyCallback","anchorNode","containsNode","keydownAC","interruptAC","clipboard","writeText","_cancelRendering","permissionsPromise","getPermissions","_scrollMode","onBeforeDraw","onAfterDraw","preloadEditingData","updateMode","viewerElement","ensurePageViewVisible","_spreadMode","_updateSpreadMode","getPagesLeft","Language","startUpdatePages","endUpdatePages","prevPages","newPages","clonePage","_location","_previousScrollMode","previousPageNumber","scrollDown","pages","_updateScrollMode","cleanupTimeouts","cleanupSwitchAnnotationEditorMode","#ensurePageViewVisible","pageIndexSet","parity","spread","dummyPage","#scrollIntoView","pageSpot","isSameScale","#isSameScale","newScale","setScaleUpdatePages","#setScaleUpdatePages","newValue","preset","origin","presetValue","previousScale","scaleDiff","pageWidthScaleFactor","#pageWidthScaleFactor","#setScale","hPadding","vPadding","pageWidthScale","pageHeightScale","horizontalScale","#resetCurrentPageView","widthScale","heightScale","boundingRect","convertToViewportPoint","_updateLocation","firstPage","normalizedScaleValue","currentPageView","topLeft","intLeft","intTop","visiblePages","numVisiblePages","newCacheSize","isSimpleLayout","stillFullyVisible","switchToEditAnnotationMode","#switchToEditAnnotationMode","pagesToRefresh","containsElement","_isContainerRtl","isHorizontalScrollbarEnabled","isVerticalScrollbarEnabled","some","firstPageView","getPagesOverview","initialOrientation","getPageAdvance","#getPageAdvance","pageLayout","yArray","currentId","expectedId","advance","updateScale","steps","ceil","#updateContainerHeightCss","#cleanupTimeouts","#cleanupSwitchAnnotationEditorMode","#preloadEditingData","STAMP","loadModel","SIGNATURE","loadSignatures","editId","isFromKeyboard","mustEnterInEditMode","updater","resetModifiedIds","idsToRefresh","noUpdate","SecondaryToolbar","presentationModeButton","printButton","downloadButton","viewBookmarkButton","firstPageButton","lastPageButton","pageRotateCwButton","pageRotateCcwButton","cursorSelectToolButton","eventDetails","cursorHandToolButton","scrollPageButton","scrollVerticalButton","scrollHorizontalButton","scrollWrappedButton","spreadNoneButton","spreadOddButton","spreadEvenButton","imageAltTextSettingsButton","documentPropertiesButton","openFileButton","setPageNumber","setPagesCount","scrollModeChanged","spreadModeChanged","cursorToolChanged","#cursorToolChanged","#scrollModeChanged","forceScrollModePage","isHorizontal","#spreadModeChanged","DEFAULT_HEIGHT_IN_PAGE","SignatureManager","addButton","tabsToAltText","clearButton","clearDescription","drawCurves","drawPlaceholder","drawPath","drawPathString","drawPoints","drawSVG","drawThickness","errorBar","errorDescription","errorTitle","extractedSignatureData","imagePath","imagePicker","imagePickerLink","imagePlaceholder","imageSVG","saveCheckbox","saveContainer","tabButtons","addSignatureToolbarButton","loadSignaturesPromise","typeInput","currentTab","currentTabAC","hasDescriptionChanged","isStorageFull","editDescriptionDialog","signatureStorage","l10nDescription","panels","typeButton","drawButton","imageButton","editSignatureElements","EditDescriptionDialog","errorUploadTitle","errorUploadDescription","errorNoDataTitle","errorNoDataDescription","initTab","initTabButtons","accept","signaturesChanged","#initTabButtons","tabCallback","buttonsArray","resetCommon","#resetCommon","resetTab","#resetTab","#initTab","initTypeTab","initDrawTab","initImageTab","disableButtons","#disableButtons","#initTypeTab","#initDrawTab","currentPointerId","drawCallback","setPointerCapture","drawWidth","drawHeight","thickness","curves","points","finishDrawAC","listenerDrawOptions","pId","releasePointerCapture","showError","#showError","#initImageTab","passiveOptions","extractSignature","dataTransfer","dropEffect","effectAllowed","#extractSignature","imageManager","getFromFile","lineData","getFromImage","bitmap","viewBox","toSVGPath","getOutlineForType","#getOutlineForType","getFromText","getOutlineForDraw","#getOutlineForDraw","getDrawnSignature","addToolbarButton","#addToolbarButton","signatureData","areContours","maxDim","outlineData","processDrawnLines","lines","innerMargin","mustSmooth","CREATE","heightInPage","deleteButton","savedCount","deleteSpan","#signaturesChanged","getSignature","reload","decompressSignature","signaturesData","outlines","renderEditButton","tabType","_drawId","#add","newCurves","compressSignature","saved","descriptionChanged","addSignature","previousDescription","signatureSVG","updateButton","editSignatureView","descriptionInput","Event","getSignaturePreview","#update","hasBeenChanged","Toolbar","colorPicker","zoomIn","zoomOut","editorCommentButton","POPUP","editorFreeTextButton","FREETEXT","editorHighlightButton","HIGHLIGHT","editorInkButton","INK","editorStampButton","telemetry","editorSignatureButton","updateToolbarDensity","#updateToolbarDensity","hasPageLabels","setPageScale","pageScaleValue","pageScale","updateLoadingIndicatorState","editorModeChanged","editorHighlightColorPicker","scaleSelect","oncontextmenu","cp","setMainHighlightColorPicker","renderMainDropdown","#editorModeChanged","editorCommentParamsToolbar","editorFreeTextParamsToolbar","editorHighlightParamsToolbar","editorInkParamsToolbar","editorStampParamsToolbar","editorSignatureParamsToolbar","resetNumPages","predefinedValueFound","customScaleOption","loading","DEFAULT_VIEW_HISTORY_CACHE_SIZE","ViewHistory","cacheSize","_initializedPromise","databaseStr","database","branch","setMultiple","properties","defaultValue","getMultiple","SIDEBAR_WIDTH_VAR","SIDEBAR_RESIZING_CLASS","UI_NOTIFICATION_CLASS","ViewsManager","hasAnimations","matchMedia","outerContainer","sidebarContainer","thumbnailButton","outlineButton","attachmentsButton","layersButton","outlinesView","attachmentsView","layersView","viewsManagerAddFile","viewsManagerAddFileButton","viewsManagerCurrentOutlineButton","viewsManagerSelectorButton","viewsManagerSelectorOptions","viewsManagerHeaderLabel","viewsManagerStatus","isInitialViewSet","isInitialEventDispatched","onToggled","onUpdateThumbnails","_enableSplitMerge","_enableMerge","pagesTitle","outlinesTitle","attachmentsTitle","layersTitle","notificationButton","hideUINotification","switchView","visibleView","setInitialView","forceOpen","isViewChanged","titleL10nId","queueMicrotask","#dispatchEvent","showUINotification","#showUINotification","#hideUINotification","onTreeLoaded","PdfTextExtractor","FORCE_PAGES_LOADED_TIMEOUT","ViewOnLoad","PREVIOUS","PDFViewerApplication","_initializedCapability","settled","appConfig","pdfLoadingTask","printService","pdfRenderingQueue","pdfPresentationMode","pdfDocumentProperties","pdfLinkService","pdfTextExtractor","viewsManager","pdfOutlineViewer","pdfAttachmentViewer","pdfLayerViewer","pdfCursorTools","pdfScriptingManager","store","preferences","secondaryToolbar","annotationEditorParams","imageAltTextSettings","_downloadUrl","_eventBusAbortController","_windowAbortController","_globalAbortController","documentInfo","_contentDispositionFilename","_contentLength","_saveInProgress","_wheelUnusedTicks","_wheelUnusedFactor","_touchManager","_touchUnusedTicks","_touchUnusedFactor","_PDFBug","_hasAnnotationEditors","_title","_isCtrlKeyDown","_caretBrowsing","_isScrolling","_printPermissionPromise","_parseHashParams","getElementsByTagName","appContainer","_initializeViewerComponents","bindWindowEvents","loadPDFBug","PDFBug","loadCSS","init","debugOpts","StepperManager","setEventBus","_cleanup","_scriptingDocProperties","newAltTextDialog","altTextDialog","addSignatureDialog","editSignatureDialog","editCommentDialog","editorCommentsSidebar","editorCommentsSidebarResizer","editorCommentsSidebarList","editorCommentsSidebarCount","editorCommentsSidebarTitle","editorCommentsSidebarCloseButton","viewsManagerStatusBar","viewsManagerUndoBar","viewsManagerWaitingBar","findBar","principalContainer","altTextSettingsDialog","documentProperties","_docFilename","_docTitle","imageAltTextSettingsSeparator","supportsFullscreen","passwordOverlay","passwordPrompt","run","config","queryString","search","validateFileURL","fileInput","_openFileInput","msg","togglePrintingButtons","_hideViewBookmark","updateZoom","zoomReset","touchPinchCallback","prevDistance","distance","newScaleFactor","_accumulateFactor","PIXELS_PER_LINE_SCALE","ticks","_accumulateTicks","touchPinchEndCallback","fullscreenEnabled","loadingBar","barElement","setTitleUsingUrl","downloadUrl","decodeURIComponent","setTitle","hasChangesIndicator","_hasChanges","_unblockDocumentLoadEvent","_annotationStorageModified","downloadOrSave","workerParams","apiParams","loadingTask","onPassword","onProgress","load","missing","_documentError","saveDocument","editorStats","stats","onSavePages","_mergedDocumentNeedsSaving","moreInfo","_otherError","moreInfoText","stack","lineNumber","pageLayoutPromise","getPageLayout","pageModePromise","getPageMode","openActionPromise","getOpenAction","storedPromise","fingerprints","zoom","sidebarView","_initializeAnnotationStorageCallbacks","timeStamp","stored","pageMode","openAction","_initializePdfHistory","initialDest","_initializeAutoPrint","getOutline","getAttachments","_initializePageLabels","_initializeMetadata","jsActions","triggerAutoPrint","js","triggerPrinting","hasStructTree","pdfTitle","IsXFAPresent","IsAcroFormPresent","IsSignaturesPresent","getPageLabels","numLabels","standardLabels","emptyLabels","onSetModified","onResetModified","onAnnotationEditor","storedHash","setRotation","setViewerModes","beforePrint","alert","afterPrint","resetModified","rotatePages","requestPresentationMode","onResize","onHashchange","onPageRender","onPageRendered","onUpdateViewarea","onPageChanging","onScaleChanging","onRotationChanging","onSidebarViewChanged","onPageMode","onNamedAction","onPageNumberChanged","onViewerModesChanged","onImageAltTextSettings","onFindFromUrlHash","onUpdateFindMatchesCount","onUpdateFindControlState","onFileInputChange","onOpenFile","onSaveAndLoad","isPinchingDisabled","isPinchingStopped","onPinching","onPinchEnd","addWindowResolutionChange","mediaQueryList","onWheel","onKeyDown","onKeyUp","onBeforeUnload","_lastScrollTop","_lastScrollLeft","scrollendTimeoutID","scrollAbortController","scrollend","unbindWindowEvents","testingClose","extractParams","modifiedPdfBytes","prop","wholeTicks","trunc","newFactor","blockUnblockOnload","scriptingReady","HOSTED_VIEWER_ORIGINS","viewerOrigin","fileOrigin","exp","isBuiltInMac","isPinchToZoom","deltaZ","DOM_DELTA_PAGE","sign","closeSecondaryToolbar","closeEditorUndoBar","returnValue","isViewerInPresentationMode","handled","ensureViewerFocused","cmd","curElement","curElementTagName","isContentEditable","turnPage","turnOnlyIfPageFit","AppConstants","PDFViewerApplicationConstants","PDFViewerApplicationOptions","getViewerConfiguration","createAutomatically","altTextSettingsCloseButton","webViewerLoad","readyState"],"sourceRoot":""}