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,EAAEA,QAAQ,CAACvH,KAAK,CAAC;QAAE0H,QAAQ,EAAE;MAAK,CAAC,CAAC;MAC5CN,GAAG,EAAE,IAAI,CAACA,GAAG;MACb66C,OAAO;MACPj5C,iBAAiB,EAAE,IAAI,CAACA,iBAAiB;MACzCF,WAAW,EAAE,IAAI,CAACA,WAAW;MAC7BtB;IACF,CAAC;IAED,IAAI,IAAI,CAACJ,GAAG,EAAE;MACZ,OAAOisC,+CAAQ,CAAC1rC,MAAM,CAACS,UAAU,CAAC;IACpC;IAEA,IAAI,CAAChB,GAAG,GAAGS,QAAQ,CAAC1H,aAAa,CAAC,KAAK,CAAC;IACxCiI,UAAU,CAAChB,GAAG,GAAG,IAAI,CAACA,GAAG;IAEzB,OAAOisC,+CAAQ,CAAC/rC,MAAM,CAACc,UAAU,CAAC;EACpC;EAEAE,MAAMA,CAAA,EAAG;IACP,IAAI,CAACjB,UAAU,GAAG,IAAI;EACxB;EAEAmB,IAAIA,CAAA,EAAG;IACL,IAAI,CAAC,IAAI,CAACpB,GAAG,EAAE;MACb;IACF;IACA,IAAI,CAACA,GAAG,CAACW,MAAM,GAAG,IAAI;EACxB;AACF;;;;;;;;;SC/GA;SACA;;SAEA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;;SAEA;SACA;;SAEA;SACA;SACA;;;;;UCtBA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA,IAAI;UACJ;UACA;UACA,IAAI;UACJ;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA,CAAC;UACD;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA,EAAE;UACF;UACA,sGAAsG;UACtG;UACA;UACA;UACA;UACA;UACA;UACA;UACA,GAAG;UACH;UACA;UACA;UACA;UACA;UACA,GAAG;UACH;UACA,EAAE;UACF;UACA;;;;;UChEA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;SEAA;SACA;SACA;SACA","sources":["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/annotation_editor_layer_builder.js","webpack://pdf.js/./web/annotation_layer_builder.js","webpack://pdf.js/./web/app_options.js","webpack://pdf.js/./web/download_manager.js","webpack://pdf.js/./web/draw_layer_builder.js","webpack://pdf.js/./web/event_utils.js","webpack://pdf.js/./web/generic_scripting.js","webpack://pdf.js/./web/genericl10n.js","webpack://pdf.js/./web/l10n.js","webpack://pdf.js/./web/pdf_find_utils.js","webpack://pdf.js/./web/pdf_find_controller.js","webpack://pdf.js/./web/pdf_history.js","webpack://pdf.js/./web/pdf_link_service.js","webpack://pdf.js/./web/pdf_page_view.js","webpack://pdf.js/./web/pdf_rendering_queue.js","webpack://pdf.js/./web/pdf_scripting_manager.component.js","webpack://pdf.js/./web/pdf_scripting_manager.js","webpack://pdf.js/./web/pdf_single_page_viewer.js","webpack://pdf.js/./web/pdf_viewer.component.js","webpack://pdf.js/./web/pdf_viewer.js","webpack://pdf.js/./web/pdfjs.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/ui_utils.js","webpack://pdf.js/./web/xfa_layer_builder.js","webpack://pdf.js/webpack/bootstrap","webpack://pdf.js/webpack/runtime/async module","webpack://pdf.js/webpack/runtime/define property getters","webpack://pdf.js/webpack/runtime/hasOwnProperty shorthand","webpack://pdf.js/webpack/before-startup","webpack://pdf.js/webpack/startup","webpack://pdf.js/webpack/after-startup"],"sourcesContent":["/**\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 `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 `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 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 return this.value.toString(10);\n }\n }\n}\n/**\n * A `FluentType` representing a date and time.\n *\n * A `FluentDateTime` instance stores the number value of the date it\n * represents, 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 /**\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 super(value);\n this.opts = opts;\n }\n /**\n * Format this `FluentDateTime` to a string.\n */\n toString(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 return new Date(this.value).toISOString();\n }\n }\n}\n","/* global Intl */\n/**\n * @overview\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 (arg instanceof Date) {\n return new FluentDateTime(arg.getTime());\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 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 `FluentValues` representing the\n * positional arguments, and an object of named `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.valueOf(), {\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 `FluentValues` representing the\n * positional arguments, and an object of named `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) {\n return new FluentDateTime(arg.valueOf(), {\n ...arg.opts,\n ...values(opts, DATETIME_ALLOWED),\n });\n }\n if (arg instanceof FluentNumber) {\n return new FluentDateTime(arg.valueOf(), {\n ...values(opts, DATETIME_ALLOWED),\n });\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 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\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 * @module fluent\n * @overview\n *\n * `fluent` is a JavaScript implementation of Project Fluent, a localization\n * framework designed to unleash the expressive power of the natural language.\n *\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-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 // eslint-disable-next-line max-len\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 // eslint-disable-next-line max-len\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} 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} 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 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 * @private\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 * @private\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 {DOMFragment} 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} 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 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/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/annotation_layer.js\").AnnotationLayer} AnnotationLayer */\n\nimport { AnnotationEditorLayer } from \"pdfjs-lib\";\nimport { GenericL10n } from \"web-null_l10n\";\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderOptions\n * @property {AnnotationEditorUIManager} [uiManager]\n * @property {PDFPageProxy} pdfPage\n * @property {IL10n} [l10n]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationLayer} [annotationLayer]\n * @property {TextLayer} [textLayer]\n * @property {DrawLayer} [drawLayer]\n * @property {function} [onAppend]\n */\n\nclass AnnotationEditorLayerBuilder {\n #annotationLayer = null;\n\n #drawLayer = null;\n\n #onAppend = null;\n\n #textLayer = null;\n\n #uiManager;\n\n /**\n * @param {AnnotationEditorLayerBuilderOptions} options\n */\n constructor(options) {\n this.pdfPage = options.pdfPage;\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 }\n\n /**\n * @param {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n */\n async render(viewport, intent = \"display\") {\n if (intent !== \"display\") {\n return;\n }\n\n if (this._cancelled) {\n return;\n }\n\n const clonedViewport = viewport.clone({ dontFlip: true });\n if (this.div) {\n this.annotationEditorLayer.update({ viewport: clonedViewport });\n this.show();\n return;\n }\n\n // Create an AnnotationEditor layer div\n 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 accessibilityManager: this.accessibilityManager,\n pageIndex: this.pdfPage.pageNumber - 1,\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 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.div.hidden = true;\n }\n\n show() {\n if (!this.div || this.annotationEditorLayer.isInvisible) {\n return;\n }\n this.div.hidden = 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/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { AnnotationLayer } 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 {IPDFLinkService} linkService\n * @property {IDownloadManager} [downloadManager]\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 {function} [onAppend]\n */\n\nclass AnnotationLayerBuilder {\n #onAppend = null;\n\n #onPresentationModeChanged = null;\n\n /**\n * @param {AnnotationLayerBuilderOptions} options\n */\n constructor({\n pdfPage,\n linkService,\n downloadManager,\n annotationStorage = null,\n imageResourcesPath = \"\",\n renderForms = true,\n enableScripting = false,\n hasJSActionsPromise = null,\n fieldObjectsPromise = null,\n annotationCanvasMap = null,\n accessibilityManager = 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.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.#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 {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n * @returns {Promise<void>} A promise that is resolved when rendering of the\n * annotations is complete.\n */\n async render(viewport, intent = \"display\") {\n 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\n if (annotations.length === 0) {\n this.hide();\n return;\n }\n\n this.annotationLayer = new AnnotationLayer({\n div,\n accessibilityManager: this._accessibilityManager,\n annotationCanvasMap: this._annotationCanvasMap,\n page: this.pdfPage,\n viewport: viewport.clone({ dontFlip: true }),\n });\n\n await this.annotationLayer.render({\n annotations,\n imageResourcesPath: this.imageResourcesPath,\n renderForms: this.renderForms,\n linkService: this.linkService,\n downloadManager: this.downloadManager,\n annotationStorage: this.annotationStorage,\n enableScripting: this.enableScripting,\n hasJSActions,\n fieldObjects,\n });\n\n // Ensure that interactive form elements in the annotationLayer are\n // disabled while PresentationMode is active (see issue 12232).\n if (this.linkService.isInPresentationMode) {\n this.#updatePresentationModeState(PresentationModeState.FULLSCREEN);\n }\n if (!this.#onPresentationModeChanged) {\n this.#onPresentationModeChanged = evt => {\n this.#updatePresentationModeState(evt.state);\n };\n this._eventBus?._on(\n \"presentationmodechanged\",\n this.#onPresentationModeChanged\n );\n }\n }\n\n cancel() {\n this._cancelled = true;\n\n if (this.#onPresentationModeChanged) {\n this._eventBus?._off(\n \"presentationmodechanged\",\n this.#onPresentationModeChanged\n );\n this.#onPresentationModeChanged = null;\n }\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n\n #updatePresentationModeState(state) {\n if (!this.div) {\n return;\n }\n let disableFormElements = false;\n\n switch (state) {\n case PresentationModeState.FULLSCREEN:\n disableFormElements = true;\n break;\n case PresentationModeState.NORMAL:\n break;\n default:\n return;\n }\n for (const section of this.div.childNodes) {\n if (section.hasAttribute(\"data-internal-link\")) {\n continue;\n }\n section.inert = disableFormElements;\n }\n }\n}\n\nexport { AnnotationLayerBuilder };\n","/* Copyright 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 // eslint-disable-next-line no-var\n var compatibilityParams = Object.create(null);\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof navigator === \"undefined\"\n ) {\n globalThis.navigator = Object.create(null);\n }\n const userAgent = navigator.userAgent || \"\";\n const platform = navigator.platform || \"\";\n const maxTouchPoints = navigator.maxTouchPoints || 1;\n\n const isAndroid = /Android/.test(userAgent);\n const isIOS =\n /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) ||\n (platform === \"MacIntel\" && maxTouchPoints > 1);\n\n // Limit canvas size to 5 mega-pixels on mobile.\n // Support: Android, iOS\n (function checkCanvasSizeLimitation() {\n if (isIOS || isAndroid) {\n compatibilityParams.maxCanvasPixels = 5242880;\n }\n })();\n}\n\nconst OptionKind = {\n BROWSER: 0x01,\n VIEWER: 0x02,\n API: 0x04,\n WORKER: 0x08,\n PREFERENCE: 0x80,\n};\n\n/**\n * NOTE: These options are used to generate the `default_preferences.json` file,\n * see `OptionKind.PREFERENCE`, hence the values below must use only\n * primitive types and cannot rely on any imported types.\n */\nconst defaultOptions = {\n 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 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\n annotationEditorMode: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n annotationMode: {\n /** @type {number} */\n value: 2,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n cursorToolOnLoad: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n 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 enableHighlightEditor: {\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 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 enableML: {\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 enableStampEditor: {\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: true,\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: \"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F\",\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 maxCanvasPixels: {\n /** @type {number} */\n value: 2 ** 25,\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 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 kind: OptionKind.API,\n },\n enableXfa: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n fontExtraProperties: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API,\n },\n isEvalSupported: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API,\n },\n isOffscreenCanvasSupported: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API,\n },\n maxImageSize: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.API,\n },\n pdfBug: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API,\n },\n standardFontDataUrl: {\n /** @type {string} */\n value:\n // 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 verbosity: {\n /** @type {number} */\n value: 1,\n kind: OptionKind.API,\n },\n\n workerPort: {\n /** @type {Object} */\n value: null,\n kind: OptionKind.WORKER,\n },\n workerSrc: {\n /** @type {string} */\n value:\n // 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.viewerCssTheme = {\n /** @type {number} */\n value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\") ? 2 : 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\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 defaultOptions.locale = {\n /** @type {string} */\n value: navigator.language || \"en-US\",\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\nconst userOptions = Object.create(null);\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // Apply any compatibility-values to the user-options,\n // see also `AppOptions.remove` below.\n for (const name in compatibilityParams) {\n userOptions[name] = compatibilityParams[name];\n }\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING || LIB\")) {\n // Ensure that the `defaultOptions` are correctly specified.\n for (const name in defaultOptions) {\n const { value, kind } = 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 (\n typeof compatibilityParams === \"object\" &&\n compatibilityParams[name] !== undefined\n ) {\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 }\n }\n}\n\nclass AppOptions {\n constructor() {\n throw new Error(\"Cannot initialize AppOptions.\");\n }\n\n static get(name) {\n return userOptions[name] ?? defaultOptions[name]?.value ?? undefined;\n }\n\n static getAll(kind = null, defaultOnly = false) {\n const options = Object.create(null);\n for (const name in defaultOptions) {\n const defaultOption = defaultOptions[name];\n\n if (kind && !(kind & defaultOption.kind)) {\n continue;\n }\n options[name] = defaultOnly\n ? defaultOption.value\n : userOptions[name] ?? defaultOption.value;\n }\n return options;\n }\n\n static set(name, value) {\n userOptions[name] = value;\n }\n\n static setAll(options, init = false) {\n if ((typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) && init) {\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;\n }\n for (const name in userOptions) {\n // Ignore any compatibility-values in the user-options.\n if (compatibilityParams[name] !== undefined) {\n continue;\n }\n console.warn(\n \"setAll: The Preferences may override manually set AppOptions; \" +\n 'please use the \"disablePreferences\"-option in order to prevent that.'\n );\n break;\n }\n }\n\n for (const name in options) {\n userOptions[name] = options[name];\n }\n }\n\n static remove(name) {\n delete userOptions[name];\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // Re-apply a compatibility-value, if it exists, to the user-options.\n const val = compatibilityParams[name];\n if (val !== undefined) {\n userOptions[name] = val;\n }\n }\n }\n}\n\nexport { AppOptions, OptionKind };\n","/* Copyright 2013 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n\nimport { createValidAbsoluteUrl, isPdfFile } from \"pdfjs-lib\";\n\nif (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"CHROME || GENERIC\")) {\n throw new Error(\n 'Module \"pdfjs-web/download_manager\" shall not be used ' +\n \"outside CHROME and GENERIC builds.\"\n );\n}\n\nfunction download(blobUrl, filename) {\n const a = document.createElement(\"a\");\n if (!a.click) {\n throw new Error('DownloadManager: \"a.click()\" is not supported.');\n }\n a.href = blobUrl;\n a.target = \"_parent\";\n // Use a.download if available. This increases the likelihood that\n // the file is downloaded instead of opened by another PDF plugin.\n if (\"download\" in a) {\n a.download = filename;\n }\n // <a> must be in the document for recent Firefox versions,\n // otherwise .click() is ignored.\n (document.body || document.documentElement).append(a);\n a.click();\n a.remove();\n}\n\n/**\n * @implements {IDownloadManager}\n */\nclass DownloadManager {\n #openBlobUrls = new WeakMap();\n\n downloadUrl(url, filename, _options) {\n if (!createValidAbsoluteUrl(url, \"http://example.com\")) {\n console.error(`downloadUrl - not a valid URL: ${url}`);\n return; // restricted/invalid URL\n }\n download(url + \"#pdfjs.action=download\", filename);\n }\n\n downloadData(data, filename, contentType) {\n const blobUrl = URL.createObjectURL(\n new Blob([data], { type: contentType })\n );\n download(blobUrl, filename);\n }\n\n /**\n * @returns {boolean} Indicating if the data was opened.\n */\n openOrDownloadData(data, filename, dest = null) {\n const isPdfData = isPdfFile(filename);\n const contentType = isPdfData ? \"application/pdf\" : \"\";\n\n if (\n (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"COMPONENTS\")) &&\n isPdfData\n ) {\n let blobUrl = this.#openBlobUrls.get(data);\n if (!blobUrl) {\n blobUrl = URL.createObjectURL(new Blob([data], { type: contentType }));\n this.#openBlobUrls.set(data, blobUrl);\n }\n let viewerUrl;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // The current URL is the viewer, let's use it and append the file.\n viewerUrl = \"?file=\" + encodeURIComponent(blobUrl + \"#\" + filename);\n } else if (PDFJSDev.test(\"CHROME\")) {\n // In the Chrome extension, the URL is rewritten using the history API\n // in viewer.js, so an absolute URL must be generated.\n viewerUrl =\n // eslint-disable-next-line no-undef\n chrome.runtime.getURL(\"/content/web/viewer.html\") +\n \"?file=\" +\n encodeURIComponent(blobUrl + \"#\" + filename);\n }\n if (dest) {\n viewerUrl += `#${escape(dest)}`;\n }\n\n try {\n window.open(viewerUrl);\n return true;\n } catch (ex) {\n console.error(`openOrDownloadData: ${ex}`);\n // Release the `blobUrl`, since opening it failed, and fallback to\n // downloading the PDF file.\n URL.revokeObjectURL(blobUrl);\n this.#openBlobUrls.delete(data);\n }\n }\n\n this.downloadData(data, filename, contentType);\n return false;\n }\n\n download(blob, url, filename, _options) {\n const blobUrl = URL.createObjectURL(blob);\n download(blobUrl, filename);\n }\n}\n\nexport { DownloadManager };\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} DrawLayerBuilderOptions\n * @property {number} pageIndex\n */\n\nclass DrawLayerBuilder {\n #drawLayer = null;\n\n /**\n * @param {DrawLayerBuilderOptions} options\n */\n constructor(options) {\n this.pageIndex = options.pageIndex;\n }\n\n /**\n * @param {string} intent (default value is 'display')\n */\n async render(intent = \"display\") {\n if (intent !== \"display\" || this.#drawLayer || this._cancelled) {\n return;\n }\n this.#drawLayer = new DrawLayer({\n pageIndex: this.pageIndex,\n });\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\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\n function handler(type) {\n if (target instanceof EventBus) {\n target._off(name, eventHandler);\n } else {\n target.removeEventListener(name, eventHandler);\n }\n\n if (timeout) {\n clearTimeout(timeout);\n }\n resolve(type);\n }\n\n const eventHandler = handler.bind(null, WaitOnType.EVENT);\n if (target instanceof EventBus) {\n target._on(name, eventHandler);\n } else {\n target.addEventListener(name, eventHandler);\n }\n\n const timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);\n const timeout = setTimeout(timeoutHandler, delay);\n\n 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 });\n }\n\n /**\n * @param {string} eventName\n * @param {function} listener\n * @param {Object} [options]\n */\n off(eventName, listener, options = null) {\n this._off(eventName, listener, {\n external: true,\n once: options?.once,\n });\n }\n\n /**\n * @param {string} eventName\n * @param {Object} data\n */\n dispatch(eventName, data) {\n const eventListeners = this.#listeners[eventName];\n if (!eventListeners || eventListeners.length === 0) {\n return;\n }\n let externalListeners;\n // Making copy of the listeners array in case if it will be modified\n // during dispatch.\n for (const { listener, external, once } of eventListeners.slice(0)) {\n if (once) {\n this._off(eventName, listener);\n }\n if (external) {\n (externalListeners ||= []).push(listener);\n continue;\n }\n listener(data);\n }\n // Dispatch any \"external\" listeners *after* the internal ones, to give the\n // viewer components time to handle events and update their state first.\n if (externalListeners) {\n for (const listener of externalListeners) {\n listener(data);\n }\n externalListeners = null;\n }\n }\n\n /**\n * @ignore\n */\n _on(eventName, listener, options = null) {\n const eventListeners = (this.#listeners[eventName] ||= []);\n eventListeners.push({\n listener,\n external: options?.external === true,\n once: options?.once === true,\n });\n }\n\n /**\n * @ignore\n */\n _off(eventName, listener, options = null) {\n const eventListeners = this.#listeners[eventName];\n if (!eventListeners) {\n return;\n }\n for (let i = 0, ii = eventListeners.length; i < ii; i++) {\n if (eventListeners[i].listener === listener) {\n eventListeners.splice(i, 1);\n return;\n }\n }\n }\n}\n\n/**\n * NOTE: Only used to support various PDF viewer tests in `mozilla-central`.\n */\nclass AutomationEventBus extends EventBus {\n dispatch(eventName, data) {\n if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: AutomationEventBus.dispatch\");\n }\n super.dispatch(eventName, data);\n\n const 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\nexport { AutomationEventBus, EventBus, waitOnEventOrTimeout, WaitOnType };\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 = url.split(\"#\", 1)[0];\n // eslint-disable-next-line prefer-const\n let { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n if (!contentLength) {\n const { length } = await pdfDocument.getDownloadInfo();\n contentLength = length;\n }\n\n return {\n ...info,\n baseURL: baseUrl,\n filesize: contentLength,\n filename: contentDispositionFilename || getPdfFilenameFromUrl(url),\n metadata: metadata?.getRaw(),\n authors: metadata?.get(\"dc:creator\"),\n numPages: pdfDocument.numPages,\n URL: url,\n };\n}\n\nclass GenericScripting {\n constructor(sandboxBundleSrc) {\n this._ready = new Promise((resolve, reject) => {\n const sandbox =\n typeof PDFJSDev === \"undefined\"\n ? import(sandboxBundleSrc) // eslint-disable-line no-unsanitized/method\n : __non_webpack_import__(sandboxBundleSrc);\n sandbox\n .then(pdfjsSandbox => {\n resolve(pdfjsSandbox.QuickJSSandbox());\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 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n\nimport { FluentBundle, FluentResource } from \"fluent-bundle\";\nimport { DOMLocalization } from \"fluent-dom\";\nimport { fetchData } from \"pdfjs-lib\";\nimport { L10n } from \"./l10n.js\";\n\nfunction createBundle(lang, text) {\n const resource = new FluentResource(text);\n const bundle = new FluentBundle(lang);\n const errors = bundle.addResource(resource);\n if (errors.length) {\n console.error(\"L10n errors\", errors);\n }\n return bundle;\n}\n\n/**\n * @implements {IL10n}\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 for (const lang of langs) {\n const bundle = await this.#createBundle(lang, baseURL, paths);\n if (bundle) {\n yield bundle;\n }\n 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 { baseURL: href.replace(/[^/]*$/, \"\") || \"./\", paths };\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 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/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n\n/**\n * NOTE: The L10n-implementations should use lowercase language-codes\n * internally.\n * @implements {IL10n}\n */\nclass L10n {\n #dir;\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 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 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 2018 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst CharacterType = {\n SPACE: 0,\n ALPHA_LETTER: 1,\n PUNCT: 2,\n HAN_LETTER: 3,\n KATAKANA_LETTER: 4,\n HIRAGANA_LETTER: 5,\n HALFWIDTH_KATAKANA_LETTER: 6,\n THAI_LETTER: 7,\n};\n\nfunction isAlphabeticalScript(charCode) {\n return charCode < 0x2e80;\n}\n\nfunction isAscii(charCode) {\n return (charCode & 0xff80) === 0;\n}\n\nfunction isAsciiAlpha(charCode) {\n return (\n (charCode >= /* a = */ 0x61 && charCode <= /* z = */ 0x7a) ||\n (charCode >= /* A = */ 0x41 && charCode <= /* Z = */ 0x5a)\n );\n}\n\nfunction isAsciiDigit(charCode) {\n return charCode >= /* 0 = */ 0x30 && charCode <= /* 9 = */ 0x39;\n}\n\nfunction isAsciiSpace(charCode) {\n return (\n charCode === /* SPACE = */ 0x20 ||\n charCode === /* TAB = */ 0x09 ||\n charCode === /* CR = */ 0x0d ||\n charCode === /* LF = */ 0x0a\n );\n}\n\nfunction isHan(charCode) {\n return (\n (charCode >= 0x3400 && charCode <= 0x9fff) ||\n (charCode >= 0xf900 && charCode <= 0xfaff)\n );\n}\n\nfunction isKatakana(charCode) {\n return charCode >= 0x30a0 && charCode <= 0x30ff;\n}\n\nfunction isHiragana(charCode) {\n return charCode >= 0x3040 && charCode <= 0x309f;\n}\n\nfunction isHalfwidthKatakana(charCode) {\n return charCode >= 0xff60 && charCode <= 0xff9f;\n}\n\nfunction isThai(charCode) {\n return (charCode & 0xff80) === 0x0e00;\n}\n\n/**\n * This function is based on the word-break detection implemented in:\n * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp\n */\nfunction getCharacterType(charCode) {\n if (isAlphabeticalScript(charCode)) {\n if (isAscii(charCode)) {\n if (isAsciiSpace(charCode)) {\n return CharacterType.SPACE;\n } else if (\n isAsciiAlpha(charCode) ||\n isAsciiDigit(charCode) ||\n charCode === /* UNDERSCORE = */ 0x5f\n ) {\n return CharacterType.ALPHA_LETTER;\n }\n return CharacterType.PUNCT;\n } else if (isThai(charCode)) {\n return CharacterType.THAI_LETTER;\n } else if (charCode === /* NBSP = */ 0xa0) {\n return CharacterType.SPACE;\n }\n return CharacterType.ALPHA_LETTER;\n }\n\n if (isHan(charCode)) {\n return CharacterType.HAN_LETTER;\n } else if (isKatakana(charCode)) {\n return CharacterType.KATAKANA_LETTER;\n } else if (isHiragana(charCode)) {\n return CharacterType.HIRAGANA_LETTER;\n } else if (isHalfwidthKatakana(charCode)) {\n return CharacterType.HALFWIDTH_KATAKANA_LETTER;\n }\n return CharacterType.ALPHA_LETTER;\n}\n\nlet NormalizeWithNFKC;\nfunction getNormalizeWithNFKC() {\n /* eslint-disable no-irregular-whitespace */\n NormalizeWithNFKC ||= ` ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`;\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\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 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 if (ranges.join(\"\") !== NormalizeWithNFKC) {\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(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { binarySearchFirstItem, scrollIntoView } from \"./ui_utils.js\";\nimport { getCharacterType, getNormalizeWithNFKC } from \"./pdf_find_utils.js\";\n\nconst FindState = {\n FOUND: 0,\n NOT_FOUND: 1,\n WRAPPED: 2,\n PENDING: 3,\n};\n\nconst FIND_TIMEOUT = 250; // ms\nconst MATCH_SCROLL_OFFSET_TOP = -50; // px\nconst MATCH_SCROLL_OFFSET_LEFT = -400; // px\n\nconst CHARACTERS_TO_NORMALIZE = {\n \"\\u2010\": \"-\", // Hyphen\n \"\\u2018\": \"'\", // Left single quotation mark\n \"\\u2019\": \"'\", // Right single quotation mark\n \"\\u201A\": \"'\", // Single low-9 quotation mark\n \"\\u201B\": \"'\", // Single high-reversed-9 quotation mark\n \"\\u201C\": '\"', // Left double quotation mark\n \"\\u201D\": '\"', // Right double quotation mark\n \"\\u201E\": '\"', // Double low-9 quotation mark\n \"\\u201F\": '\"', // Double high-reversed-9 quotation mark\n \"\\u00BC\": \"1/4\", // Vulgar fraction one quarter\n \"\\u00BD\": \"1/2\", // Vulgar fraction one half\n \"\\u00BE\": \"3/4\", // Vulgar fraction three quarters\n};\n\n// These diacritics aren't considered as combining diacritics\n// when searching in a document:\n// https://searchfox.org/mozilla-central/source/intl/unicharutil/util/is_combining_diacritic.py.\n// The combining class definitions can be found:\n// https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values\n// Category 0 corresponds to [^\\p{Mn}].\nconst DIACRITICS_EXCEPTION = new Set([\n // UNICODE_COMBINING_CLASS_KANA_VOICING\n // https://www.compart.com/fr/unicode/combining/8\n 0x3099, 0x309a,\n // UNICODE_COMBINING_CLASS_VIRAMA (under 0xFFFF)\n // https://www.compart.com/fr/unicode/combining/9\n 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b,\n 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714,\n 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f,\n 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed,\n // 91\n // https://www.compart.com/fr/unicode/combining/91\n 0x0c56,\n // 129\n // https://www.compart.com/fr/unicode/combining/129\n 0x0f71,\n // 130\n // https://www.compart.com/fr/unicode/combining/130\n 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80,\n // 132\n // https://www.compart.com/fr/unicode/combining/132\n 0x0f74,\n]);\nlet DIACRITICS_EXCEPTION_STR; // Lazily initialized, see below.\n\nconst DIACRITICS_REG_EXP = /\\p{M}+/gu;\nconst SPECIAL_CHARS_REG_EXP =\n /([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})/gu;\nconst NOT_DIACRITIC_FROM_END_REG_EXP = /([^\\p{M}])\\p{M}*$/u;\nconst NOT_DIACRITIC_FROM_START_REG_EXP = /^\\p{M}*([^\\p{M}])/u;\n\n// The range [AC00-D7AF] corresponds to the Hangul syllables.\n// The few other chars are some CJK Compatibility Ideographs.\nconst SYLLABLES_REG_EXP = /[\\uAC00-\\uD7AF\\uFA6C\\uFACF-\\uFAD1\\uFAD5-\\uFAD7]+/g;\nconst SYLLABLES_LENGTHS = new Map();\n// When decomposed (in using NFD) the above syllables will start\n// with one of the chars in this regexp.\nconst FIRST_CHAR_SYLLABLES_REG_EXP =\n \"[\\\\u1100-\\\\u1112\\\\ud7a4-\\\\ud7af\\\\ud84a\\\\ud84c\\\\ud850\\\\ud854\\\\ud857\\\\ud85f]\";\n\nconst NFKC_CHARS_TO_NORMALIZE = new Map();\n\nlet noSyllablesRegExp = null;\nlet withSyllablesRegExp = null;\n\nfunction normalize(text) {\n // The diacritics in the text or in the query can be composed or not.\n // So we use a decomposed text using NFD (and the same for the query)\n // in order to be sure that diacritics are in the same order.\n\n // Collect syllables length and positions.\n const syllablePositions = [];\n let m;\n while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) {\n let { index } = m;\n for (const char of m[0]) {\n let len = SYLLABLES_LENGTHS.get(char);\n if (!len) {\n len = char.normalize(\"NFD\").length;\n SYLLABLES_LENGTHS.set(char, len);\n }\n syllablePositions.push([len, index++]);\n }\n }\n\n let normalizationRegex;\n if (syllablePositions.length === 0 && noSyllablesRegExp) {\n normalizationRegex = noSyllablesRegExp;\n } else if (syllablePositions.length > 0 && withSyllablesRegExp) {\n normalizationRegex = withSyllablesRegExp;\n } else {\n // Compile the regular expression for text normalization once.\n const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(\"\");\n const toNormalizeWithNFKC = getNormalizeWithNFKC();\n\n // 3040-309F: Hiragana\n // 30A0-30FF: Katakana\n const CJK = \"(?:\\\\p{Ideographic}|[\\u3040-\\u30FF])\";\n const HKDiacritics = \"(?:\\u3099|\\u309A)\";\n const regexp = `([${replace}])|([${toNormalizeWithNFKC}])|(${HKDiacritics}\\\\n)|(\\\\p{M}+(?:-\\\\n)?)|(\\\\S-\\\\n)|(${CJK}\\\\n)|(\\\\n)`;\n\n if (syllablePositions.length === 0) {\n // Most of the syllables belong to Hangul so there are no need\n // to search for them in a non-Hangul document.\n // We use the \\0 in order to have the same number of groups.\n normalizationRegex = noSyllablesRegExp = new RegExp(\n regexp + \"|(\\\\u0000)\",\n \"gum\"\n );\n } else {\n normalizationRegex = withSyllablesRegExp = new RegExp(\n regexp + `|(${FIRST_CHAR_SYLLABLES_REG_EXP})`,\n \"gum\"\n );\n }\n }\n\n // The goal of this function is to normalize the string and\n // be able to get from an index in the new string the\n // corresponding index in the old string.\n // For example if we have: abCd12ef456gh where C is replaced by ccc\n // and numbers replaced by nothing (it's the case for diacritics), then\n // we'll obtain the normalized string: abcccdefgh.\n // So here the reverse map is: [0,1,2,2,2,3,6,7,11,12].\n\n // The goal is to obtain the array: [[0, 0], [3, -1], [4, -2],\n // [6, 0], [8, 3]].\n // which can be used like this:\n // - let say that i is the index in new string and j the index\n // the old string.\n // - if i is in [0; 3[ then j = i + 0\n // - if i is in [3; 4[ then j = i - 1\n // - if i is in [4; 6[ then j = i - 2\n // ...\n // Thanks to a binary search it's easy to know where is i and what's the\n // shift.\n // Let say that the last entry in the array is [x, s] and we have a\n // substitution at index y (old string) which will replace o chars by n chars.\n // Firstly, if o === n, then no need to add a new entry: the shift is\n // the same.\n // Secondly, if o < n, then we push the n - o elements:\n // [y - (s - 1), s - 1], [y - (s - 2), s - 2], ...\n // Thirdly, if o > n, then we push the element: [y - (s - n), o + s - n]\n\n // Collect diacritics length and positions.\n const rawDiacriticsPositions = [];\n while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {\n rawDiacriticsPositions.push([m[0].length, m.index]);\n }\n\n let normalized = text.normalize(\"NFD\");\n const positions = [[0, 0]];\n let rawDiacriticsIndex = 0;\n let syllableIndex = 0;\n let shift = 0;\n let shiftOrigin = 0;\n let eol = 0;\n let hasDiacritics = false;\n\n normalized = normalized.replace(\n normalizationRegex,\n (match, p1, p2, p3, p4, p5, p6, p7, p8, 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 (p5)` 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 // \"X-\\n\" is removed because an hyphen at the end of a line\n // with not a space before is likely here to mark a break\n // in a word.\n // 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 // 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 = p6.length - 1;\n positions.push([i - shift + len, shift]);\n shiftOrigin += 1;\n eol += 1;\n return p6.slice(0, -1);\n }\n\n if (p7) {\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 // p8\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 p8;\n }\n );\n\n positions.push([normalized.length, shift]);\n\n return [normalized, positions, hasDiacritics];\n}\n\n// Determine the original, non-normalized, match index such that highlighting of\n// search results is correct in the `textLayer` for strings containing e.g. \"½\"\n// characters; essentially \"inverting\" the result of the `normalize` function.\nfunction getOriginalIndex(diffs, pos, len) {\n if (!diffs) {\n return [pos, len];\n }\n\n // 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(diffs, x => x[0] >= start);\n if (diffs[i][0] > start) {\n --i;\n }\n\n let j = binarySearchFirstItem(diffs, x => x[0] >= end, i);\n if (diffs[j][0] > end) {\n --j;\n }\n\n // First char in the old string.\n const oldStart = start + diffs[i][1];\n\n // Last char in the old string.\n const oldEnd = end + diffs[j][1];\n const oldLen = oldEnd + 1 - oldStart;\n\n return [oldStart, oldLen];\n}\n\n/**\n * @typedef {Object} PDFFindControllerOptions\n * @property {IPDFLinkService} 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 /**\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 }\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} selectedLeft\n * @property {number} pageIndex\n * @property {number} matchIndex\n */\n\n /**\n * Scroll the current match into view.\n * @param {PDFFindControllerScrollMatchIntoViewParams}\n */\n scrollMatchIntoView({\n element = null,\n selectedLeft = 0,\n pageIndex = -1,\n matchIndex = -1,\n }) {\n if (!this._scrollMatches || !element) {\n return;\n } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {\n return;\n } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {\n return;\n }\n this._scrollMatches = false; // Ensure that scrolling only happens once.\n\n const spot = {\n top: MATCH_SCROLL_OFFSET_TOP,\n left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT,\n };\n scrollIntoView(element, spot, /* scrollMatches = */ true);\n }\n\n #reset() {\n this._highlightMatches = false;\n this._scrollMatches = false;\n this._pdfDocument = null;\n this._pageMatches = [];\n this._pageMatchesLength = [];\n this.#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\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 #calculateRegExpMatch(query, entireWord, pageIndex, pageContent) {\n const matches = (this._pageMatches[pageIndex] = []);\n const matchesLength = (this._pageMatchesLength[pageIndex] = []);\n if (!query) {\n // The query can be empty because some chars like diacritics could have\n // been stripped out.\n return;\n }\n const diffs = this._pageDiffs[pageIndex];\n let match;\n while ((match = query.exec(pageContent)) !== null) {\n if (\n entireWord &&\n !this.#isEntireWord(pageContent, match.index, match[0].length)\n ) {\n continue;\n }\n\n const [matchPos, matchLen] = getOriginalIndex(\n diffs,\n match.index,\n match[0].length\n );\n\n if (matchLen) {\n matches.push(matchPos);\n matchesLength.push(matchLen);\n }\n }\n }\n\n #convertToRegExpString(query, hasDiacritics) {\n const { matchDiacritics } = this.#state;\n let isUnicode = false;\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 interfer with regexp syntax.\n return `[ ]*\\\\${p1}[ ]*`;\n }\n if (p2) {\n // Allow whitespaces around punctuation signs.\n return `[ ]*${p2}[ ]*`;\n }\n if (p3) {\n // Replace spaces by \\s+ to be sure to match any spaces.\n return \"[ ]+\";\n }\n if (matchDiacritics) {\n return p4 || p5;\n }\n\n if (p4) {\n // Diacritics are removed with few exceptions.\n return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : \"\";\n }\n\n // A letter has been matched and it can be followed by any diacritics\n // in normalized text.\n if (hasDiacritics) {\n isUnicode = true;\n return `${p5}\\\\p{M}*`;\n }\n return p5;\n }\n );\n\n const trailingSpaces = \"[ ]*\";\n if (query.endsWith(trailingSpaces)) {\n // The [ ]* has been added in order to help to match \"foo . bar\" but\n // it doesn't make sense to match some whitespaces after the dot\n // when it's the last character.\n query = query.slice(0, query.length - trailingSpaces.length);\n }\n\n if (matchDiacritics) {\n // aX must not match aXY.\n if (hasDiacritics) {\n DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(\n ...DIACRITICS_EXCEPTION\n );\n\n isUnicode = true;\n query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\\\p{M}]|$)`;\n }\n }\n\n return [isUnicode, query];\n }\n\n #calculateMatch(pageIndex) {\n let query = this.#query;\n if (query.length === 0) {\n return; // Do nothing: the matches should be wiped out already.\n }\n const { caseSensitive, entireWord } = this.#state;\n const pageContent = this._pageContents[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\n const flags = `g${isUnicode ? \"u\" : \"\"}${caseSensitive ? \"\" : \"i\"}`;\n query = query ? new RegExp(query, flags) : null;\n\n this.#calculateRegExpMatch(query, entireWord, pageIndex, pageContent);\n\n // When `highlightAll` is set, ensure that the matches on previously\n // rendered (and still active) pages are correctly highlighted.\n if (this.#state.highlightAll) {\n this.#updatePage(pageIndex);\n }\n if (this._resumePageIdx === pageIndex) {\n this._resumePageIdx = null;\n this.#nextPageMatch();\n }\n\n // Update the match count.\n const pageMatchesCount = this._pageMatches[pageIndex].length;\n 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 #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 for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n const { promise, resolve } = Promise.withResolvers();\n this._extractTextPromises[i] = promise;\n\n // eslint-disable-next-line arrow-body-style\n deferred = deferred.then(() => {\n return this._pdfDocument\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 #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 matchesCount: this.#requestMatchesCount(),\n rawQuery: this.#state?.query ?? null,\n });\n }\n}\n\nexport { FindState, PDFFindController };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { isValidRotation, parseQueryString } from \"./ui_utils.js\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n// Heuristic value used when force-resetting `this._blockHashChange`.\nconst HASH_CHANGE_TIMEOUT = 1000; // milliseconds\n// Heuristic value used when adding the current position to the browser history.\nconst POSITION_UPDATED_THRESHOLD = 50;\n// Heuristic value used when adding a temporary position to the browser history.\nconst UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds\n\n/**\n * @typedef {Object} PDFHistoryOptions\n * @property {IPDFLinkService} linkService - The navigation/linking service.\n * @property {EventBus} eventBus - The application event bus.\n */\n\n/**\n * @typedef {Object} InitializeParameters\n * @property {string} fingerprint - The PDF document's unique fingerprint.\n * @property {boolean} [resetHistory] - Reset the browsing history.\n * @property {boolean} [updateUrl] - Attempt to update the document URL, with\n * the current hash, when pushing/replacing browser history entries.\n */\n\n/**\n * @typedef {Object} PushParameters\n * @property {string} [namedDest] - The named destination. If absent, a\n * stringified version of `explicitDest` is used.\n * @property {Array} explicitDest - The explicit destination array.\n * @property {number} pageNumber - The page to which the destination points.\n */\n\nfunction getCurrentHash() {\n return document.location.hash;\n}\n\nclass PDFHistory {\n /**\n * @param {PDFHistoryOptions} options\n */\n constructor({ linkService, eventBus }) {\n this.linkService = linkService;\n this.eventBus = eventBus;\n\n this._initialized = false;\n this._fingerprint = \"\";\n this.reset();\n\n this._boundEvents = null;\n // Ensure that we don't miss a \"pagesinit\" event,\n // by registering the listener immediately.\n this.eventBus._on(\"pagesinit\", () => {\n this._isPagesLoaded = false;\n\n this.eventBus._on(\n \"pagesloaded\",\n evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n },\n { once: true }\n );\n });\n }\n\n /**\n * Initialize the history for the PDF document, using either the current\n * browser history entry or the document hash, whichever is present.\n * @param {InitializeParameters} params\n */\n initialize({ fingerprint, resetHistory = false, updateUrl = false }) {\n if (!fingerprint || typeof fingerprint !== \"string\") {\n console.error(\n 'PDFHistory.initialize: The \"fingerprint\" must be a non-empty string.'\n );\n return;\n }\n // Ensure that any old state is always reset upon initialization.\n if (this._initialized) {\n this.reset();\n }\n const reInitialized =\n this._fingerprint !== \"\" && this._fingerprint !== fingerprint;\n this._fingerprint = fingerprint;\n this._updateUrl = updateUrl === true;\n\n this._initialized = true;\n this._bindEvents();\n const state = window.history.state;\n\n this._popStateInProgress = false;\n this._blockHashChange = 0;\n this._currentHash = getCurrentHash();\n this._numPositionUpdates = 0;\n\n this._uid = this._maxUid = 0;\n this._destination = null;\n this._position = null;\n\n if (!this._isValidState(state, /* checkReload = */ true) || resetHistory) {\n const { hash, page, rotation } = this._parseCurrentHash(\n /* checkNameddest = */ true\n );\n\n if (!hash || reInitialized || resetHistory) {\n // Ensure that the browser history is reset on PDF document load.\n this._pushOrReplaceState(null, /* forceReplace = */ true);\n return;\n }\n // Ensure that the browser history is initialized correctly when\n // the document hash is present on PDF document load.\n this._pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n\n // The browser history contains a valid entry, ensure that the history is\n // initialized correctly on PDF document load.\n const destination = state.destination;\n this._updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (destination.rotation !== undefined) {\n this._initialRotation = destination.rotation;\n }\n if (destination.dest) {\n this._initialBookmark = JSON.stringify(destination.dest);\n\n // If the history is updated, e.g. through the user changing the hash,\n // before the initial destination has become visible, then we do *not*\n // want to potentially add `this._position` to the browser history.\n this._destination.page = null;\n } else if (destination.hash) {\n this._initialBookmark = destination.hash;\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this._initialBookmark = `page=${destination.page}`;\n }\n }\n\n /**\n * Reset the current `PDFHistory` instance, and consequently prevent any\n * further updates and/or navigation of the browser history.\n */\n reset() {\n if (this._initialized) {\n this._pageHide(); // Simulate a 'pagehide' event when resetting.\n\n this._initialized = false;\n this._unbindEvents();\n }\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n this._initialBookmark = null;\n this._initialRotation = null;\n }\n\n /**\n * Push an internal destination to the browser history.\n * @param {PushParameters}\n */\n push({ namedDest = null, explicitDest, pageNumber }) {\n if (!this._initialized) {\n return;\n }\n if (namedDest && typeof namedDest !== \"string\") {\n console.error(\n \"PDFHistory.push: \" +\n `\"${namedDest}\" is not a valid namedDest parameter.`\n );\n return;\n } else if (!Array.isArray(explicitDest)) {\n console.error(\n \"PDFHistory.push: \" +\n `\"${explicitDest}\" is not a valid explicitDest parameter.`\n );\n return;\n } else if (!this._isValidPage(pageNumber)) {\n // Allow an unset `pageNumber` if and only if the history is still empty;\n // please refer to the `this._destination.page = null;` comment above.\n if (pageNumber !== null || this._destination) {\n console.error(\n \"PDFHistory.push: \" +\n `\"${pageNumber}\" is not a valid pageNumber parameter.`\n );\n return;\n }\n }\n\n const hash = namedDest || JSON.stringify(explicitDest);\n if (!hash) {\n // The hash *should* never be undefined, but if that were to occur,\n // avoid any possible issues by not updating the browser history.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination &&\n (isDestHashesEqual(this._destination.hash, hash) ||\n isDestArraysEqual(this._destination.dest, explicitDest))\n ) {\n // When the new destination is identical to `this._destination`, and\n // its `page` is undefined, replace the current browser history entry.\n // NOTE: This can only occur if `this._destination` was set either:\n // - through the document hash being specified on load.\n // - through the user changing the hash of the document.\n if (this._destination.page) {\n return;\n }\n forceReplace = true;\n }\n if (this._popStateInProgress && !forceReplace) {\n return;\n }\n\n this._pushOrReplaceState(\n {\n dest: explicitDest,\n hash,\n page: pageNumber,\n rotation: this.linkService.rotation,\n },\n forceReplace\n );\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new destination is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occurring when the new destination is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push a page to the browser history; generally the `push` method should be\n * used instead.\n * @param {number} pageNumber\n */\n pushPage(pageNumber) {\n if (!this._initialized) {\n return;\n }\n if (!this._isValidPage(pageNumber)) {\n console.error(\n `PDFHistory.pushPage: \"${pageNumber}\" is not a valid page number.`\n );\n return;\n }\n\n if (this._destination?.page === pageNumber) {\n // When the new page is identical to the one in `this._destination`, we\n // don't want to add a potential duplicate entry in the browser history.\n return;\n }\n if (this._popStateInProgress) {\n return;\n }\n\n this._pushOrReplaceState({\n // Simulate an internal destination, for `this._tryPushCurrentPosition`:\n dest: null,\n hash: `page=${pageNumber}`,\n page: pageNumber,\n rotation: this.linkService.rotation,\n });\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new page is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occurring when the new page is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push the current position to the browser history.\n */\n pushCurrentPosition() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n this._tryPushCurrentPosition();\n }\n\n /**\n * Go back one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n back() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n const state = window.history.state;\n if (this._isValidState(state) && state.uid > 0) {\n window.history.back();\n }\n }\n\n /**\n * Go forward one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n forward() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n const state = window.history.state;\n if (this._isValidState(state) && state.uid < this._maxUid) {\n window.history.forward();\n }\n }\n\n /**\n * @type {boolean} Indicating if the user is currently moving through the\n * browser history, useful e.g. for skipping the next 'hashchange' event.\n */\n get popStateInProgress() {\n return (\n this._initialized &&\n (this._popStateInProgress || this._blockHashChange > 0)\n );\n }\n\n get initialBookmark() {\n return this._initialized ? this._initialBookmark : null;\n }\n\n get initialRotation() {\n return this._initialized ? this._initialRotation : null;\n }\n\n /**\n * @private\n */\n _pushOrReplaceState(destination, forceReplace = false) {\n const shouldReplace = forceReplace || !this._destination;\n const newState = {\n fingerprint: this._fingerprint,\n uid: shouldReplace ? this._uid : this._uid + 1,\n destination,\n };\n\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n window.history.state?.chromecomState\n ) {\n // history.state.chromecomState is managed by chromecom.js.\n newState.chromecomState = window.history.state.chromecomState;\n }\n this._updateInternalState(destination, newState.uid);\n\n let newUrl;\n if (this._updateUrl && destination?.hash) {\n const baseUrl = document.location.href.split(\"#\", 1)[0];\n // Prevent errors in Firefox.\n if (!baseUrl.startsWith(\"file://\")) {\n newUrl = `${baseUrl}#${destination.hash}`;\n }\n }\n if (shouldReplace) {\n window.history.replaceState(newState, \"\", newUrl);\n } else {\n window.history.pushState(newState, \"\", newUrl);\n }\n\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n top === window\n ) {\n // eslint-disable-next-line no-undef\n chrome.runtime.sendMessage(\"showPageAction\");\n }\n }\n\n /**\n * @private\n */\n _tryPushCurrentPosition(temporary = false) {\n if (!this._position) {\n return;\n }\n let position = this._position;\n if (temporary) {\n position = Object.assign(Object.create(null), this._position);\n position.temporary = true;\n }\n\n if (!this._destination) {\n this._pushOrReplaceState(position);\n return;\n }\n if (this._destination.temporary) {\n // Always replace a previous *temporary* position.\n this._pushOrReplaceState(position, /* forceReplace = */ true);\n return;\n }\n if (this._destination.hash === position.hash) {\n return; // The current document position has not changed.\n }\n if (\n !this._destination.page &&\n (POSITION_UPDATED_THRESHOLD <= 0 ||\n this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)\n ) {\n // `this._destination` was set through the user changing the hash of\n // the document. Do not add `this._position` to the browser history,\n // to avoid \"flooding\" it with lots of (nearly) identical entries,\n // since we cannot ensure that the document position has changed.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination.page >= position.first &&\n this._destination.page <= position.page\n ) {\n // When the `page` of `this._destination` is still visible, do not\n // update the browsing history when `this._destination` either:\n // - contains an internal destination, since in this case we\n // cannot ensure that the document position has actually changed.\n // - was set through the user changing the hash of the document.\n if (this._destination.dest !== undefined || !this._destination.first) {\n return;\n }\n // To avoid \"flooding\" the browser history, replace the current entry.\n forceReplace = true;\n }\n this._pushOrReplaceState(position, forceReplace);\n }\n\n /**\n * @private\n */\n _isValidPage(val) {\n return (\n Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n );\n }\n\n /**\n * @private\n */\n _isValidState(state, checkReload = false) {\n if (!state) {\n return false;\n }\n if (state.fingerprint !== this._fingerprint) {\n if (checkReload) {\n // Potentially accept the history entry, even if the fingerprints don't\n // match, when the viewer was reloaded (see issue 6847).\n if (\n typeof state.fingerprint !== \"string\" ||\n state.fingerprint.length !== this._fingerprint.length\n ) {\n return false;\n }\n const [perfEntry] = performance.getEntriesByType(\"navigation\");\n if (perfEntry?.type !== \"reload\") {\n return false;\n }\n } else {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return false;\n }\n }\n if (!Number.isInteger(state.uid) || state.uid < 0) {\n return false;\n }\n if (state.destination === null || typeof state.destination !== \"object\") {\n return false;\n }\n return true;\n }\n\n /**\n * @private\n */\n _updateInternalState(destination, uid, removeTemporary = false) {\n if (this._updateViewareaTimeout) {\n // When updating `this._destination`, make sure that we always wait for\n // the next 'updateviewarea' event before (potentially) attempting to\n // push the current position to the browser history.\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n if (removeTemporary && destination?.temporary) {\n // When the `destination` comes from the browser history,\n // we no longer treat it as a *temporary* position.\n delete destination.temporary;\n }\n this._destination = destination;\n this._uid = uid;\n this._maxUid = Math.max(this._maxUid, uid);\n // This should always be reset when `this._destination` is updated.\n this._numPositionUpdates = 0;\n }\n\n /**\n * @private\n */\n _parseCurrentHash(checkNameddest = false) {\n const hash = unescape(getCurrentHash()).substring(1);\n const params = parseQueryString(hash);\n\n const nameddest = params.get(\"nameddest\") || \"\";\n let page = params.get(\"page\") | 0;\n\n if (!this._isValidPage(page) || (checkNameddest && nameddest.length > 0)) {\n page = null;\n }\n return { hash, page, rotation: this.linkService.rotation };\n }\n\n /**\n * @private\n */\n _updateViewarea({ location }) {\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n\n this._position = {\n hash: location.pdfOpenParams.substring(1),\n page: this.linkService.page,\n first: location.pageNumber,\n rotation: location.rotation,\n };\n\n if (this._popStateInProgress) {\n return;\n }\n\n if (\n POSITION_UPDATED_THRESHOLD > 0 &&\n this._isPagesLoaded &&\n this._destination &&\n !this._destination.page\n ) {\n // If the current destination was set through the user changing the hash\n // of the document, we will usually not try to push the current position\n // to the browser history; see `this._tryPushCurrentPosition()`.\n //\n // To prevent `this._tryPushCurrentPosition()` from effectively being\n // reduced to a no-op in this case, we will assume that the position\n // *did* in fact change if the 'updateviewarea' event was dispatched\n // more than `POSITION_UPDATED_THRESHOLD` times.\n this._numPositionUpdates++;\n }\n\n if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n // When closing the browser, a 'pagehide' event will be dispatched which\n // *should* allow us to push the current position to the browser history.\n // In practice, it seems that the event is arriving too late in order for\n // the session history to be successfully updated.\n // (For additional details, please refer to the discussion in\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1153393.)\n //\n // To workaround this we attempt to *temporarily* add the current position\n // to the browser history only when the viewer is *idle*,\n // i.e. when scrolling and/or zooming does not occur.\n //\n // PLEASE NOTE: It's absolutely imperative that the browser history is\n // *not* updated too often, since that would render the viewer more or\n // less unusable. Hence the use of a timeout to delay the update until\n // the viewer has been idle for `UPDATE_VIEWAREA_TIMEOUT` milliseconds.\n this._updateViewareaTimeout = setTimeout(() => {\n if (!this._popStateInProgress) {\n this._tryPushCurrentPosition(/* temporary = */ true);\n }\n this._updateViewareaTimeout = null;\n }, UPDATE_VIEWAREA_TIMEOUT);\n }\n }\n\n /**\n * @private\n */\n _popState({ state }) {\n const newHash = getCurrentHash(),\n hashChanged = this._currentHash !== newHash;\n this._currentHash = newHash;\n\n if (\n (typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n state?.chromecomState &&\n !this._isValidState(state)) ||\n !state\n ) {\n // This case corresponds to the user changing the hash of the document.\n this._uid++;\n\n const { hash, page, rotation } = this._parseCurrentHash();\n this._pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n if (!this._isValidState(state)) {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return;\n }\n\n // Prevent the browser history from updating until the new destination,\n // as stored in the browser history, has been scrolled into view.\n this._popStateInProgress = true;\n\n if (hashChanged) {\n // When the hash changed, implying that the 'popstate' event will be\n // followed by a 'hashchange' event, then we do *not* want to update the\n // browser history when handling the 'hashchange' event (in web/app.js)\n // since that would *overwrite* the new destination navigated to below.\n //\n // To avoid accidentally disabling all future user-initiated hash changes,\n // if there's e.g. another 'hashchange' listener that stops the event\n // propagation, we make sure to always force-reset `this._blockHashChange`\n // after `HASH_CHANGE_TIMEOUT` milliseconds have passed.\n this._blockHashChange++;\n waitOnEventOrTimeout({\n target: window,\n name: \"hashchange\",\n delay: HASH_CHANGE_TIMEOUT,\n }).then(() => {\n this._blockHashChange--;\n });\n }\n\n // Navigate to the new destination.\n const destination = state.destination;\n this._updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (isValidRotation(destination.rotation)) {\n this.linkService.rotation = destination.rotation;\n }\n if (destination.dest) {\n this.linkService.goToDestination(destination.dest);\n } else if (destination.hash) {\n this.linkService.setHash(destination.hash);\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this.linkService.page = destination.page;\n }\n\n // Since `PDFLinkService.goToDestination` is asynchronous, we thus defer the\n // resetting of `this._popStateInProgress` slightly.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n\n /**\n * @private\n */\n _pageHide() {\n // Attempt to push the `this._position` into the browser history when\n // navigating away from the document. This is *only* done if the history\n // is empty/temporary, since otherwise an existing browser history entry\n // will end up being overwritten (given that new entries cannot be pushed\n // into the browser history when the 'unload' event has already fired).\n if (!this._destination || this._destination.temporary) {\n this._tryPushCurrentPosition();\n }\n }\n\n /**\n * @private\n */\n _bindEvents() {\n if (this._boundEvents) {\n return; // The event listeners were already added.\n }\n this._boundEvents = {\n updateViewarea: this._updateViewarea.bind(this),\n popState: this._popState.bind(this),\n pageHide: this._pageHide.bind(this),\n };\n\n this.eventBus._on(\"updateviewarea\", this._boundEvents.updateViewarea);\n window.addEventListener(\"popstate\", this._boundEvents.popState);\n window.addEventListener(\"pagehide\", this._boundEvents.pageHide);\n }\n\n /**\n * @private\n */\n _unbindEvents() {\n if (!this._boundEvents) {\n return; // The event listeners were already removed.\n }\n this.eventBus._off(\"updateviewarea\", this._boundEvents.updateViewarea);\n window.removeEventListener(\"popstate\", this._boundEvents.popState);\n window.removeEventListener(\"pagehide\", this._boundEvents.pageHide);\n\n this._boundEvents = null;\n }\n}\n\nfunction isDestHashesEqual(destHash, pushHash) {\n if (typeof destHash !== \"string\" || typeof pushHash !== \"string\") {\n return false;\n }\n if (destHash === pushHash) {\n return true;\n }\n const nameddest = parseQueryString(destHash).get(\"nameddest\");\n if (nameddest === pushHash) {\n return true;\n }\n return false;\n}\n\nfunction isDestArraysEqual(firstDest, secondDest) {\n function isEntryEqual(first, second) {\n if (typeof first !== typeof second) {\n return false;\n }\n if (Array.isArray(first) || Array.isArray(second)) {\n return false;\n }\n if (first !== null && typeof first === \"object\" && second !== null) {\n if (Object.keys(first).length !== Object.keys(second).length) {\n return false;\n }\n for (const key in first) {\n if (!isEntryEqual(first[key], second[key])) {\n return false;\n }\n }\n return true;\n }\n return first === second || (Number.isNaN(first) && Number.isNaN(second));\n }\n\n if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {\n return false;\n }\n if (firstDest.length !== secondDest.length) {\n return false;\n }\n for (let i = 0, ii = firstDest.length; i < ii; i++) {\n if (!isEntryEqual(firstDest[i], secondDest[i])) {\n return false;\n }\n }\n return true;\n}\n\nexport { isDestArraysEqual, isDestHashesEqual, PDFHistory };\n","/* Copyright 2015 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { parseQueryString } from \"./ui_utils.js\";\n\nconst DEFAULT_LINK_REL = \"noopener noreferrer nofollow\";\n\nconst LinkTarget = {\n NONE: 0, // Default value.\n SELF: 1,\n BLANK: 2,\n PARENT: 3,\n TOP: 4,\n};\n\n/**\n * @typedef {Object} ExternalLinkParameters\n * @property {string} url - An absolute URL.\n * @property {LinkTarget} [target] - The link target. The default value is\n * `LinkTarget.NONE`.\n * @property {string} [rel] - The link relationship. The default value is\n * `DEFAULT_LINK_REL`.\n * @property {boolean} [enabled] - Whether the link should be enabled. The\n * default value is true.\n */\n\n/**\n * Adds various attributes (href, title, target, rel) to hyperlinks.\n * @param {HTMLAnchorElement} link - The link element.\n * @param {ExternalLinkParameters} params\n */\nfunction addLinkAttributes(link, { url, target, rel, enabled = true } = {}) {\n if (!url || typeof url !== \"string\") {\n throw new Error('A valid \"url\" parameter must provided.');\n }\n\n if (enabled) {\n link.href = link.title = url;\n } else {\n link.href = \"\";\n link.title = `Disabled: ${url}`;\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 * @typedef {Object} PDFLinkServiceOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [externalLinkTarget] - Specifies the `target` attribute\n * for external links. Must use one of the values from {LinkTarget}.\n * Defaults to using no target.\n * @property {string} [externalLinkRel] - Specifies the `rel` attribute for\n * external links. Defaults to stripping the referrer.\n * @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument,\n * thus preserving the current zoom level in the viewer, when navigating\n * to internal destinations. The default value is `false`.\n */\n\n/**\n * Performs navigation functions inside PDF, such as opening specified page,\n * or destination.\n * @implements {IPDFLinkService}\n */\nclass PDFLinkService {\n #pagesRefCache = new Map();\n\n /**\n * @param {PDFLinkServiceOptions} options\n */\n constructor({\n eventBus,\n externalLinkTarget = null,\n externalLinkRel = null,\n ignoreDestinationZoom = false,\n } = {}) {\n this.eventBus = eventBus;\n this.externalLinkTarget = externalLinkTarget;\n this.externalLinkRel = externalLinkRel;\n this.externalLinkEnabled = true;\n this._ignoreDestinationZoom = ignoreDestinationZoom;\n\n this.baseUrl = null;\n this.pdfDocument = null;\n this.pdfViewer = null;\n this.pdfHistory = null;\n }\n\n setDocument(pdfDocument, baseUrl = null) {\n this.baseUrl = baseUrl;\n this.pdfDocument = pdfDocument;\n this.#pagesRefCache.clear();\n }\n\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n\n setHistory(pdfHistory) {\n this.pdfHistory = pdfHistory;\n }\n\n /**\n * @type {number}\n */\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n }\n\n /**\n * @type {number}\n */\n get page() {\n return this.pdfViewer.currentPageNumber;\n }\n\n /**\n * @param {number} value\n */\n set page(value) {\n this.pdfViewer.currentPageNumber = value;\n }\n\n /**\n * @type {number}\n */\n get rotation() {\n return this.pdfViewer.pagesRotation;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {\n this.pdfViewer.pagesRotation = value;\n }\n\n /**\n * @type {boolean}\n */\n get isInPresentationMode() {\n return this.pdfViewer.isInPresentationMode;\n }\n\n #goToDestinationHelper(rawDest, namedDest = null, explicitDest) {\n // Dest array looks like that: <page-ref> </XYZ|/FitXXX> <args..>\n const destRef = explicitDest[0];\n let pageNumber;\n\n if (typeof destRef === \"object\" && destRef !== null) {\n pageNumber = this._cachedPageNumber(destRef);\n\n if (!pageNumber) {\n // Fetch the page reference if it's not yet available. This could\n // only occur during loading, before all pages have been resolved.\n this.pdfDocument\n .getPageIndex(destRef)\n .then(pageIndex => {\n this.cachePageRef(pageIndex + 1, destRef);\n this.#goToDestinationHelper(rawDest, namedDest, explicitDest);\n })\n .catch(() => {\n console.error(\n `PDFLinkService.#goToDestinationHelper: \"${destRef}\" is not ` +\n `a valid page reference, for dest=\"${rawDest}\".`\n );\n });\n return;\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n } else {\n console.error(\n `PDFLinkService.#goToDestinationHelper: \"${destRef}\" is not ` +\n `a valid destination reference, for dest=\"${rawDest}\".`\n );\n return;\n }\n if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n console.error(\n `PDFLinkService.#goToDestinationHelper: \"${pageNumber}\" is not ` +\n `a valid page number, for dest=\"${rawDest}\".`\n );\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new destination into\n // view, to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.push({ namedDest, explicitDest, pageNumber });\n }\n\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: explicitDest,\n ignoreDestinationZoom: this._ignoreDestinationZoom,\n });\n }\n\n /**\n * This method will, when available, also update the browser history.\n *\n * @param {string|Array} dest - The named, or explicit, PDF destination.\n */\n async goToDestination(dest) {\n if (!this.pdfDocument) {\n return;\n }\n let namedDest, explicitDest;\n if (typeof dest === \"string\") {\n namedDest = dest;\n explicitDest = await this.pdfDocument.getDestination(dest);\n } else {\n namedDest = null;\n explicitDest = await dest;\n }\n if (!Array.isArray(explicitDest)) {\n console.error(\n `PDFLinkService.goToDestination: \"${explicitDest}\" is not ` +\n `a valid destination array, for dest=\"${dest}\".`\n );\n return;\n }\n this.#goToDestinationHelper(dest, namedDest, explicitDest);\n }\n\n /**\n * This method will, when available, also update the browser history.\n *\n * @param {number|string} val - The page number, or page label.\n */\n goToPage(val) {\n if (!this.pdfDocument) {\n return;\n }\n const pageNumber =\n (typeof val === \"string\" && this.pdfViewer.pageLabelToPageNumber(val)) ||\n val | 0;\n if (\n !(\n Number.isInteger(pageNumber) &&\n pageNumber > 0 &&\n pageNumber <= this.pagesCount\n )\n ) {\n console.error(`PDFLinkService.goToPage: \"${val}\" is not a valid page.`);\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new page into view,\n // to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.pushPage(pageNumber);\n }\n\n this.pdfViewer.scrollPageIntoView({ pageNumber });\n }\n\n /**\n * Wrapper around the `addLinkAttributes` helper function.\n * @param {HTMLAnchorElement} link\n * @param {string} url\n * @param {boolean} [newWindow]\n */\n addLinkAttributes(link, url, newWindow = false) {\n addLinkAttributes(link, {\n url,\n target: newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n rel: this.externalLinkRel,\n enabled: this.externalLinkEnabled,\n });\n }\n\n /**\n * @param {string|Array} dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n if (typeof dest === \"string\") {\n if (dest.length > 0) {\n return this.getAnchorUrl(\"#\" + escape(dest));\n }\n } else if (Array.isArray(dest)) {\n const str = JSON.stringify(dest);\n if (str.length > 0) {\n return this.getAnchorUrl(\"#\" + escape(str));\n }\n }\n return this.getAnchorUrl(\"\");\n }\n\n /**\n * Prefix the full url on anchor links to make sure that links are resolved\n * relative to the current URL instead of the one defined in <base href>.\n * @param {string} anchor - The anchor hash, including the #.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(anchor) {\n return this.baseUrl ? 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.openOrDownloadData` 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 (\n typeof dest === \"string\" ||\n PDFLinkService.#isValidExplicitDestination(dest)\n ) {\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 // See PDF reference, table 8.45 - Named action\n switch (action) {\n case \"GoBack\":\n this.pdfHistory?.back();\n break;\n\n case \"GoForward\":\n this.pdfHistory?.forward();\n break;\n\n case \"NextPage\":\n this.pdfViewer.nextPage();\n break;\n\n case \"PrevPage\":\n this.pdfViewer.previousPage();\n break;\n\n case \"LastPage\":\n this.page = this.pagesCount;\n break;\n\n case \"FirstPage\":\n this.page = 1;\n break;\n\n default:\n break; // No action according to spec\n }\n\n this.eventBus.dispatch(\"namedaction\", {\n source: this,\n action,\n });\n }\n\n /**\n * @param {Object} action\n */\n async executeSetOCGState(action) {\n const pdfDocument = this.pdfDocument;\n const optionalContentConfig =\n 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 /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {\n if (!pageRef) {\n return;\n }\n const refStr =\n pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n this.#pagesRefCache.set(refStr, pageNum);\n }\n\n /**\n * @ignore\n */\n _cachedPageNumber(pageRef) {\n if (!pageRef) {\n return null;\n }\n const refStr =\n pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;\n return this.#pagesRefCache.get(refStr) || null;\n }\n\n static #isValidExplicitDestination(dest) {\n if (!Array.isArray(dest)) {\n return false;\n }\n const destLength = dest.length;\n if (destLength < 2) {\n return false;\n }\n const page = dest[0];\n if (\n !(\n typeof page === \"object\" &&\n Number.isInteger(page.num) &&\n Number.isInteger(page.gen)\n ) &&\n !(Number.isInteger(page) && page >= 0)\n ) {\n return false;\n }\n const zoom = dest[1];\n if (!(typeof zoom === \"object\" && typeof zoom.name === \"string\")) {\n return false;\n }\n let allowNull = true;\n switch (zoom.name) {\n case \"XYZ\":\n if (destLength !== 5) {\n return false;\n }\n break;\n case \"Fit\":\n case \"FitB\":\n return destLength === 2;\n case \"FitH\":\n case \"FitBH\":\n case \"FitV\":\n case \"FitBV\":\n if (destLength !== 3) {\n return false;\n }\n break;\n case \"FitR\":\n if (destLength !== 6) {\n return false;\n }\n allowNull = false;\n break;\n default:\n return false;\n }\n for (let i = 2; i < destLength; i++) {\n const param = dest[i];\n if (!(typeof param === \"number\" || (allowNull && param === null))) {\n return false;\n }\n }\n return true;\n }\n}\n\n/**\n * @implements {IPDFLinkService}\n */\nclass SimpleLinkService {\n constructor() {\n this.externalLinkEnabled = true;\n }\n\n /**\n * @type {number}\n */\n get pagesCount() {\n return 0;\n }\n\n /**\n * @type {number}\n */\n get page() {\n return 0;\n }\n\n /**\n * @param {number} value\n */\n set page(value) {}\n\n /**\n * @type {number}\n */\n get rotation() {\n return 0;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {}\n\n /**\n * @type {boolean}\n */\n get isInPresentationMode() {\n return false;\n }\n\n /**\n * @param {string|Array} dest - The named, or explicit, PDF destination.\n */\n async goToDestination(dest) {}\n\n /**\n * @param {number|string} val - The page number, or page label.\n */\n goToPage(val) {}\n\n /**\n * @param {HTMLAnchorElement} link\n * @param {string} url\n * @param {boolean} [newWindow]\n */\n addLinkAttributes(link, url, newWindow = false) {\n addLinkAttributes(link, { url, enabled: this.externalLinkEnabled });\n }\n\n /**\n * @param dest - The PDF destination object.\n * @returns {string} The hyperlink to the PDF object.\n */\n getDestinationHash(dest) {\n return \"#\";\n }\n\n /**\n * @param hash - The PDF parameters/hash.\n * @returns {string} The hyperlink to the PDF object.\n */\n getAnchorUrl(hash) {\n return \"#\";\n }\n\n /**\n * @param {string} hash\n */\n setHash(hash) {}\n\n /**\n * @param {string} action\n */\n executeNamedAction(action) {}\n\n /**\n * @param {Object} action\n */\n executeSetOCGState(action) {}\n\n /**\n * @param {number} pageNum - page number.\n * @param {Object} pageRef - reference to the page.\n */\n cachePageRef(pageNum, pageRef) {}\n}\n\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\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_rendering_queue\").PDFRenderingQueue} PDFRenderingQueue */\n\nimport {\n AbortException,\n AnnotationMode,\n PixelsPerInch,\n RenderingCancelledException,\n setLayerDimensions,\n shadow,\n} from \"pdfjs-lib\";\nimport {\n approximateFraction,\n DEFAULT_SCALE,\n OutputScale,\n RenderingStates,\n roundToDivide,\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 { DrawLayerBuilder } from \"./draw_layer_builder.js\";\nimport { GenericL10n } from \"web-null_l10n\";\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 {Object} [pageColors] - Overwrites background and foreground colors\n * with user defined ones in order to improve readability in high contrast\n * mode.\n * @property {IL10n} [l10n] - Localization service.\n * @property {Object} [layerProperties] - The object that is used to lookup\n * the necessary layer-properties.\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\n/**\n * @implements {IRenderableView}\n */\nclass PDFPageView {\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #hasRestrictedScaling = false;\n\n #layerProperties = null;\n\n #loadingId = null;\n\n #previousRotation = null;\n\n #renderError = null;\n\n #renderingState = RenderingStates.INITIAL;\n\n #textLayerMode = TextLayerMode.ENABLE;\n\n #useThumbnailCanvas = {\n directDrawing: true,\n initialOptionalContent: true,\n regularAnnotations: true,\n };\n\n #viewportMap = new WeakMap();\n\n #layers = [null, null, null, null];\n\n /**\n * @param {PDFPageViewOptions} options\n */\n constructor(options) {\n const container = options.container;\n const defaultViewport = options.defaultViewport;\n\n this.id = options.id;\n this.renderingId = \"page\" + this.id;\n this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES;\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.maxCanvasPixels =\n options.maxCanvasPixels ?? AppOptions.get(\"maxCanvasPixels\");\n this.pageColors = options.pageColors || null;\n\n this.eventBus = options.eventBus;\n this.renderingQueue = options.renderingQueue;\n this.l10n = options.l10n;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.l10n ||= new GenericL10n();\n }\n\n this.renderTask = null;\n this.resume = null;\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.zoomLayer = null;\n this.xfaLayer = null;\n this.structTreeLayer = null;\n this.drawLayer = 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\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 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 #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 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 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 break;\n case RenderingStates.INITIAL:\n case RenderingStates.FINISHED:\n this.div.classList.remove(\"loadingIcon\", \"loading\");\n break;\n }\n }\n\n #setDimensions() {\n const { viewport } = this;\n if (this.pdfPage) {\n if (this.#previousRotation === viewport.rotation) {\n return;\n }\n this.#previousRotation = viewport.rotation;\n }\n\n setLayerDimensions(\n this.div,\n viewport,\n /* mustFlip = */ true,\n /* mustRotate = */ false\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 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 async #renderAnnotationLayer() {\n let error = null;\n try {\n await this.annotationLayer.render(this.viewport, \"display\");\n } catch (ex) {\n console.error(`#renderAnnotationLayer: \"${ex}\".`);\n error = ex;\n } finally {\n this.eventBus.dispatch(\"annotationlayerrendered\", {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n }\n\n async #renderAnnotationEditorLayer() {\n let error = null;\n try {\n await this.annotationEditorLayer.render(this.viewport, \"display\");\n } catch (ex) {\n console.error(`#renderAnnotationEditorLayer: \"${ex}\".`);\n error = ex;\n } finally {\n this.eventBus.dispatch(\"annotationeditorlayerrendered\", {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n }\n\n async #renderDrawLayer() {\n try {\n await this.drawLayer.render(\"display\");\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(this.viewport, \"display\");\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\n this.eventBus.dispatch(\"xfalayerrendered\", {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n }\n\n async #renderTextLayer() {\n const { pdfPage, textLayer, viewport } = this;\n if (!textLayer) {\n return;\n }\n\n let error = null;\n try {\n if (!textLayer.renderingDone) {\n const readableStream = pdfPage.streamTextContent({\n includeMarkedContent: true,\n disableNormalization: true,\n });\n textLayer.setTextContentSource(readableStream);\n }\n await textLayer.render(viewport);\n } catch (ex) {\n if (ex instanceof AbortException) {\n return;\n }\n console.error(`#renderTextLayer: \"${ex}\".`);\n error = ex;\n }\n\n this.eventBus.dispatch(\"textlayerrendered\", {\n source: this,\n pageNumber: this.id,\n numTextDivs: textLayer.numTextDivs,\n error,\n });\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 this.structTreeLayer ||= new StructTreeLayerBuilder();\n\n const tree = await (!this.structTreeLayer.renderingDone\n ? this.pdfPage.getStructTree()\n : null);\n const treeDom = this.structTreeLayer?.render(tree);\n if (treeDom) {\n // Pause translation when inserting the structTree in the DOM.\n this.l10n.pause();\n this.canvas?.append(treeDom);\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 /**\n * @private\n */\n _resetZoomLayer(removeFromDOM = false) {\n if (!this.zoomLayer) {\n return;\n }\n const zoomLayerCanvas = this.zoomLayer.firstChild;\n this.#viewportMap.delete(zoomLayerCanvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n zoomLayerCanvas.width = 0;\n zoomLayerCanvas.height = 0;\n\n if (removeFromDOM) {\n // Note: `ChildNode.remove` doesn't throw if the parent node is undefined.\n this.zoomLayer.remove();\n }\n this.zoomLayer = null;\n }\n\n reset({\n keepZoomLayer = false,\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = 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 zoomLayerNode = (keepZoomLayer && this.zoomLayer) || null,\n annotationLayerNode =\n (keepAnnotationLayer && this.annotationLayer?.div) || null,\n annotationEditorLayerNode =\n (keepAnnotationEditorLayer && this.annotationEditorLayer?.div) || null,\n xfaLayerNode = (keepXfaLayer && this.xfaLayer?.div) || null,\n textLayerNode = (keepTextLayer && this.textLayer?.div) || null;\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const node = childNodes[i];\n switch (node) {\n case zoomLayerNode:\n case annotationLayerNode:\n case annotationEditorLayerNode:\n case xfaLayerNode:\n case textLayerNode:\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 (!zoomLayerNode) {\n if (this.canvas) {\n this.#viewportMap.delete(this.canvas);\n // Zeroing the width and height causes Firefox to release graphics\n // resources immediately, which can greatly reduce memory consumption.\n this.canvas.width = 0;\n this.canvas.height = 0;\n delete this.canvas;\n }\n this._resetZoomLayer();\n }\n }\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 if (this.canvas) {\n let onlyCssZoom = false;\n if (this.#hasRestrictedScaling) {\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.maxCanvasPixels === 0\n ) {\n onlyCssZoom = true;\n } else if (this.maxCanvasPixels > 0) {\n const { width, height } = this.viewport;\n const { sx, sy } = this.outputScale;\n onlyCssZoom =\n ((Math.floor(width) * sx) | 0) * ((Math.floor(height) * sy) | 0) >\n this.maxCanvasPixels;\n }\n }\n const postponeDrawing =\n !onlyCssZoom && drawingDelay >= 0 && drawingDelay < 1000;\n\n if (postponeDrawing || onlyCssZoom) {\n if (\n postponeDrawing &&\n this.renderingState !== RenderingStates.FINISHED\n ) {\n this.cancelRendering({\n keepZoomLayer: true,\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 target: this.canvas,\n redrawAnnotationLayer: true,\n redrawAnnotationEditorLayer: true,\n redrawXfaLayer: true,\n redrawTextLayer: !postponeDrawing,\n hideTextLayer: postponeDrawing,\n });\n\n if (postponeDrawing) {\n // The \"pagerendered\"-event will be dispatched once the actual\n // rendering is done, hence don't dispatch it here as well.\n return;\n }\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: true,\n timestamp: performance.now(),\n error: this.#renderError,\n });\n return;\n }\n if (!this.zoomLayer && !this.canvas.hidden) {\n this.zoomLayer = this.canvas.parentNode;\n this.zoomLayer.style.position = \"absolute\";\n }\n }\n if (this.zoomLayer) {\n this.cssTransform({ target: this.zoomLayer.firstChild });\n }\n this.reset({\n keepZoomLayer: true,\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n });\n }\n\n /**\n * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n * rather than calling this one directly.\n */\n cancelRendering({\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n cancelExtraDelay = 0,\n } = {}) {\n if (this.renderTask) {\n this.renderTask.cancel(cancelExtraDelay);\n this.renderTask = null;\n }\n this.resume = null;\n\n if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {\n this.textLayer.cancel();\n this.textLayer = null;\n }\n if (this.structTreeLayer && !this.textLayer) {\n this.structTreeLayer = null;\n }\n if (\n this.annotationLayer &&\n (!keepAnnotationLayer || !this.annotationLayer.div)\n ) {\n this.annotationLayer.cancel();\n this.annotationLayer = null;\n this._annotationCanvasMap = null;\n }\n if (\n this.annotationEditorLayer &&\n (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)\n ) {\n 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 target,\n redrawAnnotationLayer = false,\n redrawAnnotationEditorLayer = false,\n redrawXfaLayer = false,\n redrawTextLayer = false,\n hideTextLayer = false,\n }) {\n // Scale target (canvas), its wrapper and page container.\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) &&\n !(target instanceof HTMLCanvasElement)\n ) {\n throw new Error(\"Expected `target` to be a canvas.\");\n }\n if (!target.hasAttribute(\"zooming\")) {\n target.setAttribute(\"zooming\", true);\n const { style } = target;\n style.width = style.height = \"\";\n }\n\n const originalViewport = this.#viewportMap.get(target);\n if (this.viewport !== originalViewport) {\n // The canvas may have been originally rotated; rotate relative to that.\n const relativeRotation =\n this.viewport.rotation - originalViewport.rotation;\n const absRotation = Math.abs(relativeRotation);\n let scaleX = 1,\n scaleY = 1;\n if (absRotation === 90 || absRotation === 270) {\n const { width, height } = this.viewport;\n // Scale x and y because of the rotation.\n scaleX = height / width;\n scaleY = width / height;\n }\n target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;\n }\n\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 async #finishRenderTask(renderTask, error = null) {\n // The renderTask may have been replaced by a new one, so only remove\n // the reference to the renderTask if it matches the one that is\n // triggering this callback.\n if (renderTask === this.renderTask) {\n this.renderTask = null;\n }\n\n if (error instanceof RenderingCancelledException) {\n this.#renderError = null;\n return;\n }\n this.#renderError = error;\n\n this.renderingState = RenderingStates.FINISHED;\n this._resetZoomLayer(/* removeFromDOM = */ true);\n\n // Ensure that the thumbnails won't become partially (or fully) blank,\n // for documents that contain interactive form elements.\n this.#useThumbnailCanvas.regularAnnotations = !renderTask.separateAnnots;\n\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform: false,\n timestamp: performance.now(),\n error: this.#renderError,\n });\n\n if (error) {\n throw error;\n }\n }\n\n 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, pageColors, 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 // Wrap the canvas so that if it has a CSS transform for high DPI the\n // overflow will be hidden in Firefox.\n const canvasWrapper = document.createElement(\"div\");\n canvasWrapper.classList.add(\"canvasWrapper\");\n canvasWrapper.setAttribute(\"aria-hidden\", true);\n this.#addLayer(canvasWrapper, \"canvasWrapper\");\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 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 });\n }\n\n if (\n !this.annotationLayer &&\n this.#annotationMode !== AnnotationMode.DISABLE\n ) {\n const {\n annotationStorage,\n downloadManager,\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 enableScripting,\n hasJSActionsPromise,\n fieldObjectsPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n accessibilityManager: this._accessibilityManager,\n onAppend: annotationLayerDiv => {\n this.#addLayer(annotationLayerDiv, \"annotationLayer\");\n },\n });\n }\n\n const renderContinueCallback = cont => {\n 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 const { width, height } = viewport;\n const canvas = document.createElement(\"canvas\");\n canvas.setAttribute(\"role\", \"presentation\");\n\n // Keep the canvas hidden until the first draw callback, or until drawing\n // is complete when `!this.renderingQueue`, to prevent black flickering.\n canvas.hidden = true;\n const hasHCM = !!(pageColors?.background && pageColors?.foreground);\n\n let showCanvas = isLastShow => {\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 have\n // a final flash we just display it once all the drawing is done.\n if (!hasHCM || isLastShow) {\n canvas.hidden = false;\n showCanvas = null; // Only invoke the function once.\n }\n };\n canvasWrapper.append(canvas);\n this.canvas = canvas;\n\n const ctx = canvas.getContext(\"2d\", { alpha: false });\n const outputScale = (this.outputScale = new OutputScale());\n\n if (\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.#hasRestrictedScaling = true;\n } else if (this.maxCanvasPixels > 0) {\n const pixelsInViewport = width * height;\n const maxScale = Math.sqrt(this.maxCanvasPixels / pixelsInViewport);\n if (outputScale.sx > maxScale || outputScale.sy > maxScale) {\n outputScale.sx = maxScale;\n outputScale.sy = maxScale;\n this.#hasRestrictedScaling = true;\n } else {\n this.#hasRestrictedScaling = false;\n }\n }\n const sfx = approximateFraction(outputScale.sx);\n const sfy = approximateFraction(outputScale.sy);\n\n canvas.width = roundToDivide(width * outputScale.sx, sfx[0]);\n canvas.height = roundToDivide(height * outputScale.sy, sfy[0]);\n const { style } = canvas;\n style.width = roundToDivide(width, sfx[1]) + \"px\";\n style.height = roundToDivide(height, sfy[1]) + \"px\";\n\n // Add the viewport so it's known what it was originally drawn with.\n this.#viewportMap.set(canvas, viewport);\n\n // Rendering area\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n const renderContext = {\n canvasContext: ctx,\n transform,\n viewport,\n annotationMode: this.#annotationMode,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n pageColors,\n };\n const renderTask = (this.renderTask = this.pdfPage.render(renderContext));\n renderTask.onContinue = renderContinueCallback;\n\n const resultPromise = renderTask.promise.then(\n async () => {\n showCanvas?.(true);\n await this.#finishRenderTask(renderTask);\n\n this.#renderTextLayer();\n\n if (this.annotationLayer) {\n await this.#renderAnnotationLayer();\n }\n\n const { annotationEditorUIManager } = this.#layerProperties;\n\n if (!annotationEditorUIManager) {\n return;\n }\n\n this.drawLayer ||= new DrawLayerBuilder({\n pageIndex: this.id,\n });\n await this.#renderDrawLayer();\n this.drawLayer.setParent(canvasWrapper);\n\n if (!this.annotationEditorLayer) {\n this.annotationEditorLayer = new AnnotationEditorLayerBuilder({\n uiManager: annotationEditorUIManager,\n pdfPage,\n l10n,\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 }\n this.#renderAnnotationEditorLayer();\n },\n error => {\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 (!(error instanceof RenderingCancelledException)) {\n showCanvas?.(true);\n }\n return this.#finishRenderTask(renderTask, error);\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.eventBus.dispatch(\"pagerender\", {\n source: this,\n pageNumber: this.id,\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 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n/** @typedef {import(\"./pdf_viewer\").PDFViewer} PDFViewer */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./pdf_thumbnail_viewer\").PDFThumbnailViewer} PDFThumbnailViewer */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nconst CLEANUP_TIMEOUT = 30000;\n\n/**\n * Controls rendering of the views for pages and thumbnails.\n */\nclass PDFRenderingQueue {\n constructor() {\n this.pdfViewer = null;\n this.pdfThumbnailViewer = null;\n this.onIdle = null;\n this.highestPriorityPage = null;\n /** @type {number} */\n this.idleTimeout = null;\n this.printing = false;\n this.isThumbnailViewEnabled = false;\n\n 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 {IRenderableView} view\n * @returns {boolean}\n */\n isHighestPriority(view) {\n return this.highestPriorityPage === view.renderingId;\n }\n\n /**\n * @param {Object} currentlyVisiblePages\n */\n renderHighestPriority(currentlyVisiblePages) {\n if (this.idleTimeout) {\n clearTimeout(this.idleTimeout);\n this.idleTimeout = null;\n }\n\n // Pages have a higher priority than thumbnails, so check them first.\n if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {\n return;\n }\n // No pages needed rendering, so check thumbnails.\n if (\n this.isThumbnailViewEnabled &&\n this.pdfThumbnailViewer?.forceRendering()\n ) {\n return;\n }\n\n if (this.printing) {\n // If printing is currently ongoing do not reschedule cleanup.\n return;\n }\n\n if (this.onIdle) {\n this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);\n }\n }\n\n /**\n * @param {Object} visible\n * @param {Array} views\n * @param {boolean} scrolledDown\n * @param {boolean} [preRenderExtra]\n */\n getHighestPriority(visible, views, scrolledDown, preRenderExtra = false) {\n /**\n * The state has changed. Figure out which page has the highest priority to\n * render next (if any).\n *\n * Priority:\n * 1. visible pages\n * 2. if last scrolled down, the page after the visible pages, or\n * if last scrolled up, the page before the visible pages\n */\n const visibleViews = visible.views,\n numVisible = visibleViews.length;\n\n if (numVisible === 0) {\n return null;\n }\n for (let i = 0; i < numVisible; i++) {\n const view = visibleViews[i].view;\n if (!this.isViewFinished(view)) {\n return view;\n }\n }\n const firstId = visible.first.id,\n lastId = visible.last.id;\n\n // All the visible views have rendered; try to handle any \"holes\" in the\n // page layout (can happen e.g. with spreadModes at higher zoom levels).\n if (lastId - firstId + 1 > numVisible) {\n const visibleIds = visible.ids;\n for (let i = 1, ii = lastId - firstId; i < ii; i++) {\n const holeId = scrolledDown ? firstId + i : lastId - i;\n if (visibleIds.has(holeId)) {\n continue;\n }\n const holeView = views[holeId - 1];\n if (!this.isViewFinished(holeView)) {\n return holeView;\n }\n }\n }\n\n // All the visible views have rendered; try to render next/previous page.\n // (IDs start at 1, so no need to add 1 when `scrolledDown === true`.)\n let preRenderIndex = scrolledDown ? lastId : firstId - 2;\n let preRenderView = views[preRenderIndex];\n\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n if (preRenderExtra) {\n preRenderIndex += scrolledDown ? 1 : -1;\n preRenderView = views[preRenderIndex];\n\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n }\n // Everything that needs to be rendered has been.\n return null;\n }\n\n /**\n * @param {IRenderableView} view\n * @returns {boolean}\n */\n isViewFinished(view) {\n return view.renderingState === RenderingStates.FINISHED;\n }\n\n /**\n * Render a page or thumbnail view. This calls the appropriate function\n * based on the views state. If the view is already rendered it will return\n * `false`.\n *\n * @param {IRenderableView} view\n */\n renderView(view) {\n switch (view.renderingState) {\n case RenderingStates.FINISHED:\n return false;\n case RenderingStates.PAUSED:\n this.highestPriorityPage = view.renderingId;\n view.resume();\n break;\n case RenderingStates.RUNNING:\n this.highestPriorityPage = view.renderingId;\n break;\n case RenderingStates.INITIAL:\n this.highestPriorityPage = view.renderingId;\n view\n .draw()\n .finally(() => {\n this.renderHighestPriority();\n })\n .catch(reason => {\n if (reason instanceof RenderingCancelledException) {\n return;\n }\n console.error(`renderView: \"${reason}\"`);\n });\n break;\n }\n return true;\n }\n}\n\nexport { PDFRenderingQueue };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { docProperties, GenericScripting } from \"./generic_scripting.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.js\";\n\nclass PDFScriptingManagerComponents extends PDFScriptingManager {\n constructor(options) {\n // The default viewer already handles adding/removing of DOM events,\n // hence limit this to only the viewer components.\n if (!options.externalServices) {\n window.addEventListener(\"updatefromsandbox\", event => {\n options.eventBus.dispatch(\"updatefromsandbox\", {\n source: window,\n detail: event.detail,\n });\n });\n }\n\n options.externalServices ||= {\n createScripting: () => new GenericScripting(options.sandboxBundleSrc),\n };\n options.docProperties ||= pdfDocument => docProperties(pdfDocument);\n super(options);\n }\n}\n\nexport { PDFScriptingManagerComponents as PDFScriptingManager };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n\nimport { apiPageLayoutToViewerModes, RenderingStates } from \"./ui_utils.js\";\nimport { 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 #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.message}\".`);\n\n await this.#destroyScripting();\n return;\n }\n\n this._internalEvents.set(\"updatefromsandbox\", event => {\n if (event?.source === window) {\n this.#updateFromSandbox(event.detail);\n }\n });\n this._internalEvents.set(\"dispatcheventinsandbox\", event => {\n this.#scripting?.dispatchEventInSandbox(event.detail);\n });\n\n this._internalEvents.set(\"pagechanging\", ({ pageNumber, previous }) => {\n if (pageNumber === previous) {\n return; // The current page didn't change.\n }\n this.#dispatchPageClose(previous);\n this.#dispatchPageOpen(pageNumber);\n });\n this._internalEvents.set(\"pagerendered\", ({ pageNumber }) => {\n if (!this._pageOpenPending.has(pageNumber)) {\n return; // No pending \"PageOpen\" event for the newly rendered page.\n }\n if (pageNumber !== this.#pdfViewer.currentPageNumber) {\n return; // The newly rendered page is no longer the current one.\n }\n this.#dispatchPageOpen(pageNumber);\n });\n this._internalEvents.set(\"pagesdestroy\", async () => {\n await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber);\n\n await this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillClose\",\n });\n\n this.#closeCapability?.resolve();\n });\n\n for (const [name, listener] of this._internalEvents) {\n this.#eventBus._on(name, listener);\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 this.#eventBus.dispatch(\"sandboxcreated\", { source: this });\n } catch (error) {\n console.error(`setDocument: \"${error.message}\".`);\n\n await this.#destroyScripting();\n return;\n }\n\n await this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"Open\",\n });\n await this.#dispatchPageOpen(\n this.#pdfViewer.currentPageNumber,\n /* initialize = */ true\n );\n\n // Defer this slightly, to ensure that scripting is *fully* initialized.\n Promise.resolve().then(() => {\n if (pdfDocument === this.#pdfDocument) {\n this.#ready = true;\n }\n });\n }\n\n async dispatchWillSave() {\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 _internalEvents() {\n return shadow(this, \"_internalEvents\", new Map());\n }\n\n /**\n * @private\n */\n get _pageOpenPending() {\n return shadow(this, \"_pageOpenPending\", new Set());\n }\n\n /**\n * @private\n */\n get _visitedPages() {\n return shadow(this, \"_visitedPages\", new Map());\n }\n\n 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 for (const [name, listener] of this._internalEvents) {\n this.#eventBus._off(name, listener);\n }\n this._internalEvents.clear();\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 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ScrollMode, SpreadMode } from \"./ui_utils.js\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\n\nclass PDFSinglePageViewer extends PDFViewer {\n _resetView() {\n super._resetView();\n this._scrollMode = ScrollMode.PAGE;\n this._spreadMode = SpreadMode.NONE;\n }\n\n // eslint-disable-next-line accessor-pairs\n set scrollMode(mode) {}\n\n _updateScrollMode() {}\n\n // eslint-disable-next-line accessor-pairs\n set spreadMode(mode) {}\n\n _updateSpreadMode() {}\n}\n\nexport { PDFSinglePageViewer };\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\nimport { FindState, PDFFindController } from \"./pdf_find_controller.js\";\nimport {\n LinkTarget,\n PDFLinkService,\n SimpleLinkService,\n} from \"./pdf_link_service.js\";\nimport {\n parseQueryString,\n ProgressBar,\n RenderingStates,\n ScrollMode,\n SpreadMode,\n} from \"./ui_utils.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { DownloadManager } from \"./download_manager.js\";\nimport { EventBus } from \"./event_utils.js\";\nimport { GenericL10n } from \"./genericl10n.js\";\nimport { PDFHistory } from \"./pdf_history.js\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { PDFScriptingManager } from \"./pdf_scripting_manager.component.js\";\nimport { PDFSinglePageViewer } from \"./pdf_single_page_viewer.js\";\nimport { PDFViewer } from \"./pdf_viewer.js\";\nimport { StructTreeLayerBuilder } from \"./struct_tree_layer_builder.js\";\nimport { TextLayerBuilder } from \"./text_layer_builder.js\";\nimport { XfaLayerBuilder } from \"./xfa_layer_builder.js\";\n\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : void 0;\n/* eslint-disable-next-line no-unused-vars */\nconst pdfjsBuild =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_BUILD\") : void 0;\n\nexport {\n AnnotationLayerBuilder,\n DownloadManager,\n EventBus,\n FindState,\n GenericL10n,\n LinkTarget,\n parseQueryString,\n PDFFindController,\n PDFHistory,\n PDFLinkService,\n PDFPageView,\n PDFScriptingManager,\n PDFSinglePageViewer,\n PDFViewer,\n ProgressBar,\n RenderingStates,\n ScrollMode,\n SimpleLinkService,\n SpreadMode,\n StructTreeLayerBuilder,\n TextLayerBuilder,\n XfaLayerBuilder,\n};\n","/* Copyright 2014 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFDocumentProxy} PDFDocumentProxy */\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/optional_content_config\").OptionalContentConfig} OptionalContentConfig */\n/** @typedef {import(\"./event_utils\").EventBus} EventBus */\n/** @typedef {import(\"./interfaces\").IDownloadManager} IDownloadManager */\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n/** @typedef {import(\"./interfaces\").IPDFLinkService} IPDFLinkService */\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\nimport {\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationMode,\n PermissionFlag,\n PixelsPerInch,\n shadow,\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 RenderingStates,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SpreadMode,\n TextLayerMode,\n UNKNOWN_SCALE,\n VERTICAL_PADDING,\n watchScroll,\n} from \"./ui_utils.js\";\nimport { GenericL10n } from \"web-null_l10n\";\nimport { PDFPageView } from \"./pdf_page_view.js\";\nimport { PDFRenderingQueue } from \"./pdf_rendering_queue.js\";\nimport { SimpleLinkService } from \"./pdf_link_service.js\";\n\nconst DEFAULT_CACHE_SIZE = 10;\n\nconst PagesCountLimit = {\n FORCE_SCROLL_MODE_PAGE: 15000,\n FORCE_LAZY_PAGE_INIT: 7500,\n PAUSE_EAGER_PAGE_INIT: 250,\n};\n\nfunction isValidAnnotationEditorMode(mode) {\n return (\n Object.values(AnnotationEditorType).includes(mode) &&\n mode !== AnnotationEditorType.DISABLE\n );\n}\n\n/**\n * @typedef {Object} PDFViewerOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {HTMLDivElement} [viewer] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {IPDFLinkService} [linkService] - The navigation/linking service.\n * @property {IDownloadManager} [downloadManager] - The download manager\n * component.\n * @property {PDFFindController} [findController] - The find controller\n * component.\n * @property {PDFScriptingManager} [scriptingManager] - The scripting manager\n * component.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {boolean} [removePageBorders] - Removes the border shadow around\n * the pages. The default value is `false`.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n * selection and searching is created. The constants from {TextLayerMode}\n * should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n * created, and if interactive form elements or `AnnotationStorage`-data are\n * being rendered. The constants from {@link AnnotationMode} should be used;\n * see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n * The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {number} [annotationEditorMode] - Enables the creation and editing\n * of new Annotations. The constants from {@link AnnotationEditorType} should\n * be used. The default value is `AnnotationEditorType.NONE`.\n * @property {string} [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 {IL10n} [l10n] - Localization service.\n * @property {boolean} [enablePermissions] - Enables PDF document permissions,\n * when they exist. The default value is `false`.\n * @property {Object} [pageColors] - Overwrites background and foreground colors\n * with user defined ones in order to improve readability in high contrast\n * mode.\n */\n\nclass PDFPageViewBuffer {\n // Here we rely on the fact that `Set`s preserve the insertion order.\n #buf = new Set();\n\n #size = 0;\n\n constructor(size) {\n this.#size = size;\n }\n\n push(view) {\n const buf = this.#buf;\n if (buf.has(view)) {\n buf.delete(view); // Move the view to the \"end\" of the buffer.\n }\n buf.add(view);\n\n if (buf.size > this.#size) {\n this.#destroyFirstView();\n }\n }\n\n /**\n * After calling resize, the size of the buffer will be `newSize`.\n * The optional parameter `idsToKeep` is, if present, a Set of page-ids to\n * push to the back of the buffer, delaying their destruction. The size of\n * `idsToKeep` has no impact on the final size of the buffer; if `idsToKeep`\n * is larger than `newSize`, some of those pages will be destroyed anyway.\n */\n resize(newSize, idsToKeep = null) {\n this.#size = newSize;\n\n const buf = this.#buf;\n if (idsToKeep) {\n const ii = buf.size;\n let i = 1;\n for (const view of buf) {\n if (idsToKeep.has(view.id)) {\n buf.delete(view); // Move the view to the \"end\" of the buffer.\n buf.add(view);\n }\n if (++i > ii) {\n break;\n }\n }\n }\n\n while (buf.size > this.#size) {\n this.#destroyFirstView();\n }\n }\n\n has(view) {\n return this.#buf.has(view);\n }\n\n [Symbol.iterator]() {\n return this.#buf.keys();\n }\n\n #destroyFirstView() {\n const firstView = this.#buf.keys().next().value;\n\n firstView?.destroy();\n this.#buf.delete(firstView);\n }\n}\n\n/**\n * Simple viewer control to display PDF content/pages.\n */\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 #containerTopLeft = null;\n\n #copyCallbackBound = null;\n\n #enableHighlightFloatingButton = false;\n\n #enablePermissions = false;\n\n #mlManager = null;\n\n #getAllTextInProgress = false;\n\n #hiddenCopyElement = null;\n\n #interruptCopyCondition = false;\n\n #previousContainerHeight = 0;\n\n #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this));\n\n #scrollModePageState = null;\n\n #onVisibilityChange = null;\n\n #scaleTimeoutId = null;\n\n #textLayerMode = TextLayerMode.ENABLE;\n\n /**\n * @param {PDFViewerOptions} options\n */\n constructor(options) {\n const viewerVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\n if (version !== viewerVersion) {\n throw new Error(\n `The API version \"${version}\" does not match the Viewer version \"${viewerVersion}\".`\n );\n }\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n\n if (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\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.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.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\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 this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));\n this.presentationModeState = PresentationModeState.UNKNOWN;\n this._onBeforeDraw = this._onAfterDraw = null;\n this._resetView();\n\n if (\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 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 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 return params;\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() {\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 visibilityChangePromise = new Promise(resolve => {\n this.#onVisibilityChange = () => {\n if (document.visibilityState !== \"hidden\") {\n return;\n }\n resolve();\n };\n document.addEventListener(\"visibilitychange\", this.#onVisibilityChange);\n });\n\n await Promise.race([\n this._onePageRenderedCapability.promise,\n visibilityChangePromise,\n ]);\n // Ensure that the \"visibilitychange\" listener is always removed.\n document.removeEventListener(\"visibilitychange\", this.#onVisibilityChange);\n this.#onVisibilityChange = null;\n }\n\n async getAllText() {\n const texts = [];\n const buffer = [];\n for (\n let pageNum = 1, pagesCount = this.pdfDocument.numPages;\n pageNum <= pagesCount;\n ++pageNum\n ) {\n if (this.#interruptCopyCondition) {\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.#getAllTextInProgress ||\n textLayerMode === TextLayerMode.ENABLE_PERMISSIONS\n ) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.#getAllTextInProgress = 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 savedCursor = this.container.style.cursor;\n this.container.style.cursor = \"wait\";\n\n const interruptCopy = ev =>\n (this.#interruptCopyCondition = ev.key === \"Escape\");\n window.addEventListener(\"keydown\", interruptCopy);\n\n this.getAllText()\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.#getAllTextInProgress = false;\n this.#interruptCopyCondition = false;\n window.removeEventListener(\"keydown\", interruptCopy);\n this.container.style.cursor = savedCursor;\n });\n\n event.preventDefault();\n event.stopPropagation();\n }\n }\n\n /**\n * @param {PDFDocumentProxy} pdfDocument\n */\n setDocument(pdfDocument) {\n if (this.pdfDocument) {\n this.eventBus.dispatch(\"pagesdestroy\", { source: this });\n\n this._cancelRendering();\n this._resetView();\n\n this.findController?.setDocument(null);\n this._scriptingManager?.setDocument(null);\n\n if (this.#annotationEditorUIManager) {\n this.#annotationEditorUIManager.destroy();\n this.#annotationEditorUIManager = null;\n }\n }\n\n this.pdfDocument = pdfDocument;\n if (!pdfDocument) {\n return;\n }\n const 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 // Given that browsers don't handle huge amounts of DOM-elements very well,\n // enforce usage of PAGE-scrolling when loading *very* long/large documents.\n if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) {\n console.warn(\n \"Forcing PAGE-scrolling for performance reasons, given the length of the document.\"\n );\n const mode = (this._scrollMode = ScrollMode.PAGE);\n this.eventBus.dispatch(\"scrollmodechanged\", { source: this, mode });\n }\n\n this._pagesCapability.promise.then(\n () => {\n this.eventBus.dispatch(\"pagesloaded\", { source: this, pagesCount });\n },\n () => {\n /* Prevent \"Uncaught (in promise)\"-messages in the console. */\n }\n );\n\n this._onBeforeDraw = evt => {\n const pageView = this._pages[evt.pageNumber - 1];\n if (!pageView) {\n return;\n }\n // Add the page to the buffer at the start of drawing. That way it can be\n // evicted from the buffer and destroyed even if we pause its rendering.\n this.#buffer.push(pageView);\n };\n this.eventBus._on(\"pagerender\", this._onBeforeDraw);\n\n this._onAfterDraw = evt => {\n if (evt.cssTransform) {\n return;\n }\n this._onePageRenderedCapability.resolve({ timestamp: evt.timestamp });\n\n this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n this._onAfterDraw = null;\n };\n this.eventBus._on(\"pagerendered\", this._onAfterDraw);\n\n // Fetch a single page so we can get a viewport that will be the default\n // viewport for all pages\n Promise.all([firstPagePromise, permissionsPromise])\n .then(([firstPdfPage, permissions]) => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the first page resolved.\n }\n this._firstPageCapability.resolve(firstPdfPage);\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n const { annotationEditorMode, annotationMode, textLayerMode } =\n this.#initializePermissions(permissions);\n\n if (textLayerMode !== TextLayerMode.DISABLE) {\n const element = (this.#hiddenCopyElement =\n document.createElement(\"div\"));\n element.id = \"hiddenCopyElement\";\n this.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 this.viewer,\n this.#altTextManager,\n this.eventBus,\n pdfDocument,\n this.pageColors,\n this.#annotationEditorHighlightColors,\n this.#enableHighlightFloatingButton,\n this.#mlManager\n );\n this.eventBus.dispatch(\"annotationeditoruimanager\", {\n source: this,\n uiManager: this.#annotationEditorUIManager,\n });\n if (mode !== AnnotationEditorType.NONE) {\n this.#annotationEditorUIManager.updateMode(mode);\n }\n } else {\n console.error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n }\n\n const viewerElement =\n this._scrollMode === ScrollMode.PAGE ? null : this.viewer;\n const scale = this.currentScale;\n const viewport = firstPdfPage.getViewport({\n scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n });\n // Ensure that the various layers always get the correct initial size,\n // see issue 15795.\n this.viewer.style.setProperty(\"--scale-factor\", viewport.scale);\n if (\n this.pageColors?.foreground === \"CanvasText\" ||\n this.pageColors?.background === \"Canvas\"\n ) {\n this.viewer.style.setProperty(\n \"--hcm-highlight-filter\",\n pdfDocument.filterFactory.addHighlightHCMFilter(\n \"highlight\",\n \"CanvasText\",\n \"Canvas\",\n \"HighlightText\",\n \"Highlight\"\n )\n );\n this.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: this.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 pageColors: this.pageColors,\n l10n: this.l10n,\n layerProperties: this._layerProperties,\n });\n this._pages.push(pageView);\n }\n // Set the first `pdfPage` immediately, since it's already loaded,\n // rather than having to repeat the `PDFDocumentProxy.getPage` call in\n // the `this.#ensurePdfPageLoaded` method before rendering can start.\n const firstPageView = this._pages[0];\n if (firstPageView) {\n firstPageView.setPdfPage(firstPdfPage);\n this.linkService.cachePageRef(1, firstPdfPage.ref);\n }\n\n if (this._scrollMode === ScrollMode.PAGE) {\n // Ensure that the current page becomes visible on document load.\n this.#ensurePageViewVisible();\n } else if (this._spreadMode !== SpreadMode.NONE) {\n this._updateSpreadMode();\n }\n\n // Fetch all the pages since the viewport is needed before printing\n // starts to create the correct size canvas. Wait until one page is\n // rendered so we don't tie up too many resources early on.\n this.#onePageRenderedOrForceFetch().then(async () => {\n this.findController?.setDocument(pdfDocument); // Enable searching.\n this._scriptingManager?.setDocument(pdfDocument); // Enable scripting.\n\n if (this.#hiddenCopyElement) {\n this.#copyCallbackBound = this.#copyCallback.bind(\n this,\n textLayerMode\n );\n document.addEventListener(\"copy\", this.#copyCallbackBound);\n }\n\n if (this.#annotationEditorUIManager) {\n // Ensure that the Editor buttons, in the toolbar, are updated.\n this.eventBus.dispatch(\"annotationeditormodechanged\", {\n source: this,\n mode: this.#annotationEditorMode,\n });\n }\n\n // In addition to 'disableAutoFetch' being set, also attempt to reduce\n // resource usage when loading *very* long/large documents.\n if (\n pdfDocument.loadingParams.disableAutoFetch ||\n pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT\n ) {\n // XXX: Printing is semi-broken with auto fetch disabled.\n this._pagesCapability.resolve();\n return;\n }\n let getPagesLeft = pagesCount - 1; // The first page was already loaded.\n\n if (getPagesLeft <= 0) {\n this._pagesCapability.resolve();\n return;\n }\n for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) {\n const promise = pdfDocument.getPage(pageNum).then(\n pdfPage => {\n const pageView = this._pages[pageNum - 1];\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n this.linkService.cachePageRef(pageNum, pdfPage.ref);\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n },\n reason => {\n console.error(\n `Unable to get page ${pageNum} to initialize viewer`,\n reason\n );\n if (--getPagesLeft === 0) {\n this._pagesCapability.resolve();\n }\n }\n );\n\n if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) {\n await promise;\n }\n }\n });\n\n this.eventBus.dispatch(\"pagesinit\", { source: this });\n\n pdfDocument.getMetadata().then(({ info }) => {\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the metadata resolved.\n }\n if (info.Language) {\n this.viewer.lang = info.Language;\n }\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n })\n .catch(reason => {\n console.error(\"Unable to initialize viewer\", reason);\n\n this._pagesCapability.reject(reason);\n });\n }\n\n /**\n * @param {Array|null} labels\n */\n setPageLabels(labels) {\n if (!this.pdfDocument) {\n return;\n }\n if (!labels) {\n this._pageLabels = null;\n } else if (\n !(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)\n ) {\n this._pageLabels = null;\n console.error(`setPageLabels: Invalid page labels.`);\n } else {\n this._pageLabels = labels;\n }\n // Update all the `PDFPageView` instances.\n for (let i = 0, ii = this._pages.length; i < ii; i++) {\n this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null);\n }\n }\n\n _resetView() {\n this._pages = [];\n this._currentPageNumber = 1;\n this._currentScale = UNKNOWN_SCALE;\n this._currentScaleValue = null;\n this._pageLabels = null;\n this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);\n this._location = null;\n this._pagesRotation = 0;\n this._optionalContentConfigPromise = null;\n this._firstPageCapability = 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 if (this._onBeforeDraw) {\n this.eventBus._off(\"pagerender\", this._onBeforeDraw);\n this._onBeforeDraw = null;\n }\n if (this._onAfterDraw) {\n this.eventBus._off(\"pagerendered\", this._onAfterDraw);\n this._onAfterDraw = null;\n }\n if (this.#onVisibilityChange) {\n document.removeEventListener(\n \"visibilitychange\",\n this.#onVisibilityChange\n );\n this.#onVisibilityChange = null;\n }\n // Remove the pages from the DOM...\n this.viewer.textContent = \"\";\n // ... and reset the Scroll mode CSS class(es) afterwards.\n this._updateScrollMode();\n\n this.viewer.removeAttribute(\"lang\");\n\n if (this.#hiddenCopyElement) {\n document.removeEventListener(\"copy\", this.#copyCallbackBound);\n this.#copyCallbackBound = null;\n\n this.#hiddenCopyElement.remove();\n this.#hiddenCopyElement = null;\n }\n }\n\n #ensurePageViewVisible() {\n if (this._scrollMode !== ScrollMode.PAGE) {\n throw new Error(\"#ensurePageViewVisible: Invalid scrollMode value.\");\n }\n const pageNumber = this._currentPageNumber,\n state = this.#scrollModePageState,\n viewer = this.viewer;\n\n // Temporarily remove all the pages from the DOM...\n viewer.textContent = \"\";\n // ... and clear out the active ones.\n state.pages.length = 0;\n\n if (this._spreadMode === SpreadMode.NONE && !this.isInPresentationMode) {\n // Finally, append the new page to the viewer.\n const pageView = this._pages[pageNumber - 1];\n viewer.append(pageView.div);\n\n state.pages.push(pageView);\n } else {\n const pageIndexSet = new Set(),\n parity = this._spreadMode - 1;\n\n // Determine the pageIndices in the new spread.\n if (parity === -1) {\n // PresentationMode is active, with `SpreadMode.NONE` set.\n pageIndexSet.add(pageNumber - 1);\n } else if (pageNumber % 2 !== parity) {\n // Left-hand side page.\n pageIndexSet.add(pageNumber - 1);\n pageIndexSet.add(pageNumber);\n } else {\n // Right-hand side page.\n pageIndexSet.add(pageNumber - 2);\n pageIndexSet.add(pageNumber - 1);\n }\n\n // Finally, append the new pages to the viewer and apply the spreadMode.\n const spread = document.createElement(\"div\");\n spread.className = \"spread\";\n\n if (this.isInPresentationMode) {\n const dummyPage = document.createElement(\"div\");\n dummyPage.className = \"dummyPage\";\n spread.append(dummyPage);\n }\n\n for (const i of pageIndexSet) {\n const pageView = this._pages[i];\n if (!pageView) {\n continue;\n }\n spread.append(pageView.div);\n\n state.pages.push(pageView);\n }\n viewer.append(spread);\n }\n\n state.scrollDown = pageNumber >= state.previousPageNumber;\n state.previousPageNumber = pageNumber;\n }\n\n _scrollUpdate() {\n if (this.pagesCount === 0) {\n return;\n }\n this.update();\n }\n\n #scrollIntoView(pageView, pageSpot = null) {\n const { div, id } = pageView;\n\n // Ensure that `this._currentPageNumber` is correct, when `#scrollIntoView`\n // is called directly (and not from `#resetCurrentPageView`).\n if (this._currentPageNumber !== id) {\n this._setCurrentPageNumber(id);\n }\n if (this._scrollMode === ScrollMode.PAGE) {\n this.#ensurePageViewVisible();\n // Ensure that rendering always occurs, to avoid showing a blank page,\n // even if the current position doesn't change when the page is scrolled.\n this.update();\n }\n\n if (!pageSpot && !this.isInPresentationMode) {\n const left = div.offsetLeft + div.clientLeft,\n right = left + div.clientWidth;\n const { scrollLeft, clientWidth } = this.container;\n if (\n this._scrollMode === ScrollMode.HORIZONTAL ||\n left < scrollLeft ||\n right > scrollLeft + clientWidth\n ) {\n pageSpot = { left: 0, top: 0 };\n }\n }\n scrollIntoView(div, pageSpot);\n\n // Ensure that the correct *initial* document position is set, when any\n // OpenParameters are used, for documents with non-default Scroll/Spread\n // modes (fixes issue 15695). This is necessary since the scroll-handler\n // invokes the `update`-method asynchronously, and `this._location` could\n // thus be wrong when the initial zooming occurs in the default viewer.\n if (!this._currentScaleValue && this._location) {\n this._location = null;\n }\n }\n\n /**\n * Prevent unnecessary re-rendering of all pages when the scale changes\n * only because of limited numerical precision.\n */\n #isSameScale(newScale) {\n return (\n newScale === this._currentScale ||\n Math.abs(newScale - this._currentScale) < 1e-15\n );\n }\n\n #setScaleUpdatePages(\n newScale,\n newValue,\n { noScroll = false, preset = false, drawingDelay = -1 }\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 this._currentScale = newScale;\n\n if (!noScroll) {\n let page = this._currentPageNumber,\n dest;\n if (\n this._location &&\n !(this.isInPresentationMode || this.isChangingPresentationMode)\n ) {\n page = this._location.pageNumber;\n dest = [\n null,\n { name: \"XYZ\" },\n this._location.left,\n this._location.top,\n null,\n ];\n }\n this.scrollPageIntoView({\n pageNumber: page,\n destArray: dest,\n allowNegativeOffset: true,\n });\n }\n\n this.eventBus.dispatch(\"scalechanging\", {\n source: this,\n scale: newScale,\n presetValue: preset ? newValue : undefined,\n });\n\n if (this.defaultRenderingQueue) {\n this.update();\n }\n }\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 */\n\n /**\n * Scrolls page into view.\n * @param {ScrollPageIntoViewParameters} params\n */\n scrollPageIntoView({\n pageNumber,\n destArray = null,\n allowNegativeOffset = false,\n ignoreDestinationZoom = false,\n }) {\n if (!this.pdfDocument) {\n return;\n }\n const pageView =\n Number.isInteger(pageNumber) && this._pages[pageNumber - 1];\n if (!pageView) {\n console.error(\n `scrollPageIntoView: \"${pageNumber}\" is not a valid pageNumber parameter.`\n );\n return;\n }\n\n if (this.isInPresentationMode || !destArray) {\n this._setCurrentPageNumber(pageNumber, /* resetCurrentPageView = */ true);\n return;\n }\n let x = 0,\n y = 0;\n let width = 0,\n height = 0,\n widthScale,\n heightScale;\n const changeOrientation = pageView.rotation % 180 !== 0;\n const pageWidth =\n (changeOrientation ? pageView.height : pageView.width) /\n pageView.scale /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n const pageHeight =\n (changeOrientation ? pageView.width : pageView.height) /\n pageView.scale /\n PixelsPerInch.PDF_TO_CSS_UNITS;\n let scale = 0;\n switch (destArray[1].name) {\n case \"XYZ\":\n x = destArray[2];\n y = destArray[3];\n scale = destArray[4];\n // If x and/or y coordinates are not supplied, default to\n // _top_ left of the page (not the obvious bottom left,\n // since aligning the bottom of the intended page with the\n // top of the window is rarely helpful).\n x = x !== null ? x : 0;\n y = y !== null ? y : pageHeight;\n break;\n case \"Fit\":\n case \"FitB\":\n scale = \"page-fit\";\n break;\n case \"FitH\":\n case \"FitBH\":\n y = destArray[2];\n scale = \"page-width\";\n // According to the PDF spec, section 12.3.2.2, a `null` value in the\n // parameter should maintain the position relative to the new page.\n if (y === null && this._location) {\n x = this._location.left;\n y = this._location.top;\n } else if (typeof y !== \"number\" || y < 0) {\n // The \"top\" value isn't optional, according to the spec, however some\n // bad PDF generators will pretend that it is (fixes bug 1663390).\n y = pageHeight;\n }\n break;\n case \"FitV\":\n case \"FitBV\":\n x = destArray[2];\n width = pageWidth;\n height = pageHeight;\n scale = \"page-height\";\n break;\n case \"FitR\":\n x = destArray[2];\n y = destArray[3];\n width = destArray[4] - x;\n height = destArray[5] - y;\n 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 (!allowNegativeOffset) {\n // Some bad PDF generators will create destinations with e.g. top values\n // that exceeds the page height. Ensure that offsets are not negative,\n // to prevent a previous page from becoming visible (fixes bug 874482).\n left = Math.max(left, 0);\n top = Math.max(top, 0);\n }\n this.#scrollIntoView(pageView, /* pageSpot = */ { left, top });\n }\n\n _updateLocation(firstPage) {\n const currentScale = this._currentScale;\n const currentScaleValue = this._currentScaleValue;\n const normalizedScaleValue =\n parseFloat(currentScaleValue) === currentScale\n ? Math.round(currentScale * 10000) / 100\n : currentScaleValue;\n\n const pageNumber = firstPage.id;\n const currentPageView = this._pages[pageNumber - 1];\n const container = this.container;\n const topLeft = currentPageView.getPagePoint(\n container.scrollLeft - firstPage.x,\n container.scrollTop - firstPage.y\n );\n const intLeft = Math.round(topLeft[0]);\n const intTop = Math.round(topLeft[1]);\n\n let pdfOpenParams = `#page=${pageNumber}`;\n if (!this.isInPresentationMode) {\n pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`;\n }\n\n this._location = {\n pageNumber,\n scale: normalizedScaleValue,\n top: intTop,\n left: intLeft,\n rotation: this._pagesRotation,\n pdfOpenParams,\n };\n }\n\n update() {\n const visible = this._getVisiblePages();\n const visiblePages = visible.views,\n numVisiblePages = visiblePages.length;\n\n if (numVisiblePages === 0) {\n return;\n }\n const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1);\n this.#buffer.resize(newCacheSize, visible.ids);\n\n this.renderingQueue.renderHighestPriority(visible);\n\n const isSimpleLayout =\n this._spreadMode === SpreadMode.NONE &&\n (this._scrollMode === ScrollMode.PAGE ||\n this._scrollMode === ScrollMode.VERTICAL);\n const currentId = this._currentPageNumber;\n let stillFullyVisible = false;\n\n for (const page of visiblePages) {\n if (page.percent < 100) {\n break;\n }\n if (page.id === currentId && isSimpleLayout) {\n stillFullyVisible = true;\n break;\n }\n }\n this._setCurrentPageNumber(\n stillFullyVisible ? currentId : visiblePages[0].id\n );\n\n this._updateLocation(visible.first);\n this.eventBus.dispatch(\"updateviewarea\", {\n source: this,\n location: this._location,\n });\n }\n\n containsElement(element) {\n return this.container.contains(element);\n }\n\n focus() {\n this.container.focus();\n }\n\n get _isContainerRtl() {\n return getComputedStyle(this.container).direction === \"rtl\";\n }\n\n get isInPresentationMode() {\n return this.presentationModeState === PresentationModeState.FULLSCREEN;\n }\n\n get isChangingPresentationMode() {\n return this.presentationModeState === PresentationModeState.CHANGING;\n }\n\n get isHorizontalScrollbarEnabled() {\n return this.isInPresentationMode\n ? false\n : this.container.scrollWidth > this.container.clientWidth;\n }\n\n get isVerticalScrollbarEnabled() {\n return this.isInPresentationMode\n ? false\n : this.container.scrollHeight > this.container.clientHeight;\n }\n\n _getVisiblePages() {\n const views =\n this._scrollMode === ScrollMode.PAGE\n ? this.#scrollModePageState.pages\n : this._pages,\n horizontal = this._scrollMode === ScrollMode.HORIZONTAL,\n rtl = horizontal && this._isContainerRtl;\n\n return getVisibleElements({\n scrollEl: this.container,\n views,\n sortByVisibility: true,\n horizontal,\n rtl,\n });\n }\n\n cleanup() {\n for (const pageView of this._pages) {\n if (pageView.renderingState !== RenderingStates.FINISHED) {\n pageView.reset();\n }\n }\n }\n\n /**\n * @private\n */\n _cancelRendering() {\n for (const pageView of this._pages) {\n pageView.cancelRendering();\n }\n }\n\n /**\n * @param {PDFPageView} pageView\n * @returns {Promise<PDFPageProxy | null>}\n */\n async #ensurePdfPageLoaded(pageView) {\n if (pageView.pdfPage) {\n return pageView.pdfPage;\n }\n try {\n const pdfPage = await this.pdfDocument.getPage(pageView.id);\n if (!pageView.pdfPage) {\n pageView.setPdfPage(pdfPage);\n }\n if (!this.linkService._cachedPageNumber?.(pdfPage.ref)) {\n this.linkService.cachePageRef(pageView.id, pdfPage.ref);\n }\n return pdfPage;\n } catch (reason) {\n console.error(\"Unable to get page for page view\", reason);\n return null; // Page error -- there is nothing that can be done.\n }\n }\n\n #getScrollAhead(visible) {\n if (visible.first?.id === 1) {\n return true;\n } else if (visible.last?.id === this.pagesCount) {\n return false;\n }\n switch (this._scrollMode) {\n case ScrollMode.PAGE:\n return this.#scrollModePageState.scrollDown;\n case ScrollMode.HORIZONTAL:\n return this.scroll.right;\n }\n return this.scroll.down;\n }\n\n forceRendering(currentlyVisiblePages) {\n const visiblePages = currentlyVisiblePages || this._getVisiblePages();\n const scrollAhead = this.#getScrollAhead(visiblePages);\n const preRenderExtra =\n this._spreadMode !== SpreadMode.NONE &&\n this._scrollMode !== ScrollMode.HORIZONTAL;\n\n const pageView = this.renderingQueue.getHighestPriority(\n visiblePages,\n this._pages,\n scrollAhead,\n preRenderExtra\n );\n\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 /**\n * @private\n */\n _getPageAdvance(currentPageNumber, previous = false) {\n switch (this._scrollMode) {\n case ScrollMode.WRAPPED: {\n const { views } = this._getVisiblePages(),\n pageLayout = new Map();\n\n // Determine the current (visible) page layout.\n for (const { id, y, percent, widthPercent } of views) {\n if (percent === 0 || widthPercent < 100) {\n continue;\n }\n let yArray = pageLayout.get(y);\n if (!yArray) {\n pageLayout.set(y, (yArray ||= []));\n }\n yArray.push(id);\n }\n // Find the row of the current page.\n for (const yArray of pageLayout.values()) {\n const currentIndex = yArray.indexOf(currentPageNumber);\n if (currentIndex === -1) {\n continue;\n }\n const numPages = yArray.length;\n if (numPages === 1) {\n break;\n }\n // Handle documents with varying page sizes.\n if (previous) {\n for (let i = currentIndex - 1, ii = 0; i >= ii; i--) {\n const currentId = yArray[i],\n expectedId = yArray[i + 1] - 1;\n if (currentId < expectedId) {\n return currentPageNumber - expectedId;\n }\n }\n } else {\n for (let i = currentIndex + 1, ii = numPages; i < ii; i++) {\n const currentId = yArray[i],\n expectedId = yArray[i - 1] + 1;\n if (currentId > expectedId) {\n return expectedId - currentPageNumber;\n }\n }\n }\n // The current row is \"complete\", advance to the previous/next one.\n if (previous) {\n const firstId = yArray[0];\n if (firstId < currentPageNumber) {\n return currentPageNumber - firstId + 1;\n }\n } else {\n const lastId = yArray[numPages - 1];\n if (lastId > currentPageNumber) {\n return lastId - currentPageNumber + 1;\n }\n }\n break;\n }\n break;\n }\n case ScrollMode.HORIZONTAL: {\n break;\n }\n case ScrollMode.PAGE:\n case ScrollMode.VERTICAL: {\n if (this._spreadMode === SpreadMode.NONE) {\n break; // Normal vertical scrolling.\n }\n const parity = this._spreadMode - 1;\n\n if (previous && currentPageNumber % 2 !== parity) {\n break; // Left-hand side page.\n } else if (!previous && currentPageNumber % 2 === parity) {\n break; // Right-hand side page.\n }\n const { views } = this._getVisiblePages(),\n expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1;\n\n for (const { id, percent, widthPercent } of views) {\n if (id !== expectedId) {\n continue;\n }\n if (percent > 0 && widthPercent === 100) {\n return 2;\n }\n break;\n }\n break;\n }\n }\n return 1;\n }\n\n /**\n * Go to the next page, taking scroll/spread-modes into account.\n * @returns {boolean} Whether navigation 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 */\n\n /**\n * Increase the current zoom level one, or more, times.\n * @param {ChangeScaleOptions} [options]\n */\n increaseScale({ drawingDelay, scaleFactor, steps } = {}) {\n if (!this.pdfDocument) {\n return;\n }\n let newScale = this._currentScale;\n if (scaleFactor > 1) {\n newScale = Math.round(newScale * scaleFactor * 100) / 100;\n } else {\n steps ??= 1;\n do {\n newScale =\n Math.ceil((newScale * DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;\n } while (--steps > 0 && newScale < MAX_SCALE);\n }\n this.#setScale(Math.min(MAX_SCALE, newScale), {\n noScroll: false,\n drawingDelay,\n });\n }\n\n /**\n * Decrease the current zoom level one, or more, times.\n * @param {ChangeScaleOptions} [options]\n */\n decreaseScale({ drawingDelay, scaleFactor, steps } = {}) {\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 {\n steps ??= 1;\n do {\n newScale =\n Math.floor((newScale / DEFAULT_SCALE_DELTA).toFixed(2) * 10) / 10;\n } while (--steps > 0 && newScale > MIN_SCALE);\n }\n this.#setScale(Math.max(MIN_SCALE, newScale), {\n noScroll: false,\n drawingDelay,\n });\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 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 */\n\n /**\n * @param {AnnotationEditorModeOptions} options\n */\n set annotationEditorMode({ mode, editId = null, isFromKeyboard = false }) {\n if (!this.#annotationEditorUIManager) {\n throw new Error(`The AnnotationEditor is not enabled.`);\n }\n if (this.#annotationEditorMode === mode) {\n return; // The AnnotationEditor mode didn't change.\n }\n if (!isValidAnnotationEditorMode(mode)) {\n throw new Error(`Invalid AnnotationEditor mode: ${mode}`);\n }\n if (!this.pdfDocument) {\n return;\n }\n this.#annotationEditorMode = mode;\n this.eventBus.dispatch(\"annotationeditormodechanged\", {\n source: this,\n mode,\n });\n\n this.#annotationEditorUIManager.updateMode(mode, editId, isFromKeyboard);\n }\n\n // eslint-disable-next-line accessor-pairs\n set annotationEditorParams({ type, value }) {\n if (!this.#annotationEditorUIManager) {\n throw new Error(`The AnnotationEditor is not enabled.`);\n }\n this.#annotationEditorUIManager.updateParams(type, value);\n }\n\n refresh(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 if (this.#scaleTimeoutId !== null) {\n clearTimeout(this.#scaleTimeoutId);\n this.#scaleTimeoutId = null;\n }\n if (!noUpdate) {\n this.update();\n }\n }\n}\n\nexport { PagesCountLimit, PDFPageViewBuffer, PDFViewer };\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// Ensure that the viewer waits for the library to complete loading,\n// to avoid breaking e.g. the standalone viewer components (see issue 17228).\nif (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n !globalThis.pdfjsLib\n) {\n await globalThis.pdfjsLibPromise;\n}\n\nconst {\n AbortException,\n AnnotationEditorLayer,\n AnnotationEditorParamsType,\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationLayer,\n AnnotationMode,\n build,\n CMapCompressionType,\n ColorPicker,\n createValidAbsoluteUrl,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n MissingPDFException,\n noContextMenu,\n normalizeUnicode,\n OPS,\n Outliner,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n renderTextLayer,\n setLayerDimensions,\n shadow,\n UnexpectedResponseException,\n updateTextLayer,\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 build,\n CMapCompressionType,\n ColorPicker,\n createValidAbsoluteUrl,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n MissingPDFException,\n noContextMenu,\n normalizeUnicode,\n OPS,\n Outliner,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n renderTextLayer,\n setLayerDimensions,\n shadow,\n UnexpectedResponseException,\n updateTextLayer,\n Util,\n VerbosityLevel,\n version,\n XfaLayer,\n};\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 { 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: \"columnheader\",\n TBody: null,\n TFoot: null,\n // Standard structure type Caption\n Caption: null,\n // Standard structure type Figure\n Figure: \"figure\",\n // Standard structure type Formula\n Formula: null,\n // standard structure type Artifact\n Artifact: null,\n};\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\nclass StructTreeLayerBuilder {\n #treeDom = undefined;\n\n get renderingDone() {\n return this.#treeDom !== undefined;\n }\n\n render(structTree) {\n if (this.#treeDom !== undefined) {\n return this.#treeDom;\n }\n const treeDom = this.#walk(structTree);\n treeDom?.classList.add(\"structTree\");\n return (this.#treeDom = treeDom);\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 htmlElement.setAttribute(\"aria-label\", removeNullCharacters(alt));\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 #walk(node) {\n if (!node) {\n return null;\n }\n\n const element = document.createElement(\"span\");\n if (\"role\" in node) {\n const { role } = node;\n const match = role.match(HEADING_PATTERN);\n if (match) {\n element.setAttribute(\"role\", \"heading\");\n element.setAttribute(\"aria-level\", match[1]);\n } else if (PDF_ROLE_TO_HTML_ROLE[role]) {\n element.setAttribute(\"role\", PDF_ROLE_TO_HTML_ROLE[role]);\n }\n }\n\n this.#setAttributes(node, element);\n\n if (node.children) {\n if (node.children.length === 1 && \"id\" in node.children[0]) {\n // Often there is only one content node so just set the values on the\n // parent node to avoid creating an extra span.\n this.#setAttributes(node.children[0], element);\n } else {\n for (const kid of node.children) {\n element.append(this.#walk(kid));\n }\n }\n }\n return element;\n }\n}\n\nexport { StructTreeLayerBuilder };\n","/* Copyright 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 elementToCompare = contentElement || element;\n const index = binarySearchFirstItem(\n children,\n node =>\n TextAccessibilityManager.#compareElementPositions(\n elementToCompare,\n node\n ) < 0\n );\n\n if (index === 0) {\n children[0].before(element);\n } else {\n children[index - 1].after(element);\n }\n\n 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 /**\n * @param {TextHighlighterOptions} options\n */\n constructor({ findController, eventBus, pageIndex }) {\n this.findController = findController;\n this.matches = [];\n this.eventBus = eventBus;\n this.pageIdx = pageIndex;\n this._onUpdateTextLayerMatches = null;\n this.textDivs = null;\n this.textContentItemsStr = null;\n this.enabled = false;\n }\n\n /**\n * Store two arrays that will map DOM nodes to text they should contain.\n * The arrays should be of equal length and the array element at each index\n * should correspond to the other. e.g.\n * `items[0] = \"<span>Item 0</span>\" and texts[0] = \"Item 0\";\n *\n * @param {Array<Node>} divs\n * @param {Array<string>} texts\n */\n setTextMapping(divs, texts) {\n this.textDivs = divs;\n this.textContentItemsStr = texts;\n }\n\n /**\n * Start listening for events to update the highlighter and check if there are\n * any current matches that need be highlighted.\n */\n enable() {\n if (!this.textDivs || !this.textContentItemsStr) {\n throw new Error(\"Text divs and strings have not been set.\");\n }\n if (this.enabled) {\n throw new Error(\"TextHighlighter is already enabled.\");\n }\n this.enabled = true;\n if (!this._onUpdateTextLayerMatches) {\n this._onUpdateTextLayerMatches = evt => {\n if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n this._updateMatches();\n }\n };\n this.eventBus._on(\n \"updatetextlayermatches\",\n this._onUpdateTextLayerMatches\n );\n }\n this._updateMatches();\n }\n\n disable() {\n if (!this.enabled) {\n return;\n }\n this.enabled = false;\n if (this._onUpdateTextLayerMatches) {\n this.eventBus._off(\n \"updatetextlayermatches\",\n this._onUpdateTextLayerMatches\n );\n this._onUpdateTextLayerMatches = null;\n }\n 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 return className.includes(\"selected\") ? span.offsetLeft : 0;\n }\n div.append(node);\n return 0;\n }\n\n let i0 = selectedMatchIdx,\n i1 = i0 + 1;\n if (highlightAll) {\n i0 = 0;\n i1 = matches.length;\n } else if (!isSelectedPage) {\n // Not highlighting all and this isn't the selected page, so do nothing.\n return;\n }\n\n 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 selectedLeft = 0;\n\n // Match inside new div.\n if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {\n // If there was a previous div, then add the text at the end.\n if (prevEnd !== null) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n // Clear the divs and set the content until the starting point.\n beginText(begin);\n } else {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);\n }\n\n if (begin.divIdx === end.divIdx) {\n selectedLeft = appendTextToDiv(\n begin.divIdx,\n begin.offset,\n end.offset,\n \"highlight\" + highlightSuffix\n );\n } else {\n selectedLeft = appendTextToDiv(\n begin.divIdx,\n begin.offset,\n infinity.offset,\n \"highlight begin\" + highlightSuffix\n );\n for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {\n textDivs[n0].className = \"highlight middle\" + highlightSuffix;\n }\n beginText(end, \"highlight end\" + highlightSuffix);\n }\n prevEnd = end;\n\n if (isSelected) {\n // Attempt to scroll the selected match into view.\n findController.scrollMatchIntoView({\n element: textDivs[begin.divIdx],\n selectedLeft,\n pageIndex: pageIdx,\n matchIndex: selectedMatchIdx,\n });\n }\n }\n\n if (prevEnd) {\n appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);\n }\n }\n\n _updateMatches(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// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"../src/display/api\").TextContent} TextContent */\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, renderTextLayer, updateTextLayer } from \"pdfjs-lib\";\nimport { removeNullCharacters } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {TextHighlighter} highlighter - Optional object that will handle\n * highlighting text from the find controller.\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {function} [onAppend]\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 #enablePermissions = false;\n\n #onAppend = null;\n\n #rotation = 0;\n\n #scale = 0;\n\n #textContentSource = null;\n\n constructor({\n highlighter = null,\n accessibilityManager = null,\n enablePermissions = false,\n onAppend = null,\n }) {\n this.textContentItemsStr = [];\n this.renderingDone = false;\n this.textDivs = [];\n this.textDivProperties = new WeakMap();\n this.textLayerRenderTask = null;\n this.highlighter = highlighter;\n this.accessibilityManager = accessibilityManager;\n this.#enablePermissions = enablePermissions === true;\n this.#onAppend = onAppend;\n\n this.div = document.createElement(\"div\");\n this.div.tabIndex = 0;\n this.div.className = \"textLayer\";\n }\n\n #finishRendering() {\n this.renderingDone = true;\n\n const endOfContent = document.createElement(\"div\");\n endOfContent.className = \"endOfContent\";\n this.div.append(endOfContent);\n\n this.#bindMouse();\n }\n\n get numTextDivs() {\n return this.textDivs.length;\n }\n\n /**\n * Renders the text layer.\n * @param {PageViewport} viewport\n */\n async render(viewport) {\n if (!this.#textContentSource) {\n throw new Error('No \"textContentSource\" parameter specified.');\n }\n\n const scale = viewport.scale * (globalThis.devicePixelRatio || 1);\n const { rotation } = viewport;\n if (this.renderingDone) {\n const mustRotate = rotation !== this.#rotation;\n const mustRescale = scale !== this.#scale;\n if (mustRotate || mustRescale) {\n this.hide();\n updateTextLayer({\n container: this.div,\n viewport,\n textDivs: this.textDivs,\n textDivProperties: this.textDivProperties,\n mustRescale,\n mustRotate,\n });\n this.#scale = scale;\n this.#rotation = rotation;\n }\n this.show();\n return;\n }\n\n this.cancel();\n this.highlighter?.setTextMapping(this.textDivs, this.textContentItemsStr);\n this.accessibilityManager?.setTextMapping(this.textDivs);\n\n this.textLayerRenderTask = renderTextLayer({\n textContentSource: this.#textContentSource,\n container: this.div,\n viewport,\n textDivs: this.textDivs,\n textDivProperties: this.textDivProperties,\n textContentItemsStr: this.textContentItemsStr,\n });\n\n await this.textLayerRenderTask.promise;\n this.#finishRendering();\n this.#scale = scale;\n this.#rotation = rotation;\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 if (this.textLayerRenderTask) {\n this.textLayerRenderTask.cancel();\n this.textLayerRenderTask = null;\n }\n this.highlighter?.disable();\n this.accessibilityManager?.disable();\n this.textContentItemsStr.length = 0;\n this.textDivs.length = 0;\n this.textDivProperties = new WeakMap();\n }\n\n /**\n * @param {ReadableStream | TextContent} source\n */\n setTextContentSource(source) {\n this.cancel();\n this.#textContentSource = source;\n }\n\n /**\n * Improves text selection by adding an additional div where the mouse was\n * clicked. This reduces flickering of the content if the mouse is slowly\n * dragged up or down.\n */\n #bindMouse() {\n const { div } = this;\n\n div.addEventListener(\"mousedown\", evt => {\n const end = div.querySelector(\".endOfContent\");\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // On non-Firefox browsers, the selection will feel better if the height\n // of the `endOfContent` div is adjusted to start at mouse click\n // location. This avoids flickering when the selection moves up.\n // However it does not work when selection is started on empty space.\n let adjustTop = evt.target !== div;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n adjustTop &&=\n getComputedStyle(end).getPropertyValue(\"-moz-user-select\") !==\n \"none\";\n }\n if (adjustTop) {\n const divBounds = div.getBoundingClientRect();\n const r = Math.max(0, (evt.pageY - divBounds.top) / divBounds.height);\n end.style.top = (r * 100).toFixed(2) + \"%\";\n }\n }\n end.classList.add(\"active\");\n });\n\n div.addEventListener(\"mouseup\", () => {\n const end = div.querySelector(\".endOfContent\");\n if (!end) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n end.style.top = \"\";\n }\n end.classList.remove(\"active\");\n });\n\n div.addEventListener(\"copy\", 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 event.preventDefault();\n event.stopPropagation();\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\nconst DEFAULT_SCALE_VALUE = \"auto\";\nconst DEFAULT_SCALE = 1.0;\nconst DEFAULT_SCALE_DELTA = 1.1;\nconst MIN_SCALE = 0.1;\nconst MAX_SCALE = 10.0;\nconst UNKNOWN_SCALE = 0;\nconst MAX_AUTO_SCALE = 1.25;\nconst SCROLLBAR_PADDING = 40;\nconst VERTICAL_PADDING = 5;\n\nconst RenderingStates = {\n INITIAL: 0,\n RUNNING: 1,\n PAUSED: 2,\n FINISHED: 3,\n};\n\nconst PresentationModeState = {\n UNKNOWN: 0,\n NORMAL: 1,\n CHANGING: 2,\n FULLSCREEN: 3,\n};\n\nconst SidebarView = {\n UNKNOWN: -1,\n NONE: 0,\n THUMBS: 1, // Default value.\n OUTLINE: 2,\n ATTACHMENTS: 3,\n LAYERS: 4,\n};\n\nconst 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 * Scale factors for the canvas, necessary with HiDPI displays.\n */\nclass OutputScale {\n constructor() {\n const pixelRatio = window.devicePixelRatio || 1;\n\n /**\n * @type {number} Horizontal scale.\n */\n this.sx = pixelRatio;\n\n /**\n * @type {number} Vertical scale.\n */\n this.sy = pixelRatio;\n }\n\n /**\n * @type {boolean} Returns `true` when scaling is required, `false` otherwise.\n */\n get scaled() {\n return this.sx !== 1 || this.sy !== 1;\n }\n}\n\n/**\n * Scrolls specified element into view of its parent.\n * @param {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 * @param {boolean} [scrollMatches] - When scrolling search results into view,\n * ignore elements that either: Contains marked content identifiers,\n * or have the CSS-rule `overflow: hidden;` set. The default value is `false`.\n */\nfunction scrollIntoView(element, spot, scrollMatches = false) {\n // Assuming offsetParent is available (it's not available when viewer is in\n // hidden iframe or object). We have to scroll: if the offsetParent is not set\n // producing the error. See also animationStarted.\n let parent = element.offsetParent;\n if (!parent) {\n console.error(\"offsetParent is not set -- cannot scroll\");\n return;\n }\n let offsetY = element.offsetTop + element.clientTop;\n let offsetX = element.offsetLeft + element.clientLeft;\n while (\n (parent.clientHeight === parent.scrollHeight &&\n parent.clientWidth === parent.scrollWidth) ||\n (scrollMatches &&\n (parent.classList.contains(\"markedContent\") ||\n getComputedStyle(parent).overflow === \"hidden\"))\n ) {\n offsetY += parent.offsetTop;\n offsetX += parent.offsetLeft;\n\n parent = parent.offsetParent;\n if (!parent) {\n return; // no need to scroll\n }\n }\n if (spot) {\n if (spot.top !== undefined) {\n offsetY += spot.top;\n }\n if (spot.left !== undefined) {\n offsetX += spot.left;\n parent.scrollLeft = offsetX;\n }\n }\n parent.scrollTop = offsetY;\n}\n\n/**\n * Helper function to start monitoring the scroll event and converting them into\n * PDF.js friendly one: with scroll debounce and scroll direction.\n */\nfunction watchScroll(viewAreaElement, callback) {\n const debounceScroll = function (evt) {\n if (rAF) {\n return;\n }\n // schedule an invocation of scroll for next animation frame.\n rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {\n rAF = null;\n\n const currentX = viewAreaElement.scrollLeft;\n const lastX = state.lastX;\n if (currentX !== lastX) {\n state.right = currentX > lastX;\n }\n state.lastX = currentX;\n const currentY = viewAreaElement.scrollTop;\n const lastY = state.lastY;\n if (currentY !== lastY) {\n state.down = currentY > lastY;\n }\n state.lastY = currentY;\n callback(state);\n });\n };\n\n const state = {\n right: true,\n down: true,\n lastX: viewAreaElement.scrollLeft,\n lastY: viewAreaElement.scrollTop,\n _eventHandler: debounceScroll,\n };\n\n let rAF = null;\n viewAreaElement.addEventListener(\"scroll\", debounceScroll, true);\n return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value&param2=...).\n * @param {string} 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 */\nfunction approximateFraction(x) {\n // Fast paths for int numbers or their inversions.\n if (Math.floor(x) === x) {\n return [x, 1];\n }\n const xinv = 1 / x;\n const limit = 8;\n if (xinv > limit) {\n return [1, limit];\n } else if (Math.floor(xinv) === xinv) {\n return [1, xinv];\n }\n\n const x_ = x > 1 ? xinv : x;\n // a/b and c/d are neighbours in Farey sequence.\n let a = 0,\n b = 1,\n c = 1,\n d = 1;\n // Limiting search to order 8.\n while (true) {\n // Generating next term in sequence (order of q).\n const p = a + c,\n q = b + d;\n if (q > limit) {\n break;\n }\n if (x_ <= p / q) {\n c = p;\n d = q;\n } else {\n a = p;\n b = q;\n }\n }\n let result;\n // Select closest of the neighbours to x.\n if (x_ - a / b < c / d - x_) {\n result = x_ === x ? [a, b] : [b, a];\n } else {\n result = x_ === x ? [c, d] : [d, c];\n }\n return result;\n}\n\nfunction roundToDivide(x, div) {\n const r = x % div;\n return r === 0 ? x : Math.round(x - r + div);\n}\n\n/**\n * @typedef {Object} GetPageSizeInchesParameters\n * @property {number[]} view\n * @property {number} userUnit\n * @property {number} rotate\n */\n\n/**\n * @typedef {Object} PageSize\n * @property {number} width - In inches.\n * @property {number} height - In inches.\n */\n\n/**\n * Gets the size of the specified page, converted from PDF units to inches.\n * @param {GetPageSizeInchesParameters} params\n * @returns {PageSize}\n */\nfunction getPageSizeInches({ view, userUnit, rotate }) {\n const [x1, y1, x2, y2] = view;\n // We need to take the page rotation into account as well.\n const changeOrientation = rotate % 180 !== 0;\n\n const width = ((x2 - x1) / 72) * userUnit;\n const height = ((y2 - y1) / 72) * userUnit;\n\n return {\n width: changeOrientation ? height : width,\n height: changeOrientation ? width : height,\n };\n}\n\n/**\n * Helper function for getVisibleElements.\n *\n * @param {number} index - initial guess at the first visible element\n * @param {Array} views - array of pages, into which `index` is an index\n * @param {number} top - the top of the scroll pane\n * @returns {number} less than or equal to `index` that is definitely at or\n * before the first visible element in `views`, but not by too much. (Usually,\n * this will be the first element in the first partially visible row in\n * `views`, although sometimes it goes back one row further.)\n */\nfunction backtrackBeforeAllVisibleElements(index, views, top) {\n // binarySearchFirstItem's assumption is that the input is ordered, with only\n // one index where the conditions flips from false to true: [false ...,\n // true...]. With vertical scrolling and spreads, it is possible to have\n // [false ..., true, false, true ...]. With wrapped scrolling we can have a\n // similar sequence, with many more mixed true and false in the middle.\n //\n // So there is no guarantee that the binary search yields the index of the\n // first visible element. It could have been any of the other visible elements\n // that were preceded by a hidden element.\n\n // Of course, if either this element or the previous (hidden) element is also\n // the first element, there's nothing to worry about.\n if (index < 2) {\n return index;\n }\n\n // That aside, the possible cases are represented below.\n //\n // **** = fully hidden\n // A*B* = mix of partially visible and/or hidden pages\n // CDEF = fully visible\n //\n // (1) Binary search could have returned A, in which case we can stop.\n // (2) Binary search could also have returned B, in which case we need to\n // check the whole row.\n // (3) Binary search could also have returned C, in which case we need to\n // check the whole previous row.\n //\n // There's one other possibility:\n //\n // **** = fully hidden\n // ABCD = mix of fully and/or partially visible pages\n //\n // (4) Binary search could only have returned A.\n\n // Initially assume that we need to find the beginning of the current row\n // (case 1, 2, or 4), which means finding a page that is above the current\n // page's top. If the found page is partially visible, we're definitely not in\n // case 3, and this assumption is correct.\n let elt = views[index].div;\n let pageTop = elt.offsetTop + elt.clientTop;\n\n if (pageTop >= top) {\n // The found page is fully visible, so we're actually either in case 3 or 4,\n // and unfortunately we can't tell the difference between them without\n // scanning the entire previous row, so we just conservatively assume that\n // we do need to backtrack to that row. In both cases, the previous page is\n // in the previous row, so use its top instead.\n elt = views[index - 1].div;\n pageTop = elt.offsetTop + elt.clientTop;\n }\n\n // Now we backtrack to the first page that still has its bottom below\n // `pageTop`, which is the top of a page in the first visible row (unless\n // we're in case 4, in which case it's the row before that).\n // `index` is found by binary search, so the page at `index - 1` is\n // invisible and we can start looking for potentially visible pages from\n // `index - 2`. (However, if this loop terminates on its first iteration,\n // which is the case when pages are stacked vertically, `index` should remain\n // unchanged, so we use a distinct loop variable.)\n for (let i = index - 2; i >= 0; --i) {\n elt = views[i].div;\n if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {\n // We have reached the previous row, so stop now.\n // This loop is expected to terminate relatively quickly because the\n // number of pages per row is expected to be small.\n break;\n }\n index = i;\n }\n return index;\n}\n\n/**\n * @typedef {Object} GetVisibleElementsParameters\n * @property {HTMLElement} scrollEl - A container that can possibly scroll.\n * @property {Array} views - Objects with a `div` property that contains an\n * HTMLElement, which should all be descendants of `scrollEl` satisfying the\n * relevant layout assumptions.\n * @property {boolean} sortByVisibility - If `true`, the returned elements are\n * sorted in descending order of the percent of their padding box that is\n * visible. The default value is `false`.\n * @property {boolean} horizontal - If `true`, the elements are assumed to be\n * laid out horizontally instead of vertically. The default value is `false`.\n * @property {boolean} rtl - If `true`, the `scrollEl` container is assumed to\n * be in right-to-left mode. The default value is `false`.\n */\n\n/**\n * Generic helper to find out what elements are visible within a scroll pane.\n *\n * Well, pretty generic. There are some assumptions placed on the elements\n * referenced by `views`:\n * - If `horizontal`, no left of any earlier element is to the right of the\n * left of any later element.\n * - Otherwise, `views` can be split into contiguous rows where, within a row,\n * no top of any element is below the bottom of any other element, and\n * between rows, no bottom of any element in an earlier row is below the\n * top of any element in a later row.\n *\n * (Here, top, left, etc. all refer to the padding edge of the element in\n * question. For pages, that ends up being equivalent to the bounding box of the\n * rendering canvas. Earlier and later refer to index in `views`, not page\n * layout.)\n *\n * @param {GetVisibleElementsParameters} 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 hiddenHeight =\n Math.max(0, top - currentHeight) + Math.max(0, viewBottom - bottom);\n const hiddenWidth =\n Math.max(0, left - currentWidth) + Math.max(0, viewRight - right);\n\n const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,\n fractionWidth = (viewWidth - hiddenWidth) / viewWidth;\n const percent = (fractionHeight * fractionWidth * 100) | 0;\n\n visible.push({\n id: view.id,\n x: currentWidth,\n y: currentHeight,\n view,\n percent,\n widthPercent: (fractionWidth * 100) | 0,\n });\n ids.add(view.id);\n }\n\n const first = visible[0],\n last = visible.at(-1);\n\n if (sortByVisibility) {\n visible.sort(function (a, b) {\n const pc = a.percent - b.percent;\n if (Math.abs(pc) > 0.001) {\n return -pc;\n }\n return a.id - b.id; // ensure stability\n });\n }\n return { first, last, views: visible, ids };\n}\n\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\nfunction clamp(v, min, max) {\n return Math.min(Math.max(v, min), max);\n}\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 = clamp(val, 0, 100);\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 (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 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\nexport {\n animationStarted,\n apiPageLayoutToViewerModes,\n apiPageModeToSidebarView,\n approximateFraction,\n AutoPrintRegExp,\n backtrackBeforeAllVisibleElements, // only exported for testing\n binarySearchFirstItem,\n CursorTool,\n DEFAULT_SCALE,\n DEFAULT_SCALE_DELTA,\n DEFAULT_SCALE_VALUE,\n docStyle,\n getActiveOrFocusedElement,\n getPageSizeInches,\n getVisibleElements,\n isPortraitOrientation,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n MAX_AUTO_SCALE,\n MAX_SCALE,\n MIN_SCALE,\n normalizeWheelEventDelta,\n normalizeWheelEventDirection,\n OutputScale,\n parseQueryString,\n PresentationModeState,\n ProgressBar,\n removeNullCharacters,\n RenderingStates,\n roundToDivide,\n SCROLLBAR_PADDING,\n scrollIntoView,\n ScrollMode,\n SidebarView,\n SpreadMode,\n TextLayerMode,\n toggleCheckedBtn,\n toggleExpandedBtn,\n UNKNOWN_SCALE,\n VERTICAL_PADDING,\n watchScroll,\n};\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(\"./interfaces\").IPDFLinkService} IPDFLinkService */\n\nimport { XfaLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} XfaLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {IPDFLinkService} linkService\n * @property {Object} [xfaHtml]\n */\n\nclass XfaLayerBuilder {\n /**\n * @param {XfaLayerBuilderOptions} options\n */\n constructor({\n 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 {PageViewport} viewport\n * @param {string} intent (default value is 'display')\n * @returns {Promise<Object | void>} A promise that is resolved when rendering\n * of the XFA layer is complete. The first rendering will return an object\n * with a `textDivs` property that can be used with the TextHighlighter.\n */\n 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","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","var webpackQueues = typeof Symbol === \"function\" ? Symbol(\"webpack queues\") : \"__webpack_queues__\";\nvar webpackExports = typeof Symbol === \"function\" ? Symbol(\"webpack exports\") : \"__webpack_exports__\";\nvar webpackError = typeof Symbol === \"function\" ? Symbol(\"webpack error\") : \"__webpack_error__\";\nvar resolveQueue = (queue) => {\n\tif(queue && queue.d < 1) {\n\t\tqueue.d = 1;\n\t\tqueue.forEach((fn) => (fn.r--));\n\t\tqueue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));\n\t}\n}\nvar wrapDeps = (deps) => (deps.map((dep) => {\n\tif(dep !== null && typeof dep === \"object\") {\n\t\tif(dep[webpackQueues]) return dep;\n\t\tif(dep.then) {\n\t\t\tvar queue = [];\n\t\t\tqueue.d = 0;\n\t\t\tdep.then((r) => {\n\t\t\t\tobj[webpackExports] = r;\n\t\t\t\tresolveQueue(queue);\n\t\t\t}, (e) => {\n\t\t\t\tobj[webpackError] = e;\n\t\t\t\tresolveQueue(queue);\n\t\t\t});\n\t\t\tvar obj = {};\n\t\t\tobj[webpackQueues] = (fn) => (fn(queue));\n\t\t\treturn obj;\n\t\t}\n\t}\n\tvar ret = {};\n\tret[webpackQueues] = x => {};\n\tret[webpackExports] = dep;\n\treturn ret;\n}));\n__webpack_require__.a = (module, body, hasAwait) => {\n\tvar queue;\n\thasAwait && ((queue = []).d = -1);\n\tvar depQueues = new Set();\n\tvar exports = module.exports;\n\tvar currentDeps;\n\tvar outerResolve;\n\tvar reject;\n\tvar promise = new Promise((resolve, rej) => {\n\t\treject = rej;\n\t\touterResolve = resolve;\n\t});\n\tpromise[webpackExports] = exports;\n\tpromise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise[\"catch\"](x => {}));\n\tmodule.exports = promise;\n\tbody((deps) => {\n\t\tcurrentDeps = wrapDeps(deps);\n\t\tvar fn;\n\t\tvar getResult = () => (currentDeps.map((d) => {\n\t\t\tif(d[webpackError]) throw d[webpackError];\n\t\t\treturn d[webpackExports];\n\t\t}))\n\t\tvar promise = new Promise((resolve) => {\n\t\t\tfn = () => (resolve(getResult));\n\t\t\tfn.r = 0;\n\t\t\tvar fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));\n\t\t\tcurrentDeps.map((dep) => (dep[webpackQueues](fnQueue)));\n\t\t});\n\t\treturn fn.r ? promise : getResult();\n\t}, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));\n\tqueue && queue.d < 0 && (queue.d = 0);\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))","","// startup\n// Load entry module and return exports\n// This entry module used 'module' so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(624);\n",""],"names":["FluentType","constructor","value","valueOf","FluentNone","toString","scope","FluentNumber","opts","nf","memoizeIntlObject","Intl","NumberFormat","format","err","reportError","FluentDateTime","dtf","DateTimeFormat","Date","toISOString","MAX_PLACEABLES","FSI","PDI","match","selector","key","category","PluralRules","select","getDefault","variants","star","resolvePattern","RangeError","getArguments","args","positional","named","Object","create","arg","type","name","resolveExpression","push","expr","minimumFractionDigits","precision","resolveVariableReference","resolveMessageReference","resolveTermReference","resolveFunctionReference","resolveSelectExpression","params","prototype","hasOwnProperty","call","ReferenceError","getTime","TypeError","attr","message","bundle","_messages","get","attribute","attributes","id","term","_terms","resolved","func","_functions","sel","variant","resolveComplexPattern","ptn","dirty","has","add","result","useIsolating","_useIsolating","length","elem","_transform","placeables","delete","join","Scope","errors","WeakSet","error","Error","ctor","cache","_intls","set","JSON","stringify","locales","values","allowed","unwrapped","opt","entries","includes","NUMBER_ALLOWED","NUMBER","DATETIME_ALLOWED","DATETIME","Map","getMemoizerForLocale","stringLocale","Array","isArray","memoizer","undefined","FluentBundle","functions","transform","v","hasMessage","getMessage","addResource","res","allowOverrides","i","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","source","lastIndex","cursor","next","exec","parseMessage","SyntaxError","test","re","consumeChar","char","errorClass","consumeToken","match1","parsePattern","parseAttributes","keys","attrs","first","parsePatternElements","Infinity","indent","parseIndent","trim","elements","commonIndent","parsePlaceable","Math","min","lastElement","baked","element","Indent","slice","parseInlineExpression","parseVariants","sigil","parseArguments","parseLiteral","parseArgument","count","parseVariantKey","parseNumberLiteral","parseStringLiteral","fraction","parseFloat","parseEscapeSequence","codepoint4","codepoint6","codepoint","parseInt","String","fromCodePoint","start","makeIndent","text","replace","blank","reOverlay","TEXT_LEVEL_ELEMENTS","LOCALIZABLE_ATTRIBUTES","global","a","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","console","warn","createTextNodeFromTextContent","appendChild","fromElement","explicitlyAllowed","getAttribute","split","map","from","isAttrNameLocalizable","removeAttribute","setAttribute","sourceElement","translatedChild","childName","sourceChild","querySelector","removeChild","clone","cloneNode","shallowPopulateUsing","createElement","createTextNode","attrName","toLowerCase","elemName","CachedIterable","iterable","CachedSyncIterable","Symbol","iterator","cached","cur","touchNext","idx","last","done","CachedAsyncIterable","asyncIterator","default","Localization","resourceIds","generateBundles","onChange","addResourceIds","eager","removeResourceIds","filter","r","formatWithFallback","method","translations","hasAtLeastOneBundle","bundles","missingIds","keysFromBundle","size","locale","ids","formatMessages","messageFromBundle","formatValues","valueFromBundle","formatValue","val","handleEvent","formatted","attrNames","messageErrors","Set","forEach","L10NID_ATTR_NAME","L10NARGS_ATTR_NAME","L10N_ELEMENT_QUERY","DOMLocalization","roots","pendingrAF","pendingElements","windowElement","mutationObserver","observerConfig","characterData","childList","subtree","attributeFilter","translateRoots","setAttributes","getAttributes","parse","connectRoot","newRoot","root","contains","defaultView","MutationObserver","mutations","translateMutations","observe","disconnectRoot","pauseObserving","clear","resumeObserving","Promise","all","translateFragment","takeRecords","disconnect","mutation","target","addedNode","addedNodes","ELEMENT_NODE","childElementCount","getTranslatables","requestAnimationFrame","translateElements","frag","getKeysForElement","applyTranslations","nodes","querySelectorAll","AnnotationEditorLayer","GenericL10n","AnnotationEditorLayerBuilder","annotationLayer","drawLayer","onAppend","textLayer","uiManager","options","pdfPage","accessibilityManager","l10n","annotationEditorLayer","div","_cancelled","render","viewport","intent","clonedViewport","dontFlip","update","show","document","className","hidden","dir","direction","pageIndex","pageNumber","parameters","annotations","cancel","destroy","hide","isInvisible","AnnotationLayer","PresentationModeState","AnnotationLayerBuilder","onPresentationModeChanged","linkService","downloadManager","annotationStorage","imageResourcesPath","renderForms","enableScripting","hasJSActionsPromise","fieldObjectsPromise","annotationCanvasMap","_hasJSActionsPromise","resolve","_fieldObjectsPromise","_annotationCanvasMap","_accessibilityManager","_eventBus","eventBus","hasJSActions","fieldObjects","getAnnotations","page","isInPresentationMode","updatePresentationModeState","FULLSCREEN","evt","state","_on","_off","#updatePresentationModeState","disableFormElements","NORMAL","section","inert","compatibilityParams","userAgent","navigator","platform","maxTouchPoints","isAndroid","isIOS","checkCanvasSizeLimitation","maxCanvasPixels","OptionKind","BROWSER","VIEWER","API","WORKER","PREFERENCE","defaultOptions","canvasMaxAreaInBytes","kind","isInAutomation","supportsCaretBrowsingMode","supportsDocumentFonts","supportsIntegratedFind","supportsMouseWheelZoomCtrlKey","supportsMouseWheelZoomMetaKey","supportsPinchToZoom","annotationEditorMode","annotationMode","cursorToolOnLoad","debuggerSrc","defaultZoomDelay","defaultZoomValue","disableHistory","disablePageLabels","enableHighlightEditor","enableHighlightFloatingButton","enableML","enablePermissions","enablePrintAutoRotate","enableStampEditor","externalLinkRel","externalLinkTarget","highlightEditorColors","historyUpdateUrl","ignoreDestinationZoom","forcePageColors","pageColorsBackground","pageColorsForeground","pdfBugEnabled","printResolution","sidebarViewOnLoad","scrollModeOnLoad","spreadModeOnLoad","textLayerMode","viewOnLoad","cMapPacked","cMapUrl","disableAutoFetch","disableFontFace","disableRange","disableStream","docBaseUrl","enableXfa","fontExtraProperties","isEvalSupported","isOffscreenCanvasSupported","maxImageSize","pdfBug","standardFontDataUrl","verbosity","workerPort","workerSrc","defaultUrl","sandboxBundleSrc","viewerCssTheme","disablePreferences","language","userOptions","AppOptions","getAll","defaultOnly","defaultOption","setAll","init","remove","createValidAbsoluteUrl","isPdfFile","download","blobUrl","filename","click","href","documentElement","append","DownloadManager","openBlobUrls","WeakMap","downloadUrl","url","_options","downloadData","data","contentType","URL","createObjectURL","Blob","openOrDownloadData","dest","isPdfData","blob","DrawLayer","DrawLayerBuilder","setParent","parent","getDrawLayer","WaitOnType","EVENT","TIMEOUT","waitOnEventOrTimeout","delay","Number","isInteger","promise","withResolvers","handler","EventBus","eventHandler","removeEventListener","timeout","clearTimeout","bind","addEventListener","timeoutHandler","setTimeout","listeners","on","eventName","listener","external","once","off","dispatch","eventListeners","externalListeners","ii","splice","AutomationEventBus","getPdfFilenameFromUrl","docProperties","pdfDocument","baseUrl","info","metadata","contentDispositionFilename","contentLength","getMetadata","getDownloadInfo","baseURL","filesize","getRaw","authors","numPages","GenericScripting","_ready","reject","sandbox","then","pdfjsSandbox","QuickJSSandbox","catch","createSandbox","dispatchEventInSandbox","event","dispatchEvent","destroySandbox","nukeSandbox","fetchData","L10n","createBundle","lang","resource","generateBundlesFallback","getLanguage","_setL10n","#generateBundles","defaultLang","baseLang","paths","getPaths","langs","shortLang","createBundleFallback","#createBundle","path","#getPaths","#generateBundlesFallback","#createBundleFallback","isRTL","fixupLangCode","getDirection","fallback","messages","translate","pause","resume","#fixupLangCode","langCode","PARTIAL_LANG_CODES","en","es","fy","ga","gu","hi","hy","nb","ne","nn","pa","pt","sv","zh","#isRTL","shortCode","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","binarySearchFirstItem","scrollIntoView","FindState","FOUND","NOT_FOUND","WRAPPED","PENDING","FIND_TIMEOUT","MATCH_SCROLL_OFFSET_TOP","MATCH_SCROLL_OFFSET_LEFT","CHARACTERS_TO_NORMALIZE","DIACRITICS_EXCEPTION","DIACRITICS_EXCEPTION_STR","DIACRITICS_REG_EXP","SPECIAL_CHARS_REG_EXP","NOT_DIACRITIC_FROM_END_REG_EXP","NOT_DIACRITIC_FROM_START_REG_EXP","SYLLABLES_REG_EXP","SYLLABLES_LENGTHS","FIRST_CHAR_SYLLABLES_REG_EXP","NFKC_CHARS_TO_NORMALIZE","noSyllablesRegExp","withSyllablesRegExp","normalize","syllablePositions","m","index","len","normalizationRegex","toNormalizeWithNFKC","CJK","HKDiacritics","regexp","RegExp","rawDiacriticsPositions","normalized","positions","rawDiacriticsIndex","syllableIndex","shift","shiftOrigin","eol","hasDiacritics","p1","p2","p3","p4","p5","p6","p7","p8","replacement","jj","j","charAt","hasTrailingDashEOL","endsWith","newCharLen","getOriginalIndex","diffs","pos","end","x","oldStart","oldEnd","oldLen","PDFFindController","updateMatchesCountOnProgress","visitedPagesCount","_linkService","onIsPageVisible","reset","onFind","onFindBarClose","highlightMatches","_highlightMatches","pageMatches","_pageMatches","pageMatchesLength","_pageMatchesLength","selected","_selected","setDocument","_pdfDocument","_firstPageCapability","#onFind","shouldDirtyMatch","_dirtyMatch","updateUIState","extractText","findbarClosed","pendingTimeout","_findTimeout","nextMatch","highlightAll","updateAllPages","scrollMatchIntoView","selectedLeft","matchIndex","_scrollMatches","matchIdx","pageIdx","spot","top","left","#reset","_offset","wrapped","_extractTextPromises","_pageContents","_pageDiffs","_hasDiacritics","_matchesCountTotal","_pagesToSearch","_pendingFindMatches","_resumePageIdx","query","#query","_rawQuery","_normalizedQuery","q","#shouldDirtyMatch","newQuery","prevQuery","newType","prevType","pagesCount","isEntireWord","#isEntireWord","startIdx","charCodeAt","limit","calculateRegExpMatch","#calculateRegExpMatch","entireWord","pageContent","matches","matchesLength","matchPos","matchLen","convertToRegExpString","#convertToRegExpString","matchDiacritics","isUnicode","replaceAll","trailingSpaces","fromCharCode","calculateMatch","#calculateMatch","caseSensitive","sort","reverse","isUnicodePart","queryPart","flags","updatePage","nextPageMatch","pageMatchesCount","updateUIResultsCount","#extractText","deferred","textOptions","disableNormalization","getPage","getTextContent","strBuf","textItem","items","str","hasEOL","reason","#updatePage","#updateAllPages","#nextMatch","previous","findPrevious","currentPageIndex","offset","numPageMatches","updateMatch","advanceOffsetPage","matchesReady","#matchesReady","numMatches","#nextPageMatch","#advanceOffsetPage","#updateMatch","found","previousPage","#onFindBarClose","requestMatchesCount","#requestMatchesCount","current","total","#updateUIResultsCount","matchesCount","#updateUIState","rawQuery","isValidRotation","parseQueryString","HASH_CHANGE_TIMEOUT","POSITION_UPDATED_THRESHOLD","UPDATE_VIEWAREA_TIMEOUT","getCurrentHash","location","hash","PDFHistory","_initialized","_fingerprint","_boundEvents","_isPagesLoaded","initialize","fingerprint","resetHistory","updateUrl","reInitialized","_updateUrl","_bindEvents","window","history","_popStateInProgress","_blockHashChange","_currentHash","_numPositionUpdates","_uid","_maxUid","_destination","_position","_isValidState","rotation","_parseCurrentHash","_pushOrReplaceState","destination","_updateInternalState","uid","_initialRotation","_initialBookmark","_pageHide","_unbindEvents","_updateViewareaTimeout","namedDest","explicitDest","_isValidPage","forceReplace","isDestHashesEqual","isDestArraysEqual","pushPage","pushCurrentPosition","_tryPushCurrentPosition","back","forward","popStateInProgress","initialBookmark","initialRotation","shouldReplace","newState","newUrl","replaceState","pushState","temporary","position","assign","checkReload","perfEntry","performance","getEntriesByType","removeTemporary","max","checkNameddest","unescape","substring","nameddest","_updateViewarea","pdfOpenParams","_popState","newHash","hashChanged","goToDestination","setHash","updateViewarea","popState","pageHide","destHash","pushHash","firstDest","secondDest","isEntryEqual","second","isNaN","DEFAULT_LINK_REL","LinkTarget","NONE","SELF","BLANK","PARENT","TOP","addLinkAttributes","link","rel","enabled","title","onclick","targetStr","PDFLinkService","pagesRefCache","externalLinkEnabled","_ignoreDestinationZoom","pdfViewer","pdfHistory","setViewer","setHistory","currentPageNumber","pagesRotation","goToDestinationHelper","#goToDestinationHelper","rawDest","destRef","_cachedPageNumber","getPageIndex","cachePageRef","scrollPageIntoView","destArray","getDestination","goToPage","pageLabelToPageNumber","newWindow","getDestinationHash","getAnchorUrl","escape","anchor","phrase","zoomArgs","zoomArg","zoomArgNumber","allowNegativeOffset","mode","isValidExplicitDestination","executeNamedAction","action","nextPage","executeSetOCGState","optionalContentConfig","optionalContentConfigPromise","setOCGState","pageNum","pageRef","refStr","gen","num","#isValidExplicitDestination","destLength","zoom","allowNull","param","SimpleLinkService","AbortException","AnnotationMode","PixelsPerInch","RenderingCancelledException","setLayerDimensions","shadow","approximateFraction","DEFAULT_SCALE","OutputScale","RenderingStates","roundToDivide","TextLayerMode","StructTreeLayerBuilder","TextAccessibilityManager","TextHighlighter","TextLayerBuilder","XfaLayerBuilder","DEFAULT_LAYER_PROPERTIES","annotationEditorUIManager","findController","LAYERS_ORDER","PDFPageView","ENABLE_FORMS","hasRestrictedScaling","layerProperties","loadingId","previousRotation","renderError","renderingState","INITIAL","ENABLE","useThumbnailCanvas","directDrawing","initialOptionalContent","regularAnnotations","viewportMap","layers","container","defaultViewport","renderingId","pageLabel","scale","pdfPageRotate","_optionalContentConfigPromise","pageColors","renderingQueue","renderTask","_isStandalone","hasViewer","_container","zoomLayer","xfaLayer","structTreeLayer","setDimensions","style","setProperty","PDF_TO_CSS_UNITS","hasInitialVisibility","addLayer","#addLayer","oldDiv","replaceWith","layer","after","prepend","PAUSED","classList","RUNNING","FINISHED","#setDimensions","setPdfPage","foreground","background","filterFactory","addHighlightHCMFilter","rotate","totalRotation","getViewport","cleanup","_textHighlighter","renderAnnotationLayer","#renderAnnotationLayer","ex","renderAnnotationEditorLayer","#renderAnnotationEditorLayer","renderDrawLayer","#renderDrawLayer","renderXfaLayer","#renderXfaLayer","textDivs","buildXfaTextContentItems","renderTextLayer","#renderTextLayer","renderingDone","readableStream","streamTextContent","includeMarkedContent","setTextContentSource","numTextDivs","renderStructTreeLayer","#renderStructTreeLayer","tree","getStructTree","treeDom","canvas","#buildXfaTextContentItems","item","setTextMapping","enable","_resetZoomLayer","removeFromDOM","zoomLayerCanvas","firstChild","width","height","keepZoomLayer","keepAnnotationLayer","keepAnnotationEditorLayer","keepXfaLayer","keepTextLayer","cancelRendering","zoomLayerNode","annotationLayerNode","annotationEditorLayerNode","xfaLayerNode","textLayerNode","node","layerIndex","indexOf","drawingDelay","onlyCssZoom","sx","sy","outputScale","floor","postponeDrawing","cancelExtraDelay","cssTransform","redrawAnnotationLayer","redrawAnnotationEditorLayer","redrawXfaLayer","redrawTextLayer","hideTextLayer","timestamp","now","parentNode","disable","originalViewport","relativeRotation","absRotation","abs","scaleX","scaleY","getPagePoint","y","convertToPdfPoint","finishRenderTask","#finishRenderTask","separateAnnots","draw","canvasWrapper","DISABLE","isPureXfa","highlighter","ENABLE_PERMISSIONS","textLayerDiv","annotationLayerDiv","renderContinueCallback","cont","showCanvas","isHighestPriority","hasHCM","isLastShow","ctx","getContext","alpha","invScale","pixelsInViewport","maxScale","sqrt","sfx","sfy","scaled","renderContext","canvasContext","onContinue","resultPromise","annotationEditorLayerDiv","setPageLabel","thumbnailCanvas","CLEANUP_TIMEOUT","PDFRenderingQueue","pdfThumbnailViewer","onIdle","highestPriorityPage","idleTimeout","printing","isThumbnailViewEnabled","defineProperty","setThumbnailViewer","view","renderHighestPriority","currentlyVisiblePages","forceRendering","getHighestPriority","visible","views","scrolledDown","preRenderExtra","visibleViews","numVisible","isViewFinished","firstId","lastId","visibleIds","holeId","holeView","preRenderIndex","preRenderView","renderView","finally","PDFScriptingManager","PDFScriptingManagerComponents","externalServices","detail","createScripting","apiPageLayoutToViewerModes","closeCapability","destroyCapability","ready","scripting","willPrintCapability","destroyScripting","objects","calculationOrder","docActions","getFieldObjects","getCalculationOrderIds","getJSActions","initScripting","_internalEvents","updateFromSandbox","dispatchPageClose","dispatchPageOpen","_pageOpenPending","appInfo","docInfo","actions","dispatchWillSave","dispatchDidSave","dispatchWillPrint","dispatchDidPrint","destroyPromise","_visitedPages","#updateFromSandbox","isChangingPresentationMode","siblings","command","modes","spreadMode","pagesPromise","log","currentScaleValue","increaseScale","decreaseScale","focus","elementId","CustomEvent","setValue","#dispatchPageOpen","visitedPages","pageView","getPageView","actionsPromise","#dispatchPageClose","#initScripting","#destroyScripting","race","ScrollMode","SpreadMode","PDFViewer","PDFSinglePageViewer","_resetView","_scrollMode","PAGE","_spreadMode","scrollMode","_updateScrollMode","_updateSpreadMode","ProgressBar","pdfjsVersion","pdfjsBuild","AnnotationEditorType","AnnotationEditorUIManager","PermissionFlag","version","DEFAULT_SCALE_DELTA","DEFAULT_SCALE_VALUE","docStyle","getVisibleElements","isPortraitOrientation","isValidScrollMode","isValidSpreadMode","MAX_AUTO_SCALE","MAX_SCALE","MIN_SCALE","removeNullCharacters","SCROLLBAR_PADDING","UNKNOWN_SCALE","VERTICAL_PADDING","watchScroll","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","buffer","altTextManager","annotationEditorHighlightColors","containerTopLeft","copyCallbackBound","mlManager","getAllTextInProgress","hiddenCopyElement","interruptCopyCondition","previousContainerHeight","resizeObserver","ResizeObserver","resizeObserverCallback","scrollModePageState","onVisibilityChange","scaleTimeoutId","viewerVersion","viewer","firstElementChild","tagName","offsetParent","getComputedStyle","_getVisiblePages","_scriptingManager","scriptingManager","removePageBorders","defaultRenderingQueue","scroll","_scrollUpdate","presentationModeState","UNKNOWN","_onBeforeDraw","_onAfterDraw","updateContainerHeightCss","_pages","getCachedPageViews","pageViewsReady","every","_currentPageNumber","_setCurrentPageNumber","resetCurrentPageView","_pageLabels","currentPageLabel","currentScale","_currentScale","setScale","noScroll","_currentScaleValue","_pagesRotation","refresh","firstPagePromise","onePageRendered","_onePageRenderedCapability","_pagesCapability","_layerProperties","self","initializePermissions","#initializePermissions","permissions","COPY","MODIFY_CONTENTS","MODIFY_ANNOTATIONS","FILL_INTERACTIVE_FORMS","onePageRenderedOrForceFetch","#onePageRenderedOrForceFetch","visibilityState","visibilityChangePromise","getAllText","texts","copyCallback","#copyCallback","selection","getSelection","focusNode","anchorNode","containsNode","preventDefault","stopPropagation","savedCursor","interruptCopy","ev","clipboard","writeText","_cancelRendering","getOptionalContentConfig","permissionsPromise","getPermissions","firstPdfPage","before","updateMode","viewerElement","firstPageView","ref","ensurePageViewVisible","loadingParams","getPagesLeft","Language","setPageLabels","labels","_location","VERTICAL","_previousScrollMode","previousPageNumber","scrollDown","pages","#ensurePageViewVisible","pageIndexSet","parity","spread","dummyPage","#scrollIntoView","pageSpot","offsetLeft","clientLeft","right","clientWidth","scrollLeft","HORIZONTAL","isSameScale","#isSameScale","newScale","setScaleUpdatePages","#setScaleUpdatePages","newValue","preset","presetValue","pageWidthScaleFactor","#pageWidthScaleFactor","#setScale","currentPage","hPadding","vPadding","pageWidthScale","pageHeightScale","clientHeight","horizontalScale","#resetCurrentPageView","widthScale","heightScale","changeOrientation","pageWidth","pageHeight","boundingRect","convertToViewportPoint","_updateLocation","firstPage","normalizedScaleValue","round","currentPageView","topLeft","scrollTop","intLeft","intTop","visiblePages","numVisiblePages","newCacheSize","isSimpleLayout","currentId","stillFullyVisible","percent","containsElement","_isContainerRtl","CHANGING","isHorizontalScrollbarEnabled","scrollWidth","isVerticalScrollbarEnabled","scrollHeight","horizontal","rtl","scrollEl","sortByVisibility","ensurePdfPageLoaded","#ensurePdfPageLoaded","getScrollAhead","#getScrollAhead","down","scrollAhead","hasEqualPageSizes","getPagesOverview","initialOrientation","orientation","toggle","_getPageAdvance","pageLayout","widthPercent","yArray","currentIndex","expectedId","advance","scaleFactor","steps","ceil","toFixed","#updateContainerHeightCss","#resizeObserverCallback","borderBoxSize","blockSize","offsetTop","editId","isFromKeyboard","annotationEditorParams","updateParams","noUpdate","updateArgs","globalThis","pdfjsLib","pdfjsLibPromise","AnnotationEditorParamsType","build","CMapCompressionType","ColorPicker","DOMSVGFactory","FeatureTest","getDocument","getFilenameFromUrl","getXfaPageViewport","GlobalWorkerOptions","ImageKind","InvalidPDFException","isDataScheme","MissingPDFException","noContextMenu","normalizeUnicode","OPS","Outliner","PasswordResponses","PDFDataRangeTransport","PDFDateString","PDFWorker","UnexpectedResponseException","updateTextLayer","Util","VerbosityLevel","XfaLayer","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","HEADING_PATTERN","structTree","walk","#setAttributes","structElement","htmlElement","alt","#walk","role","children","kid","textChildren","textNodes","waitingElements","compareElementPositions","#compareElementPositions","e1","e2","rect1","getBoundingClientRect","rect2","top1","bot1","mid1","top2","bot2","mid2","centerX1","centerX2","nodeIndex","getElementById","addIdToAriaOwns","isRemovable","addPointerInTextLayer","removePointerInTextLayer","owns","#addIdToAriaOwns","child","moveElementInDOM","contentElement","hasChildNodes","elementToCompare","_onUpdateTextLayerMatches","textContentItemsStr","divs","_updateMatches","_convertMatches","iIndex","mm","begin","divIdx","_renderMatches","isSelectedPage","selectedMatchIdx","prevEnd","infinity","beginText","appendTextToDiv","fromOffset","toOffset","Node","span","i0","i1","lastDivIdx","lastOffset","isSelected","highlightSuffix","n0","n1","clearedUntilDivIdx","n","textContentSource","textDivProperties","textLayerRenderTask","tabIndex","finishRendering","#finishRendering","endOfContent","bindMouse","devicePixelRatio","mustRotate","mustRescale","#bindMouse","adjustTop","getPropertyValue","divBounds","pageY","clipboardData","setData","SidebarView","THUMBS","OUTLINE","ATTACHMENTS","LAYERS","ODD","EVEN","CursorTool","SELECT","HAND","ZOOM","AutoPrintRegExp","pixelRatio","scrollMatches","offsetY","clientTop","offsetX","overflow","viewAreaElement","callback","debounceScroll","rAF","viewAreaElementScrolled","currentX","lastX","currentY","lastY","_eventHandler","URLSearchParams","InvisibleCharsRegExp","replaceInvisible","condition","minIndex","maxIndex","currentItem","xinv","x_","b","c","d","p","getPageSizeInches","userUnit","x1","y1","x2","y2","backtrackBeforeAllVisibleElements","elt","pageTop","bottom","isElementBottomAfterViewTop","elementBottom","isElementNextAfterViewHorizontally","elementLeft","elementRight","numViews","firstVisibleElementInd","lastEdge","currentWidth","currentHeight","viewWidth","viewHeight","viewRight","viewBottom","hiddenHeight","hiddenWidth","fractionHeight","fractionWidth","at","pc","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","animationStarted","clamp","disableAutoFetchTimeout","bar","setWidth","scrollbarWidth","offsetWidth","setDisableAutoFetch","getActiveOrFocusedElement","curRoot","curActiveOrFocused","activeElement","shadowRoot","layout","apiPageModeToSidebarView","toggleCheckedBtn","button","toggleExpandedBtn","xfaHtml","getXfa"],"sourceRoot":""}
\No newline at end of file