diff --git a/.gitattributes b/.gitattributes index bb25f6542bd763ebb01906462024f92ccb7b7005..6d38324720fe9bf232877c5921575f448a063f4f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -107,3 +107,7 @@ tools/ui/node_modules/lightningcss-linux-x64-gnu/lightningcss.linux-x64-gnu.node tools/ui/node_modules/lightningcss-linux-x64-musl/lightningcss.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text tools/ui/node_modules/mermaid/dist/mermaid.js.map filter=lfs diff=lfs merge=lfs -text tools/ui/node_modules/mermaid/dist/mermaid.min.js.map filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Bold.ttf filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-BoldItalic.ttf filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Italic.ttf filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Regular.ttf filter=lfs diff=lfs merge=lfs -text diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitFixedItalic.pfb b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitFixedItalic.pfb new file mode 100644 index 0000000000000000000000000000000000000000..d71697d4b638737a5545dd0cb28cba8f613e4eec Binary files /dev/null and b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitFixedItalic.pfb differ diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerif.pfb b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerif.pfb new file mode 100644 index 0000000000000000000000000000000000000000..3fa682efbb4b1d1941194a5dd8b78f39b33b72b0 Binary files /dev/null and b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerif.pfb differ diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifBold.pfb b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifBold.pfb new file mode 100644 index 0000000000000000000000000000000000000000..ff7c6ddecf6b689d93823c4c2a8c41e6e058de46 Binary files /dev/null and b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifBold.pfb differ diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifBoldItalic.pfb b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifBoldItalic.pfb new file mode 100644 index 0000000000000000000000000000000000000000..460231fb88a0083e577ed534760307d7779fd82f Binary files /dev/null and b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifBoldItalic.pfb differ diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifItalic.pfb b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifItalic.pfb new file mode 100644 index 0000000000000000000000000000000000000000..d03a7c781e1a2b91481103dc3227a6bdca4a461c Binary files /dev/null and b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSerifItalic.pfb differ diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSymbol.pfb b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSymbol.pfb new file mode 100644 index 0000000000000000000000000000000000000000..c8f9bca78c2f89ce40dff0afe6cdd7068061b3e6 Binary files /dev/null and b/tools/ui/node_modules/pdfjs-dist/standard_fonts/FoxitSymbol.pfb differ diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/LICENSE_FOXIT b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LICENSE_FOXIT new file mode 100644 index 0000000000000000000000000000000000000000..8b4ed6dddf22b2fcc9f7f520cd23613b49307fa0 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LICENSE_FOXIT @@ -0,0 +1,27 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/LICENSE_LIBERATION b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LICENSE_LIBERATION new file mode 100644 index 0000000000000000000000000000000000000000..aba73e8a403084a93a245ca00e4a0db007886e0a --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LICENSE_LIBERATION @@ -0,0 +1,102 @@ +Digitized data copyright (c) 2010 Google Corporation + with Reserved Font Arimo, Tinos and Cousine. +Copyright (c) 2012 Red Hat, Inc. + with Reserved Font Name Liberation. + +This Font Software is licensed under the SIL Open Font License, +Version 1.1. + +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 + +PREAMBLE The goals of the Open Font License (OFL) are to stimulate +worldwide development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to provide +a free and open framework in which fonts may be shared and improved in +partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. +The fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + + + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. +This may include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components +as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting ? in part or in whole ? +any of the components of the Original Version, by changing formats or +by porting the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical writer +or other person who contributed to the Font Software. + + +PERMISSION & CONDITIONS + +Permission is hereby granted, free of charge, to any person obtaining a +copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components,in + Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, + redistributed and/or sold with any software, provided that each copy + contains the above copyright notice and this license. These can be + included either as stand-alone text files, human-readable headers or + in the appropriate machine-readable metadata fields within text or + binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font + Name(s) unless explicit written permission is granted by the + corresponding Copyright Holder. This restriction only applies to the + primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font + Software shall not be used to promote, endorse or advertise any + Modified Version, except to acknowledge the contribution(s) of the + Copyright Holder(s) and the Author(s) or with their explicit written + permission. + +5) The Font Software, modified or unmodified, in part or in whole, must + be distributed entirely under this license, and must not be distributed + under any other license. The requirement for fonts to remain under + this license does not apply to any document created using the Font + Software. + + + +TERMINATION +This license becomes null and void if any of the above conditions are not met. + + + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. + diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Bold.ttf b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Bold.ttf new file mode 100644 index 0000000000000000000000000000000000000000..3f1d35633ca47ef0b9433e9a07608b456dee3c0b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Bold.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:361c61b82d575c5c35fd9157fda8b0194bcfcd0d88ea8521a4fb5dd53d33dddc +size 137052 diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-BoldItalic.ttf b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-BoldItalic.ttf new file mode 100644 index 0000000000000000000000000000000000000000..d7a933ba9003e3b3703c5ed36300db47248dc4c1 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-BoldItalic.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a224075ac17495ad0a3af3bc0a419ac0704a8b3fd1095456201fb9b095fc281d +size 135124 diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Italic.ttf b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Italic.ttf new file mode 100644 index 0000000000000000000000000000000000000000..3cb610daf2679300d0006a4f01c737df5c46a039 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Italic.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:832b4406dbef23628800d3aaad21048534ac84d7e3ad955be83b8172ed8ef512 +size 162036 diff --git a/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Regular.ttf b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Regular.ttf new file mode 100644 index 0000000000000000000000000000000000000000..325d1ccf70cf276031e4cdc14fc11ec23d259f58 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/standard_fonts/LiberationSans-Regular.ttf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f8ace1f892b2bd9dc1792ba7f097fa7588f84fed48321480e04de5390828221f +size 139512 diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/annotation_layer.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/annotation_layer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b01c5240e8aec7b30c4c78f85a2f42799b3c8ef7 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/annotation_layer.d.ts @@ -0,0 +1,244 @@ +export type PDFPageProxy = import("./api").PDFPageProxy; +export type PageViewport = import("./display_utils").PageViewport; +export type TextAccessibilityManager = import("../../web/text_accessibility.js").TextAccessibilityManager; +export type IDownloadManager = import("../../web/interfaces").IDownloadManager; +export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService; +export type AnnotationEditorUIManager = any; +export type StructTreeLayerBuilder = import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder; +export type AnnotationElementParameters = { + data: Object; + layer: HTMLDivElement; + linkService: IPDFLinkService; + downloadManager?: import("../../web/interfaces").IDownloadManager | undefined; + annotationStorage?: AnnotationStorage | undefined; + /** + * - Path for image resources, mainly + * for annotation icons. Include trailing slash. + */ + imageResourcesPath?: string | undefined; + renderForms: boolean; + svgFactory: Object; + enableScripting?: boolean | undefined; + hasJSActions?: boolean | undefined; + fieldObjects?: Object | undefined; +}; +export type AnnotationLayerParameters = { + viewport: PageViewport; + div: HTMLDivElement; + annotations: any[]; + page: PDFPageProxy; + linkService: IPDFLinkService; + downloadManager?: import("../../web/interfaces").IDownloadManager | undefined; + annotationStorage?: AnnotationStorage | undefined; + /** + * - Path for image resources, mainly + * for annotation icons. Include trailing slash. + */ + imageResourcesPath?: string | undefined; + renderForms: boolean; + /** + * - Enable embedded script execution. + */ + enableScripting?: boolean | undefined; + /** + * - Some fields have JS actions. + * The default value is `false`. + */ + hasJSActions?: boolean | undefined; + fieldObjects?: { + [x: string]: Object[]; + } | null | undefined; + annotationCanvasMap?: Map | undefined; + accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined; + annotationEditorUIManager?: AnnotationEditorUIManager; + structTreeLayer?: import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined; +}; +/** + * @typedef {Object} AnnotationLayerParameters + * @property {PageViewport} viewport + * @property {HTMLDivElement} div + * @property {Array} annotations + * @property {PDFPageProxy} page + * @property {IPDFLinkService} linkService + * @property {IDownloadManager} [downloadManager] + * @property {AnnotationStorage} [annotationStorage] + * @property {string} [imageResourcesPath] - Path for image resources, mainly + * for annotation icons. Include trailing slash. + * @property {boolean} renderForms + * @property {boolean} [enableScripting] - Enable embedded script execution. + * @property {boolean} [hasJSActions] - Some fields have JS actions. + * The default value is `false`. + * @property {Object> | null} [fieldObjects] + * @property {Map} [annotationCanvasMap] + * @property {TextAccessibilityManager} [accessibilityManager] + * @property {AnnotationEditorUIManager} [annotationEditorUIManager] + * @property {StructTreeLayerBuilder} [structTreeLayer] + */ +/** + * Manage the layer containing all the annotations. + */ +export class AnnotationLayer { + /** + * @private + */ + private static get _defaultBorderStyle(); + constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, }: { + div: any; + accessibilityManager: any; + annotationCanvasMap: any; + annotationEditorUIManager: any; + page: any; + viewport: any; + structTreeLayer: any; + }); + div: any; + page: any; + viewport: any; + zIndex: number; + _annotationEditorUIManager: any; + popupShow: any[] | undefined; + hasEditableAnnotations(): boolean; + /** + * Render a new annotation layer with all annotation elements. + * + * @param {AnnotationLayerParameters} params + * @memberof AnnotationLayer + */ + render(params: AnnotationLayerParameters): Promise; + /** + * Add link annotations to the annotation layer. + * + * @param {Array} annotations + * @param {IPDFLinkService} linkService + * @memberof AnnotationLayer + */ + addLinkAnnotations(annotations: Array, linkService: IPDFLinkService): Promise; + /** + * Update the annotation elements on existing annotation layer. + * + * @param {AnnotationLayerParameters} viewport + * @memberof AnnotationLayer + */ + update({ viewport }: AnnotationLayerParameters): void; + getEditableAnnotations(): any[]; + getEditableAnnotation(id: any): any; + #private; +} +export class FreeTextAnnotationElement extends AnnotationElement { + constructor(parameters: any); + textContent: any; + textPosition: any; + annotationEditorType: number; + render(): HTMLElement | undefined; +} +export class HighlightAnnotationElement extends AnnotationElement { + constructor(parameters: any); + annotationEditorType: number; + render(): HTMLElement | undefined; +} +export class InkAnnotationElement extends AnnotationElement { + constructor(parameters: any); + containerClassName: string; + svgElementName: string; + annotationEditorType: number; + render(): HTMLElement | undefined; + getElementsToTriggerPopup(): any[]; + #private; +} +export class StampAnnotationElement extends AnnotationElement { + constructor(parameters: any); + annotationEditorType: number; + render(): HTMLElement | undefined; +} +import { AnnotationStorage } from "./annotation_storage.js"; +declare class AnnotationElement { + static _hasPopupData({ contentsObj, richText }: { + contentsObj: any; + richText: any; + }): boolean; + constructor(parameters: any, { isRenderable, ignoreBorder, createQuadrilaterals, }?: { + isRenderable?: boolean | undefined; + ignoreBorder?: boolean | undefined; + createQuadrilaterals?: boolean | undefined; + }); + isRenderable: boolean; + data: any; + layer: any; + linkService: any; + downloadManager: any; + imageResourcesPath: any; + renderForms: any; + svgFactory: any; + annotationStorage: any; + enableScripting: any; + hasJSActions: any; + _fieldObjects: any; + parent: any; + container: HTMLElement | undefined; + get _isEditable(): any; + get hasPopupData(): boolean; + updateEdited(params: any): void; + popup: any; + resetEdited(): void; + /** + * Create an empty container for the annotation's HTML element. + * + * @private + * @param {boolean} ignoreBorder + * @memberof AnnotationElement + * @returns {HTMLElement} A section element. + */ + private _createContainer; + setRotation(angle: any, container?: HTMLElement | undefined): void; + get _commonActions(): any; + _dispatchEventFromSandbox(actions: any, jsEvent: any): void; + _setDefaultPropertiesFromJS(element: any): void; + /** + * Create quadrilaterals from the annotation's quadpoints. + * + * @private + * @memberof AnnotationElement + */ + private _createQuadrilaterals; + /** + * Create a popup for the annotation's HTML element. This is used for + * annotations that do not have a Popup entry in the dictionary, but + * are of a type that works with popups (such as Highlight annotations). + * + * @param {Object} [popupData] - The data for the popup, if any. + * + * @private + * @memberof AnnotationElement + */ + private _createPopup; + get hasPopupElement(): boolean; + /** + * Render the annotation's HTML element(s). + * + * @public + * @memberof AnnotationElement + */ + public render(): void; + /** + * @private + * @returns {Array} + */ + private _getElementsByName; + show(): void; + hide(): void; + /** + * Get the HTML element(s) which can trigger a popup when clicked or hovered. + * + * @public + * @memberof AnnotationElement + * @returns {Array|HTMLElement} An array of elements or an + * element. + */ + public getElementsToTriggerPopup(): Array | HTMLElement; + addHighlightArea(): void; + _editOnDoubleClick(): void; + get width(): number; + get height(): number; + #private; +} +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/annotation_storage.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/annotation_storage.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc4083c3e7b80a1ff7fa6a53263df094e62bce2f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/annotation_storage.d.ts @@ -0,0 +1,92 @@ +/** + * Key/value storage for annotation data in forms. + */ +export class AnnotationStorage { + onSetModified: any; + onResetModified: any; + onAnnotationEditor: any; + /** + * Get the value for a given key if it exists, or return the default value. + * @param {string} key + * @param {Object} defaultValue + * @returns {Object} + */ + getValue(key: string, defaultValue: Object): Object; + /** + * Get the value for a given key. + * @param {string} key + * @returns {Object} + */ + getRawValue(key: string): Object; + /** + * Remove a value from the storage. + * @param {string} key + */ + remove(key: string): void; + /** + * Set the value for a given key + * @param {string} key + * @param {Object} value + */ + setValue(key: string, value: Object): void; + /** + * Check if the storage contains the given key. + * @param {string} key + * @returns {boolean} + */ + has(key: string): boolean; + get size(): number; + resetModified(): void; + /** + * @returns {PrintAnnotationStorage} + */ + get print(): PrintAnnotationStorage; + /** + * PLEASE NOTE: Only intended for usage within the API itself. + * @ignore + */ + get serializable(): Readonly<{ + map: null; + hash: ""; + transfer: undefined; + }> | { + map: Map; + hash: string; + transfer: any[]; + }; + get editorStats(): any; + resetModifiedIds(): void; + /** + * @returns {{ids: Set, hash: string}} + */ + get modifiedIds(): { + ids: Set; + hash: string; + }; + [Symbol.iterator](): MapIterator<[any, any]>; + #private; +} +/** + * A special `AnnotationStorage` for use during printing, where the serializable + * data is *frozen* upon initialization, to prevent scripting from modifying its + * contents. (Necessary since printing is triggered synchronously in browsers.) + */ +export class PrintAnnotationStorage extends AnnotationStorage { + constructor(parent: any); + /** + * PLEASE NOTE: Only intended for usage within the API itself. + * @ignore + */ + get serializable(): { + map: any; + hash: any; + transfer: any; + }; + get modifiedIds(): any; + #private; +} +export const SerializableEmpty: Readonly<{ + map: null; + hash: ""; + transfer: undefined; +}>; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/api.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/api.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd0968990a82d49e31d72a7be9a54c560de4722d --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/api.d.ts @@ -0,0 +1,1567 @@ +export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; +export type RefProxy = { + num: number; + gen: number; +}; +/** + * Document initialization / loading parameters object. + */ +export type DocumentInitParameters = { + /** + * - The URL of the PDF. + */ + url?: string | URL | undefined; + /** + * - + * Binary PDF data. + * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is + * BASE64-encoded, use `atob()` to convert it to a binary string first. + * + * NOTE: If TypedArrays are used they will generally be transferred to the + * worker-thread. This will help reduce main-thread memory usage, however + * it will take ownership of the TypedArrays. + */ + data?: string | number[] | ArrayBuffer | TypedArray | undefined; + /** + * - Basic authentication headers. + */ + httpHeaders?: Object | undefined; + /** + * - Indicates whether or not + * cross-site Access-Control requests should be made using credentials such + * as cookies or authorization headers. The default is `false`. + */ + withCredentials?: boolean | undefined; + /** + * - For decrypting password-protected PDFs. + */ + password?: string | undefined; + /** + * - The PDF file length. It's used for progress + * reports and range requests operations. + */ + length?: number | undefined; + /** + * - Allows for using a custom range + * transport implementation. + */ + range?: PDFDataRangeTransport | undefined; + /** + * - Specify maximum number of bytes fetched + * per range request. The default value is 65536 (= 2^16). + */ + rangeChunkSize?: number | undefined; + /** + * - The worker that will be used for loading and + * parsing the PDF data. + */ + worker?: PDFWorker | undefined; + /** + * - Controls the logging level; the constants + * from {@link VerbosityLevel} should be used. + */ + verbosity?: number | undefined; + /** + * - The base URL of the document, used when + * attempting to recover valid absolute URLs for annotations, and outline + * items, that (incorrectly) only specify relative URLs. + */ + docBaseUrl?: string | undefined; + /** + * - The URL where the predefined Adobe CMaps are + * located. Include the trailing slash. + */ + cMapUrl?: string | undefined; + /** + * - Specifies if the Adobe CMaps are binary + * packed or not. The default value is `true`. + */ + cMapPacked?: boolean | undefined; + /** + * - The factory that will be used when + * reading built-in CMap files. + * The default value is {DOMCMapReaderFactory}. + */ + CMapReaderFactory?: Object | undefined; + /** + * - The URL where the predefined ICC profiles are + * located. Include the trailing slash. + */ + iccUrl?: string | undefined; + /** + * - When `true`, fonts that aren't + * embedded in the PDF document will fallback to a system font. + * The default value is `true` in web environments and `false` in Node.js; + * unless `disableFontFace === true` in which case this defaults to `false` + * regardless of the environment (to prevent completely broken fonts). + */ + useSystemFonts?: boolean | undefined; + /** + * - The URL where the standard font + * files are located. Include the trailing slash. + */ + standardFontDataUrl?: string | undefined; + /** + * - The factory that will be used + * when reading the standard font files. + * The default value is {DOMStandardFontDataFactory}. + */ + StandardFontDataFactory?: Object | undefined; + /** + * - The URL where the wasm files are located. + * Include the trailing slash. + */ + wasmUrl?: string | undefined; + /** + * - The factory that will be used + * when reading the wasm files. + * The default value is {DOMWasmFactory}. + */ + WasmFactory?: Object | undefined; + /** + * - Enable using the Fetch API in the + * worker-thread when reading CMap and standard font files. When `true`, + * the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory` + * options are ignored. + * The default value is `true` in web environments and `false` in Node.js. + */ + useWorkerFetch?: boolean | undefined; + /** + * - Attempt to use WebAssembly in order to + * improve e.g. image decoding performance. + * The default value is `true`. + */ + useWasm?: boolean | undefined; + /** + * - Reject certain promises, e.g. + * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated + * PDF data cannot be successfully parsed, instead of attempting to recover + * whatever possible of the data. The default value is `false`. + */ + stopAtErrors?: boolean | undefined; + /** + * - The maximum allowed image size in total + * pixels, i.e. width * height. Images above this value will not be rendered. + * Use -1 for no limit, which is also the default value. + */ + maxImageSize?: number | undefined; + /** + * - Determines if we can evaluate strings + * as JavaScript. Primarily used to improve performance of PDF functions. + * The default value is `true`. + */ + isEvalSupported?: boolean | undefined; + /** + * - Determines if we can use + * `OffscreenCanvas` in the worker. Primarily used to improve performance of + * image conversion/rendering. + * The default value is `true` in web environments and `false` in Node.js. + */ + isOffscreenCanvasSupported?: boolean | undefined; + /** + * - Determines if we can use + * `ImageDecoder` in the worker. Primarily used to improve performance of + * image conversion/rendering. + * The default value is `true` in web environments and `false` in Node.js. + * + * NOTE: Also temporarily disabled in Chromium browsers, until we no longer + * support the affected browser versions, because of various bugs: + * + * - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf; + * see https://issues.chromium.org/issues/374807001 + * + * - Broken images when using the JPEG decoder with images that have custom + * colour profiles, e.g. GitHub discussion 19030; + * see https://issues.chromium.org/issues/378869810 + */ + isImageDecoderSupported?: boolean | undefined; + /** + * - The integer value is used to + * know when an image must be resized (uses `OffscreenCanvas` in the worker). + * If it's -1 then a possibly slow algorithm is used to guess the max value. + */ + canvasMaxAreaInBytes?: number | undefined; + /** + * - By default fonts are converted to + * OpenType fonts and loaded via the Font Loading API or `@font-face` rules. + * If disabled, fonts will be rendered using a built-in font renderer that + * constructs the glyphs with primitive path commands. + * The default value is `false` in web environments and `true` in Node.js. + */ + disableFontFace?: boolean | undefined; + /** + * - Include additional properties, + * which are unused during rendering of PDF documents, when exporting the + * parsed font data from the worker-thread. This may be useful for debugging + * purposes (and backwards compatibility), but note that it will lead to + * increased memory usage. The default value is `false`. + */ + fontExtraProperties?: boolean | undefined; + /** + * - Render Xfa forms if any. + * The default value is `false`. + */ + enableXfa?: boolean | undefined; + /** + * - Specify an explicit document + * context to create elements with and to load resources, such as fonts, + * into. Defaults to the current document. + */ + ownerDocument?: HTMLDocument | undefined; + /** + * - Disable range request loading of PDF + * files. When enabled, and if the server supports partial content requests, + * then the PDF will be fetched in chunks. The default value is `false`. + */ + disableRange?: boolean | undefined; + /** + * - Disable streaming of PDF file data. + * By default PDF.js attempts to load PDF files in chunks. The default value + * is `false`. + */ + disableStream?: boolean | undefined; + /** + * - Disable pre-fetching of PDF file + * data. When range requests are enabled PDF.js will automatically keep + * fetching more data even if it isn't needed to display the current page. + * The default value is `false`. + * + * NOTE: It is also necessary to disable streaming, see above, in order for + * disabling of pre-fetching to work correctly. + */ + disableAutoFetch?: boolean | undefined; + /** + * - Enables special hooks for debugging PDF.js + * (see `web/debugger.js`). The default value is `false`. + */ + pdfBug?: boolean | undefined; + /** + * - The factory that will be used when + * creating canvases. The default value is {DOMCanvasFactory}. + */ + CanvasFactory?: Object | undefined; + /** + * - The factory that will be used to + * create SVG filters when rendering some images on the main canvas. + * The default value is {DOMFilterFactory}. + */ + FilterFactory?: Object | undefined; + /** + * - Enables hardware acceleration for + * rendering. The default value is `false`. + */ + enableHWA?: boolean | undefined; +}; +export type OnProgressParameters = { + /** + * - Currently loaded number of bytes. + */ + loaded: number; + /** + * - Total number of bytes in the PDF file. + */ + total: number; +}; +/** + * Page getViewport parameters. + */ +export type GetViewportParameters = { + /** + * - The desired scale of the viewport. + */ + scale: number; + /** + * - The desired rotation, in degrees, of + * the viewport. If omitted it defaults to the page rotation. + */ + rotation?: number | undefined; + /** + * - The horizontal, i.e. x-axis, offset. + * The default value is `0`. + */ + offsetX?: number | undefined; + /** + * - The vertical, i.e. y-axis, offset. + * The default value is `0`. + */ + offsetY?: number | undefined; + /** + * - If true, the y-axis will not be + * flipped. The default value is `false`. + */ + dontFlip?: boolean | undefined; +}; +/** + * Page getTextContent parameters. + */ +export type getTextContentParameters = { + /** + * - When true include marked + * content items in the items array of TextContent. The default is `false`. + */ + includeMarkedContent?: boolean | undefined; + /** + * - When true the text is *not* + * normalized in the worker-thread. The default is `false`. + */ + disableNormalization?: boolean | undefined; +}; +/** + * Page text content. + */ +export type TextContent = { + /** + * - Array of + * {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent + * items are included when includeMarkedContent is true. + */ + items: Array; + /** + * - {@link TextStyle} objects, + * indexed by font name. + */ + styles: { + [x: string]: TextStyle; + }; + /** + * - The document /Lang attribute. + */ + lang: string | null; +}; +/** + * Page text content part. + */ +export type TextItem = { + /** + * - Text content. + */ + str: string; + /** + * - Text direction: 'ttb', 'ltr' or 'rtl'. + */ + dir: string; + /** + * - Transformation matrix. + */ + transform: Array; + /** + * - Width in device space. + */ + width: number; + /** + * - Height in device space. + */ + height: number; + /** + * - Font name used by PDF.js for converted font. + */ + fontName: string; + /** + * - Indicating if the text content is followed by a + * line-break. + */ + hasEOL: boolean; +}; +/** + * Page text marked content part. + */ +export type TextMarkedContent = { + /** + * - Either 'beginMarkedContent', + * 'beginMarkedContentProps', or 'endMarkedContent'. + */ + type: string; + /** + * - The marked content identifier. Only used for type + * 'beginMarkedContentProps'. + */ + id: string; +}; +/** + * Text style. + */ +export type TextStyle = { + /** + * - Font ascent. + */ + ascent: number; + /** + * - Font descent. + */ + descent: number; + /** + * - Whether or not the text is in vertical mode. + */ + vertical: boolean; + /** + * - The possible font family. + */ + fontFamily: string; +}; +/** + * Page annotation parameters. + */ +export type GetAnnotationsParameters = { + /** + * - Determines the annotations that are fetched, + * can be 'display' (viewable annotations), 'print' (printable annotations), + * or 'any' (all annotations). The default value is 'display'. + */ + intent?: string | undefined; +}; +/** + * Page render parameters. + */ +export type RenderParameters = { + /** + * - 2D context of a DOM + * Canvas object for backwards compatibility; it is recommended to use the + * `canvas` parameter instead. + * If the context must absolutely be used to render the page, the canvas must + * be null. + */ + canvasContext: CanvasRenderingContext2D; + /** + * - A DOM Canvas object. The default + * value is the canvas associated with the `canvasContext` parameter if no + * value is provided explicitly. + */ + canvas: HTMLCanvasElement | null; + /** + * - Rendering viewport obtained by calling + * the `PDFPageProxy.getViewport` method. + */ + viewport: PageViewport; + /** + * - Rendering intent, can be 'display', 'print', + * or 'any'. The default value is 'display'. + */ + intent?: string | undefined; + /** + * Controls which annotations are rendered + * onto the canvas, for annotations with appearance-data; the values from + * {@link AnnotationMode} should be used. The following values are supported: + * - `AnnotationMode.DISABLE`, which disables all annotations. + * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus + * it also depends on the `intent`-option, see above). + * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain + * interactive form elements (those will be rendered in the display layer). + * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations + * (as above) but where interactive form elements are updated with data + * from the {@link AnnotationStorage}-instance; useful e.g. for printing. + * The default value is `AnnotationMode.ENABLE`. + */ + annotationMode?: number | undefined; + /** + * - Additional transform, applied just + * before viewport transform. + */ + transform?: any[] | undefined; + /** + * - Background + * to use for the canvas. + * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS + * value, a `CanvasGradient` object (a linear or radial gradient) or + * a `CanvasPattern` object (a repetitive image). The default value is + * 'rgb(255,255,255)'. + * + * NOTE: This option may be partially, or completely, ignored when the + * `pageColors`-option is used. + */ + background?: string | CanvasGradient | CanvasPattern | undefined; + /** + * - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + */ + pageColors?: Object | undefined; + /** + * - + * A promise that should resolve with an {@link OptionalContentConfig}created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`, + * the configuration will be fetched automatically with the default visibility + * states set. + */ + optionalContentConfigPromise?: Promise | undefined; + /** + * - Map some + * annotation ids with canvases used to render them. + */ + annotationCanvasMap?: Map | undefined; + printAnnotationStorage?: PrintAnnotationStorage | undefined; + /** + * - Render the page in editing mode. + */ + isEditing?: boolean | undefined; +}; +/** + * Page getOperatorList parameters. + */ +export type GetOperatorListParameters = { + /** + * - Rendering intent, can be 'display', 'print', + * or 'any'. The default value is 'display'. + */ + intent?: string | undefined; + /** + * Controls which annotations are included + * in the operatorList, for annotations with appearance-data; the values from + * {@link AnnotationMode} should be used. The following values are supported: + * - `AnnotationMode.DISABLE`, which disables all annotations. + * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus + * it also depends on the `intent`-option, see above). + * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain + * interactive form elements (those will be rendered in the display layer). + * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations + * (as above) but where interactive form elements are updated with data + * from the {@link AnnotationStorage}-instance; useful e.g. for printing. + * The default value is `AnnotationMode.ENABLE`. + */ + annotationMode?: number | undefined; + printAnnotationStorage?: PrintAnnotationStorage | undefined; + /** + * - Render the page in editing mode. + */ + isEditing?: boolean | undefined; +}; +/** + * Structure tree node. The root node will have a role "Root". + */ +export type StructTreeNode = { + /** + * - Array of + * {@link StructTreeNode} and {@link StructTreeContent} objects. + */ + children: Array; + /** + * - element's role, already mapped if a role map exists + * in the PDF. + */ + role: string; +}; +/** + * Structure tree content. + */ +export type StructTreeContent = { + /** + * - either "content" for page and stream structure + * elements or "object" for object references. + */ + type: string; + /** + * - unique id that will map to the text layer. + */ + id: string; +}; +/** + * PDF page operator list. + */ +export type PDFOperatorList = { + /** + * - Array containing the operator functions. + */ + fnArray: Array; + /** + * - Array containing the arguments of the + * functions. + */ + argsArray: Array; +}; +export type PDFWorkerParameters = { + /** + * - The name of the worker. + */ + name?: string | undefined; + /** + * - The `workerPort` object. + */ + port?: Worker | undefined; + /** + * - Controls the logging level; + * the constants from {@link VerbosityLevel} should be used. + */ + verbosity?: number | undefined; +}; +/** @type {string} */ +export const build: string; +/** + * @typedef { Int8Array | Uint8Array | Uint8ClampedArray | + * Int16Array | Uint16Array | + * Int32Array | Uint32Array | Float32Array | + * Float64Array + * } TypedArray + */ +/** + * @typedef {Object} RefProxy + * @property {number} num + * @property {number} gen + */ +/** + * Document initialization / loading parameters object. + * + * @typedef {Object} DocumentInitParameters + * @property {string | URL} [url] - The URL of the PDF. + * @property {TypedArray | ArrayBuffer | Array | string} [data] - + * Binary PDF data. + * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is + * BASE64-encoded, use `atob()` to convert it to a binary string first. + * + * NOTE: If TypedArrays are used they will generally be transferred to the + * worker-thread. This will help reduce main-thread memory usage, however + * it will take ownership of the TypedArrays. + * @property {Object} [httpHeaders] - Basic authentication headers. + * @property {boolean} [withCredentials] - Indicates whether or not + * cross-site Access-Control requests should be made using credentials such + * as cookies or authorization headers. The default is `false`. + * @property {string} [password] - For decrypting password-protected PDFs. + * @property {number} [length] - The PDF file length. It's used for progress + * reports and range requests operations. + * @property {PDFDataRangeTransport} [range] - Allows for using a custom range + * transport implementation. + * @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched + * per range request. The default value is 65536 (= 2^16). + * @property {PDFWorker} [worker] - The worker that will be used for loading and + * parsing the PDF data. + * @property {number} [verbosity] - Controls the logging level; the constants + * from {@link VerbosityLevel} should be used. + * @property {string} [docBaseUrl] - The base URL of the document, used when + * attempting to recover valid absolute URLs for annotations, and outline + * items, that (incorrectly) only specify relative URLs. + * @property {string} [cMapUrl] - The URL where the predefined Adobe CMaps are + * located. Include the trailing slash. + * @property {boolean} [cMapPacked] - Specifies if the Adobe CMaps are binary + * packed or not. The default value is `true`. + * @property {Object} [CMapReaderFactory] - The factory that will be used when + * reading built-in CMap files. + * The default value is {DOMCMapReaderFactory}. + * @property {string} [iccUrl] - The URL where the predefined ICC profiles are + * located. Include the trailing slash. + * @property {boolean} [useSystemFonts] - When `true`, fonts that aren't + * embedded in the PDF document will fallback to a system font. + * The default value is `true` in web environments and `false` in Node.js; + * unless `disableFontFace === true` in which case this defaults to `false` + * regardless of the environment (to prevent completely broken fonts). + * @property {string} [standardFontDataUrl] - The URL where the standard font + * files are located. Include the trailing slash. + * @property {Object} [StandardFontDataFactory] - The factory that will be used + * when reading the standard font files. + * The default value is {DOMStandardFontDataFactory}. + * @property {string} [wasmUrl] - The URL where the wasm files are located. + * Include the trailing slash. + * @property {Object} [WasmFactory] - The factory that will be used + * when reading the wasm files. + * The default value is {DOMWasmFactory}. + * @property {boolean} [useWorkerFetch] - Enable using the Fetch API in the + * worker-thread when reading CMap and standard font files. When `true`, + * the `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory` + * options are ignored. + * The default value is `true` in web environments and `false` in Node.js. + * @property {boolean} [useWasm] - Attempt to use WebAssembly in order to + * improve e.g. image decoding performance. + * The default value is `true`. + * @property {boolean} [stopAtErrors] - Reject certain promises, e.g. + * `getOperatorList`, `getTextContent`, and `RenderTask`, when the associated + * PDF data cannot be successfully parsed, instead of attempting to recover + * whatever possible of the data. The default value is `false`. + * @property {number} [maxImageSize] - The maximum allowed image size in total + * pixels, i.e. width * height. Images above this value will not be rendered. + * Use -1 for no limit, which is also the default value. + * @property {boolean} [isEvalSupported] - Determines if we can evaluate strings + * as JavaScript. Primarily used to improve performance of PDF functions. + * The default value is `true`. + * @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use + * `OffscreenCanvas` in the worker. Primarily used to improve performance of + * image conversion/rendering. + * The default value is `true` in web environments and `false` in Node.js. + * @property {boolean} [isImageDecoderSupported] - Determines if we can use + * `ImageDecoder` in the worker. Primarily used to improve performance of + * image conversion/rendering. + * The default value is `true` in web environments and `false` in Node.js. + * + * NOTE: Also temporarily disabled in Chromium browsers, until we no longer + * support the affected browser versions, because of various bugs: + * + * - Crashes when using the BMP decoder with huge images, e.g. issue6741.pdf; + * see https://issues.chromium.org/issues/374807001 + * + * - Broken images when using the JPEG decoder with images that have custom + * colour profiles, e.g. GitHub discussion 19030; + * see https://issues.chromium.org/issues/378869810 + * + * @property {number} [canvasMaxAreaInBytes] - The integer value is used to + * know when an image must be resized (uses `OffscreenCanvas` in the worker). + * If it's -1 then a possibly slow algorithm is used to guess the max value. + * @property {boolean} [disableFontFace] - By default fonts are converted to + * OpenType fonts and loaded via the Font Loading API or `@font-face` rules. + * If disabled, fonts will be rendered using a built-in font renderer that + * constructs the glyphs with primitive path commands. + * The default value is `false` in web environments and `true` in Node.js. + * @property {boolean} [fontExtraProperties] - Include additional properties, + * which are unused during rendering of PDF documents, when exporting the + * parsed font data from the worker-thread. This may be useful for debugging + * purposes (and backwards compatibility), but note that it will lead to + * increased memory usage. The default value is `false`. + * @property {boolean} [enableXfa] - Render Xfa forms if any. + * The default value is `false`. + * @property {HTMLDocument} [ownerDocument] - Specify an explicit document + * context to create elements with and to load resources, such as fonts, + * into. Defaults to the current document. + * @property {boolean} [disableRange] - Disable range request loading of PDF + * files. When enabled, and if the server supports partial content requests, + * then the PDF will be fetched in chunks. The default value is `false`. + * @property {boolean} [disableStream] - Disable streaming of PDF file data. + * By default PDF.js attempts to load PDF files in chunks. The default value + * is `false`. + * @property {boolean} [disableAutoFetch] - Disable pre-fetching of PDF file + * data. When range requests are enabled PDF.js will automatically keep + * fetching more data even if it isn't needed to display the current page. + * The default value is `false`. + * + * NOTE: It is also necessary to disable streaming, see above, in order for + * disabling of pre-fetching to work correctly. + * @property {boolean} [pdfBug] - Enables special hooks for debugging PDF.js + * (see `web/debugger.js`). The default value is `false`. + * @property {Object} [CanvasFactory] - The factory that will be used when + * creating canvases. The default value is {DOMCanvasFactory}. + * @property {Object} [FilterFactory] - The factory that will be used to + * create SVG filters when rendering some images on the main canvas. + * The default value is {DOMFilterFactory}. + * @property {boolean} [enableHWA] - Enables hardware acceleration for + * rendering. The default value is `false`. + */ +/** + * This is the main entry point for loading a PDF and interacting with it. + * + * NOTE: If a URL is used to fetch the PDF data a standard Fetch API call (or + * XHR as fallback) is used, which means it must follow same origin rules, + * e.g. no cross-domain requests without CORS. + * + * @param {string | URL | TypedArray | ArrayBuffer | DocumentInitParameters} + * src - Can be a URL where a PDF file is located, a typed array (Uint8Array) + * already populated with data, or a parameter object. + * @returns {PDFDocumentLoadingTask} + */ +export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask; +/** + * Abstract class to support range requests file loading. + * + * NOTE: The TypedArrays passed to the constructor and relevant methods below + * will generally be transferred to the worker-thread. This will help reduce + * main-thread memory usage, however it will take ownership of the TypedArrays. + */ +export class PDFDataRangeTransport { + /** + * @param {number} length + * @param {Uint8Array|null} initialData + * @param {boolean} [progressiveDone] + * @param {string} [contentDispositionFilename] + */ + constructor(length: number, initialData: Uint8Array | null, progressiveDone?: boolean, contentDispositionFilename?: string); + length: number; + initialData: Uint8Array | null; + progressiveDone: boolean; + contentDispositionFilename: string; + /** + * @param {function} listener + */ + addRangeListener(listener: Function): void; + /** + * @param {function} listener + */ + addProgressListener(listener: Function): void; + /** + * @param {function} listener + */ + addProgressiveReadListener(listener: Function): void; + /** + * @param {function} listener + */ + addProgressiveDoneListener(listener: Function): void; + /** + * @param {number} begin + * @param {Uint8Array|null} chunk + */ + onDataRange(begin: number, chunk: Uint8Array | null): void; + /** + * @param {number} loaded + * @param {number|undefined} total + */ + onDataProgress(loaded: number, total: number | undefined): void; + /** + * @param {Uint8Array|null} chunk + */ + onDataProgressiveRead(chunk: Uint8Array | null): void; + onDataProgressiveDone(): void; + transportReady(): void; + /** + * @param {number} begin + * @param {number} end + */ + requestDataRange(begin: number, end: number): void; + abort(): void; + #private; +} +/** + * @typedef {Object} OnProgressParameters + * @property {number} loaded - Currently loaded number of bytes. + * @property {number} total - Total number of bytes in the PDF file. + */ +/** + * The loading task controls the operations required to load a PDF document + * (such as network requests) and provides a way to listen for completion, + * after which individual pages can be rendered. + */ +export class PDFDocumentLoadingTask { + static "__#59@#docId": number; + /** + * @private + */ + private _capability; + /** + * @private + */ + private _transport; + /** + * @private + */ + private _worker; + /** + * Unique identifier for the document loading task. + * @type {string} + */ + docId: string; + /** + * Whether the loading task is destroyed or not. + * @type {boolean} + */ + destroyed: boolean; + /** + * Callback to request a password if a wrong or no password was provided. + * The callback receives two parameters: a function that should be called + * with the new password, and a reason (see {@link PasswordResponses}). + * @type {function} + */ + onPassword: Function; + /** + * Callback to be able to monitor the loading progress of the PDF file + * (necessary to implement e.g. a loading bar). + * The callback receives an {@link OnProgressParameters} argument. + * @type {function} + */ + onProgress: Function; + /** + * Promise for document loading task completion. + * @type {Promise} + */ + get promise(): Promise; + /** + * Abort all network requests and destroy the worker. + * @returns {Promise} A promise that is resolved when destruction is + * completed. + */ + destroy(): Promise; + /** + * Attempt to fetch the raw data of the PDF document, when e.g. + * - An exception was thrown during document initialization. + * - An `onPassword` callback is delaying initialization. + * @returns {Promise} + */ + getData(): Promise; +} +/** + * Proxy to a `PDFDocument` in the worker thread. + */ +export class PDFDocumentProxy { + constructor(pdfInfo: any, transport: any); + _pdfInfo: any; + _transport: any; + /** + * @type {AnnotationStorage} Storage for annotation data in forms. + */ + get annotationStorage(): AnnotationStorage; + /** + * @type {Object} The canvas factory instance. + */ + get canvasFactory(): Object; + /** + * @type {Object} The filter factory instance. + */ + get filterFactory(): Object; + /** + * @type {number} Total number of pages in the PDF file. + */ + get numPages(): number; + /** + * @type {Array} A (not guaranteed to be) unique ID to identify + * the PDF document. + * NOTE: The first element will always be defined for all PDF documents, + * whereas the second element is only defined for *modified* PDF documents. + */ + get fingerprints(): Array; + /** + * @type {boolean} True if only XFA form. + */ + get isPureXfa(): boolean; + /** + * NOTE: This is (mostly) intended to support printing of XFA forms. + * + * @type {Object | null} An object representing a HTML tree structure + * to render the XFA, or `null` when no XFA form exists. + */ + get allXfaHtml(): Object | null; + /** + * @param {number} pageNumber - The page number to get. The first page is 1. + * @returns {Promise} A promise that is resolved with + * a {@link PDFPageProxy} object. + */ + getPage(pageNumber: number): Promise; + /** + * @param {RefProxy} ref - The page reference. + * @returns {Promise} A promise that is resolved with the page index, + * starting from zero, that is associated with the reference. + */ + getPageIndex(ref: RefProxy): Promise; + /** + * @returns {Promise>>} A promise that is resolved + * with a mapping from named destinations to references. + * + * This can be slow for large documents. Use `getDestination` instead. + */ + getDestinations(): Promise<{ + [x: string]: Array; + }>; + /** + * @param {string} id - The named destination to get. + * @returns {Promise | null>} A promise that is resolved with all + * information of the given named destination, or `null` when the named + * destination is not present in the PDF file. + */ + getDestination(id: string): Promise | null>; + /** + * @returns {Promise | null>} A promise that is resolved with + * an {Array} containing the page labels that correspond to the page + * indexes, or `null` when no page labels are present in the PDF file. + */ + getPageLabels(): Promise | null>; + /** + * @returns {Promise} A promise that is resolved with a {string} + * containing the page layout name. + */ + getPageLayout(): Promise; + /** + * @returns {Promise} A promise that is resolved with a {string} + * containing the page mode name. + */ + getPageMode(): Promise; + /** + * @returns {Promise} A promise that is resolved with an + * {Object} containing the viewer preferences, or `null` when no viewer + * preferences are present in the PDF file. + */ + getViewerPreferences(): Promise; + /** + * @returns {Promise} A promise that is resolved with an {Array} + * containing the destination, or `null` when no open action is present + * in the PDF. + */ + getOpenAction(): Promise; + /** + * @returns {Promise} A promise that is resolved with a lookup table + * for mapping named attachments to their content. + */ + getAttachments(): Promise; + /** + * @returns {Promise} A promise that is resolved with + * an {Object} with the JavaScript actions: + * - from the name tree. + * - from A or AA entries in the catalog dictionary. + * , or `null` if no JavaScript exists. + */ + getJSActions(): Promise; + /** + * @typedef {Object} OutlineNode + * @property {string} title + * @property {boolean} bold + * @property {boolean} italic + * @property {Uint8ClampedArray} color - The color in RGB format to use for + * display purposes. + * @property {string | Array | null} dest + * @property {string | null} url + * @property {string | undefined} unsafeUrl + * @property {boolean | undefined} newWindow + * @property {number | undefined} count + * @property {Array} items + */ + /** + * @returns {Promise>} A promise that is resolved with an + * {Array} that is a tree outline (if it has one) of the PDF file. + */ + getOutline(): Promise | null; + url: string | null; + unsafeUrl: string | undefined; + newWindow: boolean | undefined; + count: number | undefined; + items: Array; + }>>; + /** + * @typedef {Object} GetOptionalContentConfigParameters + * @property {string} [intent] - Determines the optional content groups that + * are visible by default; valid values are: + * - 'display' (viewable groups). + * - 'print' (printable groups). + * - 'any' (all groups). + * The default value is 'display'. + */ + /** + * @param {GetOptionalContentConfigParameters} [params] - Optional content + * config parameters. + * @returns {Promise} A promise that is resolved with + * an {@link OptionalContentConfig} that contains all the optional content + * groups (assuming that the document has any). + */ + getOptionalContentConfig({ intent }?: { + /** + * - Determines the optional content groups that + * are visible by default; valid values are: + * - 'display' (viewable groups). + * - 'print' (printable groups). + * - 'any' (all groups). + * The default value is 'display'. + */ + intent?: string | undefined; + }): Promise; + /** + * @returns {Promise | null>} A promise that is resolved with + * an {Array} that contains the permission flags for the PDF document, or + * `null` when no permissions are present in the PDF file. + */ + getPermissions(): Promise | null>; + /** + * @returns {Promise<{ info: Object, metadata: Metadata }>} A promise that is + * resolved with an {Object} that has `info` and `metadata` properties. + * `info` is an {Object} filled with anything available in the information + * dictionary and similarly `metadata` is a {Metadata} object with + * information from the metadata section of the PDF. + */ + getMetadata(): Promise<{ + info: Object; + metadata: Metadata; + }>; + /** + * @typedef {Object} MarkInfo + * Properties correspond to Table 321 of the PDF 32000-1:2008 spec. + * @property {boolean} Marked + * @property {boolean} UserProperties + * @property {boolean} Suspects + */ + /** + * @returns {Promise} A promise that is resolved with + * a {MarkInfo} object that contains the MarkInfo flags for the PDF + * document, or `null` when no MarkInfo values are present in the PDF file. + */ + getMarkInfo(): Promise<{ + Marked: boolean; + UserProperties: boolean; + Suspects: boolean; + } | null>; + /** + * @returns {Promise} A promise that is resolved with a + * {Uint8Array} containing the raw data of the PDF document. + */ + getData(): Promise; + /** + * @returns {Promise} A promise that is resolved with a + * {Uint8Array} containing the full data of the saved document. + */ + saveDocument(): Promise; + /** + * @returns {Promise<{ length: number }>} A promise that is resolved when the + * document's data is loaded. It is resolved with an {Object} that contains + * the `length` property that indicates size of the PDF data in bytes. + */ + getDownloadInfo(): Promise<{ + length: number; + }>; + /** + * Cleans up resources allocated by the document on both the main and worker + * threads. + * + * NOTE: Do not, under any circumstances, call this method when rendering is + * currently ongoing since that may lead to rendering errors. + * + * @param {boolean} [keepLoadedFonts] - Let fonts remain attached to the DOM. + * NOTE: This will increase persistent memory usage, hence don't use this + * option unless absolutely necessary. The default value is `false`. + * @returns {Promise} A promise that is resolved when clean-up has finished. + */ + cleanup(keepLoadedFonts?: boolean): Promise; + /** + * Destroys the current document instance and terminates the worker. + */ + destroy(): Promise; + /** + * @param {RefProxy} ref - The page reference. + * @returns {number | null} The page number, if it's cached. + */ + cachedPageNumber(ref: RefProxy): number | null; + /** + * @type {DocumentInitParameters} A subset of the current + * {DocumentInitParameters}, which are needed in the viewer. + */ + get loadingParams(): DocumentInitParameters; + /** + * @type {PDFDocumentLoadingTask} The loadingTask for the current document. + */ + get loadingTask(): PDFDocumentLoadingTask; + /** + * @returns {Promise> | null>} A promise that is + * resolved with an {Object} containing /AcroForm field data for the JS + * sandbox, or `null` when no field data is present in the PDF file. + */ + getFieldObjects(): Promise<{ + [x: string]: Array; + } | null>; + /** + * @returns {Promise} A promise that is resolved with `true` + * if some /AcroForm fields have JavaScript actions. + */ + hasJSActions(): Promise; + /** + * @returns {Promise | null>} A promise that is resolved with an + * {Array} containing IDs of annotations that have a calculation + * action, or `null` when no such annotations are present in the PDF file. + */ + getCalculationOrderIds(): Promise | null>; +} +/** + * Page getViewport parameters. + * + * @typedef {Object} GetViewportParameters + * @property {number} scale - The desired scale of the viewport. + * @property {number} [rotation] - The desired rotation, in degrees, of + * the viewport. If omitted it defaults to the page rotation. + * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. + * The default value is `0`. + * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. + * The default value is `0`. + * @property {boolean} [dontFlip] - If true, the y-axis will not be + * flipped. The default value is `false`. + */ +/** + * Page getTextContent parameters. + * + * @typedef {Object} getTextContentParameters + * @property {boolean} [includeMarkedContent] - When true include marked + * content items in the items array of TextContent. The default is `false`. + * @property {boolean} [disableNormalization] - When true the text is *not* + * normalized in the worker-thread. The default is `false`. + */ +/** + * Page text content. + * + * @typedef {Object} TextContent + * @property {Array} items - Array of + * {@link TextItem} and {@link TextMarkedContent} objects. TextMarkedContent + * items are included when includeMarkedContent is true. + * @property {Object} styles - {@link TextStyle} objects, + * indexed by font name. + * @property {string | null} lang - The document /Lang attribute. + */ +/** + * Page text content part. + * + * @typedef {Object} TextItem + * @property {string} str - Text content. + * @property {string} dir - Text direction: 'ttb', 'ltr' or 'rtl'. + * @property {Array} transform - Transformation matrix. + * @property {number} width - Width in device space. + * @property {number} height - Height in device space. + * @property {string} fontName - Font name used by PDF.js for converted font. + * @property {boolean} hasEOL - Indicating if the text content is followed by a + * line-break. + */ +/** + * Page text marked content part. + * + * @typedef {Object} TextMarkedContent + * @property {string} type - Either 'beginMarkedContent', + * 'beginMarkedContentProps', or 'endMarkedContent'. + * @property {string} id - The marked content identifier. Only used for type + * 'beginMarkedContentProps'. + */ +/** + * Text style. + * + * @typedef {Object} TextStyle + * @property {number} ascent - Font ascent. + * @property {number} descent - Font descent. + * @property {boolean} vertical - Whether or not the text is in vertical mode. + * @property {string} fontFamily - The possible font family. + */ +/** + * Page annotation parameters. + * + * @typedef {Object} GetAnnotationsParameters + * @property {string} [intent] - Determines the annotations that are fetched, + * can be 'display' (viewable annotations), 'print' (printable annotations), + * or 'any' (all annotations). The default value is 'display'. + */ +/** + * Page render parameters. + * + * @typedef {Object} RenderParameters + * @property {CanvasRenderingContext2D} canvasContext - 2D context of a DOM + * Canvas object for backwards compatibility; it is recommended to use the + * `canvas` parameter instead. + * If the context must absolutely be used to render the page, the canvas must + * be null. + * @property {HTMLCanvasElement|null} canvas - A DOM Canvas object. The default + * value is the canvas associated with the `canvasContext` parameter if no + * value is provided explicitly. + * @property {PageViewport} viewport - Rendering viewport obtained by calling + * the `PDFPageProxy.getViewport` method. + * @property {string} [intent] - Rendering intent, can be 'display', 'print', + * or 'any'. The default value is 'display'. + * @property {number} [annotationMode] Controls which annotations are rendered + * onto the canvas, for annotations with appearance-data; the values from + * {@link AnnotationMode} should be used. The following values are supported: + * - `AnnotationMode.DISABLE`, which disables all annotations. + * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus + * it also depends on the `intent`-option, see above). + * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain + * interactive form elements (those will be rendered in the display layer). + * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations + * (as above) but where interactive form elements are updated with data + * from the {@link AnnotationStorage}-instance; useful e.g. for printing. + * The default value is `AnnotationMode.ENABLE`. + * @property {Array} [transform] - Additional transform, applied just + * before viewport transform. + * @property {CanvasGradient | CanvasPattern | string} [background] - Background + * to use for the canvas. + * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS + * value, a `CanvasGradient` object (a linear or radial gradient) or + * a `CanvasPattern` object (a repetitive image). The default value is + * 'rgb(255,255,255)'. + * + * NOTE: This option may be partially, or completely, ignored when the + * `pageColors`-option is used. + * @property {Object} [pageColors] - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + * @property {Promise} [optionalContentConfigPromise] - + * A promise that should resolve with an {@link OptionalContentConfig} + * created from `PDFDocumentProxy.getOptionalContentConfig`. If `null`, + * the configuration will be fetched automatically with the default visibility + * states set. + * @property {Map} [annotationCanvasMap] - Map some + * annotation ids with canvases used to render them. + * @property {PrintAnnotationStorage} [printAnnotationStorage] + * @property {boolean} [isEditing] - Render the page in editing mode. + */ +/** + * Page getOperatorList parameters. + * + * @typedef {Object} GetOperatorListParameters + * @property {string} [intent] - Rendering intent, can be 'display', 'print', + * or 'any'. The default value is 'display'. + * @property {number} [annotationMode] Controls which annotations are included + * in the operatorList, for annotations with appearance-data; the values from + * {@link AnnotationMode} should be used. The following values are supported: + * - `AnnotationMode.DISABLE`, which disables all annotations. + * - `AnnotationMode.ENABLE`, which includes all possible annotations (thus + * it also depends on the `intent`-option, see above). + * - `AnnotationMode.ENABLE_FORMS`, which excludes annotations that contain + * interactive form elements (those will be rendered in the display layer). + * - `AnnotationMode.ENABLE_STORAGE`, which includes all possible annotations + * (as above) but where interactive form elements are updated with data + * from the {@link AnnotationStorage}-instance; useful e.g. for printing. + * The default value is `AnnotationMode.ENABLE`. + * @property {PrintAnnotationStorage} [printAnnotationStorage] + * @property {boolean} [isEditing] - Render the page in editing mode. + */ +/** + * Structure tree node. The root node will have a role "Root". + * + * @typedef {Object} StructTreeNode + * @property {Array} children - Array of + * {@link StructTreeNode} and {@link StructTreeContent} objects. + * @property {string} role - element's role, already mapped if a role map exists + * in the PDF. + */ +/** + * Structure tree content. + * + * @typedef {Object} StructTreeContent + * @property {string} type - either "content" for page and stream structure + * elements or "object" for object references. + * @property {string} id - unique id that will map to the text layer. + */ +/** + * PDF page operator list. + * + * @typedef {Object} PDFOperatorList + * @property {Array} fnArray - Array containing the operator functions. + * @property {Array} argsArray - Array containing the arguments of the + * functions. + */ +/** + * Proxy to a `PDFPage` in the worker thread. + */ +export class PDFPageProxy { + constructor(pageIndex: any, pageInfo: any, transport: any, pdfBug?: boolean); + _pageIndex: any; + _pageInfo: any; + _transport: any; + _stats: StatTimer | null; + _pdfBug: boolean; + /** @type {PDFObjects} */ + commonObjs: PDFObjects; + objs: PDFObjects; + _intentStates: Map; + destroyed: boolean; + /** + * @type {number} Page number of the page. First page is 1. + */ + get pageNumber(): number; + /** + * @type {number} The number of degrees the page is rotated clockwise. + */ + get rotate(): number; + /** + * @type {RefProxy | null} The reference that points to this page. + */ + get ref(): RefProxy | null; + /** + * @type {number} The default size of units in 1/72nds of an inch. + */ + get userUnit(): number; + /** + * @type {Array} An array of the visible portion of the PDF page in + * user space units [x1, y1, x2, y2]. + */ + get view(): Array; + /** + * @param {GetViewportParameters} params - Viewport parameters. + * @returns {PageViewport} Contains 'width' and 'height' properties + * along with transforms required for rendering. + */ + getViewport({ scale, rotation, offsetX, offsetY, dontFlip, }?: GetViewportParameters): PageViewport; + /** + * @param {GetAnnotationsParameters} [params] - Annotation parameters. + * @returns {Promise>} A promise that is resolved with an + * {Array} of the annotation objects. + */ + getAnnotations({ intent }?: GetAnnotationsParameters): Promise>; + /** + * @returns {Promise} A promise that is resolved with an + * {Object} with JS actions. + */ + getJSActions(): Promise; + /** + * @type {Object} The filter factory instance. + */ + get filterFactory(): Object; + /** + * @type {boolean} True if only XFA form. + */ + get isPureXfa(): boolean; + /** + * @returns {Promise} A promise that is resolved with + * an {Object} with a fake DOM object (a tree structure where elements + * are {Object} with a name, attributes (class, style, ...), value and + * children, very similar to a HTML DOM tree), or `null` if no XFA exists. + */ + getXfa(): Promise; + /** + * Begins the process of rendering a page to the desired context. + * + * @param {RenderParameters} params - Page render parameters. + * @returns {RenderTask} An object that contains a promise that is + * resolved when the page finishes rendering. + */ + render({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: RenderParameters): RenderTask; + /** + * @param {GetOperatorListParameters} params - Page getOperatorList + * parameters. + * @returns {Promise} A promise resolved with an + * {@link PDFOperatorList} object that represents the page's operator list. + */ + getOperatorList({ intent, annotationMode, printAnnotationStorage, isEditing, }?: GetOperatorListParameters): Promise; + /** + * NOTE: All occurrences of whitespace will be replaced by + * standard spaces (0x20). + * + * @param {getTextContentParameters} params - getTextContent parameters. + * @returns {ReadableStream} Stream for reading text content chunks. + */ + streamTextContent({ includeMarkedContent, disableNormalization, }?: getTextContentParameters): ReadableStream; + /** + * NOTE: All occurrences of whitespace will be replaced by + * standard spaces (0x20). + * + * @param {getTextContentParameters} params - getTextContent parameters. + * @returns {Promise} A promise that is resolved with a + * {@link TextContent} object that represents the page's text content. + */ + getTextContent(params?: getTextContentParameters): Promise; + /** + * @returns {Promise} A promise that is resolved with a + * {@link StructTreeNode} object that represents the page's structure tree, + * or `null` when no structure tree is present for the current page. + */ + getStructTree(): Promise; + /** + * Destroys the page object. + * @private + */ + private _destroy; + /** + * Cleans up resources allocated by the page. + * + * @param {boolean} [resetStats] - Reset page stats, if enabled. + * The default value is `false`. + * @returns {boolean} Indicates if clean-up was successfully run. + */ + cleanup(resetStats?: boolean): boolean; + /** + * @private + */ + private _startRenderPage; + /** + * @private + */ + private _renderPageChunk; + /** + * @private + */ + private _pumpOperatorList; + /** + * @private + */ + private _abortOperatorList; + /** + * @type {StatTimer | null} Returns page stats, if enabled; returns `null` + * otherwise. + */ + get stats(): StatTimer | null; + #private; +} +/** + * @typedef {Object} PDFWorkerParameters + * @property {string} [name] - The name of the worker. + * @property {Worker} [port] - The `workerPort` object. + * @property {number} [verbosity] - Controls the logging level; + * the constants from {@link VerbosityLevel} should be used. + */ +/** + * PDF.js web worker abstraction that controls the instantiation of PDF + * documents. Message handlers are used to pass information from the main + * thread to the worker thread and vice versa. If the creation of a web + * worker is not possible, a "fake" worker will be used instead. + * + * @param {PDFWorkerParameters} params - The worker initialization parameters. + */ +export class PDFWorker { + static "__#62@#fakeWorkerId": number; + static "__#62@#isWorkerDisabled": boolean; + static "__#62@#workerPorts": WeakMap; + /** + * @param {PDFWorkerParameters} params - The worker initialization parameters. + * @returns {PDFWorker} + */ + static create(params: PDFWorkerParameters): PDFWorker; + /** + * The current `workerSrc`, when it exists. + * @type {string} + */ + static get workerSrc(): string; + static get "__#62@#mainThreadWorkerMessageHandler"(): any; + static get _setupFakeWorkerGlobal(): any; + constructor({ name, port, verbosity, }?: { + name?: null | undefined; + port?: null | undefined; + verbosity?: number | undefined; + }); + name: any; + destroyed: boolean; + verbosity: number; + /** + * Promise for worker initialization completion. + * @type {Promise} + */ + get promise(): Promise; + /** + * The current `workerPort`, when it exists. + * @type {Worker} + */ + get port(): Worker; + /** + * The current MessageHandler-instance. + * @type {MessageHandler} + */ + get messageHandler(): MessageHandler; + /** + * Destroys the worker instance. + */ + destroy(): void; + #private; +} +/** + * Allows controlling of the rendering tasks. + */ +export class RenderTask { + constructor(internalRenderTask: any); + /** + * Callback for incremental rendering -- a function that will be called + * each time the rendering is paused. To continue rendering call the + * function that is the first argument to the callback. + * @type {function} + */ + onContinue: Function; + /** + * A function that will be synchronously called when the rendering tasks + * finishes with an error (either because of an actual error, or because the + * rendering is cancelled). + * + * @type {function} + * @param {Error} error + */ + onError: Function; + /** + * Promise for rendering task completion. + * @type {Promise} + */ + get promise(): Promise; + /** + * Cancels the rendering task. If the task is currently rendering it will + * not be cancelled until graphics pauses with a timeout. The promise that + * this object extends will be rejected when cancelled. + * + * @param {number} [extraDelay] + */ + cancel(extraDelay?: number): void; + /** + * Whether form fields are rendered separately from the main operatorList. + * @type {boolean} + */ + get separateAnnots(): boolean; + #private; +} +/** @type {string} */ +export const version: string; +import { PageViewport } from "./display_utils.js"; +import { OptionalContentConfig } from "./optional_content_config.js"; +import { PrintAnnotationStorage } from "./annotation_storage.js"; +import { AnnotationStorage } from "./annotation_storage.js"; +import { Metadata } from "./metadata.js"; +import { StatTimer } from "./display_utils.js"; +import { PDFObjects } from "./pdf_objects.js"; +import { MessageHandler } from "../shared/message_handler.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/api_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/api_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..84163238193229e5f23e747dfe5e29d7a8c2b5cc --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/api_utils.d.ts @@ -0,0 +1,13 @@ +export function getDataProp(val: any): Uint8Array; +export function getFactoryUrlProp(val: any): string | null; +export function getUrlProp(val: any): string | null; +export function isNameProxy(v: any): boolean; +export function isRefProxy(v: any): boolean; +export const isValidExplicitDest: (dest?: any) => boolean; +export class LoopbackPort { + postMessage(obj: any, transfer: any): void; + addEventListener(name: any, listener: any, options?: null): void; + removeEventListener(name: any, listener: any): void; + terminate(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/canvas.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/canvas.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8afc6db5149d1055548910c2d65e7d893c6fb90f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/canvas.d.ts @@ -0,0 +1,205 @@ +export class CanvasGraphics { + constructor(canvasCtx: any, commonObjs: any, objs: any, canvasFactory: any, filterFactory: any, { optionalContentConfig, markedContentStack }: { + optionalContentConfig: any; + markedContentStack?: null | undefined; + }, annotationCanvasMap: any, pageColors: any); + ctx: any; + current: CanvasExtraState; + stateStack: any[]; + pendingClip: {} | {} | null; + pendingEOFill: boolean; + res: any; + xobjs: any; + commonObjs: any; + objs: any; + canvasFactory: any; + filterFactory: any; + groupStack: any[]; + baseTransform: any; + baseTransformStack: any[]; + groupLevel: number; + smaskStack: any[]; + smaskCounter: number; + tempSMask: any; + suspendedCtx: any; + contentVisible: boolean; + markedContentStack: never[]; + optionalContentConfig: any; + cachedCanvases: CachedCanvases; + cachedPatterns: Map; + annotationCanvasMap: any; + viewportScale: number; + outputScaleX: number; + outputScaleY: number; + pageColors: any; + _cachedScaleForStroking: number[]; + _cachedGetSinglePixelWidth: number | null; + _cachedBitmapsMap: Map; + getObject(data: any, fallback?: null): any; + beginDrawing({ transform, viewport, transparency, background, }: { + transform: any; + viewport: any; + transparency?: boolean | undefined; + background?: null | undefined; + }): void; + compositeCtx: any; + transparentCanvas: any; + executeOperatorList(operatorList: any, executionStartIdx: any, continueCallback: any, stepper: any): any; + endDrawing(): void; + _scaleImage(img: any, inverseTransform: any): { + img: any; + paintWidth: any; + paintHeight: any; + }; + _createMaskCanvas(img: any): { + canvas: any; + offsetX: number; + offsetY: number; + }; + setLineWidth(width: any): void; + setLineCap(style: any): void; + setLineJoin(style: any): void; + setMiterLimit(limit: any): void; + setDash(dashArray: any, dashPhase: any): void; + setRenderingIntent(intent: any): void; + setFlatness(flatness: any): void; + setGState(states: any): void; + get inSMaskMode(): boolean; + checkSMaskState(): void; + /** + * Soft mask mode takes the current main drawing canvas and replaces it with + * a temporary canvas. Any drawing operations that happen on the temporary + * canvas need to be composed with the main canvas that was suspended (see + * `compose()`). The temporary canvas also duplicates many of its operations + * on the suspended canvas to keep them in sync, so that when the soft mask + * mode ends any clipping paths or transformations will still be active and in + * the right order on the canvas' graphics state stack. + */ + beginSMaskMode(): void; + endSMaskMode(): void; + compose(dirtyBox: any): void; + composeSMask(ctx: any, smask: any, layerCtx: any, layerBox: any): void; + genericComposeSMask(maskCtx: any, layerCtx: any, width: any, height: any, subtype: any, backdrop: any, transferMap: any, layerOffsetX: any, layerOffsetY: any, maskOffsetX: any, maskOffsetY: any): void; + save(): void; + restore(): void; + transform(a: any, b: any, c: any, d: any, e: any, f: any): void; + constructPath(op: any, data: any, minMax: any): void; + closePath(): void; + stroke(path: any, consumePath?: boolean): void; + closeStroke(path: any): void; + fill(path: any, consumePath?: boolean): void; + eoFill(path: any): void; + fillStroke(path: any): void; + eoFillStroke(path: any): void; + closeFillStroke(path: any): void; + closeEOFillStroke(path: any): void; + endPath(path: any): void; + rawFillPath(path: any): void; + clip(): void; + eoClip(): void; + beginText(): void; + endText(): void; + setCharSpacing(spacing: any): void; + setWordSpacing(spacing: any): void; + setHScale(scale: any): void; + setLeading(leading: any): void; + setFont(fontRefName: any, size: any): void; + setTextRenderingMode(mode: any): void; + setTextRise(rise: any): void; + moveText(x: any, y: any): void; + setLeadingMoveText(x: any, y: any): void; + setTextMatrix(matrix: any): void; + nextLine(): void; + paintChar(character: any, x: any, y: any, patternFillTransform: any, patternStrokeTransform: any): void; + get isFontSubpixelAAEnabled(): any; + showText(glyphs: any): void; + showType3Text(glyphs: any): void; + setCharWidth(xWidth: any, yWidth: any): void; + setCharWidthAndBounds(xWidth: any, yWidth: any, llx: any, lly: any, urx: any, ury: any): void; + getColorN_Pattern(IR: any): any; + setStrokeColorN(...args: any[]): void; + setFillColorN(...args: any[]): void; + setStrokeRGBColor(color: any): void; + setStrokeTransparent(): void; + setFillRGBColor(color: any): void; + setFillTransparent(): void; + _getPattern(objId: any, matrix?: null): any; + shadingFill(objId: any): void; + beginInlineImage(): void; + beginImageData(): void; + paintFormXObjectBegin(matrix: any, bbox: any): void; + paintFormXObjectEnd(): void; + beginGroup(group: any): void; + endGroup(group: any): void; + beginAnnotation(id: any, rect: any, transform: any, matrix: any, hasOwnCanvas: any): void; + annotationCanvas: any; + endAnnotation(): void; + paintImageMaskXObject(img: any): void; + paintImageMaskXObjectRepeat(img: any, scaleX: any, skewX: number | undefined, skewY: number | undefined, scaleY: any, positions: any): void; + paintImageMaskXObjectGroup(images: any): void; + paintImageXObject(objId: any): void; + paintImageXObjectRepeat(objId: any, scaleX: any, scaleY: any, positions: any): void; + applyTransferMapsToCanvas(ctx: any): any; + applyTransferMapsToBitmap(imgData: any): any; + paintInlineImageXObject(imgData: any): void; + paintInlineImageXObjectGroup(imgData: any, map: any): void; + paintSolidColorImageMask(): void; + markPoint(tag: any): void; + markPointProps(tag: any, properties: any): void; + beginMarkedContent(tag: any): void; + beginMarkedContentProps(tag: any, properties: any): void; + endMarkedContent(): void; + beginCompat(): void; + endCompat(): void; + consumePath(path: any, clipBox: any): void; + getSinglePixelWidth(): number; + getScaleForStroking(): number[]; + rescaleAndStroke(path: any, saveRestore: any): void; + isContentVisible(): boolean; + #private; +} +declare class CanvasExtraState { + constructor(width: any, height: any); + alphaIsShape: boolean; + fontSize: number; + fontSizeScale: number; + textMatrix: null; + textMatrixScale: number; + fontMatrix: number[]; + leading: number; + x: number; + y: number; + lineX: number; + lineY: number; + charSpacing: number; + wordSpacing: number; + textHScale: number; + textRenderingMode: number; + textRise: number; + fillColor: string; + strokeColor: string; + patternFill: boolean; + patternStroke: boolean; + fillAlpha: number; + strokeAlpha: number; + lineWidth: number; + activeSMask: null; + transferMaps: string; + clipBox: Float32Array; + minMax: Float32Array; + clone(): any; + getPathBoundingBox(pathType?: string, transform?: null): Float32Array; + updateClipFromPath(): void; + isEmptyClip(): boolean; + startNewPathAndClipBox(box: any): void; + getClippedPathBoundingBox(pathType?: string, transform?: null): number[] | null; +} +declare class CachedCanvases { + constructor(canvasFactory: any); + canvasFactory: any; + cache: any; + getCanvas(id: any, width: any, height: any): any; + delete(id: any): void; + clear(): void; +} +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/canvas_factory.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/canvas_factory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b3b23bef833e267ff079b238a144e6f056130156 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/canvas_factory.d.ts @@ -0,0 +1,27 @@ +export class BaseCanvasFactory { + constructor({ enableHWA }: { + enableHWA?: boolean | undefined; + }); + create(width: any, height: any): { + canvas: void; + context: any; + }; + reset(canvasAndContext: any, width: any, height: any): void; + destroy(canvasAndContext: any): void; + /** + * @ignore + */ + _createCanvas(width: any, height: any): void; + #private; +} +export class DOMCanvasFactory extends BaseCanvasFactory { + constructor({ ownerDocument, enableHWA }: { + ownerDocument?: Document | undefined; + enableHWA?: boolean | undefined; + }); + _document: Document; + /** + * @ignore + */ + _createCanvas(width: any, height: any): HTMLCanvasElement; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/cmap_reader_factory.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/cmap_reader_factory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..43e22e9554ee1e7449004ca62e87fe6c16008432 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/cmap_reader_factory.d.ts @@ -0,0 +1,25 @@ +export class BaseCMapReaderFactory { + constructor({ baseUrl, isCompressed }: { + baseUrl?: null | undefined; + isCompressed?: boolean | undefined; + }); + baseUrl: any; + isCompressed: boolean; + fetch({ name }: { + name: any; + }): Promise<{ + cMapData: Uint8Array; + isCompressed: boolean; + }>; + /** + * @ignore + * @returns {Promise} + */ + _fetch(url: any): Promise; +} +export class DOMCMapReaderFactory extends BaseCMapReaderFactory { + /** + * @ignore + */ + _fetch(url: any): Promise>; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/content_disposition.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/content_disposition.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d562c8934aec8158616af4e06841f2cfe60613f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/content_disposition.d.ts @@ -0,0 +1,7 @@ +/** + * Extract file name from the Content-Disposition HTTP response header. + * + * @param {string} contentDisposition + * @returns {string} Filename, if found in the Content-Disposition header. + */ +export function getFilenameFromContentDispositionHeader(contentDisposition: string): string; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/display_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/display_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5c8021c1ff99f81440c2db69502f0897bc25ba7b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/display_utils.d.ts @@ -0,0 +1,258 @@ +export type PageViewportParameters = { + /** + * - The xMin, yMin, xMax and + * yMax coordinates. + */ + viewBox: Array; + /** + * - The size of units. + */ + userUnit: number; + /** + * - The scale of the viewport. + */ + scale: number; + /** + * - The rotation, in degrees, of the viewport. + */ + rotation: number; + /** + * - The horizontal, i.e. x-axis, offset. The + * default value is `0`. + */ + offsetX?: number | undefined; + /** + * - The vertical, i.e. y-axis, offset. The + * default value is `0`. + */ + offsetY?: number | undefined; + /** + * - If true, the y-axis will not be flipped. + * The default value is `false`. + */ + dontFlip?: boolean | undefined; +}; +export type PageViewportCloneParameters = { + /** + * - The scale, overriding the one in the cloned + * viewport. The default value is `this.scale`. + */ + scale?: number | undefined; + /** + * - The rotation, in degrees, overriding the one + * in the cloned viewport. The default value is `this.rotation`. + */ + rotation?: number | undefined; + /** + * - The horizontal, i.e. x-axis, offset. + * The default value is `this.offsetX`. + */ + offsetX?: number | undefined; + /** + * - The vertical, i.e. y-axis, offset. + * The default value is `this.offsetY`. + */ + offsetY?: number | undefined; + /** + * - If true, the x-axis will not be flipped. + * The default value is `false`. + */ + dontFlip?: boolean | undefined; +}; +export function deprecated(details: any): void; +export function fetchData(url: any, type?: string): Promise; +export function getColorValues(colors: any): void; +export function getCurrentTransform(ctx: any): any[]; +export function getCurrentTransformInverse(ctx: any): any[]; +/** + * Gets the filename from a given URL. + * @param {string} url + * @returns {string} + */ +export function getFilenameFromUrl(url: string): string; +/** + * Returns the filename or guessed filename from the url (see issue 3455). + * @param {string} url - The original PDF location. + * @param {string} defaultFilename - The value returned if the filename is + * unknown, or the protocol is unsupported. + * @returns {string} Guessed PDF filename. + */ +export function getPdfFilenameFromUrl(url: string, defaultFilename?: string): string; +export function getRGB(color: any): any; +/** + * NOTE: This is (mostly) intended to support printing of XFA forms. + */ +export function getXfaPageViewport(xfaPage: any, { scale, rotation }: { + scale?: number | undefined; + rotation?: number | undefined; +}): PageViewport; +export function isDataScheme(url: any): boolean; +export function isPdfFile(filename: any): boolean; +export function isValidFetchUrl(url: any, baseUrl: any): boolean; +/** + * Event handler to suppress context menu. + */ +export function noContextMenu(e: any): void; +/** + * Scale factors for the canvas, necessary with HiDPI displays. + */ +export class OutputScale { + static get pixelRatio(): number; + static capPixels(maxPixels: any, capAreaFactor: any): any; + /** + * @type {number} Horizontal scale. + */ + sx: number; + /** + * @type {number} Vertical scale. + */ + sy: number; + /** + * @type {boolean} Returns `true` when scaling is required, `false` otherwise. + */ + get scaled(): boolean; + /** + * @type {boolean} Returns `true` when scaling is symmetric, + * `false` otherwise. + */ + get symmetric(): boolean; + /** + * @returns {boolean} Returns `true` if scaling was limited, + * `false` otherwise. + */ + limitCanvas(width: any, height: any, maxPixels: any, maxDim: any, capAreaFactor?: number): boolean; +} +/** + * @typedef {Object} PageViewportParameters + * @property {Array} viewBox - The xMin, yMin, xMax and + * yMax coordinates. + * @property {number} userUnit - The size of units. + * @property {number} scale - The scale of the viewport. + * @property {number} rotation - The rotation, in degrees, of the viewport. + * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. The + * default value is `0`. + * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. The + * default value is `0`. + * @property {boolean} [dontFlip] - If true, the y-axis will not be flipped. + * The default value is `false`. + */ +/** + * @typedef {Object} PageViewportCloneParameters + * @property {number} [scale] - The scale, overriding the one in the cloned + * viewport. The default value is `this.scale`. + * @property {number} [rotation] - The rotation, in degrees, overriding the one + * in the cloned viewport. The default value is `this.rotation`. + * @property {number} [offsetX] - The horizontal, i.e. x-axis, offset. + * The default value is `this.offsetX`. + * @property {number} [offsetY] - The vertical, i.e. y-axis, offset. + * The default value is `this.offsetY`. + * @property {boolean} [dontFlip] - If true, the x-axis will not be flipped. + * The default value is `false`. + */ +/** + * PDF page viewport created based on scale, rotation and offset. + */ +export class PageViewport { + /** + * @param {PageViewportParameters} + */ + constructor({ viewBox, userUnit, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters); + viewBox: number[]; + userUnit: number; + scale: number; + rotation: number; + offsetX: number; + offsetY: number; + transform: number[]; + width: number; + height: number; + /** + * The original, un-scaled, viewport dimensions. + * @type {Object} + */ + get rawDims(): Object; + /** + * Clones viewport, with optional additional properties. + * @param {PageViewportCloneParameters} [params] + * @returns {PageViewport} Cloned viewport. + */ + clone({ scale, rotation, offsetX, offsetY, dontFlip, }?: PageViewportCloneParameters): PageViewport; + /** + * Converts PDF point to the viewport coordinates. For examples, useful for + * converting PDF location into canvas pixel coordinates. + * @param {number} x - The x-coordinate. + * @param {number} y - The y-coordinate. + * @returns {Array} Array containing `x`- and `y`-coordinates of the + * point in the viewport coordinate space. + * @see {@link convertToPdfPoint} + * @see {@link convertToViewportRectangle} + */ + convertToViewportPoint(x: number, y: number): any[]; + /** + * Converts PDF rectangle to the viewport coordinates. + * @param {Array} rect - The xMin, yMin, xMax and yMax coordinates. + * @returns {Array} Array containing corresponding coordinates of the + * rectangle in the viewport coordinate space. + * @see {@link convertToViewportPoint} + */ + convertToViewportRectangle(rect: any[]): any[]; + /** + * Converts viewport coordinates to the PDF location. For examples, useful + * for converting canvas pixel location into PDF one. + * @param {number} x - The x-coordinate. + * @param {number} y - The y-coordinate. + * @returns {Array} Array containing `x`- and `y`-coordinates of the + * point in the PDF coordinate space. + * @see {@link convertToViewportPoint} + */ + convertToPdfPoint(x: number, y: number): any[]; +} +export class PDFDateString { + static "__#2@#regex": any; + /** + * Convert a PDF date string to a JavaScript `Date` object. + * + * The PDF date string format is described in section 7.9.4 of the official + * PDF 32000-1:2008 specification. However, in the PDF 1.7 reference (sixth + * edition) Adobe describes the same format including a trailing apostrophe. + * This syntax in incorrect, but Adobe Acrobat creates PDF files that contain + * them. We ignore all apostrophes as they are not necessary for date parsing. + * + * Moreover, Adobe Acrobat doesn't handle changing the date to universal time + * and doesn't use the user's time zone (effectively ignoring the HH' and mm' + * parts of the date string). + * + * @param {string} input + * @returns {Date|null} + */ + static toDateObject(input: string): Date | null; +} +export class PixelsPerInch { + static CSS: number; + static PDF: number; + static PDF_TO_CSS_UNITS: number; +} +declare const RenderingCancelledException_base: any; +export class RenderingCancelledException extends RenderingCancelledException_base { + [x: string]: any; + constructor(msg: any, extraDelay?: number); + extraDelay: number; +} +/** + * @param {HTMLDivElement} div + * @param {PageViewport} viewport + * @param {boolean} mustFlip + * @param {boolean} mustRotate + */ +export function setLayerDimensions(div: HTMLDivElement, viewport: PageViewport, mustFlip?: boolean, mustRotate?: boolean): void; +export class StatTimer { + started: any; + times: any[]; + time(name: any): void; + timeEnd(name: any): void; + toString(): string; +} +export function stopEvent(e: any): void; +export const SupportedImageMimeTypes: string[]; +export const SVG_NS: "http://www.w3.org/2000/svg"; +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/draw_layer.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/draw_layer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a1856d0cac7697cc65cbd975f178aa391d4763ec --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/draw_layer.d.ts @@ -0,0 +1,26 @@ +/** + * Manage the SVGs drawn on top of the page canvas. + * It's important to have them directly on top of the canvas because we want to + * be able to use mix-blend-mode for some of them. + */ +export class DrawLayer { + static "__#34@#id": number; + static get _svgFactory(): any; + static "__#34@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void; + constructor({ pageIndex }: { + pageIndex: any; + }); + pageIndex: any; + setParent(parent: any): void; + draw(properties: any, isPathUpdatable?: boolean, hasClip?: boolean): { + id: number; + clipPathId: string; + }; + drawOutline(properties: any, mustRemoveSelfIntersections: any): number; + finalizeDraw(id: any, properties: any): void; + updateProperties(elementOrId: any, properties: any): void; + updateParent(id: any, layer: any): void; + remove(id: any): void; + destroy(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/alt_text.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/alt_text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b116b0eedb69b881abcf0124aa2640e35703dc0a --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/alt_text.d.ts @@ -0,0 +1,34 @@ +export class AltText { + static "__#41@#l10nNewButton": null; + static _l10n: null; + static initialize(l10n: any): void; + constructor(editor: any); + render(): Promise; + finish(): void; + isEmpty(): boolean; + hasData(): boolean; + get guessedText(): null; + setGuessedText(guessedText: any): Promise; + toggleAltTextBadge(visibility?: boolean): void; + serialize(isForCopying: any): { + altText: null; + decorative: boolean; + guessedText: null; + textWithDisclaimer: null; + }; + /** + * Set the alt text data. + */ + set data({ altText, decorative, guessedText, textWithDisclaimer, cancel, }: { + altText: null; + decorative: boolean; + }); + get data(): { + altText: null; + decorative: boolean; + }; + toggle(enabled?: boolean): void; + shown(): void; + destroy(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/annotation_editor_layer.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/annotation_editor_layer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8ef2a2f519f0ad45bf07dadaaec5099a18ee24bd --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/annotation_editor_layer.d.ts @@ -0,0 +1,230 @@ +export type AnnotationEditorUIManager = import("./tools.js").AnnotationEditorUIManager; +export type PageViewport = import("../display_utils.js").PageViewport; +export type TextAccessibilityManager = import("../../../web/text_accessibility.js").TextAccessibilityManager; +export type IL10n = import("../../../web/interfaces").IL10n; +export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer; +export type DrawLayer = import("../draw_layer.js").DrawLayer; +export type StructTreeLayerBuilder = any; +export type AnnotationEditorLayerOptions = { + mode: Object; + div: HTMLDivElement; + structTreeLayer: StructTreeLayerBuilder; + uiManager: AnnotationEditorUIManager; + enabled: boolean; + accessibilityManager?: import("../../../web/text_accessibility.js").TextAccessibilityManager | undefined; + pageIndex: number; + l10n: IL10n; + annotationLayer?: import("../annotation_layer.js").AnnotationLayer | undefined; + textLayer?: HTMLDivElement | undefined; + drawLayer: DrawLayer; + viewport: PageViewport; +}; +export type RenderEditorLayerOptions = { + viewport: PageViewport; +}; +/** + * @typedef {Object} AnnotationEditorLayerOptions + * @property {Object} mode + * @property {HTMLDivElement} div + * @property {StructTreeLayerBuilder} structTreeLayer + * @property {AnnotationEditorUIManager} uiManager + * @property {boolean} enabled + * @property {TextAccessibilityManager} [accessibilityManager] + * @property {number} pageIndex + * @property {IL10n} l10n + * @property {AnnotationLayer} [annotationLayer] + * @property {HTMLDivElement} [textLayer] + * @property {DrawLayer} drawLayer + * @property {PageViewport} viewport + */ +/** + * @typedef {Object} RenderEditorLayerOptions + * @property {PageViewport} viewport + */ +/** + * Manage all the different editors on a page. + */ +export class AnnotationEditorLayer { + static _initialized: boolean; + static "__#35@#editorTypes": Map; + /** + * @param {AnnotationEditorLayerOptions} options + */ + constructor({ uiManager, pageIndex, div, structTreeLayer, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions); + pageIndex: number; + div: HTMLDivElement; + viewport: import("../display_utils.js").PageViewport; + drawLayer: import("../draw_layer.js").DrawLayer; + _structTree: any; + get isEmpty(): boolean; + get isInvisible(): boolean; + /** + * Update the toolbar if it's required to reflect the tool currently used. + * @param {Object} options + */ + updateToolbar(options: Object): void; + /** + * The mode has changed: it must be updated. + * @param {number} mode + */ + updateMode(mode?: number): void; + hasTextLayer(textLayer: any): boolean; + /** + * Set the editing state. + * @param {boolean} isEditing + */ + setEditingState(isEditing: boolean): void; + /** + * Add some commands into the CommandManager (undo/redo stuff). + * @param {Object} params + */ + addCommands(params: Object): void; + cleanUndoStack(type: any): void; + toggleDrawing(enabled?: boolean): void; + togglePointerEvents(enabled?: boolean): void; + toggleAnnotationLayerPointerEvents(enabled?: boolean): void; + /** + * Enable pointer events on the main div in order to enable + * editor creation. + */ + enable(): Promise; + /** + * Disable editor creation. + */ + disable(): void; + getEditableAnnotation(id: any): any; + /** + * Set the current editor. + * @param {AnnotationEditor} editor + */ + setActiveEditor(editor: AnnotationEditor): void; + enableTextSelection(): void; + disableTextSelection(): void; + enableClick(): void; + disableClick(): void; + attach(editor: any): void; + detach(editor: any): void; + /** + * Remove an editor. + * @param {AnnotationEditor} editor + */ + remove(editor: AnnotationEditor): void; + /** + * An editor can have a different parent, for example after having + * being dragged and dropped from a page to another. + * @param {AnnotationEditor} editor + */ + changeParent(editor: AnnotationEditor): void; + /** + * Add a new editor in the current view. + * @param {AnnotationEditor} editor + */ + add(editor: AnnotationEditor): void; + moveEditorInDOM(editor: any): void; + /** + * Add or rebuild depending if it has been removed or not. + * @param {AnnotationEditor} editor + */ + addOrRebuild(editor: AnnotationEditor): void; + /** + * Add a new editor and make this addition undoable. + * @param {AnnotationEditor} editor + */ + addUndoableEditor(editor: AnnotationEditor): void; + /** + * Get an id for an editor. + * @returns {string} + */ + getNextId(): string; + combinedSignal(ac: any): AbortSignal; + canCreateNewEmptyEditor(): boolean | undefined; + /** + * Paste some content into a new editor. + * @param {Object} options + * @param {Object} params + */ + pasteEditor(options: Object, params: Object): Promise; + /** + * Create a new editor + * @param {Object} data + * @returns {AnnotationEditor | null} + */ + deserialize(data: Object): AnnotationEditor | null; + /** + * Create and add a new editor. + * @param {PointerEvent} event + * @param {boolean} isCentered + * @param [Object] data + * @returns {AnnotationEditor} + */ + createAndAddNewEditor(event: PointerEvent, isCentered: boolean, data?: {}): AnnotationEditor; + /** + * Create and add a new editor. + */ + addNewEditor(data?: {}): void; + /** + * Set the last selected editor. + * @param {AnnotationEditor} editor + */ + setSelected(editor: AnnotationEditor): void; + /** + * Add or remove an editor the current selection. + * @param {AnnotationEditor} editor + */ + toggleSelected(editor: AnnotationEditor): void; + /** + * Unselect an editor. + * @param {AnnotationEditor} editor + */ + unselect(editor: AnnotationEditor): void; + /** + * Pointerup callback. + * @param {PointerEvent} event + */ + pointerup(event: PointerEvent): void; + /** + * Pointerdown callback. + * @param {PointerEvent} event + */ + pointerdown(event: PointerEvent): void; + startDrawingSession(event: any): void; + pause(on: any): void; + endDrawingSession(isAborted?: boolean): any; + /** + * + * @param {AnnotationEditor} editor + * @param {number} x + * @param {number} y + * @returns + */ + findNewParent(editor: AnnotationEditor, x: number, y: number): boolean; + commitOrRemove(): boolean; + onScaleChanging(): void; + /** + * Destroy the main editor. + */ + destroy(): void; + /** + * Render the main editor. + * @param {RenderEditorLayerOptions} parameters + */ + render({ viewport }: RenderEditorLayerOptions): void; + /** + * Update the main editor. + * @param {RenderEditorLayerOptions} parameters + */ + update({ viewport }: RenderEditorLayerOptions): void; + /** + * Get page dimensions. + * @returns {Object} dimensions. + */ + get pageDimensions(): Object; + get scale(): number; + #private; +} +import { AnnotationEditor } from "./editor.js"; +import { FreeTextEditor } from "./freetext.js"; +import { HighlightEditor } from "./highlight.js"; +import { InkEditor } from "./ink.js"; +import { SignatureEditor } from "./signature.js"; +import { StampEditor } from "./stamp.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/color_picker.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/color_picker.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4cbecd92ce5322fa473323e2c6e5962c9c9b35d --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/color_picker.d.ts @@ -0,0 +1,39 @@ +/** + * BasicColorPicker class provides a simple color picker. + * It displays an input element (with type="color") that allows the user + * to select a color for the annotation. + */ +export class BasicColorPicker { + static "__#6@#l10nColor": null; + constructor(editor: any); + renderButton(): HTMLInputElement; + update(value: any): void; + destroy(): void; + hideDropdown(): void; + #private; +} +/** + * ColorPicker class provides a color picker for the annotation editor. + * It displays a dropdown with some predefined colors and allows the user + * to select a color for the annotation. + */ +export class ColorPicker { + static "__#5@#l10nColor": null; + static get _keyboardManager(): any; + constructor({ editor, uiManager }: { + editor?: null | undefined; + uiManager?: null | undefined; + }); + renderButton(): HTMLButtonElement; + renderMainDropdown(): HTMLDivElement; + _colorSelectFromKeyboard(event: any): void; + _moveToNext(event: any): void; + _moveToPrevious(event: any): void; + _moveToBeginning(event: any): void; + _moveToEnd(event: any): void; + hideDropdown(): void; + _hideDropdownFromKeyboard(): void; + updateColor(color: any): void; + destroy(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/comment.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/comment.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..89c4f9e907c25aa8577e7c02b1bd1c3437215fbb --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/comment.d.ts @@ -0,0 +1,32 @@ +export class Comment { + constructor(editor: any); + toolbar: any; + render(): HTMLButtonElement | null; + edit(): void; + finish(): void; + isDeleted(): boolean; + hasBeenEdited(): boolean; + serialize(): { + text: null; + date: null; + deleted: boolean; + }; + /** + * Set the comment data. + */ + set data(text: { + text: null; + date: null; + deleted: boolean; + }); + get data(): { + text: null; + date: null; + deleted: boolean; + }; + setInitialText(text: any): void; + toggle(enabled?: boolean): void; + shown(): void; + destroy(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/draw.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/draw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1400854b3d5d34292fe13366a97913b00f59ae5b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/draw.d.ts @@ -0,0 +1,121 @@ +/** + * Basic draw editor. + */ +export class DrawingEditor extends AnnotationEditor { + static _currentDrawId: number; + static _currentParent: null; + static "__#27@#currentDraw": null; + static "__#27@#currentDrawingAC": null; + static "__#27@#currentDrawingOptions": null; + static "__#27@#currentPointerId": number; + static "__#27@#currentPointerType": null; + static "__#27@#currentPointerIds": null; + static "__#27@#currentMoveTimestamp": number; + static _INNER_MARGIN: number; + static _mergeSVGProperties(p1: any, p2: any): any; + /** + * @param {Object} options + * @return {DrawingOptions} the default options to use for a new editor. + */ + static getDefaultDrawingOptions(_options: any): DrawingOptions; + /** + * @return {Map} a map between the + * parameter types and the name of the options. + */ + static get typesMap(): Map<{ + RESIZE: number; + CREATE: number; + FREETEXT_SIZE: number; + FREETEXT_COLOR: number; + FREETEXT_OPACITY: number; + INK_COLOR: number; + INK_THICKNESS: number; + INK_OPACITY: number; + HIGHLIGHT_COLOR: number; + HIGHLIGHT_THICKNESS: number; + HIGHLIGHT_FREE: number; + HIGHLIGHT_SHOW_ALL: number; + DRAW_STEP: number; + }, string>; + /** + * @returns {boolean} `true` if several drawings can be added to the + * annotation. + */ + static get supportMultipleDrawings(): boolean; + /** @inheritdoc */ + static updateDefaultParams(type: any, value: any): void; + /** @inheritdoc */ + static get defaultPropertiesToUpdate(): any[][]; + static onScaleChangingWhenDrawing(): void; + /** + * Create a new drawer instance. + * @param {number} x - The x coordinate of the event. + * @param {number} y - The y coordinate of the event. + * @param {number} parentWidth - The parent width. + * @param {number} parentHeight - The parent height. + * @param {number} rotation - The parent rotation. + */ + static createDrawerInstance(_x: any, _y: any, _parentWidth: any, _parentHeight: any, _rotation: any): void; + static startDrawing(parent: any, uiManager: any, _isLTR: any, event: any): void; + static _drawMove(event: any): void; + static _cleanup(all: any): void; + static _endDraw(event: any): void; + static endDrawing(isAborted: any): any; + /** + * Deserialize the drawing outlines. + * @param {number} pageX - The x coordinate of the page. + * @param {number} pageY - The y coordinate of the page. + * @param {number} pageWidth - The width of the page. + * @param {number} pageHeight - The height of the page. + * @param {number} innerWidth - The inner width. + * @param {Object} data - The data to deserialize. + * @returns {Object} The deserialized outlines. + */ + static deserializeDraw(_pageX: any, _pageY: any, _pageWidth: any, _pageHeight: any, _innerWidth: any, _data: any): Object; + /** @inheritdoc */ + static deserialize(data: any, parent: any, uiManager: any): Promise; + constructor(params: any); + _colorPicker: null; + _drawId: null; + _addOutlines(params: any): void; + /** @inheritdoc */ + updateParams(type: any, value: any): void; + /** @inheritdoc */ + get propertiesToUpdate(): any[][]; + /** + * Update a property and make this action undoable. + * @param {string} color + */ + _updateProperty(type: any, name: any, value: any): void; + /** @inheritdoc */ + _onTranslating(_x: any, _y: any): void; + /** @inheritdoc */ + _onTranslated(): void; + /** @inheritdoc */ + onceAdded(focus: any): void; + /** @inheritdoc */ + rotate(): void; + onScaleChanging(): void; + /** + * Create the drawing options. + * @param {Object} _data + */ + createDrawingOptions(_data: Object): void; + serializeDraw(isForCopying: any): any; + /** @inheritdoc */ + renderAnnotationElement(annotation: any): null; + #private; +} +export class DrawingOptions { + updateProperty(name: any, value: any): void; + updateProperties(properties: any): void; + updateSVGProperty(name: any, value: any): void; + toSVGProperties(): { + root: any; + }; + reset(): void; + updateAll(options?: this): void; + clone(): void; + #private; +} +import { AnnotationEditor } from "./editor.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/contour.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/contour.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d03071fb016da74b87174ca6e27817009fd22d71 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/contour.d.ts @@ -0,0 +1,3 @@ +export class ContourDrawOutline extends InkDrawOutline { +} +import { InkDrawOutline } from "./inkdraw.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/freedraw.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/freedraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f9b5f6b986926b72e6896d689d4c45cf7d32fc4a --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/freedraw.d.ts @@ -0,0 +1,31 @@ +export class FreeDrawOutline extends Outline { + constructor(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any); + lastPoint: number[]; + serialize([blX, blY, trX, trY]: [any, any, any, any], rotation: any): { + outline: any[]; + points: any[][]; + }; + get box(): Float32Array; + newOutliner(point: any, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number): FreeDrawOutliner; + getNewOutline(thickness: any, innerMargin: any): FreeDrawOutline; + #private; +} +export class FreeDrawOutliner { + static "__#21@#MIN_DIST": number; + static "__#21@#MIN_DIFF": number; + static "__#21@#MIN": number; + constructor({ x, y }: { + x: any; + y: any; + }, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number); + isEmpty(): boolean; + add({ x, y }: { + x: any; + y: any; + }): boolean; + toSVGPath(): string; + newFreeDrawOutline(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any): FreeDrawOutline; + getOutlines(): FreeDrawOutline; + #private; +} +import { Outline } from "./outline.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/highlight.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/highlight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ab1f91ee1737c261320f5f74f8821947689d67e --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/highlight.d.ts @@ -0,0 +1,36 @@ +export class FreeHighlightOutliner extends FreeDrawOutliner { +} +export class HighlightOutliner { + /** + * Construct an outliner. + * @param {Array} boxes - An array of axis-aligned rectangles. + * @param {number} borderWidth - The width of the border of the boxes, it + * allows to make the boxes bigger (or smaller). + * @param {number} innerMargin - The margin between the boxes and the + * outlines. It's important to not have a null innerMargin when we want to + * draw the outline else the stroked outline could be clipped because of its + * width. + * @param {boolean} isLTR - true if we're in LTR mode. It's used to determine + * the last point of the boxes. + */ + constructor(boxes: Array, borderWidth?: number, innerMargin?: number, isLTR?: boolean); + getOutlines(): HighlightOutline; + #private; +} +import { FreeDrawOutliner } from "./freedraw.js"; +declare class HighlightOutline extends Outline { + constructor(outlines: any, box: any, lastPoint: any); + lastPoint: any; + /** + * Serialize the outlines into the PDF page coordinate system. + * @param {Array} _bbox - the bounding box of the annotation. + * @param {number} _rotation - the rotation of the annotation. + * @returns {Array>} + */ + serialize([blX, blY, trX, trY]: Array, _rotation: number): Array>; + get box(): any; + get classNamesForOutlining(): string[]; + #private; +} +import { Outline } from "./outline.js"; +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/inkdraw.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/inkdraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0565d2973feb939d462ed7c462de0bbb0eba773f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/inkdraw.d.ts @@ -0,0 +1,129 @@ +export class InkDrawOutline extends Outline { + static deserialize(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, { paths: { lines, points }, rotation, thickness }: { + paths: { + lines: any; + points: any; + }; + rotation: any; + thickness: any; + }): any; + build(lines: any, parentWidth: any, parentHeight: any, parentScale: any, rotation: any, thickness: any, innerMargin: any): void; + get thickness(): any; + setLastElement(element: any): { + path: { + d: string; + }; + }; + removeLastElement(): { + path: { + d: string; + }; + }; + serialize([pageX, pageY, pageWidth, pageHeight]: [any, any, any, any], isForCopying: any): { + lines: any[]; + points: any[]; + rect: any[]; + }; + get box(): any; + updateProperty(name: any, value: any): any; + updateParentDimensions([width, height]: [any, any], scale: any): any; + updateRotation(rotation: any): { + path: { + transform: string; + }; + }; + get viewBox(): any; + get defaultProperties(): { + root: { + viewBox: any; + }; + path: { + "transform-origin": string; + }; + }; + get rotationTransform(): string; + getPathResizingSVGProperties([newX, newY, newWidth, newHeight]: [any, any, any, any]): { + path: { + "transform-origin": string; + transform: string; + }; + }; + getPathResizedSVGProperties([newX, newY, newWidth, newHeight]: [any, any, any, any]): { + root: { + viewBox: any; + }; + path: { + "transform-origin": string; + transform: string | null; + d: string; + }; + }; + getPathTranslatedSVGProperties([newX, newY]: [any, any], parentDimensions: any): { + root: { + viewBox: any; + }; + path: { + d: string; + "transform-origin": string; + }; + }; + get defaultSVGProperties(): { + root: { + viewBox: any; + }; + rootClass: { + draw: boolean; + }; + path: { + d: string; + "transform-origin": string; + transform: string | null; + }; + bbox: any; + }; + #private; +} +export class InkDrawOutliner { + constructor(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any, thickness: any); + updateProperty(name: any, value: any): void; + isEmpty(): boolean; + isCancellable(): boolean; + add(x: any, y: any): { + path: { + d: string; + }; + } | null; + end(x: any, y: any): { + path: { + d: string; + }; + } | null; + startNew(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): null; + getLastElement(): { + line: any[]; + points: any[]; + } | undefined; + setLastElement(element: any): { + path: { + d: string; + }; + }; + removeLastElement(): { + path: { + d: string; + }; + }; + toSVGPath(): string; + getOutlines(parentWidth: any, parentHeight: any, scale: any, innerMargin: any): InkDrawOutline; + get defaultSVGProperties(): { + root: { + viewBox: string; + }; + rootClass: { + draw: boolean; + }; + bbox: number[]; + }; + #private; +} +import { Outline } from "./outline.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/outline.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/outline.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f1d20c8927d6e5a7f0118fcee5639c33a204ec94 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/outline.d.ts @@ -0,0 +1,19 @@ +export class Outline { + static PRECISION: number; + static _rescale(src: any, tx: any, ty: any, sx: any, sy: any, dest: any): any; + static _rescaleAndSwap(src: any, tx: any, ty: any, sx: any, sy: any, dest: any): any; + static _translate(src: any, tx: any, ty: any, dest: any): any; + static svgRound(x: any): number; + static _normalizePoint(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): number[]; + static _normalizePagePoint(x: any, y: any, rotation: any): any[]; + static createBezierPoints(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): number[]; + /** + * @returns {string} The SVG path of the outline. + */ + toSVGPath(): string; + /** + * @type {Object|null} The bounding box of the outline. + */ + get box(): Object | null; + serialize(_bbox: any, _rotation: any): void; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/signaturedraw.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/signaturedraw.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5cb1abc69c3a8872c35b9c22e7a141d8cf57d081 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/drawers/signaturedraw.d.ts @@ -0,0 +1,79 @@ +/** + * Basic text editor in order to create a Signature annotation. + */ +export class SignatureExtractor { + static "__#31@#PARAMETERS": { + maxDim: number; + sigmaSFactor: number; + sigmaR: number; + kernelSize: number; + }; + static "__#31@#neighborIndexToId"(i0: any, j0: any, i: any, j: any): any; + static "__#31@#neighborIdToIndex": Int32Array; + static "__#31@#clockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number; + static "__#31@#counterClockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number; + static "__#31@#findContours"(buf: any, width: any, height: any, threshold: any): { + isHole: boolean; + points: number[]; + id: number; + parent: number; + }[]; + static "__#31@#douglasPeuckerHelper"(points: any, start: any, end: any, output: any): void; + static "__#31@#douglasPeucker"(points: any): any[] | null; + static "__#31@#bilateralFilter"(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array | Uint8Array)[]; + static "__#31@#getHistogram"(buf: any): Uint32Array; + static "__#31@#toUint8"(buf: any): Uint8ClampedArray; + static "__#31@#guessThreshold"(histogram: any): number; + static "__#31@#getGrayPixels"(bitmap: any): any[]; + static extractContoursFromText(text: any, { fontFamily, fontStyle, fontWeight }: { + fontFamily: any; + fontStyle: any; + fontWeight: any; + }, pageWidth: any, pageHeight: any, rotation: any, innerMargin: any): { + outline: InkDrawOutline; + newCurves: any[]; + areContours: any; + thickness: any; + width: any; + height: any; + } | null; + static process(bitmap: any, pageWidth: any, pageHeight: any, rotation: any, innerMargin: any): { + outline: InkDrawOutline; + newCurves: any[]; + areContours: any; + thickness: any; + width: any; + height: any; + } | null; + static processDrawnLines({ lines, pageWidth, pageHeight, rotation, innerMargin, mustSmooth, areContours, }: { + lines: any; + pageWidth: any; + pageHeight: any; + rotation: any; + innerMargin: any; + mustSmooth: any; + areContours: any; + }): { + outline: InkDrawOutline; + newCurves: any[]; + areContours: any; + thickness: any; + width: any; + height: any; + } | null; + static compressSignature({ outlines, areContours, thickness, width, height, }: { + outlines: any; + areContours: any; + thickness: any; + width: any; + height: any; + }): Promise; + static decompressSignature(signatureData: any): Promise<{ + areContours: boolean; + thickness: number; + outlines: Float32Array[]; + width: number; + height: number; + } | null>; +} +import { InkDrawOutline } from "./inkdraw.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/editor.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/editor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..55a90d955288d04327eb8d28b42cdd8274c5412f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/editor.d.ts @@ -0,0 +1,517 @@ +export type AnnotationEditorLayer = import("./annotation_editor_layer.js").AnnotationEditorLayer; +export type AnnotationEditorParameters = { + /** + * - the global manager + */ + uiManager: AnnotationEditorUIManager; + /** + * - the layer containing this editor + */ + parent: AnnotationEditorLayer; + /** + * - editor id + */ + id: string; + /** + * - x-coordinate + */ + x: number; + /** + * - y-coordinate + */ + y: number; +}; +/** + * @typedef {Object} AnnotationEditorParameters + * @property {AnnotationEditorUIManager} uiManager - the global manager + * @property {AnnotationEditorLayer} parent - the layer containing this editor + * @property {string} id - editor id + * @property {number} x - x-coordinate + * @property {number} y - y-coordinate + */ +/** + * Base class for editors. + */ +export class AnnotationEditor { + static _l10n: null; + static _l10nResizer: null; + static _borderLineWidth: number; + static _colorManager: ColorManager; + static _zIndex: number; + static _telemetryTimeout: number; + static get _resizerKeyboardManager(): any; + static get isDrawer(): boolean; + static get _defaultLineColor(): any; + static deleteAnnotationElement(editor: any): void; + /** + * Initialize the l10n stuff for this type of editor. + * @param {Object} l10n + */ + static initialize(l10n: Object, _uiManager: any): void; + /** + * Update the default parameters for this type of editor. + * @param {number} _type + * @param {*} _value + */ + static updateDefaultParams(_type: number, _value: any): void; + /** + * Get the default properties to set in the UI for this type of editor. + * @returns {Array} + */ + static get defaultPropertiesToUpdate(): any[]; + /** + * Check if this kind of editor is able to handle the given mime type for + * pasting. + * @param {string} mime + * @returns {boolean} + */ + static isHandlingMimeForPasting(mime: string): boolean; + /** + * Extract the data from the clipboard item and delegate the creation of the + * editor to the parent. + * @param {DataTransferItem} item + * @param {AnnotationEditorLayer} parent + */ + static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void; + static "__#44@#rotatePoint"(x: any, y: any, angle: any): any[]; + static _round(x: any): number; + /** + * Deserialize the editor. + * The result of the deserialization is a new editor. + * + * @param {Object} data + * @param {AnnotationEditorLayer} parent + * @param {AnnotationEditorUIManager} uiManager + * @returns {Promise} + */ + static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): Promise; + static get MIN_SIZE(): number; + static canCreateNewEmptyEditor(): boolean; + /** + * @param {AnnotationEditorParameters} parameters + */ + constructor(parameters: AnnotationEditorParameters); + isSelected: boolean; + _isCopy: boolean; + _editToolbar: null; + _initialOptions: any; + _initialData: null; + _isVisible: boolean; + _uiManager: null; + _focusEventsAllowed: boolean; + parent: import("./annotation_editor_layer.js").AnnotationEditorLayer; + id: string; + width: any; + height: any; + pageIndex: number; + name: any; + div: HTMLDivElement | null; + annotationElementId: any; + _willKeepAspectRatio: boolean; + _structTreeParentId: any; + rotation: number; + pageRotation: number; + pageDimensions: any[]; + pageTranslation: any[]; + x: number; + y: number; + isAttachedToDOM: boolean; + deleted: boolean; + get editorType(): any; + get mode(): any; + /** + * Get the properties to update in the UI for this editor. + * @returns {Array} + */ + get propertiesToUpdate(): any[]; + set _isDraggable(value: boolean); + get _isDraggable(): boolean; + /** + * @returns {boolean} true if the editor handles the Enter key itself. + */ + get isEnterHandled(): boolean; + center(): void; + /** + * Add some commands into the CommandManager (undo/redo stuff). + * @param {Object} params + */ + addCommands(params: Object): void; + get currentLayer(): any; + /** + * This editor will be behind the others. + */ + setInBackground(): void; + /** + * This editor will be in the foreground. + */ + setInForeground(): void; + setParent(parent: any): void; + /** + * onfocus callback. + */ + focusin(event: any): void; + /** + * onblur callback. + * @param {FocusEvent} event + */ + focusout(event: FocusEvent): void; + commitOrRemove(): void; + /** + * Commit the data contained in this editor. + */ + commit(): void; + addToAnnotationStorage(): void; + /** + * Set the editor position within its parent. + * @param {number} x + * @param {number} y + * @param {number} tx - x-translation in screen coordinates. + * @param {number} ty - y-translation in screen coordinates. + */ + setAt(x: number, y: number, tx: number, ty: number): void; + _moveAfterPaste(baseX: any, baseY: any): void; + /** + * Translate the editor position within its parent. + * @param {number} x - x-translation in screen coordinates. + * @param {number} y - y-translation in screen coordinates. + */ + translate(x: number, y: number): void; + /** + * Translate the editor position within its page and adjust the scroll + * in order to have the editor in the view. + * @param {number} x - x-translation in page coordinates. + * @param {number} y - y-translation in page coordinates. + */ + translateInPage(x: number, y: number): void; + translationDone(): void; + drag(tx: any, ty: any): void; + /** + * Called when the editor is being translated. + * @param {number} x - in page coordinates. + * @param {number} y - in page coordinates. + */ + _onTranslating(x: number, y: number): void; + /** + * Called when the editor has been translated. + * @param {number} x - in page coordinates. + * @param {number} y - in page coordinates. + */ + _onTranslated(x: number, y: number): void; + get _hasBeenMoved(): boolean; + get _hasBeenResized(): boolean; + /** + * Get the translation to take into account the editor border. + * The CSS engine positions the element by taking the border into account so + * we must apply the opposite translation to have the editor in the right + * position. + * @returns {Array} + */ + getBaseTranslation(): Array; + /** + * @returns {boolean} true if position must be fixed (i.e. make the x and y + * living in the page). + */ + get _mustFixPosition(): boolean; + /** + * Fix the position of the editor in order to keep it inside its parent page. + * @param {number} [rotation] - the rotation of the page. + */ + fixAndSetPosition(rotation?: number): void; + /** + * Convert a screen translation into a page one. + * @param {number} x + * @param {number} y + */ + screenToPageTranslation(x: number, y: number): any[]; + /** + * Convert a page translation into a screen one. + * @param {number} x + * @param {number} y + */ + pageTranslationToScreen(x: number, y: number): any[]; + get parentScale(): any; + get parentRotation(): number; + get parentDimensions(): number[]; + /** + * Set the dimensions of this editor. + * @param {number} width + * @param {number} height + */ + setDims(width: number, height: number): void; + fixDims(): void; + /** + * Get the translation used to position this editor when it's created. + * @returns {Array} + */ + getInitialTranslation(): Array; + /** + * Called when the editor has been resized. + */ + _onResized(): void; + /** + * Called when the editor is being resized. + */ + _onResizing(): void; + /** + * Called when the alt text dialog is closed. + */ + altTextFinish(): void; + /** + * Get the toolbar buttons for this editor. + * @returns {Array>|null} + */ + get toolbarButtons(): Array> | null; + /** + * Add a toolbar for this editor. + * @returns {Promise} + */ + addEditToolbar(): Promise; + removeEditToolbar(): void; + addContainer(container: any): void; + getClientDimensions(): DOMRect; + /** + * Create the alt text for this editor. + * @returns {object} + */ + createAltText(): object; + /** + * Set the alt text data. + */ + set altTextData(data: any); + get altTextData(): any; + get guessedAltText(): any; + setGuessedAltText(text: any): Promise; + serializeAltText(isForCopying: any): any; + hasAltText(): boolean; + hasAltTextData(): any; + addCommentButton(): Comment; + get commentColor(): null; + set comment(text: { + text: any; + date: any; + deleted: any; + color: null; + }); + get comment(): { + text: any; + date: any; + deleted: any; + color: null; + }; + setCommentData(text: any): void; + get hasEditedComment(): any; + editComment(): Promise; + addComment(serialized: any): void; + /** + * Render this editor in a div. + * @returns {HTMLDivElement | null} + */ + render(): HTMLDivElement | null; + /** + * Onpointerdown callback. + * @param {PointerEvent} event + */ + pointerdown(event: PointerEvent): void; + _onStartDragging(): void; + _onStopDragging(): void; + moveInDOM(): void; + _setParentAndPosition(parent: any, x: any, y: any): void; + /** + * Convert the current rect into a page one. + * @param {number} tx - x-translation in screen coordinates. + * @param {number} ty - y-translation in screen coordinates. + * @param {number} [rotation] - the rotation of the page. + */ + getRect(tx: number, ty: number, rotation?: number): any[]; + getRectInCurrentCoords(rect: any, pageHeight: any): any[]; + /** + * Executed once this editor has been rendered. + * @param {boolean} focus - true if the editor should be focused. + */ + onceAdded(focus: boolean): void; + /** + * Check if the editor contains something. + * @returns {boolean} + */ + isEmpty(): boolean; + /** + * Enable edit mode. + * @returns {boolean} - true if the edit mode has been enabled. + */ + enableEditMode(): boolean; + /** + * Disable edit mode. + * @returns {boolean} - true if the edit mode has been disabled. + */ + disableEditMode(): boolean; + /** + * Check if the editor is edited. + * @returns {boolean} + */ + isInEditMode(): boolean; + /** + * If it returns true, then this editor handles the keyboard + * events itself. + * @returns {boolean} + */ + shouldGetKeyboardEvents(): boolean; + /** + * Check if this editor needs to be rebuilt or not. + * @returns {boolean} + */ + needsToBeRebuilt(): boolean; + get isOnScreen(): boolean; + /** + * Rebuild the editor in case it has been removed on undo. + * + * To implement in subclasses. + */ + rebuild(): void; + /** + * Rotate the editor when the page is rotated. + * @param {number} angle + */ + rotate(_angle: any): void; + /** + * Resize the editor when the page is resized. + */ + resize(): void; + /** + * Serialize the editor when it has been deleted. + * @returns {Object} + */ + serializeDeleted(): Object; + /** + * Serialize the editor. + * The result of the serialization will be used to construct a + * new annotation to add to the pdf document. + * + * To implement in subclasses. + * @param {boolean} [isForCopying] + * @param {Object | null} [context] + * @returns {Object | null} + */ + serialize(isForCopying?: boolean, context?: Object | null): Object | null; + /** + * Check if an existing annotation associated with this editor has been + * modified. + * @returns {boolean} + */ + get hasBeenModified(): boolean; + /** + * Remove this editor. + * It's used on ctrl+backspace action. + */ + remove(): void; + /** + * @returns {boolean} true if this editor can be resized. + */ + get isResizable(): boolean; + /** + * Add the resizers to this editor. + */ + makeResizable(): void; + get toolbarPosition(): null; + /** + * onkeydown callback. + * @param {KeyboardEvent} event + */ + keydown(event: KeyboardEvent): void; + _resizeWithKeyboard(x: any, y: any): void; + _stopResizingWithKeyboard(): void; + /** + * Select this editor. + */ + select(): void; + /** + * Unselect this editor. + */ + unselect(): void; + /** + * Update some parameters which have been changed through the UI. + * @param {number} type + * @param {*} value + */ + updateParams(type: number, value: any): void; + /** + * When the user disables the editing mode some editors can change some of + * their properties. + */ + disableEditing(): void; + /** + * When the user enables the editing mode some editors can change some of + * their properties. + */ + enableEditing(): void; + /** + * Check if the content of this editor can be changed. + * For example, a FreeText editor can be changed (the user can change the + * text), but a Stamp editor cannot. + * @returns {boolean} + */ + get canChangeContent(): boolean; + /** + * The editor is about to be edited. + */ + enterInEditMode(): void; + /** + * ondblclick callback. + * @param {MouseEvent} event + */ + dblclick(event: MouseEvent): void; + /** + * @returns {HTMLElement | null} the element requiring an alt text. + */ + getElementForAltText(): HTMLElement | null; + /** + * Get the div which really contains the displayed content. + * @returns {HTMLDivElement | undefined} + */ + get contentDiv(): HTMLDivElement | undefined; + /** + * When set to true, it means that this editor is currently edited. + * @param {boolean} value + */ + set isEditing(value: boolean); + /** + * If true then the editor is currently edited. + * @type {boolean} + */ + get isEditing(): boolean; + /** + * Set the aspect ratio to use when resizing. + * @param {number} width + * @param {number} height + */ + setAspectRatio(width: number, height: number): void; + /** + * Get the data to report to the telemetry when the editor is added. + * @returns {Object} + */ + get telemetryInitialData(): Object; + /** + * The telemetry data to use when saving/printing. + * @returns {Object|null} + */ + get telemetryFinalData(): Object | null; + _reportTelemetry(data: any, mustWait?: boolean): void; + /** + * Show or hide this editor. + * @param {boolean|undefined} visible + */ + show(visible?: boolean | undefined): void; + enable(): void; + disable(): void; + /** + * Render an annotation in the annotation layer. + * @param {Object} annotation + * @returns {HTMLElement|null} + */ + renderAnnotationElement(annotation: Object): HTMLElement | null; + resetAnnotationElement(annotation: any): void; + #private; +} +import { AnnotationEditorUIManager } from "./tools.js"; +import { EditorToolbar } from "./toolbar.js"; +import { Comment } from "./comment.js"; +import { ColorManager } from "./tools.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/freetext.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/freetext.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e3303729f6ddf5c5914878572ffd252b331bfacc --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/freetext.d.ts @@ -0,0 +1,61 @@ +export type AnnotationEditorLayer = import("./annotation_editor_layer.js").AnnotationEditorLayer; +/** + * Basic text editor in order to create a FreeTex annotation. + */ +export class FreeTextEditor extends AnnotationEditor { + static _freeTextDefaultContent: string; + static _internalPadding: number; + static _defaultColor: null; + static _defaultFontSize: number; + static get _keyboardManager(): any; + static _type: string; + static _editorType: number; + /** @inheritdoc */ + static initialize(l10n: any, uiManager: any): void; + /** @inheritdoc */ + static updateDefaultParams(type: any, value: any): void; + /** @inheritdoc */ + static get defaultPropertiesToUpdate(): any[][]; + static "__#20@#getNodeContent"(node: any): any; + static "__#20@#deserializeContent"(content: any): any; + /** @inheritdoc */ + static deserialize(data: any, parent: any, uiManager: any): Promise; + constructor(params: any); + _colorPicker: null; + /** @inheritdoc */ + updateParams(type: any, value: any): void; + /** @inheritdoc */ + get propertiesToUpdate(): any[][]; + /** @inheritdoc */ + get toolbarButtons(): (string | null)[][]; + get colorType(): number; + get colorValue(): any; + /** + * Helper to translate the editor with the keyboard when it's empty. + * @param {number} x in page units. + * @param {number} y in page units. + */ + _translateEmpty(x: number, y: number): void; + /** @inheritdoc */ + onceAdded(focus: any): void; + /** + * Commit the content we have in this editor. + * @returns {undefined} + */ + commit(): undefined; + /** @inheritdoc */ + keydown(event: any): void; + editorDivKeydown(event: any): void; + editorDivFocus(event: any): void; + editorDivBlur(event: any): void; + editorDivInput(event: any): void; + editorDiv: HTMLDivElement | undefined; + overlayDiv: HTMLDivElement | undefined; + editorDivPaste(event: any): void; + /** @inheritdoc */ + serialize(isForCopying?: boolean): Object | null; + /** @inheritdoc */ + renderAnnotationElement(annotation: any): HTMLElement | null; + #private; +} +import { AnnotationEditor } from "./editor.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/highlight.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/highlight.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..95866ef8e5efb9480ab5e25b0000b8bee11bf1b1 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/highlight.d.ts @@ -0,0 +1,74 @@ +/** + * Basic draw editor in order to generate an Highlight annotation. + */ +export class HighlightEditor extends AnnotationEditor { + static _defaultColor: null; + static _defaultOpacity: number; + static _defaultThickness: number; + static _type: string; + static _editorType: number; + static _freeHighlightId: number; + static _freeHighlight: null; + static _freeHighlightClipId: string; + static get _keyboardManager(): any; + static computeTelemetryFinalData(data: any): { + numberOfColors: any; + }; + /** @inheritdoc */ + static initialize(l10n: any, uiManager: any): void; + /** @inheritdoc */ + static updateDefaultParams(type: any, value: any): void; + static get defaultPropertiesToUpdate(): (number | null)[][]; + static "__#25@#rotateBbox"([x, y, width, height]: [any, any, any, any], angle: any): any[]; + static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: { + target: any; + x: any; + y: any; + }): void; + static "__#25@#highlightMove"(parent: any, event: any): void; + static "__#25@#endHighlight"(parent: any, event: any): void; + /** @inheritdoc */ + static deserialize(data: any, parent: any, uiManager: any): Promise; + constructor(params: any); + color: any; + defaultL10nId: string; + /** @inheritdoc */ + get telemetryInitialData(): { + action: string; + type: string; + color: any; + thickness: any; + methodOfCreation: string; + }; + /** @inheritdoc */ + get telemetryFinalData(): { + type: string; + color: any; + }; + get commentColor(): any; + /** @inheritdoc */ + translateInPage(x: any, y: any): void; + /** @inheritdoc */ + updateParams(type: any, value: any): void; + /** @inheritdoc */ + get propertiesToUpdate(): any[][]; + /** @inheritdoc */ + get toolbarButtons(): any; + /** @inheritdoc */ + fixAndSetPosition(): void; + /** @inheritdoc */ + getRect(tx: any, ty: any): any[]; + /** @inheritdoc */ + onceAdded(focus: any): void; + /** @inheritdoc */ + rotate(angle: any): void; + pointerover(): void; + pointerleave(): void; + _moveCaret(direction: any): void; + /** @inheritdoc */ + serialize(isForCopying?: boolean): Object | null; + /** @inheritdoc */ + renderAnnotationElement(annotation: any): null; + #private; +} +import { AnnotationEditor } from "./editor.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/ink.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/ink.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..806eefd33026b68ab1e5bba584b4b6acba7b747b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/ink.d.ts @@ -0,0 +1,41 @@ +export class InkDrawingOptions extends DrawingOptions { + constructor(viewerParameters: any); + _viewParameters: any; + clone(): InkDrawingOptions; +} +/** + * Basic draw editor in order to generate an Ink annotation. + */ +export class InkEditor extends DrawingEditor { + static _type: string; + static _editorType: number; + static _defaultDrawingOptions: null; + /** @inheritdoc */ + static initialize(l10n: any, uiManager: any): void; + /** @inheritdoc */ + static getDefaultDrawingOptions(options: any): any; + /** @inheritdoc */ + static get typesMap(): any; + /** @inheritdoc */ + static createDrawerInstance(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): InkDrawOutliner; + /** @inheritdoc */ + static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any; + defaultL10nId: string; + /** @inheritdoc */ + get toolbarButtons(): (string | null)[][]; + get colorType(): number; + get colorValue(): any; + /** @inheritdoc */ + createDrawingOptions({ color, thickness, opacity }: { + color: any; + thickness: any; + opacity: any; + }): void; + _drawingOptions: any; + /** @inheritdoc */ + serialize(isForCopying?: boolean): Object | null; + #private; +} +import { DrawingOptions } from "./draw.js"; +import { DrawingEditor } from "./draw.js"; +import { InkDrawOutliner } from "./drawers/inkdraw.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/signature.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/signature.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..90c94300fea01d4aa134586a0a743a956aa519d0 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/signature.d.ts @@ -0,0 +1,82 @@ +/** + * Basic editor in order to generate an Stamp annotation annotation containing + * a signature drawing. + */ +export class SignatureEditor extends DrawingEditor { + static _type: string; + static _editorType: number; + static _defaultDrawingOptions: null; + /** @inheritdoc */ + static initialize(l10n: any, uiManager: any): void; + /** @inheritdoc */ + static getDefaultDrawingOptions(options: any): any; + static get typesMap(): any; + static computeTelemetryFinalData(data: any): { + hasAltText: any; + hasNoAltText: any; + }; + /** @inheritdoc */ + static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any; + defaultL10nId: string; + /** @inheritdoc */ + get telemetryFinalData(): { + type: string; + hasDescription: boolean; + }; + setUuid(uuid: any): void; + getUuid(): null; + set description(description: null); + get description(): null; + getSignaturePreview(): { + areContours: any; + outline: InkDrawOutline; + }; + /** @inheritdoc */ + get toolbarButtons(): any[][] | null; + addSignature(data: any, heightInPage: any, description: any, uuid: any): void; + getFromImage(bitmap: any): { + outline: InkDrawOutline; + newCurves: any[]; + areContours: any; + thickness: any; + width: any; + height: any; + } | null; + getFromText(text: any, fontInfo: any): { + outline: InkDrawOutline; + newCurves: any[]; + areContours: any; + thickness: any; + width: any; + height: any; + } | null; + getDrawnSignature(curves: any): { + outline: InkDrawOutline; + newCurves: any[]; + areContours: any; + thickness: any; + width: any; + height: any; + } | null; + /** @inheritdoc */ + createDrawingOptions({ areContours, thickness }: { + areContours: any; + thickness: any; + }): void; + _drawingOptions: any; + /** @inheritdoc */ + serialize(isForCopying?: boolean): { + annotationType: number; + isSignature: boolean; + areContours: boolean; + color: number[]; + thickness: any; + pageIndex: number; + rect: any; + rotation: number; + structTreeParentId: any; + } | null; + #private; +} +import { DrawingEditor } from "./draw.js"; +import { InkDrawOutline } from "./drawers/inkdraw.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/stamp.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/stamp.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c73635713a5f5f691c0961f41da7fdaeab5b1323 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/stamp.d.ts @@ -0,0 +1,49 @@ +/** + * Basic text editor in order to create a FreeTex annotation. + */ +export class StampEditor extends AnnotationEditor { + static _type: string; + static _editorType: number; + /** @inheritdoc */ + static initialize(l10n: any, uiManager: any): void; + /** @inheritdoc */ + static isHandlingMimeForPasting(mime: any): boolean; + /** @inheritdoc */ + static paste(item: any, parent: any): void; + static computeTelemetryFinalData(data: any): { + hasAltText: any; + hasNoAltText: any; + }; + /** @inheritdoc */ + static deserialize(data: any, parent: any, uiManager: any): Promise; + constructor(params: any); + defaultL10nId: string; + /** @inheritdoc */ + get telemetryFinalData(): { + type: string; + hasAltText: boolean; + }; + mlGuessAltText(imageData?: null, updateAltTextData?: boolean): Promise; + /** @inheritdoc */ + onceAdded(focus: any): void; + /** @inheritdoc */ + get toolbarButtons(): (string | object)[][]; + setCanvas(annotationElementId: any, canvas: any): void; + onScaleChanging(): void; + copyCanvas(maxDataDimension: any, maxPreviewDimension: any, createImageData?: boolean): { + canvas: HTMLCanvasElement | null; + width: any; + height: any; + imageData: { + width: any; + height: any; + data: Uint8ClampedArray; + } | null; + }; + /** @inheritdoc */ + serialize(isForCopying?: boolean, context?: null): Object | null; + /** @inheritdoc */ + renderAnnotationElement(annotation: any): null; + #private; +} +import { AnnotationEditor } from "./editor.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/toolbar.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/toolbar.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d2707cfeb48fe55ac88b860445f9ae3ba8d32d9c --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/toolbar.d.ts @@ -0,0 +1,24 @@ +export class EditorToolbar { + static "__#3@#l10nRemove": null; + static "__#3@#pointerDown"(e: any): void; + constructor(editor: any); + render(): HTMLDivElement; + get div(): null; + hide(): void; + show(): void; + addDeleteButton(): void; + addAltText(altText: any): Promise; + addComment(comment: any): void; + addColorPicker(colorPicker: any): void; + addEditSignatureButton(signatureManager: any): Promise; + addButton(name: any, tool: any): Promise; + updateEditSignatureButton(description: any): void; + remove(): void; + #private; +} +export class HighlightToolbar { + constructor(uiManager: any); + show(parent: any, boxes: any, isLTR: any): void; + hide(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/tools.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/tools.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..518d4eebd0eaf4bb243cad19f7fe56289a22e57d --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/editor/tools.d.ts @@ -0,0 +1,429 @@ +export type AnnotationEditor = import("./editor.js").AnnotationEditor; +export type AnnotationEditorLayer = import("./annotation_editor_layer.js").AnnotationEditorLayer; +/** + * A pdf has several pages and each of them when it will rendered + * will have an AnnotationEditorLayer which will contain the some + * new Annotations associated to an editor in order to modify them. + * + * This class is used to manage all the different layers, editors and + * some action like copy/paste, undo/redo, ... + */ +export class AnnotationEditorUIManager { + static TRANSLATE_SMALL: number; + static TRANSLATE_BIG: number; + static get _keyboardManager(): any; + constructor(container: any, viewer: any, viewerAlert: any, altTextManager: any, commentManager: any, signatureManager: any, eventBus: any, pdfDocument: any, pageColors: any, highlightColors: any, enableHighlightFloatingButton: any, enableUpdatedAddImage: any, enableNewAltTextWhenAddingImage: any, mlManager: any, editorUndoBar: any, supportsPinchToZoom: any); + _editorUndoBar: null; + _signal: AbortSignal; + _eventBus: any; + viewParameters: { + realScale: number; + rotation: number; + }; + isShiftKeyDown: boolean; + _supportsPinchToZoom: boolean; + destroy(): void; + combinedSignal(ac: any): AbortSignal; + get mlManager(): null; + get useNewAltTextFlow(): boolean; + get useNewAltTextWhenAddingImage(): boolean; + get hcmFilter(): any; + get direction(): any; + get _highlightColors(): any; + get highlightColors(): any; + get highlightColorNames(): any; + getNonHCMColor(color: any): any; + getNonHCMColorName(color: any): any; + /** + * Set the current drawing session. + * @param {AnnotationEditorLayer} layer + */ + setCurrentDrawingSession(layer: AnnotationEditorLayer): void; + setMainHighlightColorPicker(colorPicker: any): void; + editAltText(editor: any, firstTime?: boolean): void; + hasCommentManager(): boolean; + editComment(editor: any, position: any): void; + getSignature(editor: any): void; + get signatureManager(): null; + switchToMode(mode: any, callback: any): void; + setPreference(name: any, value: any): void; + onSetPreference({ name, value }: { + name: any; + value: any; + }): void; + onPageChanging({ pageNumber }: { + pageNumber: any; + }): void; + focusMainContainer(): void; + findParent(x: any, y: any): any; + disableUserSelect(value?: boolean): void; + addShouldRescale(editor: any): void; + removeShouldRescale(editor: any): void; + onScaleChanging({ scale }: { + scale: any; + }): void; + onRotationChanging({ pagesRotation }: { + pagesRotation: any; + }): void; + highlightSelection(methodOfCreation?: string): void; + /** + * Add an editor in the annotation storage. + * @param {AnnotationEditor} editor + */ + addToAnnotationStorage(editor: AnnotationEditor): void; + a11yAlert(messageId: any, args?: null): void; + blur(): void; + focus(): void; + addEditListeners(): void; + removeEditListeners(): void; + dragOver(event: any): void; + /** + * Drop callback. + * @param {DragEvent} event + */ + drop(event: DragEvent): void; + /** + * Copy callback. + * @param {ClipboardEvent} event + */ + copy(event: ClipboardEvent): void; + /** + * Cut callback. + * @param {ClipboardEvent} event + */ + cut(event: ClipboardEvent): void; + /** + * Paste callback. + * @param {ClipboardEvent} event + */ + paste(event: ClipboardEvent): Promise; + /** + * Keydown callback. + * @param {KeyboardEvent} event + */ + keydown(event: KeyboardEvent): void; + /** + * Keyup callback. + * @param {KeyboardEvent} event + */ + keyup(event: KeyboardEvent): void; + /** + * Execute an action for a given name. + * For example, the user can click on the "Undo" entry in the context menu + * and it'll trigger the undo action. + */ + onEditingAction({ name }: { + name: any; + }): void; + /** + * Set the editing state. + * It can be useful to temporarily disable it when the user is editing a + * FreeText annotation. + * @param {boolean} isEditing + */ + setEditingState(isEditing: boolean): void; + registerEditorTypes(types: any): void; + /** + * Get an id. + * @returns {string} + */ + getId(): string; + get currentLayer(): any; + getLayer(pageIndex: any): any; + get currentPageIndex(): number; + /** + * Add a new layer for a page which will contains the editors. + * @param {AnnotationEditorLayer} layer + */ + addLayer(layer: AnnotationEditorLayer): void; + /** + * Remove a layer. + * @param {AnnotationEditorLayer} layer + */ + removeLayer(layer: AnnotationEditorLayer): void; + /** + * Change the editor mode (None, FreeText, Ink, ...) + * @param {number} mode + * @param {string|null} editId + * @param {boolean} [isFromKeyboard] - true if the mode change is due to a + * keyboard action. + * @param {boolean} [mustEnterInEditMode] - true if the editor must enter in + * edit mode. + * @param {boolean} [editComment] - true if the mode change is due to a + * comment edit. + */ + updateMode(mode: number, editId?: string | null, isFromKeyboard?: boolean, mustEnterInEditMode?: boolean, editComment?: boolean): Promise; + addNewEditorFromKeyboard(): void; + /** + * Update the toolbar if it's required to reflect the tool currently used. + * @param {Object} options + * @param {number} mode + * @returns {undefined} + */ + updateToolbar(options: Object): undefined; + /** + * Update a parameter in the current editor or globally. + * @param {number} type + * @param {*} value + */ + updateParams(type: number, value: any): void; + showAllEditors(type: any, visible: any, updateButton?: boolean): void; + enableWaiting(mustWait?: boolean): void; + /** + * Get all the editors belonging to a given page. + * @param {number} pageIndex + * @returns {Array} + */ + getEditors(pageIndex: number): Array; + /** + * Get an editor with the given id. + * @param {string} id + * @returns {AnnotationEditor} + */ + getEditor(id: string): AnnotationEditor; + /** + * Add a new editor. + * @param {AnnotationEditor} editor + */ + addEditor(editor: AnnotationEditor): void; + /** + * Remove an editor. + * @param {AnnotationEditor} editor + */ + removeEditor(editor: AnnotationEditor): void; + /** + * The annotation element with the given id has been deleted. + * @param {AnnotationEditor} editor + */ + addDeletedAnnotationElement(editor: AnnotationEditor): void; + /** + * Check if the annotation element with the given id has been deleted. + * @param {string} annotationElementId + * @returns {boolean} + */ + isDeletedAnnotationElement(annotationElementId: string): boolean; + /** + * The annotation element with the given id have been restored. + * @param {AnnotationEditor} editor + */ + removeDeletedAnnotationElement(editor: AnnotationEditor): void; + /** + * Set the given editor as the active one. + * @param {AnnotationEditor} editor + */ + setActiveEditor(editor: AnnotationEditor): void; + /** + * Update the UI of the active editor. + * @param {AnnotationEditor} editor + */ + updateUI(editor: AnnotationEditor): void; + updateUIForDefaultProperties(editorType: any): void; + /** + * Add or remove an editor the current selection. + * @param {AnnotationEditor} editor + */ + toggleSelected(editor: AnnotationEditor): void; + /** + * Set the last selected editor. + * @param {AnnotationEditor} editor + */ + setSelected(editor: AnnotationEditor): void; + /** + * Check if the editor is selected. + * @param {AnnotationEditor} editor + */ + isSelected(editor: AnnotationEditor): boolean; + get firstSelectedEditor(): any; + /** + * Unselect an editor. + * @param {AnnotationEditor} editor + */ + unselect(editor: AnnotationEditor): void; + get hasSelection(): boolean; + get isEnterHandled(): any; + /** + * Undo the last command. + */ + undo(): void; + /** + * Redo the last undoed command. + */ + redo(): void; + /** + * Add a command to execute (cmd) and another one to undo it. + * @param {Object} params + */ + addCommands(params: Object): void; + cleanUndoStack(type: any): void; + /** + * Delete the current editor or all. + */ + delete(): void; + commitOrRemove(): void; + hasSomethingToControl(): boolean; + /** + * Select all the editors. + */ + selectAll(): void; + /** + * Unselect all the selected editors. + */ + unselectAll(): void; + translateSelectedEditors(x: any, y: any, noCommit?: boolean): void; + /** + * Set up the drag session for moving the selected editors. + */ + setUpDragSession(): void; + /** + * Ends the drag session. + * @returns {boolean} true if at least one editor has been moved. + */ + endDragSession(): boolean; + /** + * Drag the set of selected editors. + * @param {number} tx + * @param {number} ty + */ + dragSelectedEditors(tx: number, ty: number): void; + /** + * Rebuild the editor (usually on undo/redo actions) on a potentially + * non-rendered page. + * @param {AnnotationEditor} editor + */ + rebuild(editor: AnnotationEditor): void; + get isEditorHandlingKeyboard(): any; + /** + * Is the current editor the one passed as argument? + * @param {AnnotationEditor} editor + * @returns + */ + isActive(editor: AnnotationEditor): editor is never; + /** + * Get the current active editor. + * @returns {AnnotationEditor|null} + */ + getActive(): AnnotationEditor | null; + /** + * Get the current editor mode. + * @returns {number} + */ + getMode(): number; + get imageManager(): any; + getSelectionBoxes(textLayer: any): { + x: number; + y: number; + width: number; + height: number; + }[] | null; + addChangedExistingAnnotation({ annotationElementId, id }: { + annotationElementId: any; + id: any; + }): void; + removeChangedExistingAnnotation({ annotationElementId }: { + annotationElementId: any; + }): void; + renderAnnotationElement(annotation: any): void; + setMissingCanvas(annotationId: any, annotationElementId: any, canvas: any): void; + addMissingCanvas(annotationId: any, editor: any): void; + #private; +} +export function bindEvents(obj: any, element: any, names: any): void; +export class ColorManager { + static _colorsMapping: Map; + get _colors(): any; + /** + * In High Contrast Mode, the color on the screen is not always the + * real color used in the pdf. + * For example in some cases white can appear to be black but when saving + * we want to have white. + * @param {string} color + * @returns {Array} + */ + convert(color: string): Array; + /** + * An input element must have its color value as a hex string + * and not as color name. + * So this function converts a name into an hex string. + * @param {string} name + * @returns {string} + */ + getHexCode(name: string): string; +} +/** + * Class to handle undo/redo. + * Commands are just saved in a buffer. + * If we hit some memory issues we could likely use a circular buffer. + * It has to be used as a singleton. + */ +export class CommandManager { + constructor(maxSize?: number); + /** + * @typedef {Object} addOptions + * @property {function} cmd + * @property {function} undo + * @property {function} [post] + * @property {boolean} mustExec + * @property {number} type + * @property {boolean} overwriteIfSameType + * @property {boolean} keepUndo + */ + /** + * Add a new couple of commands to be used in case of redo/undo. + * @param {addOptions} options + */ + add({ cmd, undo, post, mustExec, type, overwriteIfSameType, keepUndo, }: { + cmd: Function; + undo: Function; + post?: Function | undefined; + mustExec: boolean; + type: number; + overwriteIfSameType: boolean; + keepUndo: boolean; + }): void; + /** + * Undo the last command. + */ + undo(): void; + /** + * Redo the last command. + */ + redo(): void; + /** + * Check if there is something to undo. + * @returns {boolean} + */ + hasSomethingToUndo(): boolean; + /** + * Check if there is something to redo. + * @returns {boolean} + */ + hasSomethingToRedo(): boolean; + cleanType(type: any): void; + destroy(): void; + #private; +} +/** + * Class to handle the different keyboards shortcuts we can have on mac or + * non-mac OSes. + */ +export class KeyboardManager { + /** + * Create a new keyboard manager class. + * @param {Array} callbacks - an array containing an array of shortcuts + * and a callback to call. + * A shortcut is a string like `ctrl+c` or `mac+ctrl+c` for mac OS. + */ + constructor(callbacks: Array); + buffer: any[]; + callbacks: Map; + allKeys: Set; + /** + * Execute a callback, if any, for a given keyboard event. + * The self is used as `this` in the callback. + * @param {Object} self + * @param {KeyboardEvent} event + * @returns + */ + exec(self: Object, event: KeyboardEvent): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/fetch_stream.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/fetch_stream.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..18f856cc45156d2c776da691d16b98110b115601 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/fetch_stream.d.ts @@ -0,0 +1,60 @@ +/** @implements {IPDFStream} */ +export class PDFFetchStream implements IPDFStream { + constructor(source: any); + _responseOrigin: null; + source: any; + isHttp: boolean; + headers: Headers; + _fullRequestReader: PDFFetchStreamReader | null; + _rangeRequestReaders: any[]; + get _progressiveDataLength(): number; + getFullReader(): PDFFetchStreamReader; + getRangeReader(begin: any, end: any): PDFFetchStreamRangeReader | null; + cancelAllRequests(reason: any): void; +} +/** @implements {IPDFStreamReader} */ +declare class PDFFetchStreamReader implements IPDFStreamReader { + constructor(stream: any); + _stream: any; + _reader: ReadableStreamDefaultReader> | null; + _loaded: number; + _filename: string | null; + _withCredentials: any; + _contentLength: any; + _headersCapability: any; + _disableRange: any; + _rangeChunkSize: any; + _abortController: AbortController; + _isStreamingSupported: boolean; + _isRangeSupported: boolean; + onProgress: any; + get headersReady(): any; + get filename(): string | null; + get contentLength(): any; + get isRangeSupported(): boolean; + get isStreamingSupported(): boolean; + read(): Promise<{ + value: any; + done: boolean; + }>; + cancel(reason: any): void; +} +/** @implements {IPDFStreamRangeReader} */ +declare class PDFFetchStreamRangeReader implements IPDFStreamRangeReader { + constructor(stream: any, begin: any, end: any); + _stream: any; + _reader: ReadableStreamDefaultReader> | null; + _loaded: number; + _withCredentials: any; + _readCapability: any; + _isStreamingSupported: boolean; + _abortController: AbortController; + onProgress: any; + get isStreamingSupported(): boolean; + read(): Promise<{ + value: any; + done: boolean; + }>; + cancel(reason: any): void; +} +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/filter_factory.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/filter_factory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f2cdc70857de633a81510cf5cebf5869d951018 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/filter_factory.d.ts @@ -0,0 +1,29 @@ +export class BaseFilterFactory { + addFilter(maps: any): string; + addHCMFilter(fgColor: any, bgColor: any): string; + addAlphaFilter(map: any): string; + addLuminosityFilter(map: any): string; + addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): string; + destroy(keepHCM?: boolean): void; +} +/** + * FilterFactory aims to create some SVG filters we can use when drawing an + * image (or whatever) on a canvas. + * Filters aren't applied with ctx.putImageData because it just overwrites the + * underlying pixels. + * With these filters, it's possible for example to apply some transfer maps on + * an image without the need to apply them on the pixel arrays: the renderer + * does the magic for us. + */ +export class DOMFilterFactory extends BaseFilterFactory { + constructor({ docId, ownerDocument }: { + docId: any; + ownerDocument?: Document | undefined; + }); + addFilter(maps: any): any; + addHCMFilter(fgColor: any, bgColor: any): any; + addAlphaFilter(map: any): any; + addLuminosityFilter(map: any): any; + addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/font_loader.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/font_loader.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..18e58bf62471ec70d380c1348a3bc3d8cbe1591b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/font_loader.d.ts @@ -0,0 +1,39 @@ +export class FontFaceObject { + constructor(translatedData: any, inspectFont?: null); + compiledGlyphs: any; + _inspectFont: any; + createNativeFontFace(): FontFace | null; + createFontFaceRule(): string | null; + getPathGenerator(objs: any, character: any): any; +} +export class FontLoader { + constructor({ ownerDocument, styleElement, }: { + ownerDocument?: Document | undefined; + styleElement?: null | undefined; + }); + _document: Document; + nativeFontFaces: Set; + styleElement: HTMLStyleElement | null; + loadingRequests: any[] | undefined; + loadTestFontId: number | undefined; + addNativeFontFace(nativeFontFace: any): void; + removeNativeFontFace(nativeFontFace: any): void; + insertRule(rule: any): void; + clear(): void; + loadSystemFont({ systemFontInfo: info, disableFontFace, _inspectFont, }: { + systemFontInfo: any; + disableFontFace: any; + _inspectFont: any; + }): Promise; + bind(font: any): Promise; + get isFontLoadingAPISupported(): any; + get isSyncFontLoadingSupported(): any; + _queueLoadingCallback(callback: any): { + done: boolean; + complete: () => void; + callback: any; + }; + get _loadTestFont(): any; + _prepareFontLoadEvent(font: any, request: any): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/metadata.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/metadata.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e2e0dd669faea5d5af6d859739022f70d8e209df --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/metadata.d.ts @@ -0,0 +1,10 @@ +export class Metadata { + constructor({ parsedData, rawData }: { + parsedData: any; + rawData: any; + }); + getRaw(): any; + get(name: any): any; + [Symbol.iterator](): any; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/network.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/network.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0ed8f882b9ee7a9249a9f14fee52106d91bba77d --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/network.d.ts @@ -0,0 +1,86 @@ +/** @implements {IPDFStream} */ +export class PDFNetworkStream implements IPDFStream { + constructor(source: any); + _source: any; + _manager: NetworkManager; + _rangeChunkSize: any; + _fullRequestReader: PDFNetworkStreamFullRequestReader | null; + _rangeRequestReaders: any[]; + _onRangeRequestReaderClosed(reader: any): void; + getFullReader(): PDFNetworkStreamFullRequestReader; + getRangeReader(begin: any, end: any): PDFNetworkStreamRangeRequestReader; + cancelAllRequests(reason: any): void; +} +declare class NetworkManager { + constructor({ url, httpHeaders, withCredentials }: { + url: any; + httpHeaders: any; + withCredentials: any; + }); + _responseOrigin: null; + url: any; + isHttp: boolean; + headers: Headers; + withCredentials: any; + currXhrId: number; + pendingRequests: any; + request(args: any): number; + onProgress(xhrId: any, evt: any): void; + onStateChange(xhrId: any, evt: any): void; + getRequestXhr(xhrId: any): any; + isPendingRequest(xhrId: any): boolean; + abortRequest(xhrId: any): void; +} +/** @implements {IPDFStreamReader} */ +declare class PDFNetworkStreamFullRequestReader implements IPDFStreamReader { + constructor(manager: any, source: any); + _manager: any; + _url: any; + _fullRequestId: any; + _headersCapability: any; + _disableRange: any; + _contentLength: any; + _rangeChunkSize: any; + _isStreamingSupported: boolean; + _isRangeSupported: boolean; + _cachedChunks: any[]; + _requests: any[]; + _done: boolean; + _storedError: import("../shared/util.js").ResponseException | undefined; + _filename: string | null; + onProgress: any; + _onHeadersReceived(): void; + _onDone(data: any): void; + _onError(status: any): void; + _onProgress(evt: any): void; + get filename(): string | null; + get isRangeSupported(): boolean; + get isStreamingSupported(): boolean; + get contentLength(): any; + get headersReady(): any; + read(): Promise; + cancel(reason: any): void; + _fullRequestReader: any; +} +/** @implements {IPDFStreamRangeReader} */ +declare class PDFNetworkStreamRangeRequestReader implements IPDFStreamRangeReader { + constructor(manager: any, begin: any, end: any); + _manager: any; + _url: any; + _requestId: any; + _requests: any[]; + _queuedChunk: any; + _done: boolean; + _storedError: Error | undefined; + onProgress: any; + onClosed: any; + _onHeadersReceived(): void; + _close(): void; + _onDone(data: any): void; + _onError(status: any): void; + _onProgress(evt: any): void; + get isStreamingSupported(): boolean; + read(): Promise; + cancel(reason: any): void; +} +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/network_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/network_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..00e16ff8c9862a830c605f0a64ca79eb96606fa4 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/network_utils.d.ts @@ -0,0 +1,15 @@ +export function createHeaders(isHttp: any, httpHeaders: any): Headers; +export function createResponseError(status: any, url: any): ResponseException; +export function extractFilenameFromHeader(responseHeaders: any): string | null; +export function getResponseOrigin(url: any): string | null; +export function validateRangeRequestCapabilities({ responseHeaders, isHttp, rangeChunkSize, disableRange, }: { + responseHeaders: any; + isHttp: any; + rangeChunkSize: any; + disableRange: any; +}): { + allowRangeRequests: boolean; + suggestedLength: undefined; +}; +export function validateResponseStatus(status: any): boolean; +import { ResponseException } from "../shared/util.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/node_stream.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/node_stream.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..946292fbd520800637d5d65a3f6c48806134e379 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/node_stream.d.ts @@ -0,0 +1,54 @@ +export class PDFNodeStream { + constructor(source: any); + source: any; + url: URL; + _fullRequestReader: PDFNodeStreamFsFullReader | null; + _rangeRequestReaders: any[]; + get _progressiveDataLength(): number; + getFullReader(): PDFNodeStreamFsFullReader; + getRangeReader(start: any, end: any): PDFNodeStreamFsRangeReader | null; + cancelAllRequests(reason: any): void; +} +declare class PDFNodeStreamFsFullReader { + constructor(stream: any); + _url: any; + _done: boolean; + _storedError: any; + onProgress: any; + _contentLength: any; + _loaded: number; + _filename: any; + _disableRange: any; + _rangeChunkSize: any; + _isStreamingSupported: boolean; + _isRangeSupported: boolean; + _readableStream: any; + _readCapability: any; + _headersCapability: any; + get headersReady(): any; + get filename(): any; + get contentLength(): any; + get isRangeSupported(): boolean; + get isStreamingSupported(): boolean; + read(): any; + cancel(reason: any): void; + _error(reason: any): void; + _setReadableStream(readableStream: any): void; +} +declare class PDFNodeStreamFsRangeReader { + constructor(stream: any, start: any, end: any); + _url: any; + _done: boolean; + _storedError: any; + onProgress: any; + _loaded: number; + _readableStream: any; + _readCapability: any; + _isStreamingSupported: boolean; + get isStreamingSupported(): boolean; + read(): any; + cancel(reason: any): void; + _error(reason: any): void; + _setReadableStream(readableStream: any): void; +} +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/node_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/node_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cdd1dc8dc6f513ce86711726b5f4a9109a355d1a --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/node_utils.d.ts @@ -0,0 +1,32 @@ +export function fetchData(url: any): Promise>; +export class NodeCanvasFactory extends BaseCanvasFactory { + /** + * @ignore + */ + _createCanvas(width: any, height: any): import("@napi-rs/canvas").Canvas; +} +export class NodeCMapReaderFactory extends BaseCMapReaderFactory { + /** + * @ignore + */ + _fetch(url: any): Promise>; +} +export class NodeFilterFactory extends BaseFilterFactory { +} +export class NodeStandardFontDataFactory extends BaseStandardFontDataFactory { + /** + * @ignore + */ + _fetch(url: any): Promise>; +} +export class NodeWasmFactory extends BaseWasmFactory { + /** + * @ignore + */ + _fetch(url: any): Promise>; +} +import { BaseCanvasFactory } from "./canvas_factory.js"; +import { BaseCMapReaderFactory } from "./cmap_reader_factory.js"; +import { BaseFilterFactory } from "./filter_factory.js"; +import { BaseStandardFontDataFactory } from "./standard_fontdata_factory.js"; +import { BaseWasmFactory } from "./wasm_factory.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/optional_content_config.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/optional_content_config.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0c1fdc8fd77146a08357cc25f7ca23f5276757cf --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/optional_content_config.d.ts @@ -0,0 +1,18 @@ +export class OptionalContentConfig { + constructor(data: any, renderingIntent?: number); + renderingIntent: number; + name: any; + creator: any; + isVisible(group: any): any; + setVisibility(id: any, visible?: boolean, preserveRB?: boolean): void; + setOCGState({ state, preserveRB }: { + state: any; + preserveRB: any; + }): void; + get hasInitialVisibility(): boolean; + getOrder(): any; + getGroup(id: any): any; + getHash(): string; + [Symbol.iterator](): MapIterator<[any, any]>; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/pattern_helper.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/pattern_helper.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f757ed818e51b3777e72ac82411fb0036341537 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/pattern_helper.d.ts @@ -0,0 +1,75 @@ +export function getShadingPattern(IR: any): RadialAxialShadingPattern | MeshShadingPattern | DummyShadingPattern; +export namespace PathType { + let FILL: string; + let STROKE: string; + let SHADING: string; +} +export class TilingPattern { + static MAX_PATTERN_SIZE: number; + constructor(IR: any, ctx: any, canvasGraphicsFactory: any, baseTransform: any); + color: any; + operatorList: any; + matrix: any; + bbox: any; + xstep: any; + ystep: any; + paintType: any; + tilingType: any; + ctx: any; + canvasGraphicsFactory: any; + baseTransform: any; + createPatternCanvas(owner: any): { + canvas: any; + scaleX: any; + scaleY: any; + offsetX: any; + offsetY: any; + }; + getSizeAndScale(step: any, realOutputSize: any, scale: any): { + scale: any; + size: number; + }; + clipBbox(graphics: any, x0: any, y0: any, x1: any, y1: any): void; + setFillAndStrokeStyleToContext(graphics: any, paintType: any, color: any): void; + isModifyingCurrentTransform(): boolean; + getPattern(ctx: any, owner: any, inverse: any, pathType: any): any; +} +declare class RadialAxialShadingPattern extends BaseShadingPattern { + constructor(IR: any); + _type: any; + _bbox: any; + _colorStops: any; + _p0: any; + _p1: any; + _r0: any; + _r1: any; + matrix: any; + _createGradient(ctx: any): any; + getPattern(ctx: any, owner: any, inverse: any, pathType: any): any; +} +declare class MeshShadingPattern extends BaseShadingPattern { + constructor(IR: any); + _coords: any; + _colors: any; + _figures: any; + _bounds: any; + _bbox: any; + _background: any; + matrix: any; + _createMeshCanvas(combinedScale: any, backgroundColor: any, cachedCanvases: any): { + canvas: any; + offsetX: number; + offsetY: number; + scaleX: number; + scaleY: number; + }; + getPattern(ctx: any, owner: any, inverse: any, pathType: any): any; +} +declare class DummyShadingPattern extends BaseShadingPattern { + getPattern(): string; +} +declare class BaseShadingPattern { + isModifyingCurrentTransform(): boolean; + getPattern(): void; +} +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/pdf_objects.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/pdf_objects.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e43c913e3c898db09d64b591cf073104eb79aa72 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/pdf_objects.d.ts @@ -0,0 +1,40 @@ +/** + * A PDF document and page is built of many objects. E.g. there are objects for + * fonts, images, rendering code, etc. These objects may get processed inside of + * a worker. This class implements some basic methods to manage these objects. + */ +export class PDFObjects { + /** + * If called *without* callback, this returns the data of `objId` but the + * object needs to be resolved. If it isn't, this method throws. + * + * If called *with* a callback, the callback is called with the data of the + * object once the object is resolved. That means, if you call this method + * and the object is already resolved, the callback gets called right away. + * + * @param {string} objId + * @param {function} [callback] + * @returns {any} + */ + get(objId: string, callback?: Function): any; + /** + * @param {string} objId + * @returns {boolean} + */ + has(objId: string): boolean; + /** + * @param {string} objId + * @returns {boolean} + */ + delete(objId: string): boolean; + /** + * Resolves the object `objId` with optional `data`. + * + * @param {string} objId + * @param {any} [data] + */ + resolve(objId: string, data?: any): void; + clear(): void; + [Symbol.iterator](): Generator; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/standard_fontdata_factory.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/standard_fontdata_factory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ba42bd882e6db279fa9713e4fe2328c847bdfeeb --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/standard_fontdata_factory.d.ts @@ -0,0 +1,20 @@ +export class BaseStandardFontDataFactory { + constructor({ baseUrl }: { + baseUrl?: null | undefined; + }); + baseUrl: any; + fetch({ filename }: { + filename: any; + }): Promise>; + /** + * @ignore + * @returns {Promise} + */ + _fetch(url: any): Promise; +} +export class DOMStandardFontDataFactory extends BaseStandardFontDataFactory { + /** + * @ignore + */ + _fetch(url: any): Promise>; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/svg_factory.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/svg_factory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0563cd3805ffc9b6b21463715c83c0f2a5bad062 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/svg_factory.d.ts @@ -0,0 +1,14 @@ +export class BaseSVGFactory { + create(width: any, height: any, skipDimensions?: boolean): void; + createElement(type: any): void; + /** + * @ignore + */ + _createSVG(type: any): void; +} +export class DOMSVGFactory extends BaseSVGFactory { + /** + * @ignore + */ + _createSVG(type: any): any; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/text_layer.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/text_layer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b8be852cf8f3a271f709c519b8c1995393273724 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/text_layer.d.ts @@ -0,0 +1,85 @@ +export type PageViewport = import("./display_utils").PageViewport; +export type TextContent = import("./api").TextContent; +export type TextLayerParameters = { + /** + * - Text content to + * render, i.e. the value returned by the page's `streamTextContent` or + * `getTextContent` method. + */ + textContentSource: ReadableStream | TextContent; + /** + * - The DOM node that will contain the text + * runs. + */ + container: HTMLElement; + /** + * - The target viewport to properly layout + * the text runs. + */ + viewport: PageViewport; +}; +export type TextLayerUpdateParameters = { + /** + * - The target viewport to properly layout + * the text runs. + */ + viewport: PageViewport; + /** + * - Callback invoked before the textLayer is + * updated in the DOM. + */ + onBefore?: Function | undefined; +}; +export class TextLayer { + static "__#58@#ascentCache": Map; + static "__#58@#canvasContexts": Map; + static "__#58@#canvasCtxFonts": WeakMap; + static "__#58@#minFontSize": null; + static "__#58@#pendingTextLayers": Set; + static get fontFamilyMap(): any; + /** + * Clean-up global textLayer data. + * @returns {undefined} + */ + static cleanup(): undefined; + static "__#58@#getCtx"(lang?: null): any; + static "__#58@#ensureCtxFont"(ctx: any, size: any, family: any): void; + /** + * Compute the minimum font size enforced by the browser. + */ + static "__#58@#ensureMinFontSizeComputed"(): void; + static "__#58@#getAscent"(fontFamily: any, style: any, lang: any): any; + /** + * @param {TextLayerParameters} options + */ + constructor({ textContentSource, container, viewport }: TextLayerParameters); + /** + * Render the textLayer. + * @returns {Promise} + */ + render(): Promise; + /** + * Update a previously rendered textLayer, if necessary. + * @param {TextLayerUpdateParameters} options + * @returns {undefined} + */ + update({ viewport, onBefore }: TextLayerUpdateParameters): undefined; + /** + * Cancel rendering of the textLayer. + * @returns {undefined} + */ + cancel(): undefined; + /** + * @type {Array} HTML elements that correspond to the text items + * of the textContent input. + * This is output and will initially be set to an empty array. + */ + get textDivs(): Array; + /** + * @type {Array} Strings that correspond to the `str` property of + * the text items of the textContent input. + * This is output and will initially be set to an empty array + */ + get textContentItemsStr(): Array; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/touch_manager.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/touch_manager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c127f8ef9fd51384eb5b2f68827a52b1f861513a --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/touch_manager.d.ts @@ -0,0 +1,18 @@ +export class TouchManager { + constructor({ container, isPinchingDisabled, isPinchingStopped, onPinchStart, onPinching, onPinchEnd, signal, }: { + container: any; + isPinchingDisabled?: null | undefined; + isPinchingStopped?: null | undefined; + onPinchStart?: null | undefined; + onPinching?: null | undefined; + onPinchEnd?: null | undefined; + signal: any; + }); + /** + * NOTE: Don't shadow this value since `devicePixelRatio` may change if the + * window resolution changes, e.g. if the viewer is moved to another monitor. + */ + get MIN_TOUCH_DISTANCE_TO_PINCH(): number; + destroy(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/transport_stream.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/transport_stream.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..64a7b6f761ab312b24b56fd1fce3779243a4fae2 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/transport_stream.d.ts @@ -0,0 +1,67 @@ +export type IPDFStream = import("../interfaces").IPDFStream; +export type IPDFStreamReader = import("../interfaces").IPDFStreamReader; +export type IPDFStreamRangeReader = import("../interfaces").IPDFStreamRangeReader; +/** @implements {IPDFStream} */ +export class PDFDataTransportStream implements IPDFStream { + constructor(pdfDataRangeTransport: any, { disableRange, disableStream }: { + disableRange?: boolean | undefined; + disableStream?: boolean | undefined; + }); + _queuedChunks: any[]; + _progressiveDone: any; + _contentDispositionFilename: any; + _pdfDataRangeTransport: any; + _isStreamingSupported: boolean; + _isRangeSupported: boolean; + _contentLength: any; + _fullRequestReader: any; + _rangeReaders: any[]; + _onReceiveData({ begin, chunk }: { + begin: any; + chunk: any; + }): void; + get _progressiveDataLength(): any; + _onProgress(evt: any): void; + _onProgressiveDone(): void; + _removeRangeReader(reader: any): void; + getFullReader(): PDFDataTransportStreamReader; + getRangeReader(begin: any, end: any): PDFDataTransportStreamRangeReader | null; + cancelAllRequests(reason: any): void; +} +/** @implements {IPDFStreamReader} */ +declare class PDFDataTransportStreamReader implements IPDFStreamReader { + constructor(stream: any, queuedChunks: any, progressiveDone?: boolean, contentDispositionFilename?: null); + _stream: any; + _done: boolean; + _filename: any; + _queuedChunks: any; + _loaded: number; + _requests: any[]; + _headersReady: Promise; + onProgress: any; + _enqueue(chunk: any): void; + get headersReady(): Promise; + get filename(): any; + get isRangeSupported(): any; + get isStreamingSupported(): any; + get contentLength(): any; + read(): Promise; + cancel(reason: any): void; + progressiveDone(): void; +} +/** @implements {IPDFStreamRangeReader} */ +declare class PDFDataTransportStreamRangeReader implements IPDFStreamRangeReader { + constructor(stream: any, begin: any, end: any); + _stream: any; + _begin: any; + _end: any; + _queuedChunk: any; + _requests: any[]; + _done: boolean; + onProgress: any; + _enqueue(chunk: any): void; + get isStreamingSupported(): boolean; + read(): Promise; + cancel(reason: any): void; +} +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/wasm_factory.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/wasm_factory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b30a2c62b914f33fbcdb0f367a03bb4658bc459e --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/wasm_factory.d.ts @@ -0,0 +1,20 @@ +export class BaseWasmFactory { + constructor({ baseUrl }: { + baseUrl?: null | undefined; + }); + baseUrl: any; + fetch({ filename }: { + filename: any; + }): Promise>; + /** + * @ignore + * @returns {Promise} + */ + _fetch(url: any): Promise; +} +export class DOMWasmFactory extends BaseWasmFactory { + /** + * @ignore + */ + _fetch(url: any): Promise>; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/worker_options.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/worker_options.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..13081ca52e18bbe584258acc526f698de1e059a1 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/worker_options.d.ts @@ -0,0 +1,25 @@ +export class GlobalWorkerOptions { + static "__#53@#port": null; + static "__#53@#src": string; + /** + * @param {Worker | null} workerPort - Defines global port for worker process. + * Overrides the `workerSrc` option. + */ + static set workerPort(val: Worker | null); + /** + * @type {Worker | null} + */ + static get workerPort(): Worker | null; + /** + * @param {string} workerSrc - A string containing the path and filename of + * the worker file. + * + * NOTE: The `workerSrc` option should always be set, in order to prevent + * any issues when using the PDF.js library. + */ + static set workerSrc(val: string); + /** + * @type {string} + */ + static get workerSrc(): string; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/xfa_layer.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/xfa_layer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3bf777103d96de6a71a105ef91fc301b3cbf67dd --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/xfa_layer.d.ts @@ -0,0 +1,47 @@ +export type AnnotationStorage = import("./annotation_storage").AnnotationStorage; +export type PageViewport = import("./display_utils").PageViewport; +export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService; +export type XfaLayerParameters = { + viewport: PageViewport; + div: HTMLDivElement; + xfaHtml: Object; + annotationStorage?: import("./annotation_storage").AnnotationStorage | undefined; + linkService: IPDFLinkService; + /** + * - (default value is 'display'). + */ + intent?: string | undefined; +}; +/** + * @typedef {Object} XfaLayerParameters + * @property {PageViewport} viewport + * @property {HTMLDivElement} div + * @property {Object} xfaHtml + * @property {AnnotationStorage} [annotationStorage] + * @property {IPDFLinkService} linkService + * @property {string} [intent] - (default value is 'display'). + */ +export class XfaLayer { + static setupStorage(html: any, id: any, element: any, storage: any, intent: any): void; + static setAttributes({ html, element, storage, intent, linkService }: { + html: any; + element: any; + storage?: null | undefined; + intent: any; + linkService: any; + }): void; + /** + * Render the XFA layer. + * + * @param {XfaLayerParameters} parameters + */ + static render(parameters: XfaLayerParameters): { + textDivs: Text[]; + }; + /** + * Update the XFA layer. + * + * @param {XfaLayerParameters} parameters + */ + static update(parameters: XfaLayerParameters): void; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/display/xfa_text.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/display/xfa_text.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e1869f07d1ba0dcff33e71ba7f511168b6f1037b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/display/xfa_text.d.ts @@ -0,0 +1,21 @@ +export type TextContent = import("./api").TextContent; +/** @typedef {import("./api").TextContent} TextContent */ +export class XfaText { + /** + * Walk an XFA tree and create an array of text nodes that is compatible + * with a regular PDFs TextContent. Currently, only TextItem.str is supported, + * all other fields and styles haven't been implemented. + * + * @param {Object} xfa - An XFA fake DOM object. + * + * @returns {TextContent} + */ + static textContent(xfa: Object): TextContent; + /** + * @param {string} name - DOM node name. (lower case) + * + * @returns {boolean} true if the DOM node should have a corresponding text + * node. + */ + static shouldBuildText(name: string): boolean; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/interfaces.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/interfaces.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5ca6765a171aa9b2f7d7de041085730a7fe27d19 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/interfaces.d.ts @@ -0,0 +1,122 @@ +/** + * Interface that represents PDF data transport. If possible, it allows + * progressively load entire or fragment of the PDF binary data. + * + * @interface + */ +export class IPDFStream { + /** + * Gets a reader for the entire PDF data. + * @returns {IPDFStreamReader} + */ + getFullReader(): IPDFStreamReader; + /** + * Gets a reader for the range of the PDF data. + * + * NOTE: Currently this method is only expected to be invoked *after* + * the `IPDFStreamReader.prototype.headersReady` promise has resolved. + * + * @param {number} begin - the start offset of the data. + * @param {number} end - the end offset of the data. + * @returns {IPDFStreamRangeReader} + */ + getRangeReader(begin: number, end: number): IPDFStreamRangeReader; + /** + * Cancels all opened reader and closes all their opened requests. + * @param {Object} reason - the reason for cancelling + */ + cancelAllRequests(reason: Object): void; +} +/** + * Interface for a PDF binary data fragment reader. + * + * @interface + */ +export class IPDFStreamRangeReader { + /** + * Sets or gets the progress callback. The callback can be useful when the + * isStreamingSupported property of the object is defined as false. + * The callback is called with one parameter: an object with the loaded + * property. + */ + onProgress: any; + /** + * Gets ability of the stream to progressively load binary data. + * @type {boolean} + */ + get isStreamingSupported(): boolean; + /** + * Requests a chunk of the binary data. The method returns the promise, which + * is resolved into object with properties "value" and "done". If the done + * is set to true, then the stream has reached its end, otherwise the value + * contains binary data. Cancelled requests will be resolved with the done is + * set to true. + * @returns {Promise} + */ + read(): Promise; + /** + * Cancels all pending read requests and closes the stream. + * @param {Object} reason + */ + cancel(reason: Object): void; +} +/** + * Interface for a PDF binary data reader. + * + * @interface + */ +export class IPDFStreamReader { + /** + * Sets or gets the progress callback. The callback can be useful when the + * isStreamingSupported property of the object is defined as false. + * The callback is called with one parameter: an object with the loaded and + * total properties. + */ + onProgress: any; + /** + * Gets a promise that is resolved when the headers and other metadata of + * the PDF data stream are available. + * @type {Promise} + */ + get headersReady(): Promise; + /** + * Gets the Content-Disposition filename. It is defined after the headersReady + * promise is resolved. + * @type {string|null} The filename, or `null` if the Content-Disposition + * header is missing/invalid. + */ + get filename(): string | null; + /** + * Gets PDF binary data length. It is defined after the headersReady promise + * is resolved. + * @type {number} The data length (or 0 if unknown). + */ + get contentLength(): number; + /** + * Gets ability of the stream to handle range requests. It is defined after + * the headersReady promise is resolved. Rejected when the reader is cancelled + * or an error occurs. + * @type {boolean} + */ + get isRangeSupported(): boolean; + /** + * Gets ability of the stream to progressively load binary data. It is defined + * after the headersReady promise is resolved. + * @type {boolean} + */ + get isStreamingSupported(): boolean; + /** + * Requests a chunk of the binary data. The method returns the promise, which + * is resolved into object with properties "value" and "done". If the done + * is set to true, then the stream has reached its end, otherwise the value + * contains binary data. Cancelled requests will be resolved with the done is + * set to true. + * @returns {Promise} + */ + read(): Promise; + /** + * Cancels all pending read requests and closes the stream. + * @param {Object} reason + */ + cancel(reason: Object): void; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/pdf.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/pdf.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..171f4a684bf76d1a736bb850a736c5740001e3ca --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/pdf.d.ts @@ -0,0 +1,59 @@ +export type OnProgressParameters = import("./display/api").OnProgressParameters; +export type PDFDocumentLoadingTask = import("./display/api").PDFDocumentLoadingTask; +export type PDFDocumentProxy = import("./display/api").PDFDocumentProxy; +export type PDFPageProxy = import("./display/api").PDFPageProxy; +export type RenderTask = import("./display/api").RenderTask; +export type PageViewport = import("./display/display_utils").PageViewport; +import { AbortException } from "./shared/util.js"; +import { AnnotationEditorLayer } from "./display/editor/annotation_editor_layer.js"; +import { AnnotationEditorParamsType } from "./shared/util.js"; +import { AnnotationEditorType } from "./shared/util.js"; +import { AnnotationEditorUIManager } from "./display/editor/tools.js"; +import { AnnotationLayer } from "./display/annotation_layer.js"; +import { AnnotationMode } from "./shared/util.js"; +import { AnnotationType } from "./shared/util.js"; +import { build } from "./display/api.js"; +import { ColorPicker } from "./display/editor/color_picker.js"; +import { createValidAbsoluteUrl } from "./shared/util.js"; +import { DOMSVGFactory } from "./display/svg_factory.js"; +import { DrawLayer } from "./display/draw_layer.js"; +import { FeatureTest } from "./shared/util.js"; +import { fetchData } from "./display/display_utils.js"; +import { getDocument } from "./display/api.js"; +import { getFilenameFromUrl } from "./display/display_utils.js"; +import { getPdfFilenameFromUrl } from "./display/display_utils.js"; +import { getRGB } from "./display/display_utils.js"; +import { getUuid } from "./shared/util.js"; +import { getXfaPageViewport } from "./display/display_utils.js"; +import { GlobalWorkerOptions } from "./display/worker_options.js"; +import { ImageKind } from "./shared/util.js"; +import { InvalidPDFException } from "./shared/util.js"; +import { isDataScheme } from "./display/display_utils.js"; +import { isPdfFile } from "./display/display_utils.js"; +import { isValidExplicitDest } from "./display/api_utils.js"; +import { MathClamp } from "./shared/util.js"; +import { noContextMenu } from "./display/display_utils.js"; +import { normalizeUnicode } from "./shared/util.js"; +import { OPS } from "./shared/util.js"; +import { OutputScale } from "./display/display_utils.js"; +import { PasswordResponses } from "./shared/util.js"; +import { PDFDataRangeTransport } from "./display/api.js"; +import { PDFDateString } from "./display/display_utils.js"; +import { PDFWorker } from "./display/api.js"; +import { PermissionFlag } from "./shared/util.js"; +import { PixelsPerInch } from "./display/display_utils.js"; +import { RenderingCancelledException } from "./display/display_utils.js"; +import { ResponseException } from "./shared/util.js"; +import { setLayerDimensions } from "./display/display_utils.js"; +import { shadow } from "./shared/util.js"; +import { SignatureExtractor } from "./display/editor/drawers/signaturedraw.js"; +import { stopEvent } from "./display/display_utils.js"; +import { SupportedImageMimeTypes } from "./display/display_utils.js"; +import { TextLayer } from "./display/text_layer.js"; +import { TouchManager } from "./display/touch_manager.js"; +import { updateUrlHash } from "./shared/util.js"; +import { Util } from "./shared/util.js"; +import { VerbosityLevel } from "./shared/util.js"; +import { version } from "./display/api.js"; +import { XfaLayer } from "./display/xfa_layer.js"; +export { AbortException, AnnotationEditorLayer, AnnotationEditorParamsType, AnnotationEditorType, AnnotationEditorUIManager, AnnotationLayer, AnnotationMode, AnnotationType, build, ColorPicker, createValidAbsoluteUrl, DOMSVGFactory, DrawLayer, FeatureTest, fetchData, getDocument, getFilenameFromUrl, getPdfFilenameFromUrl, getRGB, getUuid, getXfaPageViewport, GlobalWorkerOptions, ImageKind, InvalidPDFException, isDataScheme, isPdfFile, isValidExplicitDest, MathClamp, noContextMenu, normalizeUnicode, OPS, OutputScale, PasswordResponses, PDFDataRangeTransport, PDFDateString, PDFWorker, PermissionFlag, PixelsPerInch, RenderingCancelledException, ResponseException, setLayerDimensions, shadow, SignatureExtractor, stopEvent, SupportedImageMimeTypes, TextLayer, TouchManager, updateUrlHash, Util, VerbosityLevel, version, XfaLayer }; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/shared/image_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/shared/image_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cbf063ae3146cd2b953434e9d57b45b6af0a3f59 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/shared/image_utils.d.ts @@ -0,0 +1,17 @@ +export function convertBlackAndWhiteToRGBA({ src, srcPos, dest, width, height, nonBlackColor, inverseDecode, }: { + src: any; + srcPos?: number | undefined; + dest: any; + width: any; + height: any; + nonBlackColor?: number | undefined; + inverseDecode?: boolean | undefined; +}): { + srcPos: number; + destPos: number; +}; +export function convertToRGBA(params: any): { + srcPos: number; + destPos: number; +} | null; +export function grayToRGBA(src: any, dest: any): void; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/shared/message_handler.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/shared/message_handler.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9120de90e322c91ea90f391cd32da015d47cecf4 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/shared/message_handler.d.ts @@ -0,0 +1,48 @@ +export class MessageHandler { + constructor(sourceName: any, targetName: any, comObj: any); + sourceName: any; + targetName: any; + comObj: any; + callbackId: number; + streamId: number; + streamSinks: any; + streamControllers: any; + callbackCapabilities: any; + actionHandler: any; + on(actionName: any, handler: any): void; + /** + * Sends a message to the comObj to invoke the action with the supplied data. + * @param {string} actionName - Action to call. + * @param {JSON} data - JSON data to send. + * @param {Array} [transfers] - List of transfers/ArrayBuffers. + */ + send(actionName: string, data: JSON, transfers?: any[]): void; + /** + * Sends a message to the comObj to invoke the action with the supplied data. + * Expects that the other side will callback with the response. + * @param {string} actionName - Action to call. + * @param {JSON} data - JSON data to send. + * @param {Array} [transfers] - List of transfers/ArrayBuffers. + * @returns {Promise} Promise to be resolved with response data. + */ + sendWithPromise(actionName: string, data: JSON, transfers?: any[]): Promise; + /** + * Sends a message to the comObj to invoke the action with the supplied data. + * Expect that the other side will callback to signal 'start_complete'. + * @param {string} actionName - Action to call. + * @param {JSON} data - JSON data to send. + * @param {Object} queueingStrategy - Strategy to signal backpressure based on + * internal queue. + * @param {Array} [transfers] - List of transfers/ArrayBuffers. + * @returns {ReadableStream} ReadableStream to read data in chunks. + */ + sendWithStream(actionName: string, data: JSON, queueingStrategy: Object, transfers?: any[]): ReadableStream; + destroy(): void; + #private; +} +export function wrapReason(ex: any): PasswordException | UnknownErrorException | InvalidPDFException | ResponseException | AbortException; +import { PasswordException } from "./util.js"; +import { UnknownErrorException } from "./util.js"; +import { InvalidPDFException } from "./util.js"; +import { ResponseException } from "./util.js"; +import { AbortException } from "./util.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/shared/murmurhash3.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/shared/murmurhash3.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f617a6780846fc5c8daf062c3b22515f8235fc7b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/shared/murmurhash3.d.ts @@ -0,0 +1,7 @@ +export class MurmurHash3_64 { + constructor(seed: any); + h1: number; + h2: number; + update(input: any): void; + hexdigest(): string; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/shared/scripting_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/shared/scripting_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be88d49b48bcdf041b443762f0de2d08226edae0 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/shared/scripting_utils.d.ts @@ -0,0 +1,18 @@ +export class ColorConverters { + static CMYK_G([c, y, m, k]: [any, any, any, any]): (string | number)[]; + static G_CMYK([g]: [any]): (string | number)[]; + static G_RGB([g]: [any]): any[]; + static G_rgb([g]: [any]): any[]; + static G_HTML([g]: [any]): string; + static RGB_G([r, g, b]: [any, any, any]): (string | number)[]; + static RGB_rgb(color: any): any; + static RGB_HTML(color: any): string; + static T_HTML(): string; + static T_rgb(): null[]; + static CMYK_RGB([c, y, m, k]: [any, any, any, any]): (string | number)[]; + static CMYK_rgb([c, y, m, k]: [any, any, any, any]): number[]; + static CMYK_HTML(components: any): string; + static RGB_CMYK([r, g, b]: [any, any, any]): (string | number)[]; +} +export const DateFormats: string[]; +export const TimeFormats: string[]; diff --git a/tools/ui/node_modules/pdfjs-dist/types/src/shared/util.d.ts b/tools/ui/node_modules/pdfjs-dist/types/src/shared/util.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fd05f4ed5aa149bd0d8dffa1e1dfec44d9274628 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/src/shared/util.d.ts @@ -0,0 +1,411 @@ +export function _isValidExplicitDest(validRef: any, validName: any, dest: any): boolean; +declare const AbortException_base: any; +/** + * Error used to indicate task cancellation. + */ +export class AbortException extends AbortException_base { + [x: string]: any; + constructor(msg: any); +} +export namespace AnnotationActionEventType { + let E: string; + let X: string; + let D: string; + let U: string; + let Fo: string; + let Bl: string; + let PO: string; + let PC: string; + let PV: string; + let PI: string; + let K: string; + let F: string; + let V: string; + let C: string; +} +export namespace AnnotationBorderStyleType { + let SOLID: number; + let DASHED: number; + let BEVELED: number; + let INSET: number; + let UNDERLINE: number; +} +export namespace AnnotationEditorParamsType { + let RESIZE: number; + let CREATE: number; + let FREETEXT_SIZE: number; + let FREETEXT_COLOR: number; + let FREETEXT_OPACITY: number; + let INK_COLOR: number; + let INK_THICKNESS: number; + let INK_OPACITY: number; + let HIGHLIGHT_COLOR: number; + let HIGHLIGHT_THICKNESS: number; + let HIGHLIGHT_FREE: number; + let HIGHLIGHT_SHOW_ALL: number; + let DRAW_STEP: number; +} +export const AnnotationEditorPrefix: "pdfjs_internal_editor_"; +export namespace AnnotationEditorType { + let DISABLE: number; + let NONE: number; + let FREETEXT: number; + let HIGHLIGHT: number; + let STAMP: number; + let INK: number; + let SIGNATURE: number; + let COMMENT: number; +} +export namespace AnnotationFieldFlag { + let READONLY: number; + let REQUIRED: number; + let NOEXPORT: number; + let MULTILINE: number; + let PASSWORD: number; + let NOTOGGLETOOFF: number; + let RADIO: number; + let PUSHBUTTON: number; + let COMBO: number; + let EDIT: number; + let SORT: number; + let FILESELECT: number; + let MULTISELECT: number; + let DONOTSPELLCHECK: number; + let DONOTSCROLL: number; + let COMB: number; + let RICHTEXT: number; + let RADIOSINUNISON: number; + let COMMITONSELCHANGE: number; +} +export namespace AnnotationFlag { + export let INVISIBLE: number; + export let HIDDEN: number; + export let PRINT: number; + export let NOZOOM: number; + export let NOROTATE: number; + export let NOVIEW: number; + let READONLY_1: number; + export { READONLY_1 as READONLY }; + export let LOCKED: number; + export let TOGGLENOVIEW: number; + export let LOCKEDCONTENTS: number; +} +export namespace AnnotationMode { + let DISABLE_1: number; + export { DISABLE_1 as DISABLE }; + export let ENABLE: number; + export let ENABLE_FORMS: number; + export let ENABLE_STORAGE: number; +} +export const AnnotationPrefix: "pdfjs_internal_id_"; +export namespace AnnotationReplyType { + let GROUP: string; + let REPLY: string; +} +export namespace AnnotationType { + export let TEXT: number; + export let LINK: number; + let FREETEXT_1: number; + export { FREETEXT_1 as FREETEXT }; + export let LINE: number; + export let SQUARE: number; + export let CIRCLE: number; + export let POLYGON: number; + export let POLYLINE: number; + let HIGHLIGHT_1: number; + export { HIGHLIGHT_1 as HIGHLIGHT }; + let UNDERLINE_1: number; + export { UNDERLINE_1 as UNDERLINE }; + export let SQUIGGLY: number; + export let STRIKEOUT: number; + let STAMP_1: number; + export { STAMP_1 as STAMP }; + export let CARET: number; + let INK_1: number; + export { INK_1 as INK }; + export let POPUP: number; + export let FILEATTACHMENT: number; + export let SOUND: number; + export let MOVIE: number; + export let WIDGET: number; + export let SCREEN: number; + export let PRINTERMARK: number; + export let TRAPNET: number; + export let WATERMARK: number; + export let THREED: number; + export let REDACT: number; +} +export function assert(cond: any, msg: any): void; +/** + * @type {any} + */ +export const BaseException: any; +export const BASELINE_FACTOR: number; +export function bytesToString(bytes: any): string; +/** + * Attempts to create a valid absolute URL. + * + * @param {URL|string} url - An absolute, or relative, URL. + * @param {URL|string} [baseUrl] - An absolute URL. + * @param {Object} [options] + * @returns Either a valid {URL}, or `null` otherwise. + */ +export function createValidAbsoluteUrl(url: URL | string, baseUrl?: URL | string, options?: Object): URL | null; +export namespace DocumentActionEventType { + let WC: string; + let WS: string; + let DS: string; + let WP: string; + let DP: string; +} +export namespace DrawOPS { + let moveTo: number; + let lineTo: number; + let curveTo: number; + let closePath: number; +} +export class FeatureTest { + static get isLittleEndian(): any; + static get isEvalSupported(): any; + static get isOffscreenCanvasSupported(): any; + static get isImageDecoderSupported(): any; + static get platform(): any; + static get isCSSRoundSupported(): any; +} +export const FONT_IDENTITY_MATRIX: number[]; +declare const FormatError_base: any; +/** + * Error caused during parsing PDF data. + */ +export class FormatError extends FormatError_base { + [x: string]: any; + constructor(msg: any); +} +export function fromBase64Util(str: any): any; +export function getModificationDate(date?: Date): string; +export function getUuid(): string; +export function getVerbosityLevel(): number; +export const hexNumbers: string[]; +export namespace ImageKind { + let GRAYSCALE_1BPP: number; + let RGB_24BPP: number; + let RGBA_32BPP: number; +} +export function info(msg: any): void; +declare const InvalidPDFException_base: any; +export class InvalidPDFException extends InvalidPDFException_base { + [x: string]: any; + constructor(msg: any); +} +export function isArrayEqual(arr1: any, arr2: any): boolean; +export const isNodeJS: any; +export const LINE_DESCENT_FACTOR: 0.35; +export const LINE_FACTOR: 1.35; +export function MathClamp(v: any, min: any, max: any): number; +export function normalizeUnicode(str: any): any; +export function objectSize(obj: any): number; +export namespace OPS { + export let dependency: number; + export let setLineWidth: number; + export let setLineCap: number; + export let setLineJoin: number; + export let setMiterLimit: number; + export let setDash: number; + export let setRenderingIntent: number; + export let setFlatness: number; + export let setGState: number; + export let save: number; + export let restore: number; + export let transform: number; + let moveTo_1: number; + export { moveTo_1 as moveTo }; + let lineTo_1: number; + export { lineTo_1 as lineTo }; + let curveTo_1: number; + export { curveTo_1 as curveTo }; + export let curveTo2: number; + export let curveTo3: number; + let closePath_1: number; + export { closePath_1 as closePath }; + export let rectangle: number; + export let stroke: number; + export let closeStroke: number; + export let fill: number; + export let eoFill: number; + export let fillStroke: number; + export let eoFillStroke: number; + export let closeFillStroke: number; + export let closeEOFillStroke: number; + export let endPath: number; + export let clip: number; + export let eoClip: number; + export let beginText: number; + export let endText: number; + export let setCharSpacing: number; + export let setWordSpacing: number; + export let setHScale: number; + export let setLeading: number; + export let setFont: number; + export let setTextRenderingMode: number; + export let setTextRise: number; + export let moveText: number; + export let setLeadingMoveText: number; + export let setTextMatrix: number; + export let nextLine: number; + export let showText: number; + export let showSpacedText: number; + export let nextLineShowText: number; + export let nextLineSetSpacingShowText: number; + export let setCharWidth: number; + export let setCharWidthAndBounds: number; + export let setStrokeColorSpace: number; + export let setFillColorSpace: number; + export let setStrokeColor: number; + export let setStrokeColorN: number; + export let setFillColor: number; + export let setFillColorN: number; + export let setStrokeGray: number; + export let setFillGray: number; + export let setStrokeRGBColor: number; + export let setFillRGBColor: number; + export let setStrokeCMYKColor: number; + export let setFillCMYKColor: number; + export let shadingFill: number; + export let beginInlineImage: number; + export let beginImageData: number; + export let endInlineImage: number; + export let paintXObject: number; + export let markPoint: number; + export let markPointProps: number; + export let beginMarkedContent: number; + export let beginMarkedContentProps: number; + export let endMarkedContent: number; + export let beginCompat: number; + export let endCompat: number; + export let paintFormXObjectBegin: number; + export let paintFormXObjectEnd: number; + export let beginGroup: number; + export let endGroup: number; + export let beginAnnotation: number; + export let endAnnotation: number; + export let paintImageMaskXObject: number; + export let paintImageMaskXObjectGroup: number; + export let paintImageXObject: number; + export let paintInlineImageXObject: number; + export let paintInlineImageXObjectGroup: number; + export let paintImageXObjectRepeat: number; + export let paintImageMaskXObjectRepeat: number; + export let paintSolidColorImageMask: number; + export let constructPath: number; + export let setStrokeTransparent: number; + export let setFillTransparent: number; + export let rawFillPath: number; +} +export namespace PageActionEventType { + export let O: string; + let C_1: string; + export { C_1 as C }; +} +declare const PasswordException_base: any; +export class PasswordException extends PasswordException_base { + [x: string]: any; + constructor(msg: any, code: any); + code: any; +} +export namespace PasswordResponses { + let NEED_PASSWORD: number; + let INCORRECT_PASSWORD: number; +} +export namespace PermissionFlag { + let PRINT_1: number; + export { PRINT_1 as PRINT }; + export let MODIFY_CONTENTS: number; + export let COPY: number; + export let MODIFY_ANNOTATIONS: number; + export let FILL_INTERACTIVE_FORMS: number; + export let COPY_FOR_ACCESSIBILITY: number; + export let ASSEMBLE: number; + export let PRINT_HIGH_QUALITY: number; +} +export namespace RenderingIntentFlag { + export let ANY: number; + export let DISPLAY: number; + let PRINT_2: number; + export { PRINT_2 as PRINT }; + export let SAVE: number; + export let ANNOTATIONS_FORMS: number; + export let ANNOTATIONS_STORAGE: number; + export let ANNOTATIONS_DISABLE: number; + export let IS_EDITING: number; + export let OPLIST: number; +} +declare const ResponseException_base: any; +export class ResponseException extends ResponseException_base { + [x: string]: any; + constructor(msg: any, status: any, missing: any); + status: any; + missing: any; +} +export function setVerbosityLevel(level: any): void; +export function shadow(obj: any, prop: any, value: any, nonSerializable?: boolean): any; +export function string32(value: any): string; +export function stringToBytes(str: any): Uint8Array; +export function stringToPDFString(str: any, keepEscapeSequence?: boolean): string; +export function stringToUTF8String(str: any): string; +export namespace TextRenderingMode { + export let FILL: number; + export let STROKE: number; + export let FILL_STROKE: number; + let INVISIBLE_1: number; + export { INVISIBLE_1 as INVISIBLE }; + export let FILL_ADD_TO_PATH: number; + export let STROKE_ADD_TO_PATH: number; + export let FILL_STROKE_ADD_TO_PATH: number; + export let ADD_TO_PATH: number; + export let FILL_STROKE_MASK: number; + export let ADD_TO_PATH_FLAG: number; +} +export function toBase64Util(arr: any): any; +export function toHexUtil(arr: any): any; +declare const UnknownErrorException_base: any; +export class UnknownErrorException extends UnknownErrorException_base { + [x: string]: any; + constructor(msg: any, details: any); + details: any; +} +export function unreachable(msg: any): void; +/** + * Remove, or replace, the hash property of the URL. + * + * @param {URL|string} url - The absolute, or relative, URL. + * @param {string} hash - The hash property (use an empty string to remove it). + * @param {boolean} [allowRel] - Allow relative URLs. + * @returns {string} The resulting URL string. + */ +export function updateUrlHash(url: URL | string, hash: string, allowRel?: boolean): string; +export function utf8StringToString(str: any): string; +export class Util { + static makeHexColor(r: any, g: any, b: any): string; + static scaleMinMax(transform: any, minMax: any): void; + static transform(m1: any, m2: any): any[]; + static applyTransform(p: any, m: any, pos?: number): void; + static applyTransformToBezier(p: any, transform: any, pos?: number): void; + static applyInverseTransform(p: any, m: any): void; + static axialAlignedBoundingBox(rect: any, transform: any, output: any): void; + static inverseTransform(m: any): number[]; + static singularValueDecompose2dScale(matrix: any, output: any): void; + static normalizeRect(rect: any): any; + static intersect(rect1: any, rect2: any): number[] | null; + static pointBoundingBox(x: any, y: any, minMax: any): void; + static rectBoundingBox(x0: any, y0: any, x1: any, y1: any, minMax: any): void; + static "__#1@#getExtremumOnCurve"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, t: any, minMax: any): void; + static "__#1@#getExtremum"(x0: any, x1: any, x2: any, x3: any, y0: any, y1: any, y2: any, y3: any, a: any, b: any, c: any, minMax: any): void; + static bezierBoundingBox(x0: any, y0: any, x1: any, y1: any, x2: any, y2: any, x3: any, y3: any, minMax: any): void; +} +export namespace VerbosityLevel { + let ERRORS: number; + let WARNINGS: number; + let INFOS: number; +} +export function warn(msg: any): void; +export {}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/annotation_editor_layer_builder.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/annotation_editor_layer_builder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..87c3251cc47a81882ce72d63f78f00a4d49efe67 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/annotation_editor_layer_builder.d.ts @@ -0,0 +1,65 @@ +export type PDFPageProxy = import("../src/display/api").PDFPageProxy; +export type PageViewport = import("../src/display/display_utils").PageViewport; +export type AnnotationEditorUIManager = import("../src/display/editor/tools.js").AnnotationEditorUIManager; +export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager; +export type IL10n = import("./interfaces").IL10n; +export type AnnotationLayer = import("../src/display/annotation_layer.js").AnnotationLayer; +export type StructTreeLayerBuilder = any; +export type AnnotationEditorLayerBuilderOptions = { + uiManager?: import("../src/pdf").AnnotationEditorUIManager | undefined; + pdfPage: PDFPageProxy; + l10n?: import("./interfaces").IL10n | undefined; + structTreeLayer?: StructTreeLayerBuilder; + accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined; + annotationLayer?: import("../src/pdf").AnnotationLayer | undefined; + textLayer?: TextLayer; + drawLayer?: DrawLayer; + onAppend?: Function | undefined; +}; +export type AnnotationEditorLayerBuilderRenderOptions = { + viewport: PageViewport; + /** + * - The default value is "display". + */ + intent?: string | undefined; +}; +/** + * @typedef {Object} AnnotationEditorLayerBuilderOptions + * @property {AnnotationEditorUIManager} [uiManager] + * @property {PDFPageProxy} pdfPage + * @property {IL10n} [l10n] + * @property {StructTreeLayerBuilder} [structTreeLayer] + * @property {TextAccessibilityManager} [accessibilityManager] + * @property {AnnotationLayer} [annotationLayer] + * @property {TextLayer} [textLayer] + * @property {DrawLayer} [drawLayer] + * @property {function} [onAppend] + */ +/** + * @typedef {Object} AnnotationEditorLayerBuilderRenderOptions + * @property {PageViewport} viewport + * @property {string} [intent] - The default value is "display". + */ +export class AnnotationEditorLayerBuilder { + /** + * @param {AnnotationEditorLayerBuilderOptions} options + */ + constructor(options: AnnotationEditorLayerBuilderOptions); + pdfPage: import("../src/display/api").PDFPageProxy; + accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager | undefined; + l10n: import("./interfaces").IL10n | GenericL10n | undefined; + annotationEditorLayer: AnnotationEditorLayer | null; + div: HTMLDivElement | null; + _cancelled: boolean; + /** + * @param {AnnotationEditorLayerBuilderRenderOptions} options + * @returns {Promise} + */ + render({ viewport, intent }: AnnotationEditorLayerBuilderRenderOptions): Promise; + cancel(): void; + hide(): void; + show(): void; + #private; +} +import { GenericL10n } from "./genericl10n"; +import { AnnotationEditorLayer } from "../src/pdf"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/annotation_layer_builder.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/annotation_layer_builder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..28165de91ccfa9f1e586449791d7416d90e5732a --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/annotation_layer_builder.d.ts @@ -0,0 +1,113 @@ +export type PDFPageProxy = import("../src/display/api").PDFPageProxy; +export type PageViewport = import("../src/display/display_utils").PageViewport; +export type AnnotationStorage = import("../src/display/annotation_storage").AnnotationStorage; +export type IDownloadManager = import("./interfaces").IDownloadManager; +export type IPDFLinkService = import("./interfaces").IPDFLinkService; +export type StructTreeLayerBuilder = import("./struct_tree_layer_builder.js").StructTreeLayerBuilder; +export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager; +export type AnnotationEditorUIManager = import("../src/display/editor/tools.js").AnnotationEditorUIManager; +export type AnnotationLayerBuilderOptions = { + pdfPage: PDFPageProxy; + annotationStorage?: import("../src/display/annotation_storage").AnnotationStorage | undefined; + /** + * - Path for image resources, mainly + * for annotation icons. Include trailing slash. + */ + imageResourcesPath?: string | undefined; + renderForms: boolean; + linkService: IPDFLinkService; + downloadManager?: import("./interfaces").IDownloadManager | undefined; + enableScripting?: boolean | undefined; + hasJSActionsPromise?: Promise | undefined; + fieldObjectsPromise?: Promise<{ + [x: string]: Object[]; + } | null> | undefined; + annotationCanvasMap?: Map | undefined; + accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined; + annotationEditorUIManager?: import("../src/pdf").AnnotationEditorUIManager | undefined; + onAppend?: Function | undefined; +}; +export type AnnotationLayerBuilderRenderOptions = { + viewport: PageViewport; + /** + * - The default value is "display". + */ + intent?: string | undefined; + structTreeLayer?: import("./struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined; +}; +export type InjectLinkAnnotationsOptions = { + inferredLinks: Array; + viewport: PageViewport; + structTreeLayer?: import("./struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined; +}; +/** + * @typedef {Object} AnnotationLayerBuilderOptions + * @property {PDFPageProxy} pdfPage + * @property {AnnotationStorage} [annotationStorage] + * @property {string} [imageResourcesPath] - Path for image resources, mainly + * for annotation icons. Include trailing slash. + * @property {boolean} renderForms + * @property {IPDFLinkService} linkService + * @property {IDownloadManager} [downloadManager] + * @property {boolean} [enableScripting] + * @property {Promise} [hasJSActionsPromise] + * @property {Promise> | null>} + * [fieldObjectsPromise] + * @property {Map} [annotationCanvasMap] + * @property {TextAccessibilityManager} [accessibilityManager] + * @property {AnnotationEditorUIManager} [annotationEditorUIManager] + * @property {function} [onAppend] + */ +/** + * @typedef {Object} AnnotationLayerBuilderRenderOptions + * @property {PageViewport} viewport + * @property {string} [intent] - The default value is "display". + * @property {StructTreeLayerBuilder} [structTreeLayer] + */ +/** + * @typedef {Object} InjectLinkAnnotationsOptions + * @property {Array} inferredLinks + * @property {PageViewport} viewport + * @property {StructTreeLayerBuilder} [structTreeLayer] + */ +export class AnnotationLayerBuilder { + /** + * @param {AnnotationLayerBuilderOptions} options + */ + constructor({ pdfPage, linkService, downloadManager, annotationStorage, imageResourcesPath, renderForms, enableScripting, hasJSActionsPromise, fieldObjectsPromise, annotationCanvasMap, accessibilityManager, annotationEditorUIManager, onAppend, }: AnnotationLayerBuilderOptions); + pdfPage: import("../src/display/api").PDFPageProxy; + linkService: import("./interfaces").IPDFLinkService; + downloadManager: import("./interfaces").IDownloadManager | undefined; + imageResourcesPath: string; + renderForms: boolean; + annotationStorage: import("../src/display/annotation_storage").AnnotationStorage; + enableScripting: boolean; + _hasJSActionsPromise: Promise; + _fieldObjectsPromise: Promise<{ + [x: string]: Object[]; + } | null>; + _annotationCanvasMap: Map; + _accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager; + _annotationEditorUIManager: import("../src/pdf").AnnotationEditorUIManager; + annotationLayer: AnnotationLayer | null; + div: HTMLDivElement | null; + _cancelled: boolean; + _eventBus: any; + /** + * @param {AnnotationLayerBuilderRenderOptions} options + * @returns {Promise} A promise that is resolved when rendering of the + * annotations is complete. + */ + render({ viewport, intent, structTreeLayer }: AnnotationLayerBuilderRenderOptions): Promise; + cancel(): void; + hide(internal?: boolean): void; + hasEditableAnnotations(): boolean; + /** + * @param {InjectLinkAnnotationsOptions} options + * @returns {Promise} A promise that is resolved when the inferred links + * are added to the annotation layer. + */ + injectLinkAnnotations({ inferredLinks, viewport, structTreeLayer, }: InjectLinkAnnotationsOptions): Promise; + #private; +} +import { AnnotationLayer } from "../src/pdf"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/app_options.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/app_options.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8b970a4b6e07bb8621045a7c8a660e3ac7120174 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/app_options.d.ts @@ -0,0 +1,16 @@ +export class AppOptions { + static eventBus: any; + static "__#75@#opts": Map; + static get(name: any): any; + static getAll(kind?: null, defaultOnly?: boolean): any; + static set(name: any, value: any): void; + static setAll(options: any, prefs?: boolean): void; +} +export namespace OptionKind { + let BROWSER: number; + let VIEWER: number; + let API: number; + let WORKER: number; + let EVENT_DISPATCH: number; + let PREFERENCE: number; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/autolinker.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/autolinker.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8975da1b004b25f46b475dd60fdac59e5408529f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/autolinker.d.ts @@ -0,0 +1,28 @@ +export class Autolinker { + static "__#76@#index": number; + static "__#76@#regex": any; + static findLinks(text: any): { + url: string; + index: any; + length: any; + }[]; + static processLinks(pdfPageView: any): ({ + borderStyle: null; + rect: any; + quadPoints?: undefined; + id: string; + unsafeUrl: any; + url: any; + annotationType: number; + rotation: number; + } | { + borderStyle: null; + quadPoints: any[]; + rect: number[]; + id: string; + unsafeUrl: any; + url: any; + annotationType: number; + rotation: number; + })[]; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/base_pdf_page_view.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/base_pdf_page_view.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..478ec4ad733715f4a7fc66363166470048e3ec69 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/base_pdf_page_view.d.ts @@ -0,0 +1,26 @@ +export class BasePDFPageView { + constructor(options: any); + canvas: null; + /** @type {null | HTMLDivElement} */ + div: null | HTMLDivElement; + eventBus: null; + id: null; + pageColors: null; + renderingQueue: null; + renderTask: null; + resume: null; + set renderingState(state: number); + get renderingState(): number; + _createCanvas(onShow: any, hideUntilComplete?: boolean): { + canvas: HTMLCanvasElement; + prevCanvas: null; + }; + _resetCanvas(): void; + _drawCanvas(options: any, onCancel: any, onFinish: any): Promise; + cancelRendering({ cancelExtraDelay }?: { + cancelExtraDelay?: number | undefined; + }): void; + dispatchPageRender(): void; + dispatchPageRendered(cssTransform: any, isDetailView: any): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/download_manager.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/download_manager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e82b16a447e3c4e50e2f6fcecbb971a8c9b74b58 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/download_manager.d.ts @@ -0,0 +1,13 @@ +export type IDownloadManager = import("./interfaces").IDownloadManager; +/** + * @implements {IDownloadManager} + */ +export class DownloadManager implements IDownloadManager { + downloadData(data: any, filename: any, contentType: any): void; + /** + * @returns {boolean} Indicating if the data was opened. + */ + openOrDownloadData(data: any, filename: any, dest?: null): boolean; + download(data: any, url: any, filename: any): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/draw_layer_builder.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/draw_layer_builder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e500e0c2f5f9d6978167b54f90832bebd713f449 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/draw_layer_builder.d.ts @@ -0,0 +1,34 @@ +export type DrawLayerBuilderOptions = { + pageIndex: number; +}; +export type DrawLayerBuilderRenderOptions = { + /** + * - The default value is "display". + */ + intent?: string | undefined; +}; +/** + * @typedef {Object} DrawLayerBuilderOptions + * @property {number} pageIndex + */ +/** + * @typedef {Object} DrawLayerBuilderRenderOptions + * @property {string} [intent] - The default value is "display". + */ +export class DrawLayerBuilder { + /** + * @param {DrawLayerBuilderOptions} options + */ + constructor(options: DrawLayerBuilderOptions); + pageIndex: number; + /** + * @param {DrawLayerBuilderRenderOptions} options + * @returns {Promise} + */ + render({ intent }: DrawLayerBuilderRenderOptions): Promise; + cancel(): void; + _cancelled: boolean | undefined; + setParent(parent: any): void; + getDrawLayer(): null; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/event_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/event_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6c8f7eca1c15aca77396a201777c476b420040b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/event_utils.d.ts @@ -0,0 +1,77 @@ +export type WaitOnEventOrTimeoutParameters = { + /** + * - The event target, can for example be: + * `window`, `document`, a DOM element, or an {EventBus} instance. + */ + target: Object; + /** + * - The name of the event. + */ + name: string; + /** + * - The delay, in milliseconds, after which the + * timeout occurs (if the event wasn't already dispatched). + */ + delay: number; +}; +/** + * Simple event bus for an application. Listeners are attached using the `on` + * and `off` methods. To raise an event, the `dispatch` method shall be used. + */ +export class EventBus { + /** + * @param {string} eventName + * @param {function} listener + * @param {Object} [options] + */ + on(eventName: string, listener: Function, options?: Object): void; + /** + * @param {string} eventName + * @param {function} listener + * @param {Object} [options] + */ + off(eventName: string, listener: Function, options?: Object): void; + /** + * @param {string} eventName + * @param {Object} data + */ + dispatch(eventName: string, data: Object): void; + /** + * @ignore + */ + _on(eventName: any, listener: any, options?: null): void; + /** + * @ignore + */ + _off(eventName: any, listener: any, options?: null): void; + #private; +} +/** + * NOTE: Only used in the Firefox built-in pdf viewer. + */ +export class FirefoxEventBus extends EventBus { + constructor(globalEventNames: any, externalServices: any, isInAutomation: any); + dispatch(eventName: any, data: any): void; + #private; +} +/** + * @typedef {Object} WaitOnEventOrTimeoutParameters + * @property {Object} target - The event target, can for example be: + * `window`, `document`, a DOM element, or an {EventBus} instance. + * @property {string} name - The name of the event. + * @property {number} delay - The delay, in milliseconds, after which the + * timeout occurs (if the event wasn't already dispatched). + */ +/** + * Allows waiting for an event or a timeout, whichever occurs first. + * Can be used to ensure that an action always occurs, even when an event + * arrives late or not at all. + * + * @param {WaitOnEventOrTimeoutParameters} + * @returns {Promise} A promise that is resolved with a {WaitOnType} value. + */ +export function waitOnEventOrTimeout({ target, name, delay }: WaitOnEventOrTimeoutParameters): Promise; +export namespace WaitOnType { + let EVENT: string; + let TIMEOUT: string; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/generic_scripting.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/generic_scripting.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fdbfee711d28996ca839d8e1347f82940d6b18b1 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/generic_scripting.d.ts @@ -0,0 +1,8 @@ +export function docProperties(pdfDocument: any): Promise; +export class GenericScripting { + constructor(sandboxBundleSrc: any); + _ready: Promise; + createSandbox(data: any): Promise; + dispatchEventInSandbox(event: any): Promise; + destroySandbox(): Promise; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/genericl10n.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/genericl10n.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..77fae2995bfaf3f3883f37a1eaa989950ebf843f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/genericl10n.d.ts @@ -0,0 +1,22 @@ +export type IL10n = import("./interfaces").IL10n; +/** + * @implements {IL10n} + */ +export class GenericL10n extends L10n implements IL10n { + /** + * Generate the bundles for Fluent. + * @param {String} defaultLang - The fallback language to use for + * translations. + * @param {String} baseLang - The base language to use for translations. + */ + static "__#72@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator; + static "__#72@#createBundle"(lang: any, baseURL: any, paths: any): Promise; + static "__#72@#getPaths"(): Promise<{ + baseURL: any; + paths: any; + }>; + static "__#72@#generateBundlesFallback"(lang: any): AsyncGenerator; + static "__#72@#createBundleFallback"(lang: any): Promise; + constructor(lang: any); +} +import { L10n } from "./l10n.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/interfaces.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/interfaces.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e97e8a4bae99df715d34f9b85944eca9e5ac144c --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/interfaces.d.ts @@ -0,0 +1,167 @@ +export type PDFPageProxy = import("../src/display/api").PDFPageProxy; +export type PageViewport = import("../src/display/display_utils").PageViewport; +export type RenderingStates = any; +/** + * @interface + */ +export class IDownloadManager { + /** + * @param {Uint8Array} data + * @param {string} filename + * @param {string} [contentType] + */ + downloadData(data: Uint8Array, filename: string, contentType?: string): void; + /** + * @param {Uint8Array} data + * @param {string} filename + * @param {string | null} [dest] + * @returns {boolean} Indicating if the data was opened. + */ + openOrDownloadData(data: Uint8Array, filename: string, dest?: string | null): boolean; + /** + * @param {Uint8Array} data + * @param {string} url + * @param {string} filename + */ + download(data: Uint8Array, url: string, filename: string): void; +} +/** + * @interface + */ +export class IL10n { + /** + * @returns {string} - The current locale. + */ + getLanguage(): string; + /** + * @returns {string} - 'rtl' or 'ltr'. + */ + getDirection(): string; + /** + * Translates text identified by the key and adds/formats data using the args + * property bag. If the key was not found, translation falls back to the + * fallback text. + * @param {Array | string} ids + * @param {Object | null} [args] + * @param {string} [fallback] + * @returns {Promise} + */ + get(ids: any[] | string, args?: Object | null, fallback?: string): Promise; + /** + * Translates HTML element. + * @param {HTMLElement} element + * @returns {Promise} + */ + translate(element: HTMLElement): Promise; + /** + * Pause the localization. + */ + pause(): void; + /** + * Resume the localization. + */ + resume(): void; +} +/** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */ +/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */ +/** @typedef {import("./ui_utils").RenderingStates} RenderingStates */ +/** + * @interface + */ +export class IPDFLinkService { + /** + * @type {number} + */ + get pagesCount(): number; + /** + * @param {number} value + */ + set page(value: number); + /** + * @type {number} + */ + get page(): number; + /** + * @param {number} value + */ + set rotation(value: number); + /** + * @type {number} + */ + get rotation(): number; + /** + * @type {boolean} + */ + get isInPresentationMode(): boolean; + /** + * @param {boolean} value + */ + set externalLinkEnabled(value: boolean); + /** + * @type {boolean} + */ + get externalLinkEnabled(): boolean; + /** + * @param {string|Array} dest - The named, or explicit, PDF destination. + */ + goToDestination(dest: string | any[]): Promise; + /** + * @param {number|string} val - The page number, or page label. + */ + goToPage(val: number | string): void; + /** + * @param {HTMLAnchorElement} link + * @param {string} url + * @param {boolean} [newWindow] + */ + addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean): void; + /** + * @param dest - The PDF destination object. + * @returns {string} The hyperlink to the PDF object. + */ + getDestinationHash(dest: any): string; + /** + * @param hash - The PDF parameters/hash. + * @returns {string} The hyperlink to the PDF object. + */ + getAnchorUrl(hash: any): string; + /** + * @param {string} hash + */ + setHash(hash: string): void; + /** + * @param {string} action + */ + executeNamedAction(action: string): void; + /** + * @param {Object} action + */ + executeSetOCGState(action: Object): void; +} +/** + * @interface + */ +export class IPDFPrintServiceFactory { + static initGlobals(): void; + static get supportsPrinting(): boolean; + static createPrintService(): void; +} +/** + * @interface + */ +export class IRenderableView { + /** @type {function | null} */ + resume: Function | null; + /** + * @type {string} - Unique ID for rendering queue. + */ + get renderingId(): string; + /** + * @type {RenderingStates} + */ + get renderingState(): RenderingStates; + /** + * @returns {Promise} Resolved on draw completion. + */ + draw(): Promise; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/l10n.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/l10n.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d22c66d14b286a97598fb2dc22b926dfdac9dadd --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/l10n.d.ts @@ -0,0 +1,34 @@ +export type IL10n = import("./interfaces").IL10n; +export const GenericL10n: null; +/** @typedef {import("./interfaces").IL10n} IL10n */ +/** + * NOTE: The L10n-implementations should use lowercase language-codes + * internally. + * @implements {IL10n} + */ +export class L10n implements IL10n { + static "__#71@#fixupLangCode"(langCode: any): any; + static "__#71@#isRTL"(lang: any): boolean; + constructor({ lang, isRTL }: { + lang: any; + isRTL: any; + }, l10n?: null); + _setL10n(l10n: any): void; + /** @inheritdoc */ + getLanguage(): any; + /** @inheritdoc */ + getDirection(): string; + /** @inheritdoc */ + get(ids: any, args: null | undefined, fallback: any): Promise; + /** @inheritdoc */ + translate(element: any): Promise; + /** @inheritdoc */ + translateOnce(element: any): Promise; + /** @inheritdoc */ + destroy(): Promise; + /** @inheritdoc */ + pause(): void; + /** @inheritdoc */ + resume(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_find_controller.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_find_controller.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..67f194398d32f45330efc62fcc99ccc4f019d0fa --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_find_controller.d.ts @@ -0,0 +1,134 @@ +export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy; +export type EventBus = import("./event_utils").EventBus; +export type IPDFLinkService = import("./interfaces").IPDFLinkService; +export type PDFFindControllerOptions = { + /** + * - The navigation/linking service. + */ + linkService: IPDFLinkService; + /** + * - The application event bus. + */ + eventBus: EventBus; + /** + * - True if the matches + * count must be updated on progress or only when the last page is reached. + * The default value is `true`. + */ + updateMatchesCountOnProgress?: boolean | undefined; +}; +export namespace FindState { + let FOUND: number; + let NOT_FOUND: number; + let WRAPPED: number; + let PENDING: number; +} +export function getOriginalIndex(diffs: any, pos: any, len: any): any[]; +export function normalize(text: any, options?: {}): any[]; +/** + * @typedef {Object} PDFFindControllerOptions + * @property {IPDFLinkService} linkService - The navigation/linking service. + * @property {EventBus} eventBus - The application event bus. + * @property {boolean} [updateMatchesCountOnProgress] - True if the matches + * count must be updated on progress or only when the last page is reached. + * The default value is `true`. + */ +/** + * Provides search functionality to find a given string in a PDF document. + */ +export class PDFFindController { + /** + * @param {PDFFindControllerOptions} options + */ + constructor({ linkService, eventBus, updateMatchesCountOnProgress }: PDFFindControllerOptions); + _linkService: import("./interfaces").IPDFLinkService; + _eventBus: import("./event_utils").EventBus; + /** + * Callback used to check if a `pageNumber` is currently visible. + * @type {function} + */ + onIsPageVisible: Function; + get highlightMatches(): boolean | undefined; + get pageMatches(): any[] | undefined; + get pageMatchesLength(): any[] | undefined; + get selected(): { + pageIdx: number; + matchIdx: number; + } | undefined; + get state(): null; + /** + * Set a reference to the PDF document in order to search it. + * Note that searching is not possible if this method is not called. + * + * @param {PDFDocumentProxy} pdfDocument - The PDF document to search. + */ + setDocument(pdfDocument: PDFDocumentProxy): void; + _pdfDocument: import("../src/display/api").PDFDocumentProxy | null | undefined; + _dirtyMatch: boolean | undefined; + _findTimeout: any; + _highlightMatches: boolean | undefined; + /** + * @typedef {Object} PDFFindControllerScrollMatchIntoViewParams + * @property {HTMLElement} element + * @property {number} selectedLeft + * @property {number} pageIndex + * @property {number} matchIndex + */ + /** + * Scroll the current match into view. + * @param {PDFFindControllerScrollMatchIntoViewParams} + */ + scrollMatchIntoView({ element, selectedLeft, pageIndex, matchIndex, }: { + element: HTMLElement; + selectedLeft: number; + pageIndex: number; + matchIndex: number; + }): void; + _scrollMatches: boolean | undefined; + _pageMatches: any[] | undefined; + _pageMatchesLength: any[] | undefined; + _selected: { + pageIdx: number; + matchIdx: number; + } | undefined; + _offset: { + pageIdx: null; + matchIdx: null; + wrapped: boolean; + } | undefined; + _extractTextPromises: any[] | undefined; + _pageContents: any[] | undefined; + _pageDiffs: any[] | undefined; + _hasDiacritics: any[] | undefined; + _matchesCountTotal: number | undefined; + _pagesToSearch: number | null | undefined; + _pendingFindMatches: Set | undefined; + _resumePageIdx: any; + _firstPageCapability: any; + _rawQuery: any; + /** + * @typedef {Object} FindMatch + * @property {number} index - The start of the matched text in the page's + * string contents. + * @property {number} length - The length of the matched text. + */ + /** + * @param {string | string[]} query - The search query. + * @param {string} pageContent - The text content of the page to search in. + * @param {number} pageIndex - The index of the page that is being processed. + * @returns {FindMatch[] | undefined} An array of matches in the provided + * page. + */ + match(query: string | string[], pageContent: string, pageIndex: number): { + /** + * - The start of the matched text in the page's + * string contents. + */ + index: number; + /** + * - The length of the matched text. + */ + length: number; + }[] | undefined; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_find_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_find_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cbdd962f6d74740728305eb8948743037e0bff38 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_find_utils.d.ts @@ -0,0 +1,16 @@ +export namespace CharacterType { + let SPACE: number; + let ALPHA_LETTER: number; + let PUNCT: number; + let HAN_LETTER: number; + let KATAKANA_LETTER: number; + let HIRAGANA_LETTER: number; + let HALFWIDTH_KATAKANA_LETTER: number; + let THAI_LETTER: number; +} +/** + * This function is based on the word-break detection implemented in: + * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp + */ +export function getCharacterType(charCode: any): number; +export function getNormalizeWithNFKC(): any; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_history.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_history.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d7d526e404ecad93157ce98c9fb7f370bb8cb601 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_history.d.ts @@ -0,0 +1,116 @@ +export type PDFHistoryOptions = { + /** + * - The navigation/linking service. + */ + linkService: IPDFLinkService; + /** + * - The application event bus. + */ + eventBus: EventBus; +}; +export type InitializeParameters = { + /** + * - The PDF document's unique fingerprint. + */ + fingerprint: string; + /** + * - Reset the browsing history. + */ + resetHistory?: boolean | undefined; + /** + * - Attempt to update the document URL, with + * the current hash, when pushing/replacing browser history entries. + */ + updateUrl?: boolean | undefined; +}; +export type PushParameters = { + /** + * - The named destination. If absent, a + * stringified version of `explicitDest` is used. + */ + namedDest?: string | undefined; + /** + * - The explicit destination array. + */ + explicitDest: any[]; + /** + * - The page to which the destination points. + */ + pageNumber: number; +}; +export type EventBus = import("./event_utils").EventBus; +export type IPDFLinkService = import("./interfaces").IPDFLinkService; +export function isDestArraysEqual(firstDest: any, secondDest: any): boolean; +export function isDestHashesEqual(destHash: any, pushHash: any): boolean; +export class PDFHistory { + /** + * @param {PDFHistoryOptions} options + */ + constructor({ linkService, eventBus }: PDFHistoryOptions); + linkService: import("./interfaces").IPDFLinkService; + eventBus: import("./event_utils.js").EventBus; + _initialized: boolean; + _fingerprint: string; + _isPagesLoaded: boolean; + /** + * Initialize the history for the PDF document, using either the current + * browser history entry or the document hash, whichever is present. + * @param {InitializeParameters} params + */ + initialize({ fingerprint, resetHistory, updateUrl }: InitializeParameters): void; + _updateUrl: boolean | undefined; + _popStateInProgress: boolean | undefined; + _blockHashChange: number | undefined; + _currentHash: string | undefined; + _numPositionUpdates: number | undefined; + _uid: any; + _maxUid: any; + _destination: any; + _position: { + hash: any; + page: number; + first: any; + rotation: any; + } | null | undefined; + _initialRotation: any; + _initialBookmark: any; + /** + * Reset the current `PDFHistory` instance, and consequently prevent any + * further updates and/or navigation of the browser history. + */ + reset(): void; + _updateViewareaTimeout: any; + /** + * Push an internal destination to the browser history. + * @param {PushParameters} + */ + push({ namedDest, explicitDest, pageNumber }: PushParameters): void; + /** + * Push a page to the browser history; generally the `push` method should be + * used instead. + * @param {number} pageNumber + */ + pushPage(pageNumber: number): void; + /** + * Push the current position to the browser history. + */ + pushCurrentPosition(): void; + /** + * Go back one step in the browser history. + * NOTE: Avoids navigating away from the document, useful for "named actions". + */ + back(): void; + /** + * Go forward one step in the browser history. + * NOTE: Avoids navigating away from the document, useful for "named actions". + */ + forward(): void; + /** + * @type {boolean} Indicating if the user is currently moving through the + * browser history, useful e.g. for skipping the next 'hashchange' event. + */ + get popStateInProgress(): boolean; + get initialBookmark(): any; + get initialRotation(): any; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_link_service.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_link_service.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..96554f6177a959b959277f77602023ad01216969 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_link_service.d.ts @@ -0,0 +1,139 @@ +export type EventBus = import("./event_utils").EventBus; +export type IPDFLinkService = import("./interfaces").IPDFLinkService; +export type PDFLinkServiceOptions = { + /** + * - The application event bus. + */ + eventBus: EventBus; + /** + * - Specifies the `target` attribute + * for external links. Must use one of the values from {LinkTarget}. + * Defaults to using no target. + */ + externalLinkTarget?: number | undefined; + /** + * - Specifies the `rel` attribute for + * external links. Defaults to stripping the referrer. + */ + externalLinkRel?: string | undefined; + /** + * - Ignores the zoom argument, + * thus preserving the current zoom level in the viewer, when navigating + * to internal destinations. The default value is `false`. + */ + ignoreDestinationZoom?: boolean | undefined; +}; +export namespace LinkTarget { + let NONE: number; + let SELF: number; + let BLANK: number; + let PARENT: number; + let TOP: number; +} +/** + * @typedef {Object} PDFLinkServiceOptions + * @property {EventBus} eventBus - The application event bus. + * @property {number} [externalLinkTarget] - Specifies the `target` attribute + * for external links. Must use one of the values from {LinkTarget}. + * Defaults to using no target. + * @property {string} [externalLinkRel] - Specifies the `rel` attribute for + * external links. Defaults to stripping the referrer. + * @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument, + * thus preserving the current zoom level in the viewer, when navigating + * to internal destinations. The default value is `false`. + */ +/** + * Performs navigation functions inside PDF, such as opening specified page, + * or destination. + * @implements {IPDFLinkService} + */ +export class PDFLinkService implements IPDFLinkService { + /** + * @param {PDFLinkServiceOptions} options + */ + constructor({ eventBus, externalLinkTarget, externalLinkRel, ignoreDestinationZoom, }?: PDFLinkServiceOptions); + externalLinkEnabled: boolean; + eventBus: import("./event_utils").EventBus; + externalLinkTarget: number; + externalLinkRel: string; + _ignoreDestinationZoom: boolean; + baseUrl: any; + pdfDocument: any; + pdfViewer: any; + pdfHistory: any; + setDocument(pdfDocument: any, baseUrl?: null): void; + setViewer(pdfViewer: any): void; + setHistory(pdfHistory: any): void; + /** + * @type {number} + */ + get pagesCount(): number; + /** + * @param {number} value + */ + set page(value: number); + /** + * @type {number} + */ + get page(): number; + /** + * @param {number} value + */ + set rotation(value: number); + /** + * @type {number} + */ + get rotation(): number; + /** + * @type {boolean} + */ + get isInPresentationMode(): boolean; + /** + * This method will, when available, also update the browser history. + * + * @param {string|Array} dest - The named, or explicit, PDF destination. + */ + goToDestination(dest: string | any[]): Promise; + /** + * This method will, when available, also update the browser history. + * + * @param {number|string} val - The page number, or page label. + */ + goToPage(val: number | string): void; + /** + * Adds various attributes (href, title, target, rel) to hyperlinks. + * @param {HTMLAnchorElement} link + * @param {string} url + * @param {boolean} [newWindow] + */ + addLinkAttributes(link: HTMLAnchorElement, url: string, newWindow?: boolean): void; + /** + * @param {string|Array} dest - The PDF destination object. + * @returns {string} The hyperlink to the PDF object. + */ + getDestinationHash(dest: string | any[]): string; + /** + * Prefix the full url on anchor links to make sure that links are resolved + * relative to the current URL instead of the one defined in . + * @param {string} anchor - The anchor hash, including the #. + * @returns {string} The hyperlink to the PDF object. + */ + getAnchorUrl(anchor: string): string; + /** + * @param {string} hash + */ + setHash(hash: string): void; + /** + * @param {string} action + */ + executeNamedAction(action: string): void; + /** + * @param {Object} action + */ + executeSetOCGState(action: Object): Promise; +} +/** + * @implements {IPDFLinkService} + */ +export class SimpleLinkService extends PDFLinkService implements IPDFLinkService { +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_page_detail_view.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_page_detail_view.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1e94d5cc06bc4f49f7bdc0a2c3136b039ce37217 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_page_detail_view.d.ts @@ -0,0 +1,32 @@ +export type IRenderableView = import("./interfaces").IRenderableView; +/** @typedef {import("./interfaces").IRenderableView} IRenderableView */ +/** + * @implements {IRenderableView} + */ +export class PDFPageDetailView extends BasePDFPageView implements IRenderableView { + constructor({ pageView }: { + pageView: any; + }); + /** + * @type {boolean} True when the last rendering attempt of the view was + * cancelled due to a `.reset()` call. This will happen when + * the visible area changes so much during the rendering that + * we need to cancel the rendering and start over. + */ + renderingCancelled: boolean; + pageView: any; + renderingId: string; + div: any; + setPdfPage(pdfPage: any): void; + get pdfPage(): any; + reset({ keepCanvas }?: { + keepCanvas?: boolean | undefined; + }): void; + update({ visibleArea, underlyingViewUpdated }?: { + visibleArea?: null | undefined; + underlyingViewUpdated?: boolean | undefined; + }): void; + draw(): Promise; + #private; +} +import { BasePDFPageView } from "./base_pdf_page_view.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_page_view.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_page_view.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be656965b442332b1c2a40ad4fcce931ecd33d78 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_page_view.d.ts @@ -0,0 +1,229 @@ +export type PageViewport = import("../src/display/display_utils").PageViewport; +export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig; +export type EventBus = import("./event_utils").EventBus; +export type IL10n = import("./interfaces").IL10n; +export type IRenderableView = import("./interfaces").IRenderableView; +export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue; +export type PDFPageViewOptions = { + /** + * - The viewer element. + */ + container?: HTMLDivElement | undefined; + /** + * - The application event bus. + */ + eventBus: EventBus; + /** + * - The page unique ID (normally its number). + */ + id: number; + /** + * - The page scale display. + */ + scale?: number | undefined; + /** + * - The page viewport. + */ + defaultViewport: PageViewport; + /** + * - + * A promise that is resolved with an {@link OptionalContentConfig} instance. + * The default value is `null`. + */ + optionalContentConfigPromise?: Promise | undefined; + /** + * - The rendering queue object. + */ + renderingQueue?: import("./pdf_rendering_queue").PDFRenderingQueue | undefined; + /** + * - Controls if the text layer used for + * selection and searching is created. The constants from {TextLayerMode} + * should be used. The default value is `TextLayerMode.ENABLE`. + */ + textLayerMode?: number | undefined; + /** + * - Controls if the annotation layer is + * created, and if interactive form elements or `AnnotationStorage`-data are + * being rendered. The constants from {@link AnnotationMode} should be used; + * see also {@link RenderParameters} and {@link GetOperatorListParameters}. + * The default value is `AnnotationMode.ENABLE_FORMS`. + */ + annotationMode?: number | undefined; + /** + * - Path for image resources, mainly + * for annotation icons. Include trailing slash. + */ + imageResourcesPath?: string | undefined; + /** + * - The maximum supported canvas size in + * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for + * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels). + */ + maxCanvasPixels?: number | undefined; + /** + * - The maximum supported canvas dimension, + * in either width or height. Use `-1` for no limit. + * The default value is 32767. + */ + maxCanvasDim?: number | undefined; + /** + * - Cap the canvas area to the + * viewport increased by the value in percent. Use `-1` for no limit. + * The default value is 200%. + */ + capCanvasAreaFactor?: number | undefined; + /** + * - When enabled, if the rendered + * pages would need a canvas that is larger than `maxCanvasPixels` or + * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one, + * that only renders the part of the page that is close to the viewport. + * The default value is `true`. + */ + enableDetailCanvas?: boolean | undefined; + /** + * - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + */ + pageColors?: Object | undefined; + /** + * - Localization service. + */ + l10n?: import("./interfaces").IL10n | undefined; + /** + * - The object that is used to lookup + * the necessary layer-properties. + */ + layerProperties?: Object | undefined; + /** + * - Enable creation of hyperlinks from + * text that look like URLs. The default value is `true`. + */ + enableAutoLinking?: boolean | undefined; +}; +/** + * @implements {IRenderableView} + */ +export class PDFPageView extends BasePDFPageView implements IRenderableView { + /** + * @param {PDFPageViewOptions} options + */ + constructor(options: PDFPageViewOptions); + renderingId: string; + pdfPage: any; + pageLabel: string | null; + rotation: number; + scale: number; + viewport: import("../src/display/display_utils").PageViewport; + pdfPageRotate: number; + _optionalContentConfigPromise: Promise | null; + imageResourcesPath: string; + enableDetailCanvas: boolean; + maxCanvasPixels: any; + maxCanvasDim: any; + capCanvasAreaFactor: any; + l10n: import("./interfaces").IL10n | GenericL10n | undefined; + _isStandalone: boolean | undefined; + _container: HTMLDivElement | undefined; + _annotationCanvasMap: any; + annotationLayer: AnnotationLayerBuilder | null; + annotationEditorLayer: any; + textLayer: TextLayerBuilder | null; + xfaLayer: XfaLayerBuilder | null; + structTreeLayer: any; + drawLayer: any; + detailView: any; + div: HTMLDivElement; + setPdfPage(pdfPage: any): void; + destroy(): void; + hasEditableAnnotations(): boolean; + get _textHighlighter(): any; + reset({ keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, keepCanvasWrapper, preserveDetailViewState, }?: { + keepAnnotationLayer?: boolean | undefined; + keepAnnotationEditorLayer?: boolean | undefined; + keepXfaLayer?: boolean | undefined; + keepTextLayer?: boolean | undefined; + keepCanvasWrapper?: boolean | undefined; + preserveDetailViewState?: boolean | undefined; + }): void; + toggleEditingMode(isEditing: any): void; + updateVisibleArea(visibleArea: any): void; + /** + * @typedef {Object} PDFPageViewUpdateParameters + * @property {number} [scale] The new scale, if specified. + * @property {number} [rotation] The new rotation, if specified. + * @property {Promise} [optionalContentConfigPromise] + * A promise that is resolved with an {@link OptionalContentConfig} + * instance. The default value is `null`. + * @property {number} [drawingDelay] + */ + /** + * Update e.g. the scale and/or rotation of the page. + * @param {PDFPageViewUpdateParameters} params + */ + update({ scale, rotation, optionalContentConfigPromise, drawingDelay, }: { + /** + * The new scale, if specified. + */ + scale?: number | undefined; + /** + * The new rotation, if specified. + */ + rotation?: number | undefined; + /** + * A promise that is resolved with an {@link OptionalContentConfig}instance. The default value is `null`. + */ + optionalContentConfigPromise?: Promise | undefined; + drawingDelay?: number | undefined; + }): void; + outputScale: OutputScale | undefined; + /** + * PLEASE NOTE: Most likely you want to use the `this.reset()` method, + * rather than calling this one directly. + */ + cancelRendering({ keepAnnotationLayer, keepAnnotationEditorLayer, keepXfaLayer, keepTextLayer, cancelExtraDelay, }?: { + keepAnnotationLayer?: boolean | undefined; + keepAnnotationEditorLayer?: boolean | undefined; + keepXfaLayer?: boolean | undefined; + keepTextLayer?: boolean | undefined; + cancelExtraDelay?: number | undefined; + }): void; + cssTransform({ redrawAnnotationLayer, redrawAnnotationEditorLayer, redrawXfaLayer, redrawTextLayer, hideTextLayer, }: { + redrawAnnotationLayer?: boolean | undefined; + redrawAnnotationEditorLayer?: boolean | undefined; + redrawXfaLayer?: boolean | undefined; + redrawTextLayer?: boolean | undefined; + hideTextLayer?: boolean | undefined; + }): void; + get width(): number; + get height(): number; + getPagePoint(x: any, y: any): any[]; + _ensureCanvasWrapper(): null; + _getRenderingContext(canvas: any, transform: any): { + canvas: any; + transform: any; + viewport: import("../src/display/display_utils").PageViewport; + annotationMode: number; + optionalContentConfigPromise: Promise | null; + annotationCanvasMap: any; + pageColors: null; + isEditing: boolean; + }; + draw(): Promise; + /** + * @param {string|null} label + */ + setPageLabel(label: string | null): void; + /** + * For use by the `PDFThumbnailView.setImage`-method. + * @ignore + */ + get thumbnailCanvas(): null; + #private; +} +import { BasePDFPageView } from "./base_pdf_page_view.js"; +import { GenericL10n } from "./genericl10n"; +import { AnnotationLayerBuilder } from "./annotation_layer_builder.js"; +import { TextLayerBuilder } from "./text_layer_builder.js"; +import { XfaLayerBuilder } from "./xfa_layer_builder.js"; +import { OutputScale } from "../src/pdf"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_rendering_queue.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_rendering_queue.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9ab84f2b237a42f1fe732af1285f3a540af065d --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_rendering_queue.d.ts @@ -0,0 +1,54 @@ +export type IRenderableView = import("./interfaces").IRenderableView; +export type PDFViewer = import("./pdf_viewer").PDFViewer; +export type PDFThumbnailViewer = import("./pdf_thumbnail_viewer").PDFThumbnailViewer; +/** + * Controls rendering of the views for pages and thumbnails. + */ +export class PDFRenderingQueue { + pdfViewer: import("./pdf_viewer").PDFViewer | null; + pdfThumbnailViewer: import("./pdf_thumbnail_viewer").PDFThumbnailViewer | null; + onIdle: any; + highestPriorityPage: string | null; + /** @type {number} */ + idleTimeout: number; + printing: boolean; + isThumbnailViewEnabled: boolean; + /** + * @param {PDFViewer} pdfViewer + */ + setViewer(pdfViewer: PDFViewer): void; + /** + * @param {PDFThumbnailViewer} pdfThumbnailViewer + */ + setThumbnailViewer(pdfThumbnailViewer: PDFThumbnailViewer): void; + /** + * @param {IRenderableView} view + * @returns {boolean} + */ + isHighestPriority(view: IRenderableView): boolean; + /** + * @param {Object} currentlyVisiblePages + */ + renderHighestPriority(currentlyVisiblePages: Object): void; + /** + * @param {Object} visible + * @param {Array} views + * @param {boolean} scrolledDown + * @param {boolean} [preRenderExtra] + * @param {boolean} [ignoreDetailViews] + */ + getHighestPriority(visible: Object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean, ignoreDetailViews?: boolean): any; + /** + * @param {IRenderableView} view + * @returns {boolean} + */ + isViewFinished(view: IRenderableView): boolean; + /** + * Render a page or thumbnail view. This calls the appropriate function + * based on the views state. If the view is already rendered it will return + * `false`. + * + * @param {IRenderableView} view + */ + renderView(view: IRenderableView): boolean; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_scripting_manager.component.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_scripting_manager.component.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6b7abdc7380b41765bcd12e970d77278caecc00 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_scripting_manager.component.d.ts @@ -0,0 +1,5 @@ +export { PDFScriptingManagerComponents as PDFScriptingManager }; +declare class PDFScriptingManagerComponents extends PDFScriptingManager { + constructor(options: any); +} +import { PDFScriptingManager } from "./pdf_scripting_manager.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_scripting_manager.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_scripting_manager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5bf2b8465b77d44111669860ed7d995ece297a64 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_scripting_manager.d.ts @@ -0,0 +1,57 @@ +export type EventBus = import("./event_utils").EventBus; +export type PDFScriptingManagerOptions = { + /** + * - The application event bus. + */ + eventBus: EventBus; + /** + * - The path and filename of the + * scripting bundle. + */ + sandboxBundleSrc?: string | undefined; + /** + * - The factory that is used when + * initializing scripting; must contain a `createScripting` method. + * PLEASE NOTE: Primarily intended for the default viewer use-case. + */ + externalServices?: Object | undefined; + /** + * - The function that is used to lookup + * the necessary document properties. + */ + docProperties?: Function | undefined; +}; +/** + * @typedef {Object} PDFScriptingManagerOptions + * @property {EventBus} eventBus - The application event bus. + * @property {string} [sandboxBundleSrc] - The path and filename of the + * scripting bundle. + * @property {Object} [externalServices] - The factory that is used when + * initializing scripting; must contain a `createScripting` method. + * PLEASE NOTE: Primarily intended for the default viewer use-case. + * @property {function} [docProperties] - The function that is used to lookup + * the necessary document properties. + */ +export class PDFScriptingManager { + /** + * @param {PDFScriptingManagerOptions} options + */ + constructor({ eventBus, externalServices, docProperties }: PDFScriptingManagerOptions); + setViewer(pdfViewer: any): void; + setDocument(pdfDocument: any): Promise; + dispatchWillSave(): Promise; + dispatchDidSave(): Promise; + dispatchWillPrint(): Promise; + dispatchDidPrint(): Promise; + get destroyPromise(): any; + get ready(): boolean; + /** + * @private + */ + private get _pageOpenPending(); + /** + * @private + */ + private get _visitedPages(); + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_single_page_viewer.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_single_page_viewer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b6c382aea0fb17a87be3095731258dc59dd6277f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_single_page_viewer.d.ts @@ -0,0 +1,7 @@ +export class PDFSinglePageViewer extends PDFViewer { + set scrollMode(mode: any); + _updateScrollMode(): void; + set spreadMode(mode: any); + _updateSpreadMode(): void; +} +import { PDFViewer } from "./pdf_viewer.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_thumbnail_view.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_thumbnail_view.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d199f340fe6272675e46bbe17b82de87af0a9454 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_thumbnail_view.d.ts @@ -0,0 +1,132 @@ +export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig; +export type PageViewport = import("../src/display/display_utils").PageViewport; +export type EventBus = import("./event_utils").EventBus; +export type IPDFLinkService = import("./interfaces").IPDFLinkService; +export type IRenderableView = import("./interfaces").IRenderableView; +export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue; +export type PDFThumbnailViewOptions = { + /** + * - The viewer element. + */ + container: HTMLDivElement; + /** + * - The application event bus. + */ + eventBus: EventBus; + /** + * - The thumbnail's unique ID (normally its number). + */ + id: number; + /** + * - The page viewport. + */ + defaultViewport: PageViewport; + /** + * - + * A promise that is resolved with an {@link OptionalContentConfig} instance. + * The default value is `null`. + */ + optionalContentConfigPromise?: Promise | undefined; + /** + * - The navigation/linking service. + */ + linkService: IPDFLinkService; + /** + * - The rendering queue object. + */ + renderingQueue: PDFRenderingQueue; + /** + * - The maximum supported canvas size in + * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for + * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels). + */ + maxCanvasPixels?: number | undefined; + /** + * - The maximum supported canvas dimension, + * in either width or height. Use `-1` for no limit. + * The default value is 32767. + */ + maxCanvasDim?: number | undefined; + /** + * - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + */ + pageColors?: Object | undefined; +}; +/** + * @implements {IRenderableView} + */ +export class PDFThumbnailView implements IRenderableView { + /** + * @param {PDFThumbnailViewOptions} options + */ + constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, }: PDFThumbnailViewOptions); + id: number; + renderingId: string; + pageLabel: string | null; + pdfPage: any; + rotation: number; + viewport: import("../src/display/display_utils").PageViewport; + pdfPageRotate: number; + _optionalContentConfigPromise: Promise | null; + maxCanvasPixels: any; + maxCanvasDim: any; + pageColors: Object | null; + eventBus: import("./event_utils").EventBus; + linkService: import("./interfaces").IPDFLinkService; + renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue; + renderTask: any; + renderingState: number; + resume: (() => void) | null; + anchor: HTMLAnchorElement; + div: HTMLDivElement; + _placeholderImg: HTMLDivElement; + canvasWidth: number | undefined; + canvasHeight: number | undefined; + scale: number | undefined; + setPdfPage(pdfPage: any): void; + reset(): void; + update({ rotation }: { + rotation?: null | undefined; + }): void; + /** + * PLEASE NOTE: Most likely you want to use the `this.reset()` method, + * rather than calling this one directly. + */ + cancelRendering(): void; + image: HTMLImageElement | undefined; + draw(): Promise; + setImage(pageView: any): void; + /** + * @param {string|null} label + */ + setPageLabel(label: string | null): void; + #private; +} +/** + * @typedef {Object} PDFThumbnailViewOptions + * @property {HTMLDivElement} container - The viewer element. + * @property {EventBus} eventBus - The application event bus. + * @property {number} id - The thumbnail's unique ID (normally its number). + * @property {PageViewport} defaultViewport - The page viewport. + * @property {Promise} [optionalContentConfigPromise] - + * A promise that is resolved with an {@link OptionalContentConfig} instance. + * The default value is `null`. + * @property {IPDFLinkService} linkService - The navigation/linking service. + * @property {PDFRenderingQueue} renderingQueue - The rendering queue object. + * @property {number} [maxCanvasPixels] - The maximum supported canvas size in + * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for + * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels). + * @property {number} [maxCanvasDim] - The maximum supported canvas dimension, + * in either width or height. Use `-1` for no limit. + * The default value is 32767. + * @property {Object} [pageColors] - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + */ +export class TempImageFactory { + static "__#85@#tempCanvas": null; + static getCanvas(width: any, height: any): (HTMLCanvasElement | CanvasRenderingContext2D | null)[]; + static destroyCanvas(): void; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_thumbnail_viewer.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_thumbnail_viewer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d26785d9a69f64f2edd6698e1177ba99c02f5d1e --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_thumbnail_viewer.d.ts @@ -0,0 +1,117 @@ +export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy; +export type PDFPageProxy = import("../src/display/api").PDFPageProxy; +export type EventBus = import("./event_utils").EventBus; +export type IPDFLinkService = import("./interfaces").IPDFLinkService; +export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue; +export type PDFThumbnailViewerOptions = { + /** + * - The container for the thumbnail + * elements. + */ + container: HTMLDivElement; + /** + * - The application event bus. + */ + eventBus: EventBus; + /** + * - The navigation/linking service. + */ + linkService: IPDFLinkService; + /** + * - The rendering queue object. + */ + renderingQueue: PDFRenderingQueue; + /** + * - The maximum supported canvas size in + * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for + * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels). + */ + maxCanvasPixels?: number | undefined; + /** + * - The maximum supported canvas dimension, + * in either width or height. Use `-1` for no limit. + * The default value is 32767. + */ + maxCanvasDim?: number | undefined; + /** + * - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + */ + pageColors?: Object | undefined; + /** + * - The AbortSignal for the window + * events. + */ + abortSignal?: AbortSignal | undefined; + /** + * - Enables hardware acceleration for + * rendering. The default value is `false`. + */ + enableHWA?: boolean | undefined; +}; +/** + * @typedef {Object} PDFThumbnailViewerOptions + * @property {HTMLDivElement} container - The container for the thumbnail + * elements. + * @property {EventBus} eventBus - The application event bus. + * @property {IPDFLinkService} linkService - The navigation/linking service. + * @property {PDFRenderingQueue} renderingQueue - The rendering queue object. + * @property {number} [maxCanvasPixels] - The maximum supported canvas size in + * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for + * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels). + * @property {number} [maxCanvasDim] - The maximum supported canvas dimension, + * in either width or height. Use `-1` for no limit. + * The default value is 32767. + * @property {Object} [pageColors] - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + * @property {AbortSignal} [abortSignal] - The AbortSignal for the window + * events. + * @property {boolean} [enableHWA] - Enables hardware acceleration for + * rendering. The default value is `false`. + */ +/** + * Viewer control to display thumbnails for pages in a PDF document. + */ +export class PDFThumbnailViewer { + /** + * @param {PDFThumbnailViewerOptions} options + */ + constructor({ container, eventBus, linkService, renderingQueue, maxCanvasPixels, maxCanvasDim, pageColors, abortSignal, enableHWA, }: PDFThumbnailViewerOptions); + container: HTMLDivElement; + eventBus: import("./event_utils").EventBus; + linkService: import("./interfaces").IPDFLinkService; + renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue; + maxCanvasPixels: number | undefined; + maxCanvasDim: number | undefined; + pageColors: Object | null; + enableHWA: boolean; + scroll: { + right: boolean; + down: boolean; + lastX: any; + lastY: any; + _eventHandler: (evt: any) => void; + }; + getThumbnail(index: any): any; + scrollThumbnailIntoView(pageNumber: any): void; + _currentPageNumber: any; + set pagesRotation(rotation: any); + get pagesRotation(): any; + _pagesRotation: any; + cleanup(): void; + _thumbnails: any[] | undefined; + _pageLabels: any[] | null | undefined; + /** + * @param {PDFDocumentProxy} pdfDocument + */ + setDocument(pdfDocument: PDFDocumentProxy): void; + pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined; + /** + * @param {Array|null} labels + */ + setPageLabels(labels: any[] | null): void; + forceRendering(): boolean; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_viewer.component.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_viewer.component.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..20baa0089423a7f0507a445b9c41e9fe05235ac0 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_viewer.component.d.ts @@ -0,0 +1,23 @@ +import { AnnotationLayerBuilder } from "./annotation_layer_builder.js"; +import { DownloadManager } from "./download_manager.js"; +import { EventBus } from "./event_utils.js"; +import { FindState } from "./pdf_find_controller.js"; +import { GenericL10n } from "./genericl10n.js"; +import { LinkTarget } from "./pdf_link_service.js"; +import { parseQueryString } from "./ui_utils.js"; +import { PDFFindController } from "./pdf_find_controller.js"; +import { PDFHistory } from "./pdf_history.js"; +import { PDFLinkService } from "./pdf_link_service.js"; +import { PDFPageView } from "./pdf_page_view.js"; +import { PDFScriptingManager } from "./pdf_scripting_manager.component.js"; +import { PDFSinglePageViewer } from "./pdf_single_page_viewer.js"; +import { PDFViewer } from "./pdf_viewer.js"; +import { ProgressBar } from "./ui_utils.js"; +import { RenderingStates } from "./ui_utils.js"; +import { ScrollMode } from "./ui_utils.js"; +import { SimpleLinkService } from "./pdf_link_service.js"; +import { SpreadMode } from "./ui_utils.js"; +import { StructTreeLayerBuilder } from "./struct_tree_layer_builder.js"; +import { TextLayerBuilder } from "./text_layer_builder.js"; +import { XfaLayerBuilder } from "./xfa_layer_builder.js"; +export { AnnotationLayerBuilder, DownloadManager, EventBus, FindState, GenericL10n, LinkTarget, parseQueryString, PDFFindController, PDFHistory, PDFLinkService, PDFPageView, PDFScriptingManager, PDFSinglePageViewer, PDFViewer, ProgressBar, RenderingStates, ScrollMode, SimpleLinkService, SpreadMode, StructTreeLayerBuilder, TextLayerBuilder, XfaLayerBuilder }; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/pdf_viewer.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_viewer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ef67fbbf47958f767eb8a2580faecd0114c02a65 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/pdf_viewer.d.ts @@ -0,0 +1,594 @@ +export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy; +export type PDFPageProxy = import("../src/display/api").PDFPageProxy; +export type PageViewport = import("../src/display/display_utils").PageViewport; +export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig; +export type EventBus = import("./event_utils").EventBus; +export type IDownloadManager = import("./interfaces").IDownloadManager; +export type IL10n = import("./interfaces").IL10n; +export type IPDFLinkService = import("./interfaces").IPDFLinkService; +export type PDFFindController = import("./pdf_find_controller").PDFFindController; +export type PDFScriptingManager = import("./pdf_scripting_manager").PDFScriptingManager; +export type PDFViewerOptions = { + /** + * - The container for the viewer element. + */ + container: HTMLDivElement; + /** + * - The viewer element. + */ + viewer?: HTMLDivElement | undefined; + /** + * - The application event bus. + */ + eventBus: EventBus; + /** + * - The navigation/linking service. + */ + linkService?: import("./interfaces").IPDFLinkService | undefined; + /** + * - The download manager + * component. + */ + downloadManager?: import("./interfaces").IDownloadManager | undefined; + /** + * - The find controller + * component. + */ + findController?: import("./pdf_find_controller").PDFFindController | undefined; + /** + * - The scripting manager + * component. + */ + scriptingManager?: import("./pdf_scripting_manager").PDFScriptingManager | undefined; + /** + * - The rendering queue object. + */ + renderingQueue?: PDFRenderingQueue | undefined; + /** + * - Removes the border shadow around + * the pages. The default value is `false`. + */ + removePageBorders?: boolean | undefined; + /** + * - Controls if the text layer used for + * selection and searching is created. The constants from {TextLayerMode} + * should be used. The default value is `TextLayerMode.ENABLE`. + */ + textLayerMode?: number | undefined; + /** + * - Controls if the annotation layer is + * created, and if interactive form elements or `AnnotationStorage`-data are + * being rendered. The constants from {@link AnnotationMode} should be used; + * see also {@link RenderParameters} and {@link GetOperatorListParameters}. + * The default value is `AnnotationMode.ENABLE_FORMS`. + */ + annotationMode?: number | undefined; + /** + * - Enables the creation and editing + * of new Annotations. The constants from {@link AnnotationEditorType} should + * be used. The default value is `AnnotationEditorType.NONE`. + */ + annotationEditorMode?: number | undefined; + /** + * - A comma separated list + * of colors to propose to highlight some text in the pdf. + */ + annotationEditorHighlightColors?: string | undefined; + /** + * - Path for image resources, mainly + * mainly for annotation icons. Include trailing slash. + */ + imageResourcesPath?: string | undefined; + /** + * - Enables automatic rotation of + * landscape pages upon printing. The default is `false`. + */ + enablePrintAutoRotate?: boolean | undefined; + /** + * - The maximum supported canvas size in + * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for + * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels). + */ + maxCanvasPixels?: number | undefined; + /** + * - The maximum supported canvas dimension, + * in either width or height. Use `-1` for no limit. + * The default value is 32767. + */ + maxCanvasDim?: number | undefined; + /** + * - Cap the canvas area to the + * viewport increased by the value in percent. Use `-1` for no limit. + * The default value is 200%. + */ + capCanvasAreaFactor?: number | undefined; + /** + * - When enabled, if the rendered + * pages would need a canvas that is larger than `maxCanvasPixels` or + * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one, + * that only renders the part of the page that is close to the viewport. + * The default value is `true`. + */ + enableDetailCanvas?: boolean | undefined; + /** + * - Localization service. + */ + l10n?: import("./interfaces").IL10n | undefined; + /** + * - Enables PDF document permissions, + * when they exist. The default value is `false`. + */ + enablePermissions?: boolean | undefined; + /** + * - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + */ + pageColors?: Object | undefined; + /** + * - Enables hardware acceleration for + * rendering. The default value is `false`. + */ + enableHWA?: boolean | undefined; + /** + * - Enable zooming on pinch gesture. + * The default value is `true`. + */ + supportsPinchToZoom?: boolean | undefined; + /** + * - Enable creation of hyperlinks from + * text that look like URLs. The default value is `true`. + */ + enableAutoLinking?: boolean | undefined; + /** + * - Minimum duration to wait + * before updating the canvas. The default value is `500`. + */ + minDurationToUpdateCanvas?: number | undefined; +}; +export namespace PagesCountLimit { + let FORCE_SCROLL_MODE_PAGE: number; + let FORCE_LAZY_PAGE_INIT: number; + let PAUSE_EAGER_PAGE_INIT: number; +} +/** + * @typedef {Object} PDFViewerOptions + * @property {HTMLDivElement} container - The container for the viewer element. + * @property {HTMLDivElement} [viewer] - The viewer element. + * @property {EventBus} eventBus - The application event bus. + * @property {IPDFLinkService} [linkService] - The navigation/linking service. + * @property {IDownloadManager} [downloadManager] - The download manager + * component. + * @property {PDFFindController} [findController] - The find controller + * component. + * @property {PDFScriptingManager} [scriptingManager] - The scripting manager + * component. + * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object. + * @property {boolean} [removePageBorders] - Removes the border shadow around + * the pages. The default value is `false`. + * @property {number} [textLayerMode] - Controls if the text layer used for + * selection and searching is created. The constants from {TextLayerMode} + * should be used. The default value is `TextLayerMode.ENABLE`. + * @property {number} [annotationMode] - Controls if the annotation layer is + * created, and if interactive form elements or `AnnotationStorage`-data are + * being rendered. The constants from {@link AnnotationMode} should be used; + * see also {@link RenderParameters} and {@link GetOperatorListParameters}. + * The default value is `AnnotationMode.ENABLE_FORMS`. + * @property {number} [annotationEditorMode] - Enables the creation and editing + * of new Annotations. The constants from {@link AnnotationEditorType} should + * be used. The default value is `AnnotationEditorType.NONE`. + * @property {string} [annotationEditorHighlightColors] - A comma separated list + * of colors to propose to highlight some text in the pdf. + * @property {string} [imageResourcesPath] - Path for image resources, mainly + * mainly for annotation icons. Include trailing slash. + * @property {boolean} [enablePrintAutoRotate] - Enables automatic rotation of + * landscape pages upon printing. The default is `false`. + * @property {number} [maxCanvasPixels] - The maximum supported canvas size in + * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for + * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels). + * @property {number} [maxCanvasDim] - The maximum supported canvas dimension, + * in either width or height. Use `-1` for no limit. + * The default value is 32767. + * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the + * viewport increased by the value in percent. Use `-1` for no limit. + * The default value is 200%. + * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered + * pages would need a canvas that is larger than `maxCanvasPixels` or + * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one, + * that only renders the part of the page that is close to the viewport. + * The default value is `true`. + * @property {IL10n} [l10n] - Localization service. + * @property {boolean} [enablePermissions] - Enables PDF document permissions, + * when they exist. The default value is `false`. + * @property {Object} [pageColors] - Overwrites background and foreground colors + * with user defined ones in order to improve readability in high contrast + * mode. + * @property {boolean} [enableHWA] - Enables hardware acceleration for + * rendering. The default value is `false`. + * @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture. + * The default value is `true`. + * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from + * text that look like URLs. The default value is `true`. + * @property {number} [minDurationToUpdateCanvas] - Minimum duration to wait + * before updating the canvas. The default value is `500`. + */ +export class PDFPageViewBuffer { + constructor(size: any); + push(view: any): void; + /** + * After calling resize, the size of the buffer will be `newSize`. + * The optional parameter `idsToKeep` is, if present, a Set of page-ids to + * push to the back of the buffer, delaying their destruction. The size of + * `idsToKeep` has no impact on the final size of the buffer; if `idsToKeep` + * is larger than `newSize`, some of those pages will be destroyed anyway. + */ + resize(newSize: any, idsToKeep?: null): void; + has(view: any): boolean; + [Symbol.iterator](): SetIterator; + #private; +} +/** + * Simple viewer control to display PDF content/pages. + */ +export class PDFViewer { + /** + * @param {PDFViewerOptions} options + */ + constructor(options: PDFViewerOptions); + container: HTMLDivElement; + viewer: Element | null; + eventBus: import("./event_utils").EventBus; + linkService: import("./interfaces").IPDFLinkService | SimpleLinkService; + downloadManager: import("./interfaces").IDownloadManager | null; + findController: import("./pdf_find_controller").PDFFindController | null; + _scriptingManager: import("./pdf_scripting_manager").PDFScriptingManager | null; + imageResourcesPath: string; + enablePrintAutoRotate: boolean; + removePageBorders: boolean | undefined; + maxCanvasPixels: number | undefined; + maxCanvasDim: number | undefined; + capCanvasAreaFactor: number | undefined; + enableDetailCanvas: boolean; + l10n: import("./interfaces").IL10n | GenericL10n | undefined; + pageColors: Object | null; + defaultRenderingQueue: boolean; + renderingQueue: PDFRenderingQueue | undefined; + scroll: { + right: boolean; + down: boolean; + lastX: any; + lastY: any; + _eventHandler: (evt: any) => void; + }; + presentationModeState: number; + get pagesCount(): number; + getPageView(index: any): any; + getCachedPageViews(): Set; + /** + * @type {boolean} - True if all {PDFPageView} objects are initialized. + */ + get pageViewsReady(): boolean; + /** + * @type {boolean} + */ + get renderForms(): boolean; + /** + * @type {boolean} + */ + get enableScripting(): boolean; + /** + * @param {number} val - The page number. + */ + set currentPageNumber(val: number); + /** + * @type {number} + */ + get currentPageNumber(): number; + /** + * @returns {boolean} Whether the pageNumber is valid (within bounds). + * @private + */ + private _setCurrentPageNumber; + _currentPageNumber: any; + /** + * @param {string} val - The page label. + */ + set currentPageLabel(val: string); + /** + * @type {string|null} Returns the current page label, or `null` if no page + * labels exist. + */ + get currentPageLabel(): string | null; + /** + * @param {number} val - Scale of the pages in percents. + */ + set currentScale(val: number); + /** + * @type {number} + */ + get currentScale(): number; + /** + * @param val - The scale of the pages (in percent or predefined value). + */ + set currentScaleValue(val: string); + /** + * @type {string} + */ + get currentScaleValue(): string; + /** + * @param {number} rotation - The rotation of the pages (0, 90, 180, 270). + */ + set pagesRotation(rotation: number); + /** + * @type {number} + */ + get pagesRotation(): number; + _pagesRotation: any; + get firstPagePromise(): any; + get onePageRendered(): any; + get pagesPromise(): any; + get _layerProperties(): any; + getAllText(): Promise; + /** + * @param {PDFDocumentProxy} pdfDocument + */ + setDocument(pdfDocument: PDFDocumentProxy): void; + pdfDocument: import("../src/display/api").PDFDocumentProxy | undefined; + _scrollMode: any; + _optionalContentConfigPromise: Promise | null | undefined; + /** + * @param {Array|null} labels + */ + setPageLabels(labels: any[] | null): void; + _pageLabels: any[] | null | undefined; + _resetView(): void; + _pages: any[] | undefined; + _currentScale: any; + _currentScaleValue: any; + _location: { + pageNumber: any; + scale: any; + top: number; + left: number; + rotation: any; + pdfOpenParams: string; + } | null | undefined; + _firstPageCapability: any; + _onePageRenderedCapability: any; + _pagesCapability: any; + _previousScrollMode: any; + _spreadMode: any; + _scrollUpdate(): void; + /** + * @param {string} label - The page label. + * @returns {number|null} The page number corresponding to the page label, + * or `null` when no page labels exist and/or the input is invalid. + */ + pageLabelToPageNumber(label: string): number | null; + /** + * @typedef {Object} ScrollPageIntoViewParameters + * @property {number} pageNumber - The page number. + * @property {Array} [destArray] - The original PDF destination array, in the + * format: + * @property {boolean} [allowNegativeOffset] - Allow negative page offsets. + * The default value is `false`. + * @property {boolean} [ignoreDestinationZoom] - Ignore the zoom argument in + * the destination array. The default value is `false`. + */ + /** + * Scrolls page into view. + * @param {ScrollPageIntoViewParameters} params + */ + scrollPageIntoView({ pageNumber, destArray, allowNegativeOffset, ignoreDestinationZoom, }: { + /** + * - The page number. + */ + pageNumber: number; + /** + * - The original PDF destination array, in the + * format: + */ + destArray?: any[] | undefined; + /** + * - Allow negative page offsets. + * The default value is `false`. + */ + allowNegativeOffset?: boolean | undefined; + /** + * - Ignore the zoom argument in + * the destination array. The default value is `false`. + */ + ignoreDestinationZoom?: boolean | undefined; + }): void; + _updateLocation(firstPage: any): void; + update(): void; + containsElement(element: any): boolean; + focus(): void; + get _isContainerRtl(): boolean; + get isInPresentationMode(): boolean; + get isChangingPresentationMode(): boolean; + get isHorizontalScrollbarEnabled(): boolean; + get isVerticalScrollbarEnabled(): boolean; + _getVisiblePages(): Object; + cleanup(): void; + /** + * @private + */ + private _cancelRendering; + forceRendering(currentlyVisiblePages: any): boolean; + /** + * @type {boolean} Whether all pages of the PDF document have identical + * widths and heights. + */ + get hasEqualPageSizes(): boolean; + /** + * Returns sizes of the pages. + * @returns {Array} Array of objects with width/height/rotation fields. + */ + getPagesOverview(): any[]; + /** + * @param {Promise} promise - A promise that is + * resolved with an {@link OptionalContentConfig} instance. + */ + set optionalContentConfigPromise(promise: Promise); + /** + * @type {Promise} + */ + get optionalContentConfigPromise(): Promise; + /** + * @param {number} mode - The direction in which the document pages should be + * laid out within the scrolling container. + * The constants from {ScrollMode} should be used. + */ + set scrollMode(mode: number); + /** + * @type {number} One of the values in {ScrollMode}. + */ + get scrollMode(): number; + _updateScrollMode(pageNumber?: null): void; + /** + * @param {number} mode - Group the pages in spreads, starting with odd- or + * even-number pages (unless `SpreadMode.NONE` is used). + * The constants from {SpreadMode} should be used. + */ + set spreadMode(mode: number); + /** + * @type {number} One of the values in {SpreadMode}. + */ + get spreadMode(): number; + _updateSpreadMode(pageNumber?: null): void; + /** + * @private + */ + private _getPageAdvance; + /** + * Go to the next page, taking scroll/spread-modes into account. + * @returns {boolean} Whether navigation occurred. + */ + nextPage(): boolean; + /** + * Go to the previous page, taking scroll/spread-modes into account. + * @returns {boolean} Whether navigation occurred. + */ + previousPage(): boolean; + /** + * @typedef {Object} ChangeScaleOptions + * @property {number} [drawingDelay] + * @property {number} [scaleFactor] + * @property {number} [steps] + * @property {Array} [origin] x and y coordinates of the scale + * transformation origin. + */ + /** + * Changes the current zoom level by the specified amount. + * @param {ChangeScaleOptions} [options] + */ + updateScale({ drawingDelay, scaleFactor, steps, origin }?: { + drawingDelay?: number | undefined; + scaleFactor?: number | undefined; + steps?: number | undefined; + /** + * x and y coordinates of the scale + * transformation origin. + */ + origin?: any[] | undefined; + }): void; + /** + * Increase the current zoom level one, or more, times. + * @param {ChangeScaleOptions} [options] + */ + increaseScale(options?: { + drawingDelay?: number | undefined; + scaleFactor?: number | undefined; + steps?: number | undefined; + /** + * x and y coordinates of the scale + * transformation origin. + */ + origin?: any[] | undefined; + }): void; + /** + * Decrease the current zoom level one, or more, times. + * @param {ChangeScaleOptions} [options] + */ + decreaseScale(options?: { + drawingDelay?: number | undefined; + scaleFactor?: number | undefined; + steps?: number | undefined; + /** + * x and y coordinates of the scale + * transformation origin. + */ + origin?: any[] | undefined; + }): void; + get containerTopLeft(): number[]; + /** + * @typedef {Object} AnnotationEditorModeOptions + * @property {number} mode - The editor mode (none, FreeText, ink, ...). + * @property {string|null} [editId] - ID of the existing annotation to edit. + * @property {boolean} [isFromKeyboard] - True if the mode change is due to a + * keyboard action. + * @property {boolean} [mustEnterInEditMode] - True if the editor must enter + * edit mode. + * @property {boolean} [editComment] - True if the editor must enter + * comment edit mode. + */ + /** + * @param {AnnotationEditorModeOptions} options + */ + set annotationEditorMode({ mode, editId, isFromKeyboard, mustEnterInEditMode, editComment, }: { + /** + * - The editor mode (none, FreeText, ink, ...). + */ + mode: number; + /** + * - ID of the existing annotation to edit. + */ + editId?: string | null | undefined; + /** + * - True if the mode change is due to a + * keyboard action. + */ + isFromKeyboard?: boolean | undefined; + /** + * - True if the editor must enter + * edit mode. + */ + mustEnterInEditMode?: boolean | undefined; + /** + * - True if the editor must enter + * comment edit mode. + */ + editComment?: boolean | undefined; + }); + get annotationEditorMode(): { + /** + * - The editor mode (none, FreeText, ink, ...). + */ + mode: number; + /** + * - ID of the existing annotation to edit. + */ + editId?: string | null | undefined; + /** + * - True if the mode change is due to a + * keyboard action. + */ + isFromKeyboard?: boolean | undefined; + /** + * - True if the editor must enter + * edit mode. + */ + mustEnterInEditMode?: boolean | undefined; + /** + * - True if the editor must enter + * comment edit mode. + */ + editComment?: boolean | undefined; + }; + refresh(noUpdate?: boolean, updateArgs?: any): void; + #private; +} +import { PDFRenderingQueue } from "./pdf_rendering_queue.js"; +import { SimpleLinkService } from "./pdf_link_service.js"; +import { GenericL10n } from "./genericl10n"; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/struct_tree_layer_builder.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/struct_tree_layer_builder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aa114a8673942f769da44c76477b90dcc5cfc18d --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/struct_tree_layer_builder.d.ts @@ -0,0 +1,25 @@ +export type PDFPageProxy = import("../src/display/api").PDFPageProxy; +export type StructTreeLayerBuilderOptions = { + pdfPage: PDFPageProxy; + rawDims: Object; +}; +/** + * @typedef {Object} StructTreeLayerBuilderOptions + * @property {PDFPageProxy} pdfPage + * @property {Object} rawDims + */ +export class StructTreeLayerBuilder { + /** + * @param {StructTreeLayerBuilderOptions} options + */ + constructor(pdfPage: any, rawDims: any); + /** + * @returns {Promise} + */ + render(): Promise; + getAriaAttributes(annotationId: any): Promise; + hide(): void; + show(): void; + addElementsToTextLayer(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/text_accessibility.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/text_accessibility.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..998f43b6e80cad7789bfb14a477e83aa1ecbecb5 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/text_accessibility.d.ts @@ -0,0 +1,44 @@ +/** + * This class aims to provide some methods: + * - to reorder elements in the DOM with respect to the visual order; + * - to create a link, using aria-owns, between spans in the textLayer and + * annotations in the annotationLayer. The goal is to help to know + * where the annotations are in the text flow. + */ +export class TextAccessibilityManager { + /** + * Compare the positions of two elements, it must correspond to + * the visual ordering. + * + * @param {HTMLElement} e1 + * @param {HTMLElement} e2 + * @returns {number} + */ + static "__#8@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number; + setTextMapping(textDivs: any): void; + /** + * Function called when the text layer has finished rendering. + */ + enable(): void; + disable(): void; + /** + * Remove an aria-owns id from a node in the text layer. + * @param {HTMLElement} element + */ + removePointerInTextLayer(element: HTMLElement): void; + /** + * Find the text node which is the nearest and add an aria-owns attribute + * in order to correctly position this editor in the text flow. + * @param {HTMLElement} element + * @param {boolean} isRemovable + * @returns {string|null} The id in the struct tree if any. + */ + addPointerInTextLayer(element: HTMLElement, isRemovable: boolean): string | null; + /** + * Move a div in the DOM in order to respect the visual order. + * @param {HTMLDivElement} element + * @returns {string|null} The id in the struct tree if any. + */ + moveElementInDOM(container: any, element: HTMLDivElement, contentElement: any, isRemovable: any): string | null; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/text_highlighter.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/text_highlighter.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fc84bce89583bc90a1880da07953d1c4f383a990 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/text_highlighter.d.ts @@ -0,0 +1,63 @@ +export type EventBus = import("./event_utils").EventBus; +export type PDFFindController = import("./pdf_find_controller").PDFFindController; +export type TextHighlighterOptions = { + findController: PDFFindController; + /** + * - The application event bus. + */ + eventBus: EventBus; + /** + * - The page index. + */ + pageIndex: number; +}; +/** @typedef {import("./event_utils").EventBus} EventBus */ +/** @typedef {import("./pdf_find_controller").PDFFindController} PDFFindController */ +/** + * @typedef {Object} TextHighlighterOptions + * @property {PDFFindController} findController + * @property {EventBus} eventBus - The application event bus. + * @property {number} pageIndex - The page index. + */ +/** + * TextHighlighter handles highlighting matches from the FindController in + * either the text layer or XFA layer depending on the type of document. + */ +export class TextHighlighter { + /** + * @param {TextHighlighterOptions} options + */ + constructor({ findController, eventBus, pageIndex }: TextHighlighterOptions); + findController: import("./pdf_find_controller").PDFFindController; + matches: any[]; + eventBus: import("./event_utils").EventBus; + pageIdx: number; + textDivs: Node[] | null; + textContentItemsStr: string[] | null; + enabled: boolean; + /** + * Store two arrays that will map DOM nodes to text they should contain. + * The arrays should be of equal length and the array element at each index + * should correspond to the other. e.g. + * `items[0] = "Item 0" and texts[0] = "Item 0"; + * + * @param {Array} divs + * @param {Array} texts + */ + setTextMapping(divs: Array, texts: Array): void; + /** + * Start listening for events to update the highlighter and check if there are + * any current matches that need be highlighted. + */ + enable(): void; + disable(): void; + _convertMatches(matches: any, matchesLength: any): { + begin: { + divIdx: number; + offset: number; + }; + }[]; + _renderMatches(matches: any): void; + _updateMatches(reset?: boolean): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/text_layer_builder.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/text_layer_builder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4cb4d53da5f78e9815ca22b922000592e6e7a25 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/text_layer_builder.d.ts @@ -0,0 +1,65 @@ +export type PDFPageProxy = import("../src/display/api").PDFPageProxy; +export type PageViewport = import("../src/display/display_utils").PageViewport; +export type TextHighlighter = import("./text_highlighter").TextHighlighter; +export type TextAccessibilityManager = import("./text_accessibility.js").TextAccessibilityManager; +export type TextLayerBuilderOptions = { + pdfPage: PDFPageProxy; + /** + * - Optional object that will handle + * highlighting text from the find controller. + */ + highlighter?: import("./text_highlighter").TextHighlighter | undefined; + accessibilityManager?: import("./text_accessibility.js").TextAccessibilityManager | undefined; + enablePermissions?: boolean | undefined; + onAppend?: Function | undefined; +}; +export type TextLayerBuilderRenderOptions = { + viewport: PageViewport; + textContentParams?: Object | undefined; +}; +/** + * @typedef {Object} TextLayerBuilderOptions + * @property {PDFPageProxy} pdfPage + * @property {TextHighlighter} [highlighter] - Optional object that will handle + * highlighting text from the find controller. + * @property {TextAccessibilityManager} [accessibilityManager] + * @property {boolean} [enablePermissions] + * @property {function} [onAppend] + */ +/** + * @typedef {Object} TextLayerBuilderRenderOptions + * @property {PageViewport} viewport + * @property {Object} [textContentParams] + */ +/** + * The text layer builder provides text selection functionality for the PDF. + * It does this by creating overlay divs over the PDF's text. These divs + * contain text that matches the PDF text they are overlaying. + */ +export class TextLayerBuilder { + static "__#81@#textLayers": Map; + static "__#81@#selectionChangeAbortController": null; + static "__#81@#removeGlobalSelectionListener"(textLayerDiv: any): void; + static "__#81@#enableGlobalSelectionListener"(): void; + /** + * @param {TextLayerBuilderOptions} options + */ + constructor({ pdfPage, highlighter, accessibilityManager, enablePermissions, onAppend, }: TextLayerBuilderOptions); + pdfPage: import("../src/display/api").PDFPageProxy; + highlighter: import("./text_highlighter").TextHighlighter; + accessibilityManager: import("./text_accessibility.js").TextAccessibilityManager; + div: HTMLDivElement; + /** + * Renders the text layer. + * @param {TextLayerBuilderRenderOptions} options + * @returns {Promise} + */ + render({ viewport, textContentParams }: TextLayerBuilderRenderOptions): Promise; + hide(): void; + show(): void; + /** + * Cancel rendering of the text layer. + */ + cancel(): void; + #private; +} diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/ui_utils.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/ui_utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..63afc46fcc68f17f34d4f4db943043771edac0f2 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/ui_utils.d.ts @@ -0,0 +1,273 @@ +export type GetPageSizeInchesParameters = { + view: number[]; + userUnit: number; + rotate: number; +}; +export type PageSize = { + /** + * - In inches. + */ + width: number; + /** + * - In inches. + */ + height: number; +}; +export type GetVisibleElementsParameters = { + /** + * - A container that can possibly scroll. + */ + scrollEl: HTMLElement; + /** + * - Objects with a `div` property that contains an + * HTMLElement, which should all be descendants of `scrollEl` satisfying the + * relevant layout assumptions. + */ + views: any[]; + /** + * - If `true`, the returned elements are + * sorted in descending order of the percent of their padding box that is + * visible. The default value is `false`. + */ + sortByVisibility: boolean; + /** + * - If `true`, the elements are assumed to be + * laid out horizontally instead of vertically. The default value is `false`. + */ + horizontal: boolean; + /** + * - If `true`, the `scrollEl` container is assumed to + * be in right-to-left mode. The default value is `false`. + */ + rtl: boolean; +}; +/** + * Promise that is resolved when DOM window becomes visible. + */ +export const animationStarted: Promise; +/** + * Converts API PageLayout values to the format used by `BaseViewer`. + * @param {string} layout - The API PageLayout value. + * @returns {Object} + */ +export function apiPageLayoutToViewerModes(layout: string): Object; +/** + * Converts API PageMode values to the format used by `PDFSidebar`. + * NOTE: There's also a "FullScreen" parameter which is not possible to support, + * since the Fullscreen API used in browsers requires that entering + * fullscreen mode only occurs as a result of a user-initiated event. + * @param {string} mode - The API PageMode value. + * @returns {number} A value from {SidebarView}. + */ +export function apiPageModeToSidebarView(mode: string): number; +/** + * Approximates float number as a fraction using Farey sequence (max order + * of 8). + * @param {number} x - Positive float number. + * @returns {Array} Estimated fraction: the first array item is a numerator, + * the second one is a denominator. + * They are both natural numbers. + */ +export function approximateFraction(x: number): any[]; +export const AutoPrintRegExp: RegExp; +/** + * Helper function for getVisibleElements. + * + * @param {number} index - initial guess at the first visible element + * @param {Array} views - array of pages, into which `index` is an index + * @param {number} top - the top of the scroll pane + * @returns {number} less than or equal to `index` that is definitely at or + * before the first visible element in `views`, but not by too much. (Usually, + * this will be the first element in the first partially visible row in + * `views`, although sometimes it goes back one row further.) + */ +export function backtrackBeforeAllVisibleElements(index: number, views: any[], top: number): number; +/** + * Use binary search to find the index of the first item in a given array which + * passes a given condition. The items are expected to be sorted in the sense + * that if the condition is true for one item in the array, then it is also true + * for all following items. + * + * @returns {number} Index of the first array element to pass the test, + * or |items.length| if no such element exists. + */ +export function binarySearchFirstItem(items: any, condition: any, start?: number): number; +export const calcRound: ((x: number) => number) | ((x: any) => any); +export namespace CursorTool { + let SELECT: number; + let HAND: number; + let ZOOM: number; +} +export const DEFAULT_SCALE: 1; +export const DEFAULT_SCALE_DELTA: 1.1; +export const DEFAULT_SCALE_VALUE: "auto"; +export const docStyle: CSSStyleDeclaration | null; +/** + * @param {number} x - A positive number to round to a multiple of `div`. + * @param {number} div - A natural number. + */ +export function floorToDivide(x: number, div: number): number; +/** + * Get the active or focused element in current DOM. + * + * Recursively search for the truly active or focused element in case there are + * shadow DOMs. + * + * @returns {Element} the truly active or focused element. + */ +export function getActiveOrFocusedElement(): Element; +/** + * @typedef {Object} GetPageSizeInchesParameters + * @property {number[]} view + * @property {number} userUnit + * @property {number} rotate + */ +/** + * @typedef {Object} PageSize + * @property {number} width - In inches. + * @property {number} height - In inches. + */ +/** + * Gets the size of the specified page, converted from PDF units to inches. + * @param {GetPageSizeInchesParameters} params + * @returns {PageSize} + */ +export function getPageSizeInches({ view, userUnit, rotate }: GetPageSizeInchesParameters): PageSize; +/** + * @typedef {Object} GetVisibleElementsParameters + * @property {HTMLElement} scrollEl - A container that can possibly scroll. + * @property {Array} views - Objects with a `div` property that contains an + * HTMLElement, which should all be descendants of `scrollEl` satisfying the + * relevant layout assumptions. + * @property {boolean} sortByVisibility - If `true`, the returned elements are + * sorted in descending order of the percent of their padding box that is + * visible. The default value is `false`. + * @property {boolean} horizontal - If `true`, the elements are assumed to be + * laid out horizontally instead of vertically. The default value is `false`. + * @property {boolean} rtl - If `true`, the `scrollEl` container is assumed to + * be in right-to-left mode. The default value is `false`. + */ +/** + * Generic helper to find out what elements are visible within a scroll pane. + * + * Well, pretty generic. There are some assumptions placed on the elements + * referenced by `views`: + * - If `horizontal`, no left of any earlier element is to the right of the + * left of any later element. + * - Otherwise, `views` can be split into contiguous rows where, within a row, + * no top of any element is below the bottom of any other element, and + * between rows, no bottom of any element in an earlier row is below the + * top of any element in a later row. + * + * (Here, top, left, etc. all refer to the padding edge of the element in + * question. For pages, that ends up being equivalent to the bounding box of the + * rendering canvas. Earlier and later refer to index in `views`, not page + * layout.) + * + * @param {GetVisibleElementsParameters} params + * @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }` + */ +export function getVisibleElements({ scrollEl, views, sortByVisibility, horizontal, rtl, }: GetVisibleElementsParameters): Object; +export function isPortraitOrientation(size: any): boolean; +export function isValidRotation(angle: any): boolean; +export function isValidScrollMode(mode: any): boolean; +export function isValidSpreadMode(mode: any): boolean; +export const MAX_AUTO_SCALE: 1.25; +export const MAX_SCALE: 10; +export const MIN_SCALE: 0.1; +export function normalizeWheelEventDelta(evt: any): number; +export function normalizeWheelEventDirection(evt: any): number; +/** + * Helper function to parse query string (e.g. ?param1=value¶m2=...). + * @param {string} query + * @returns {Map} + */ +export function parseQueryString(query: string): Map; +export namespace PresentationModeState { + let UNKNOWN: number; + let NORMAL: number; + let CHANGING: number; + let FULLSCREEN: number; +} +export class ProgressBar { + constructor(bar: any); + set percent(val: number); + get percent(): number; + setWidth(viewer: any): void; + setDisableAutoFetch(delay?: number): void; + hide(): void; + show(): void; + #private; +} +/** + * @param {string} str + * @param {boolean} [replaceInvisible] + */ +export function removeNullCharacters(str: string, replaceInvisible?: boolean): string; +export namespace RenderingStates { + let INITIAL: number; + let RUNNING: number; + let PAUSED: number; + let FINISHED: number; +} +export const SCROLLBAR_PADDING: 40; +/** + * Scrolls specified element into view of its parent. + * @param {HTMLElement} element - The element to be visible. + * @param {Object} [spot] - An object with optional top and left properties, + * specifying the offset from the top left edge. + * @param {number} [spot.left] + * @param {number} [spot.top] + * @param {boolean} [scrollMatches] - When scrolling search results into view, + * ignore elements that either: Contains marked content identifiers, + * or have the CSS-rule `overflow: hidden;` set. The default value is `false`. + */ +export function scrollIntoView(element: HTMLElement, spot?: { + left?: number | undefined; + top?: number | undefined; +}, scrollMatches?: boolean): void; +export namespace ScrollMode { + let UNKNOWN_1: number; + export { UNKNOWN_1 as UNKNOWN }; + export let VERTICAL: number; + export let HORIZONTAL: number; + export let WRAPPED: number; + export let PAGE: number; +} +export namespace SidebarView { + let UNKNOWN_2: number; + export { UNKNOWN_2 as UNKNOWN }; + export let NONE: number; + export let THUMBS: number; + export let OUTLINE: number; + export let ATTACHMENTS: number; + export let LAYERS: number; +} +export namespace SpreadMode { + let UNKNOWN_3: number; + export { UNKNOWN_3 as UNKNOWN }; + let NONE_1: number; + export { NONE_1 as NONE }; + export let ODD: number; + export let EVEN: number; +} +export namespace TextLayerMode { + let DISABLE: number; + let ENABLE: number; + let ENABLE_PERMISSIONS: number; +} +export function toggleCheckedBtn(button: any, toggle: any, view?: null): void; +export function toggleExpandedBtn(button: any, toggle: any, view?: null): void; +export const UNKNOWN_SCALE: 0; +export const VERTICAL_PADDING: 5; +/** + * Helper function to start monitoring the scroll event and converting them into + * PDF.js friendly one: with scroll debounce and scroll direction. + */ +export function watchScroll(viewAreaElement: any, callback: any, abortSignal?: undefined): { + right: boolean; + down: boolean; + lastX: any; + lastY: any; + _eventHandler: (evt: any) => void; +}; diff --git a/tools/ui/node_modules/pdfjs-dist/types/web/xfa_layer_builder.d.ts b/tools/ui/node_modules/pdfjs-dist/types/web/xfa_layer_builder.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f30fcc888ff400def1e596c32871c79ce457f2f --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/types/web/xfa_layer_builder.d.ts @@ -0,0 +1,50 @@ +export type PDFPageProxy = import("../src/display/api").PDFPageProxy; +export type AnnotationStorage = import("../src/display/annotation_storage").AnnotationStorage; +export type PageViewport = import("../src/display/display_utils").PageViewport; +export type IPDFLinkService = import("./interfaces").IPDFLinkService; +export type XfaLayerBuilderOptions = { + pdfPage: PDFPageProxy; + annotationStorage?: import("../src/display/annotation_storage").AnnotationStorage | undefined; + linkService: IPDFLinkService; + xfaHtml?: Object | undefined; +}; +export type XfaLayerBuilderRenderOptions = { + viewport: PageViewport; + /** + * - The default value is "display". + */ + intent?: string | undefined; +}; +/** + * @typedef {Object} XfaLayerBuilderOptions + * @property {PDFPageProxy} pdfPage + * @property {AnnotationStorage} [annotationStorage] + * @property {IPDFLinkService} linkService + * @property {Object} [xfaHtml] + */ +/** + * @typedef {Object} XfaLayerBuilderRenderOptions + * @property {PageViewport} viewport + * @property {string} [intent] - The default value is "display". + */ +export class XfaLayerBuilder { + /** + * @param {XfaLayerBuilderOptions} options + */ + constructor({ pdfPage, annotationStorage, linkService, xfaHtml, }: XfaLayerBuilderOptions); + pdfPage: import("../src/display/api").PDFPageProxy; + annotationStorage: import("../src/display/annotation_storage").AnnotationStorage; + linkService: import("./interfaces").IPDFLinkService; + xfaHtml: Object; + div: HTMLDivElement | null; + _cancelled: boolean; + /** + * @param {XfaLayerBuilderRenderOptions} viewport + * @returns {Promise} A promise that is resolved when rendering + * of the XFA layer is complete. The first rendering will return an object + * with a `textDivs` property that can be used with the TextHighlighter. + */ + render({ viewport, intent }: XfaLayerBuilderRenderOptions): Promise; + cancel(): void; + hide(): void; +} diff --git a/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_OPENJPEG b/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_OPENJPEG new file mode 100644 index 0000000000000000000000000000000000000000..e8fa41040dfbe8be524cac5b1bb19d60c6eb0320 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_OPENJPEG @@ -0,0 +1,39 @@ +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2003-2009, Francois-Olivier Devaux + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France + * Copyright (c) 2012, CS Systemes d'Information, France + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ diff --git a/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_PDFJS_OPENJPEG b/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_PDFJS_OPENJPEG new file mode 100644 index 0000000000000000000000000000000000000000..623929b849547b81e8d1f025f66ac0e347e27b88 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_PDFJS_OPENJPEG @@ -0,0 +1,22 @@ +Copyright (c) 2024, Mozilla Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_PDFJS_QCMS b/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_PDFJS_QCMS new file mode 100644 index 0000000000000000000000000000000000000000..7e1aeb34f9178d69df1d49f996012b22070d9870 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_PDFJS_QCMS @@ -0,0 +1,22 @@ +Copyright (c) 2025, Mozilla Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_QCMS b/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_QCMS new file mode 100644 index 0000000000000000000000000000000000000000..eec8246dfa81e83f19dae23f6c1fbf51720908c0 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/wasm/LICENSE_QCMS @@ -0,0 +1,21 @@ +qcms +Copyright (C) 2009-2024 Mozilla Corporation +Copyright (C) 1998-2007 Marti Maria + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/ui/node_modules/pdfjs-dist/wasm/openjpeg.wasm b/tools/ui/node_modules/pdfjs-dist/wasm/openjpeg.wasm new file mode 100644 index 0000000000000000000000000000000000000000..dd7b713bcb7bcf3a2340759f1cb5fd3844cf24bd --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/wasm/openjpeg.wasm @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb031f36245b389e1f5bffc59d10eed35bb0f85d7368b46c3f0b462042ec8e9e +size 257382 diff --git a/tools/ui/node_modules/pdfjs-dist/wasm/openjpeg_nowasm_fallback.js b/tools/ui/node_modules/pdfjs-dist/wasm/openjpeg_nowasm_fallback.js new file mode 100644 index 0000000000000000000000000000000000000000..f90afc938e6d5bf5f7bd13bc1edf219797821e61 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/wasm/openjpeg_nowasm_fallback.js @@ -0,0 +1,29 @@ +/* THIS FILE IS GENERATED - DO NOT EDIT */ +var OpenJPEG = (() => { + + return ( +function(moduleArg = {}) { + var moduleRtn; + +var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=true;var ENVIRONMENT_IS_WORKER=false;var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var WebAssembly={Memory:function(opts){this.buffer=new ArrayBuffer(opts["initial"]*65536)},Module:function(binary){},Instance:function(module,info){this.exports=( +// EMSCRIPTEN_START_ASM +function instantiate(Ba){var a;var b=new Uint8Array(123);for(var c=25;c>=0;--c){b[48+c]=52+c;b[65+c]=c;b[97+c]=26+c}b[43]=62;b[47]=63;function i(j,k,l){var d,e,c=0,f=k,g=l.length,h=k+(g*3>>2)-(l[g-2]=="=")-(l[g-1]=="=");for(;c>4;if(f>2;if(f>>0;A=A>>>0;if(z+A>a.length)throw"trap: invalid memory.fill";a.fill(v,z,z+A)}function B(z,C,A){a.copyWithin(z,C,C+A)}function D(){throw new Error("abort")}function Aa(n){var E=new ArrayBuffer(16777216);var F=new Int8Array(E);var G=new Int16Array(E);var H=new Int32Array(E);var I=new Uint8Array(E);var J=new Uint16Array(E);var K=new Uint32Array(E);var L=new Float32Array(E);var M=new Float64Array(E);var N=Math.imul;var O=Math.fround;var P=Math.abs;var Q=Math.clz32;var R=Math.min;var S=Math.max;var T=Math.floor;var U=Math.ceil;var V=Math.trunc;var W=Math.sqrt;var X=n.a;var Y=X.a;var Z=X.b;var _=X.c;var $=X.d;var aa=X.e;var ba=X.f;var ca=X.g;var da=X.h;var ea=X.i;var fa=X.j;var ga=X.k;var ha=X.l;var ia=X.m;var ja=X.n;var ka=X.o;var la=X.p;var ma=X.q;var na=X.r;var oa=94352;var pa=0;var qa=0;var ra=0; +// EMSCRIPTEN_START_FUNCS +function fd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,z=0,A=0,C=0,D=0,E=0,M=0,P=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=O(0),ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,pa=0,qa=0,ra=0,ta=0,ua=0,va=0,wa=0,xa=0;aa=oa-96|0;oa=aa;E=H[a+8>>2];a:{b:{c:{if(!H[a>>2]){g=N(H[E+16>>2]-H[E+8>>2]|0,H[E+20>>2]-H[E+12>>2]|0)<<2;c=Ja(g);H[E+60>>2]=c;if(!c){Ca(H[a+32>>2],1,8023,0);d=a+28|0;break b}if(!g){break c}y(c,0,g);break c}c=H[E+60>>2];if(!c){break c}Da(c);H[E+60>>2]=0}if(!H[H[a+28>>2]>>2]){break a}qa=H[a+16>>2];c=H[qa+28>>2]+N(H[qa+24>>2],152)|0;wa=H[c-152>>2];xa=H[c-144>>2];ra=H[a+20>>2];ta=H[a+12>>2];va=H[a+4>>2];d=a+28|0;d:{q=H[b+4>>2];e=0;e:{if((q|0)<=0){break e}l=H[b>>2];c=0;f:{while(1){g=l+N(c,12)|0;if(!H[g>>2]){break f}c=c+1|0;if((q|0)!=(c|0)){continue}break}e=0;break e}e=H[g+4>>2]}if(e){break d}e=Fa(1,156);if(!e){Ca(H[a+32>>2],1,6313,0);break b}H[e+140>>2]=0;c=0;l=H[b+4>>2];g:{if((l|0)==2147483647){break g}g=H[b>>2];if((l|0)>0){while(1){q=g+N(c,12)|0;if(!H[q>>2]){l=H[q+8>>2];if(l){sa[l|0](H[q+4>>2]);g=H[b>>2]}b=g+N(c,12)|0;H[b+8>>2]=15;H[b+4>>2]=e;c=1;break g}c=c+1|0;if((l|0)!=(c|0)){continue}break}}g=Ia(g,N(l,12)+12|0);c=0;if(!g){break g}H[b>>2]=g;c=H[b+4>>2];g=g+N(c,12)|0;H[g+8>>2]=15;H[g+4>>2]=e;H[g>>2]=0;H[b+4>>2]=c+1;c=1}if(c){break d}Ca(H[a+32>>2],1,8338,0);b=H[e+116>>2];if(b){Da(b);H[e+116>>2]=0}b=H[e+120>>2];if(b){Da(b);H[e+120>>2]=0}Da(H[e+148>>2]);Da(e);break b}H[e+144>>2]=H[a+24>>2];W=H[a+40>>2];ba=H[a+36>>2];R=H[a+32>>2];P=H[ra+808>>2];b=H[ta+16>>2];h:{Z=H[ra+16>>2];i:{if(Z&64){l=oa-304|0;oa=l;j:{if(P){if(ba){Ca(R,1,3219,0);break j}Ca(R,1,3219,0);break j}j=H[e+116>>2];c=H[E+20>>2]-H[E+12>>2]|0;b=H[E+16>>2]-H[E+8>>2]|0;g=N(c,b);k:{l:{if(g>>>0>K[e+132>>2]){Da(j);f=g<<2;j=Ja(f);H[e+116>>2]=j;if(!j){j=0;break j}H[e+132>>2]=g;break l}if(!j){break k}f=g<<2}if(!f){break k}y(j,0,f)}j=H[e+120>>2];m:{if(K[e+136>>2]>2639){break m}Da(j);j=Ja(10560);H[e+120>>2]=j;if(j){break m}j=0;break j}H[e+136>>2]=2640;y(j,0,10560);H[e+128>>2]=c;H[e+124>>2]=b;n=H[E+24>>2];if(!n){j=1;break j}q=H[E+28>>2];j=1;n:{o:{p:{q:{f=H[E+52>>2];r:{if(f){c=H[E+4>>2];j=0;if(f>>>0>=4){b=f&-4;while(1){g=c+(m<<3)|0;j=H[g+28>>2]+(H[g+20>>2]+(H[g+12>>2]+(H[g+4>>2]+j|0)|0)|0)|0;m=m+4|0;z=z+4|0;if((b|0)!=(z|0)){continue}break}}b=f&3;if(b){while(1){j=H[(c+(m<<3)|0)+4>>2]+j|0;m=m+1|0;k=k+1|0;if((b|0)!=(k|0)){continue}break}}if(!H[e+144>>2]&(f|0)==1){break o}if(K[e+152>>2]>=j>>>0){break r}z=Ia(H[e+148>>2],j);if(z){break q}j=0;break j}if(!H[e+144>>2]){break j}}z=H[e+148>>2];if(z){break p}j=0;break j}H[e+152>>2]=j;H[e+148>>2]=z}if(!H[E+52>>2]){j=0;break n}f=H[E+4>>2];j=0;m=0;while(1){g=m<<3;c=g+f|0;b=H[c+4>>2];if(b){B(j+z|0,H[c>>2],b)}f=H[E+4>>2];j=H[(g+f|0)+4>>2]+j|0;m=m+1|0;if(m>>>0>2]){continue}break}break n}z=H[H[E+4>>2]>>2]}m=0;f=0;c=H[E+40>>2];g=0;s:{if(!c){break s}b=H[E>>2];f=H[b+8>>2];g=0;if((c|0)==1){break s}g=H[b+32>>2]}c=n-q|0;f=f+g|0;t:{if(!f){k=0;break t}m=1;b=H[E>>2];r=H[b>>2];k=0;if((f|0)==1){m=0;break t}k=H[b+24>>2]}S=c+1|0;ia=H[e+116>>2];$=H[e+120>>2];W=H[E+12>>2];t=H[E+20>>2];M=H[E+8>>2];ja=H[E+16>>2];u:{v:{w:{x:{y:{z:{A:{B:{if(!(!m|k)){if(!ba){break B}Ca(R,2,10806,0);f=1;break A}if(f>>>0<4){break A}if(ba){H[l+112>>2]=f;Ca(R,1,9590,l+112|0);break u}H[l+96>>2]=f;Ca(R,1,9590,l+96|0);j=0;break j}Ca(R,2,10806,0);m=H[E+24>>2];if(m>>>0>30){break z}P=1;if(m>>>0>=S>>>0){break x}break v}m=H[E+24>>2];if(m>>>0<=30){break y}if(!ba){break z}H[l+32>>2]=H[E+24>>2];Ca(R,1,12302,l+32|0);break u}H[l>>2]=m;Ca(R,1,12302,l);j=0;break j}if(m>>>0>>0){break w}if(f>>>0<2){P=f;break x}if((m|0)!=(S|0)){P=f;break x}P=1;if(I[26384]){break x}if(!ba){F[26384]=1;H[l+64>>2]=f;Ca(R,2,10299,l- -64|0);break x}if(!I[26384]){F[26384]=1;H[l+80>>2]=f;Ca(R,2,10299,l+80|0)}}if(!(!(r>>>0<2|j>>>0>>0)&k+r>>>0<=j>>>0)){if(ba){j=0;Ca(R,1,9532,0);break j}j=0;Ca(R,1,9532,0);break j}T=r+z|0;b=I[T-1|0];j=b<<4|I[T-2|0]&15;if(!(!(j>>>0<2|(b|0)==255)&(j|0)<=(r|0))){if(ba){j=0;Ca(R,1,15305,0);break j}j=0;Ca(R,1,15305,0);break j}ua=H[E+28>>2];H[l+272>>2]=0;H[l+280>>2]=0;H[l+264>>2]=0;H[l+268>>2]=0;H[l+296>>2]=0;H[l+300>>2]=0;H[l+284>>2]=0;H[l+288>>2]=0;c=j-1|0;H[l+276>>2]=c;f=(r+z|0)-j|0;H[l+256>>2]=f;q=I[f|0];b=8;H[l+272>>2]=8;i=f+1|0;H[l+256>>2]=i;g=j-2|0;H[l+276>>2]=g;n=(c|0)==1?q|15:q;c=0;q=c;H[l+264>>2]=n;H[l+268>>2]=c;H[l+280>>2]=!c&(n|0)==255;h=f&3;C:{D:{if((h|0)==3){break D}w=0;if(!((n|0)!=255|(c|0)!=0|I[i|0]<=143)){break C}c=255;c=j>>>0>=3?I[i|0]:c;m=j-3|0;H[l+276>>2]=m;f=!q&(n|0)==255;b=f?15:16;H[l+272>>2]=b;V=i+(j>>>0>2)|0;H[l+256>>2]=V;c=(g|0)==1?c|15:c;g=0;H[l+280>>2]=!g&(c|0)==255;g=c;i=n;c=f?7:8;f=c&31;if((c&63)>>>0>=32){U=i<>>32-f|q<>2]=n;H[l+268>>2]=c;if((h|0)==2){break D}f=255;w=0;if(!((g|0)!=255|(x|0)!=0|I[V|0]<=143)){break C}f=j>>>0>=4?I[V|0]:f;i=j-4|0;H[l+276>>2]=i;u=V+(j>>>0>3)|0;H[l+256>>2]=u;c=(m|0)==1?f|15:f;f=0;V=f;H[l+280>>2]=!f&(c|0)==255;f=!x&(g|0)==255;b=(f?7:8)+b|0;H[l+272>>2]=b;g=c;m=n;c=f?7:8;f=c&31;if((c&63)>>>0>=32){x=m<>>32-f|q<>2]=n;H[l+268>>2]=c;if((h|0)==1){break D}w=0;if(!((g|0)!=255|(V|0)!=0|I[u|0]<=143)){break C}c=255;c=j>>>0>=5?I[u|0]:c;H[l+276>>2]=j-5;H[l+256>>2]=u+(j>>>0>4);f=0;c=(i|0)==1?c|15:c;H[l+280>>2]=!f&(c|0)==255;g=!V&(g|0)==255;b=(g?7:8)+b|0;H[l+272>>2]=b;i=n;g=g?7:8;m=g&31;if((g&63)>>>0>=32){x=i<>>32-m|q<>2]=n;H[l+268>>2]=c}c=64-b|0;b=n;g=c&31;if((c&63)>>>0>=32){i=b<>>32-g|q<>2]=b;H[l+268>>2]=i;w=1}if(!w){if(ba){j=0;Ca(R,1,11470,0);break j}j=0;Ca(R,1,11470,0);break j}C=ja-M|0;i=j;u=i-2|0;H[l+244>>2]=u;V=r+z|0;c=V-3|0;H[l+224>>2]=c;b=I[V-2|0];f=b>>>0>143;H[l+248>>2]=f;q=0;n=b>>>4|0;H[l+232>>2]=n;H[l+236>>2]=0;v=(n&7)==7?3:4;H[l+240>>2]=v;b=(c&3)+1|0;w=b>>>0>>0?b:u;E:{F:{if(!u){j=0;H[l+244>>2]=u-w;break F}b=V-4|0;H[l+224>>2]=b;g=I[c|0];j=g>>>0>143;H[l+248>>2]=j;q=v&31;if((v&63)>>>0>=32){x=g<>>32-q;q=g<>2]=n;q=x;H[l+236>>2]=q;v=(f?(g&127)==127?7:8:8)+v|0;H[l+240>>2]=v;G:{if(w>>>0<2){f=j;break G}j=V-5|0;H[l+224>>2]=j;c=I[b|0];f=c>>>0>143;H[l+248>>2]=f;m=v&31;if((v&63)>>>0>=32){U=c<>>32-m;s=c<>2]=n;q=q|U;H[l+236>>2]=q;v=(g>>>0<=143?8:(c&127)==127?7:8)+v|0;H[l+240>>2]=v;if((w|0)==2){c=b;b=j;break G}g=V-6|0;H[l+224>>2]=g;b=I[j|0];m=b;f=b>>>0>143;H[l+248>>2]=f;h=v&31;if((v&63)>>>0>=32){x=b<>>32-h;s=b<>2]=n;q=q|x;H[l+236>>2]=q;v=(c>>>0<=143?8:(b&127)==127?7:8)+v|0;H[l+240>>2]=v;if((w|0)==3){c=j;b=g;break G}b=V-7|0;H[l+224>>2]=b;c=I[g|0];f=c>>>0>143;H[l+248>>2]=f;j=v&31;if((v&63)>>>0>=32){U=c<>>32-j;j=c<>2]=n;H[l+236>>2]=j;v=(m>>>0<=143?8:(c&127)==127?7:8)+v|0;H[l+240>>2]=v;c=g}g=u-w|0;H[l+244>>2]=g;if(v>>>0>32){break E}if((g|0)>=4){j=H[c-4>>2];H[l+224>>2]=c-5;H[l+244>>2]=g-4;break F}if((g|0)<=0){j=0;break F}u=g&1;H:{if((w|0)==(i-3|0)){h=24;j=0;break H}V=g&2147483646;h=24;j=0;c=b;w=0;while(1){x=c-1|0;H[l+224>>2]=x;m=I[c|0];b=c-2|0;H[l+224>>2]=b;H[l+244>>2]=g-1;c=I[x|0];g=g-2|0;H[l+244>>2]=g;j=m<>2]=b-1;b=I[b|0];H[l+244>>2]=g-1;j=b<>2]=h>>>0>143;g=f?(j&2130706432)==2130706432?7:8:8;c=g+(j>>>0<=2415919103?8:(j&8323072)==8323072?7:8)|0;m=j>>>16&255;b=c+(m>>>0<=143?8:(j&32512)==32512?7:8)|0;x=j>>>8&255;H[l+240>>2]=b+((x>>>0<=143?8:(j&127)==127?7:8)+v|0);b=m<>>24|x<>>0>=32){x=b<>>32-c;b=b<>2]=b|n;H[l+236>>2]=q|x}jc(l+192|0,z,r-i|0,255);V=0;I:{if(P>>>0<2){break I}jc(l+160|0,T,k,0);V=0;if((P|0)==2){break I}n=0;q=0;f=0;H[l+152>>2]=1;H[l+144>>2]=0;H[l+136>>2]=0;H[l+140>>2]=0;b=k-1|0;H[l+148>>2]=b;c=(r+z|0)+k|0;g=c-1|0;H[l+128>>2]=g;m=g&3;J:{if((k|0)<=0){c=g;break J}c=c-2|0;H[l+128>>2]=c;n=I[g|0]}H[l+136>>2]=n;H[l+140>>2]=0;h=n>>>0>143;H[l+152>>2]=h;v=(n&127)==127?7:8;H[l+144>>2]=v;K:{if(!m){break K}r=k-2|0;H[l+148>>2]=r;L:{if((k|0)<2){j=c;break L}j=c-1|0;H[l+128>>2]=j;f=I[c|0]}h=f>>>0>143;H[l+152>>2]=h;c=v&31;if((v&63)>>>0>=32){i=f<>>32-c;c=f<>2]=q;c=i;H[l+140>>2]=c;v=(n>>>0<=143?8:(f&127)==127?7:8)+v|0;H[l+144>>2]=v;if((m|0)==1){c=j;n=q;q=i;k=b;b=r;break K}i=k-3|0;H[l+148>>2]=i;M:{if((k|0)<3){g=j;break M}g=j-1|0;H[l+128>>2]=g;o=I[j|0]}h=o>>>0>143;H[l+152>>2]=h;b=v&31;if((v&63)>>>0>=32){U=o<>>32-b;b=o<>2]=n;H[l+140>>2]=b;v=(f>>>0<=143?8:(o&127)==127?7:8)+v|0;H[l+144>>2]=v;if((m|0)==2){c=g;k=r;b=i;break K}b=k-4|0;H[l+148>>2]=b;f=0;N:{if((k|0)<4){c=g;break N}c=g-1|0;H[l+128>>2]=c;f=I[g|0]}h=f>>>0>143;H[l+152>>2]=h;g=v&31;if((v&63)>>>0>=32){x=f<>>32-g;g=f<>2]=n;H[l+140>>2]=g;v=(o>>>0<=143?8:(f&127)==127?7:8)+v|0;H[l+144>>2]=v;k=i}if(v>>>0<=32){O:{if((k|0)>=5){j=H[c-3>>2];H[l+148>>2]=k-5;H[l+128>>2]=c-4;break O}j=0;if((k|0)<2){break O}k=24;while(1){f=c-1|0;H[l+128>>2]=f;c=I[c|0];g=b-1|0;H[l+148>>2]=g;j=c<>>0>1;c=f;k=k-8|0;b=g;if(i){continue}break}}i=j&255;H[l+152>>2]=i>>>0>143;g=h?(j&2130706432)==2130706432?7:8:8;c=g+(j>>>0<=2415919103?8:(j&8323072)==8323072?7:8)|0;k=j>>>16&255;b=c+(k>>>0<=143?8:(j&32512)==32512?7:8)|0;f=j>>>8&255;H[l+144>>2]=b+((f>>>0<=143?8:(j&127)==127?7:8)+v|0);b=k<>>24|f<>>0>=32){i=b<>>32-c;b=b<>2]=b|n;H[l+140>>2]=i|q}V=1}ca=t-W|0;X=S+1|0;F[$+2112|0]=0;o=$+2112|0;g=$a(l+256|0);if((C|0)>0){T=ua-1|0;c=$;f=o;b=ia;z=0;while(1){r=z;m=J[(p<<8|(ob(l+224|0)&127)<<1)+16656>>1];P:{if(p){break P}j=g-2|0;m=(j|0)==-1?m:0;if((g|0)>1){g=j;break P}g=$a(l+256|0)}q=H[l+236>>2];n=H[l+232>>2];j=H[l+240>>2];t=m>>>4|0;u=H[c>>2]|(t&3|m>>>2&48)<<_;H[c>>2]=u;h=m&16;p=m>>>5&7|h>>>4;k=j;j=m&7;z=k-j|0;n=((1<>>j;q=q>>>j|0;k=n;j=0;if((C|0)>(r|2)){j=J[(p<<8|(k&127)<<1)+16656>>1];Q:{if(p){break Q}k=g-2|0;j=(k|0)==-1?j:0;if((g|0)>1){g=k;break Q}g=$a(l+256|0)}k=j&7;z=z-k|0;p=j>>>4&1|j>>>5&7;n=((1<>>k;q=q>>>k|0;k=n}H[c>>2]=u|(j<<2&768|j&48)<<_+4;v=j>>>2&2|m>>>3&1;R:{if((v|0)!=3){break R}i=g-2|0;v=(i|0)==-1?4:3;if((g|0)>1){g=i;break R}g=$a(l+256|0)}S:{if(!v){H[l+120>>2]=1;H[l+124>>2]=1;k=0;break S}if(v>>>0<=2){i=I[(k&7)+20804|0];u=i>>>2&7;x=i&3;i=(((-1<>>x)+(i>>>5|0)|0)+1|0;k=(v|0)==1;H[l+124>>2]=k?1:i;H[l+120>>2]=k?i:1;k=u+x|0;break S}i=k;k=I[(k&7)+20804|0];W=k&3;i=i>>>W|0;if((v|0)==3){v=(k>>>5|0)+1|0;if((W|0)==3){H[l+124>>2]=i&1|2;k=k>>>2&7;H[l+120>>2]=v+((-1<>>1);k=k+4|0;break S}u=I[(i&7)+20804|0];x=u&3;i=i>>>x|0;w=k>>>2&7;H[l+120>>2]=v+(i&(-1<>>2&7;H[l+124>>2]=(((-1<>>w)+(u>>>5|0)|0)+1;k=k+(x+(w+W|0)|0)|0;break S}u=I[(i&7)+20804|0];x=u&3;i=i>>>x|0;w=k>>>2&7;H[l+120>>2]=((i&(-1<>>5|0)|0)+3;k=u>>>2&7;H[l+124>>2]=(((-1<>>w)+(u>>>5|0)|0)+3;k=k+(w+(x+W|0)|0)|0}T:{w=H[l+120>>2];if(w>>>0<=X>>>0){u=H[l+124>>2];if(u>>>0<=X>>>0){break T}}if(ba){j=0;Ca(R,1,15756,0);break j}j=0;Ca(R,1,15756,0);break j}H[l+240>>2]=z-k;i=k&31;if((k&63)>>>0>=32){x=0;q=q>>>i|0}else{x=q>>>i|0;q=((1<>>i}H[l+232>>2]=q;H[l+236>>2]=x;z=r+4|0;q=(z|0)<=(C|0)?255:255>>>(z-C<<1)|0;W=(ca|0)>1?q:q&85;if((j&240|t&15)&(W^-1)){if(ba){j=0;Ca(R,1,12194,0);break j}j=0;Ca(R,1,12194,0);break j}U:{V:{if(h){n=Na(l+192|0);i=w+(m<<19>>31)|0;H[l+208>>2]=H[l+208>>2]-i;k=H[l+204>>2];q=H[l+200>>2];h=i&31;if((i&63)>>>0>=32){x=0;q=k>>>h|0}else{x=k>>>h|0;q=((1<>>h}H[l+200>>2]=q;H[l+204>>2]=x;v=(n&(-1<>>8&1)<>2]=v}W:{if(m&32){n=Na(l+192|0);i=w+(m<<18>>31)|0;H[l+208>>2]=H[l+208>>2]-i;k=H[l+204>>2];q=H[l+200>>2];h=i&31;if((i&63)>>>0>=32){x=0;q=k>>>h|0}else{x=k>>>h|0;q=((1<>>h}H[l+200>>2]=q;H[l+204>>2]=x;q=n&(-1<>>9&1)<>2]=q+2<>>0>q>>>0?n:q)|128;break W}if(!(W&2)){break W}H[(C<<2)+b>>2]=0}i=b+4|0;X:{Y:{if(m&64){n=Na(l+192|0);h=w+(m<<17>>31)|0;H[l+208>>2]=H[l+208>>2]-h;k=H[l+204>>2];q=H[l+200>>2];t=h&31;if((h&63)>>>0>=32){x=0;q=k>>>t|0}else{x=k>>>t|0;q=((1<>>t}H[l+200>>2]=q;H[l+204>>2]=x;v=(n&(-1<>>10&1)<>2]=v}F[f+1|0]=0;Z:{if(m&128){n=Na(l+192|0);h=w+(m<<16>>31)|0;H[l+208>>2]=H[l+208>>2]-h;k=H[l+204>>2];q=H[l+200>>2];t=h&31;if((h&63)>>>0>=32){x=0;q=k>>>t|0}else{x=k>>>t|0;q=((1<>>t}H[l+200>>2]=q;H[l+204>>2]=x;q=n&(-1<>>11&1)<>2]=q+2<>2]=0}i=b+8|0;_:{$:{if(j&16){n=Na(l+192|0);m=u+(j<<19>>31)|0;H[l+208>>2]=H[l+208>>2]-m;k=H[l+204>>2];q=H[l+200>>2];h=m&31;if((m&63)>>>0>=32){x=0;q=k>>>h|0}else{x=k>>>h|0;q=((1<>>h}H[l+200>>2]=q;H[l+204>>2]=x;v=(n&(-1<>>8&1)<>2]=v}aa:{if(j&32){n=Na(l+192|0);m=u+(j<<18>>31)|0;H[l+208>>2]=H[l+208>>2]-m;k=H[l+204>>2];q=H[l+200>>2];h=m&31;if((m&63)>>>0>=32){x=0;q=k>>>h|0}else{x=k>>>h|0;q=((1<>>h}H[l+200>>2]=q;H[l+204>>2]=x;q=n&(-1<>>9&1)<>2]=q+2<>>0>q>>>0?n:q)|128;break aa}if(!(W&32)){break aa}H[i+(C<<2)>>2]=0}i=b+12|0;ba:{ca:{if(j&64){n=Na(l+192|0);m=u+(j<<17>>31)|0;H[l+208>>2]=H[l+208>>2]-m;k=H[l+204>>2];q=H[l+200>>2];h=m&31;if((m&63)>>>0>=32){x=0;q=k>>>h|0}else{x=k>>>h|0;q=((1<>>h}H[l+200>>2]=q;H[l+204>>2]=x;v=(n&(-1<>>10&1)<>2]=v}f=f+2|0;F[f|0]=0;da:{if(j&128){n=Na(l+192|0);m=u+(j<<16>>31)|0;H[l+208>>2]=H[l+208>>2]-m;k=H[l+204>>2];q=H[l+200>>2];h=m&31;if((m&63)>>>0>=32){x=0;q=k>>>h|0}else{x=k>>>h|0;q=((1<>>h}H[l+200>>2]=q;H[l+204>>2]=x;j=n&(-1<>>11&1)<>2]=j+2<>>0<128){break da}H[i+(C<<2)>>2]=0}_=_^16;c=(r&4)+c|0;b=b+16|0;if((z|0)<(C|0)){continue}break}}ma=Z&8;ka=$+1584|0;la=$+1056|0;fa=$+528|0;if((ca|0)>=3){na=N(C,12);s=C<<3;ea=ua-1|0;b=ua-2|0;A=3<>>1&2147483644)+4|0;u=2;while(1){Z=u;v=I[o|0];F[o|0]=0;_=_&-17^2;ea:{if((C|0)<=0){u=u+2|0;break ea}p=Z&4?fa:$;u=Z+2|0;f=ia+(N(C,Z)<<2)|0;t=0;b=o;r=0;while(1){h=r;v=v&255;c=I[b+1|0]>>>5&4|(v>>>7|t);m=J[(c<<8|(ob(l+224|0)&127)<<1)+18704>>1];fa:{if(c){break fa}c=g-2|0;m=(c|0)==-1?m:0;if((g|0)>1){g=c;break fa}g=$a(l+256|0)}j=H[l+236>>2];q=H[l+232>>2];c=H[l+240>>2];k=H[p>>2]|(m>>>4&3|m>>>2&48)<<_;H[p>>2]=k;T=m&64;W=m&128;t=T>>>5|W>>>6;n=c;c=m&7;w=n-c|0;n=((1<>>c;q=j>>>c|0;r=n;j=0;if((C|0)>(h|2)){c=I[b+2|0]>>>5&4|I[b+1|0]>>>7|t;j=J[(c<<8|(n&127)<<1)+18704>>1];ga:{if(c){break ga}c=g-2|0;j=(c|0)==-1?j:0;if((g|0)>1){g=c;break ga}g=$a(l+256|0)}c=j&7;w=w-c|0;t=(j>>>5|j>>>6)&2;n=((1<>>c;r=n;q=q>>>c|0}H[p>>2]=k|(j<<2&768|j&48)<<_+4;k=1;c=1;ha:{ia:{ja:{z=j>>>2&2|m>>>3&1;switch(z|0){case 0:break ha;case 3:break ia;default:break ja}}c=I[(r&7)+20804|0];x=c>>>2&7;k=r;r=c&3;i=(((-1<>>r)+(c>>>5|0)|0)+1|0;c=(z|0)==1;k=c?1:i;c=c?i:1;z=r+x|0;break ha}U=I[(r&7)+20804|0];k=U&3;c=r>>>k|0;S=I[(c&7)+20804|0];x=S&3;i=S>>>2&7;r=U>>>2&7;z=i+(r+(k+x|0)|0)|0;k=c>>>x|0;c=((k&(-1<>>5|0)|0)+1|0;k=(((-1<>>r)+(S>>>5|0)|0)+1|0}H[l+240>>2]=w-z;i=z&31;if((z&63)>>>0>=32){x=0;q=q>>>i|0}else{x=q>>>i|0;q=((1<>>i}H[l+232>>2]=q;H[l+236>>2]=x;r=m&240;if(r-1&r){n=c;q=v&127;c=I[b+1|0]&127;q=c>>>0>>0?q:c;c=q-2|0;c=n+(c>>>0<=q>>>0?c:0)|0}i=j&240;if(i-1&i){n=I[b+1|0]&127;q=I[b+2|0]&127;q=n>>>0>q>>>0?n:q;k=(q>>>0>2?q-2|0:0)+k|0}if(!(c>>>0<=X>>>0&k>>>0<=X>>>0)){if(ba){j=0;Ca(R,1,15856,0);break j}j=0;Ca(R,1,15856,0);break j}v=I[b+2|0];F[b+1|0]=0;F[b+2|0]=0;n=i|r>>>4;r=h+4|0;q=(r|0)<=(C|0)?255:255>>>(r-C<<1)|0;S=(u|0)>(ca|0)?q&85:q;if(n&(S^-1)){if(ba){j=0;Ca(R,1,12194,0);break j}j=0;Ca(R,1,12194,0);break j}ka:{la:{if(m&16){n=Na(l+192|0);w=(m<<19>>31)+c|0;H[l+208>>2]=H[l+208>>2]-w;i=H[l+204>>2];q=H[l+200>>2];z=w&31;if((w&63)>>>0>=32){x=0;q=i>>>z|0}else{x=i>>>z|0;q=((1<>>z}H[l+200>>2]=q;H[l+204>>2]=x;w=(n&(-1<>>8&1)<>2]=w}ma:{if(m&32){n=Na(l+192|0);w=(m<<18>>31)+c|0;H[l+208>>2]=H[l+208>>2]-w;i=H[l+204>>2];q=H[l+200>>2];z=w&31;if((w&63)>>>0>=32){x=0;q=i>>>z|0}else{x=i>>>z|0;q=((1<>>z}H[l+200>>2]=q;H[l+204>>2]=x;q=n&(-1<>>9&1)<>2]=q+2<>>0>q>>>0?n:q)|128;break ma}if(!(S&2)){break ma}H[(C<<2)+f>>2]=0}w=f+4|0;na:{oa:{if(T){n=Na(l+192|0);z=(m<<17>>31)+c|0;H[l+208>>2]=H[l+208>>2]-z;i=H[l+204>>2];q=H[l+200>>2];T=z&31;if((z&63)>>>0>=32){x=0;q=i>>>T|0}else{x=i>>>T|0;q=((1<>>T}H[l+200>>2]=q;H[l+204>>2]=x;Y=(n&(-1<>>10&1)<>2]=Y}pa:{if(W){q=Na(l+192|0);i=(m<<16>>31)+c|0;H[l+208>>2]=H[l+208>>2]-i;n=H[l+204>>2];c=H[l+200>>2];z=i&31;if((i&63)>>>0>=32){x=0;c=n>>>z|0}else{x=n>>>z|0;c=((1<>>z}H[l+200>>2]=c;H[l+204>>2]=x;c=q&(-1<>>11&1)<>2]=c+2<>2]=0}i=f+8|0;qa:{ra:{if(j&16){q=Na(l+192|0);m=(j<<19>>31)+k|0;H[l+208>>2]=H[l+208>>2]-m;n=H[l+204>>2];c=H[l+200>>2];w=m&31;if((m&63)>>>0>=32){x=0;c=n>>>w|0}else{x=n>>>w|0;c=((1<>>w}H[l+200>>2]=c;H[l+204>>2]=x;c=(q&(-1<>>8&1)<>2]=c}sa:{if(j&32){q=Na(l+192|0);m=(j<<18>>31)+k|0;H[l+208>>2]=H[l+208>>2]-m;n=H[l+204>>2];c=H[l+200>>2];w=m&31;if((m&63)>>>0>=32){x=0;c=n>>>w|0}else{x=n>>>w|0;c=((1<>>w}H[l+200>>2]=c;H[l+204>>2]=x;c=q&(-1<>>9&1)<>2]=c+2<>>0>>0?q:c)|128;break sa}if(!(S&32)){break sa}H[i+(C<<2)>>2]=0}i=f+12|0;ta:{ua:{if(j&64){q=Na(l+192|0);m=(j<<17>>31)+k|0;H[l+208>>2]=H[l+208>>2]-m;n=H[l+204>>2];c=H[l+200>>2];w=m&31;if((m&63)>>>0>=32){x=0;c=n>>>w|0}else{x=n>>>w|0;c=((1<>>w}H[l+200>>2]=c;H[l+204>>2]=x;c=(q&(-1<>>10&1)<>2]=c}b=b+2|0;va:{if(j&128){q=Na(l+192|0);k=(j<<16>>31)+k|0;H[l+208>>2]=H[l+208>>2]-k;n=H[l+204>>2];c=H[l+200>>2];m=k&31;if((k&63)>>>0>=32){x=0;c=n>>>m|0}else{x=n>>>m|0;c=((1<>>m}H[l+200>>2]=c;H[l+204>>2]=x;c=q&(-1<>>11&1)<>2]=c+2<>>0<128){break va}H[i+(C<<2)>>2]=0}_=_^16;p=(h&4)+p|0;f=f+16|0;if((r|0)<(C|0)){continue}break}}wa:{if(!(Z&2)|P>>>0<2){break wa}p=u&4;xa:{ya:{za:{Aa:{Ba:{if(V){w=p?$:fa;z=0;if((C|0)<=0){break Ba}q=ia+(N(C,Z-2|0)<<2)|0;while(1){j=ob(l+128|0);m=0;f=H[w>>2];if(f){m=q+(z<<2)|0;k=0;b=15;while(1){Ca:{if(!(b&f)){break Ca}n=b&286331153;if(n&f){H[m>>2]=D|H[m>>2]^((j^-1)&1)<>>1|0}if(f&n<<1){c=(C<<2)+m|0;H[c>>2]=D|H[c>>2]^((j^-1)&1)<>>1|0}if(f&n<<2){c=m+s|0;H[c>>2]=D|H[c>>2]^((j^-1)&1)<>>1|0}if(!(f&n<<3)){break Ca}c=m+na|0;H[c>>2]=D|H[c>>2]^((j^-1)&1)<>>1|0}m=m+4|0;b=b<<4;k=k+1|0;if((k|0)!=8){continue}break}m=Me(f)}w=w+4|0;H[l+144>>2]=H[l+144>>2]-m;c=H[l+140>>2];b=H[l+136>>2];j=m&31;if((m&63)>>>0>=32){x=0;b=c>>>j|0}else{x=c>>>j|0;b=((1<>>j}H[l+136>>2]=b;H[l+140>>2]=x;z=z+8|0;if((C|0)>(z|0)){continue}break}}c=0;j=0;Y=p?la:ka;m=Y;w=p?$:fa;b=w;if((C|0)>0){break za}b=!p;break Aa}Y=p?la:ka;b=!p}if(Z>>>0<=5){break wa}h=b?$:fa;if((C|0)<=0){break xa}b=b?la:ka;break ya}while(1){q=j>>>28|0;j=H[b>>2];q=j|(q|j<<4|j>>>4);H[m>>2]=q;q=q|H[b+4>>2]<<28;H[m>>2]=(q>>>1&2004318071|q<<1&-286331154|q)&(j^-1);m=m+4|0;b=b+4|0;c=c+8|0;if((C|0)>(c|0)){continue}break}if(Z>>>0<6){break wa}h=p?fa:$;b=p?ka:la}k=0;p=0;m=w;v=b;j=b;b=h;while(1){q=m+4|0;c=H[j>>2];n=H[m>>2];if(!ma){c=c|(n|(n<<4|p>>>28|n>>>4|H[q>>2]<<28))<<3&-2004318072}H[j>>2]=(H[b>>2]^-1)&c;b=b+4|0;j=j+4|0;p=n;m=q;k=k+8|0;if((C|0)>(k|0)){continue}break}if((C|0)<=0){break xa}T=ia+(N(C,Z-6|0)<<2)|0;pa=0;p=h;while(1){f=0;b=H[v>>2];if(b){W=pa|4;Z=C-pa|0;i=(pa<<2)+T|0;j=0;t=0;while(1){q=j;j=Na(l+160|0);S=(C|0)>(t+W|0)?t+4|0:Z;Da:{if((S|0)<=(t|0)){m=0;break Da}da=H[p>>2]^-1;x=t<<2;z=i+x|0;m=0;k=t;r=15<>>1|0}n=U<<1;if(n&b){if(j&1){f=f|n;b=da&116<<(k<<2)|b}m=m+1|0;j=j>>>1|0}n=U<<2;if(n&b){if(j&1){f=f|n;b=da&232<<(k<<2)|b}m=m+1|0;j=j>>>1|0}n=U<<3;if(!(n&b)){break Ea}if(j&1){f=f|n;b=da&192<<(k<<2)|b}m=m+1|0;j=j>>>1|0}c=c<<4;k=k+1|0;if((S|0)>(k|0)){continue}break}if(!(f>>>x&65535)){break Da}while(1){Fa:{if(!(f&r)){break Fa}n=r&286331153;if(n&f){H[z>>2]=A|(H[z>>2]|j<<31);m=m+1|0;j=j>>>1|0}if(n<<1&f){c=(C<<2)+z|0;H[c>>2]=A|(H[c>>2]|j<<31);m=m+1|0;j=j>>>1|0}if(n<<2&f){c=s+z|0;H[c>>2]=A|(H[c>>2]|j<<31);m=m+1|0;j=j>>>1|0}if(!(n<<3&f)){break Fa}c=z+na|0;H[c>>2]=A|(H[c>>2]|j<<31);m=m+1|0;j=j>>>1|0}r=r<<4;z=z+4|0;t=t+1|0;if((S|0)>(t|0)){continue}break}}H[l+176>>2]=H[l+176>>2]-m;j=H[l+172>>2];c=H[l+168>>2];n=m&31;if((m&63)>>>0>=32){x=0;c=j>>>n|0}else{x=j>>>n|0;c=((1<>>n}H[l+168>>2]=c;H[l+172>>2]=x;j=1;t=4;if(!(q&1)){continue}break}H[v+4>>2]=H[v+4>>2]|(f>>>27&14|f>>>29|f>>>28)&(H[p+4>>2]^-1)}j=H[p>>2]|f;q=j>>>3&286331153;c=q>>>4|q<<4|q;if(pa){b=Y-4|0;H[b>>2]=H[b>>2]|(H[w-4>>2]^-1)&q<<28}H[Y>>2]=H[Y>>2]|c&(H[w>>2]^-1);H[Y+4>>2]=H[Y+4>>2]|(H[w+4>>2]^-1)&j>>>31;v=v+4|0;p=p+4|0;Y=Y+4|0;w=w+4|0;pa=pa+8|0;if((C|0)>(pa|0)){continue}break}}if(!ha){break wa}y(h,0,ha)}if((u|0)<(ca|0)){continue}break}}Ga:{if(P>>>0<2){break Ga}f=(ca&3)-1|0;Ha:{if(V&f>>>0<2){if((C|0)<=0){break Ha}r=1<>2];if(o){m=n+(t<<2)|0;b=15;k=0;while(1){Ia:{if(!(b&o)){break Ia}p=b&286331153;if(p&o){H[m>>2]=r|H[m>>2]^((j^-1)&1)<>>1|0}if(o&p<<1){c=(C<<2)+m|0;H[c>>2]=r|H[c>>2]^((j^-1)&1)<>>1|0}if(o&p<<2){c=g+m|0;H[c>>2]=r|H[c>>2]^((j^-1)&1)<>>1|0}if(!(o&p<<3)){break Ia}c=m+q|0;H[c>>2]=r|H[c>>2]^((j^-1)&1)<>>1|0}m=m+4|0;b=b<<4;k=k+1|0;if((k|0)!=8){continue}break}m=Me(o)}w=w+4|0;H[l+144>>2]=H[l+144>>2]-m;c=H[l+140>>2];b=H[l+136>>2];j=m&31;if((m&63)>>>0>=32){x=0;b=c>>>j|0}else{x=c>>>j|0;b=((1<>>j}H[l+136>>2]=b;H[l+140>>2]=x;t=t+8|0;if((C|0)>(t|0)){continue}break}}if((C|0)<=0|f>>>0>1){break Ha}b=ca&4;m=b?fa:$;b=b?ka:la;c=0;j=0;while(1){g=j>>>28|0;j=H[m>>2];g=j|(g|j<<4|j>>>4);H[b>>2]=g;g=g|H[m+4>>2]<<28;H[b>>2]=(g>>>1&2004318071|g<<1&-286331154|g)&(j^-1);b=b+4|0;m=m+4|0;c=c+8|0;if((C|0)>(c|0)){continue}break}}P=(ca|0)>6?(ca-(ca+1&3)|0)-3|0:0;if((ca|0)<=(P|0)){break Ga}W=N(C,12);t=C<<3;s=3<>>0>=3){_=-1;if((c|0)<5){break La}if(S){break Ja}c=P&4;m=c?fa:$;j=c?ka:la;b=0;if(!ma){b=c?$:fa;c=0;f=0;while(1){g=f>>>28|0;_=-1;f=H[b>>2];H[j>>2]=(H[j>>2]|(f|(g|f<<4|f>>>4|H[b+4>>2]<<28))<<3&-2004318072)&(H[m>>2]^-1);m=m+4|0;j=j+4|0;b=b+4|0;c=c+8|0;if((C|0)>(c|0)){continue}break}break Ka}while(1){_=-1;H[j>>2]=H[j>>2]&(H[m>>2]^-1);m=m+4|0;j=j+4|0;b=b+8|0;if((C|0)>(b|0)){continue}break}break Ka}_=H[(b<<2)+20812>>2]}if(S){break Ja}}b=P&4;r=b?fa:$;p=b?ka:la;g=b?$:fa;v=b?la:ka;u=ia+(N(C,P)<<2)|0;h=0;while(1){f=0;b=H[p>>2]&_;if(b){V=h|4;Z=C-h|0;o=u+(h<<2)|0;j=0;i=0;while(1){q=j;j=Na(l+160|0);T=(C|0)>(i+V|0)?i+4|0:Z;Ma:{if((T|0)<=(i|0)){m=0;break Ma}x=i<<2;z=x+o|0;ha=(H[r>>2]^-1)&_;m=0;k=i;w=15<>>1|0}n=U<<1;if(n&b){if(j&1){f=f|n;b=ha&116<<(k<<2)|b}m=m+1|0;j=j>>>1|0}n=U<<2;if(n&b){if(j&1){f=f|n;b=ha&232<<(k<<2)|b}m=m+1|0;j=j>>>1|0}n=U<<3;if(!(n&b)){break Na}if(j&1){f=f|n;b=ha&192<<(k<<2)|b}m=m+1|0;j=j>>>1|0}c=c<<4;k=k+1|0;if((T|0)>(k|0)){continue}break}if(!(f>>>x&65535)){break Ma}while(1){Oa:{if(!(f&w)){break Oa}n=w&286331153;if(n&f){H[z>>2]=s|(H[z>>2]|j<<31);m=m+1|0;j=j>>>1|0}if(n<<1&f){c=(C<<2)+z|0;H[c>>2]=s|(H[c>>2]|j<<31);m=m+1|0;j=j>>>1|0}if(n<<2&f){c=t+z|0;H[c>>2]=s|(H[c>>2]|j<<31);m=m+1|0;j=j>>>1|0}if(!(n<<3&f)){break Oa}c=z+W|0;H[c>>2]=s|(H[c>>2]|j<<31);m=m+1|0;j=j>>>1|0}w=w<<4;z=z+4|0;i=i+1|0;if((T|0)>(i|0)){continue}break}}H[l+176>>2]=H[l+176>>2]-m;j=H[l+172>>2];c=H[l+168>>2];n=m&31;if((m&63)>>>0>=32){x=0;c=j>>>n|0}else{x=j>>>n|0;c=((1<>>n}H[l+168>>2]=c;H[l+172>>2]=x;j=1;i=4;if(!(q&1)){continue}break}H[p+4>>2]=H[p+4>>2]|(f>>>27&14|f>>>29|f>>>28)&(H[r+4>>2]^-1)}j=H[r>>2]|f;q=j>>>3&286331153;c=q>>>4|q<<4|q;if(h){b=v-4|0;H[b>>2]=H[b>>2]|(H[g-4>>2]^-1)&q<<28}H[v>>2]=H[v>>2]|c&(H[g>>2]^-1);H[v+4>>2]=H[v+4>>2]|(H[g+4>>2]^-1)&j>>>31;p=p+4|0;r=r+4|0;v=v+4|0;g=g+4|0;h=h+8|0;if((C|0)>(h|0)){continue}break}}P=P+4|0;if((ca|0)>(P|0)){continue}break}}j=1;if((ca|0)<=0|(C|0)<=0){break j}q=C&2147483644;n=C&3;g=M-ja>>>0>4294967292;p=0;while(1){j=ia+(N(p,C)<<2)|0;m=0;if(!g){while(1){c=H[j>>2];b=c&2147483647;H[j>>2]=(c|0)<0?0-b|0:b;c=H[j+4>>2];b=c&2147483647;H[j+4>>2]=(c|0)<0?0-b|0:b;c=H[j+8>>2];b=c&2147483647;H[j+8>>2]=(c|0)<0?0-b|0:b;c=H[j+12>>2];b=c&2147483647;H[j+12>>2]=(c|0)<0?0-b|0:b;j=j+16|0;m=m+4|0;if((q|0)!=(m|0)){continue}break}}m=0;if(n){while(1){c=H[j>>2];b=c&2147483647;H[j>>2]=(c|0)<0?0-b|0:b;j=j+4|0;m=m+1|0;if((n|0)!=(m|0)){continue}break}}j=1;p=p+1|0;if((ca|0)!=(p|0)){continue}break}break j}if(!ba){break v}H[l+52>>2]=H[E+24>>2];H[l+48>>2]=S;Ca(R,1,9686,l+48|0);break u}H[l+20>>2]=m;H[l+16>>2]=S;Ca(R,1,9686,l+16|0);j=0;break j}j=0}oa=l+304|0;if(j){break i}break b}H[e+108>>2]=(b<<9)+22336;c=0;b=H[e+116>>2];Pa:{Qa:{p=H[E+16>>2]-H[E+8>>2]|0;k=H[E+20>>2]-H[E+12>>2]|0;g=N(p,k);Ra:{Sa:{Ta:{if(g>>>0>K[e+132>>2]){Da(b);b=Ja(g<<2);H[e+116>>2]=b;if(!b){break Ra}H[e+132>>2]=g;break Ta}if(!b){break Sa}}g=g<<2;if(!g){break Sa}y(b,0,g)}b=H[e+120>>2];r=p+2|0;n=k+3>>>2|0;g=N(r,n+2|0);if(g>>>0<=K[e+136>>2]){z=g<<2;break Qa}Da(b);z=g<<2;b=Ja(z);H[e+120>>2]=b;if(b){break Qa}}b=0;break Pa}H[e+136>>2]=g;if(z){y(b,0,z)}Ua:{if(!r){break Ua}q=H[e+120>>2];b=q;l=p+1|0;if(l>>>0>=7){g=r&-8;while(1){H[b+24>>2]=1226833920;H[b+28>>2]=1226833920;H[b+16>>2]=1226833920;H[b+20>>2]=1226833920;H[b+8>>2]=1226833920;H[b+12>>2]=1226833920;H[b>>2]=1226833920;H[b+4>>2]=1226833920;b=b+32|0;c=c+8|0;if((g|0)!=(c|0)){continue}break}}g=r&7;if(g){c=0;while(1){H[b>>2]=1226833920;b=b+4|0;c=c+1|0;if((g|0)!=(c|0)){continue}break}}b=q+(N(r,n+1|0)<<2)|0;if(l>>>0>=7){g=r&-8;c=0;while(1){H[b+24>>2]=1226833920;H[b+28>>2]=1226833920;H[b+16>>2]=1226833920;H[b+20>>2]=1226833920;H[b+8>>2]=1226833920;H[b+12>>2]=1226833920;H[b>>2]=1226833920;H[b+4>>2]=1226833920;b=b+32|0;c=c+8|0;if((g|0)!=(c|0)){continue}break}}g=r&7;if(g){c=0;while(1){H[b>>2]=1226833920;b=b+4|0;c=c+1|0;if((g|0)!=(c|0)){continue}break}}b=k&3;if(!b){break Ua}g=(b|0)==1?1224736768:(b|0)==2?1207959552:1073741824;b=q+(N(n,r)<<2)|0;if(l>>>0>=7){c=r&-8;z=0;while(1){H[b+28>>2]=g;H[b+24>>2]=g;H[b+20>>2]=g;H[b+16>>2]=g;H[b+12>>2]=g;H[b+8>>2]=g;H[b+4>>2]=g;H[b>>2]=g;b=b+32|0;z=z+8|0;if((c|0)!=(z|0)){continue}break}}c=r&7;if(!c){break Ua}z=0;while(1){H[b>>2]=g;b=b+4|0;z=z+1|0;if((c|0)!=(z|0)){continue}break}}H[e+128>>2]=k;H[e+124>>2]=p;b=1}if(!b){break b}z=P+H[E+28>>2]|0;if((z|0)>=31){if(!ba){break h}H[aa+16>>2]=z;Ca(R,2,8716,aa+16|0);break b}ic(e);_a(e,18,46);_a(e,17,3);_a(e,0,4);if(H[E+64>>2]){break i}q=H[E+52>>2];Va:{if(!(q>>>0<=1&(!H[e+144>>2]|(q|0)!=1))){b=H[E+4>>2];g=0;if(q-1>>>0>=3){c=q&-4;while(1){l=(i<<3)+b|0;g=H[l+28>>2]+(H[l+20>>2]+(H[l+12>>2]+(H[l+4>>2]+g|0)|0)|0)|0;i=i+4|0;f=f+4|0;if((c|0)!=(f|0)){continue}break}}c=q&3;if(c){while(1){g=H[((i<<3)+b|0)+4>>2]+g|0;i=i+1|0;j=j+1|0;if((c|0)!=(j|0)){continue}break}}ja=H[e+148>>2];c=g+2|0;if(c>>>0>K[e+152>>2]){b=Ia(ja,c);if(!b){break b}H[e+148>>2]=b;b=b+g|0;F[b|0]=0;F[b+1|0]=0;H[e+152>>2]=c;ja=H[e+148>>2];if(!H[E+52>>2]){break Va}b=H[E+4>>2]}g=0;i=0;while(1){l=i<<3;c=l+b|0;b=H[c+4>>2];if(b){B(g+ja|0,H[c>>2],b)}b=H[E+4>>2];g=H[(l+b|0)+4>>2]+g|0;i=i+1|0;if(i>>>0>2]){continue}break}break Va}if((q|0)!=1){break i}ja=H[H[E+4>>2]>>2]}b=H[E+60>>2];if(b){$=H[e+116>>2];H[e+116>>2]=b}if(H[E+44>>2]){ia=Z&2;ha=Z&8;da=e+28|0;V=!(Z&1);_=2;while(1){l=U+ja|0;ma=H[E>>2]+N(S,24)|0;c=H[ma>>2];na=V|((H[E+28>>2]-4|0)<(z|0)|_>>>0>1);Wa:{if(!na){H[e+20>>2]=l;b=c+l|0;H[e+24>>2]=b;G[e+112>>1]=I[b|0]|I[b+1|0]<<8;F[b|0]=255;F[H[e+24>>2]+1|0]=255;H[e+8>>2]=0;H[e>>2]=0;H[e+16>>2]=l;break Wa}H[e+20>>2]=l;b=c+l|0;H[e+24>>2]=b;G[e+112>>1]=I[b|0]|I[b+1|0]<<8;F[b|0]=255;F[H[e+24>>2]+1|0]=255;H[e+104>>2]=e+28;H[e+16>>2]=l;H[e+12>>2]=0;b=c?I[l|0]<<16:16711680;H[e>>2]=b;j=1;c=l+1|0;g=I[l+1|0];Xa:{if(I[l|0]==255){if(g>>>0>=144){H[e+12>>2]=1;b=b|65280;break Xa}H[e+16>>2]=c;j=0;b=b+(g<<9)|0;break Xa}H[e+16>>2]=c;b=b|g<<8}H[e+8>>2]=j;H[e+4>>2]=32768;H[e>>2]=b<<7}x=H[ma>>2];Ya:{if(!H[ma+8>>2]|(z|0)<=0){break Ya}T=0;P=na&(ia|0)!=0;while(1){Za:{_a:{$a:{switch(_-1|0){default:if(!na){b=1<>>1|b;r=H[e+124>>2];n=r<<2;b=(n+H[e+120>>2]|0)+12|0;g=H[e+116>>2];m=0;c=H[e+128>>2];if(c>>>0>=4){if(!r){break Za}d=N(r,12);q=r<<3;f=0-o|0;while(1){c=0;while(1){l=b;b=H[b>>2];ab:{if(!b){break ab}if(!(!(b&495)|b&2097168)){b=H[e>>2];j=H[e+8>>2];bb:{if(j){break bb}j=(b|0)==255;k=H[e+16>>2];b=I[k|0];cb:{if(!j){H[e>>2]=b;H[e+16>>2]=k+1;break cb}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=k+1;j=7;break bb}b=255;H[e>>2]=255}j=8}j=j-1|0;H[e+8>>2]=j;db:{if(!(b>>>j&1)){break db}eb:{if(j){break eb}j=(b|0)==255;k=H[e+16>>2];b=I[k|0];fb:{if(!j){H[e>>2]=b;H[e+16>>2]=k+1;break fb}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=k+1;j=7;break eb}b=255;H[e>>2]=255}j=8}j=j-1|0;H[e+8>>2]=j;k=b>>>j&1;H[g>>2]=k?f:o;j=H[e+124>>2];b=l-4|0;H[b>>2]=H[b>>2]|32;H[l+4>>2]=H[l+4>>2]|8;H[l>>2]=H[l>>2]|k<<19|16;if(ha){break db}b=l+(-2-j<<2)|0;H[b+4>>2]=H[b+4>>2]|32768;H[b>>2]=H[b>>2]|k<<31|65536;b=b-4|0;H[b>>2]=H[b>>2]|131072}b=H[l>>2]|2097152;H[l>>2]=b}if(!(!(b&3960)|b&16777344)){b=H[e>>2];j=H[e+8>>2];gb:{if(j){break gb}j=(b|0)==255;k=H[e+16>>2];b=I[k|0];hb:{if(!j){H[e>>2]=b;H[e+16>>2]=k+1;break hb}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=k+1;j=7;break gb}b=255;H[e>>2]=255}j=8}j=j-1|0;H[e+8>>2]=j;if(b>>>j&1){ib:{if(j){break ib}j=(b|0)==255;k=H[e+16>>2];b=I[k|0];jb:{if(!j){H[e>>2]=b;H[e+16>>2]=k+1;break jb}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=k+1;j=7;break ib}b=255;H[e>>2]=255}j=8}j=j-1|0;H[e+8>>2]=j;j=b>>>j&1;H[g+n>>2]=j?f:o;b=l-4|0;H[b>>2]=H[b>>2]|256;H[l+4>>2]=H[l+4>>2]|64;b=H[l>>2]|j<<22|128}else{b=H[l>>2]}b=b|16777216;H[l>>2]=b}if(!(!(b&31680)|b&134218752)){b=H[e>>2];j=H[e+8>>2];kb:{if(j){break kb}j=(b|0)==255;k=H[e+16>>2];b=I[k|0];lb:{if(!j){H[e>>2]=b;H[e+16>>2]=k+1;break lb}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=k+1;j=7;break kb}b=255;H[e>>2]=255}j=8}j=j-1|0;H[e+8>>2]=j;if(b>>>j&1){mb:{if(j){break mb}j=(b|0)==255;k=H[e+16>>2];b=I[k|0];nb:{if(!j){H[e>>2]=b;H[e+16>>2]=k+1;break nb}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=k+1;j=7;break mb}b=255;H[e>>2]=255}j=8}j=j-1|0;H[e+8>>2]=j;j=b>>>j&1;H[g+q>>2]=j?f:o;b=l-4|0;H[b>>2]=H[b>>2]|2048;H[l+4>>2]=H[l+4>>2]|512;b=H[l>>2]|j<<25|1024}else{b=H[l>>2]}b=b|134217728;H[l>>2]=b}if(!(b&253440)|b&1073750016){break ab}b=H[e>>2];j=H[e+8>>2];ob:{if(j){break ob}j=(b|0)==255;k=H[e+16>>2];b=I[k|0];pb:{if(!j){H[e>>2]=b;H[e+16>>2]=k+1;break pb}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=k+1;j=7;break ob}b=255;H[e>>2]=255}j=8}j=j-1|0;H[e+8>>2]=j;if(b>>>j&1){qb:{if(j){break qb}j=(b|0)==255;k=H[e+16>>2];b=I[k|0];rb:{if(!j){H[e>>2]=b;H[e+16>>2]=k+1;break rb}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=k+1;j=7;break qb}b=255;H[e>>2]=255}j=8}j=j-1|0;H[e+8>>2]=j;k=b>>>j&1;H[d+g>>2]=k?f:o;j=H[e+124>>2];b=l-4|0;H[b>>2]=H[b>>2]|16384;H[l+4>>2]=H[l+4>>2]|4096;H[l>>2]=H[l>>2]|k<<28|8192;b=l+(j<<2)|0;H[b+4>>2]=H[b+4>>2]|4;H[b+12>>2]=H[b+12>>2]|1;H[b+8>>2]=H[b+8>>2]|k<<18|2}H[l>>2]=H[l>>2]|1073741824}g=g+4|0;b=l+4|0;c=c+1|0;if((r|0)!=(c|0)){continue}break}g=d+g|0;b=l+12|0;m=m+4|0;c=H[e+128>>2];if(m>>>0<(c&-4)>>>0){continue}break}}if(!r|c>>>0<=m>>>0){break _a}v=0;q=0-o|0;j=c;while(1){sb:{if((j|0)==(m|0)){j=m;break sb}d=b-4|0;k=H[b>>2];i=0;while(1){p=N(i,3);l=k>>>p|0;if(!(l&2097168|!(l&495))){c=H[e>>2];f=H[e+8>>2];tb:{if(f){break tb}l=(c|0)!=255;j=H[e+16>>2];c=I[j|0];ub:{if(!l){if(c>>>0>=144){c=255;H[e>>2]=255;break ub}H[e>>2]=c;H[e+16>>2]=j+1;f=7;break tb}H[e>>2]=c;H[e+16>>2]=j+1}f=8}f=f-1|0;H[e+8>>2]=f;vb:{if(!(c>>>f&1)){break vb}j=(N(i,r)<<2)+g|0;wb:{if(f){break wb}l=(c|0)!=255;n=H[e+16>>2];c=I[n|0];xb:{if(!l){if(c>>>0>=144){c=255;H[e>>2]=255;break xb}H[e>>2]=c;H[e+16>>2]=n+1;f=7;break wb}H[e>>2]=c;H[e+16>>2]=n+1}f=8}l=f-1|0;H[e+8>>2]=l;k=j;j=c>>>l&1;H[k>>2]=j?q:o;l=H[e+124>>2];H[d>>2]=H[d>>2]|32<>2]=H[b>>2]|(j<<19|16)<>2]=H[b+4>>2]|8<>2]=H[c+4>>2]|32768;H[c>>2]=H[c>>2]|j<<31|65536;c=c-4|0;H[c>>2]=H[c>>2]|131072}if((i|0)!=3){break vb}c=(l<<2)+b|0;H[c+4>>2]=H[c+4>>2]|4;H[c+12>>2]=H[c+12>>2]|1;H[c+8>>2]=H[c+8>>2]|j<<18|2}k=H[b>>2]|2097152<>2]=k;c=H[e+128>>2]}j=c;i=i+1|0;if(i>>>0>>0){continue}break}}g=g+4|0;b=b+4|0;v=v+1|0;if((r|0)!=(v|0)){continue}break}break _a}j=0;r=0;v=0;yb:{zb:{Ab:{D=H[e+124>>2];if(!((D|0)!=64|H[e+128>>2]!=64)){b=1<>>1|b;l=0-j|0;u=e+28|0;g=H[e+120>>2]+268|0;f=H[e+8>>2];c=H[e+4>>2];k=H[e>>2];m=H[e+104>>2];b=H[e+116>>2];if(Z&8){break Ab}while(1){v=0;while(1){q=b;n=g;g=H[g>>2];if(g){Bb:{if(g&2097168){break Bb}b=g&495;if(!b){break Bb}m=u+(I[b+H[e+108>>2]|0]<<2)|0;i=H[m>>2];b=H[i>>2];c=c-b|0;Cb:{if(k>>>16>>>0>>0){p=H[i+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[i+(d?8:12)>>2];while(1){Db:{if(f){break Db}f=H[e+16>>2];c=f+1|0;i=I[f+1|0];if(I[f|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Db}H[e+16>>2]=c;k=(i<<9)+k|0;f=7;break Db}H[e+16>>2]=c;f=8;k=(i<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?p:!p;break Cb}k=k-(b<<16)|0;if(!(c&32768)){p=H[i+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[i+(b?12:8)>>2];while(1){Eb:{if(f){break Eb}f=H[e+16>>2];d=f+1|0;i=I[f+1|0];if(I[f|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Eb}H[e+16>>2]=d;k=(i<<9)+k|0;f=7;break Eb}H[e+16>>2]=d;f=8;k=(i<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!p:p;break Cb}b=H[i+4>>2]}if(b){o=n-4|0;d=H[n+4>>2]>>>17&4|(H[o>>2]>>>19&1|(g>>>14&16|(g>>>16&64|g&170)));m=u+(I[d+24384|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;p=I[d+24640|0];Fb:{if(k>>>16>>>0>>0){i=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){Gb:{if(f){break Gb}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Gb}H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break Gb}H[e+16>>2]=c;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;d=d?i:!i;break Fb}k=k-(b<<16)|0;if(!(c&32768)){i=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){Hb:{if(f){break Hb}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Hb}H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break Hb}H[e+16>>2]=d;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}d=b?!i:i;break Fb}d=H[h+4>>2]}H[q>>2]=(p|0)==(d|0)?j:l;H[o>>2]=H[o>>2]|32;H[n+4>>2]=H[n+4>>2]|8;b=n-268|0;H[b>>2]=H[b>>2]|131072;b=n-260|0;H[b>>2]=H[b>>2]|32768;b=n-264|0;i=b;w=H[b>>2];b=d^p;H[i>>2]=w|b<<31|65536;g=b<<19|g|16}g=g|2097152}if(!(!(g&3960)|g&16777344)){p=g>>>3|0;m=u+(I[H[e+108>>2]+(p&495)|0]<<2)|0;o=H[m>>2];b=H[o>>2];c=c-b|0;Ib:{if(k>>>16>>>0>>0){i=H[o+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[o+(d?8:12)>>2];while(1){Jb:{if(f){break Jb}f=H[e+16>>2];c=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Jb}H[e+16>>2]=c;k=(o<<9)+k|0;f=7;break Jb}H[e+16>>2]=c;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break Ib}k=k-(b<<16)|0;if(!(c&32768)){i=H[o+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[o+(b?12:8)>>2];while(1){Kb:{if(f){break Kb}f=H[e+16>>2];d=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Kb}H[e+16>>2]=d;k=(o<<9)+k|0;f=7;break Kb}H[e+16>>2]=d;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break Ib}b=H[o+4>>2]}if(b){o=n-4|0;d=H[n+4>>2]>>>20&4|(H[o>>2]>>>22&1|(g>>>15&16|(g>>>19&64|p&170)));m=u+(I[d+24384|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;p=I[d+24640|0];Lb:{if(k>>>16>>>0>>0){i=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){Mb:{if(f){break Mb}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Mb}H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break Mb}H[e+16>>2]=c;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break Lb}k=k-(b<<16)|0;if(!(c&32768)){i=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){Nb:{if(f){break Nb}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Nb}H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break Nb}H[e+16>>2]=d;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break Lb}b=H[h+4>>2]}H[q+256>>2]=(p|0)==(b|0)?j:l;H[o>>2]=H[o>>2]|256;H[n+4>>2]=H[n+4>>2]|64;g=(b^p)<<22|g|128}g=g|16777216}if(!(!(g&31680)|g&134218752)){p=g>>>6|0;m=u+(I[H[e+108>>2]+(p&495)|0]<<2)|0;o=H[m>>2];b=H[o>>2];c=c-b|0;Ob:{if(k>>>16>>>0>>0){i=H[o+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[o+(d?8:12)>>2];while(1){Pb:{if(f){break Pb}f=H[e+16>>2];c=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Pb}H[e+16>>2]=c;k=(o<<9)+k|0;f=7;break Pb}H[e+16>>2]=c;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break Ob}k=k-(b<<16)|0;if(!(c&32768)){i=H[o+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[o+(b?12:8)>>2];while(1){Qb:{if(f){break Qb}f=H[e+16>>2];d=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Qb}H[e+16>>2]=d;k=(o<<9)+k|0;f=7;break Qb}H[e+16>>2]=d;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break Ob}b=H[o+4>>2]}if(b){o=n-4|0;d=H[n+4>>2]>>>23&4|(H[o>>2]>>>25&1|(g>>>18&16|(g>>>22&64|p&170)));m=u+(I[d+24384|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;p=I[d+24640|0];Rb:{if(k>>>16>>>0>>0){i=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){Sb:{if(f){break Sb}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Sb}H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break Sb}H[e+16>>2]=c;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break Rb}k=k-(b<<16)|0;if(!(c&32768)){i=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){Tb:{if(f){break Tb}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Tb}H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break Tb}H[e+16>>2]=d;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break Rb}b=H[h+4>>2]}H[q+512>>2]=(p|0)==(b|0)?j:l;H[o>>2]=H[o>>2]|2048;H[n+4>>2]=H[n+4>>2]|512;g=(b^p)<<25|g|1024}g=g|134217728}if(!(!(g&253440)|g&1073750016)){p=g>>>9|0;m=u+(I[H[e+108>>2]+(p&495)|0]<<2)|0;o=H[m>>2];b=H[o>>2];c=c-b|0;Ub:{if(k>>>16>>>0>>0){i=H[o+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[o+(d?8:12)>>2];while(1){Vb:{if(f){break Vb}f=H[e+16>>2];c=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Vb}H[e+16>>2]=c;k=(o<<9)+k|0;f=7;break Vb}H[e+16>>2]=c;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break Ub}k=k-(b<<16)|0;if(!(c&32768)){i=H[o+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[o+(b?12:8)>>2];while(1){Wb:{if(f){break Wb}f=H[e+16>>2];d=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Wb}H[e+16>>2]=d;k=(o<<9)+k|0;f=7;break Wb}H[e+16>>2]=d;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break Ub}b=H[o+4>>2]}if(b){o=n-4|0;d=H[n+4>>2]>>>26&4|(H[o>>2]>>>28&1|(g>>>21&16|(g>>>25&64|p&170)));m=u+(I[d+24384|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;p=I[d+24640|0];Xb:{if(k>>>16>>>0>>0){i=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){Yb:{if(f){break Yb}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Yb}H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break Yb}H[e+16>>2]=c;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break Xb}k=k-(b<<16)|0;if(!(c&32768)){i=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){Zb:{if(f){break Zb}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break Zb}H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break Zb}H[e+16>>2]=d;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break Xb}b=H[h+4>>2]}H[q+768>>2]=(p|0)==(b|0)?j:l;H[o>>2]=H[o>>2]|16384;H[n+4>>2]=H[n+4>>2]|4096;H[n+260>>2]=H[n+260>>2]|4;H[n+268>>2]=H[n+268>>2]|1;b=b^p;H[n+264>>2]=H[n+264>>2]|b<<18|2;g=b<<28|g|8192}g=g|1073741824}H[n>>2]=g}g=n+4|0;b=q+4|0;v=v+1|0;if((v|0)!=64){continue}break}g=n+12|0;b=q+772|0;q=r>>>0<60;r=r+4|0;if(q){continue}break}break zb}b=1<>>1|b;q=H[e+120>>2];g=(q+(D<<2)|0)+12|0;b=H[e+128>>2];f=H[e+8>>2];c=H[e+4>>2];k=H[e>>2];m=H[e+104>>2];p=H[e+116>>2];_b:{if(Z&8){$b:{if(b>>>0<4){break $b}if(D){t=N(D,12);o=D<<3;q=0-l|0;M=e+28|0;while(1){w=0;while(1){n=g;g=H[g>>2];if(g){ac:{if(g&2097168){break ac}b=g&495;if(!b){break ac}m=M+(I[b+H[e+108>>2]|0]<<2)|0;r=H[m>>2];b=H[r>>2];c=c-b|0;bc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;i=H[r+4>>2];if(c&32768){break bc}i=H[r+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[r+(b?12:8)>>2];while(1){cc:{if(f){break cc}f=H[e+16>>2];d=f+1|0;r=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(r<<8)+k|0;break cc}if(r>>>0<=143){H[e+16>>2]=d;k=(r<<9)+k|0;f=7;break cc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}i=b?!i:i;break bc}i=H[r+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[r+(d?8:12)>>2];while(1){dc:{if(f){break dc}f=H[e+16>>2];c=f+1|0;r=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(r<<8)+k|0;break dc}if(r>>>0<=143){H[e+16>>2]=c;k=(r<<9)+k|0;f=7;break dc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;i=d?i:!i}if(i){h=n-4|0;d=H[n+4>>2]>>>17&4|(H[h>>2]>>>19&1|(g>>>14&16|(g>>>16&64|g&170)));m=M+(I[d+24384|0]<<2)|0;u=H[m>>2];b=H[u>>2];c=c-b|0;i=I[d+24640|0];ec:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;s=H[u+4>>2];if(c&32768){break ec}r=H[u+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[u+(b?12:8)>>2];while(1){fc:{if(f){break fc}f=H[e+16>>2];d=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(u<<8)+k|0;break fc}if(u>>>0<=143){H[e+16>>2]=d;k=(u<<9)+k|0;f=7;break fc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}s=b?!r:r;break ec}r=H[u+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[u+(d?8:12)>>2];while(1){gc:{if(f){break gc}f=H[e+16>>2];c=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(u<<8)+k|0;break gc}if(u>>>0<=143){H[e+16>>2]=c;k=(u<<9)+k|0;f=7;break gc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;s=d?r:!r}b=s;H[p>>2]=(i|0)==(b|0)?l:q;H[h>>2]=H[h>>2]|32;H[n+4>>2]=H[n+4>>2]|8;g=(b^i)<<19|g|16}g=g|2097152}if(!(!(g&3960)|g&16777344)){i=g>>>3|0;m=M+(I[H[e+108>>2]+(i&495)|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;hc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;s=H[h+4>>2];if(c&32768){break hc}r=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){ic:{if(f){break ic}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(h<<8)+k|0;break ic}if(h>>>0<=143){H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break ic}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}s=b?!r:r;break hc}r=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){jc:{if(f){break jc}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(h<<8)+k|0;break jc}if(h>>>0<=143){H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break jc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;s=d?r:!r}if(s){u=n-4|0;d=H[n+4>>2]>>>20&4|(H[u>>2]>>>22&1|(g>>>15&16|(g>>>19&64|i&170)));m=M+(I[d+24384|0]<<2)|0;s=H[m>>2];b=H[s>>2];c=c-b|0;r=(D<<2)+p|0;i=I[d+24640|0];kc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;A=H[s+4>>2];if(c&32768){break kc}h=H[s+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[s+(b?12:8)>>2];while(1){lc:{if(f){break lc}f=H[e+16>>2];d=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(s<<8)+k|0;break lc}if(s>>>0<=143){H[e+16>>2]=d;k=(s<<9)+k|0;f=7;break lc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}A=b?!h:h;break kc}h=H[s+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[s+(d?8:12)>>2];while(1){mc:{if(f){break mc}f=H[e+16>>2];c=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(s<<8)+k|0;break mc}if(s>>>0<=143){H[e+16>>2]=c;k=(s<<9)+k|0;f=7;break mc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;A=d?h:!h}b=A;H[r>>2]=(i|0)==(b|0)?l:q;H[u>>2]=H[u>>2]|256;H[n+4>>2]=H[n+4>>2]|64;g=(b^i)<<22|g|128}g=g|16777216}if(!(!(g&31680)|g&134218752)){i=g>>>6|0;m=M+(I[H[e+108>>2]+(i&495)|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;nc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;s=H[h+4>>2];if(c&32768){break nc}r=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){oc:{if(f){break oc}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(h<<8)+k|0;break oc}if(h>>>0<=143){H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break oc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}s=b?!r:r;break nc}r=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){pc:{if(f){break pc}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(h<<8)+k|0;break pc}if(h>>>0<=143){H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break pc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;s=d?r:!r}if(s){u=n-4|0;d=H[n+4>>2]>>>23&4|(H[u>>2]>>>25&1|(g>>>18&16|(g>>>22&64|i&170)));m=M+(I[d+24384|0]<<2)|0;s=H[m>>2];b=H[s>>2];c=c-b|0;r=o+p|0;i=I[d+24640|0];qc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;A=H[s+4>>2];if(c&32768){break qc}h=H[s+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[s+(b?12:8)>>2];while(1){rc:{if(f){break rc}f=H[e+16>>2];d=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(s<<8)+k|0;break rc}if(s>>>0<=143){H[e+16>>2]=d;k=(s<<9)+k|0;f=7;break rc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}A=b?!h:h;break qc}h=H[s+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[s+(d?8:12)>>2];while(1){sc:{if(f){break sc}f=H[e+16>>2];c=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(s<<8)+k|0;break sc}if(s>>>0<=143){H[e+16>>2]=c;k=(s<<9)+k|0;f=7;break sc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;A=d?h:!h}b=A;H[r>>2]=(i|0)==(b|0)?l:q;H[u>>2]=H[u>>2]|2048;H[n+4>>2]=H[n+4>>2]|512;g=(b^i)<<25|g|1024}g=g|134217728}if(!(!(g&253440)|g&1073750016)){i=g>>>9|0;m=M+(I[H[e+108>>2]+(i&495)|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;tc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;s=H[h+4>>2];if(c&32768){break tc}r=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){uc:{if(f){break uc}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(h<<8)+k|0;break uc}if(h>>>0<=143){H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break uc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}s=b?!r:r;break tc}r=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){vc:{if(f){break vc}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(h<<8)+k|0;break vc}if(h>>>0<=143){H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break vc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;s=d?r:!r}if(s){u=n-4|0;d=H[n+4>>2]>>>26&4|(H[u>>2]>>>28&1|(g>>>21&16|(g>>>25&64|i&170)));m=M+(I[d+24384|0]<<2)|0;s=H[m>>2];b=H[s>>2];c=c-b|0;r=p+t|0;i=I[d+24640|0];wc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;A=H[s+4>>2];if(c&32768){break wc}h=H[s+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[s+(b?12:8)>>2];while(1){xc:{if(f){break xc}f=H[e+16>>2];d=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(s<<8)+k|0;break xc}if(s>>>0<=143){H[e+16>>2]=d;k=(s<<9)+k|0;f=7;break xc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}A=b?!h:h;break wc}h=H[s+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[s+(d?8:12)>>2];while(1){yc:{if(f){break yc}f=H[e+16>>2];c=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(s<<8)+k|0;break yc}if(s>>>0<=143){H[e+16>>2]=c;k=(s<<9)+k|0;f=7;break yc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;A=d?h:!h}b=A;H[r>>2]=(i|0)==(b|0)?l:q;H[u>>2]=H[u>>2]|16384;H[n+4>>2]=H[n+4>>2]|4096;d=n+(H[e+124>>2]<<2)|0;H[d+4>>2]=H[d+4>>2]|4;H[d+12>>2]=H[d+12>>2]|1;b=b^i;H[d+8>>2]=H[d+8>>2]|b<<18|2;g=b<<28|g|8192}g=g|1073741824}H[n>>2]=g}g=n+4|0;p=p+4|0;w=w+1|0;if((D|0)!=(w|0)){continue}break}g=n+12|0;p=p+t|0;j=j+4|0;b=H[e+128>>2];if(j>>>0<(b&-4)>>>0){continue}break}break $b}g=(b&-4)-1|0;j=(g&-4)+4|0;g=(q+(g<<1&-8)|0)+20|0}H[e+8>>2]=f;H[e+4>>2]=c;H[e>>2]=k;H[e+104>>2]=m;if(!D|b>>>0<=j>>>0){break _b}while(1){c=(b|0)==(j|0);f=0;b=j;if(!c){while(1){hc(e,g,(N(f,D)<<2)+p|0,l,f,H[e+124>>2]+2|0,1);f=f+1|0;b=H[e+128>>2];if(f>>>0>>0){continue}break}}g=g+4|0;p=p+4|0;v=v+1|0;if((D|0)!=(v|0)){continue}break}break _b}zc:{if(b>>>0<4){break zc}if(D){t=N(D,12);o=D<<3;q=0-l|0;M=e+28|0;while(1){w=0;while(1){n=g;g=H[g>>2];if(g){Ac:{if(g&2097168){break Ac}b=g&495;if(!b){break Ac}m=M+(I[b+H[e+108>>2]|0]<<2)|0;r=H[m>>2];b=H[r>>2];c=c-b|0;Bc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;i=H[r+4>>2];if(c&32768){break Bc}i=H[r+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[r+(b?12:8)>>2];while(1){Cc:{if(f){break Cc}f=H[e+16>>2];d=f+1|0;r=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(r<<8)+k|0;break Cc}if(r>>>0<=143){H[e+16>>2]=d;k=(r<<9)+k|0;f=7;break Cc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}i=b?!i:i;break Bc}i=H[r+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[r+(d?8:12)>>2];while(1){Dc:{if(f){break Dc}f=H[e+16>>2];c=f+1|0;r=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(r<<8)+k|0;break Dc}if(r>>>0<=143){H[e+16>>2]=c;k=(r<<9)+k|0;f=7;break Dc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;i=d?i:!i}if(i){h=n-4|0;d=H[n+4>>2]>>>17&4|(H[h>>2]>>>19&1|(g>>>14&16|(g>>>16&64|g&170)));m=M+(I[d+24384|0]<<2)|0;u=H[m>>2];b=H[u>>2];c=c-b|0;i=I[d+24640|0];Ec:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;d=H[u+4>>2];if(c&32768){break Ec}r=H[u+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[u+(b?12:8)>>2];while(1){Fc:{if(f){break Fc}f=H[e+16>>2];d=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(u<<8)+k|0;break Fc}if(u>>>0<=143){H[e+16>>2]=d;k=(u<<9)+k|0;f=7;break Fc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}d=b?!r:r;break Ec}r=H[u+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[u+(d?8:12)>>2];while(1){Gc:{if(f){break Gc}f=H[e+16>>2];c=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(u<<8)+k|0;break Gc}if(u>>>0<=143){H[e+16>>2]=c;k=(u<<9)+k|0;f=7;break Gc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;d=d?r:!r}H[p>>2]=(i|0)==(d|0)?l:q;H[h>>2]=H[h>>2]|32;H[n+4>>2]=H[n+4>>2]|8;b=n+(-2-H[e+124>>2]<<2)|0;H[b+4>>2]=H[b+4>>2]|32768;d=d^i;H[b>>2]=H[b>>2]|d<<31|65536;b=b-4|0;H[b>>2]=H[b>>2]|131072;g=d<<19|g|16}g=g|2097152}if(!(!(g&3960)|g&16777344)){i=g>>>3|0;m=M+(I[H[e+108>>2]+(i&495)|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;Hc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;s=H[h+4>>2];if(c&32768){break Hc}r=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){Ic:{if(f){break Ic}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(h<<8)+k|0;break Ic}if(h>>>0<=143){H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break Ic}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}s=b?!r:r;break Hc}r=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){Jc:{if(f){break Jc}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(h<<8)+k|0;break Jc}if(h>>>0<=143){H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break Jc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;s=d?r:!r}if(s){u=n-4|0;d=H[n+4>>2]>>>20&4|(H[u>>2]>>>22&1|(g>>>15&16|(g>>>19&64|i&170)));m=M+(I[d+24384|0]<<2)|0;s=H[m>>2];b=H[s>>2];c=c-b|0;r=(D<<2)+p|0;i=I[d+24640|0];Kc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;A=H[s+4>>2];if(c&32768){break Kc}h=H[s+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[s+(b?12:8)>>2];while(1){Lc:{if(f){break Lc}f=H[e+16>>2];d=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(s<<8)+k|0;break Lc}if(s>>>0<=143){H[e+16>>2]=d;k=(s<<9)+k|0;f=7;break Lc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}A=b?!h:h;break Kc}h=H[s+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[s+(d?8:12)>>2];while(1){Mc:{if(f){break Mc}f=H[e+16>>2];c=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(s<<8)+k|0;break Mc}if(s>>>0<=143){H[e+16>>2]=c;k=(s<<9)+k|0;f=7;break Mc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;A=d?h:!h}b=A;H[r>>2]=(i|0)==(b|0)?l:q;H[u>>2]=H[u>>2]|256;H[n+4>>2]=H[n+4>>2]|64;g=(b^i)<<22|g|128}g=g|16777216}if(!(!(g&31680)|g&134218752)){i=g>>>6|0;m=M+(I[H[e+108>>2]+(i&495)|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;Nc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;s=H[h+4>>2];if(c&32768){break Nc}r=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){Oc:{if(f){break Oc}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(h<<8)+k|0;break Oc}if(h>>>0<=143){H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break Oc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}s=b?!r:r;break Nc}r=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){Pc:{if(f){break Pc}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(h<<8)+k|0;break Pc}if(h>>>0<=143){H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break Pc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;s=d?r:!r}if(s){u=n-4|0;d=H[n+4>>2]>>>23&4|(H[u>>2]>>>25&1|(g>>>18&16|(g>>>22&64|i&170)));m=M+(I[d+24384|0]<<2)|0;s=H[m>>2];b=H[s>>2];c=c-b|0;r=o+p|0;i=I[d+24640|0];Qc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;A=H[s+4>>2];if(c&32768){break Qc}h=H[s+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[s+(b?12:8)>>2];while(1){Rc:{if(f){break Rc}f=H[e+16>>2];d=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(s<<8)+k|0;break Rc}if(s>>>0<=143){H[e+16>>2]=d;k=(s<<9)+k|0;f=7;break Rc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}A=b?!h:h;break Qc}h=H[s+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[s+(d?8:12)>>2];while(1){Sc:{if(f){break Sc}f=H[e+16>>2];c=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(s<<8)+k|0;break Sc}if(s>>>0<=143){H[e+16>>2]=c;k=(s<<9)+k|0;f=7;break Sc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;A=d?h:!h}b=A;H[r>>2]=(i|0)==(b|0)?l:q;H[u>>2]=H[u>>2]|2048;H[n+4>>2]=H[n+4>>2]|512;g=(b^i)<<25|g|1024}g=g|134217728}if(!(!(g&253440)|g&1073750016)){i=g>>>9|0;m=M+(I[H[e+108>>2]+(i&495)|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;Tc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;s=H[h+4>>2];if(c&32768){break Tc}r=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){Uc:{if(f){break Uc}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(h<<8)+k|0;break Uc}if(h>>>0<=143){H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break Uc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}s=b?!r:r;break Tc}r=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){Vc:{if(f){break Vc}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(h<<8)+k|0;break Vc}if(h>>>0<=143){H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break Vc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;s=d?r:!r}if(s){u=n-4|0;d=H[n+4>>2]>>>26&4|(H[u>>2]>>>28&1|(g>>>21&16|(g>>>25&64|i&170)));m=M+(I[d+24384|0]<<2)|0;s=H[m>>2];b=H[s>>2];c=c-b|0;r=p+t|0;i=I[d+24640|0];Wc:{if(k>>>16>>>0>=b>>>0){k=k-(b<<16)|0;A=H[s+4>>2];if(c&32768){break Wc}h=H[s+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[s+(b?12:8)>>2];while(1){Xc:{if(f){break Xc}f=H[e+16>>2];d=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=d;f=8;k=(s<<8)+k|0;break Xc}if(s>>>0<=143){H[e+16>>2]=d;k=(s<<9)+k|0;f=7;break Xc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}A=b?!h:h;break Wc}h=H[s+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[s+(d?8:12)>>2];while(1){Yc:{if(f){break Yc}f=H[e+16>>2];c=f+1|0;s=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=c;f=8;k=(s<<8)+k|0;break Yc}if(s>>>0<=143){H[e+16>>2]=c;k=(s<<9)+k|0;f=7;break Yc}H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;A=d?h:!h}b=A;H[r>>2]=(i|0)==(b|0)?l:q;H[u>>2]=H[u>>2]|16384;H[n+4>>2]=H[n+4>>2]|4096;d=n+(H[e+124>>2]<<2)|0;H[d+4>>2]=H[d+4>>2]|4;H[d+12>>2]=H[d+12>>2]|1;b=b^i;H[d+8>>2]=H[d+8>>2]|b<<18|2;g=b<<28|g|8192}g=g|1073741824}H[n>>2]=g}g=n+4|0;p=p+4|0;w=w+1|0;if((D|0)!=(w|0)){continue}break}g=n+12|0;p=p+t|0;j=j+4|0;b=H[e+128>>2];if(j>>>0<(b&-4)>>>0){continue}break}break zc}g=(b&-4)-1|0;j=(g&-4)+4|0;g=(q+(g<<1&-8)|0)+20|0}H[e+8>>2]=f;H[e+4>>2]=c;H[e>>2]=k;H[e+104>>2]=m;if(!D|b>>>0<=j>>>0){break _b}while(1){c=(b|0)==(j|0);f=0;b=j;if(!c){while(1){hc(e,g,(N(f,D)<<2)+p|0,l,f,H[e+124>>2]+2|0,0);f=f+1|0;b=H[e+128>>2];if(f>>>0>>0){continue}break}}g=g+4|0;p=p+4|0;v=v+1|0;if((D|0)!=(v|0)){continue}break}}break yb}while(1){v=0;while(1){q=b;n=g;g=H[g>>2];if(g){Zc:{if(g&2097168){break Zc}b=g&495;if(!b){break Zc}m=u+(I[b+H[e+108>>2]|0]<<2)|0;i=H[m>>2];b=H[i>>2];c=c-b|0;_c:{if(k>>>16>>>0>>0){p=H[i+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[i+(d?8:12)>>2];while(1){$c:{if(f){break $c}f=H[e+16>>2];c=f+1|0;i=I[f+1|0];if(I[f|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break $c}H[e+16>>2]=c;k=(i<<9)+k|0;f=7;break $c}H[e+16>>2]=c;f=8;k=(i<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?p:!p;break _c}k=k-(b<<16)|0;if(!(c&32768)){p=H[i+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[i+(b?12:8)>>2];while(1){ad:{if(f){break ad}f=H[e+16>>2];d=f+1|0;i=I[f+1|0];if(I[f|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break ad}H[e+16>>2]=d;k=(i<<9)+k|0;f=7;break ad}H[e+16>>2]=d;f=8;k=(i<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!p:p;break _c}b=H[i+4>>2]}if(b){o=n-4|0;d=H[n+4>>2]>>>17&4|(H[o>>2]>>>19&1|(g>>>14&16|(g>>>16&64|g&170)));m=u+(I[d+24384|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;p=I[d+24640|0];bd:{if(k>>>16>>>0>>0){i=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){cd:{if(f){break cd}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break cd}H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break cd}H[e+16>>2]=c;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break bd}k=k-(b<<16)|0;if(!(c&32768)){i=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){dd:{if(f){break dd}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break dd}H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break dd}H[e+16>>2]=d;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break bd}b=H[h+4>>2]}H[q>>2]=(p|0)==(b|0)?j:l;H[o>>2]=H[o>>2]|32;H[n+4>>2]=H[n+4>>2]|8;g=(b^p)<<19|g|16}g=g|2097152}if(!(!(g&3960)|g&16777344)){p=g>>>3|0;m=u+(I[H[e+108>>2]+(p&495)|0]<<2)|0;o=H[m>>2];b=H[o>>2];c=c-b|0;ed:{if(k>>>16>>>0>>0){i=H[o+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[o+(d?8:12)>>2];while(1){fd:{if(f){break fd}f=H[e+16>>2];c=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break fd}H[e+16>>2]=c;k=(o<<9)+k|0;f=7;break fd}H[e+16>>2]=c;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break ed}k=k-(b<<16)|0;if(!(c&32768)){i=H[o+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[o+(b?12:8)>>2];while(1){gd:{if(f){break gd}f=H[e+16>>2];d=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break gd}H[e+16>>2]=d;k=(o<<9)+k|0;f=7;break gd}H[e+16>>2]=d;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break ed}b=H[o+4>>2]}if(b){o=n-4|0;d=H[n+4>>2]>>>20&4|(H[o>>2]>>>22&1|(g>>>15&16|(g>>>19&64|p&170)));m=u+(I[d+24384|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;p=I[d+24640|0];hd:{if(k>>>16>>>0>>0){i=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){id:{if(f){break id}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break id}H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break id}H[e+16>>2]=c;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break hd}k=k-(b<<16)|0;if(!(c&32768)){i=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){jd:{if(f){break jd}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break jd}H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break jd}H[e+16>>2]=d;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break hd}b=H[h+4>>2]}H[q+256>>2]=(p|0)==(b|0)?j:l;H[o>>2]=H[o>>2]|256;H[n+4>>2]=H[n+4>>2]|64;g=(b^p)<<22|g|128}g=g|16777216}if(!(!(g&31680)|g&134218752)){p=g>>>6|0;m=u+(I[H[e+108>>2]+(p&495)|0]<<2)|0;o=H[m>>2];b=H[o>>2];c=c-b|0;kd:{if(k>>>16>>>0>>0){i=H[o+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[o+(d?8:12)>>2];while(1){ld:{if(f){break ld}f=H[e+16>>2];c=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break ld}H[e+16>>2]=c;k=(o<<9)+k|0;f=7;break ld}H[e+16>>2]=c;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break kd}k=k-(b<<16)|0;if(!(c&32768)){i=H[o+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[o+(b?12:8)>>2];while(1){md:{if(f){break md}f=H[e+16>>2];d=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break md}H[e+16>>2]=d;k=(o<<9)+k|0;f=7;break md}H[e+16>>2]=d;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break kd}b=H[o+4>>2]}if(b){o=n-4|0;d=H[n+4>>2]>>>23&4|(H[o>>2]>>>25&1|(g>>>18&16|(g>>>22&64|p&170)));m=u+(I[d+24384|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;p=I[d+24640|0];nd:{if(k>>>16>>>0>>0){i=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){od:{if(f){break od}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break od}H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break od}H[e+16>>2]=c;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break nd}k=k-(b<<16)|0;if(!(c&32768)){i=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){pd:{if(f){break pd}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break pd}H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break pd}H[e+16>>2]=d;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break nd}b=H[h+4>>2]}H[q+512>>2]=(p|0)==(b|0)?j:l;H[o>>2]=H[o>>2]|2048;H[n+4>>2]=H[n+4>>2]|512;g=(b^p)<<25|g|1024}g=g|134217728}if(!(!(g&253440)|g&1073750016)){p=g>>>9|0;m=u+(I[H[e+108>>2]+(p&495)|0]<<2)|0;o=H[m>>2];b=H[o>>2];c=c-b|0;qd:{if(k>>>16>>>0>>0){i=H[o+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[o+(d?8:12)>>2];while(1){rd:{if(f){break rd}f=H[e+16>>2];c=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break rd}H[e+16>>2]=c;k=(o<<9)+k|0;f=7;break rd}H[e+16>>2]=c;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break qd}k=k-(b<<16)|0;if(!(c&32768)){i=H[o+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[o+(b?12:8)>>2];while(1){sd:{if(f){break sd}f=H[e+16>>2];d=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break sd}H[e+16>>2]=d;k=(o<<9)+k|0;f=7;break sd}H[e+16>>2]=d;f=8;k=(o<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break qd}b=H[o+4>>2]}if(b){o=n-4|0;d=H[n+4>>2]>>>26&4|(H[o>>2]>>>28&1|(g>>>21&16|(g>>>25&64|p&170)));m=u+(I[d+24384|0]<<2)|0;h=H[m>>2];b=H[h>>2];c=c-b|0;p=I[d+24640|0];td:{if(k>>>16>>>0>>0){i=H[h+4>>2];d=b>>>0>c>>>0;H[m>>2]=H[h+(d?8:12)>>2];while(1){ud:{if(f){break ud}f=H[e+16>>2];c=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break ud}H[e+16>>2]=c;k=(h<<9)+k|0;f=7;break ud}H[e+16>>2]=c;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;b=b<<1;if(b>>>0<32768){continue}break}c=b;b=d?i:!i;break td}k=k-(b<<16)|0;if(!(c&32768)){i=H[h+4>>2];b=b>>>0>c>>>0;H[m>>2]=H[h+(b?12:8)>>2];while(1){vd:{if(f){break vd}f=H[e+16>>2];d=f+1|0;h=I[f+1|0];if(I[f|0]==255){if(h>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;k=k+65280|0;f=8;break vd}H[e+16>>2]=d;k=(h<<9)+k|0;f=7;break vd}H[e+16>>2]=d;f=8;k=(h<<8)+k|0}f=f-1|0;k=k<<1;c=c<<1;if(c>>>0<32768){continue}break}b=b?!i:i;break td}b=H[h+4>>2]}H[q+768>>2]=(p|0)==(b|0)?j:l;H[o>>2]=H[o>>2]|16384;H[n+4>>2]=H[n+4>>2]|4096;H[n+260>>2]=H[n+260>>2]|4;H[n+268>>2]=H[n+268>>2]|1;b=b^p;H[n+264>>2]=H[n+264>>2]|b<<18|2;g=b<<28|g|8192}g=g|1073741824}H[n>>2]=g}g=n+4|0;b=q+4|0;v=v+1|0;if((v|0)!=64){continue}break}g=n+12|0;b=q+772|0;q=r>>>0<60;r=r+4|0;if(q){continue}break}}H[e+8>>2]=f;H[e+4>>2]=c;H[e>>2]=k;H[e+104>>2]=m}break _a;case 0:if(!na){o=1<>>1|0;r=H[e+124>>2];d=r<<2;b=(d+H[e+120>>2]|0)+12|0;g=H[e+116>>2];k=0;c=H[e+128>>2];if(c>>>0>=4){if(!r){break Za}p=N(r,12);n=r<<3;i=0-o|0;while(1){c=0;while(1){l=b;b=H[b>>2];wd:{if(!b){break wd}if((b&2097168)==16){b=H[e>>2];h=H[e+8>>2];xd:{if(h){break xd}j=(b|0)==255;q=H[e+16>>2];b=I[q|0];yd:{if(!j){H[e>>2]=b;H[e+16>>2]=q+1;break yd}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=q+1;h=7;break xd}b=255;H[e>>2]=255}h=8}j=h-1|0;H[e+8>>2]=j;j=b>>>j&1;b=H[g>>2];H[g>>2]=((j|0)==(b>>>31|0)?i:o)+b;b=H[l>>2]|1048576;H[l>>2]=b}if((b&16777344)==128){b=H[e>>2];h=H[e+8>>2];zd:{if(h){break zd}j=(b|0)==255;q=H[e+16>>2];b=I[q|0];Ad:{if(!j){H[e>>2]=b;H[e+16>>2]=q+1;break Ad}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=q+1;h=7;break zd}b=255;H[e>>2]=255}h=8}q=h-1|0;H[e+8>>2]=q;j=d+g|0;f=H[j>>2];H[j>>2]=f+((b>>>q&1)==(f>>>31|0)?i:o);b=H[l>>2]|8388608;H[l>>2]=b}if((b&134218752)==1024){b=H[e>>2];h=H[e+8>>2];Bd:{if(h){break Bd}j=(b|0)==255;q=H[e+16>>2];b=I[q|0];Cd:{if(!j){H[e>>2]=b;H[e+16>>2]=q+1;break Cd}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=q+1;h=7;break Bd}b=255;H[e>>2]=255}h=8}q=h-1|0;H[e+8>>2]=q;j=g+n|0;f=H[j>>2];H[j>>2]=f+((b>>>q&1)==(f>>>31|0)?i:o);b=H[l>>2]|67108864;H[l>>2]=b}if((b&1073750016)!=8192){break wd}b=H[e>>2];h=H[e+8>>2];Dd:{if(h){break Dd}j=(b|0)==255;q=H[e+16>>2];b=I[q|0];Ed:{if(!j){H[e>>2]=b;H[e+16>>2]=q+1;break Ed}if(b>>>0<=143){H[e>>2]=b;H[e+16>>2]=q+1;h=7;break Dd}b=255;H[e>>2]=255}h=8}q=h-1|0;H[e+8>>2]=q;j=g+p|0;f=H[j>>2];H[j>>2]=f+((b>>>q&1)==(f>>>31|0)?i:o);H[l>>2]=H[l>>2]|536870912}g=g+4|0;b=l+4|0;c=c+1|0;if((r|0)!=(c|0)){continue}break}g=g+p|0;b=l+12|0;k=k+4|0;c=H[e+128>>2];if(k>>>0<(c&-4)>>>0){continue}break}}if(!r|c>>>0<=k>>>0){break _a}v=0;j=0-o|0;d=c;while(1){Fd:{if((d|0)==(k|0)){d=k;break Fd}h=H[b>>2];i=0;while(1){d=N(i,3);if((2097168<>2];m=H[e+8>>2];Gd:{if(m){break Gd}l=(c|0)!=255;q=H[e+16>>2];c=I[q|0];Hd:{if(!l){if(c>>>0>=144){c=255;H[e>>2]=255;break Hd}H[e>>2]=c;H[e+16>>2]=q+1;m=7;break Gd}H[e>>2]=c;H[e+16>>2]=q+1}m=8}l=m-1|0;H[e+8>>2]=l;l=c>>>l&1;c=H[n>>2];H[n>>2]=((l|0)==(c>>>31|0)?j:o)+c;h=H[b>>2]|1048576<>2]=h;c=H[e+128>>2]}i=i+1|0;d=c;if(i>>>0>>0){continue}break}}g=g+4|0;b=b+4|0;v=v+1|0;if((r|0)!=(v|0)){continue}break}break _a}j=H[e+120>>2];d=H[e+116>>2];s=H[e+124>>2];c=H[e+128>>2];if(!((s|0)!=64|(c|0)!=64)){c=j+268|0;r=0;u=1<>>1|0;h=0-u|0;i=H[e+8>>2];g=H[e+4>>2];b=H[e>>2];k=H[e+104>>2];while(1){m=0;while(1){q=d;j=c;d=H[c>>2];if(d){l=c;if((d&2097168)==16){k=da+((d&1048576?16:d&495?15:14)<<2)|0;f=H[k>>2];c=H[f>>2];g=g-c|0;Id:{if(b>>>16>>>0>>0){p=H[f+4>>2];n=c>>>0>g>>>0;H[k>>2]=H[f+(n?8:12)>>2];while(1){Jd:{if(i){break Jd}f=H[e+16>>2];g=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8;break Jd}H[e+16>>2]=g;b=(o<<9)+b|0;i=7;break Jd}H[e+16>>2]=g;i=8;b=(o<<8)+b|0}i=i-1|0;b=b<<1;c=c<<1;if(c>>>0<32768){continue}break}g=c;n=n?p:!p;break Id}b=b-(c<<16)|0;if(!(g&32768)){p=H[f+4>>2];c=c>>>0>g>>>0;H[k>>2]=H[f+(c?12:8)>>2];while(1){Kd:{if(i){break Kd}f=H[e+16>>2];n=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8;break Kd}H[e+16>>2]=n;b=(o<<9)+b|0;i=7;break Kd}H[e+16>>2]=n;i=8;b=(o<<8)+b|0}i=i-1|0;b=b<<1;g=g<<1;if(g>>>0<32768){continue}break}n=c?!p:p;break Id}n=H[f+4>>2]}c=H[q>>2];H[q>>2]=((n|0)==(c>>>31|0)?h:u)+c;d=d|1048576}if((d&16777344)==128){k=da+((d&8388608?16:d&3960?15:14)<<2)|0;f=H[k>>2];c=H[f>>2];g=g-c|0;Ld:{if(b>>>16>>>0>>0){p=H[f+4>>2];n=c>>>0>g>>>0;H[k>>2]=H[f+(n?8:12)>>2];while(1){Md:{if(i){break Md}f=H[e+16>>2];g=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8;break Md}H[e+16>>2]=g;b=(o<<9)+b|0;i=7;break Md}H[e+16>>2]=g;i=8;b=(o<<8)+b|0}i=i-1|0;b=b<<1;c=c<<1;if(c>>>0<32768){continue}break}g=c;n=n?p:!p;break Ld}b=b-(c<<16)|0;if(!(g&32768)){p=H[f+4>>2];c=c>>>0>g>>>0;H[k>>2]=H[f+(c?12:8)>>2];while(1){Nd:{if(i){break Nd}f=H[e+16>>2];n=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8;break Nd}H[e+16>>2]=n;b=(o<<9)+b|0;i=7;break Nd}H[e+16>>2]=n;i=8;b=(o<<8)+b|0}i=i-1|0;b=b<<1;g=g<<1;if(g>>>0<32768){continue}break}n=c?!p:p;break Ld}n=H[f+4>>2]}c=H[q+256>>2];H[q+256>>2]=((n|0)==(c>>>31|0)?h:u)+c;d=d|8388608}if((d&134218752)==1024){k=da+((d&67108864?16:d&31680?15:14)<<2)|0;f=H[k>>2];c=H[f>>2];g=g-c|0;Od:{if(b>>>16>>>0>>0){p=H[f+4>>2];n=c>>>0>g>>>0;H[k>>2]=H[f+(n?8:12)>>2];while(1){Pd:{if(i){break Pd}f=H[e+16>>2];g=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8;break Pd}H[e+16>>2]=g;b=(o<<9)+b|0;i=7;break Pd}H[e+16>>2]=g;i=8;b=(o<<8)+b|0}i=i-1|0;b=b<<1;c=c<<1;if(c>>>0<32768){continue}break}g=c;n=n?p:!p;break Od}b=b-(c<<16)|0;if(!(g&32768)){p=H[f+4>>2];c=c>>>0>g>>>0;H[k>>2]=H[f+(c?12:8)>>2];while(1){Qd:{if(i){break Qd}f=H[e+16>>2];n=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8;break Qd}H[e+16>>2]=n;b=(o<<9)+b|0;i=7;break Qd}H[e+16>>2]=n;i=8;b=(o<<8)+b|0}i=i-1|0;b=b<<1;g=g<<1;if(g>>>0<32768){continue}break}n=c?!p:p;break Od}n=H[f+4>>2]}c=H[q+512>>2];H[q+512>>2]=((n|0)==(c>>>31|0)?h:u)+c;d=d|67108864}if((d&1073750016)==8192){k=da+((d&536870912?16:d&253440?15:14)<<2)|0;f=H[k>>2];c=H[f>>2];g=g-c|0;Rd:{if(b>>>16>>>0>>0){p=H[f+4>>2];n=c>>>0>g>>>0;H[k>>2]=H[f+(n?8:12)>>2];while(1){Sd:{if(i){break Sd}f=H[e+16>>2];g=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8;break Sd}H[e+16>>2]=g;b=(o<<9)+b|0;i=7;break Sd}H[e+16>>2]=g;i=8;b=(o<<8)+b|0}i=i-1|0;b=b<<1;c=c<<1;if(c>>>0<32768){continue}break}g=c;n=n?p:!p;break Rd}b=b-(c<<16)|0;if(!(g&32768)){p=H[f+4>>2];c=c>>>0>g>>>0;H[k>>2]=H[f+(c?12:8)>>2];while(1){Td:{if(i){break Td}f=H[e+16>>2];n=f+1|0;o=I[f+1|0];if(I[f|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8;break Td}H[e+16>>2]=n;b=(o<<9)+b|0;i=7;break Td}H[e+16>>2]=n;i=8;b=(o<<8)+b|0}i=i-1|0;b=b<<1;g=g<<1;if(g>>>0<32768){continue}break}n=c?!p:p;break Rd}n=H[f+4>>2]}c=H[q+768>>2];H[q+768>>2]=((n|0)==(c>>>31|0)?h:u)+c;d=d|536870912}H[l>>2]=d}c=j+4|0;d=q+4|0;m=m+1|0;if((m|0)!=64){continue}break}c=j+12|0;d=q+772|0;l=r>>>0<60;r=r+4|0;if(l){continue}break}H[e+8>>2]=i;H[e+4>>2]=g;H[e>>2]=b;H[e+104>>2]=k;break _a}v=1<>>1|0;r=s<<2;f=(r+j|0)+12|0;i=H[e+8>>2];g=H[e+4>>2];b=H[e>>2];k=H[e+104>>2];p=0;Ud:{if(c>>>0<4){break Ud}if(s){h=N(s,12);n=s<<3;t=0-v|0;while(1){m=0;while(1){l=f;j=H[f>>2];if(j){if((j&2097168)==16){k=da+((j&1048576?16:j&495?15:14)<<2)|0;f=H[k>>2];c=H[f>>2];g=g-c|0;Vd:{if(b>>>16>>>0>=c>>>0){b=b-(c<<16)|0;q=H[f+4>>2];if(g&32768){break Vd}o=H[f+4>>2];c=c>>>0>g>>>0;H[k>>2]=H[f+(c?12:8)>>2];while(1){Wd:{if(i){break Wd}f=H[e+16>>2];q=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=q;i=8;b=(u<<8)+b|0;break Wd}if(u>>>0<=143){H[e+16>>2]=q;b=(u<<9)+b|0;i=7;break Wd}H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8}i=i-1|0;b=b<<1;g=g<<1;if(g>>>0<32768){continue}break}q=c?!o:o;break Vd}o=H[f+4>>2];q=c>>>0>g>>>0;H[k>>2]=H[f+(q?8:12)>>2];while(1){Xd:{if(i){break Xd}f=H[e+16>>2];g=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=g;i=8;b=(u<<8)+b|0;break Xd}if(u>>>0<=143){H[e+16>>2]=g;b=(u<<9)+b|0;i=7;break Xd}H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8}i=i-1|0;b=b<<1;c=c<<1;if(c>>>0<32768){continue}break}g=c;q=q?o:!o}c=H[d>>2];H[d>>2]=((q|0)==(c>>>31|0)?t:v)+c;j=j|1048576}if((j&16777344)==128){k=da+((j&8388608?16:j&3960?15:14)<<2)|0;f=H[k>>2];c=H[f>>2];g=g-c|0;Yd:{if(b>>>16>>>0>=c>>>0){b=b-(c<<16)|0;q=H[f+4>>2];if(g&32768){break Yd}o=H[f+4>>2];c=c>>>0>g>>>0;H[k>>2]=H[f+(c?12:8)>>2];while(1){Zd:{if(i){break Zd}f=H[e+16>>2];q=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=q;i=8;b=(u<<8)+b|0;break Zd}if(u>>>0<=143){H[e+16>>2]=q;b=(u<<9)+b|0;i=7;break Zd}H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8}i=i-1|0;b=b<<1;g=g<<1;if(g>>>0<32768){continue}break}q=c?!o:o;break Yd}o=H[f+4>>2];q=c>>>0>g>>>0;H[k>>2]=H[f+(q?8:12)>>2];while(1){_d:{if(i){break _d}f=H[e+16>>2];g=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=g;i=8;b=(u<<8)+b|0;break _d}if(u>>>0<=143){H[e+16>>2]=g;b=(u<<9)+b|0;i=7;break _d}H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8}i=i-1|0;b=b<<1;c=c<<1;if(c>>>0<32768){continue}break}g=c;q=q?o:!o}f=q;c=d+r|0;q=H[c>>2];H[c>>2]=q+((f|0)==(q>>>31|0)?t:v);j=j|8388608}if((j&134218752)==1024){k=da+((j&67108864?16:j&31680?15:14)<<2)|0;f=H[k>>2];c=H[f>>2];g=g-c|0;$d:{if(b>>>16>>>0>=c>>>0){b=b-(c<<16)|0;q=H[f+4>>2];if(g&32768){break $d}o=H[f+4>>2];c=c>>>0>g>>>0;H[k>>2]=H[f+(c?12:8)>>2];while(1){ae:{if(i){break ae}f=H[e+16>>2];q=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=q;i=8;b=(u<<8)+b|0;break ae}if(u>>>0<=143){H[e+16>>2]=q;b=(u<<9)+b|0;i=7;break ae}H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8}i=i-1|0;b=b<<1;g=g<<1;if(g>>>0<32768){continue}break}q=c?!o:o;break $d}o=H[f+4>>2];q=c>>>0>g>>>0;H[k>>2]=H[f+(q?8:12)>>2];while(1){be:{if(i){break be}f=H[e+16>>2];g=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=g;i=8;b=(u<<8)+b|0;break be}if(u>>>0<=143){H[e+16>>2]=g;b=(u<<9)+b|0;i=7;break be}H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8}i=i-1|0;b=b<<1;c=c<<1;if(c>>>0<32768){continue}break}g=c;q=q?o:!o}f=q;c=d+n|0;q=H[c>>2];H[c>>2]=q+((f|0)==(q>>>31|0)?t:v);j=j|67108864}if((j&1073750016)==8192){k=da+((j&536870912?16:j&253440?15:14)<<2)|0;f=H[k>>2];c=H[f>>2];g=g-c|0;ce:{if(b>>>16>>>0>=c>>>0){b=b-(c<<16)|0;q=H[f+4>>2];if(g&32768){break ce}o=H[f+4>>2];c=c>>>0>g>>>0;H[k>>2]=H[f+(c?12:8)>>2];while(1){de:{if(i){break de}f=H[e+16>>2];q=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=q;i=8;b=(u<<8)+b|0;break de}if(u>>>0<=143){H[e+16>>2]=q;b=(u<<9)+b|0;i=7;break de}H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8}i=i-1|0;b=b<<1;g=g<<1;if(g>>>0<32768){continue}break}q=c?!o:o;break ce}o=H[f+4>>2];q=c>>>0>g>>>0;H[k>>2]=H[f+(q?8:12)>>2];while(1){ee:{if(i){break ee}f=H[e+16>>2];g=f+1|0;u=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=g;i=8;b=(u<<8)+b|0;break ee}if(u>>>0<=143){H[e+16>>2]=g;b=(u<<9)+b|0;i=7;break ee}H[e+12>>2]=H[e+12>>2]+1;b=b+65280|0;i=8}i=i-1|0;b=b<<1;c=c<<1;if(c>>>0<32768){continue}break}g=c;q=q?o:!o}f=q;c=d+h|0;q=H[c>>2];H[c>>2]=q+((f|0)==(q>>>31|0)?t:v);j=j|536870912}H[l>>2]=j}f=l+4|0;d=d+4|0;m=m+1|0;if((s|0)!=(m|0)){continue}break}f=l+12|0;d=d+h|0;p=p+4|0;c=H[e+128>>2];if(p>>>0<(c&-4)>>>0){continue}break}break Ud}l=(c&-4)-1|0;p=(l&-4)+4|0;f=(j+(l<<1&-8)|0)+20|0}H[e+8>>2]=i;H[e+4>>2]=g;H[e>>2]=b;H[e+104>>2]=k;if(!s|c>>>0<=p>>>0){break _a}w=0;l=0-v|0;b=c;while(1){fe:{if((b|0)==(p|0)){b=p;break fe}i=H[f>>2];h=0;while(1){m=N(h,3);if((2097168<>>m|0;j=da+((b&1048576?16:b&495?15:14)<<2)|0;H[e+104>>2]=j;q=H[j>>2];b=H[q>>2];c=H[e+4>>2]-b|0;H[e+4>>2]=c;g=H[e>>2];ge:{if(g>>>16>>>0>>0){n=H[q+4>>2];H[e+4>>2]=b;c=b>>>0>c>>>0;H[j>>2]=H[q+(c?8:12)>>2];i=H[e+8>>2];while(1){he:{if(i){break he}q=H[e+16>>2];j=q+1|0;r=I[q+1|0];if(I[q|0]==255){if(r>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;g=g+65280|0;i=8;break he}H[e+16>>2]=j;g=(r<<9)+g|0;i=7;break he}H[e+16>>2]=j;i=8;g=(r<<8)+g|0}i=i-1|0;H[e+8>>2]=i;g=g<<1;H[e>>2]=g;b=b<<1;H[e+4>>2]=b;if(b>>>0<32768){continue}break}c=c?n:!n;break ge}g=g-(b<<16)|0;H[e>>2]=g;if(!(c&32768)){n=H[q+4>>2];b=b>>>0>c>>>0;H[j>>2]=H[q+(b?12:8)>>2];i=H[e+8>>2];while(1){ie:{if(i){break ie}q=H[e+16>>2];j=q+1|0;r=I[q+1|0];if(I[q|0]==255){if(r>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;g=g+65280|0;i=8;break ie}H[e+16>>2]=j;g=(r<<9)+g|0;i=7;break ie}H[e+16>>2]=j;i=8;g=(r<<8)+g|0}i=i-1|0;H[e+8>>2]=i;g=g<<1;H[e>>2]=g;c=c<<1;H[e+4>>2]=c;if(c>>>0<32768){continue}break}c=b?!n:n;break ge}c=H[q+4>>2]}b=H[k>>2];H[k>>2]=((c|0)==(b>>>31|0)?l:v)+b;i=H[f>>2]|1048576<>2]=i;c=H[e+128>>2]}h=h+1|0;b=c;if(h>>>0>>0){continue}break}}f=f+4|0;d=d+4|0;w=w+1|0;if((s|0)!=(w|0)){continue}break};break _a;case 1:break $a}}M=0;r=0;je:{ke:{le:{X=H[e+124>>2];if(!((X|0)!=64|H[e+128>>2]!=64)){b=1<>>1|b;w=0-v|0;q=e+100|0;l=e+96|0;s=e+28|0;g=H[e+120>>2]+268|0;h=H[e+8>>2];b=H[e+4>>2];d=H[e>>2];j=H[e+104>>2];c=H[e+116>>2];if(Z&8){break le}while(1){u=0;while(1){k=c;f=g;g=H[g>>2];me:{ne:{oe:{if(!g){j=H[l>>2];g=H[j>>2];b=b-g|0;pe:{if(d>>>16>>>0>>0){n=H[j+4>>2];c=b>>>0>>0;H[l>>2]=H[j+(c?8:12)>>2];while(1){qe:{if(h){break qe}j=H[e+16>>2];b=j+1|0;p=I[j+1|0];if(I[j|0]==255){if(p>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break qe}H[e+16>>2]=b;d=(p<<9)+d|0;h=7;break qe}H[e+16>>2]=b;h=8;d=(p<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;c=c?n:!n;break pe}d=d-(g<<16)|0;if(!(b&32768)){n=H[j+4>>2];c=b>>>0>>0;H[l>>2]=H[j+(c?12:8)>>2];while(1){re:{if(h){break re}j=H[e+16>>2];g=j+1|0;p=I[j+1|0];if(I[j|0]==255){if(p>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break re}H[e+16>>2]=g;d=(p<<9)+d|0;h=7;break re}H[e+16>>2]=g;h=8;d=(p<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!n:n;break pe}c=H[j+4>>2]}if(!c){j=l;break me}c=H[q>>2];g=H[c>>2];b=b-g|0;se:{if(d>>>16>>>0>>0){p=H[c+4>>2];j=b>>>0>>0;c=H[(j?8:12)+c>>2];H[q>>2]=c;while(1){te:{if(h){break te}n=H[e+16>>2];b=n+1|0;i=I[n+1|0];if(I[n|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break te}H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break te}H[e+16>>2]=b;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;n=j?p:!p;break se}d=d-(g<<16)|0;if(!(b&32768)){p=H[c+4>>2];g=b>>>0>>0;c=H[(g?12:8)+c>>2];H[q>>2]=c;while(1){ue:{if(h){break ue}n=H[e+16>>2];j=n+1|0;i=I[n+1|0];if(I[n|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break ue}H[e+16>>2]=j;d=(i<<9)+d|0;h=7;break ue}H[e+16>>2]=j;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=g?!p:p;break se}n=H[c+4>>2]}g=H[c>>2];b=b-g|0;ve:{if(d>>>16>>>0>>0){p=H[c+4>>2];j=c;c=b>>>0>>0;H[q>>2]=H[j+(c?8:12)>>2];while(1){we:{if(h){break we}j=H[e+16>>2];b=j+1|0;i=I[j+1|0];if(I[j|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break we}H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break we}H[e+16>>2]=b;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;c=c?p:!p;break ve}d=d-(g<<16)|0;if(!(b&32768)){p=H[c+4>>2];j=c;c=b>>>0>>0;H[q>>2]=H[j+(c?12:8)>>2];while(1){xe:{if(h){break xe}j=H[e+16>>2];g=j+1|0;i=I[j+1|0];if(I[j|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break xe}H[e+16>>2]=g;d=(i<<9)+d|0;h=7;break xe}H[e+16>>2]=g;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!p:p;break ve}c=H[c+4>>2]}g=0;j=q;ye:{ze:{Ae:{Be:{Ce:{switch(c|n<<1){case 0:i=f-4|0;j=H[f+4>>2]>>>17&4|H[i>>2]>>>19&1;c=s+(I[j+24384|0]<<2)|0;n=H[c>>2];g=H[n>>2];b=b-g|0;De:{if(d>>>16>>>0>>0){p=H[n+4>>2];A=c;c=b>>>0>>0;H[A>>2]=H[n+(c?8:12)>>2];while(1){Ee:{if(h){break Ee}n=H[e+16>>2];b=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ee}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Ee}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;n=c?p:!p;break De}d=d-(g<<16)|0;if(!(b&32768)){p=H[n+4>>2];A=c;c=b>>>0>>0;H[A>>2]=H[n+(c?12:8)>>2];while(1){Fe:{if(h){break Fe}n=H[e+16>>2];g=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Fe}H[e+16>>2]=g;d=(m<<9)+d|0;h=7;break Fe}H[e+16>>2]=g;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=c?!p:p;break De}n=H[n+4>>2]}g=I[j+24640|0];H[k>>2]=(n|0)==(g|0)?v:w;H[i>>2]=H[i>>2]|32;H[f+4>>2]=H[f+4>>2]|8;c=f-268|0;H[c>>2]=H[c>>2]|131072;c=f-260|0;H[c>>2]=H[c>>2]|32768;c=f-264|0;j=c;i=H[c>>2];c=g^n;H[j>>2]=i|c<<31|65536;j=c<<19;i=H[e+108>>2];c=s+(I[i+2|0]<<2)|0;n=H[c>>2];g=H[n>>2];b=b-g|0;Ge:{if(d>>>16>>>0>>0){p=H[n+4>>2];A=c;c=b>>>0>>0;H[A>>2]=H[n+(c?8:12)>>2];while(1){He:{if(h){break He}n=H[e+16>>2];b=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break He}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break He}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;c=c?p:!p;break Ge}d=d-(g<<16)|0;if(!(b&32768)){p=H[n+4>>2];A=c;c=b>>>0>>0;H[A>>2]=H[n+(c?12:8)>>2];while(1){Ie:{if(h){break Ie}n=H[e+16>>2];g=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ie}H[e+16>>2]=g;d=(m<<9)+d|0;h=7;break Ie}H[e+16>>2]=g;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!p:p;break Ge}c=H[n+4>>2]}g=j|16;if(!c){break Be}break;case 1:break Ce;case 2:break Ae;case 3:break ye;default:break ne}}m=f-4|0;n=H[f+4>>2]>>>20&4|(H[m>>2]>>>22&1|(g>>>15&16|(g>>>19&64|g>>>3&170)));j=s+(I[n+24384|0]<<2)|0;p=H[j>>2];c=H[p>>2];b=b-c|0;Je:{if(d>>>16>>>0>>0){i=H[p+4>>2];A=j;j=b>>>0>>0;H[A>>2]=H[p+(j?8:12)>>2];while(1){Ke:{if(h){break Ke}p=H[e+16>>2];b=p+1|0;o=I[p+1|0];if(I[p|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ke}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Ke}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;j=j?i:!i;break Je}d=d-(c<<16)|0;if(!(b&32768)){i=H[p+4>>2];c=b>>>0>>0;H[j>>2]=H[p+(c?12:8)>>2];while(1){Le:{if(h){break Le}p=H[e+16>>2];j=p+1|0;o=I[p+1|0];if(I[p|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Le}H[e+16>>2]=j;d=(o<<9)+d|0;h=7;break Le}H[e+16>>2]=j;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}j=c?!i:i;break Je}j=H[p+4>>2]}c=I[n+24640|0];H[k+256>>2]=(j|0)==(c|0)?v:w;H[m>>2]=H[m>>2]|256;H[f+4>>2]=H[f+4>>2]|64;i=H[e+108>>2];g=(c^j)<<22|g|128}j=s+(I[(g>>>6&495)+i|0]<<2)|0;n=H[j>>2];c=H[n>>2];b=b-c|0;Me:{if(d>>>16>>>0>>0){p=H[n+4>>2];A=j;j=b>>>0>>0;H[A>>2]=H[n+(j?8:12)>>2];while(1){Ne:{if(h){break Ne}n=H[e+16>>2];b=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ne}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Ne}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=j?p:!p;break Me}d=d-(c<<16)|0;if(!(b&32768)){p=H[n+4>>2];c=b>>>0>>0;H[j>>2]=H[n+(c?12:8)>>2];while(1){Oe:{if(h){break Oe}n=H[e+16>>2];j=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Oe}H[e+16>>2]=j;d=(m<<9)+d|0;h=7;break Oe}H[e+16>>2]=j;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!p:p;break Me}c=H[n+4>>2]}if(!c){break ze}}m=f-4|0;n=H[f+4>>2]>>>23&4|(H[m>>2]>>>25&1|(g>>>18&16|(g>>>22&64|g>>>6&170)));j=s+(I[n+24384|0]<<2)|0;p=H[j>>2];c=H[p>>2];b=b-c|0;Pe:{if(d>>>16>>>0>>0){i=H[p+4>>2];A=j;j=b>>>0>>0;H[A>>2]=H[p+(j?8:12)>>2];while(1){Qe:{if(h){break Qe}p=H[e+16>>2];b=p+1|0;o=I[p+1|0];if(I[p|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Qe}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Qe}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;j=j?i:!i;break Pe}d=d-(c<<16)|0;if(!(b&32768)){i=H[p+4>>2];c=b>>>0>>0;H[j>>2]=H[p+(c?12:8)>>2];while(1){Re:{if(h){break Re}p=H[e+16>>2];j=p+1|0;o=I[p+1|0];if(I[p|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Re}H[e+16>>2]=j;d=(o<<9)+d|0;h=7;break Re}H[e+16>>2]=j;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}j=c?!i:i;break Pe}j=H[p+4>>2]}c=I[n+24640|0];H[k+512>>2]=(j|0)==(c|0)?v:w;H[m>>2]=H[m>>2]|2048;H[f+4>>2]=H[f+4>>2]|512;g=(c^j)<<25|g|1024;i=H[e+108>>2]}j=s+(I[(g>>>9&495)+i|0]<<2)|0;p=H[j>>2];c=H[p>>2];b=b-c|0;Se:{if(d>>>16>>>0>>0){i=H[p+4>>2];n=b>>>0>>0;H[j>>2]=H[p+(n?8:12)>>2];while(1){Te:{if(h){break Te}p=H[e+16>>2];b=p+1|0;m=I[p+1|0];if(I[p|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Te}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Te}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?i:!i;break Se}d=d-(c<<16)|0;if(!(b&32768)){i=H[p+4>>2];c=b>>>0>>0;H[j>>2]=H[p+(c?12:8)>>2];while(1){Ue:{if(h){break Ue}p=H[e+16>>2];n=p+1|0;m=I[p+1|0];if(I[p|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ue}H[e+16>>2]=n;d=(m<<9)+d|0;h=7;break Ue}H[e+16>>2]=n;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!i:i;break Se}c=H[p+4>>2]}if(!c){break ne}}M=f-4|0;t=H[f+4>>2]>>>26&4|(H[M>>2]>>>28&1|(g>>>21&16|(g>>>25&64|g>>>9&170)));j=s+(I[t+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;break oe}Ve:{if(g&2097168){break Ve}j=s+(I[H[e+108>>2]+(g&495)|0]<<2)|0;p=H[j>>2];c=H[p>>2];b=b-c|0;We:{if(d>>>16>>>0>>0){i=H[p+4>>2];n=b>>>0>>0;H[j>>2]=H[p+(n?8:12)>>2];while(1){Xe:{if(h){break Xe}p=H[e+16>>2];b=p+1|0;m=I[p+1|0];if(I[p|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Xe}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Xe}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?i:!i;break We}d=d-(c<<16)|0;if(!(b&32768)){i=H[p+4>>2];c=b>>>0>>0;H[j>>2]=H[p+(c?12:8)>>2];while(1){Ye:{if(h){break Ye}p=H[e+16>>2];n=p+1|0;m=I[p+1|0];if(I[p|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ye}H[e+16>>2]=n;d=(m<<9)+d|0;h=7;break Ye}H[e+16>>2]=n;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!i:i;break We}c=H[p+4>>2]}if(!c){break Ve}o=f-4|0;p=H[f+4>>2]>>>17&4|(H[o>>2]>>>19&1|(g>>>14&16|(g>>>16&64|g&170)));j=s+(I[p+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;Ze:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){_e:{if(h){break _e}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break _e}H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break _e}H[e+16>>2]=b;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;i=n?m:!m;break Ze}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){$e:{if(h){break $e}i=H[e+16>>2];n=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break $e}H[e+16>>2]=n;d=(t<<9)+d|0;h=7;break $e}H[e+16>>2]=n;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}i=c?!m:m;break Ze}i=H[i+4>>2]}n=I[p+24640|0];H[k>>2]=(i|0)==(n|0)?v:w;H[o>>2]=H[o>>2]|32;H[f+4>>2]=H[f+4>>2]|8;c=f-268|0;H[c>>2]=H[c>>2]|131072;c=f-260|0;H[c>>2]=H[c>>2]|32768;c=f-264|0;p=c;A=H[c>>2];c=i^n;H[p>>2]=A|c<<31|65536;g=c<<19|g|16}af:{if(g&16777344){break af}p=g>>>3|0;j=s+(I[H[e+108>>2]+(p&495)|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;bf:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){cf:{if(h){break cf}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break cf}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break cf}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?m:!m;break bf}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){df:{if(h){break df}i=H[e+16>>2];n=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break df}H[e+16>>2]=n;d=(o<<9)+d|0;h=7;break df}H[e+16>>2]=n;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!m:m;break bf}c=H[i+4>>2]}if(!c){break af}o=f-4|0;p=H[f+4>>2]>>>20&4|(H[o>>2]>>>22&1|(g>>>15&16|(g>>>19&64|p&170)));j=s+(I[p+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;ef:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){ff:{if(h){break ff}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break ff}H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break ff}H[e+16>>2]=b;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;n=n?m:!m;break ef}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){gf:{if(h){break gf}i=H[e+16>>2];n=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break gf}H[e+16>>2]=n;d=(t<<9)+d|0;h=7;break gf}H[e+16>>2]=n;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=c?!m:m;break ef}n=H[i+4>>2]}c=I[p+24640|0];H[k+256>>2]=(n|0)==(c|0)?v:w;H[o>>2]=H[o>>2]|256;H[f+4>>2]=H[f+4>>2]|64;g=(c^n)<<22|g|128}hf:{if(g&134218752){break hf}p=g>>>6|0;j=s+(I[H[e+108>>2]+(p&495)|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;jf:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){kf:{if(h){break kf}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break kf}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break kf}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?m:!m;break jf}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){lf:{if(h){break lf}i=H[e+16>>2];n=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break lf}H[e+16>>2]=n;d=(o<<9)+d|0;h=7;break lf}H[e+16>>2]=n;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!m:m;break jf}c=H[i+4>>2]}if(!c){break hf}o=f-4|0;p=H[f+4>>2]>>>23&4|(H[o>>2]>>>25&1|(g>>>18&16|(g>>>22&64|p&170)));j=s+(I[p+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;mf:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){nf:{if(h){break nf}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break nf}H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break nf}H[e+16>>2]=b;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;n=n?m:!m;break mf}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){of:{if(h){break of}i=H[e+16>>2];n=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break of}H[e+16>>2]=n;d=(t<<9)+d|0;h=7;break of}H[e+16>>2]=n;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=c?!m:m;break mf}n=H[i+4>>2]}c=I[p+24640|0];H[k+512>>2]=(n|0)==(c|0)?v:w;H[o>>2]=H[o>>2]|2048;H[f+4>>2]=H[f+4>>2]|512;g=(c^n)<<25|g|1024}if(g&1073750016){break ne}p=g>>>9|0;j=s+(I[H[e+108>>2]+(p&495)|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;pf:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){qf:{if(h){break qf}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break qf}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break qf}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?m:!m;break pf}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){rf:{if(h){break rf}i=H[e+16>>2];n=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break rf}H[e+16>>2]=n;d=(o<<9)+d|0;h=7;break rf}H[e+16>>2]=n;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!m:m;break pf}c=H[i+4>>2]}if(!c){break ne}M=f-4|0;t=H[f+4>>2]>>>26&4|(H[M>>2]>>>28&1|(g>>>21&16|(g>>>25&64|p&170)));j=s+(I[t+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0}sf:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[(n?8:12)+i>>2];while(1){tf:{if(h){break tf}p=H[e+16>>2];b=p+1|0;i=I[p+1|0];if(I[p|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break tf}H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break tf}H[e+16>>2]=b;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;n=n?m:!m;break sf}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[(c?12:8)+i>>2];while(1){uf:{if(h){break uf}p=H[e+16>>2];n=p+1|0;i=I[p+1|0];if(I[p|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break uf}H[e+16>>2]=n;d=(i<<9)+d|0;h=7;break uf}H[e+16>>2]=n;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=c?!m:m;break sf}n=H[i+4>>2]}c=I[t+24640|0];H[k+768>>2]=(n|0)==(c|0)?v:w;H[M>>2]=H[M>>2]|16384;H[f+4>>2]=H[f+4>>2]|4096;H[f+260>>2]=H[f+260>>2]|4;H[f+268>>2]=H[f+268>>2]|1;c=c^n;H[f+264>>2]=H[f+264>>2]|c<<18|2;g=c<<28|g|8192}H[f>>2]=g&-1226833921}g=f+4|0;c=k+4|0;u=u+1|0;if((u|0)!=64){continue}break}g=f+12|0;c=k+772|0;n=r>>>0<60;r=r+4|0;if(n){continue}break}break ke}b=1<>>1|b;l=H[e+120>>2];c=(l+(X<<2)|0)+12|0;g=H[e+128>>2];h=H[e+8>>2];b=H[e+4>>2];d=H[e>>2];j=H[e+104>>2];p=H[e+116>>2];if(Z&8){vf:{if(g>>>0<4){break vf}if(X){n=e+100|0;q=e+96|0;w=N(X,12);u=X<<3;s=0-A|0;D=e+28|0;while(1){v=0;while(1){k=c;c=H[c>>2];wf:{xf:{yf:{if(c){zf:{if(c&2097168){break zf}j=D+(I[H[e+108>>2]+(c&495)|0]<<2)|0;f=H[j>>2];g=H[f>>2];b=b-g|0;Af:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[f+4>>2];if(b&32768){break Af}i=H[f+4>>2];g=b>>>0>>0;H[j>>2]=H[f+(g?12:8)>>2];while(1){Bf:{if(h){break Bf}f=H[e+16>>2];l=f+1|0;m=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(m<<8)+d|0;break Bf}if(m>>>0<=143){H[e+16>>2]=l;d=(m<<9)+d|0;h=7;break Bf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!i:i;break Af}i=H[f+4>>2];l=b>>>0>>0;H[j>>2]=H[f+(l?8:12)>>2];while(1){Cf:{if(h){break Cf}f=H[e+16>>2];b=f+1|0;m=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break Cf}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Cf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?i:!i}if(!l){break zf}o=k-4|0;f=H[k+4>>2]>>>17&4|(H[o>>2]>>>19&1|(c>>>14&16|(c>>>16&64|c&170)));j=D+(I[f+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Df:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Df}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Ef:{if(h){break Ef}i=H[e+16>>2];l=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(t<<8)+d|0;break Ef}if(t>>>0<=143){H[e+16>>2]=l;d=(t<<9)+d|0;h=7;break Ef}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Df}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Ff:{if(h){break Ff}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(t<<8)+d|0;break Ff}if(t>>>0<=143){H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break Ff}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}g=I[f+24640|0];H[p>>2]=(l|0)==(g|0)?A:s;H[o>>2]=H[o>>2]|32;H[k+4>>2]=H[k+4>>2]|8;c=(g^l)<<19|c|16}Gf:{if(c&16777344){break Gf}f=c>>>3|0;j=D+(I[H[e+108>>2]+(f&495)|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Hf:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Hf}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){If:{if(h){break If}i=H[e+16>>2];l=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break If}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break If}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Hf}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Jf:{if(h){break Jf}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break Jf}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Jf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}if(!l){break Gf}o=k-4|0;f=H[k+4>>2]>>>20&4|(H[o>>2]>>>22&1|(c>>>15&16|(c>>>19&64|f&170)));j=D+(I[f+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Y=(X<<2)+p|0;Kf:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Kf}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Lf:{if(h){break Lf}i=H[e+16>>2];l=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(t<<8)+d|0;break Lf}if(t>>>0<=143){H[e+16>>2]=l;d=(t<<9)+d|0;h=7;break Lf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Kf}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Mf:{if(h){break Mf}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(t<<8)+d|0;break Mf}if(t>>>0<=143){H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break Mf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}g=I[f+24640|0];H[Y>>2]=(l|0)==(g|0)?A:s;H[o>>2]=H[o>>2]|256;H[k+4>>2]=H[k+4>>2]|64;c=(g^l)<<22|c|128}Nf:{if(c&134218752){break Nf}f=c>>>6|0;j=D+(I[H[e+108>>2]+(f&495)|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Of:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Of}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Pf:{if(h){break Pf}i=H[e+16>>2];l=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break Pf}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break Pf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Of}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Qf:{if(h){break Qf}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break Qf}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Qf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}if(!l){break Nf}o=k-4|0;f=H[k+4>>2]>>>23&4|(H[o>>2]>>>25&1|(c>>>18&16|(c>>>22&64|f&170)));j=D+(I[f+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Y=p+u|0;Rf:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Rf}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Sf:{if(h){break Sf}i=H[e+16>>2];l=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(t<<8)+d|0;break Sf}if(t>>>0<=143){H[e+16>>2]=l;d=(t<<9)+d|0;h=7;break Sf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Rf}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Tf:{if(h){break Tf}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(t<<8)+d|0;break Tf}if(t>>>0<=143){H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break Tf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}g=I[f+24640|0];H[Y>>2]=(l|0)==(g|0)?A:s;H[o>>2]=H[o>>2]|2048;H[k+4>>2]=H[k+4>>2]|512;c=(g^l)<<25|c|1024}if(c&1073750016){break xf}f=c>>>9|0;j=D+(I[H[e+108>>2]+(f&495)|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Uf:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Uf}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Vf:{if(h){break Vf}i=H[e+16>>2];l=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break Vf}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break Vf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Uf}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Wf:{if(h){break Wf}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break Wf}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Wf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}if(!l){break xf}t=k-4|0;o=H[k+4>>2]>>>26&4|(H[t>>2]>>>28&1|(c>>>21&16|(c>>>25&64|f&170)));j=D+(I[o+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;break yf}l=H[q>>2];c=H[l>>2];b=b-c|0;Xf:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;g=H[l+4>>2];if(b&32768){break Xf}j=H[l+4>>2];c=b>>>0>>0;H[q>>2]=H[l+(c?12:8)>>2];while(1){Yf:{if(h){break Yf}l=H[e+16>>2];g=l+1|0;f=I[l+1|0];if(I[l|0]!=255){H[e+16>>2]=g;h=8;d=(f<<8)+d|0;break Yf}if(f>>>0<=143){H[e+16>>2]=g;d=(f<<9)+d|0;h=7;break Yf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}g=c?!j:j;break Xf}j=H[l+4>>2];g=b>>>0>>0;H[q>>2]=H[l+(g?8:12)>>2];while(1){Zf:{if(h){break Zf}l=H[e+16>>2];b=l+1|0;f=I[l+1|0];if(I[l|0]!=255){H[e+16>>2]=b;h=8;d=(f<<8)+d|0;break Zf}if(f>>>0<=143){H[e+16>>2]=b;d=(f<<9)+d|0;h=7;break Zf}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;g=g?j:!j}if(!g){j=q;break wf}g=H[n>>2];c=H[g>>2];b=b-c|0;_f:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;l=H[g+4>>2];if(b&32768){break _f}f=H[g+4>>2];c=b>>>0>>0;g=H[(c?12:8)+g>>2];H[n>>2]=g;while(1){$f:{if(h){break $f}j=H[e+16>>2];l=j+1|0;i=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=l;h=8;d=(i<<8)+d|0;break $f}if(i>>>0<=143){H[e+16>>2]=l;d=(i<<9)+d|0;h=7;break $f}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=c?!f:f;break _f}f=H[g+4>>2];l=b>>>0>>0;g=H[(l?8:12)+g>>2];H[n>>2]=g;while(1){ag:{if(h){break ag}j=H[e+16>>2];b=j+1|0;i=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(i<<8)+d|0;break ag}if(i>>>0<=143){H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break ag}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;l=l?f:!f}c=H[g>>2];b=b-c|0;bg:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;j=H[g+4>>2];if(b&32768){break bg}f=H[g+4>>2];c=b>>>0>>0;H[n>>2]=H[(c?12:8)+g>>2];while(1){cg:{if(h){break cg}j=H[e+16>>2];g=j+1|0;i=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=g;h=8;d=(i<<8)+d|0;break cg}if(i>>>0<=143){H[e+16>>2]=g;d=(i<<9)+d|0;h=7;break cg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}j=c?!f:f;break bg}f=H[g+4>>2];j=g;g=b>>>0>>0;H[n>>2]=H[j+(g?8:12)>>2];while(1){dg:{if(h){break dg}j=H[e+16>>2];b=j+1|0;i=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(i<<8)+d|0;break dg}if(i>>>0<=143){H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break dg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;j=g?f:!f}g=j;c=0;j=n;eg:{fg:{gg:{hg:{ig:{switch(g|l<<1){case 0:i=k-4|0;l=H[k+4>>2]>>>17&4|H[i>>2]>>>19&1;g=D+(I[l+24384|0]<<2)|0;j=H[g>>2];c=H[j>>2];b=b-c|0;jg:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;f=H[j+4>>2];if(b&32768){break jg}f=H[j+4>>2];c=b>>>0>>0;H[g>>2]=H[j+(c?12:8)>>2];while(1){kg:{if(h){break kg}j=H[e+16>>2];g=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=g;h=8;d=(m<<8)+d|0;break kg}if(m>>>0<=143){H[e+16>>2]=g;d=(m<<9)+d|0;h=7;break kg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}f=c?!f:f;break jg}f=H[j+4>>2];m=g;g=b>>>0>>0;H[m>>2]=H[j+(g?8:12)>>2];while(1){lg:{if(h){break lg}j=H[e+16>>2];b=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break lg}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break lg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;f=g?f:!f}g=f;c=I[l+24640|0];H[p>>2]=(g|0)==(c|0)?A:s;H[i>>2]=H[i>>2]|32;H[k+4>>2]=H[k+4>>2]|8;l=(c^g)<<19;i=H[e+108>>2];g=D+(I[i+2|0]<<2)|0;j=H[g>>2];c=H[j>>2];b=b-c|0;mg:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;f=H[j+4>>2];if(b&32768){break mg}f=H[j+4>>2];c=b>>>0>>0;H[g>>2]=H[j+(c?12:8)>>2];while(1){ng:{if(h){break ng}j=H[e+16>>2];g=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=g;h=8;d=(m<<8)+d|0;break ng}if(m>>>0<=143){H[e+16>>2]=g;d=(m<<9)+d|0;h=7;break ng}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}f=c?!f:f;break mg}f=H[j+4>>2];m=g;g=b>>>0>>0;H[m>>2]=H[j+(g?8:12)>>2];while(1){og:{if(h){break og}j=H[e+16>>2];b=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break og}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break og}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;f=g?f:!f}g=f;c=l|16;if(!g){break hg}break;case 1:break ig;case 2:break gg;case 3:break eg;default:break xf}}m=k-4|0;j=H[k+4>>2]>>>20&4|(H[m>>2]>>>22&1|(c>>>15&16|(c>>>19&64|c>>>3&170)));l=D+(I[j+24384|0]<<2)|0;f=H[l>>2];g=H[f>>2];b=b-g|0;t=(X<<2)+p|0;pg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;i=H[f+4>>2];if(b&32768){break pg}i=H[f+4>>2];g=b>>>0>>0;H[l>>2]=H[f+(g?12:8)>>2];while(1){qg:{if(h){break qg}f=H[e+16>>2];l=f+1|0;o=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break qg}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break qg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}i=g?!i:i;break pg}i=H[f+4>>2];o=l;l=b>>>0>>0;H[o>>2]=H[f+(l?8:12)>>2];while(1){rg:{if(h){break rg}f=H[e+16>>2];b=f+1|0;o=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break rg}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break rg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;i=l?i:!i}l=i;g=I[j+24640|0];H[t>>2]=(l|0)==(g|0)?A:s;H[m>>2]=H[m>>2]|256;H[k+4>>2]=H[k+4>>2]|64;i=H[e+108>>2];c=(g^l)<<22|c|128}l=D+(I[(c>>>6&495)+i|0]<<2)|0;j=H[l>>2];g=H[j>>2];b=b-g|0;sg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;f=H[j+4>>2];if(b&32768){break sg}f=H[j+4>>2];g=b>>>0>>0;H[l>>2]=H[j+(g?12:8)>>2];while(1){tg:{if(h){break tg}j=H[e+16>>2];l=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=l;h=8;d=(m<<8)+d|0;break tg}if(m>>>0<=143){H[e+16>>2]=l;d=(m<<9)+d|0;h=7;break tg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}f=g?!f:f;break sg}f=H[j+4>>2];m=l;l=b>>>0>>0;H[m>>2]=H[j+(l?8:12)>>2];while(1){ug:{if(h){break ug}j=H[e+16>>2];b=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break ug}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break ug}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;f=l?f:!f}if(!f){break fg}}m=k-4|0;j=H[k+4>>2]>>>23&4|(H[m>>2]>>>25&1|(c>>>18&16|(c>>>22&64|c>>>6&170)));l=D+(I[j+24384|0]<<2)|0;f=H[l>>2];g=H[f>>2];b=b-g|0;t=p+u|0;vg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;i=H[f+4>>2];if(b&32768){break vg}i=H[f+4>>2];g=b>>>0>>0;H[l>>2]=H[f+(g?12:8)>>2];while(1){wg:{if(h){break wg}f=H[e+16>>2];l=f+1|0;o=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break wg}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break wg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}i=g?!i:i;break vg}i=H[f+4>>2];o=l;l=b>>>0>>0;H[o>>2]=H[f+(l?8:12)>>2];while(1){xg:{if(h){break xg}f=H[e+16>>2];b=f+1|0;o=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break xg}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break xg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;i=l?i:!i}l=i;g=I[j+24640|0];H[t>>2]=(l|0)==(g|0)?A:s;H[m>>2]=H[m>>2]|2048;H[k+4>>2]=H[k+4>>2]|512;c=(g^l)<<25|c|1024;i=H[e+108>>2]}j=D+(I[(c>>>9&495)+i|0]<<2)|0;f=H[j>>2];g=H[f>>2];b=b-g|0;yg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[f+4>>2];if(b&32768){break yg}i=H[f+4>>2];g=b>>>0>>0;H[j>>2]=H[f+(g?12:8)>>2];while(1){zg:{if(h){break zg}f=H[e+16>>2];l=f+1|0;m=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(m<<8)+d|0;break zg}if(m>>>0<=143){H[e+16>>2]=l;d=(m<<9)+d|0;h=7;break zg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!i:i;break yg}i=H[f+4>>2];l=b>>>0>>0;H[j>>2]=H[f+(l?8:12)>>2];while(1){Ag:{if(h){break Ag}f=H[e+16>>2];b=f+1|0;m=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break Ag}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Ag}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?i:!i}if(!l){break xf}}t=k-4|0;o=H[k+4>>2]>>>26&4|(H[t>>2]>>>28&1|(c>>>21&16|(c>>>25&64|c>>>9&170)));j=D+(I[o+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0}Y=p+w|0;Bg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Bg}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[(g?12:8)+i>>2];while(1){Cg:{if(h){break Cg}f=H[e+16>>2];l=f+1|0;i=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(i<<8)+d|0;break Cg}if(i>>>0<=143){H[e+16>>2]=l;d=(i<<9)+d|0;h=7;break Cg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Bg}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[(l?8:12)+i>>2];while(1){Dg:{if(h){break Dg}f=H[e+16>>2];b=f+1|0;i=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(i<<8)+d|0;break Dg}if(i>>>0<=143){H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break Dg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}g=I[o+24640|0];H[Y>>2]=(l|0)==(g|0)?A:s;H[t>>2]=H[t>>2]|16384;H[k+4>>2]=H[k+4>>2]|4096;f=k+(H[e+124>>2]<<2)|0;H[f+4>>2]=H[f+4>>2]|4;H[f+12>>2]=H[f+12>>2]|1;g=g^l;H[f+8>>2]=H[f+8>>2]|g<<18|2;c=g<<28|c|8192}H[k>>2]=c&-1226833921}c=k+4|0;p=p+4|0;v=v+1|0;if((X|0)!=(v|0)){continue}break}c=k+12|0;p=p+w|0;r=r+4|0;g=H[e+128>>2];if(r>>>0<(g&-4)>>>0){continue}break}break vf}c=(g&-4)-1|0;r=(c&-4)+4|0;c=(l+(c<<1&-8)|0)+20|0}H[e+8>>2]=h;H[e+4>>2]=b;H[e>>2]=d;H[e+104>>2]=j;if(!X|g>>>0<=r>>>0){break je}while(1){h=0;if(H[e+128>>2]!=(r|0)){while(1){gc(e,c,(N(h,X)<<2)+p|0,A,h,1);h=h+1|0;if(h>>>0>2]-r>>>0){continue}break}}H[c>>2]=H[c>>2]&-1226833921;p=p+4|0;c=c+4|0;M=M+1|0;if((X|0)!=(M|0)){continue}break}break je}Eg:{if(g>>>0<4){break Eg}if(X){n=e+100|0;q=e+96|0;w=N(X,12);u=X<<3;s=0-A|0;D=e+28|0;while(1){v=0;while(1){k=c;c=H[c>>2];Fg:{Gg:{Hg:{if(c){Ig:{if(c&2097168){break Ig}j=D+(I[H[e+108>>2]+(c&495)|0]<<2)|0;f=H[j>>2];g=H[f>>2];b=b-g|0;Jg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[f+4>>2];if(b&32768){break Jg}i=H[f+4>>2];g=b>>>0>>0;H[j>>2]=H[f+(g?12:8)>>2];while(1){Kg:{if(h){break Kg}f=H[e+16>>2];l=f+1|0;m=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(m<<8)+d|0;break Kg}if(m>>>0<=143){H[e+16>>2]=l;d=(m<<9)+d|0;h=7;break Kg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!i:i;break Jg}i=H[f+4>>2];l=b>>>0>>0;H[j>>2]=H[f+(l?8:12)>>2];while(1){Lg:{if(h){break Lg}f=H[e+16>>2];b=f+1|0;m=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break Lg}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Lg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?i:!i}if(!l){break Ig}o=k-4|0;f=H[k+4>>2]>>>17&4|(H[o>>2]>>>19&1|(c>>>14&16|(c>>>16&64|c&170)));j=D+(I[f+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Mg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Mg}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Ng:{if(h){break Ng}i=H[e+16>>2];l=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(t<<8)+d|0;break Ng}if(t>>>0<=143){H[e+16>>2]=l;d=(t<<9)+d|0;h=7;break Ng}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Mg}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Og:{if(h){break Og}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(t<<8)+d|0;break Og}if(t>>>0<=143){H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break Og}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}g=I[f+24640|0];H[p>>2]=(l|0)==(g|0)?A:s;H[o>>2]=H[o>>2]|32;H[k+4>>2]=H[k+4>>2]|8;f=k+(-2-H[e+124>>2]<<2)|0;H[f+4>>2]=H[f+4>>2]|32768;l=g^l;H[f>>2]=H[f>>2]|l<<31|65536;g=f-4|0;H[g>>2]=H[g>>2]|131072;c=l<<19|c|16}Pg:{if(c&16777344){break Pg}f=c>>>3|0;j=D+(I[H[e+108>>2]+(f&495)|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Qg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Qg}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Rg:{if(h){break Rg}i=H[e+16>>2];l=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break Rg}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break Rg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Qg}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Sg:{if(h){break Sg}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break Sg}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Sg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}if(!l){break Pg}o=k-4|0;f=H[k+4>>2]>>>20&4|(H[o>>2]>>>22&1|(c>>>15&16|(c>>>19&64|f&170)));j=D+(I[f+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Y=(X<<2)+p|0;Tg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Tg}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Ug:{if(h){break Ug}i=H[e+16>>2];l=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(t<<8)+d|0;break Ug}if(t>>>0<=143){H[e+16>>2]=l;d=(t<<9)+d|0;h=7;break Ug}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Tg}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Vg:{if(h){break Vg}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(t<<8)+d|0;break Vg}if(t>>>0<=143){H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break Vg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}g=I[f+24640|0];H[Y>>2]=(l|0)==(g|0)?A:s;H[o>>2]=H[o>>2]|256;H[k+4>>2]=H[k+4>>2]|64;c=(g^l)<<22|c|128}Wg:{if(c&134218752){break Wg}f=c>>>6|0;j=D+(I[H[e+108>>2]+(f&495)|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Xg:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Xg}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){Yg:{if(h){break Yg}i=H[e+16>>2];l=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break Yg}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break Yg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Xg}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){Zg:{if(h){break Zg}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break Zg}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Zg}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}if(!l){break Wg}o=k-4|0;f=H[k+4>>2]>>>23&4|(H[o>>2]>>>25&1|(c>>>18&16|(c>>>22&64|f&170)));j=D+(I[f+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;Y=p+u|0;_g:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break _g}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){$g:{if(h){break $g}i=H[e+16>>2];l=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(t<<8)+d|0;break $g}if(t>>>0<=143){H[e+16>>2]=l;d=(t<<9)+d|0;h=7;break $g}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break _g}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){ah:{if(h){break ah}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(t<<8)+d|0;break ah}if(t>>>0<=143){H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break ah}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}g=I[f+24640|0];H[Y>>2]=(l|0)==(g|0)?A:s;H[o>>2]=H[o>>2]|2048;H[k+4>>2]=H[k+4>>2]|512;c=(g^l)<<25|c|1024}if(c&1073750016){break Gg}f=c>>>9|0;j=D+(I[H[e+108>>2]+(f&495)|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;bh:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break bh}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[i+(g?12:8)>>2];while(1){ch:{if(h){break ch}i=H[e+16>>2];l=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break ch}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break ch}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break bh}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[i+(l?8:12)>>2];while(1){dh:{if(h){break dh}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break dh}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break dh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}if(!l){break Gg}t=k-4|0;o=H[k+4>>2]>>>26&4|(H[t>>2]>>>28&1|(c>>>21&16|(c>>>25&64|f&170)));j=D+(I[o+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0;break Hg}l=H[q>>2];c=H[l>>2];b=b-c|0;eh:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;g=H[l+4>>2];if(b&32768){break eh}j=H[l+4>>2];c=b>>>0>>0;H[q>>2]=H[l+(c?12:8)>>2];while(1){fh:{if(h){break fh}l=H[e+16>>2];g=l+1|0;f=I[l+1|0];if(I[l|0]!=255){H[e+16>>2]=g;h=8;d=(f<<8)+d|0;break fh}if(f>>>0<=143){H[e+16>>2]=g;d=(f<<9)+d|0;h=7;break fh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}g=c?!j:j;break eh}j=H[l+4>>2];g=b>>>0>>0;H[q>>2]=H[l+(g?8:12)>>2];while(1){gh:{if(h){break gh}l=H[e+16>>2];b=l+1|0;f=I[l+1|0];if(I[l|0]!=255){H[e+16>>2]=b;h=8;d=(f<<8)+d|0;break gh}if(f>>>0<=143){H[e+16>>2]=b;d=(f<<9)+d|0;h=7;break gh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;g=g?j:!j}if(!g){j=q;break Fg}g=H[n>>2];c=H[g>>2];b=b-c|0;hh:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;l=H[g+4>>2];if(b&32768){break hh}f=H[g+4>>2];c=b>>>0>>0;g=H[(c?12:8)+g>>2];H[n>>2]=g;while(1){ih:{if(h){break ih}j=H[e+16>>2];l=j+1|0;i=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=l;h=8;d=(i<<8)+d|0;break ih}if(i>>>0<=143){H[e+16>>2]=l;d=(i<<9)+d|0;h=7;break ih}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=c?!f:f;break hh}f=H[g+4>>2];l=b>>>0>>0;g=H[(l?8:12)+g>>2];H[n>>2]=g;while(1){jh:{if(h){break jh}j=H[e+16>>2];b=j+1|0;i=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(i<<8)+d|0;break jh}if(i>>>0<=143){H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break jh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;l=l?f:!f}c=H[g>>2];b=b-c|0;kh:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;j=H[g+4>>2];if(b&32768){break kh}f=H[g+4>>2];c=b>>>0>>0;H[n>>2]=H[(c?12:8)+g>>2];while(1){lh:{if(h){break lh}j=H[e+16>>2];g=j+1|0;i=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=g;h=8;d=(i<<8)+d|0;break lh}if(i>>>0<=143){H[e+16>>2]=g;d=(i<<9)+d|0;h=7;break lh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}j=c?!f:f;break kh}f=H[g+4>>2];j=g;g=b>>>0>>0;H[n>>2]=H[j+(g?8:12)>>2];while(1){mh:{if(h){break mh}j=H[e+16>>2];b=j+1|0;i=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(i<<8)+d|0;break mh}if(i>>>0<=143){H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break mh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;j=g?f:!f}g=j;c=0;j=n;nh:{oh:{ph:{qh:{rh:{switch(g|l<<1){case 0:i=k-4|0;l=H[k+4>>2]>>>17&4|H[i>>2]>>>19&1;g=D+(I[l+24384|0]<<2)|0;j=H[g>>2];c=H[j>>2];b=b-c|0;sh:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;f=H[j+4>>2];if(b&32768){break sh}f=H[j+4>>2];c=b>>>0>>0;H[g>>2]=H[j+(c?12:8)>>2];while(1){th:{if(h){break th}j=H[e+16>>2];g=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=g;h=8;d=(m<<8)+d|0;break th}if(m>>>0<=143){H[e+16>>2]=g;d=(m<<9)+d|0;h=7;break th}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}f=c?!f:f;break sh}f=H[j+4>>2];m=g;g=b>>>0>>0;H[m>>2]=H[j+(g?8:12)>>2];while(1){uh:{if(h){break uh}j=H[e+16>>2];b=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break uh}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break uh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;f=g?f:!f}g=f;c=I[l+24640|0];H[p>>2]=(g|0)==(c|0)?A:s;H[i>>2]=H[i>>2]|32;H[k+4>>2]=H[k+4>>2]|8;l=k+(-2-H[e+124>>2]<<2)|0;H[l+4>>2]=H[l+4>>2]|32768;g=c^g;H[l>>2]=H[l>>2]|g<<31|65536;c=l-4|0;H[c>>2]=H[c>>2]|131072;l=g<<19;i=H[e+108>>2];g=D+(I[i+2|0]<<2)|0;j=H[g>>2];c=H[j>>2];b=b-c|0;vh:{if(d>>>16>>>0>=c>>>0){d=d-(c<<16)|0;f=H[j+4>>2];if(b&32768){break vh}f=H[j+4>>2];c=b>>>0>>0;H[g>>2]=H[j+(c?12:8)>>2];while(1){wh:{if(h){break wh}j=H[e+16>>2];g=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=g;h=8;d=(m<<8)+d|0;break wh}if(m>>>0<=143){H[e+16>>2]=g;d=(m<<9)+d|0;h=7;break wh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}f=c?!f:f;break vh}f=H[j+4>>2];m=g;g=b>>>0>>0;H[m>>2]=H[j+(g?8:12)>>2];while(1){xh:{if(h){break xh}j=H[e+16>>2];b=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break xh}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break xh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;f=g?f:!f}g=f;c=l|16;if(!g){break qh}break;case 1:break rh;case 2:break ph;case 3:break nh;default:break Gg}}m=k-4|0;j=H[k+4>>2]>>>20&4|(H[m>>2]>>>22&1|(c>>>15&16|(c>>>19&64|c>>>3&170)));l=D+(I[j+24384|0]<<2)|0;f=H[l>>2];g=H[f>>2];b=b-g|0;t=(X<<2)+p|0;yh:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;i=H[f+4>>2];if(b&32768){break yh}i=H[f+4>>2];g=b>>>0>>0;H[l>>2]=H[f+(g?12:8)>>2];while(1){zh:{if(h){break zh}f=H[e+16>>2];l=f+1|0;o=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break zh}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break zh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}i=g?!i:i;break yh}i=H[f+4>>2];o=l;l=b>>>0>>0;H[o>>2]=H[f+(l?8:12)>>2];while(1){Ah:{if(h){break Ah}f=H[e+16>>2];b=f+1|0;o=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break Ah}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Ah}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;i=l?i:!i}l=i;g=I[j+24640|0];H[t>>2]=(l|0)==(g|0)?A:s;H[m>>2]=H[m>>2]|256;H[k+4>>2]=H[k+4>>2]|64;i=H[e+108>>2];c=(g^l)<<22|c|128}l=D+(I[(c>>>6&495)+i|0]<<2)|0;j=H[l>>2];g=H[j>>2];b=b-g|0;Bh:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;f=H[j+4>>2];if(b&32768){break Bh}f=H[j+4>>2];g=b>>>0>>0;H[l>>2]=H[j+(g?12:8)>>2];while(1){Ch:{if(h){break Ch}j=H[e+16>>2];l=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=l;h=8;d=(m<<8)+d|0;break Ch}if(m>>>0<=143){H[e+16>>2]=l;d=(m<<9)+d|0;h=7;break Ch}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}f=g?!f:f;break Bh}f=H[j+4>>2];m=l;l=b>>>0>>0;H[m>>2]=H[j+(l?8:12)>>2];while(1){Dh:{if(h){break Dh}j=H[e+16>>2];b=j+1|0;m=I[j+1|0];if(I[j|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break Dh}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Dh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;f=l?f:!f}if(!f){break oh}}m=k-4|0;j=H[k+4>>2]>>>23&4|(H[m>>2]>>>25&1|(c>>>18&16|(c>>>22&64|c>>>6&170)));l=D+(I[j+24384|0]<<2)|0;f=H[l>>2];g=H[f>>2];b=b-g|0;t=p+u|0;Eh:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;i=H[f+4>>2];if(b&32768){break Eh}i=H[f+4>>2];g=b>>>0>>0;H[l>>2]=H[f+(g?12:8)>>2];while(1){Fh:{if(h){break Fh}f=H[e+16>>2];l=f+1|0;o=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(o<<8)+d|0;break Fh}if(o>>>0<=143){H[e+16>>2]=l;d=(o<<9)+d|0;h=7;break Fh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}i=g?!i:i;break Eh}i=H[f+4>>2];o=l;l=b>>>0>>0;H[o>>2]=H[f+(l?8:12)>>2];while(1){Gh:{if(h){break Gh}f=H[e+16>>2];b=f+1|0;o=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(o<<8)+d|0;break Gh}if(o>>>0<=143){H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Gh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;i=l?i:!i}l=i;g=I[j+24640|0];H[t>>2]=(l|0)==(g|0)?A:s;H[m>>2]=H[m>>2]|2048;H[k+4>>2]=H[k+4>>2]|512;c=(g^l)<<25|c|1024;i=H[e+108>>2]}j=D+(I[(c>>>9&495)+i|0]<<2)|0;f=H[j>>2];g=H[f>>2];b=b-g|0;Hh:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[f+4>>2];if(b&32768){break Hh}i=H[f+4>>2];g=b>>>0>>0;H[j>>2]=H[f+(g?12:8)>>2];while(1){Ih:{if(h){break Ih}f=H[e+16>>2];l=f+1|0;m=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(m<<8)+d|0;break Ih}if(m>>>0<=143){H[e+16>>2]=l;d=(m<<9)+d|0;h=7;break Ih}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!i:i;break Hh}i=H[f+4>>2];l=b>>>0>>0;H[j>>2]=H[f+(l?8:12)>>2];while(1){Jh:{if(h){break Jh}f=H[e+16>>2];b=f+1|0;m=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(m<<8)+d|0;break Jh}if(m>>>0<=143){H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break Jh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?i:!i}if(!l){break Gg}}t=k-4|0;o=H[k+4>>2]>>>26&4|(H[t>>2]>>>28&1|(c>>>21&16|(c>>>25&64|c>>>9&170)));j=D+(I[o+24384|0]<<2)|0;i=H[j>>2];g=H[i>>2];b=b-g|0}Y=p+w|0;Kh:{if(d>>>16>>>0>=g>>>0){d=d-(g<<16)|0;l=H[i+4>>2];if(b&32768){break Kh}m=H[i+4>>2];g=b>>>0>>0;H[j>>2]=H[(g?12:8)+i>>2];while(1){Lh:{if(h){break Lh}f=H[e+16>>2];l=f+1|0;i=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=l;h=8;d=(i<<8)+d|0;break Lh}if(i>>>0<=143){H[e+16>>2]=l;d=(i<<9)+d|0;h=7;break Lh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}l=g?!m:m;break Kh}m=H[i+4>>2];l=b>>>0>>0;H[j>>2]=H[(l?8:12)+i>>2];while(1){Mh:{if(h){break Mh}f=H[e+16>>2];b=f+1|0;i=I[f+1|0];if(I[f|0]!=255){H[e+16>>2]=b;h=8;d=(i<<8)+d|0;break Mh}if(i>>>0<=143){H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break Mh}H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;l=l?m:!m}g=I[o+24640|0];H[Y>>2]=(l|0)==(g|0)?A:s;H[t>>2]=H[t>>2]|16384;H[k+4>>2]=H[k+4>>2]|4096;f=k+(H[e+124>>2]<<2)|0;H[f+4>>2]=H[f+4>>2]|4;H[f+12>>2]=H[f+12>>2]|1;g=g^l;H[f+8>>2]=H[f+8>>2]|g<<18|2;c=g<<28|c|8192}H[k>>2]=c&-1226833921}c=k+4|0;p=p+4|0;v=v+1|0;if((X|0)!=(v|0)){continue}break}c=k+12|0;p=p+w|0;r=r+4|0;g=H[e+128>>2];if(r>>>0<(g&-4)>>>0){continue}break}break Eg}c=(g&-4)-1|0;r=(c&-4)+4|0;c=(l+(c<<1&-8)|0)+20|0}H[e+8>>2]=h;H[e+4>>2]=b;H[e>>2]=d;H[e+104>>2]=j;if(!X|g>>>0<=r>>>0){break je}while(1){h=0;if(H[e+128>>2]!=(r|0)){while(1){gc(e,c,(N(h,X)<<2)+p|0,A,h,0);h=h+1|0;if(h>>>0>2]-r>>>0){continue}break}}H[c>>2]=H[c>>2]&-1226833921;p=p+4|0;c=c+4|0;M=M+1|0;if((X|0)!=(M|0)){continue}break}break je}while(1){u=0;while(1){k=c;f=g;g=H[g>>2];Nh:{Oh:{Ph:{if(!g){j=H[l>>2];g=H[j>>2];b=b-g|0;Qh:{if(d>>>16>>>0>>0){n=H[j+4>>2];c=b>>>0>>0;H[l>>2]=H[j+(c?8:12)>>2];while(1){Rh:{if(h){break Rh}j=H[e+16>>2];b=j+1|0;p=I[j+1|0];if(I[j|0]==255){if(p>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Rh}H[e+16>>2]=b;d=(p<<9)+d|0;h=7;break Rh}H[e+16>>2]=b;h=8;d=(p<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;c=c?n:!n;break Qh}d=d-(g<<16)|0;if(!(b&32768)){n=H[j+4>>2];c=b>>>0>>0;H[l>>2]=H[j+(c?12:8)>>2];while(1){Sh:{if(h){break Sh}j=H[e+16>>2];g=j+1|0;p=I[j+1|0];if(I[j|0]==255){if(p>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Sh}H[e+16>>2]=g;d=(p<<9)+d|0;h=7;break Sh}H[e+16>>2]=g;h=8;d=(p<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!n:n;break Qh}c=H[j+4>>2]}if(!c){j=l;break Nh}c=H[q>>2];g=H[c>>2];b=b-g|0;Th:{if(d>>>16>>>0>>0){p=H[c+4>>2];j=b>>>0>>0;c=H[(j?8:12)+c>>2];H[q>>2]=c;while(1){Uh:{if(h){break Uh}n=H[e+16>>2];b=n+1|0;i=I[n+1|0];if(I[n|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Uh}H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break Uh}H[e+16>>2]=b;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;n=j?p:!p;break Th}d=d-(g<<16)|0;if(!(b&32768)){p=H[c+4>>2];g=b>>>0>>0;c=H[(g?12:8)+c>>2];H[q>>2]=c;while(1){Vh:{if(h){break Vh}n=H[e+16>>2];j=n+1|0;i=I[n+1|0];if(I[n|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Vh}H[e+16>>2]=j;d=(i<<9)+d|0;h=7;break Vh}H[e+16>>2]=j;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=g?!p:p;break Th}n=H[c+4>>2]}g=H[c>>2];b=b-g|0;Wh:{if(d>>>16>>>0>>0){p=H[c+4>>2];j=c;c=b>>>0>>0;H[q>>2]=H[j+(c?8:12)>>2];while(1){Xh:{if(h){break Xh}j=H[e+16>>2];b=j+1|0;i=I[j+1|0];if(I[j|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Xh}H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break Xh}H[e+16>>2]=b;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;c=c?p:!p;break Wh}d=d-(g<<16)|0;if(!(b&32768)){p=H[c+4>>2];j=c;c=b>>>0>>0;H[q>>2]=H[j+(c?12:8)>>2];while(1){Yh:{if(h){break Yh}j=H[e+16>>2];g=j+1|0;i=I[j+1|0];if(I[j|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Yh}H[e+16>>2]=g;d=(i<<9)+d|0;h=7;break Yh}H[e+16>>2]=g;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!p:p;break Wh}c=H[c+4>>2]}g=0;j=q;Zh:{_h:{$h:{ai:{bi:{switch(c|n<<1){case 0:i=f-4|0;j=H[f+4>>2]>>>17&4|H[i>>2]>>>19&1;c=s+(I[j+24384|0]<<2)|0;n=H[c>>2];g=H[n>>2];b=b-g|0;ci:{if(d>>>16>>>0>>0){p=H[n+4>>2];A=c;c=b>>>0>>0;H[A>>2]=H[n+(c?8:12)>>2];while(1){di:{if(h){break di}n=H[e+16>>2];b=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break di}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break di}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;g=c?p:!p;break ci}d=d-(g<<16)|0;if(!(b&32768)){p=H[n+4>>2];A=c;c=b>>>0>>0;H[A>>2]=H[n+(c?12:8)>>2];while(1){ei:{if(h){break ei}n=H[e+16>>2];g=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break ei}H[e+16>>2]=g;d=(m<<9)+d|0;h=7;break ei}H[e+16>>2]=g;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}g=c?!p:p;break ci}g=H[n+4>>2]}c=I[j+24640|0];H[k>>2]=(g|0)==(c|0)?v:w;H[i>>2]=H[i>>2]|32;H[f+4>>2]=H[f+4>>2]|8;j=(c^g)<<19;i=H[e+108>>2];c=s+(I[i+2|0]<<2)|0;n=H[c>>2];g=H[n>>2];b=b-g|0;fi:{if(d>>>16>>>0>>0){p=H[n+4>>2];A=c;c=b>>>0>>0;H[A>>2]=H[n+(c?8:12)>>2];while(1){gi:{if(h){break gi}n=H[e+16>>2];b=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break gi}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break gi}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;g=g<<1;if(g>>>0<32768){continue}break}b=g;c=c?p:!p;break fi}d=d-(g<<16)|0;if(!(b&32768)){p=H[n+4>>2];A=c;c=b>>>0>>0;H[A>>2]=H[n+(c?12:8)>>2];while(1){hi:{if(h){break hi}n=H[e+16>>2];g=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break hi}H[e+16>>2]=g;d=(m<<9)+d|0;h=7;break hi}H[e+16>>2]=g;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!p:p;break fi}c=H[n+4>>2]}g=j|16;if(!c){break ai}break;case 1:break bi;case 2:break $h;case 3:break Zh;default:break Oh}}m=f-4|0;n=H[f+4>>2]>>>20&4|(H[m>>2]>>>22&1|(g>>>15&16|(g>>>19&64|g>>>3&170)));j=s+(I[n+24384|0]<<2)|0;p=H[j>>2];c=H[p>>2];b=b-c|0;ii:{if(d>>>16>>>0>>0){i=H[p+4>>2];A=j;j=b>>>0>>0;H[A>>2]=H[p+(j?8:12)>>2];while(1){ji:{if(h){break ji}p=H[e+16>>2];b=p+1|0;o=I[p+1|0];if(I[p|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break ji}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break ji}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;j=j?i:!i;break ii}d=d-(c<<16)|0;if(!(b&32768)){i=H[p+4>>2];c=b>>>0>>0;H[j>>2]=H[p+(c?12:8)>>2];while(1){ki:{if(h){break ki}p=H[e+16>>2];j=p+1|0;o=I[p+1|0];if(I[p|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break ki}H[e+16>>2]=j;d=(o<<9)+d|0;h=7;break ki}H[e+16>>2]=j;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}j=c?!i:i;break ii}j=H[p+4>>2]}c=I[n+24640|0];H[k+256>>2]=(j|0)==(c|0)?v:w;H[m>>2]=H[m>>2]|256;H[f+4>>2]=H[f+4>>2]|64;i=H[e+108>>2];g=(c^j)<<22|g|128}j=s+(I[(g>>>6&495)+i|0]<<2)|0;n=H[j>>2];c=H[n>>2];b=b-c|0;li:{if(d>>>16>>>0>>0){p=H[n+4>>2];A=j;j=b>>>0>>0;H[A>>2]=H[n+(j?8:12)>>2];while(1){mi:{if(h){break mi}n=H[e+16>>2];b=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break mi}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break mi}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=j?p:!p;break li}d=d-(c<<16)|0;if(!(b&32768)){p=H[n+4>>2];c=b>>>0>>0;H[j>>2]=H[n+(c?12:8)>>2];while(1){ni:{if(h){break ni}n=H[e+16>>2];j=n+1|0;m=I[n+1|0];if(I[n|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break ni}H[e+16>>2]=j;d=(m<<9)+d|0;h=7;break ni}H[e+16>>2]=j;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!p:p;break li}c=H[n+4>>2]}if(!c){break _h}}m=f-4|0;n=H[f+4>>2]>>>23&4|(H[m>>2]>>>25&1|(g>>>18&16|(g>>>22&64|g>>>6&170)));j=s+(I[n+24384|0]<<2)|0;p=H[j>>2];c=H[p>>2];b=b-c|0;oi:{if(d>>>16>>>0>>0){i=H[p+4>>2];A=j;j=b>>>0>>0;H[A>>2]=H[p+(j?8:12)>>2];while(1){pi:{if(h){break pi}p=H[e+16>>2];b=p+1|0;o=I[p+1|0];if(I[p|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break pi}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break pi}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;j=j?i:!i;break oi}d=d-(c<<16)|0;if(!(b&32768)){i=H[p+4>>2];c=b>>>0>>0;H[j>>2]=H[p+(c?12:8)>>2];while(1){qi:{if(h){break qi}p=H[e+16>>2];j=p+1|0;o=I[p+1|0];if(I[p|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break qi}H[e+16>>2]=j;d=(o<<9)+d|0;h=7;break qi}H[e+16>>2]=j;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}j=c?!i:i;break oi}j=H[p+4>>2]}c=I[n+24640|0];H[k+512>>2]=(j|0)==(c|0)?v:w;H[m>>2]=H[m>>2]|2048;H[f+4>>2]=H[f+4>>2]|512;g=(c^j)<<25|g|1024;i=H[e+108>>2]}j=s+(I[(g>>>9&495)+i|0]<<2)|0;p=H[j>>2];c=H[p>>2];b=b-c|0;ri:{if(d>>>16>>>0>>0){i=H[p+4>>2];n=b>>>0>>0;H[j>>2]=H[p+(n?8:12)>>2];while(1){si:{if(h){break si}p=H[e+16>>2];b=p+1|0;m=I[p+1|0];if(I[p|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break si}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break si}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?i:!i;break ri}d=d-(c<<16)|0;if(!(b&32768)){i=H[p+4>>2];c=b>>>0>>0;H[j>>2]=H[p+(c?12:8)>>2];while(1){ti:{if(h){break ti}p=H[e+16>>2];n=p+1|0;m=I[p+1|0];if(I[p|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break ti}H[e+16>>2]=n;d=(m<<9)+d|0;h=7;break ti}H[e+16>>2]=n;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!i:i;break ri}c=H[p+4>>2]}if(!c){break Oh}}M=f-4|0;t=H[f+4>>2]>>>26&4|(H[M>>2]>>>28&1|(g>>>21&16|(g>>>25&64|g>>>9&170)));j=s+(I[t+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;break Ph}ui:{if(g&2097168){break ui}j=s+(I[H[e+108>>2]+(g&495)|0]<<2)|0;p=H[j>>2];c=H[p>>2];b=b-c|0;vi:{if(d>>>16>>>0>>0){i=H[p+4>>2];n=b>>>0>>0;H[j>>2]=H[p+(n?8:12)>>2];while(1){wi:{if(h){break wi}p=H[e+16>>2];b=p+1|0;m=I[p+1|0];if(I[p|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break wi}H[e+16>>2]=b;d=(m<<9)+d|0;h=7;break wi}H[e+16>>2]=b;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?i:!i;break vi}d=d-(c<<16)|0;if(!(b&32768)){i=H[p+4>>2];c=b>>>0>>0;H[j>>2]=H[p+(c?12:8)>>2];while(1){xi:{if(h){break xi}p=H[e+16>>2];n=p+1|0;m=I[p+1|0];if(I[p|0]==255){if(m>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break xi}H[e+16>>2]=n;d=(m<<9)+d|0;h=7;break xi}H[e+16>>2]=n;h=8;d=(m<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!i:i;break vi}c=H[p+4>>2]}if(!c){break ui}o=f-4|0;p=H[f+4>>2]>>>17&4|(H[o>>2]>>>19&1|(g>>>14&16|(g>>>16&64|g&170)));j=s+(I[p+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;yi:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){zi:{if(h){break zi}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break zi}H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break zi}H[e+16>>2]=b;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;n=n?m:!m;break yi}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){Ai:{if(h){break Ai}i=H[e+16>>2];n=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ai}H[e+16>>2]=n;d=(t<<9)+d|0;h=7;break Ai}H[e+16>>2]=n;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=c?!m:m;break yi}n=H[i+4>>2]}c=I[p+24640|0];H[k>>2]=(n|0)==(c|0)?v:w;H[o>>2]=H[o>>2]|32;H[f+4>>2]=H[f+4>>2]|8;g=(c^n)<<19|g|16}Bi:{if(g&16777344){break Bi}p=g>>>3|0;j=s+(I[H[e+108>>2]+(p&495)|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;Ci:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){Di:{if(h){break Di}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Di}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Di}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?m:!m;break Ci}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){Ei:{if(h){break Ei}i=H[e+16>>2];n=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ei}H[e+16>>2]=n;d=(o<<9)+d|0;h=7;break Ei}H[e+16>>2]=n;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!m:m;break Ci}c=H[i+4>>2]}if(!c){break Bi}o=f-4|0;p=H[f+4>>2]>>>20&4|(H[o>>2]>>>22&1|(g>>>15&16|(g>>>19&64|p&170)));j=s+(I[p+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;Fi:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){Gi:{if(h){break Gi}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Gi}H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break Gi}H[e+16>>2]=b;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;n=n?m:!m;break Fi}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){Hi:{if(h){break Hi}i=H[e+16>>2];n=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Hi}H[e+16>>2]=n;d=(t<<9)+d|0;h=7;break Hi}H[e+16>>2]=n;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=c?!m:m;break Fi}n=H[i+4>>2]}c=I[p+24640|0];H[k+256>>2]=(n|0)==(c|0)?v:w;H[o>>2]=H[o>>2]|256;H[f+4>>2]=H[f+4>>2]|64;g=(c^n)<<22|g|128}Ii:{if(g&134218752){break Ii}p=g>>>6|0;j=s+(I[H[e+108>>2]+(p&495)|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;Ji:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){Ki:{if(h){break Ki}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ki}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Ki}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?m:!m;break Ji}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){Li:{if(h){break Li}i=H[e+16>>2];n=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Li}H[e+16>>2]=n;d=(o<<9)+d|0;h=7;break Li}H[e+16>>2]=n;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!m:m;break Ji}c=H[i+4>>2]}if(!c){break Ii}o=f-4|0;p=H[f+4>>2]>>>23&4|(H[o>>2]>>>25&1|(g>>>18&16|(g>>>22&64|p&170)));j=s+(I[p+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;Mi:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){Ni:{if(h){break Ni}i=H[e+16>>2];b=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ni}H[e+16>>2]=b;d=(t<<9)+d|0;h=7;break Ni}H[e+16>>2]=b;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;n=n?m:!m;break Mi}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){Oi:{if(h){break Oi}i=H[e+16>>2];n=i+1|0;t=I[i+1|0];if(I[i|0]==255){if(t>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Oi}H[e+16>>2]=n;d=(t<<9)+d|0;h=7;break Oi}H[e+16>>2]=n;h=8;d=(t<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=c?!m:m;break Mi}n=H[i+4>>2]}c=I[p+24640|0];H[k+512>>2]=(n|0)==(c|0)?v:w;H[o>>2]=H[o>>2]|2048;H[f+4>>2]=H[f+4>>2]|512;g=(c^n)<<25|g|1024}if(g&1073750016){break Oh}p=g>>>9|0;j=s+(I[H[e+108>>2]+(p&495)|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0;Pi:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[i+(n?8:12)>>2];while(1){Qi:{if(h){break Qi}i=H[e+16>>2];b=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Qi}H[e+16>>2]=b;d=(o<<9)+d|0;h=7;break Qi}H[e+16>>2]=b;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;c=n?m:!m;break Pi}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[i+(c?12:8)>>2];while(1){Ri:{if(h){break Ri}i=H[e+16>>2];n=i+1|0;o=I[i+1|0];if(I[i|0]==255){if(o>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ri}H[e+16>>2]=n;d=(o<<9)+d|0;h=7;break Ri}H[e+16>>2]=n;h=8;d=(o<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}c=c?!m:m;break Pi}c=H[i+4>>2]}if(!c){break Oh}M=f-4|0;t=H[f+4>>2]>>>26&4|(H[M>>2]>>>28&1|(g>>>21&16|(g>>>25&64|p&170)));j=s+(I[t+24384|0]<<2)|0;i=H[j>>2];c=H[i>>2];b=b-c|0}Si:{if(d>>>16>>>0>>0){m=H[i+4>>2];n=b>>>0>>0;H[j>>2]=H[(n?8:12)+i>>2];while(1){Ti:{if(h){break Ti}p=H[e+16>>2];b=p+1|0;i=I[p+1|0];if(I[p|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ti}H[e+16>>2]=b;d=(i<<9)+d|0;h=7;break Ti}H[e+16>>2]=b;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;c=c<<1;if(c>>>0<32768){continue}break}b=c;n=n?m:!m;break Si}d=d-(c<<16)|0;if(!(b&32768)){m=H[i+4>>2];c=b>>>0>>0;H[j>>2]=H[(c?12:8)+i>>2];while(1){Ui:{if(h){break Ui}p=H[e+16>>2];n=p+1|0;i=I[p+1|0];if(I[p|0]==255){if(i>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;d=d+65280|0;h=8;break Ui}H[e+16>>2]=n;d=(i<<9)+d|0;h=7;break Ui}H[e+16>>2]=n;h=8;d=(i<<8)+d|0}h=h-1|0;d=d<<1;b=b<<1;if(b>>>0<32768){continue}break}n=c?!m:m;break Si}n=H[i+4>>2]}c=I[t+24640|0];H[k+768>>2]=(n|0)==(c|0)?v:w;H[M>>2]=H[M>>2]|16384;H[f+4>>2]=H[f+4>>2]|4096;H[f+260>>2]=H[f+260>>2]|4;H[f+268>>2]=H[f+268>>2]|1;c=c^n;H[f+264>>2]=H[f+264>>2]|c<<18|2;g=c<<28|g|8192}H[f>>2]=g&-1226833921}g=f+4|0;c=k+4|0;u=u+1|0;if((u|0)!=64){continue}break}g=f+12|0;c=k+772|0;n=r>>>0<60;r=r+4|0;if(n){continue}break}}H[e+8>>2]=h;H[e+4>>2]=b;H[e>>2]=d;H[e+104>>2]=j}Vi:{if(!(Z&32)){break Vi}H[e+104>>2]=e+100;g=H[e+100>>2];b=H[g>>2];d=H[e+4>>2]-b|0;H[e+4>>2]=d;h=H[e>>2];Wi:{if(h>>>16>>>0>>0){H[e+4>>2]=b;g=H[(b>>>0>d>>>0?8:12)+g>>2];H[e+100>>2]=g;d=H[e+8>>2];while(1){Xi:{if(d){break Xi}l=H[e+16>>2];c=l+1|0;j=I[l+1|0];if(I[l|0]==255){if(j>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;h=h+65280|0;d=8;break Xi}H[e+16>>2]=c;h=(j<<9)+h|0;d=7;break Xi}H[e+16>>2]=c;d=8;h=(j<<8)+h|0}d=d-1|0;H[e+8>>2]=d;h=h<<1;H[e>>2]=h;b=b<<1;H[e+4>>2]=b;if(b>>>0<32768){continue}break}d=b;break Wi}h=h-(b<<16)|0;H[e>>2]=h;if(d&32768){break Wi}g=H[(b>>>0>d>>>0?12:8)+g>>2];H[e+100>>2]=g;b=H[e+8>>2];while(1){Yi:{if(b){break Yi}c=H[e+16>>2];b=c+1|0;l=I[c+1|0];if(I[c|0]==255){if(l>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;h=h+65280|0;b=8;break Yi}H[e+16>>2]=b;h=(l<<9)+h|0;b=7;break Yi}H[e+16>>2]=b;b=8;h=(l<<8)+h|0}b=b-1|0;H[e+8>>2]=b;h=h<<1;H[e>>2]=h;d=d<<1;H[e+4>>2]=d;if(d>>>0<32768){continue}break}}b=H[g>>2];d=d-b|0;H[e+4>>2]=d;Zi:{if(h>>>16>>>0>>0){H[e+4>>2]=b;g=H[(b>>>0>d>>>0?8:12)+g>>2];H[e+100>>2]=g;d=H[e+8>>2];while(1){_i:{if(d){break _i}l=H[e+16>>2];c=l+1|0;j=I[l+1|0];if(I[l|0]==255){if(j>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;h=h+65280|0;d=8;break _i}H[e+16>>2]=c;h=(j<<9)+h|0;d=7;break _i}H[e+16>>2]=c;d=8;h=(j<<8)+h|0}d=d-1|0;H[e+8>>2]=d;h=h<<1;H[e>>2]=h;b=b<<1;H[e+4>>2]=b;if(b>>>0<32768){continue}break}d=b;break Zi}h=h-(b<<16)|0;H[e>>2]=h;if(d&32768){break Zi}g=H[(b>>>0>d>>>0?12:8)+g>>2];H[e+100>>2]=g;b=H[e+8>>2];while(1){$i:{if(b){break $i}c=H[e+16>>2];b=c+1|0;l=I[c+1|0];if(I[c|0]==255){if(l>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;h=h+65280|0;b=8;break $i}H[e+16>>2]=b;h=(l<<9)+h|0;b=7;break $i}H[e+16>>2]=b;b=8;h=(l<<8)+h|0}b=b-1|0;H[e+8>>2]=b;h=h<<1;H[e>>2]=h;d=d<<1;H[e+4>>2]=d;if(d>>>0<32768){continue}break}}b=H[g>>2];d=d-b|0;H[e+4>>2]=d;aj:{if(h>>>16>>>0>>0){H[e+4>>2]=b;g=H[(b>>>0>d>>>0?8:12)+g>>2];H[e+100>>2]=g;d=H[e+8>>2];while(1){bj:{if(d){break bj}l=H[e+16>>2];c=l+1|0;j=I[l+1|0];if(I[l|0]==255){if(j>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;h=h+65280|0;d=8;break bj}H[e+16>>2]=c;h=(j<<9)+h|0;d=7;break bj}H[e+16>>2]=c;d=8;h=(j<<8)+h|0}d=d-1|0;H[e+8>>2]=d;h=h<<1;H[e>>2]=h;b=b<<1;H[e+4>>2]=b;if(b>>>0<32768){continue}break}d=b;break aj}h=h-(b<<16)|0;H[e>>2]=h;if(d&32768){break aj}g=H[(b>>>0>d>>>0?12:8)+g>>2];H[e+100>>2]=g;b=H[e+8>>2];while(1){cj:{if(b){break cj}c=H[e+16>>2];b=c+1|0;l=I[c+1|0];if(I[c|0]==255){if(l>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;h=h+65280|0;b=8;break cj}H[e+16>>2]=b;h=(l<<9)+h|0;b=7;break cj}H[e+16>>2]=b;b=8;h=(l<<8)+h|0}b=b-1|0;H[e+8>>2]=b;h=h<<1;H[e>>2]=h;d=d<<1;H[e+4>>2]=d;if(d>>>0<32768){continue}break}}b=H[g>>2];d=d-b|0;H[e+4>>2]=d;if(h>>>16>>>0>>0){H[e+4>>2]=b;H[e+100>>2]=H[(b>>>0>d>>>0?8:12)+g>>2];d=H[e+8>>2];while(1){dj:{if(d){break dj}g=H[e+16>>2];c=g+1|0;l=I[g+1|0];if(I[g|0]==255){if(l>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;h=h+65280|0;d=8;break dj}H[e+16>>2]=c;h=(l<<9)+h|0;d=7;break dj}H[e+16>>2]=c;d=8;h=(l<<8)+h|0}d=d-1|0;H[e+8>>2]=d;h=h<<1;H[e>>2]=h;b=b<<1;H[e+4>>2]=b;if(b>>>0<32768){continue}break}break Vi}c=h-(b<<16)|0;H[e>>2]=c;if(d&32768){break Vi}H[e+100>>2]=H[(b>>>0>d>>>0?12:8)+g>>2];h=H[e+8>>2];while(1){ej:{if(h){break ej}g=H[e+16>>2];b=g+1|0;l=I[g+1|0];if(I[g|0]==255){if(l>>>0>=144){H[e+12>>2]=H[e+12>>2]+1;c=c+65280|0;h=8;break ej}H[e+16>>2]=b;c=(l<<9)+c|0;h=7;break ej}H[e+16>>2]=b;h=8;c=(l<<8)+c|0}h=h-1|0;H[e+8>>2]=h;c=c<<1;H[e>>2]=c;d=d<<1;H[e+4>>2]=d;if(d>>>0<32768){continue}break}}}if(!P){break Za}ic(e);_a(e,18,46);_a(e,17,3);_a(e,0,4)}b=_+1|0;c=(b|0)==3;_=c?0:b;z=z-c|0;T=T+1|0;if(T>>>0>=K[ma+8>>2]){break Ya}if((z|0)>0){continue}break}}U=x+U|0;c=H[e+24>>2];b=J[e+112>>1];F[c|0]=b;F[c+1|0]=b>>>8;S=S+1|0;if(S>>>0>2]){continue}break}}fj:{if(!W){break fj}gj:{c=H[e+24>>2];g=H[e+16>>2];if(c>>>0>g+2>>>0){if(!ba){break gj}g=H[e+16>>2];c=H[e+24>>2];b=H[e+20>>2];H[aa+56>>2]=c-b;H[aa+52>>2]=g-b;H[aa+48>>2]=(c-g|0)-2;Ca(R,2,15235,aa+48|0);break fj}b=H[e+12>>2];if(b>>>0<3){break fj}if(ba){H[aa+80>>2]=H[e+12>>2];Ca(R,2,7107,aa+80|0);break fj}H[aa+64>>2]=b;Ca(R,2,7107,aa- -64|0);break fj}b=H[e+20>>2];H[aa+40>>2]=c-b;H[aa+36>>2]=g-b;H[aa+32>>2]=(c-g|0)-2;Ca(R,2,15235,aa+32|0)}if(!H[E+60>>2]){break i}H[e+116>>2]=$}l=H[ta+4>>2];g=H[E+12>>2];m=H[E+8>>2]-H[ta>>2]|0;c=H[ta+16>>2];if(c&1){b=H[qa+28>>2]+N(va,152)|0;m=(H[b-144>>2]+m|0)-H[b-152>>2]|0}j=g-l|0;if(c&2){b=H[qa+28>>2]+N(va,152)|0;j=(H[b-140>>2]+j|0)-H[b-148>>2]|0}k=H[E+60>>2];i=k;i=i?i:H[e+116>>2];o=H[e+128>>2];P=H[e+124>>2];n=H[ra+808>>2];hj:{if(!n){break hj}b=!o|!P;if((n|0)<=30){if(b){break hj}h=0;while(1){l=(N(h,P)<<2)+i|0;b=0;while(1){g=l+(b<<2)|0;q=H[g>>2];c=q>>31;c=(c^q)-c|0;if(c>>>n|0){c=c>>>H[ra+808>>2]|0;H[g>>2]=(q|0)<0?0-c|0:c}b=b+1|0;if((P|0)!=(b|0)){continue}break}h=h+1|0;if((o|0)!=(h|0)){continue}break}break hj}if(b){break hj}b=N(o,P)<<2;if(!b){break hj}y(i,0,b)}if(k){q=N(o,P);if(H[ra+20>>2]==1){if(!q){break a}b=0;if((q|0)!=1){j=i+4|0;l=q&-2;e=0;while(1){g=b<<2;c=g+i|0;H[c>>2]=H[c>>2]/2;c=g+j|0;H[c>>2]=H[c>>2]/2;b=b+2|0;e=e+2|0;if((l|0)!=(e|0)){continue}break}}if(!(q&1)){break a}b=(b<<2)+i|0;H[b>>2]=H[b>>2]/2;break a}if(!q){break a}ga=O(L[ta+32>>2]*O(.5));if(q>>>0>=4){c=q&-4;b=0;while(1){L[i>>2]=ga*O(H[i>>2]);L[i+4>>2]=ga*O(H[i+4>>2]);L[i+8>>2]=ga*O(H[i+8>>2]);L[i+12>>2]=ga*O(H[i+12>>2]);i=i+16|0;b=b+4|0;if((c|0)!=(b|0)){continue}break}}c=q&3;if(!c){break a}b=0;while(1){L[i>>2]=ga*O(H[i>>2]);i=i+4|0;b=b+1|0;if((c|0)!=(b|0)){continue}break}break a}r=xa-wa|0;if(H[ra+20>>2]==1){if(!o){break a}f=(H[qa+36>>2]+(N(j,r)<<2)|0)+(m<<2)|0;d=P&-4;j=0;while(1){b=0;if(d){k=f+(N(j,r)<<2)|0;n=(N(j,P)<<2)+i|0;while(1){q=b<<2;p=q+n|0;l=H[p+4>>2];g=H[p+8>>2];c=H[p+12>>2];q=k+q|0;H[q>>2]=H[p>>2]/2;H[q+12>>2]=(c|0)/2;H[q+8>>2]=(g|0)/2;H[q+4>>2]=(l|0)/2;b=b+4|0;if(d>>>0>b>>>0){continue}break}}ij:{if(b>>>0>=P>>>0){break ij}c=b+1|0;l=f+(N(j,r)<<2)|0;g=(N(j,P)<<2)+i|0;if(P-b&1){b=b<<2;H[b+l>>2]=H[b+g>>2]/2;b=c}if((c|0)==(P|0)){break ij}while(1){c=b<<2;H[c+l>>2]=H[c+g>>2]/2;c=c+4|0;H[c+l>>2]=H[c+g>>2]/2;b=b+2|0;if((P|0)!=(b|0)){continue}break}}j=j+1|0;if((o|0)!=(j|0)){continue}break}break a}if(!o|!P){break a}ga=O(L[ta+32>>2]*O(.5));j=(H[qa+36>>2]+(N(j,r)<<2)|0)+(m<<2)|0;g=P&-4;l=P&3;f=0;c=P-1>>>0<3;while(1){b=j;e=0;if(!c){while(1){L[b>>2]=ga*O(H[i>>2]);L[b+4>>2]=ga*O(H[i+4>>2]);L[b+8>>2]=ga*O(H[i+8>>2]);L[b+12>>2]=ga*O(H[i+12>>2]);b=b+16|0;i=i+16|0;e=e+4|0;if((g|0)!=(e|0)){continue}break}}e=0;if(l){while(1){L[b>>2]=ga*O(H[i>>2]);b=b+4|0;i=i+4|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}j=(r<<2)+j|0;f=f+1|0;if((o|0)!=(f|0)){continue}break}break a}H[aa>>2]=z;Ca(R,2,8716,aa)}H[H[d>>2]>>2]=0}Da(a);oa=aa+96|0} +function gb(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,z=0,A=0,C=0,D=0,E=0,J=0,M=0,Q=0,R=0,S=0,V=0,W=0,X=0,Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=O(0),ia=0,ja=0,ka=0,la=0,ma=0,na=0,pa=0,qa=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ha=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ta=0,Va=0,Ya=0,Za=0,_a=0,$a=0,bb=0,cb=0,db=0,eb=O(0),fb=O(0),gb=0,jb=0,kb=0,lb=0,nb=0,ob=0,pb=0,sb=O(0),tb=0;Za=oa-16|0;oa=Za;a:{if(!(I[a+8|0]&128)|H[a+228>>2]!=(b|0)){break a}Ya=H[a+180>>2]+N(b,5644)|0;q=H[Ya+5596>>2];if(!q){mb(Ya);break a}j=H[a+100>>2];if(!j){j=H[a+96>>2]}k=H[j>>2];g=H[j+4>>2];r=H[j+8>>2];i=H[j+12>>2];m=H[a+60>>2];l=H[a+64>>2];j=H[Ya+5600>>2];Ha=oa-16|0;oa=Ha;R=H[a+232>>2];H[R+36>>2]=b;h=H[H[R+28>>2]+76>>2];H[R+64>>2]=1;H[R+60>>2]=i;H[R+56>>2]=r;H[R+52>>2]=g;H[R+48>>2]=k;H[R+32>>2]=h+N(b,5644);Da(H[R+68>>2]);r=0;H[R+68>>2]=0;b:{if(m){r=Fa(4,H[H[R+24>>2]+16>>2]);if(!r){break b}if(m>>>0>=4){k=l+12|0;g=l+8|0;i=l+4|0;h=m&-4;b=0;while(1){o=$<<2;H[(H[o+l>>2]<<2)+r>>2]=1;H[(H[i+o>>2]<<2)+r>>2]=1;H[(H[g+o>>2]<<2)+r>>2]=1;H[(H[k+o>>2]<<2)+r>>2]=1;$=$+4|0;b=b+4|0;if((h|0)!=(b|0)){continue}break}}b=m&3;if(b){while(1){H[(H[l+($<<2)>>2]<<2)+r>>2]=1;$=$+1|0;E=E+1|0;if((b|0)!=(E|0)){continue}break}}H[R+68>>2]=r}c:{t=H[R+24>>2];ia=H[t+16>>2];d:{if(!ia){break d}$=0;e:{while(1){f:{if(H[($<<2)+r>>2]?0:r){break f}g=H[t+24>>2]+N($,52)|0;p=H[g+4>>2];o=p-1|0;i=H[R+60>>2];h=o+i|0;l=0-!p|0;b=l;k=Ke(h,h>>>0>>0?b+1|0:b,p,0);s=H[g>>2];g=s-1|0;i=H[R+56>>2];h=g+i|0;m=0-!s|0;b=m;i=Ke(h,h>>>0>>0?b+1|0:b,s,0);h=H[R+52>>2];b=h+o|0;o=Ke(b,b>>>0>>0?l+1|0:l,p,0);p=H[H[H[R+20>>2]>>2]+20>>2]+N($,76)|0;l=H[p+20>>2]-H[p+24>>2]|0;if(l>>>0>31){break f}h=H[R+48>>2];b=h+g|0;h=Ke(b,b>>>0>>0?m+1|0:m,s,0);b=h-H[p>>2]|0;g:{if((b>>>0<=h>>>0?b:0)>>>l|0){break g}b=o-H[p+4>>2]|0;if((b>>>0<=o>>>0?b:0)>>>l|0){break g}h=H[p+8>>2];b=h-i|0;if((b>>>0<=h>>>0?b:0)>>>l|0){break g}h=H[p+12>>2];b=h-k|0;if(!((b>>>0<=h>>>0?b:0)>>>l|0)){break f}}H[R+64>>2]=0;break e}$=$+1|0;if((ia|0)!=($|0)){continue}break}if(!H[R+64>>2]){break e}E=0;while(1){o=H[H[H[R+20>>2]>>2]+20>>2]+N(E,76)|0;b=H[o+28>>2]+N(H[o+24>>2],152)|0;k=H[b-148>>2];g=H[b-140>>2];r=H[b-152>>2];i=H[b-144>>2];b=H[R+68>>2];h:{if(H[b+(E<<2)>>2]?0:b){break h}h=g-k|0;b=i-r|0;Ie(h,0,b);if(!(!ra|(g|0)==(k|0))){$=0;Ca(f,1,2982,0);break b}b=N(b,h);if(b>>>0>=1073741824){$=0;Ca(f,1,2982,0);break b}h=b<<2;H[o+44>>2]=h;i:{j:{k:{b=H[o+36>>2];if(b){if(h>>>0<=K[o+48>>2]){break h}if(H[o+40>>2]){break k}}b=Ja(h);H[o+36>>2]=b;h=b;b=H[o+44>>2];if(!(b?h:1)){break j}H[o+40>>2]=1;H[o+48>>2]=b;break h}Da(b);b=Ja(H[o+44>>2]);H[o+36>>2]=b;if(b){break i}H[o+48>>2]=0;H[o+40>>2]=0;H[o+44>>2]=0}$=0;Ca(f,1,2982,0);break b}H[o+40>>2]=1;H[o+48>>2]=H[o+44>>2]}E=E+1|0;t=H[R+24>>2];if(E>>>0>2]){continue}break}break d}A=H[t+24>>2];Q=H[H[H[R+20>>2]>>2]+20>>2];b=0;while(1){l:{if(H[(b<<2)+r>>2]?0:r){break l}M=Q+N(b,76)|0;o=H[M>>2];k=A+N(b,52)|0;w=H[k>>2];m=w-1|0;g=H[R+48>>2];i=m+g|0;s=0-!w|0;h=s;h=Ke(i,g>>>0>i>>>0?h+1|0:h,w,0);W=h>>>0>>0?o:h;H[M+56>>2]=W;o=H[M+4>>2];p=H[k+4>>2];k=p-1|0;g=H[R+52>>2];i=k+g|0;l=0-!p|0;h=l;h=Ke(i,g>>>0>i>>>0?h+1|0:h,p,0);z=h>>>0>>0?o:h;H[M+60>>2]=z;g=H[M+8>>2];i=H[R+56>>2];h=i+m|0;h=Ke(h,h>>>0>>0?s+1|0:s,w,0);o=g>>>0>>0?g:h;H[M+64>>2]=o;g=H[M+12>>2];i=H[R+60>>2];h=k+i|0;h=Ke(h,h>>>0>>0?l+1|0:l,p,0);h=g>>>0>>0?g:h;H[M+68>>2]=h;if(o>>>0>>0|h>>>0>>0){break c}ca=H[M+20>>2];if(!ca){break l}X=h-1|0;C=0-!h|0;w=o-1|0;p=0-!o|0;Z=z-1|0;s=0-!z|0;z=W-1|0;m=0-!W|0;o=H[M+28>>2];k=0;i=0;while(1){fa=o+N(k,152)|0;D=ca+(k^-1)|0;g=D&31;if((D&63)>>>0>=32){l=1<>>32-g}M=h;h=X+M|0;g=l+C|0;g=h>>>0>>0?g+1|0:g;W=D&31;if((D&63)>>>0>=32){h=g>>>W|0}else{h=((1<>>W}H[fa+148>>2]=h;h=l+p|0;v=h+1|0;g=h;h=w+M|0;g=h>>>0>>0?v:g;W=D&31;if((D&63)>>>0>=32){h=g>>>W|0}else{h=((1<>>W}H[fa+144>>2]=h;h=l+s|0;v=h+1|0;g=h;h=M+Z|0;g=h>>>0>>0?v:g;W=D&31;if((D&63)>>>0>=32){h=g>>>W|0}else{h=((1<>>W}H[fa+140>>2]=h;h=l+m|0;l=h+1|0;g=h;h=z+M|0;g=h>>>0>>0?l:g;l=D&31;if((D&63)>>>0>=32){h=g>>>l|0}else{h=((1<>>l}H[fa+136>>2]=h;k=k+1|0;i=k?i:i+1|0;if(i|(k|0)!=(ca|0)){continue}break}}b=b+1|0;if((ia|0)!=(b|0)){continue}break}}$=0;H[Ha+8>>2]=0;b=H[R+28>>2];da=Fa(1,8);if(da){H[da+4>>2]=b;H[da>>2]=t}if(!da){break b}m=H[H[R+20>>2]>>2];S=oa-144|0;oa=S;Q=H[R+36>>2];b=N(Q,5644);z=H[da+4>>2];va=b+H[z+76>>2]|0;ia=H[va+420>>2];t=0;g=0;Y=oa-32|0;oa=Y;sa=b+H[z+76>>2]|0;ya=H[sa+420>>2];ja=H[da>>2];ka=H[ja+16>>2];o=Ga(N(ka,528));m:{if(!o){break m}r=Ga(ka<<2);n:{if(!r){r=o;break n}s=H[z+76>>2]+N(Q,5644)|0;p=H[s+420>>2];b=p+1|0;h=Fa(b,240);o:{if(h){p:{if(b){ba=H[ja+16>>2];b=h;while(1){H[b+236>>2]=f;i=Fa(ba,16);H[b+200>>2]=i;if(!i){break p}i=H[ja+16>>2];H[b+196>>2]=i;v=0;ba=0;if(i){while(1){l=H[b+200>>2]+(v<<4)|0;k=H[s+5584>>2]+N(v,1080)|0;i=Fa(H[k+4>>2],16);H[l+12>>2]=i;if(!i){break p}H[l+8>>2]=H[k+4>>2];v=v+1|0;ba=H[ja+16>>2];if(v>>>0>>0){continue}break}}b=b+240|0;i=(n|0)==(p|0);n=n+1|0;if(!i){continue}break}}break o}b=H[h+4>>2];if(b){Da(b);H[h+4>>2]=0}b=h;n=0;while(1){v=H[b+200>>2];if(v){ba=0;k=H[b+196>>2];if(k){while(1){i=H[v+12>>2];if(i){Da(i);H[v+12>>2]=0;k=H[b+196>>2]}v=v+16|0;ba=ba+1|0;if(ba>>>0>>0){continue}break}v=H[b+200>>2]}Da(v);H[b+200>>2]=0}b=b+240|0;i=(n|0)==(p|0);n=n+1|0;if(!i){continue}break}Da(h)}h=0}if(h){q:{if(!ka){break q}b=o;if(ka>>>0>=8){C=r+28|0;w=r+24|0;p=r+20|0;s=r+16|0;l=r+12|0;n=r+8|0;k=r+4|0;i=ka&-8;while(1){A=u<<2;H[A+r>>2]=b;H[k+A>>2]=b+528;H[n+A>>2]=b+1056;H[l+A>>2]=b+1584;H[s+A>>2]=b+2112;H[p+A>>2]=b+2640;H[w+A>>2]=b+3168;H[A+C>>2]=b+3696;u=u+8|0;b=b+4224|0;t=t+8|0;if((i|0)!=(t|0)){continue}break}}i=ka&7;if(!i){break q}while(1){H[(u<<2)+r>>2]=b;u=u+1|0;b=b+528|0;V=V+1|0;if((i|0)!=(V|0)){continue}break}}k=r;n=0;s=H[(H[z+76>>2]+N(Q,5644)|0)+5584>>2];v=H[ja+24>>2];b=H[z+24>>2];r=(Q>>>0)/(b>>>0)|0;i=H[z+4>>2]+N(H[z+12>>2],Q-N(b,r)|0)|0;b=H[ja>>2];H[Y+20>>2]=b>>>0>>0?i:b;b=i+H[z+12>>2]|0;i=b>>>0>>0?-1:b;b=H[ja+8>>2];H[Y+16>>2]=b>>>0>i>>>0?i:b;i=H[z+8>>2]+N(r,H[z+16>>2])|0;b=H[ja+4>>2];H[Y+12>>2]=b>>>0>>0?i:b;b=i+H[z+16>>2]|0;i=b>>>0>>0?-1:b;b=H[ja+12>>2];H[Y+8>>2]=b>>>0>i>>>0?i:b;H[Y+24>>2]=0;H[Y+28>>2]=0;H[Y+4>>2]=2147483647;H[Y>>2]=2147483647;if(H[ja+16>>2]){while(1){r=k?H[k+(n<<2)>>2]:0;Z=H[v+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>>u|0)&-1>>>u:0;b=i+z|0;w=b+1|0;l=b;b=D+_|0;C=b>>>0>>0?w:l;u=V&31;l=pa&31;if((pa&63)>>>0>=32){l=1<>>32-l;w=p}if((V&63)>>>0>=32){p=C>>>u|0}else{p=((1<>>u}b=w+p|0;w=(b>>>0>>0?l+1|0:l)-!b|0;l=b-1|0;C=pa&31;b=i+Q|0;wa=b+1|0;i=b;b=M+_|0;i=b>>>0>>0?wa:i;if((pa&63)>>>0>=32){l=w>>>C|0}else{l=((1<>>C}w=l;l=V&31;if((V&63)>>>0>=32){b=i>>>l|0}else{b=((1<>>l}b=(b|0)!=(p|0)?w-(b>>>pa|0)&-1>>>pa:0;if(ba){H[ba+4>>2]=W;H[ba>>2]=b;r=ba+8|0}b=N(b,W);if(b>>>0>K[Y+24>>2]){H[Y+24>>2]=b}t=t+1|0;if(t>>>0>2]){continue}break}}v=v+52|0;s=s+1080|0;n=n+1|0;if(n>>>0>2]){continue}break}}l=ya+1|0;X=H[Y+28>>2];ca=H[Y+24>>2];H[h+4>>2]=0;b=H[sa+8>>2]+1|0;A=N(ca,ka);Z=N(A,X);Ie(b,0,Z);t:{if(!ra){b=N(b,Z);H[h+8>>2]=b;b=Fa(b,2);H[h+4>>2]=b;if(b){break t}}Da(o);Da(k);b=H[h+4>>2];if(b){Da(b);H[h+4>>2]=0}if(!l){r=h;break n}r=0;t=h;while(1){b=H[t+200>>2];if(b){n=0;u=H[t+196>>2];if(u){while(1){i=H[b+12>>2];if(i){Da(i);H[b+12>>2]=0;u=H[t+196>>2]}b=b+16|0;n=n+1|0;if(u>>>0>n>>>0){continue}break}b=H[t+200>>2]}Da(b);H[t+200>>2]=0}t=t+240|0;b=(r|0)==(ya|0);r=r+1|0;if(!b){continue}break}r=h;break n}g=H[ja+24>>2];Q=H[Y+20>>2];H[h+204>>2]=Q;C=H[Y+12>>2];H[h+208>>2]=C;w=H[Y+16>>2];H[h+212>>2]=w;p=H[Y+8>>2];H[h+216>>2]=p;H[h+12>>2]=Z;H[h+16>>2]=A;H[h+20>>2]=ca;v=1;H[h+24>>2]=1;if(ka){t=H[h+200>>2];s=0;r=g;while(1){b=H[k+(s<<2)>>2];H[t>>2]=H[r>>2];H[t+4>>2]=H[r+4>>2];z=H[t+8>>2];u:{if(!z){break u}n=H[t+12>>2];if((z|0)!=1){i=z&-2;u=0;while(1){H[n>>2]=H[b>>2];H[n+4>>2]=H[b+4>>2];H[n+8>>2]=H[b+8>>2];H[n+12>>2]=H[b+12>>2];H[n+16>>2]=H[b+16>>2];H[n+20>>2]=H[b+20>>2];H[n+24>>2]=H[b+24>>2];H[n+28>>2]=H[b+28>>2];n=n+32|0;b=b+32|0;u=u+2|0;if((i|0)!=(u|0)){continue}break}}if(!(z&1)){break u}H[n>>2]=H[b>>2];H[n+4>>2]=H[b+4>>2];H[n+8>>2]=H[b+8>>2];H[n+12>>2]=H[b+12>>2]}r=r+52|0;t=t+16|0;s=s+1|0;if((ka|0)!=(s|0)){continue}break}}if(l>>>0>1){i=h;while(1){H[i+456>>2]=p;H[i+452>>2]=w;H[i+448>>2]=C;H[i+444>>2]=Q;H[i+264>>2]=1;H[i+260>>2]=ca;H[i+256>>2]=A;H[i+252>>2]=Z;if(ka){t=H[i+440>>2];s=0;r=g;while(1){b=H[k+(s<<2)>>2];H[t>>2]=H[r>>2];H[t+4>>2]=H[r+4>>2];z=H[t+8>>2];v:{if(!z){break v}n=H[t+12>>2];if((z|0)!=1){l=z&-2;u=0;while(1){H[n>>2]=H[b>>2];H[n+4>>2]=H[b+4>>2];H[n+8>>2]=H[b+8>>2];H[n+12>>2]=H[b+12>>2];H[n+16>>2]=H[b+16>>2];H[n+20>>2]=H[b+20>>2];H[n+24>>2]=H[b+24>>2];H[n+28>>2]=H[b+28>>2];n=n+32|0;b=b+32|0;u=u+2|0;if((l|0)!=(u|0)){continue}break}}if(!(z&1)){break v}H[n>>2]=H[b>>2];H[n+4>>2]=H[b+4>>2];H[n+8>>2]=H[b+8>>2];H[n+12>>2]=H[b+12>>2]}r=r+52|0;t=t+16|0;s=s+1|0;if((ka|0)!=(s|0)){continue}break}}b=H[i+8>>2];H[i+244>>2]=H[i+4>>2];H[i+248>>2]=b;b=(v|0)!=(ya|0);i=i+240|0;v=v+1|0;if(b){continue}break}}Da(o);Da(k);k=H[sa+420>>2];w:{if(I[sa+5640|0]&4){if((k|0)==-1){break w}n=sa+424|0;r=H[sa+8>>2];u=0;b=h;while(1){i=H[n+36>>2];H[b+44>>2]=1;H[b+84>>2]=i;H[b+48>>2]=H[n>>2];i=H[n+4>>2];H[b+68>>2]=0;H[b+72>>2]=0;H[b+52>>2]=i;H[b+60>>2]=H[n+12>>2];H[b+64>>2]=H[n+16>>2];i=H[n+8>>2];H[b+76>>2]=ca;H[b+56>>2]=i>>>0>>0?i:r;n=n+148|0;b=b+240|0;i=(k|0)==(u|0);u=u+1|0;if(!i){continue}break}break w}if((k|0)==-1){break w}g=H[sa+8>>2];r=H[sa+4>>2];b=h;if(k){i=k+1&-2;V=0;while(1){H[b+68>>2]=0;H[b+72>>2]=0;H[b+52>>2]=0;H[b+44>>2]=1;H[b+48>>2]=0;H[b+84>>2]=r;H[b+60>>2]=X;H[b+324>>2]=r;H[b+76>>2]=ca;H[b+56>>2]=g;H[b+308>>2]=0;H[b+312>>2]=0;H[b+292>>2]=0;H[b+284>>2]=1;H[b+288>>2]=0;H[b+300>>2]=X;H[b+296>>2]=g;H[b+316>>2]=ca;H[b+64>>2]=H[b+196>>2];H[b+304>>2]=H[b+436>>2];b=b+480|0;V=V+2|0;if((i|0)!=(V|0)){continue}break}}if(k&1){break w}H[b+68>>2]=0;H[b+72>>2]=0;H[b+52>>2]=0;H[b+44>>2]=1;H[b+48>>2]=0;H[b+84>>2]=r;H[b+60>>2]=X;H[b+76>>2]=ca;H[b+56>>2]=g;H[b+64>>2]=H[b+196>>2]}g=h;break m}Da(o)}Da(r)}oa=Y+32|0;h=g;x:{y:{if(!g){break y}A=ia+1|0;p=q;k=g;z:{A:{while(1){if(H[k+84>>2]==-1){break z}z=Ga(H[ja+16>>2]<<2);if(!z){break z}b=H[ja+16>>2]<<2;if(b){y(z,1,b)}if(fc(k)){while(1){E=H[m+20>>2];B:{C:{if(K[k+40>>2]>=K[va+12>>2]){break C}i=H[k+32>>2];b=N(H[k+28>>2],76)+E|0;if(i>>>0>=K[b+24>>2]){break C}r=H[b+28>>2]+N(i,152)|0;if(!H[r+24>>2]){break C}i=r+28|0;D=0;D:{while(1){b=i+N(D,36)|0;g=H[b+20>>2]+N(H[k+36>>2],40)|0;if(!Cb(R,H[k+28>>2],H[k+32>>2],H[b+16>>2],H[g>>2],H[g+4>>2],H[g+8>>2],H[g+12>>2])){D=D+1|0;if(D>>>0>2]){continue}break D}break}H[z+(H[k+28>>2]<<2)>>2]=0;H[S+136>>2]=0;if(!ec(H[da+4>>2],H[m+20>>2],va,k,S+140|0,p,S+136|0,j,f)){break A}D=H[k+32>>2];o=H[k+28>>2];u=H[S+136>>2];if(H[S+140>>2]){H[S+136>>2]=0;C=H[(H[m+20>>2]+N(o,76)|0)+28>>2]+N(D,152)|0;E=H[C+24>>2];if(E){Q=j-u|0;w=j+p|0;o=C+28|0;X=0;g=0;l=p+u|0;v=l;while(1){E:{if(H[o+8>>2]==H[o>>2]|H[o+12>>2]==H[o+4>>2]){break E}b=H[o+20>>2]+N(H[k+36>>2],40)|0;r=N(H[b+20>>2],H[b+16>>2]);if(!r){break E}E=H[b+24>>2];V=0;while(1){t=H[E+36>>2];if(t){F:{if(g|H[E+64>>2]){H[E+52>>2]=0;D=1;b=64;break F}D=H[E>>2];b=H[E+40>>2];G:{if(b){D=N(b,24)+D|0;if(H[D-20>>2]!=H[D-12>>2]){D=D-24|0;break G}b=b+1|0}else{b=1}H[E+40>>2]=b}n=H[D+20>>2];H:{I:{if(n>>>0>(v^-1)>>>0){break I}i=D+20|0;while(1){if(w>>>0>>0){break I}s=H[E+4>>2];g=H[E+52>>2];if((g|0)!=H[E+56>>2]){b=t}else{b=g<<1|1;s=Ia(s,b<<3);if(!s){Ca(f,1,1024,0);break A}H[E+56>>2]=b;H[E+4>>2]=s;g=H[E+52>>2];n=H[i>>2];b=H[E+36>>2]}i=(g<<3)+s|0;H[i+4>>2]=n;H[i>>2]=v;H[E+52>>2]=g+1;H[D>>2]=H[D>>2]+n;g=H[D+16>>2];i=g+H[D+4>>2]|0;H[D+4>>2]=i;t=b-g|0;H[E+36>>2]=t;H[D+8>>2]=i;v=n+v|0;i=0;if((b|0)==(g|0)){break H}H[E+40>>2]=H[E+40>>2]+1;i=D+44|0;n=H[D+44>>2];D=D+24|0;if((v^-1)>>>0>=n>>>0){continue}break}}g=H[k+28>>2];i=H[k+32>>2];b=H[k+36>>2];if(H[H[da+4>>2]+104>>2]){H[S+120>>2]=g;H[S+116>>2]=i;H[S+112>>2]=X;H[S+108>>2]=b;H[S+104>>2]=V;H[S+100>>2]=Q;H[S+96>>2]=n;Ca(f,1,14693,S+96|0);break A}H[S+88>>2]=g;H[S+84>>2]=i;H[S+80>>2]=X;H[S+76>>2]=b;H[S+72>>2]=V;H[S+68>>2]=Q;H[S+64>>2]=n;Ca(f,2,14693,S- -64|0);H[E+52>>2]=0;H[E+64>>2]=1;i=1}g=i;D=H[E+40>>2];b=44}H[b+E>>2]=D}E=E+68|0;V=V+1|0;if((r|0)!=(V|0)){continue}break}E=H[C+24>>2]}o=o+36|0;X=X+1|0;if(E>>>0>X>>>0){continue}break}D=H[k+32>>2];o=H[k+28>>2];b=g?Q:v-l|0}else{b=0}u=b+u|0}b=H[ja+24>>2]+N(o,52)|0;i=H[b+36>>2];H[b+36>>2]=i>>>0>>0?D:i;break B}E=H[m+20>>2]}H[S+136>>2]=0;if(!ec(H[da+4>>2],E,va,k,S+140|0,p,S+136|0,j,f)){break A}o=H[k+28>>2];u=H[S+136>>2];if(!H[S+140>>2]){break B}w=H[k+32>>2];b=H[(H[m+20>>2]+N(o,76)|0)+28>>2]+N(w,152)|0;r=H[b+24>>2];if(!r){break B}Q=j-u|0;s=b+28|0;C=H[k+36>>2];D=0;g=0;J:{K:{while(1){L:{if(H[s+8>>2]==H[s>>2]|H[s+12>>2]==H[s+4>>2]){break L}b=H[s+20>>2]+N(C,40)|0;i=N(H[b+20>>2],H[b+16>>2]);if(!i){break L}t=H[b+24>>2];X=0;while(1){n=H[t+36>>2];if(n){E=H[t>>2];V=H[t+40>>2];M:{if(V){E=N(V,24)+E|0;if(H[E-20>>2]!=H[E-12>>2]){E=E-24|0;break M}V=V+1|0}else{V=1}H[t+40>>2]=V}v=H[E+20>>2];D=D+v|0;if(Q>>>0>>0|v>>>0>D>>>0){break J}while(1){N:{l=H[E+16>>2];H[E+4>>2]=l+H[E+4>>2];b=n-l|0;if((l|0)==(n|0)){break N}V=V+1|0;H[t+40>>2]=V;v=H[E+44>>2];D=D+v|0;if(v>>>0>D>>>0){break K}E=E+24|0;n=b;if(D>>>0<=Q>>>0){continue}break K}break}H[t+36>>2]=b}t=t+68|0;X=X+1|0;if((i|0)!=(X|0)){continue}break}}s=s+36|0;g=g+1|0;if((r|0)!=(g|0)){continue}break}u=u+D|0;break B}H[t+36>>2]=b}if(!H[H[da+4>>2]+104>>2]){H[S+24>>2]=o;H[S+20>>2]=w;H[S+16>>2]=g;H[S+12>>2]=C;H[S+8>>2]=X;H[S+4>>2]=Q;H[S>>2]=v;Ca(f,2,14608,S);o=H[k+28>>2];u=u+Q|0;break B}H[S+56>>2]=o;H[S+52>>2]=w;H[S+48>>2]=g;H[S+44>>2]=C;H[S+40>>2]=X;H[S+36>>2]=Q;H[S+32>>2]=v;Ca(f,1,14608,S+32|0);break A}O:{if(!H[z+(o<<2)>>2]){break O}b=H[ja+24>>2]+N(o,52)|0;if(H[b+36>>2]){break O}H[b+36>>2]=H[(H[m+20>>2]+N(o,76)|0)+24>>2]-1}j=j-u|0;p=p+u|0;if(fc(k)){continue}break}}Da(z);k=k+240|0;ma=ma+1|0;if(ma>>>0<=K[va+420>>2]){continue}break}Db(h,A);H[Ha+8>>2]=p-q;b=1;break x}Db(h,A);Da(z);break y}Db(h,A)}b=0}oa=S+144|0;hb(da);if(!b){break b}$=H[H[R+32>>2]+5584>>2];s=H[H[R+20>>2]>>2];p=H[s+20>>2];H[Ha+12>>2]=1;E=0;b=H[R+32>>2];m=H[$+16>>2]>>>4&1&H[b+12>>2]==H[b+8>>2];t=H[s+16>>2];P:{if(!t){break P}while(1){b=H[R+68>>2];if(!(H[b+(E<<2)>>2]?0:b)){r=Ha+12|0;ma=0;qa=H[p+24>>2];Q:{if(!qa){break Q}l=H[R+44>>2];while(1){q=H[p+28>>2]+N(ma,152)|0;n=H[q+24>>2];if(n){j=q+28|0;qa=H[q+20>>2];g=H[q+16>>2];i=0;while(1){if(N(g,qa)){t=j+N(i,36)|0;k=0;while(1){w=H[t+20>>2]+N(k,40)|0;b=Cb(R,H[p+16>>2],ma,H[t+16>>2],H[w>>2],H[w+4>>2],H[w+8>>2],H[w+12>>2]);n=H[w+20>>2];o=H[w+16>>2];h=N(n,o);R:{if(b){if(!h){break R}o=0;while(1){h=H[w+24>>2]+N(o,68)|0;S:{if(!Cb(R,H[p+16>>2],ma,H[t+16>>2],H[h+8>>2],H[h+12>>2],H[h+16>>2],H[h+20>>2])){b=H[h+60>>2];if(!b){break S}Da(b);H[h+60>>2]=0;break S}if(!H[R+64>>2]){if(H[h+60>>2]|H[h+16>>2]==H[h+8>>2]|H[h+20>>2]==H[h+12>>2]){break S}}g=Fa(1,44);if(!g){H[Ha+12>>2]=0;break Q}b=H[R+64>>2];H[g+36>>2]=0;H[g+28>>2]=r;H[g+20>>2]=$;H[g+16>>2]=p;H[g+12>>2]=t;H[g+8>>2]=h;H[g+4>>2]=ma;H[g>>2]=b;H[g+40>>2]=m;H[g+32>>2]=f;H[g+24>>2]=H[l+4>>2]>1;ib(l,14,g);if(!H[Ha+12>>2]){break Q}}o=o+1|0;if(o>>>0>2],H[w+16>>2])>>>0){continue}break}break R}if(!h){break R}g=0;while(1){h=H[w+24>>2]+N(g,68)|0;b=H[h+60>>2];if(b){Da(b);H[h+60>>2]=0;n=H[w+20>>2];o=H[w+16>>2]}g=g+1|0;if(g>>>0>>0){continue}break}}k=k+1|0;g=H[q+16>>2];qa=H[q+20>>2];if(k>>>0>>0){continue}break}n=H[q+24>>2]}i=i+1|0;if(n>>>0>i>>>0){continue}break}qa=H[p+24>>2]}ma=ma+1|0;if(qa>>>0>ma>>>0){continue}break}}if(!H[Ha+12>>2]){break P}t=H[s+16>>2]}$=$+1080|0;p=p+76|0;E=E+1|0;if(E>>>0>>0){continue}break}}$=0;Ua(H[R+44>>2]);if(!H[Ha+12>>2]){break b}T:{if(H[R+64>>2]){break T}E=H[R+24>>2];if(!H[E+16>>2]){break T}p=0;while(1){g=H[H[H[R+20>>2]>>2]+20>>2]+N(p,76)|0;b=H[g+28>>2]+N(H[(H[E+24>>2]+N(p,52)|0)+36>>2],152)|0;r=H[b+136>>2];i=H[b+144>>2];j=H[b+140>>2];h=H[b+148>>2];Da(H[g+52>>2]);H[g+52>>2]=0;U:{b=H[R+68>>2];if((i|0)==(r|0)|(h|0)==(j|0)|(H[b+(p<<2)>>2]?0:b)){break U}h=h-j|0;b=i-r|0;Ie(h,0,b);if(ra){Ca(f,1,2982,0);break b}b=N(b,h);if(b>>>0>=1073741824){Ca(f,1,2982,0);break b}b=Ja(b<<2);H[g+52>>2]=b;if(b){break U}Ca(f,1,2982,0);break b}p=p+1|0;E=H[R+24>>2];if(p>>>0>2]){continue}break}}E=H[R+32>>2];qa=H[H[R+20>>2]>>2];if(H[qa+16>>2]){p=H[qa+20>>2];E=H[E+5584>>2];t=H[H[R+24>>2]+24>>2];r=0;while(1){V:{b=H[R+68>>2];if(H[b+(r<<2)>>2]?0:b){break V}m=H[t+36>>2]+1|0;if(H[E+20>>2]==1){fa=m;j=0;ta=oa-32|0;oa=ta;W:{X:{if(H[R+64>>2]){b=1;if((m|0)==1){break W}i=H[p+28>>2];h=i+N(H[p+24>>2],152)|0;s=H[h-144>>2];l=H[h-152>>2];if((s|0)==(l|0)){break W}g=m-1|0;n=g&1;z=H[R+44>>2];Q=H[z+4>>2];Y:{if((m|0)==2){h=i;break Y}o=g&-2;h=i;b=0;while(1){k=H[h+160>>2]-H[h+152>>2]|0;k=j>>>0>k>>>0?j:k;j=H[h+164>>2]-H[h+156>>2]|0;k=j>>>0>>0?k:j;j=H[h+312>>2]-H[h+304>>2]|0;k=j>>>0>>0?k:j;j=H[h+316>>2]-H[h+308>>2]|0;j=j>>>0>>0?k:j;h=h+304|0;b=b+2|0;if((o|0)!=(b|0)){continue}break}}b=0;if(n){k=H[h+160>>2]-H[h+152>>2]|0;j=j>>>0>k>>>0?j:k;h=H[h+164>>2]-H[h+156>>2]|0;j=h>>>0>>0?j:h}if(j>>>0>134217727){break W}n=H[i+4>>2];o=H[i+12>>2];k=H[i>>2];h=H[i+8>>2];q=j<<5;A=rb(q);H[ta+16>>2]=A;if(!A){break W}C=s-l|0;b=o-n|0;k=h-k|0;H[ta>>2]=A;while(1){w=H[p+36>>2];o=b;H[ta+8>>2]=b;b=k;H[ta+24>>2]=b;l=H[i+156>>2];n=H[i+164>>2];j=H[i+160>>2];h=H[i+152>>2];H[ta+28>>2]=(h|0)%2;k=j-h|0;H[ta+20>>2]=k-b;m=(Q|0)<2;b=n-l|0;Z:{if(!(!m&b>>>0>1)){h=0;if(!b){break Z}while(1){lc(ta+16|0,w+(N(h,C)<<2)|0);h=h+1|0;if((h|0)!=(b|0)){continue}break}break Z}s=b>>>0>>0?b:Q;n=s-1|0;l=(b>>>0)/(s>>>0)|0;j=0;while(1){Z=Ga(36);if(!Z){break X}h=H[ta+20>>2];H[Z>>2]=H[ta+16>>2];H[Z+4>>2]=h;h=H[ta+28>>2];H[Z+8>>2]=H[ta+24>>2];H[Z+12>>2]=h;H[Z+28>>2]=N(j,l);H[Z+24>>2]=w;H[Z+20>>2]=C;H[Z+16>>2]=k;h=(j|0)==(n|0);j=j+1|0;H[Z+32>>2]=h?b:N(l,j);h=rb(q);H[Z>>2]=h;if(!h){b=0;Ua(z);Da(Z);Da(A);break W}ib(z,10,Z);if((j|0)!=(s|0)){continue}break}Ua(z)}H[ta+4>>2]=b-o;H[ta+12>>2]=H[i+156>>2]%2;_:{if(!(!m&k>>>0>1)){j=8;h=0;if(k>>>0>=8){while(1){qb(ta,w+(h<<2)|0,C,8);h=j;j=h+8|0;if(k>>>0>=j>>>0){continue}break}}if(h>>>0>=k>>>0){break _}qb(ta,w+(h<<2)|0,C,k-h|0);break _}m=k>>>0>>0?k:Q;o=m-1|0;n=(k>>>0)/(m>>>0)|0;j=0;while(1){l=Ga(36);if(!l){break X}h=H[ta+4>>2];H[l>>2]=H[ta>>2];H[l+4>>2]=h;h=H[ta+12>>2];H[l+8>>2]=H[ta+8>>2];H[l+12>>2]=h;H[l+28>>2]=N(j,n);H[l+24>>2]=w;H[l+20>>2]=C;H[l+16>>2]=b;h=(j|0)==(o|0);j=j+1|0;H[l+32>>2]=h?k:N(n,j);h=rb(q);H[l>>2]=h;if(!h){b=0;Ua(z);Da(l);Da(A);break W}ib(z,11,l);if((j|0)!=(m|0)){continue}break}Ua(z)}i=i+152|0;g=g-1|0;if(g){continue}break}b=1;Da(A);break W}b=1;o=H[p+28>>2];Ta=o+N(fa,152)|0;jb=Ta-152|0;if(H[jb>>2]==H[Ta-144>>2]){break W}aa=Ta-148|0;if(H[aa>>2]==H[Ta-140>>2]){break W}s=H[o+4>>2];l=H[o+12>>2];m=H[o>>2];n=H[o+8>>2];M=H[p+68>>2];W=H[p+64>>2];ia=H[p+60>>2];ca=H[p+56>>2];Na=kc(p,fa);if(!Na){b=0;break W}$:{aa:{if((fa|0)!=1){b=fa-1|0;k=b&1;ba:{if((fa|0)==2){h=o;break ba}g=b&-2;h=o;b=0;while(1){i=H[h+160>>2]-H[h+152>>2]|0;i=i>>>0>>0?j:i;j=H[h+164>>2]-H[h+156>>2]|0;i=i>>>0>j>>>0?i:j;j=H[h+312>>2]-H[h+304>>2]|0;i=i>>>0>j>>>0?i:j;j=H[h+316>>2]-H[h+308>>2]|0;j=i>>>0>j>>>0?i:j;h=h+304|0;b=b+2|0;if((g|0)!=(b|0)){continue}break}}if(k){b=H[h+160>>2]-H[h+152>>2]|0;j=b>>>0>>0?j:b;b=H[h+164>>2]-H[h+156>>2]|0;j=b>>>0>>0?j:b}if(j>>>0>=268435456){break $}J=rb(j<<4);if(!J){break $}ca:{if(!fa){break ca}u=l-s|0;ba=n-m|0;_a=J-4|0;kb=J+28|0;Q=J+24|0;Va=J+16|0;bb=J-16|0;lb=J-32|0;nb=J-8|0;wa=J+4|0;$a=1;da:while(1){h=H[o+156>>2];cb=(h|0)%2|0;b=H[o+152>>2];ga=(b|0)%2|0;X=H[o+164>>2]-h|0;Ba=X-u|0;Z=H[o+160>>2]-b|0;Aa=Z-ba|0;_=ca;b=ca;i=ia;ma=i;j=W;g=j;h=M;v=h;k=H[p+20>>2];ea:{if((k|0)==($a|0)){break ea}q=k-$a|0;ma=0;b=0;if(ca){h=q&31;if((q&63)>>>0>=32){l=-1<>>32-h}b=ca+(b^-1)|0;h=l^-1;h=b>>>0>>0?h+1|0:h;j=q&31;if((q&63)>>>0>=32){b=h>>>j|0}else{b=((1<>>j}}if(ia){j=q&31;if((q&63)>>>0>=32){l=-1<>>32-j}h=ia+(h^-1)|0;j=l^-1;j=h>>>0>>0?j+1|0:j;i=q&31;if((q&63)>>>0>=32){ma=j>>>i|0}else{ma=((1<>>i}}h=0;j=0;if(W){i=q&31;if((q&63)>>>0>=32){l=-1<>>32-i}j=W+(j^-1)|0;i=l^-1;i=j>>>0>>0?i+1|0:i;g=q&31;if((q&63)>>>0>=32){j=i>>>g|0}else{j=((1<>>g}}if(M){i=q&31;if((q&63)>>>0>=32){l=-1<>>32-i}h=M+(h^-1)|0;i=l^-1;i=h>>>0>>0?i+1|0:i;g=q&31;if((q&63)>>>0>=32){h=i>>>g|0}else{h=((1<>>g}}g=0;_=0;s=1<>>0>>0){k=q&31;if((q&63)>>>0>=32){l=-1<>>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+(j<<3)|0;h=H[i+4>>2];ma:{na:{if((j|0)>=0){b=j+1|0;g=H[((j|0)<(Aa|0)?i:Ma)>>2];break na}g=H[J>>2];b=0;j=j+1|0;_=J;if(j){break ma}}if((b|0)>=(Aa|0)){j=b;_=Ma;break ma}j=b;_=J+(b<<3)|0}b=_;H[i+4>>2]=h-((H[b>>2]+g|0)+2>>2);if((j|0)<(Pa|0)){continue}break}break la}H[J>>2]=H[J>>2]/2;break ga}j=m;if((Oa|0)<=(j|0)){break ga}while(1){b=j<<3;g=b+J|0;h=H[g>>2];oa:{if((j|0)<0){i=H[wa>>2];_=wa;break oa}i=H[((j|0)<(ba|0)?g+4|0:La)>>2];_=wa;if(!j){break oa}_=(j|0)>(ba|0)?La:b+_a|0}b=_;H[g>>2]=h+(H[b>>2]+i>>1);j=j+1|0;if((Oa|0)!=(j|0)){continue}break}break ga}if((j|0)>=(Pa|0)){break ha}while(1){b=J+(j<<3)|0;g=b;i=H[b>>2];pa:{qa:{if((j|0)>0){h=H[(((j|0)<(Aa|0)?j:Aa)<<3)+_a>>2];break qa}h=H[wa>>2];b=wa;if((j|0)<0){break pa}}b=la;if((j|0)>=(Aa|0)){break pa}b=wa+(j<<3)|0}H[g>>2]=i-((H[b>>2]+h|0)+2>>2);j=j+1|0;if((Pa|0)!=(j|0)){continue}break}}if((m|0)>=(Oa|0)){break ga}b=m;j=b;if((b|0)<(z|0)){while(1){b=J+(j<<3)|0;j=j+1|0;H[b+4>>2]=H[b+4>>2]+(H[J+(j<<3)>>2]+H[b>>2]>>1);if((j|0)!=(z|0)){continue}break}b=z}if((b|0)>=(Oa|0)){break ga}while(1){j=b;ra:{sa:{if((b|0)>=0){_=H[((b|0)<(ba|0)?J+(b<<3)|0:za)>>2];h=b+1|0;break sa}_=H[J>>2];h=0;b=j+1|0;i=J;if(b){break ra}}if((h|0)>=(ba|0)){b=h;i=za;break ra}b=h;i=J+(b<<3)|0}h=wa+(j<<3)|0;H[h>>2]=H[h>>2]+(H[i>>2]+_>>1);if((b|0)<(Oa|0)){continue}break}}if(!ab(Na,D,v,db,V,pa,1,0)){break aa}}v=V;if((X|0)!=(v|0)){continue}break}}o=o+152|0;h=s<<1;b=ma<<1|1;b=b>>>0>>0?h:b;ka=b>>>0>>0?b:X;ua=J+(n<<5)|0;j=Ba<<5;La=j+bb|0;b=(n|0)<(Ba|0);pa=b?ua+28|0:La+12|0;sa=b?ua+24|0:La+8|0;va=b?ua+20|0:La+4|0;ja=(n|0)<0?Va:b?ua+16|0:La;q=(u|0)>(na|0)?na:u-1|0;ea=((b?n:Ba)<<5)+bb|0;ya=(n|0)<=0;v=ya?Va:ea;V=(Ba|0)>0;ba=V|(u|0)>1;_=ua+(cb<<4)|0;ma=(J+(4-(cb<<2)<<2)|0)+(k<<5)|0;s=(Ba|0)>(Qa|0)?Qa:Ba;m=n+1|0;h=C<<1;b=w<<1|1;z=b>>>0>h>>>0?h:b;A=J+(z<<4)|0;b=u<<5;xa=b+lb|0;za=j+lb|0;C=!u&(Ba|0)==1;Ma=b+bb|0;S=Ma+12|0;Y=Ma+8|0;da=Ma+4|0;w=ea+12|0;i=ea+8|0;while(1){ta:{ua:{va:{wa:{l=D;if(db>>>0>l>>>0){b=db-l|0;D=(b>>>0>=4?4:b)+l|0;Ra(Na,l,n,D,Qa,_,1,8);Ra(Na,l,pb,D,ob,ma,1,8);if(!cb){if(!ba){break ta}if((n|0)>=(Qa|0)){break ua}H[ua>>2]=H[ua>>2]-((H[v>>2]+H[ja>>2]|0)+2>>2);xa:{if(!ya){j=H[ea+4>>2];h=i;b=w;break xa}j=H[J+20>>2];if((n|0)<0){break wa}h=Q;b=kb}H[ua+4>>2]=H[ua+4>>2]-((H[va>>2]+j|0)+2>>2);H[ua+8>>2]=H[ua+8>>2]-((H[h>>2]+H[sa>>2]|0)+2>>2);j=H[pa>>2];b=H[b>>2];break va}if(C){H[J>>2]=H[J>>2]/2;H[J+8>>2]=H[J+8>>2]/2;H[J+12>>2]=H[J+12>>2]/2;H[J+4>>2]=H[J+4>>2]/2;break ta}b=n;if((Qa|0)>(b|0)){while(1){g=J+(b<<5)|0;ya:{if((b|0)<0){h=H[J>>2];j=V|(b|0)!=-1;H[g+16>>2]=H[g+16>>2]-(((j?h:H[za>>2])+h|0)+2>>2);h=H[wa>>2];H[g+20>>2]=H[g+20>>2]-(((j?h:H[za+4>>2])+h|0)+2>>2);h=H[J+8>>2];H[g+24>>2]=H[g+24>>2]-(((j?h:H[za+8>>2])+h|0)+2>>2);h=H[J+12>>2];H[g+28>>2]=H[g+28>>2]-(((j?h:H[za+12>>2])+h|0)+2>>2);b=b+1|0;break ya}j=b+1|0;za:{if((j|0)<(Ba|0)){b=J+(j<<5)|0;H[g+16>>2]=H[g+16>>2]-((H[g>>2]+H[b>>2]|0)+2>>2);H[g+20>>2]=H[g+20>>2]-((H[g+4>>2]+H[b+4>>2]|0)+2>>2);H[g+24>>2]=H[g+24>>2]-((H[g+8>>2]+H[b+8>>2]|0)+2>>2);H[g+28>>2]=H[g+28>>2]-((H[g+12>>2]+H[b+12>>2]|0)+2>>2);break za}h=H[g+16>>2];if((b|0)<(Ba|0)){H[g+16>>2]=h-((H[g>>2]+H[za>>2]|0)+2>>2);H[g+20>>2]=H[g+20>>2]-((H[g+4>>2]+H[za+4>>2]|0)+2>>2);H[g+24>>2]=H[g+24>>2]-((H[g+8>>2]+H[za+8>>2]|0)+2>>2);H[g+28>>2]=H[g+28>>2]-((H[g+12>>2]+H[za+12>>2]|0)+2>>2);break za}H[g+16>>2]=h-((H[za>>2]<<1)+2>>2);H[g+20>>2]=H[g+20>>2]-((H[za+4>>2]<<1)+2>>2);H[g+24>>2]=H[g+24>>2]-((H[za+8>>2]<<1)+2>>2);H[g+28>>2]=H[g+28>>2]-((H[za+12>>2]<<1)+2>>2)}b=j}if((Qa|0)!=(b|0)){continue}break}}b=k;if((na|0)<=(b|0)){break ta}while(1){g=J+(b<<5)|0;Aa:{if((b|0)<0){H[g>>2]=H[g>>2]+(H[Va>>2]<<1>>1);H[g+4>>2]=H[g+4>>2]+(H[J+20>>2]<<1>>1);H[g+8>>2]=H[g+8>>2]+(H[J+24>>2]<<1>>1);H[g+12>>2]=H[g+12>>2]+(H[J+28>>2]<<1>>1);break Aa}j=H[g>>2];if(!b){h=(b|0)<(u|0);H[g>>2]=j+(H[Va>>2]+H[(h?g+16|0:Ma)>>2]>>1);H[g+4>>2]=H[g+4>>2]+(H[J+20>>2]+H[(h?g+20|0:da)>>2]>>1);H[g+8>>2]=H[g+8>>2]+(H[J+24>>2]+H[(h?g+24|0:Y)>>2]>>1);H[g+12>>2]=H[g+12>>2]+(H[J+28>>2]+H[(h?g+28|0:S)>>2]>>1);break Aa}if((b|0)<=(u|0)){h=(b|0)<(u|0);H[g>>2]=j+(H[g-16>>2]+H[(h?g+16|0:Ma)>>2]>>1);H[g+4>>2]=H[g+4>>2]+(H[g-12>>2]+H[(h?g+20|0:da)>>2]>>1);H[g+8>>2]=H[g+8>>2]+(H[g-8>>2]+H[(h?g+24|0:Y)>>2]>>1);H[g+12>>2]=H[g+12>>2]+(H[g-4>>2]+H[(h?g+28|0:S)>>2]>>1);break Aa}H[g>>2]=j+(H[Ma>>2]<<1>>1);H[g+4>>2]=H[g+4>>2]+(H[Ma+4>>2]<<1>>1);H[g+8>>2]=H[g+8>>2]+(H[Ma+8>>2]<<1>>1);H[g+12>>2]=H[g+12>>2]+(H[Ma+12>>2]<<1>>1)}b=b+1|0;if((na|0)!=(b|0)){continue}break}break ta}ba=Z;u=X;$a=$a+1|0;if((fa|0)!=($a|0)){continue da}break ca}H[ua+4>>2]=H[ua+4>>2]-((j<<1)+2>>2);H[ua+8>>2]=H[ua+8>>2]-((H[Q>>2]<<1)+2>>2);j=H[kb>>2];b=j}H[ua+12>>2]=H[ua+12>>2]-((b+j|0)+2>>2);g=n;j=m;b=j;if((s|0)>(b|0)){while(1){h=J+(j<<5)|0;b=Va+(g<<5)|0;H[h>>2]=H[h>>2]-((H[b>>2]+H[h+16>>2]|0)+2>>2);H[h+4>>2]=H[h+4>>2]-((H[b+4>>2]+H[h+20>>2]|0)+2>>2);H[h+8>>2]=H[h+8>>2]-((H[b+8>>2]+H[h+24>>2]|0)+2>>2);H[h+12>>2]=H[h+12>>2]-((H[b+12>>2]+H[h+28>>2]|0)+2>>2);g=j;j=g+1|0;if((s|0)!=(j|0)){continue}break}b=s}if((b|0)>=(Qa|0)){break ua}while(1){h=b<<5;x=h+Va|0;ga=h+J|0;g=(b|0)<(Ba|0);Ba:{if((b|0)<=0){h=H[Va>>2];if((b|0)>=0){j=g?x:La;H[ga>>2]=H[ga>>2]-((h+H[j>>2]|0)+2>>2);H[ga+4>>2]=H[ga+4>>2]-((H[J+20>>2]+H[j+4>>2]|0)+2>>2);H[ga+8>>2]=H[ga+8>>2]-((H[J+24>>2]+H[j+8>>2]|0)+2>>2);h=(H[J+28>>2]+H[j+12>>2]|0)+2|0;break Ba}H[ga>>2]=H[ga>>2]-((h<<1)+2>>2);H[ga+4>>2]=H[ga+4>>2]-((H[J+20>>2]<<1)+2>>2);H[ga+8>>2]=H[ga+8>>2]-((H[J+24>>2]<<1)+2>>2);h=(H[J+28>>2]<<1)+2|0;break Ba}la=((g?b:Ba)<<5)+bb|0;j=H[la>>2]+2|0;h=H[ga>>2];if(!g){H[ga>>2]=h-(j+H[La>>2]>>2);H[ga+4>>2]=H[ga+4>>2]-((H[la+4>>2]+H[La+4>>2]|0)+2>>2);H[ga+8>>2]=H[ga+8>>2]-((H[la+8>>2]+H[La+8>>2]|0)+2>>2);h=(H[la+12>>2]+H[La+12>>2]|0)+2|0;break Ba}H[ga>>2]=h-(j+H[x>>2]>>2);H[ga+4>>2]=H[ga+4>>2]-((H[la+4>>2]+H[x+4>>2]|0)+2>>2);H[ga+8>>2]=H[ga+8>>2]-((H[la+8>>2]+H[x+8>>2]|0)+2>>2);h=(H[la+12>>2]+H[x+12>>2]|0)+2|0}H[ga+12>>2]=H[ga+12>>2]-(h>>2);b=b+1|0;if((Qa|0)!=(b|0)){continue}break}}if((k|0)>=(na|0)){break ta}h=k;b=h;if((q|0)>(b|0)){while(1){b=J+(h<<5)|0;H[b+16>>2]=H[b+16>>2]+(H[b+32>>2]+H[b>>2]>>1);H[b+20>>2]=H[b+20>>2]+(H[b+36>>2]+H[b+4>>2]>>1);H[b+24>>2]=H[b+24>>2]+(H[b+40>>2]+H[b+8>>2]>>1);H[b+28>>2]=H[b+28>>2]+(H[b+44>>2]+H[b+12>>2]>>1);h=h+1|0;if((q|0)!=(h|0)){continue}break}b=q}if((b|0)>=(na|0)){break ta}while(1){h=b<<5;x=h+Va|0;Ca:{Da:{Ea:{if((b|0)<0){h=H[J>>2];if((b|0)!=-1){break Ea}if((u|0)<=0){H[x>>2]=H[x>>2]+(h+H[xa>>2]>>1);H[x+4>>2]=H[x+4>>2]+(H[xa+4>>2]+H[J+4>>2]>>1);H[x+8>>2]=H[x+8>>2]+(H[xa+8>>2]+H[J+8>>2]>>1);g=H[J+12>>2];h=H[xa+12>>2];break Da}break Ea}j=h+J|0;h=b+1|0;Fa:{if((h|0)<(u|0)){b=J+(h<<5)|0;H[x>>2]=H[x>>2]+(H[b>>2]+H[j>>2]>>1);H[x+4>>2]=H[x+4>>2]+(H[b+4>>2]+H[j+4>>2]>>1);H[x+8>>2]=H[x+8>>2]+(H[b+8>>2]+H[j+8>>2]>>1);H[x+12>>2]=H[x+12>>2]+(H[b+12>>2]+H[j+12>>2]>>1);break Fa}if((b|0)>=(u|0)){H[x>>2]=H[x>>2]+H[xa>>2];H[x+4>>2]=H[x+4>>2]+H[xa+4>>2];H[x+8>>2]=H[x+8>>2]+H[xa+8>>2];H[x+12>>2]=H[x+12>>2]+H[xa+12>>2];break Fa}H[x>>2]=H[x>>2]+(H[xa>>2]+H[j>>2]>>1);H[x+4>>2]=H[x+4>>2]+(H[xa+4>>2]+H[j+4>>2]>>1);H[x+8>>2]=H[x+8>>2]+(H[xa+8>>2]+H[j+8>>2]>>1);H[x+12>>2]=H[x+12>>2]+(H[xa+12>>2]+H[j+12>>2]>>1)}b=h;break Ca}H[x>>2]=h+H[x>>2];H[x+4>>2]=H[x+4>>2]+H[J+4>>2];H[x+8>>2]=H[x+8>>2]+H[J+8>>2];g=H[J+12>>2];h=g}H[x+12>>2]=H[x+12>>2]+(g+h>>1);b=b+1|0}if((na|0)!=(b|0)){continue}break}}if(ab(Na,l,z,D,ka,A,1,4)){continue}break}break}break aa}Da(J);b=1}g=H[Ta-16>>2];i=H[jb>>2];j=H[aa>>2];h=H[Ta-8>>2];Ra(Na,g-i|0,H[Ta-12>>2]-j|0,h-i|0,H[Ta-4>>2]-j|0,H[p+52>>2],1,h-g|0);Xa(Na);break W}Xa(Na);Da(J);b=0;break W}Xa(Na);b=0;break W}b=0;Ua(z);Da(A)}oa=ta+32|0;if(b){break V}break b}k=0;o=0;aa=oa+-64|0;oa=aa;Ga:{Ha:{if(H[R+64>>2]){n=H[p+28>>2];s=n+N(H[p+24>>2],152)|0;l=H[s-152>>2];g=1;S=H[R+44>>2];sa=H[S+4>>2];if((m|0)==1){break Ga}X=m-1|0;o=X&1;Ia:{if((m|0)==2){i=0;b=n;break Ia}g=X&-2;i=0;b=n;while(1){h=H[b+160>>2]-H[b+152>>2]|0;j=h>>>0>>0?i:h;h=H[b+164>>2]-H[b+156>>2]|0;j=h>>>0>>0?j:h;h=H[b+312>>2]-H[b+304>>2]|0;j=h>>>0>>0?j:h;h=H[b+316>>2]-H[b+308>>2]|0;i=h>>>0>>0?j:h;b=b+304|0;k=k+2|0;if((g|0)!=(k|0)){continue}break}}g=0;if(o){h=H[b+160>>2]-H[b+152>>2]|0;h=h>>>0>>0?i:h;b=H[b+164>>2]-H[b+156>>2]|0;i=b>>>0>>0?h:b}if(i>>>0>134217727){break Ga}m=H[s-144>>2];k=H[n+4>>2];j=H[n+12>>2];h=H[n>>2];b=H[n+8>>2];V=i<<5;ea=Ja(V);H[aa+32>>2]=ea;if(!ea){break Ga}o=j-k|0;j=b-h|0;b=sa>>>1|0;ba=b>>>0<=2?2:b;x=m-l|0;ma=x<<5;na=N(x,28);D=N(x,24);fa=N(x,20);M=x<<4;W=N(x,12);ia=x<<3;H[aa>>2]=ea;_=ea+32|0;h=H[p+36>>2];while(1){l=o;H[aa+8>>2]=l;b=j;H[aa+40>>2]=b;ka=H[n+156>>2];pa=H[n+164>>2];i=H[n+160>>2];g=H[n+152>>2];H[aa+56>>2]=0;H[aa+52>>2]=b;H[aa+48>>2]=0;s=(g|0)%2|0;H[aa+44>>2]=s;j=i-g|0;Q=j-b|0;H[aa+60>>2]=Q;H[aa+36>>2]=Q;w=(sa|0)<2;o=pa-ka|0;Ja:{if(!(!w&o>>>0>15)){m=0;i=h;if(o>>>0<8){break Ja}v=0;while(1){b=aa+32|0;Eb(b,i,x,8);Wa(b);b=0;if(j){while(1){k=(b<<2)+i|0;g=ea+(b<<5)|0;L[k>>2]=L[g>>2];L[k+(x<<2)>>2]=L[g+4>>2];L[k+ia>>2]=L[g+8>>2];L[k+W>>2]=L[g+12>>2];b=b+1|0;if((j|0)!=(b|0)){continue}break}b=0;while(1){k=(b<<2)+i|0;g=ea+(b<<5)|0;L[k+M>>2]=L[g+16>>2];L[k+fa>>2]=L[g+20>>2];L[k+D>>2]=L[g+24>>2];L[k+na>>2]=L[g+28>>2];b=b+1|0;if((j|0)!=(b|0)){continue}break}}i=i+ma|0;b=v+15|0;m=v+8|0;v=m;if(b>>>0>>0){continue}break}break Ja}i=o>>>3|0;C=i>>>0>>0?i:sa;q=(o>>>0)/(C>>>0)&-8;m=o&-8;k=0;i=h;while(1){A=Ga(48);if(!A){break Ha}g=Ja(V);H[A>>2]=g;if(!g){g=0;Ua(S);Da(A);Da(ea);break Ga}H[A+40>>2]=i;H[A+36>>2]=x;H[A+32>>2]=j;H[A+28>>2]=Q;H[A+24>>2]=0;H[A+20>>2]=b;H[A+16>>2]=0;H[A+12>>2]=s;H[A+8>>2]=b;H[A+4>>2]=Q;g=m-N(k,q)|0;k=k+1|0;g=(C|0)==(k|0)?g:q;H[A+44>>2]=g;ib(S,12,A);i=(N(g,x)<<2)+i|0;if((k|0)!=(C|0)){continue}break}Ua(S)}Ka:{if(m>>>0>=o>>>0){break Ka}b=aa+32|0;g=o-m|0;Eb(b,i,x,g);Wa(b);if(!j){break Ka}q=g&-4;C=g&3;s=0;k=ka+(m-pa|0)>>>0>4294967292;while(1){Q=(s<<2)+i|0;m=ea+(s<<5)|0;b=0;v=0;if(!k){while(1){L[Q+(N(b,x)<<2)>>2]=L[m+(b<<2)>>2];g=b|1;L[Q+(N(g,x)<<2)>>2]=L[m+(g<<2)>>2];g=b|2;L[Q+(N(g,x)<<2)>>2]=L[m+(g<<2)>>2];g=b|3;L[Q+(N(g,x)<<2)>>2]=L[m+(g<<2)>>2];b=b+4|0;v=v+4|0;if((q|0)!=(v|0)){continue}break}}v=0;if(C){while(1){L[Q+(N(b,x)<<2)>>2]=L[m+(b<<2)>>2];b=b+1|0;v=v+1|0;if((C|0)!=(v|0)){continue}break}}s=s+1|0;if((s|0)!=(j|0)){continue}break}}Y=o-l|0;H[aa+4>>2]=Y;b=H[n+156>>2];H[aa+28>>2]=Y;H[aa+24>>2]=0;H[aa+20>>2]=l;H[aa+16>>2]=0;va=(b|0)%2|0;H[aa+12>>2]=va;La:{if(!(!w&j>>>0>15)){k=h;if(j>>>0<8){break La}ca=o&-2;Z=o&1;z=Y&-2;A=Y&1;Q=l&-2;C=l&1;b=va<<5;ja=_-b|0;ya=b+ea|0;w=N(l,x)<<2;q=pa-1|0;s=(q|0)==(l+ka|0);i=j;while(1){b=0;v=0;Ma:{Na:{switch(l|0){default:while(1){u=(N(b,x)<<2)+k|0;g=H[u+4>>2];m=ya+(b<<6)|0;H[m>>2]=H[u>>2];H[m+4>>2]=g;g=H[u+28>>2];H[m+24>>2]=H[u+24>>2];H[m+28>>2]=g;g=H[u+20>>2];H[m+16>>2]=H[u+16>>2];H[m+20>>2]=g;g=H[u+12>>2];H[m+8>>2]=H[u+8>>2];H[m+12>>2]=g;g=b|1;u=ya+(g<<6)|0;m=(N(g,x)<<2)+k|0;g=H[m+28>>2];H[u+24>>2]=H[m+24>>2];H[u+28>>2]=g;g=H[m+20>>2];H[u+16>>2]=H[m+16>>2];H[u+20>>2]=g;g=H[m+12>>2];H[u+8>>2]=H[m+8>>2];H[u+12>>2]=g;g=H[m+4>>2];H[u>>2]=H[m>>2];H[u+4>>2]=g;b=b+2|0;v=v+2|0;if((Q|0)!=(v|0)){continue}break};break;case 0:break Ma;case 1:break Na}}if(!C){break Ma}m=ya+(b<<6)|0;g=(N(b,x)<<2)+k|0;b=H[g+4>>2];H[m>>2]=H[g>>2];H[m+4>>2]=b;b=H[g+28>>2];H[m+24>>2]=H[g+24>>2];H[m+28>>2]=b;b=H[g+20>>2];H[m+16>>2]=H[g+16>>2];H[m+20>>2]=b;b=H[g+12>>2];H[m+8>>2]=H[g+8>>2];H[m+12>>2]=b}Oa:{if((l|0)==(o|0)){break Oa}u=k+w|0;b=0;m=0;if(!s){while(1){da=u+(N(b,x)<<2)|0;g=H[da+4>>2];v=ja+(b<<6)|0;H[v>>2]=H[da>>2];H[v+4>>2]=g;g=H[da+28>>2];H[v+24>>2]=H[da+24>>2];H[v+28>>2]=g;g=H[da+20>>2];H[v+16>>2]=H[da+16>>2];H[v+20>>2]=g;g=H[da+12>>2];H[v+8>>2]=H[da+8>>2];H[v+12>>2]=g;g=b|1;da=ja+(g<<6)|0;v=u+(N(g,x)<<2)|0;g=H[v+28>>2];H[da+24>>2]=H[v+24>>2];H[da+28>>2]=g;g=H[v+20>>2];H[da+16>>2]=H[v+16>>2];H[da+20>>2]=g;g=H[v+12>>2];H[da+8>>2]=H[v+8>>2];H[da+12>>2]=g;g=H[v+4>>2];H[da>>2]=H[v>>2];H[da+4>>2]=g;b=b+2|0;m=m+2|0;if((z|0)!=(m|0)){continue}break}}if(!A){break Oa}m=ja+(b<<6)|0;g=u+(N(b,x)<<2)|0;b=H[g+4>>2];H[m>>2]=H[g>>2];H[m+4>>2]=b;b=H[g+28>>2];H[m+24>>2]=H[g+24>>2];H[m+28>>2]=b;b=H[g+20>>2];H[m+16>>2]=H[g+16>>2];H[m+20>>2]=b;b=H[g+12>>2];H[m+8>>2]=H[g+8>>2];H[m+12>>2]=b}Wa(aa);Pa:{if(!o){break Pa}b=0;v=0;if((q|0)!=(ka|0)){while(1){u=ea+(b<<5)|0;g=H[u+4>>2];m=(N(b,x)<<2)+k|0;H[m>>2]=H[u>>2];H[m+4>>2]=g;g=H[u+28>>2];H[m+24>>2]=H[u+24>>2];H[m+28>>2]=g;g=H[u+20>>2];H[m+16>>2]=H[u+16>>2];H[m+20>>2]=g;g=H[u+12>>2];H[m+8>>2]=H[u+8>>2];H[m+12>>2]=g;g=b|1;u=(N(g,x)<<2)+k|0;m=ea+(g<<5)|0;g=H[m+28>>2];H[u+24>>2]=H[m+24>>2];H[u+28>>2]=g;g=H[m+20>>2];H[u+16>>2]=H[m+16>>2];H[u+20>>2]=g;g=H[m+12>>2];H[u+8>>2]=H[m+8>>2];H[u+12>>2]=g;g=H[m+4>>2];H[u>>2]=H[m>>2];H[u+4>>2]=g;b=b+2|0;v=v+2|0;if((ca|0)!=(v|0)){continue}break}}if(!Z){break Pa}m=(N(b,x)<<2)+k|0;g=ea+(b<<5)|0;b=H[g+4>>2];H[m>>2]=H[g>>2];H[m+4>>2]=b;b=H[g+28>>2];H[m+24>>2]=H[g+24>>2];H[m+28>>2]=b;b=H[g+20>>2];H[m+16>>2]=H[g+16>>2];H[m+20>>2]=b;b=H[g+12>>2];H[m+8>>2]=H[g+8>>2];H[m+12>>2]=b}k=k+32|0;i=i-8|0;if(i>>>0>7){continue}break}break La}b=j>>>3|0;q=b>>>0>>0?b:ba;m=q>>>0<=1?1:q;s=(j>>>0)/(q>>>0)&-8;i=j&-8;g=0;k=h;while(1){w=Ga(48);if(!w){break Ha}b=Ja(V);H[w>>2]=b;if(!b){g=0;Ua(S);Da(w);Da(ea);break Ga}H[w+40>>2]=k;H[w+36>>2]=x;H[w+32>>2]=o;H[w+28>>2]=Y;H[w+24>>2]=0;H[w+20>>2]=l;H[w+16>>2]=0;H[w+12>>2]=va;H[w+8>>2]=l;H[w+4>>2]=Y;b=i-N(g,s)|0;g=g+1|0;b=(q|0)==(g|0)?b:s;H[w+44>>2]=b;ib(S,13,w);k=(b<<2)+k|0;if((g|0)!=(m|0)){continue}break}Ua(S)}w=j&7;Qa:{if(!w){break Qa}s=va<<5;Ra:{if(!l){break Ra}q=s+ea|0;C=w<<2;b=0;if((l|0)!=1){m=l&-2;i=0;while(1){g=!C;if(!g){B(q+(b<<6)|0,(N(b,x)<<2)+k|0,C)}if(!g){g=b|1;B(q+(g<<6)|0,(N(g,x)<<2)+k|0,C)}b=b+2|0;i=i+2|0;if((m|0)!=(i|0)){continue}break}}if(!(l&1)|!C){break Ra}B(q+(b<<6)|0,(N(b,x)<<2)+k|0,C)}Sa:{if((l|0)==(o|0)){break Sa}q=_-s|0;s=(N(l,x)<<2)+k|0;C=w<<2;b=0;if((ka|0)!=(pa+(l^-1)|0)){m=Y&-2;i=0;while(1){g=!C;if(!g){B(q+(b<<6)|0,s+(N(b,x)<<2)|0,C)}if(!g){g=b|1;B(q+(g<<6)|0,s+(N(g,x)<<2)|0,C)}b=b+2|0;i=i+2|0;if((m|0)!=(i|0)){continue}break}}if(!(Y&1)|!C){break Sa}B(q+(b<<6)|0,s+(N(b,x)<<2)|0,C)}Wa(aa);if(!o){break Qa}l=w<<2;b=0;if((pa|0)!=(ka+1|0)){m=o&-2;i=0;while(1){g=!l;if(!g){B((N(b,x)<<2)+k|0,ea+(b<<5)|0,l)}if(!g){g=b|1;B((N(g,x)<<2)+k|0,ea+(g<<5)|0,l)}b=b+2|0;i=i+2|0;if((m|0)!=(i|0)){continue}break}}if(!(o&1)|!l){break Qa}B((N(b,x)<<2)+k|0,ea+(b<<5)|0,l)}n=n+152|0;X=X-1|0;if(X){continue}break}g=1;Da(ea);break Ga}g=1;h=H[p+28>>2];x=h+N(m,152)|0;va=x-152|0;if(H[va>>2]==H[x-144>>2]){break Ga}ja=x-148|0;if(H[ja>>2]==H[x-140>>2]){break Ga}w=H[h+4>>2];q=H[h+12>>2];s=H[h>>2];l=H[h+8>>2];z=H[p+68>>2];A=H[p+64>>2];Q=H[p+60>>2];C=H[p+56>>2];la=kc(p,m);if(!la){g=0;break Ga}if((m|0)==1){i=H[x-16>>2];j=H[va>>2];h=H[ja>>2];b=H[x-8>>2];Ra(la,i-j|0,H[x-12>>2]-h|0,b-j|0,H[x-4>>2]-h|0,H[p+52>>2],1,b-i|0);Xa(la);break Ga}b=m-1|0;n=b&1;Ta:{if((m|0)==2){g=0;b=h;break Ta}k=b&-2;g=0;b=h;while(1){j=H[b+160>>2]-H[b+152>>2]|0;i=g>>>0>j>>>0?g:j;j=H[b+164>>2]-H[b+156>>2]|0;i=i>>>0>j>>>0?i:j;j=H[b+312>>2]-H[b+304>>2]|0;i=i>>>0>j>>>0?i:j;j=H[b+316>>2]-H[b+308>>2]|0;g=i>>>0>j>>>0?i:j;b=b+304|0;o=o+2|0;if((k|0)!=(o|0)){continue}break}}if(n){j=H[b+160>>2]-H[b+152>>2]|0;j=g>>>0>j>>>0?g:j;b=H[b+164>>2]-H[b+156>>2]|0;g=b>>>0>>0?j:b}Ua:{if(g>>>0>=134217728){break Ua}ea=Ja(g<<5);H[aa+32>>2]=ea;if(!ea){break Ua}H[aa>>2]=ea;Va:{if(m){n=q-w|0;b=l-s|0;ya=ea+32|0;s=m;v=H[p+20>>2];S=1;da=0;while(1){H[aa+8>>2]=n;H[aa+40>>2]=b;g=H[h+164>>2];i=H[h+160>>2];k=H[h+156>>2];j=H[h+152>>2];na=(j|0)%2|0;H[aa+44>>2]=na;u=(k|0)%2|0;H[aa+12>>2]=u;w=i-j|0;ia=w-b|0;H[aa+36>>2]=ia;Z=g-k|0;D=Z-n|0;H[aa+4>>2]=D;m=C;o=m;k=Q;i=k;g=A;X=g;j=z;_=j;Wa:{if(!da&(v|0)==(S|0)){break Wa}M=v-S|0;i=0;o=0;if(m){g=M&31;if((M&63)>>>0>=32){l=-1<>>32-g}j=m+(j^-1)|0;g=l^-1;g=j>>>0>>0?g+1|0:g;k=M&31;if((M&63)>>>0>=32){o=g>>>k|0}else{o=((1<>>k}}if(Q){i=M&31;if((M&63)>>>0>=32){l=-1<>>32-i}j=Q+(j^-1)|0;i=l^-1;i=j>>>0>>0?i+1|0:i;g=M&31;if((M&63)>>>0>=32){i=i>>>g|0}else{i=((1<>>g}}j=0;g=0;if(A){k=M&31;if((M&63)>>>0>=32){l=-1<>>32-k}g=A+(g^-1)|0;k=l^-1;k=g>>>0>>0?k+1|0:k;m=M&31;if((M&63)>>>0>=32){g=k>>>m|0}else{g=((1<>>m}}if(z){k=M&31;if((M&63)>>>0>=32){l=-1<>>32-k}j=z+(j^-1)|0;k=l^-1;k=j>>>0>>0?k+1|0:k;m=M&31;if((M&63)>>>0>=32){j=k>>>m|0}else{j=((1<>>m}}X=0;m=0;W=1<>>0>>0){m=M&31;if((M&63)>>>0>=32){l=-1<>>32-m}q=k^-1;k=q+(C-W|0)|0;m=l^-1;m=k>>>0>>0?m+1|0:m;l=M&31;if((M&63)>>>0>=32){m=m>>>l|0}else{m=((1<>>l}}if(A>>>0>W>>>0){l=M&31;if((M&63)>>>0>=32){l=-1<>>32-l}q=k^-1;k=q+(A-W|0)|0;l=l^-1;l=k>>>0>>0?l+1|0:l;q=M&31;if((M&63)>>>0>=32){X=l>>>q|0}else{X=((1<>>q}}_=0;k=0;if(Q>>>0>W>>>0){l=M&31;if((M&63)>>>0>=32){l=-1<>>32-l}q=k^-1;k=q+(Q-W|0)|0;l=l^-1;l=k>>>0>>0?l+1|0:l;q=M&31;if((M&63)>>>0>=32){k=l>>>q|0}else{k=((1<>>q}}if(z>>>0<=W>>>0){break Wa}l=M&31;if((M&63)>>>0>=32){l=-1<>>32-l}ca=q^-1;q=ca+(z-W|0)|0;l=l^-1;ca=q>>>0>>0?l+1|0:l;l=q;q=M&31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:b;b=0;while(1){V=b+i|0;ba=V+1|0;q=b<<2;Ra(la,ka,V,sa,ba,q+na|0,16,0);Ra(la,fa,V,D,ba,q+ma|0,16,0);b=b+1|0;if((ca|0)!=(b|0)){continue}break}Wa(aa+32|0);b=i;i=i+8|0;if(!ab(la,_,b,Y,i,ia,8,1)){break Va}}b=i|7;if(Z>>>0>b>>>0){continue}break}}if(!(!(i>>>0>>0&b>>>0>=l>>>0)&(g+n>>>0<=i>>>0|k+n>>>0>b>>>0)|i>>>0>=Z>>>0)){fa=aa+32|0;D=0;ia=Z-i|0;if(ia){while(1){M=i+D|0;W=M+1|0;b=H[fa+16>>2];ca=D<<2;Ra(la,b,M,H[fa+20>>2],W,ca+((H[fa>>2]+(H[fa+12>>2]<<5)|0)+(b<<6)|0)|0,16,0);q=H[fa+24>>2];b=H[fa+8>>2];Ra(la,q+b|0,M,b+H[fa+28>>2]|0,W,(ca+((H[fa>>2]-(H[fa+12>>2]<<5)|0)+(q<<6)|0)|0)+32|0,16,0);D=D+1|0;if((ia|0)!=(D|0)){continue}break}}Wa(fa);if(!ab(la,_,i,Y,Z,ea+(_<<5)|0,8,1)){break Va}}H[aa+28>>2]=g;H[aa+24>>2]=k;H[aa+20>>2]=pa;H[aa+16>>2]=l;if(Y>>>0>_>>>0){j=j<<1;b=X<<1|1;b=b>>>0>>0?j:b;ia=b>>>0>>0?b:Z;b=u<<5;ca=(ya-b|0)+(k<<6)|0;X=(b+ea|0)+(l<<6)|0;q=g+n|0;g=k+n|0;j=m<<1;b=o<<1|1;i=b>>>0>j>>>0?j:b;j=ea+(i<<5)|0;while(1){b=Y-_|0;b=(b>>>0>=8?8:b)+_|0;Ra(la,_,l,b,pa,X,1,16);Ra(la,_,g,b,q,ca,1,16);Wa(aa);if(!ab(la,_,i,b,ia,j,1,8)){break Va}_=_+8|0;if(Y>>>0>_>>>0){continue}break}}h=h+152|0;b=w;n=Z;S=S+1|0;da=S?da:da+1|0;if(da|(s|0)!=(S|0)){continue}break}}g=1;i=H[x-16>>2];j=H[va>>2];h=H[ja>>2];b=H[x-8>>2];Ra(la,i-j|0,H[x-12>>2]-h|0,b-j|0,H[x-4>>2]-h|0,H[p+52>>2],1,b-i|0);Xa(la);Da(ea);break Ga}Xa(la);Da(ea);g=0;break Ga}Xa(la);g=0;break Ga}g=0;Ua(S);Da(ea)}oa=aa- -64|0;if(g){break V}break b}E=E+1080|0;t=t+52|0;p=p+76|0;r=r+1|0;if(r>>>0>2]){continue}break}E=H[R+32>>2];qa=H[H[R+20>>2]>>2]}i=H[E+16>>2];Za:{if(H[R+68>>2]|!i){break Za}t=H[qa+20>>2];k=H[t+28>>2];_a:{$a:{g=H[R+64>>2];if(g){r=H[qa+16>>2];if(r>>>0<3){break _a}j=H[t+24>>2];if(!((j|0)==H[t+100>>2]&(j|0)==H[t+176>>2])){Ca(f,1,10089,0);break b}h=H[H[R+24>>2]+24>>2];b=H[h+36>>2];ab:{if((b|0)!=H[h+88>>2]|(b|0)!=H[h+140>>2]){break ab}h=N(j,152);b=h+k|0;b=N(H[b-140>>2]-H[b-148>>2]|0,H[b-144>>2]-H[b-152>>2]|0);j=h+H[t+104>>2]|0;if((b|0)!=(N(H[j-140>>2]-H[j-148>>2]|0,H[j-144>>2]-H[j-152>>2]|0)|0)){break ab}h=h+H[t+180>>2]|0;if((N(H[h-140>>2]-H[h-148>>2]|0,H[h-144>>2]-H[h-152>>2]|0)|0)==(b|0)){break $a}}Ca(f,1,10089,0);break b}r=H[qa+16>>2];if(r>>>0<3){break _a}b=H[H[R+24>>2]+24>>2];h=H[b+36>>2];bb:{if((h|0)!=H[b+88>>2]){break bb}j=H[b+140>>2];if((j|0)!=(h|0)){break bb}h=N(h,152);b=k+h|0;b=N(H[b+148>>2]-H[b+140>>2]|0,H[b+144>>2]-H[b+136>>2]|0);h=h+H[t+104>>2]|0;if((b|0)!=(N(H[h+148>>2]-H[h+140>>2]|0,H[h+144>>2]-H[h+136>>2]|0)|0)){break bb}h=H[t+180>>2]+N(j,152)|0;if((N(H[h+148>>2]-H[h+140>>2]|0,H[h+144>>2]-H[h+136>>2]|0)|0)==(b|0)){break $a}}Ca(f,1,10089,0);break b}if((i|0)==2){if(!H[E+5608>>2]){break Za}z=Ga(r<<2);if(!z){break b}A=H[qa+16>>2];cb:{if(!A){break cb}db:{eb:{if(H[R+64>>2]){o=A&3;h=0;if(A>>>0>=4){break eb}p=0;break db}o=A&3;h=0;fb:{if(A>>>0<4){p=0;break fb}k=z+12|0;r=z+8|0;i=z+4|0;j=A&-4;p=0;g=0;while(1){n=p<<2;H[n+z>>2]=H[t+52>>2];H[i+n>>2]=H[t+128>>2];H[n+r>>2]=H[t+204>>2];H[k+n>>2]=H[t+280>>2];p=p+4|0;t=t+304|0;g=g+4|0;if((j|0)!=(g|0)){continue}break}}if(!o){break cb}while(1){H[z+(p<<2)>>2]=H[t+52>>2];p=p+1|0;t=t+76|0;h=h+1|0;if((o|0)!=(h|0)){continue}break}break cb}k=z+12|0;r=z+8|0;i=z+4|0;j=A&-4;p=0;g=0;while(1){n=p<<2;H[n+z>>2]=H[t+36>>2];H[i+n>>2]=H[t+112>>2];H[n+r>>2]=H[t+188>>2];H[k+n>>2]=H[t+264>>2];p=p+4|0;t=t+304|0;g=g+4|0;if((j|0)!=(g|0)){continue}break}}if(!o){break cb}while(1){H[z+(p<<2)>>2]=H[t+36>>2];p=p+1|0;t=t+76|0;h=h+1|0;if((o|0)!=(h|0)){continue}break}}h=H[E+5608>>2];n=0;Q=Ga(A<<3);j=0;gb:{if(!Q){break gb}if(!(!b|!A)){m=Q+(A<<2)|0;o=Q+12|0;r=Q+8|0;i=Q+4|0;t=A&-4;w=A&3;l=A-1|0;while(1){p=0;k=0;if(l>>>0>=3){while(1){g=p<<2;L[g+Q>>2]=L[H[g+z>>2]>>2];j=g|4;L[j+Q>>2]=L[H[j+z>>2]>>2];j=g|8;L[j+Q>>2]=L[H[j+z>>2]>>2];j=g|12;L[j+Q>>2]=L[H[j+z>>2]>>2];p=p+4|0;k=k+4|0;if((t|0)!=(k|0)){continue}break}}s=0;if(w){while(1){j=p<<2;L[j+Q>>2]=L[H[j+z>>2]>>2];p=p+1|0;s=s+1|0;if((w|0)!=(s|0)){continue}break}}g=0;p=h;while(1){j=g<<2;C=j+m|0;H[C>>2]=0;ha=O(0);s=0;k=0;if(l>>>0>2){while(1){q=s<<2;ha=O(O(L[p>>2]*L[q+Q>>2])+ha);L[C>>2]=ha;ha=O(O(L[p+4>>2]*L[i+q>>2])+ha);L[C>>2]=ha;ha=O(O(L[p+8>>2]*L[q+r>>2])+ha);L[C>>2]=ha;ha=O(O(L[p+12>>2]*L[o+q>>2])+ha);L[C>>2]=ha;s=s+4|0;p=p+16|0;k=k+4|0;if((t|0)!=(k|0)){continue}break}}k=0;if(w){while(1){ha=O(O(L[p>>2]*L[Q+(s<<2)>>2])+ha);L[C>>2]=ha;s=s+1|0;p=p+4|0;k=k+1|0;if((w|0)!=(k|0)){continue}break}}j=j+z|0;k=H[j>>2];H[j>>2]=k+4;L[k>>2]=ha;g=g+1|0;if((A|0)!=(g|0)){continue}break}n=n+1|0;if((n|0)!=(b|0)){continue}break}}Da(Q);j=1}b=j;Da(z);if(b){break Za}break b}if(H[H[E+5584>>2]+20>>2]==1){if(g){oc(H[t+36>>2],H[t+112>>2],H[t+188>>2],b);break Za}oc(H[t+52>>2],H[t+128>>2],H[t+204>>2],b);break Za}if(g){nc(H[t+36>>2],H[t+112>>2],H[t+188>>2],b);break Za}nc(H[t+52>>2],H[t+128>>2],H[t+204>>2],b);break Za}H[Ha>>2]=r;Ca(f,1,10150,Ha)}w=H[H[R+20>>2]>>2];if(!H[w+16>>2]){$=1;break b}q=H[R+68>>2];n=H[w+20>>2];b=H[H[R+32>>2]+5584>>2];o=H[H[R+24>>2]+24>>2];j=0;while(1){hb:{if(H[q+(j<<2)>>2]?0:q){break hb}h=H[n+28>>2];i=h+N(H[o+36>>2],152)|0;ib:{if(!H[R+64>>2]){g=H[i+148>>2]-H[i+140>>2]|0;qa=H[i+144>>2]-H[i+136>>2]|0;k=0;r=52;break ib}h=h+N(H[n+24>>2],152)|0;qa=H[i+8>>2]-H[i>>2]|0;k=H[h-144>>2]-(qa+H[h-152>>2]|0)|0;g=H[i+12>>2]-H[i+4>>2]|0;r=36}h=H[o+24>>2];jb:{if(H[o+32>>2]){h=1<>2];if(H[b+20>>2]==1){l=qa&-2;m=qa&1;t=0;h=k<<2;while(1){r=0;if((qa|0)!=1){while(1){k=H[b+1076>>2]+H[$>>2]|0;H[$>>2]=(i|0)>(k|0)?i:(k|0)<(p|0)?k:p;k=H[b+1076>>2]+H[$+4>>2]|0;H[$+4>>2]=(i|0)>(k|0)?i:(k|0)<(p|0)?k:p;$=$+8|0;r=r+2|0;if((l|0)!=(r|0)){continue}break}}if(m){r=H[b+1076>>2]+H[$>>2]|0;H[$>>2]=(i|0)>(r|0)?i:(p|0)>(r|0)?r:p;$=$+4|0}$=$+h|0;t=t+1|0;if((t|0)!=(g|0)){continue}break}break hb}t=i>>31;h=0;while(1){r=0;while(1){ha=L[$>>2];m=p;kb:{if(ha>O(2147483648)){break kb}m=i;if(ha>2];l=m;m=l>>31;eb=O(T(ha));sb=O(ha-eb);if(sbO(.5)){break lb}ha=O(eb*O(.5));fb=O(ha-O(T(ha)))==O(0)?eb:fb}ha=fb}if(O(P(ha))>31)|0;C=m+1|0;v=m;m=l+s|0;l=s>>>0>m>>>0?C:v;m=(l|0)<=(t|0)&i>>>0>m>>>0|(l|0)<(t|0)?i:m>>>0

>>0&(l|0)<=0|(l|0)<0?m:p}H[$>>2]=m;$=$+4|0;r=r+1|0;if((qa|0)!=(r|0)){continue}break}$=(k<<2)+$|0;h=h+1|0;if((g|0)!=(h|0)){continue}break}}n=n+76|0;b=b+1080|0;o=o+52|0;$=1;j=j+1|0;if(j>>>0>2]){continue}break}break b}$=0;Ca(f,1,3372,0)}oa=Ha+16|0;if(!$){mb(Ya);H[a+8>>2]=H[a+8>>2]|32768;Ca(f,1,11451,0);break a}mb:{if(!c){break mb}b=0;m=H[a+232>>2];h=bc(m,1);if(!((h|0)==-1|d>>>0>>0)){nb:{b=1;d=H[m+24>>2];if(!H[d+16>>2]){break nb}i=H[d+24>>2];k=H[H[H[m+20>>2]>>2]+20>>2];while(1){b=H[i+24>>2];g=b&7;j=b>>>3|0;b=H[k+28>>2];o=b+N(H[i+36>>2],152)|0;ob:{if(H[m+64>>2]){b=b+N(H[k+24>>2],152)|0;d=H[o+8>>2]-H[o>>2]|0;r=H[b-144>>2]-(d+H[b-152>>2]|0)|0;h=H[o+12>>2]-H[o+4>>2]|0;b=36;break ob}h=H[o+148>>2]-H[o+140>>2]|0;d=H[o+144>>2]-H[o+136>>2]|0;r=0;b=52}b=H[b+k>>2];pb:{qb:{rb:{sb:{j=j+((g|0)!=0)|0;switch(((j|0)==3?4:j)-1|0){case 0:break rb;case 1:break qb;case 3:break sb;default:break pb}}if(!h){break pb}l=d<<2;if((h|0)!=1){o=h&-2;j=0;while(1){g=!l;if(!g){B(c,b,l)}d=r<<2;n=d+(b+l|0)|0;b=c+l|0;if(!g){B(b,n,l)}c=b+l|0;b=d+(l+n|0)|0;j=j+2|0;if((o|0)!=(j|0)){continue}break}}if(!(h&1)){break pb}if(l){B(c,b,l)}c=c+l|0;break pb}j=!h|!d;if(H[i+32>>2]){if(j){break pb}o=d&-8;n=d&7;j=0;g=d-1>>>0<7;while(1){d=0;if(!g){while(1){F[c|0]=H[b>>2];F[c+1|0]=H[b+4>>2];F[c+2|0]=H[b+8>>2];F[c+3|0]=H[b+12>>2];F[c+4|0]=H[b+16>>2];F[c+5|0]=H[b+20>>2];F[c+6|0]=H[b+24>>2];F[c+7|0]=H[b+28>>2];c=c+8|0;b=b+32|0;d=d+8|0;if((o|0)!=(d|0)){continue}break}}d=0;if(n){while(1){F[c|0]=H[b>>2];c=c+1|0;b=b+4|0;d=d+1|0;if((n|0)!=(d|0)){continue}break}}b=(r<<2)+b|0;j=j+1|0;if((h|0)!=(j|0)){continue}break}break pb}if(j){break pb}o=d&-8;n=d&7;j=0;g=d-1>>>0<7;r=r<<2;while(1){d=0;if(!g){while(1){F[c|0]=H[b>>2];F[c+1|0]=H[b+4>>2];F[c+2|0]=H[b+8>>2];F[c+3|0]=H[b+12>>2];F[c+4|0]=H[b+16>>2];F[c+5|0]=H[b+20>>2];F[c+6|0]=H[b+24>>2];F[c+7|0]=H[b+28>>2];c=c+8|0;b=b+32|0;d=d+8|0;if((o|0)!=(d|0)){continue}break}}d=0;if(n){while(1){F[c|0]=H[b>>2];c=c+1|0;b=b+4|0;d=d+1|0;if((n|0)!=(d|0)){continue}break}}b=b+r|0;j=j+1|0;if((h|0)!=(j|0)){continue}break}break pb}j=!h|!d;if(H[i+32>>2]){if(j){break pb}o=d&-8;n=d&7;j=0;g=d-1>>>0<7;while(1){d=0;if(!g){while(1){G[c>>1]=H[b>>2];G[c+2>>1]=H[b+4>>2];G[c+4>>1]=H[b+8>>2];G[c+6>>1]=H[b+12>>2];G[c+8>>1]=H[b+16>>2];G[c+10>>1]=H[b+20>>2];G[c+12>>1]=H[b+24>>2];G[c+14>>1]=H[b+28>>2];c=c+16|0;b=b+32|0;d=d+8|0;if((o|0)!=(d|0)){continue}break}}d=0;if(n){while(1){G[c>>1]=H[b>>2];c=c+2|0;b=b+4|0;d=d+1|0;if((n|0)!=(d|0)){continue}break}}b=(r<<2)+b|0;j=j+1|0;if((h|0)!=(j|0)){continue}break}break pb}if(j){break pb}o=d&-8;n=d&7;j=0;g=d-1>>>0<7;while(1){d=0;if(!g){while(1){G[c>>1]=H[b>>2];G[c+2>>1]=H[b+4>>2];G[c+4>>1]=H[b+8>>2];G[c+6>>1]=H[b+12>>2];G[c+8>>1]=H[b+16>>2];G[c+10>>1]=H[b+20>>2];G[c+12>>1]=H[b+24>>2];G[c+14>>1]=H[b+28>>2];c=c+16|0;b=b+32|0;d=d+8|0;if((o|0)!=(d|0)){continue}break}}d=0;if(n){while(1){G[c>>1]=H[b>>2];c=c+2|0;b=b+4|0;d=d+1|0;if((n|0)!=(d|0)){continue}break}}b=(r<<2)+b|0;j=j+1|0;if((h|0)!=(j|0)){continue}break}}k=k+76|0;i=i+52|0;b=1;tb=tb+1|0;if(tb>>>0>2]+16>>2]){continue}break}}}if(!b){break a}b=H[Ya+5596>>2];if(!b){break mb}Da(b);H[Ya+5596>>2]=0;H[Ya+5600>>2]=0}F[a+92|0]=I[a+92|0]&254;H[a+8>>2]=H[a+8>>2]&-129;gb=1;c=Sa(e);b=H[a+8>>2];if(!(c|ra)&(b|0)==64|(b|0)==256){break a}if((Ka(e,Za+10|0,2,f)|0)!=2){Ca(f,H[a+208>>2]?1:2,2472,0);gb=!H[a+208>>2];break a}Ea(Za+10|0,Za+12|0,2);b=H[Za+12>>2];if((b|0)==65424){break a}if((b|0)==65497){H[a+8>>2]=256;H[a+228>>2]=0;break a}if(!(Sa(e)|ra)){H[a+8>>2]=64;Ca(f,2,8419,0);break a}gb=0;Ca(f,1,8306,0)}oa=Za+16|0;return gb|0}function Za(a,b,c,d,e,f,g,h,i,j,k){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,v=0,x=0,z=0,A=0,C=0,D=0,E=0,J=0,M=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=O(0),Y=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,pa=0,qa=0,ta=0,ua=0,va=0,wa=0,xa=O(0);s=oa-80|0;oa=s;H[s+40>>2]=65424;z=N(H[a+132>>2],H[a+128>>2]);a:{b:{c:{l=H[a+8>>2];d:{if((l|0)!=8){j=0;if((l|0)!=256){break a}H[s+40>>2]=65497;break d}if(F[a+92|0]&1){break d}C=z&-2;E=z&1;R=s+77|0;S=s+76|0;T=s+72|0;n=65424;e:{f:{while(1){g:{h:{i:{j:{k:{l:{m:{n:{l=H[a+84>>2];if(!l){break n}p=l;l=H[a+80>>2];if(p>>>0<=l>>>0){break n}o=H[a+88>>2]+(l<<3)|0;n=H[o>>2];o=H[o+4>>2];H[a+80>>2]=l+1;if(!fb(j,n,o,k)){Ca(k,1,5440,0);j=0;break a}if((Ka(j,H[a+16>>2],2,k)|0)!=2){Ca(k,1,2472,0);j=0;break a}Ea(H[a+16>>2],s+40|0,2);if(H[s+40>>2]==65424){break m}Ca(k,1,4073,0);j=0;break a}if((n|0)==65427){break l}}while(1){if(!(Sa(j)|ra)){H[a+8>>2]=64;break l}if((Ka(j,H[a+16>>2],2,k)|0)!=2){Ca(k,1,2472,0);j=0;break a}Ea(H[a+16>>2],s+36|0,2);if(K[s+36>>2]<=1){Ca(k,1,6048,0);j=0;break a}o:{if(H[s+40>>2]!=32896){break o}if(Sa(j)|ra){break o}H[a+8>>2]=64;break l}r=H[a+8>>2];p:{if(!(r&16)){n=H[s+36>>2];break p}n=H[s+36>>2];l=H[a+24>>2];if(!l){break p}o=n+2|0;if(o>>>0>l>>>0){Ca(k,1,8370,0);j=0;break a}H[a+24>>2]=l-o}o=n-2|0;H[s+36>>2]=o;l=24912;t=H[s+40>>2];while(1){n=l;m=H[l>>2];if(m){l=l+12|0;if((m|0)!=(t|0)){continue}}break}if(!(r&H[n+4>>2])){Ca(k,1,5397,0);j=0;break a}q:{if(K[a+20>>2]>=o>>>0){l=H[a+16>>2];break q}l=Sa(j);r=ra;if((r|0)<0){l=1}else{l=l>>>0>>0&(r|0)<=0}if(l){Ca(k,1,5797,0);j=0;break a}l=Ia(H[a+16>>2],H[s+36>>2]);if(!l){Da(H[a+16>>2]);H[a+16>>2]=0;H[a+20>>2]=0;Ca(k,1,4973,0);j=0;break a}H[a+16>>2]=l;o=H[s+36>>2];H[a+20>>2]=o}l=Ka(j,l,o,k);if((l|0)!=H[s+36>>2]){Ca(k,1,2472,0);j=0;break a}o=H[n+8>>2];if(!o){Ca(k,1,11725,0);j=0;break a}if(!(sa[o|0](a,H[a+16>>2],l,k)|0)){H[s+32>>2]=H[s+40>>2];Ca(k,1,13959,s+32|0);j=0;break a}n=H[j+56>>2];t=H[s+36>>2];A=H[a+224>>2];o=H[A+40>>2];p=H[a+228>>2];x=N(p,40);l=o+x|0;M=H[l+20>>2];r=M+1|0;q=H[l+28>>2];if(r>>>0>q>>>0){X=O(O(q>>>0)+O(100));if(X=O(0)){o=~~X>>>0}else{o=0}H[l+28>>2]=o;r=Ia(H[l+24>>2],N(o,24));o=H[A+40>>2];l=x+o|0;if(!r){break k}H[l+24>>2]=r;M=H[l+20>>2];r=M+1|0}o=o+x|0;l=H[o+24>>2]+N(M,24)|0;H[l+16>>2]=t+4;n=(n-t|0)-4|0;H[l+8>>2]=n;H[l+12>>2]=n>>31;G[l>>1]=m;H[o+20>>2]=r;r:{if((m|0)!=65424){break r}l=H[o+16>>2];s:{if(!l){break s}p=H[o+4>>2];o=H[o+12>>2];if(p>>>0<=o>>>0){break s}l=l+N(o,24)|0;H[l>>2]=n;H[l+4>>2]=0}l=(H[j+56>>2]-H[s+36>>2]|0)-4|0;o=H[a+48>>2];n=H[a+52>>2];if((n|0)>0){p=1}else{p=l>>>0<=o>>>0&(n|0)>=0}if(p){break r}H[a+48>>2]=l;H[a+52>>2]=0}if(I[a+92|0]&4){if((ub(j,H[a+24>>2],k)|0)!=H[a+24>>2]|ra){Ca(k,1,2472,0);j=0;break a}H[s+40>>2]=65427;break l}if((Ka(j,H[a+16>>2],2,k)|0)!=2){Ca(k,1,2472,0);j=0;break a}Ea(H[a+16>>2],s+40|0,2);if(H[s+40>>2]!=65427){continue}break}}if(!(!(Sa(j)|ra)&H[a+8>>2]==64)){l=I[a+92|0];if(!(l&4)){l=N(H[a+228>>2],5644);o=H[a+180>>2];t:{u:{if(H[a+56>>2]){m=Sa(j);break u}m=H[a+24>>2];if(m>>>0<2){break t}}m=m-2|0;H[a+24>>2]=m}A=l+o|0;if(!m){break j}l=Sa(j);o=ra;if((o|0)<0){l=1}else{l=l>>>0>>0&(o|0)<=0}if(l){if(H[a+208>>2]){Ca(k,1,5842,0);j=0;break a}Ca(k,2,5842,0)}l=H[a+24>>2];if(l>>>0>=4294967294){Ca(k,1,1480,0);j=0;break a}o=H[A+5596>>2];v:{if(o){n=H[A+5600>>2];if(n>>>0>-3-l>>>0){Ca(k,1,1211,0);j=0;break a}l=Ia(o,(l+n|0)+2|0);if(l){H[A+5596>>2]=l;break j}Da(H[A+5596>>2]);H[A+5596>>2]=0;break v}l=Ga(l+2|0);H[A+5596>>2]=l;if(l){break j}}Ca(k,1,6176,0);j=0;break a}H[a+8>>2]=8;F[a+92|0]=l&250;break i}n=H[s+40>>2];break g}Da(H[l+24>>2]);a=H[A+40>>2]+N(p,40)|0;H[a+28>>2]=0;H[a+20>>2]=0;H[a+24>>2]=0;Ca(k,1,3863,0);j=0;break a}x=H[j+56>>2];n=x-2|0;t=H[j+60>>2];r=t-(x>>>0<2)|0;p=H[a+224>>2];P=H[p+40>>2];D=H[a+228>>2];q=N(D,40);o=P+q|0;l=H[o+16>>2]+N(H[o+12>>2],24)|0;H[l+8>>2]=n;H[l+12>>2]=r;r=l;l=t;v=H[a+24>>2];x=v+x|0;H[r+16>>2]=x;H[r+20>>2]=v>>>0>x>>>0?l+1|0:l;t=H[a+24>>2];M=H[o+20>>2];r=M+1|0;l=H[o+28>>2];w:{if(r>>>0<=l>>>0){l=H[o+24>>2];break w}X=O(O(l>>>0)+O(100));if(X=O(0)){l=~~X>>>0}else{l=0}H[o+28>>2]=l;l=Ia(H[o+24>>2],N(l,24));P=H[p+40>>2];o=q+P|0;if(!l){break f}H[o+24>>2]=l;M=H[o+20>>2];r=M+1|0}l=N(M,24)+l|0;H[l+16>>2]=t+2;H[l+8>>2]=n;H[l+12>>2]=n>>31;G[l>>1]=65427;H[(q+P|0)+20>>2]=r;x:{if(m){m=Ka(j,H[A+5596>>2]+H[A+5600>>2]|0,H[a+24>>2],k);l=8;if((m|0)==H[a+24>>2]){break x}l=64;if((m|0)!=-1){break x}Ca(k,1,2472,0);j=0;break a}m=0;l=H[a+24>>2]?64:8}H[a+8>>2]=l;H[A+5600>>2]=H[A+5600>>2]+m;y:{if(F[a+92|0]&1){break y}l=H[a+44>>2];if(H[a+76>>2]|((l|0)<0|(l|0)!=H[a+228>>2])){break y}if(!Fb(j)){break y}o=H[a+228>>2];n=H[a+180>>2]+N(o,5644)|0;l=H[n+5592>>2];o=H[H[a+224>>2]+40>>2]+N(o,40)|0;if((l|0)!=H[o+4>>2]){break y}p=l;l=H[n+5588>>2]+1|0;if(p>>>0<=l>>>0){break y}z:{o=H[o+16>>2]+N(l,24)|0;l=H[o>>2];o=H[o+4>>2];if((l|0)==H[j+56>>2]&(o|0)==H[j+60>>2]){break z}if(fb(j,l,o,k)){break z}Ca(k,1,5440,0);j=0;break a}if((Ka(j,H[a+16>>2],2,k)|0)!=2){Ca(k,1,2472,0);j=0;break a}Ea(H[a+16>>2],s+40|0,2);if(H[s+40>>2]==65424){break h}Ca(k,1,4073,0);j=0;break a}l=I[a+92|0];if((l&9)!=1){break i}F[a+92|0]=l|8;r=H[a+228>>2];if(H[(H[a+180>>2]+N(r,5644)|0)+5592>>2]==1){break i}if(!Fb(j)){break i}n=H[j+60>>2];t=n;o=H[j+56>>2];if((n&o)==-1){break i}A:{while(1){l=1;n=s+70|0;if((Ka(j,n,2,k)|0)!=2){break A}Ea(n,s- -64|0,2);if(H[s+64>>2]!=65424){break A}m=2472;if((Ka(j,n,2,k)|0)!=2){break c}Ea(n,s+60|0,2);if(H[s+60>>2]!=10){m=6048;break c}H[s+60>>2]=8;n=Ka(j,s+70|0,8,k);if((n|0)!=H[s+60>>2]){break c}if((n|0)!=8){m=4047;break c}Ea(s+70|0,s+56|0,2);Ea(T,s+52|0,4);Ea(S,s+48|0,1);Ea(R,s+44|0,1);if((r|0)!=H[s+56>>2]){n=H[s+52>>2];if(n>>>0<14){break A}n=n-12|0;H[s+52>>2]=n;n=ub(j,n,k);if(!ra&H[s+52>>2]==(n|0)){continue}break A}break}l=H[s+48>>2]!=H[s+44>>2]}if(!zc(j,o,t,k)){break b}if(l){break i}F[a+92|0]=I[a+92|0]&238|16;B:{if(!z){break B}o=H[a+180>>2];n=0;l=0;if((z|0)!=1){while(1){m=o+N(n,5644)|0;r=H[m+5592>>2];if(r){H[m+5592>>2]=r+1}m=o+N(n|1,5644)|0;r=H[m+5592>>2];if(r){H[m+5592>>2]=r+1}n=n+2|0;l=l+2|0;if((C|0)!=(l|0)){continue}break}}if(!E){break B}l=o+N(n,5644)|0;o=H[l+5592>>2];if(!o){break B}H[l+5592>>2]=o+1}Ca(k,2,9035,0)}if(F[a+92|0]&1){break h}if((Ka(j,H[a+16>>2],2,k)|0)!=2){if(!(!z|(z|0)!=(H[a+228>>2]+1|0))){j=H[a+180>>2];n=0;while(1){l=j+N(n,5644)|0;if(!(H[l+5588>>2]|H[l+5592>>2])){break e}n=n+1|0;if((z|0)!=(n|0)){continue}break}}Ca(k,1,2472,0);j=0;break a}Ea(H[a+16>>2],s+40|0,2)}n=H[s+40>>2];if(F[a+92|0]&1){break g}if((n|0)!=65497){continue}}break}if(H[a+8>>2]==256|(n|0)!=65497){break d}H[a+8>>2]=256;H[a+228>>2]=0;break d}Da(H[o+24>>2]);a=H[p+40>>2]+N(D,40)|0;H[a+28>>2]=0;H[a+20>>2]=0;H[a+24>>2]=0;Ca(k,1,3863,0);j=0;break a}H[s+16>>2]=n;Ca(k,4,11004,s+16|0);H[a+228>>2]=n;H[s+40>>2]=65497;H[a+8>>2]=256}n=H[a+228>>2];j=H[a+180>>2];C:{D:{if(F[a+92|0]&1){break D}E:{F:{if(n>>>0>=z>>>0){break F}m=j+N(n,5644)|0;while(1){if(H[m+5596>>2]){break F}n=n+1|0;H[a+228>>2]=n;m=m+5644|0;if((n|0)!=(z|0)){continue}break}break E}if((n|0)!=(z|0)){break D}}H[i>>2]=0;break C}G:{H:{l=j+N(n,5644)|0;if(H[l+5172>>2]){a=6837}else{if(!(I[l+5640|0]&2)){break G}r=H[l+5160>>2];I:{if(!r){m=0;break I}z=H[l+5164>>2];j=0;m=0;n=0;if(r>>>0>=4){A=r&-4;o=0;while(1){t=z+(n<<3)|0;m=H[t+28>>2]+(H[t+20>>2]+(H[t+12>>2]+(H[t+4>>2]+m|0)|0)|0)|0;n=n+4|0;o=o+4|0;if((A|0)!=(o|0)){continue}break}}o=r&3;if(!o){break I}while(1){m=H[(z+(n<<3)|0)+4>>2]+m|0;n=n+1|0;j=j+1|0;if((o|0)!=(j|0)){continue}break}}j=Ga(m);H[l+5172>>2]=j;if(j){break H}a=4009}Ca(k,1,a,0);Ca(k,1,8059,0);j=0;break a}H[l+5180>>2]=m;m=H[l+5164>>2];j=H[l+5160>>2];if(j){o=0;n=0;while(1){r=n<<3;t=r+m|0;z=H[t>>2];if(z){j=H[t+4>>2];if(j){B(H[l+5172>>2]+o|0,z,j)}j=r+H[l+5164>>2]|0;t=H[j+4>>2];Da(H[j>>2]);m=H[l+5164>>2];j=r+m|0;H[j>>2]=0;H[j+4>>2]=0;o=o+t|0;j=H[l+5160>>2]}n=n+1|0;if(n>>>0>>0){continue}break}}H[l+5160>>2]=0;Da(m);H[l+5164>>2]=0;H[l+5168>>2]=H[l+5172>>2];H[l+5176>>2]=H[l+5180>>2]}l=H[a+232>>2];Y=H[l+28>>2];o=H[a+228>>2];M=H[(H[Y+76>>2]+N(o,5644)|0)+5584>>2];j=H[l+24>>2];Z=H[j+24>>2];n=H[Y+24>>2];m=(o>>>0)/(n>>>0)|0;U=H[H[l+20>>2]>>2];l=o-N(m,n)|0;n=H[Y+12>>2];l=H[Y+4>>2]+N(l,n)|0;o=H[j>>2];o=l>>>0>o>>>0?l:o;H[U>>2]=o;n=l+n|0;l=l>>>0>n>>>0?-1:n;n=H[j+8>>2];l=l>>>0>>0?l:n;H[U+8>>2]=l;J:{K:{if(!((l|0)>(o|0)&(o|0)>=0)){Ca(k,1,6682,0);break K}n=H[U+20>>2];l=m;m=H[Y+16>>2];l=H[Y+8>>2]+N(l,m)|0;o=H[j+4>>2];o=l>>>0>o>>>0?l:o;H[U+4>>2]=o;m=l+m|0;l=l>>>0>m>>>0?-1:m;j=H[j+12>>2];j=j>>>0>l>>>0?l:j;H[U+12>>2]=j;if(!((j|0)>(o|0)&(o|0)>=0)){Ca(k,1,6644,0);break K}L:{if(H[M+4>>2]){if(H[U+16>>2]){break L}j=1;break J}Ca(k,1,5358,0);break K}M:{N:{while(1){H[Z+36>>2]=0;j=H[Z>>2];m=j>>31;z=j-1|0;l=H[U>>2];r=l;o=z+l|0;x=m-!j|0;l=x+(l>>31)|0;va=n,wa=Je(o,o>>>0>>0?l+1|0:l,j,m),H[va>>2]=wa;o=H[Z+4>>2];t=o>>31;r=o-1|0;l=H[U+4>>2];p=l;A=r+l|0;q=t-!o|0;l=q+(l>>31)|0;va=n,wa=Je(A,p>>>0>A>>>0?l+1|0:l,o,t),H[va+4>>2]=wa;l=H[U+8>>2];A=l;z=l+z|0;l=(l>>31)+x|0;va=n,wa=Je(z,z>>>0>>0?l+1|0:l,j,m),H[va+8>>2]=wa;j=H[U+12>>2];H[n+16>>2]=ga;l=q+(j>>31)|0;j=j+r|0;l=j>>>0>>0?l+1|0:l;va=n,wa=Je(j,l,o,t),H[va+12>>2]=wa;j=H[M+4>>2];H[n+20>>2]=j;l=H[Y+80>>2];H[n+24>>2]=j>>>0>>0?1:j-l|0;Da(H[n+52>>2]);H[n+68>>2]=0;H[n+60>>2]=0;H[n+64>>2]=0;H[n+52>>2]=0;H[n+56>>2]=0;j=N(j,152);l=H[n+28>>2];O:{if(!l){l=Ga(j);H[n+28>>2]=l;if(!l){break K}H[n+32>>2]=j;if(!j){break O}y(l,0,j);break O}if(j>>>0<=K[n+32>>2]){break O}l=Ia(l,j);if(!l){Ca(k,1,3090,0);Da(H[n+28>>2]);H[n+28>>2]=0;H[n+32>>2]=0;break K}H[n+28>>2]=l;o=H[n+32>>2];m=j-o|0;if(m){y(l+o|0,0,m)}H[n+32>>2]=j}j=H[n+20>>2];if(j){ja=M+944|0;ka=M+812|0;ea=M+28|0;o=H[n+28>>2];_=0;while(1){t=j-1|0;m=t&31;if((t&63)>>>0>=32){l=-1<>>32-m}z=r^-1;r=H[n>>2];m=z+r|0;A=l^-1;l=A+(r>>31)|0;l=m>>>0>>0?l+1|0:l;r=m;m=t&31;if((t&63)>>>0>=32){p=l>>m}else{p=((1<>>m}H[o>>2]=p;l=H[n+4>>2];r=l;m=l+z|0;l=(l>>31)+A|0;l=m>>>0>>0?l+1|0:l;r=m;m=t&31;if((t&63)>>>0>=32){q=l>>m}else{q=((1<>>m}H[o+4>>2]=q;l=H[n+8>>2];r=l;m=l+z|0;l=(l>>31)+A|0;l=m>>>0>>0?l+1|0:l;r=m;m=t&31;if((t&63)>>>0>=32){r=l>>m}else{r=((1<>>m}H[o+8>>2]=r;l=H[n+12>>2];x=l;m=l+z|0;l=(l>>31)+A|0;l=m>>>0>>0?l+1|0:l;x=m;m=t&31;if((t&63)>>>0>=32){x=l>>m}else{x=((1<>>m}H[o+12>>2]=x;C=r>>31;E=_<<2;R=H[E+ka>>2];m=R&31;if((R&63)>>>0>=32){l=1<>>32-m}P=v;m=P+r|0;l=l+C|0;C=m-1|0;m=(m>>>0

>>0?l+1|0:l)-!m|0;l=R&31;if((R&63)>>>0>=32){l=m>>l}else{l=((1<>>l}C=l<>31;P=H[E+ja>>2];m=P&31;if((P&63)>>>0>=32){l=-1<>>32-m;m=-1<>>0>>0?l+1|0:l;E=m;m=P&31;if((P&63)>>>0>=32){l=l>>m}else{l=((1<>>m}l=l<>P:0;H[o+20>>2]=x;aa=p&-1<>R:0;H[o+16>>2]=m;Ie(m,0,x);if(!(!m|!ra)){break N}ca=N(m,x);if(ca>>>0>=107374183){break N}V=N(ca,40);if(_){P=P-1|0;R=R-1|0;l=$>>31;m=$+1|0;$=((m?l:l+1|0)&1)<<31|m>>>1;l=aa>>31;m=aa+1|0;aa=((m?l:l+1|0)&1)<<31|m>>>1;l=3}else{l=1}H[o+24>>2]=l;m=o+28|0;x=j;r=j&31;if((j&63)>>>0>=32){l=1<>>32-r}ia=j;r=l;j=H[M+12>>2];S=j>>>0

>>0?j:P;j=S&31;if((S&63)>>>0>=32){l=-1<>>32-j;j=-1<>2];T=j>>>0>>0?j:R;j=T&31;if((T&63)>>>0>=32){l=-1<>>32-j;j=-1<>2];p=l;j=l+z|0;l=(l>>31)+A|0;l=j>>>0

>>0?l+1|0:l;p=j;j=t&31;if((t&63)>>>0>=32){Q=l>>j}else{Q=((1<>>j}l=H[n>>2];p=l;j=l+z|0;l=(l>>31)+A|0;l=j>>>0

>>0?l+1|0:l;p=j;j=t&31;if((t&63)>>>0>=32){ba=l>>j}else{ba=((1<>>j}j=0;p=z;C=p;q=A;E=q;l=t;break P}j=fa+1|0;p=j>>>1|0;q=t&31;if((t&63)>>>0>=32){l=p<>>32-q;p=p<>>0>C>>>0?l+1|0:l;q=H[n+4>>2];p=q+C|0;E=l;l=l+(q>>31)|0;l=p>>>0>>0?l+1|0:l;q=p;p=x&31;if((x&63)>>>0>=32){Q=l>>p}else{Q=((1<>>p}p=j&1;q=t&31;if((t&63)>>>0>=32){l=p<>>32-q;p=p<>2];D=v+p|0;q=p>>>0>>0?l+1|0:l;l=q+(v>>31)|0;l=v>>>0>D>>>0?l+1|0:l;v=D;D=x&31;if((x&63)>>>0>=32){ba=l>>D}else{ba=((1<>>D}l=x}D=l;v=H[n+8>>2];ha=v>>31;J=H[n+12>>2];H[m+4>>2]=Q;H[m>>2]=ba;H[m+16>>2]=j;l=(J>>31)+E|0;C=C+J|0;l=C>>>0>>0?l+1|0:l;E=C;C=D&31;if((D&63)>>>0>=32){l=l>>C}else{l=((1<>>C}H[m+12>>2]=l;l=q+ha|0;p=p+v|0;l=p>>>0>>0?l+1|0:l;q=p;p=D&31;if((D&63)>>>0>=32){l=l>>p}else{l=((1<>>p}H[m+8>>2]=l;da=1;p=H[ea>>2];j=(H[Z+24>>2]+(!H[M+20>>2]|!j?0:(j|0)==3?2:1)|0)-p|0;Q:{if((j|0)>=1024){da=898846567431158e293;if(j>>>0<2047){j=j-1023|0;break Q}da=Infinity;j=(j>>>0>=3069?3069:j)-2046|0;break Q}if((j|0)>-1023){break Q}da=2004168360008973e-307;if(j>>>0>4294965304){j=j+969|0;break Q}da=0;j=(j>>>0<=4294964336?-2960:j)+1938|0}qa=+H[ea+4>>2]*.00048828125+1;u(0,0);u(1,j+1023<<20);va=m,xa=O(qa*(da*+w())),L[va+32>>2]=xa;H[m+28>>2]=(p+H[M+804>>2]|0)-1;j=H[m+20>>2];R:{S:{if(!(j|!ca)){j=Ga(V);H[m+20>>2]=j;if(!j){Ca(k,1,2854,0);break K}if(V){y(j,0,V)}H[m+24>>2]=V;break S}if(V>>>0>K[m+24>>2]){j=Ia(j,V);if(!j){Ca(k,1,2854,0);Da(H[m+20>>2]);H[m+20>>2]=0;H[m+24>>2]=0;break K}H[m+20>>2]=j;l=H[m+24>>2];p=V-l|0;if(p){y(j+l|0,0,p)}H[m+24>>2]=V}if(!ca){break R}}j=H[m+20>>2];C=0;while(1){p=H[o+16>>2];l=(C>>>0)/(p>>>0)|0;p=C-N(l,p)|0;q=(p<>2];E=(q|0)>(E|0)?q:E;H[j>>2]=E;q=(l<>2];D=(q|0)>(D|0)?q:D;H[j+4>>2]=D;p=(p+1<>2];p=(p|0)<(q|0)?p:q;H[j+8>>2]=p;l=(l+1<>2];q=(l|0)<(q|0)?l:q;H[j+12>>2]=q;l=(p>>31)+pa|0;v=p;p=p+na|0;l=v>>>0>p>>>0?l+1|0:l;E=E>>T;v=p;p=T&31;if((T&63)>>>0>=32){l=l>>p}else{l=((1<>>p}v=l-E<>T;H[j+16>>2]=v;l=(q>>31)+ma|0;p=q+la|0;l=p>>>0>>0?l+1|0:l;D=D>>S;q=p;p=S&31;if((S&63)>>>0>=32){l=l>>p}else{l=((1<>>p}l=l-D<>S;H[j+20>>2]=l;p=N(l,v);Ie(p,0,68);if(ra){Ca(k,1,2935,0);break K}l=N(p,68);q=H[j+24>>2];T:{U:{if(!(q|!p)){q=Ga(l);H[j+24>>2]=q;if(!q){break K}if(!l){break U}y(q,0,l);break U}if(l>>>0<=K[j+28>>2]){break T}q=Ia(q,l);if(!q){Da(H[j+24>>2]);H[j+24>>2]=0;H[j+28>>2]=0;Ca(k,1,2549,0);break K}H[j+24>>2]=q;v=H[j+28>>2];J=l-v|0;if(!J){break U}y(q+v|0,0,J)}H[j+28>>2]=l}l=H[j+20>>2];q=H[j+16>>2];v=H[j+32>>2];V:{if(!v){l=sc(q,l,k);break V}l=qc(v,q,l,k)}H[j+32>>2]=l;l=H[j+20>>2];q=H[j+16>>2];v=H[j+36>>2];W:{if(!v){l=sc(q,l,k);break W}l=qc(v,q,l,k)}H[j+36>>2]=l;if(p){ba=D+1|0;ha=E+1|0;q=0;while(1){W=H[j+16>>2];v=(q>>>0)/(W>>>0)|0;l=H[j+24>>2]+N(q,68)|0;Q=H[l>>2];X:{if(Q){ta=H[l+56>>2];J=H[l+48>>2];ua=H[l+4>>2];Da(H[l+60>>2]);H[l+48>>2]=0;H[l+52>>2]=0;H[l- -64>>2]=0;H[l+56>>2]=0;H[l+60>>2]=0;H[l+40>>2]=0;H[l+44>>2]=0;H[l+32>>2]=0;H[l+36>>2]=0;H[l+24>>2]=0;H[l+28>>2]=0;H[l+16>>2]=0;H[l+20>>2]=0;H[l+8>>2]=0;H[l+12>>2]=0;H[l>>2]=Q;H[l+48>>2]=J;Y:{if(!J){break Y}J=N(J,24);if(!J){break Y}y(Q,0,J)}H[l+56>>2]=ta;H[l+4>>2]=ua;break X}J=Fa(10,24);H[l>>2]=J;if(!J){break K}H[l+48>>2]=10}J=q-N(v,W)|0;Q=J+E<>2];H[l+8>>2]=(Q|0)>(W|0)?Q:W;Q=v+D<>2];H[l+12>>2]=(Q|0)>(W|0)?Q:W;J=J+ha<>2];H[l+16>>2]=(J|0)<(Q|0)?J:Q;Q=l;l=v+ba<>2];H[Q+20>>2]=(l|0)<(v|0)?l:v;q=q+1|0;if((p|0)!=(q|0)){continue}break}}j=j+40|0;C=C+1|0;if((C|0)!=(ca|0)){continue}break}}ea=ea+8|0;m=m+36|0;fa=fa+1|0;if(fa>>>0>2]){continue}break}o=o+152|0;j=t;_=_+1|0;if(_>>>0>2]){continue}break}}Z=Z+52|0;n=n+76|0;M=M+1080|0;ga=ga+1|0;if(ga>>>0>2]){continue}break}j=1;break J}Ca(k,1,2982,0);break K}Ca(k,1,2373,0)}j=0}if(!j){Ca(k,1,3668,0);j=0;break a}j=H[a+228>>2];H[s+4>>2]=N(H[a+128>>2],H[a+132>>2]);H[s>>2]=j+1;Ca(k,4,11825,s);H[b>>2]=H[a+228>>2];H[i>>2]=1;if(c){b=bc(H[a+232>>2],0);H[c>>2]=b;j=0;if((b|0)==-1){break a}}b=H[H[H[a+232>>2]+20>>2]>>2];H[d>>2]=H[b>>2];H[e>>2]=H[b+4>>2];H[f>>2]=H[b+8>>2];H[g>>2]=H[b+12>>2];H[h>>2]=H[b+16>>2];H[a+8>>2]=H[a+8>>2]|128}j=1;break a}Ca(k,1,m,0)}Ca(k,1,3702,0);j=0}oa=s+80|0;return j|0}function fc(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,L=0,M=0,O=0,P=0,Q=0,R=0,S=0,T=0;a:{b:{c:{d:{e:{f:{g:{h:{i:{j:{switch(H[a+84>>2]){case 0:k:{c=H[a+52>>2];b=H[a+196>>2];if(c>>>0>>0){q=H[a+64>>2];if(q>>>0>>0){break k}}Ca(H[a+236>>2],1,8491,0);break b}if(!H[a+44>>2]){k=H[a+36>>2];b=0;break i}H[a+44>>2]=0;i=H[a+68>>2];b=1;break i;case 1:l:{c=H[a+52>>2];b=H[a+196>>2];if(c>>>0>>0){q=H[a+64>>2];if(q>>>0>>0){break l}}Ca(H[a+236>>2],1,8536,0);break b}if(!H[a+44>>2]){e=H[a+36>>2];b=0;break e}H[a+44>>2]=0;i=H[a+48>>2];b=1;break e;case 2:m:{A=H[a+52>>2];x=H[a+196>>2];if(A>>>0>>0){r=H[a+64>>2];if(r>>>0>>0){break m}}Ca(H[a+236>>2],1,8671,0);break b}if(!H[a+44>>2]){y=H[a+40>>2];break f}H[a+228>>2]=0;H[a+232>>2]=0;H[a+44>>2]=0;j=H[a+200>>2];while(1){O=j+(u<<4)|0;l=H[O+8>>2];if(l){q=H[O+12>>2];b=0;while(1){g=l+(b^-1)|0;d=q+(b<<4)|0;s=g+H[d>>2]|0;n:{if(s>>>0>31){break n}c=H[O>>2];if(c>>>0>-1>>>s>>>0){break n}c=c<>>0>k>>>0?k:c:c;H[a+228>>2]=k}g=g+H[d+4>>2]|0;o:{if(g>>>0>31){break o}c=H[O+4>>2];if(c>>>0>-1>>>g>>>0){break o}c=c<>>0>i>>>0?i:c:c;H[a+232>>2]=i}b=b+1|0;if((l|0)!=(b|0)){continue}break}}u=u+1|0;if((x|0)!=(u|0)){continue}break};if(!k|!i){break d}if(!I[a|0]){H[a+108>>2]=H[a+208>>2];H[a+100>>2]=H[a+204>>2];H[a+112>>2]=H[a+216>>2];H[a+104>>2]=H[a+212>>2]}o=H[a+48>>2];b=1;break f;case 3:p:{A=H[a+52>>2];l=H[a+196>>2];if(A>>>0>>0){P=H[a+64>>2];if(P>>>0>>0){break p}}Ca(H[a+236>>2],1,8626,0);break b}if(!H[a+44>>2]){B=H[a+200>>2];e=H[a+28>>2];y=B+(e<<4)|0;E=H[a+40>>2];break g}H[a+228>>2]=0;H[a+232>>2]=0;H[a+44>>2]=0;B=H[a+200>>2];while(1){x=(p<<4)+B|0;s=H[x+8>>2];if(s){q=H[x+12>>2];b=0;while(1){g=s+(b^-1)|0;d=q+(b<<4)|0;j=g+H[d>>2]|0;q:{if(j>>>0>31){break q}c=H[x>>2];if(c>>>0>-1>>>j>>>0){break q}c=c<>>0>k>>>0?k:c:c;H[a+228>>2]=k}g=g+H[d+4>>2]|0;r:{if(g>>>0>31){break r}c=H[x+4>>2];if(c>>>0>-1>>>g>>>0){break r}c=c<>>0>i>>>0?i:c:c;H[a+232>>2]=i}b=b+1|0;if((s|0)!=(b|0)){continue}break}}p=p+1|0;if((l|0)!=(p|0)){continue}break};if(!k|!i){break d}s:{if(I[a|0]){p=H[a+108>>2];break s}p=H[a+208>>2];H[a+108>>2]=p;H[a+100>>2]=H[a+204>>2];H[a+112>>2]=H[a+216>>2];H[a+104>>2]=H[a+212>>2]}b=1;break g;case 4:break j;default:break d}}t:{p=H[a+52>>2];b=H[a+196>>2];if(p>>>0>>0){r=H[a+64>>2];if(r>>>0>>0){break t}}Ca(H[a+236>>2],1,8581,0);break d}if(!H[a+44>>2]){p=H[a+28>>2];o=H[a+200>>2]+(p<<4)|0;u=H[a+40>>2];b=0;break h}H[a+28>>2]=p;H[a+44>>2]=0;b=1;break h}u:while(1){v:{w:{if(!b){k=k+1|0;break w}H[a+40>>2]=i;if(K[a+56>>2]<=i>>>0){break b}e=H[a+48>>2];b=0;break v}b=1}x:while(1){y:{z:{A:{B:{if(!b){H[a+32>>2]=e;if(K[a+60>>2]<=e>>>0){break B}H[a+28>>2]=c;b=c;o=0;break y}H[a+36>>2]=k;if(K[a+76>>2]<=k>>>0){b=H[a+28>>2];o=1;break y}b=((N(H[a+16>>2],H[a+32>>2])+N(H[a+12>>2],H[a+40>>2])|0)+N(H[a+20>>2],H[a+28>>2])|0)+N(H[a+24>>2],k)|0;if(b>>>0>=K[a+8>>2]){break c}b=H[a+4>>2]+(b<<1)|0;if(J[b>>1]){break A}break a}i=H[a+40>>2]+1|0;break z}b=0;continue u}b=1;continue u}while(1){C:{D:{E:{if(!o){if(b>>>0>=q>>>0){break E}g=H[a+32>>2];d=H[a+200>>2]+(b<<4)|0;if(g>>>0>=K[d+8>>2]){break C}if(!I[a|0]){b=H[d+12>>2]+(g<<4)|0;H[a+76>>2]=N(H[b+12>>2],H[b+8>>2])}k=H[a+72>>2];b=1;continue x}b=b+1|0;H[a+28>>2]=b;break D}e=H[a+32>>2]+1|0;b=0;continue x}o=0;continue}o=1;continue}}}}F:while(1){G:{H:{if(!b){u=u+1|0;H[a+40>>2]=u;break H}if(p>>>0>=r>>>0){break b}H[a+228>>2]=0;H[a+232>>2]=0;o=H[a+200>>2]+(p<<4)|0;s=H[o+8>>2];if(!s){break b}q=H[o+12>>2];k=0;e=0;b=0;while(1){g=s+(b^-1)|0;d=q+(b<<4)|0;j=g+H[d>>2]|0;I:{if(j>>>0>31){break I}c=H[o>>2];if(c>>>0>-1>>>j>>>0){break I}c=c<>>0>e>>>0?e:c:c;H[a+228>>2]=e}g=g+H[d+4>>2]|0;J:{if(g>>>0>31){break J}c=H[o+4>>2];if(c>>>0>-1>>>g>>>0){break J}c=c<>>0>k>>>0?k:c:c;H[a+232>>2]=k}b=b+1|0;if((s|0)!=(b|0)){continue}break}if(!e|!k){break d}K:{if(I[a|0]){k=H[a+108>>2];break K}k=H[a+208>>2];H[a+108>>2]=k;H[a+100>>2]=H[a+204>>2];H[a+112>>2]=H[a+216>>2];H[a+104>>2]=H[a+212>>2]}b=0;break G}b=1}L:while(1){M:{N:{O:{P:{if(!b){H[a+224>>2]=k;if(K[a+112>>2]<=k>>>0){break P}B=H[a+100>>2];b=0;break M}if(K[a+56>>2]<=u>>>0){i=H[a+32>>2];b=1;break M}b=((N(H[a+16>>2],H[a+32>>2])+N(H[a+12>>2],u)|0)+N(H[a+20>>2],p)|0)+N(H[a+24>>2],H[a+36>>2])|0;if(b>>>0>=K[a+8>>2]){break c}b=H[a+4>>2]+(b<<1)|0;if(J[b>>1]){break O}break a}p=p+1|0;H[a+28>>2]=p;break N}b=0;continue F}b=1;continue F}while(1){Q:{R:{S:{T:{if(!b){H[a+220>>2]=B;if(K[a+104>>2]<=B>>>0){break S}i=H[a+48>>2];break T}i=i+1|0}H[a+32>>2]=i;b=H[a+60>>2];d=H[o+8>>2];if((b>>>0>>0?b:d)>>>0>i>>>0){g=H[o>>2];c=g;n=d+(i^-1)|0;m=n;d=m&31;if((m&63)>>>0>=32){b=c<>>32-d;v=g<>>0>=32){b=b>>>d|0}else{b=((1<>>d}if((q|0)!=(b|0)){break Q}b=m&31;if((m&63)>>>0>=32){b=-1>>>b|0}else{b=(1<>>b}c=H[o+4>>2];if((b&c)!=(c|0)){break Q}d=m&31;if((m&63)>>>0>=32){b=c<>>32-d;w=c<>2];j=F+d|0;O=Ke(j,d>>>0>j>>>0?h+1|0:h,w,b);b=h;L=H[a+208>>2];d=F+L|0;b=L>>>0>d>>>0?b+1|0:b;s=Ke(d,b,w,C);A=v-1|0;j=H[a+212>>2];l=A+j|0;d=f-!v|0;b=d;x=Ke(l,l>>>0>>0?b+1|0:b,v,f);D=H[a+204>>2];j=A+D|0;b=D>>>0>j>>>0?b+1|0:b;j=Ke(j,b,v,f);z=H[o+12>>2]+(i<<4)|0;M=H[z>>2];t=M+n|0;b=t&31;if((t&63)>>>0>=32){b=-1>>>b|0}else{b=(1<>>b}if((g|0)!=(b&g)){break Q}h=c;P=H[z+4>>2];n=P+n|0;e=n&31;if((n&63)>>>0>=32){b=c<>>32-e;e=c<>>0>=32){c=b>>>l|0}else{c=((1<>>l}if((h|0)!=(c|0)){break Q}l=H[a+224>>2];e=!!(Le(l,e,b)|ra);b=n&31;if((n&63)>>>0>=32){h=-1<>>32-b;b=-1<>>0>=32){h=n<>>32-e|b<>2];if((t&63)>>>0>=32){b=g<>>32-n;e=g<>>0>=32){h=-1<>>32-b;b=-1<>>0>=32){h=j<>>32-t|b<>2];if(!n|(!H[z+12>>2]|(j|0)==(x|0))){break Q}if((s|0)==(O|0)){break Q}u=H[a+68>>2];H[a+40>>2]=u;b=d;c=c+A|0;b=c>>>0>>0?b+1|0:b;g=(Ke(c,b,v,f)>>>M)-(j>>>M)|0;b=q;c=l+F|0;b=c>>>0>>0?b+1|0:b;S=a,T=N(n,(Ke(c,b,w,C)>>>P)-(s>>>P)|0)+g|0,H[S+36>>2]=T;b=1;continue L}c=H[a+220>>2];b=H[a+228>>2];B=c+b-(c>>>0)%(b>>>0)|0;break R}c=H[a+224>>2];b=H[a+232>>2];k=c+b-(c>>>0)%(b>>>0)|0;b=0;continue L}b=0;continue}b=1;continue}}}}U:while(1){V:{W:{if(!b){E=E+1|0;H[a+40>>2]=E;break W}H[a+224>>2]=p;if(K[a+112>>2]<=p>>>0){break b}v=H[a+100>>2];b=0;break V}b=1}X:while(1){Y:{Z:{_:{$:{if(!b){H[a+220>>2]=v;if(K[a+104>>2]<=v>>>0){break $}H[a+28>>2]=A;e=A;b=0;break Y}if(K[a+56>>2]<=E>>>0){u=H[a+32>>2];b=1;break Y}b=((N(H[a+16>>2],H[a+32>>2])+N(H[a+12>>2],E)|0)+N(H[a+20>>2],e)|0)+N(H[a+24>>2],H[a+36>>2])|0;if(b>>>0>=K[a+8>>2]){break c}b=H[a+4>>2]+(b<<1)|0;if(J[b>>1]){break _}break a}c=H[a+224>>2];b=H[a+232>>2];p=c+b-(c>>>0)%(b>>>0)|0;break Z}b=0;continue U}b=1;continue U}while(1){aa:{ba:{ca:{da:{if(!b){if(e>>>0>=P>>>0){break ca}u=H[a+48>>2];H[a+32>>2]=u;y=(e<<4)+B|0;break da}u=u+1|0;H[a+32>>2]=u}b=H[a+60>>2];d=H[y+8>>2];if((b>>>0>>0?b:d)>>>0>u>>>0){g=H[y>>2];c=g;f=d+(u^-1)|0;i=f;d=f&31;if((f&63)>>>0>=32){b=c<>>32-d;k=g<>>0>=32){b=b>>>d|0}else{b=((1<>>d}if((q|0)!=(b|0)){break aa}b=i&31;if((i&63)>>>0>=32){b=-1>>>b|0}else{b=(1<>>b}c=H[y+4>>2];if((b&c)!=(c|0)){break aa}d=i&31;if((i&63)>>>0>=32){b=c<>>32-d;o=c<>2];j=F+d|0;O=Ke(j,d>>>0>j>>>0?h+1|0:h,o,b);b=h;w=H[a+208>>2];d=w+F|0;b=w>>>0>d>>>0?b+1|0:b;s=Ke(d,b,o,n);C=k-1|0;j=H[a+212>>2];l=C+j|0;d=t-!k|0;b=d;x=Ke(l,l>>>0>>0?b+1|0:b,k,t);L=H[a+204>>2];j=C+L|0;b=L>>>0>j>>>0?b+1|0:b;j=Ke(j,b,k,t);D=H[y+12>>2]+(u<<4)|0;z=H[D>>2];m=z+f|0;b=m&31;if((m&63)>>>0>=32){b=-1>>>b|0}else{b=(1<>>b}if((g|0)!=(b&g)){break aa}h=c;M=H[D+4>>2];f=M+f|0;r=f&31;if((f&63)>>>0>=32){b=c<>>32-r;r=c<>>0>=32){c=b>>>l|0}else{c=((1<>>l}if((h|0)!=(c|0)){break aa}l=H[a+224>>2];r=!!(Le(l,r,b)|ra);b=f&31;if((f&63)>>>0>=32){h=-1<>>32-b;b=-1<>>0>=32){h=f<>>32-r|b<>2];if((m&63)>>>0>=32){b=g<>>32-f;f=g<>>0>=32){h=-1<>>32-b;b=-1<>>0>=32){h=f<>>32-m|b<>2];if(!f|(!H[D+12>>2]|(j|0)==(x|0))){break aa}if((s|0)==(O|0)){break aa}E=H[a+68>>2];H[a+40>>2]=E;b=d;c=c+C|0;b=c>>>0>>0?b+1|0:b;g=(Ke(c,b,k,t)>>>z)-(j>>>z)|0;b=q;c=l+F|0;b=c>>>0>>0?b+1|0:b;S=a,T=N(f,(Ke(c,b,o,n)>>>M)-(s>>>M)|0)+g|0,H[S+36>>2]=T;b=1;continue X}e=e+1|0;H[a+28>>2]=e;break ba}c=H[a+220>>2];b=H[a+228>>2];v=c+b-(c>>>0)%(b>>>0)|0;b=0;continue X}b=0;continue}b=1;continue}}}}ea:while(1){fa:{ga:{if(!b){y=y+1|0;H[a+40>>2]=y;break ga}H[a+32>>2]=o;if(K[a+60>>2]<=o>>>0){break b}E=H[a+108>>2];b=0;break fa}b=1}ha:while(1){ia:{ja:{ka:{la:{if(!b){H[a+224>>2]=E;if(K[a+112>>2]<=E>>>0){break la}B=H[a+100>>2];b=0;break ia}if(K[a+56>>2]<=y>>>0){p=H[a+28>>2];b=1;break ia}b=((N(H[a+16>>2],H[a+32>>2])+N(H[a+12>>2],y)|0)+N(H[a+20>>2],H[a+28>>2])|0)+N(H[a+24>>2],H[a+36>>2])|0;if(b>>>0>=K[a+8>>2]){break c}b=H[a+4>>2]+(b<<1)|0;if(J[b>>1]){break ka}break a}o=H[a+32>>2]+1|0;break ja}b=0;continue ea}b=1;continue ea}while(1){ma:{na:{oa:{pa:{if(!b){H[a+220>>2]=B;if(K[a+104>>2]<=B>>>0){break oa}H[a+28>>2]=A;p=A;break pa}p=p+1|0;H[a+28>>2]=p}if(p>>>0>>0){m=H[a+32>>2];e=H[a+200>>2]+(p<<4)|0;b=H[e+8>>2];if(m>>>0>=b>>>0){break ma}g=H[e>>2];c=g;f=b+(m^-1)|0;i=f;d=f&31;if((f&63)>>>0>=32){b=c<>>32-d;v=g<>>0>=32){b=b>>>d|0}else{b=((1<>>d}if((q|0)!=(b|0)){break ma}b=i&31;if((i&63)>>>0>=32){b=-1>>>b|0}else{b=(1<>>b}c=H[e+4>>2];if((b&c)!=(c|0)){break ma}d=i&31;if((i&63)>>>0>=32){b=c<>>32-d;w=c<>2];j=F+d|0;O=Ke(j,d>>>0>j>>>0?h+1|0:h,w,b);b=h;L=H[a+208>>2];d=F+L|0;b=L>>>0>d>>>0?b+1|0:b;s=Ke(d,b,w,n);C=v-1|0;j=H[a+212>>2];l=C+j|0;d=t-!v|0;b=d;x=Ke(l,l>>>0>>0?b+1|0:b,v,t);D=H[a+204>>2];j=C+D|0;b=D>>>0>j>>>0?b+1|0:b;j=Ke(j,b,v,t);z=H[e+12>>2]+(m<<4)|0;M=H[z>>2];m=M+f|0;b=m&31;if((m&63)>>>0>=32){b=-1>>>b|0}else{b=(1<>>b}if((g|0)!=(b&g)){break ma}h=c;P=H[z+4>>2];f=P+f|0;e=f&31;if((f&63)>>>0>=32){b=c<>>32-e;e=c<>>0>=32){c=b>>>l|0}else{c=((1<>>l}if((h|0)!=(c|0)){break ma}l=H[a+224>>2];e=!!(Le(l,e,b)|ra);b=f&31;if((f&63)>>>0>=32){h=-1<>>32-b;b=-1<>>0>=32){h=f<>>32-e|b<>2];if((m&63)>>>0>=32){b=g<>>32-f;f=g<>>0>=32){h=-1<>>32-b;b=-1<>>0>=32){h=f<>>32-m|b<>2];if(!f|(!H[z+12>>2]|(j|0)==(x|0))){break ma}if((s|0)==(O|0)){break ma}y=H[a+68>>2];H[a+40>>2]=y;b=d;c=c+C|0;b=c>>>0>>0?b+1|0:b;g=(Ke(c,b,v,t)>>>M)-(j>>>M)|0;b=q;c=l+F|0;b=c>>>0>>0?b+1|0:b;S=a,T=N(f,(Ke(c,b,w,n)>>>P)-(s>>>P)|0)+g|0,H[S+36>>2]=T;b=1;continue ha}c=H[a+220>>2];b=H[a+228>>2];B=c+b-(c>>>0)%(b>>>0)|0;break na}c=H[a+224>>2];b=H[a+232>>2];E=c+b-(c>>>0)%(b>>>0)|0;b=0;continue ha}b=0;continue}b=1;continue}}}}qa:while(1){ra:{sa:{if(!b){e=e+1|0;break sa}H[a+32>>2]=i;if(K[a+60>>2]<=i>>>0){break b}k=H[a+68>>2];b=0;break ra}b=1}ta:while(1){ua:{va:{wa:{xa:{if(!b){H[a+40>>2]=k;if(K[a+56>>2]<=k>>>0){break xa}H[a+28>>2]=c;b=c;o=0;break ua}H[a+36>>2]=e;if(K[a+76>>2]<=e>>>0){b=H[a+28>>2];o=1;break ua}b=((N(H[a+16>>2],H[a+32>>2])+N(H[a+12>>2],H[a+40>>2])|0)+N(H[a+20>>2],H[a+28>>2])|0)+N(H[a+24>>2],e)|0;if(b>>>0>=K[a+8>>2]){break c}b=H[a+4>>2]+(b<<1)|0;if(J[b>>1]){break wa}break a}i=H[a+32>>2]+1|0;break va}b=0;continue qa}b=1;continue qa}while(1){ya:{za:{Aa:{if(!o){if(b>>>0>=q>>>0){break Aa}g=H[a+32>>2];d=H[a+200>>2]+(b<<4)|0;if(g>>>0>=K[d+8>>2]){break ya}if(!I[a|0]){b=H[d+12>>2]+(g<<4)|0;H[a+76>>2]=N(H[b+12>>2],H[b+8>>2])}e=H[a+72>>2];b=1;continue ta}b=b+1|0;H[a+28>>2]=b;break za}k=H[a+40>>2]+1|0;b=0;continue ta}o=0;continue}o=1;continue}}}}return 0}Ca(H[a+236>>2],1,1343,0)}return 0}G[b>>1]=1;return 1}function yd(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=O(0),t=0,u=0,v=0,w=O(0),x=0,z=0,A=0,C=O(0),D=O(0),E=O(0),G=0,J=0,K=0,L=0,M=0,Q=O(0),R=0,S=0,T=0;n=oa-8320|0;oa=n;H[n+64>>2]=0;j=2;h=H[a>>2];a:{b:{if((h|0)==176622093){break b}if((h|0)!=1375686655){if(!((h|0)!=201326592|H[a+4>>2]!=538988650)&H[a+8>>2]==176622093){break b}Y(1101);j=1;break a}j=0}h=Fa(1,96);g=0;c:{if(!h){break c}H[h+76>>2]=1;d:{e:{f:{switch(j|0){case 0:H[h+88>>2]=68;H[h+84>>2]=69;H[h+80>>2]=70;H[h+16>>2]=71;H[h+4>>2]=72;H[h+28>>2]=73;H[h+24>>2]=74;H[h+20>>2]=75;H[h>>2]=76;H[h+92>>2]=77;H[h+44>>2]=78;H[h+40>>2]=79;H[h+36>>2]=80;H[h+32>>2]=81;H[h+12>>2]=82;H[h+8>>2]=83;g=Ub();H[h+48>>2]=g;if(g){break e}break d;case 2:break f;default:break d}}H[h+88>>2]=84;H[h+84>>2]=85;H[h+80>>2]=86;H[h+16>>2]=87;H[h+4>>2]=88;H[h+92>>2]=89;H[h+44>>2]=90;H[h+40>>2]=91;H[h+36>>2]=92;H[h+32>>2]=93;H[h+28>>2]=94;H[h+24>>2]=95;H[h+20>>2]=96;H[h+12>>2]=97;H[h+8>>2]=98;H[h>>2]=99;g=Fa(1,136);g:{if(g){l=Ub();H[g>>2]=l;h:{if(!l){break h}H[g+108>>2]=0;H[g+112>>2]=0;F[g+124|0]=0;H[g+116>>2]=0;H[g+120>>2]=0;l=tb();H[g+4>>2]=l;if(!l){break h}l=tb();H[g+8>>2]=l;if(!l){break h}break g}Pc(g)}g=0}H[h+48>>2]=g;if(!g){break d}}H[h+72>>2]=1;H[h+64>>2]=1;H[h+60>>2]=0;H[h+52>>2]=0;H[h+56>>2]=0;H[h+68>>2]=1;g=h;break c}Da(h);g=0}if(g){H[g+60>>2]=0;H[g+72>>2]=100}if(g){H[g+56>>2]=0;H[g+68>>2]=101}if(g){H[g+52>>2]=0;H[g+64>>2]=102}h=n+68|0;if(h){y(h,0,8248);H[h+8248>>2]=0;H[h+8200>>2]=-1;H[h+8204>>2]=-1}if(d){H[n+8316>>2]=H[n+8316>>2]|1}H[n+60>>2]=b;H[n+56>>2]=a;H[n+52>>2]=a;j=1;b=0;h=n+52|0;i:{if(!h){break i}a=Fa(1,72);if(a){j:{H[a+64>>2]=1048576;l=Ga(1048576);H[a+32>>2]=l;if(!l){Da(a);a=0;break j}H[a+36>>2]=l;H[a+28>>2]=2;H[a+24>>2]=3;H[a+20>>2]=4;H[a+16>>2]=5;H[a+44>>2]=6;H[a+40>>2]=8;H[a+68>>2]=H[a+68>>2]|2}}else{a=0}if(!a){break i}if(a){H[a+4>>2]=0;H[a>>2]=h}b=H[h+8>>2];if(a){H[a+8>>2]=b;H[a+12>>2]=0}if(!(!a|!(I[a+68|0]&2))){H[a+16>>2]=64}if(a){H[a+24>>2]=66}if(a){H[a+28>>2]=67}b=a}a=n+68|0;if(!g|!a){a=0}else{k:{if(!H[g+76>>2]){Ca(g+52|0,1,9902,0);a=0;break k}sa[H[g+24>>2]](H[g+48>>2],a);a=1}}if(!a){Y(1153);jb(b);lb(g);break a}if(!b|!g){a=0}else{l:{if(!H[g+76>>2]){Ca(g+52|0,1,9983,0);a=0;break l}a=sa[H[g>>2]](b,H[g+48>>2],n- -64|0,g+52|0)|0}}if(!a){Y(1181);jb(b);lb(g);Va(H[n+64>>2]);break a}m:{if(!f){break m}if(g){a=sa[H[g+40>>2]](H[g+48>>2],f,g+52|0)|0}else{a=0}if(a){break m}Y(1116);jb(b);lb(g);Va(H[n+64>>2]);break a}a=H[n+64>>2];f=0;n:{if(!H[g+76>>2]|(!g|!b)){a=f}else{a=sa[H[g+4>>2]](H[g+48>>2],b,a,g+52|0)|0}if(a){if(!(!H[g+76>>2]|(!g|!b))){f=sa[H[g+16>>2]](H[g+48>>2],b,g+52|0)|0}if(f){break n}}Y(1316);lb(g);jb(b);Va(H[n+64>>2]);break a}jb(b);lb(g);k=H[n+64>>2];a=H[k+28>>2];if(a){Da(a);k=H[n+64>>2];H[k+28>>2]=0;H[k+32>>2]=0}v=H[k+16>>2];o:{p:{if(!c){if(!(!e|(v|0)!=4)){p=1;v=4;break o}q:{b=H[k+20>>2];if(!((b|0)==3|(v|0)!=3)){a=H[k+24>>2];if(H[a>>2]!=H[a+4>>2]|H[a+52>>2]==1){break q}H[k+20>>2]=3;break p}if(v>>>0>2){break q}H[k+20>>2]=2;break o}r:{switch(b-3|0){case 2:s:{t:{if(v>>>0<4){break t}f=H[k+24>>2];a=H[f>>2];if((a|0)!=H[f+52>>2]|(a|0)!=H[f+104>>2]|(a|0)!=H[f+156>>2]){break t}a=H[f+4>>2];if((a|0)!=H[f+56>>2]|(a|0)!=H[f+108>>2]){break t}if((a|0)==H[f+160>>2]){break s}}H[n+20>>2]=1053;H[n+16>>2]=1373;Ha(26080,8179,n+16|0);break o}g=N(H[f+12>>2],H[f+8>>2]);C=O(O(1)/O((-1<>2]^-1)>>>0));D=O(O(1)/O((-1<>2]^-1)>>>0));w=O(O(1)/O((-1<>2]^-1)>>>0));Q=O(O(1)/O((-1<>2]^-1)>>>0));a=0;while(1){if((a|0)!=(g|0)){h=a<<2;b=h+H[f+148>>2]|0;l=H[b>>2];c=h+H[f+96>>2]|0;j=H[c>>2];m=h+H[f+44>>2]|0;s=O(O(1)-O(C*O(H[h+H[f+200>>2]>>2])));E=O(O(O(O(1)-O(Q*O(H[m>>2])))*O(255))*s);if(O(P(E))>2]=h;E=O(O(O(O(1)-O(w*O(j|0)))*O(255))*s);if(O(P(E))>2]=h;s=O(O(O(O(1)-O(D*O(l|0)))*O(255))*s);if(O(P(s))>2]=c;a=a+1|0;continue}break};Da(H[f+200>>2]);a=H[k+24>>2];H[a+128>>2]=8;H[a+76>>2]=8;H[a+24>>2]=8;H[a+200>>2]=0;H[k+20>>2]=1;a=H[k+16>>2]-1|0;H[k+16>>2]=a;i=3;while(1){if(a>>>0<=i>>>0){break o}a=H[k+24>>2]+N(i,52)|0;B(a,a+52|0,52);i=i+1|0;a=H[k+16>>2];continue};case 0:break p;case 1:break r;default:break o}}g=H[k+24>>2];a=H[g>>2];u:{v:{if((a|0)!=H[g+52>>2]|(a|0)!=H[g+104>>2]){break v}a=H[g+4>>2];if((a|0)!=H[g+56>>2]){break v}if((a|0)==H[g+108>>2]){break u}}H[n+36>>2]=1115;H[n+32>>2]=1373;Ha(26080,8221,n+32|0);break o}a=H[g+24>>2];b=-1<>2]?0:a;j=H[g+84>>2]?0:a;m=N(H[g+12>>2],H[g+8>>2]);a=0;while(1){if((a|0)!=(m|0)){c=a<<2;i=c+H[g+44>>2]|0;f=c+H[g+148>>2]|0;s=O(H[f>>2]-l|0);h=c+H[g+96>>2]|0;C=O(H[h>>2]-j|0);D=O(H[i>>2]);w=O(O(O(s*O(1.4019900560379028))+O(O(C*O(-3680000008898787e-20))+D))+O(.5));if(O(P(w))>2]=(b|0)<(c|0)?b:(c|0)>0?c:0;w=O(O(O(s*O(-.7141128182411194))+O(O(D*O(1.0003000497817993))+O(C*O(-.34412500262260437))))+O(.5));if(O(P(w))>2]=(b|0)<(c|0)?b:(c|0)>0?c:0;s=O(O(O(s*O(-7999999979801942e-21))+O(O(D*O(.9998229742050171))+O(C*O(1.7720400094985962))))+O(.5));if(O(P(s))>2]=(b|0)<(c|0)?b:(c|0)>0?c:0;a=a+1|0;continue}break}H[k+20>>2]=1;break o}v=c>>>0>v>>>0?v:c;p=1;break o}w:{x:{c=H[k+24>>2];if(H[c>>2]!=1){break x}y:{switch(H[c+52>>2]-1|0){case 1:if(H[c+104>>2]!=2){break x}if(!(H[c+4>>2]!=1|H[c+56>>2]!=2|H[c+108>>2]!=2)){b=H[c+24>>2];i=H[c+148>>2];a=H[c+96>>2];j=H[c+44>>2];G=H[c+60>>2];q=H[c+8>>2];f=H[c+12>>2];c=N(q,f)<<2;h=Ja(c);g=Ja(c);l=Ja(c);if(!(!h|!g|!l)){m=-1<>2]&1;L=f-b|0;K=H[k>>2]&1;x=q-K|0;if(!b){c=l;f=g;b=h;break w}c=l;f=g;b=h;while(1){if((p|0)==(q|0)){break w}La(o,m,H[j>>2],0,0,b,f,c);p=p+1|0;c=c+4|0;f=f+4|0;b=b+4|0;j=j+4|0;continue}}Da(h);Da(g);Da(l);break o}if(H[c+4>>2]!=1|H[c+56>>2]!=1|H[c+108>>2]!=1){break x}a=H[c+24>>2];f=H[c+148>>2];b=H[c+96>>2];i=H[c+44>>2];t=H[c+60>>2];h=H[c+8>>2];x=H[c+12>>2];c=N(h,x)<<2;g=Ja(c);l=Ja(c);m=Ja(c);if(!(!g|!l|!m)){o=-1<>2]&1;a=h-z|0;G=a&1;u=a>>>1|0;J=a&-2;a=m;j=l;c=g;while(1){if((q|0)!=(x|0)){if(z){La(r,o,H[i>>2],0,0,c,j,a);j=j+4|0;c=c+4|0;i=i+4|0;a=a+4|0}h=0;while(1){if(h>>>0>>0){La(r,o,H[i>>2],H[b>>2],H[f>>2],c,j,a);La(r,o,H[i+4>>2],H[b>>2],H[f>>2],c+4|0,j+4|0,a+4|0);h=h+2|0;f=f+4|0;b=b+4|0;a=a+8|0;j=j+8|0;c=c+8|0;i=i+8|0;continue}break}z:{if(!G){break z}h=H[i>>2];A:{if((t|0)==(u|0)){La(r,o,h,0,0,c,j,a);break A}La(r,o,h,H[b>>2],H[f>>2],c,j,a)}a=a+4|0;j=j+4|0;c=c+4|0;i=i+4|0;if(t>>>0<=u>>>0){break z}f=f+4|0;b=b+4|0}q=q+1|0;continue}break}Da(H[H[k+24>>2]+44>>2]);a=H[k+24>>2];H[a+44>>2]=g;Da(H[a+96>>2]);a=H[k+24>>2];H[a+96>>2]=l;Da(H[a+148>>2]);a=H[k+24>>2];H[a+148>>2]=m;b=H[a+8>>2];H[a+112>>2]=b;H[a+60>>2]=b;b=H[a+12>>2];H[a+116>>2]=b;H[a+64>>2]=b;b=H[a>>2];H[a+104>>2]=b;H[a+52>>2]=b;b=H[a+4>>2];H[a+108>>2]=b;H[a+56>>2]=b;H[k+20>>2]=1;break o}Da(g);Da(l);Da(m);break o;case 0:break y;default:break x}}if(H[c+104>>2]!=1|H[c+4>>2]!=1|(H[c+56>>2]!=1|H[c+108>>2]!=1)){break x}b=H[c+24>>2];i=H[c+148>>2];a=H[c+96>>2];j=H[c+44>>2];o=N(H[c+12>>2],H[c+8>>2]);c=o<<2;g=Ja(c);l=Ja(c);m=Ja(c);if(!(!g|!l|!m)){q=-1<>2],H[a>>2],H[i>>2],h,b,f);c=c+1|0;f=f+4|0;b=b+4|0;h=h+4|0;i=i+4|0;a=a+4|0;j=j+4|0;continue}break}Da(H[H[k+24>>2]+44>>2]);a=H[k+24>>2];H[a+44>>2]=g;Da(H[a+96>>2]);a=H[k+24>>2];H[a+96>>2]=l;Da(H[a+148>>2]);H[H[k+24>>2]+148>>2]=m;H[k+20>>2]=1;break o}Da(g);Da(l);Da(m);break o}H[n+4>>2]=463;H[n>>2]=1373;Ha(26080,8264,n);break o}J=x>>>1|0;z=x&-2;R=L&-2;u=q<<2;while(1){if(M>>>0>>0){p=c+u|0;r=f+u|0;q=b+u|0;t=j+u|0;if(K){La(o,m,H[j>>2],0,0,b,f,c);La(o,m,H[t>>2],H[a>>2],H[i>>2],q,r,p);p=p+4|0;r=r+4|0;q=q+4|0;t=t+4|0;c=c+4|0;f=f+4|0;j=j+4|0;b=b+4|0}A=0;while(1){if(z>>>0>A>>>0){La(o,m,H[j>>2],H[a>>2],H[i>>2],b,f,c);La(o,m,H[j+4>>2],H[a>>2],H[i>>2],b+4|0,f+4|0,c+4|0);La(o,m,H[t>>2],H[a>>2],H[i>>2],q,r,p);La(o,m,H[t+4>>2],H[a>>2],H[i>>2],q+4|0,r+4|0,p+4|0);A=A+2|0;i=i+4|0;a=a+4|0;p=p+8|0;r=r+8|0;q=q+8|0;t=t+8|0;c=c+8|0;f=f+8|0;b=b+8|0;j=j+8|0;continue}break}B:{if((x|0)==(z|0)){break B}A=H[j>>2];C:{if((G|0)==(J|0)){La(o,m,A,0,0,b,f,c);La(o,m,H[t>>2],0,0,q,r,p);break C}La(o,m,A,H[a>>2],H[i>>2],b,f,c);La(o,m,H[t>>2],H[a>>2],H[i>>2],q,r,p)}c=c+4|0;f=f+4|0;b=b+4|0;j=j+4|0;if(G>>>0<=J>>>0){break B}i=i+4|0;a=a+4|0}M=M+2|0;c=c+u|0;f=f+u|0;b=b+u|0;j=j+u|0;continue}break}D:{if(!(L&1)){break D}if(K){La(o,m,H[j>>2],0,0,b,f,c);c=c+4|0;f=f+4|0;j=j+4|0;b=b+4|0}p=0;while(1){if(p>>>0>>0){La(o,m,H[j>>2],H[a>>2],H[i>>2],b,f,c);La(o,m,H[j+4>>2],H[a>>2],H[i>>2],b+4|0,f+4|0,c+4|0);p=p+2|0;i=i+4|0;a=a+4|0;c=c+8|0;f=f+8|0;b=b+8|0;j=j+8|0;continue}break}if((x|0)==(z|0)){break D}j=H[j>>2];if((G|0)==(J|0)){La(o,m,j,0,0,b,f,c);break D}La(o,m,j,H[a>>2],H[i>>2],b,f,c)}Da(H[H[k+24>>2]+44>>2]);a=H[k+24>>2];H[a+44>>2]=h;Da(H[a+96>>2]);a=H[k+24>>2];H[a+96>>2]=g;Da(H[a+148>>2]);a=H[k+24>>2];H[a+148>>2]=l;b=H[a+8>>2];H[a+112>>2]=b;H[a+60>>2]=b;b=H[a+12>>2];H[a+116>>2]=b;H[a+64>>2]=b;b=H[a>>2];H[a+104>>2]=b;H[a+52>>2]=b;b=H[a+4>>2];H[a+108>>2]=b;H[a+56>>2]=b;H[k+20>>2]=1;p=0}f=H[n+64>>2];E:{if(d){break E}b=0;while(1){if((b|0)==(v|0)){break E}d=H[f+24>>2]+N(b,52)|0;a=H[d+24>>2];if((a|0)!=8){F:{if(a>>>0<=7){h=N(H[d+12>>2],H[d+8>>2]);g=H[d+44>>2];if(H[d+32>>2]){c=1<>2];j=a>>31<<7|a>>>25;S=l,T=Je(a<<7,j,c,0),H[S>>2]=T;i=i+1|0;continue}}a=-1<>2],0,255),ra,a,0);H[c>>2]=l;i=i+1|0;continue}}a=a-8|0;c=N(H[d+12>>2],H[d+8>>2]);h=H[d+44>>2];i=0;if(H[d+32>>2]){while(1){if((c|0)==(i|0)){break F}g=h+(i<<2)|0;H[g>>2]=H[g>>2]>>a;i=i+1|0;continue}}while(1){if((c|0)==(i|0)){break F}g=h+(i<<2)|0;H[g>>2]=H[g>>2]>>>a;i=i+1|0;continue}}H[d+24>>2]=8}b=b+1|0;continue}}a=H[f+24>>2];b=N(H[a+12>>2],H[a+8>>2]);G:{if(!p){if(H[f+20>>2]==2){if(H[f+16>>2]==1){na(H[a+44>>2],b|0);break G}if(!e){break G}ea(H[a+44>>2],H[a+96>>2],b|0);break G}da(H[a+44>>2],H[a+96>>2],H[a+148>>2],b|0);break G}H:{switch(v-1|0){case 0:ca(H[a+44>>2],b|0);break G;case 2:ba(H[a+44>>2],H[a+96>>2],H[a+148>>2],b|0);break G;case 3:break H;default:break G}}aa(H[a+44>>2],H[a+96>>2],H[a+148>>2],H[a+200>>2],b|0)}Va(H[n+64>>2]);j=0}oa=n+8320|0;return j|0}function mc(a,b,c,d,e,f,g,h,i){var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,z=0,A=0,C=0,D=0,E=0,F=0,G=0,I=0,J=0,L=0,M=0;j=H[a>>2];a:{if(j>>>0>>0|b>>>0>=d>>>0|b>>>0>=j>>>0){break a}j=H[a+4>>2];if(j>>>0>>0|c>>>0>=e>>>0|c>>>0>=j>>>0){break a}C=(c>>>0)/K[a+12>>2]|0;s=H[a+8>>2];F=(b>>>0)/(s>>>0)|0;J=(N(s,F)-b|0)+s|0;x=c;while(1){k=H[a+12>>2];j=k;j=(c|0)==(x|0)?j-((c>>>0)%(j>>>0)|0)|0:j;u=e-x|0;r=j>>>0>>0?j:u;z=r&-4;v=r&3;L=r&-8;G=r&7;w=r-1|0;M=(g|0)==2&(r|0)==1;I=N(k-j|0,s);A=(N(x-c|0,h)<<2)+f|0;D=F;u=b;while(1){j=(b|0)==(u|0)?J:s;k=d-u|0;q=j>>>0>>0?j:k;k=s-j|0;l=D<<2;j=H[l+(H[a+24>>2]+(N(H[a+16>>2],C)<<2)|0)>>2];b:{c:{d:{e:{f:{g:{if(i){h:{i:{j:{k:{if(j){l=((I<<2)+j|0)+(k<<2)|0;j=u-b|0;if((g|0)==1){break h}m=(N(g,j)<<2)+A|0;if((q|0)==1){break i}if(M){break j}if((g|0)!=8|q>>>0<=7){break k}if(!r){break b}o=q&-4;k=0;while(1){j=0;while(1){H[(j<<5)+m>>2]=H[(j<<2)+l>>2];n=j|1;H[(n<<5)+m>>2]=H[(n<<2)+l>>2];n=j|2;H[(n<<5)+m>>2]=H[(n<<2)+l>>2];n=j|3;H[(n<<5)+m>>2]=H[(n<<2)+l>>2];j=j+4|0;if(o>>>0>j>>>0){continue}break}if(j>>>0>>0){while(1){H[(j<<5)+m>>2]=H[(j<<2)+l>>2];j=j+1|0;if((q|0)!=(j|0)){continue}break}}l=(s<<2)+l|0;m=(h<<2)+m|0;k=k+1|0;if((r|0)!=(k|0)){continue}break}break b}if((g|0)!=1){if(!r){break b}p=q&-4;n=q&3;l=(N(u-b|0,g)<<2)+A|0;o=0;while(1){l:{if(!q){break l}m=0;j=0;k=0;if(q>>>0>=4){while(1){H[(N(g,j)<<2)+l>>2]=0;H[(N(j|1,g)<<2)+l>>2]=0;H[(N(j|2,g)<<2)+l>>2]=0;H[(N(j|3,g)<<2)+l>>2]=0;j=j+4|0;k=k+4|0;if((p|0)!=(k|0)){continue}break}}if(!n){break l}while(1){H[(N(g,j)<<2)+l>>2]=0;j=j+1|0;m=m+1|0;if((n|0)!=(m|0)){continue}break}}l=(h<<2)+l|0;o=o+1|0;if((r|0)!=(o|0)){continue}break}break b}if(!r){break b}l=q<<2;k=(u-b<<2)+A|0;o=0;if(w>>>0>=7){break g}break f}if(!r){break b}E=q&-4;p=q&3;n=0;break c}j=0;k=q&-4;if(k){while(1){H[(j<<3)+m>>2]=H[(j<<2)+l>>2];o=j|1;H[(o<<3)+m>>2]=H[(o<<2)+l>>2];o=j|2;H[(o<<3)+m>>2]=H[(o<<2)+l>>2];o=j|3;H[(o<<3)+m>>2]=H[(o<<2)+l>>2];j=j+4|0;if(k>>>0>j>>>0){continue}break}}if(j>>>0>=q>>>0){break b}o=0;k=j;n=q-j&3;if(n){while(1){H[(k<<3)+m>>2]=H[(k<<2)+l>>2];k=k+1|0;o=o+1|0;if((n|0)!=(o|0)){continue}break}}if(j-q>>>0>4294967292){break b}while(1){H[(k<<3)+m>>2]=H[(k<<2)+l>>2];j=k+1|0;H[(j<<3)+m>>2]=H[(j<<2)+l>>2];j=k+2|0;H[(j<<3)+m>>2]=H[(j<<2)+l>>2];j=k+3|0;H[(j<<3)+m>>2]=H[(j<<2)+l>>2];k=k+4|0;if((q|0)!=(k|0)){continue}break}break b}if(!r){break b}k=0;if(w>>>0>=3){while(1){H[m>>2]=H[l>>2];j=h<<2;m=j+m|0;p=l;l=s<<2;o=p+l|0;H[m>>2]=H[o>>2];m=j+m|0;o=l+o|0;H[m>>2]=H[o>>2];m=j+m|0;o=l+o|0;H[m>>2]=H[o>>2];l=l+o|0;m=j+m|0;k=k+4|0;if((z|0)!=(k|0)){continue}break}}j=0;if(!v){break b}while(1){H[m>>2]=H[l>>2];l=(s<<2)+l|0;m=(h<<2)+m|0;j=j+1|0;if((v|0)!=(j|0)){continue}break}break b}j=(j<<2)+A|0;if((q|0)!=4){if(!r){break b}m=q<<2;o=0;if(w>>>0>=3){break e}break d}if(!r){break b}o=0;if(w>>>0>=3){while(1){k=H[l+4>>2];H[j>>2]=H[l>>2];H[j+4>>2]=k;k=H[l+12>>2];H[j+8>>2]=H[l+8>>2];H[j+12>>2]=k;k=l;l=s<<2;k=k+l|0;n=H[k+12>>2];m=h<<2;j=m+j|0;H[j+8>>2]=H[k+8>>2];H[j+12>>2]=n;n=H[k+4>>2];H[j>>2]=H[k>>2];H[j+4>>2]=n;k=l+k|0;n=H[k+12>>2];j=j+m|0;H[j+8>>2]=H[k+8>>2];H[j+12>>2]=n;n=H[k+4>>2];H[j>>2]=H[k>>2];H[j+4>>2]=n;k=l+k|0;n=H[k+12>>2];j=j+m|0;H[j+8>>2]=H[k+8>>2];H[j+12>>2]=n;n=H[k+4>>2];H[j>>2]=H[k>>2];H[j+4>>2]=n;l=l+k|0;j=j+m|0;o=o+4|0;if((z|0)!=(o|0)){continue}break}}m=0;if(!v){break b}while(1){k=H[l+4>>2];H[j>>2]=H[l>>2];H[j+4>>2]=k;k=H[l+12>>2];H[j+8>>2]=H[l+8>>2];H[j+12>>2]=k;l=(s<<2)+l|0;j=(h<<2)+j|0;m=m+1|0;if((v|0)!=(m|0)){continue}break}break b}if(!j){j=Fa(1,N(H[a+8>>2],H[a+12>>2])<<2);if(!j){return 0}H[l+(H[a+24>>2]+(N(H[a+16>>2],C)<<2)|0)>>2]=j}l=((I<<2)+j|0)+(k<<2)|0;j=u-b|0;m:{n:{o:{p:{q:{r:{if((g|0)!=1){m=(N(g,j)<<2)+A|0;if((q|0)==1){break r}if((g|0)!=8|q>>>0<=7){break q}if(!r){break b}o=q&-4;k=0;while(1){j=0;while(1){H[(j<<2)+l>>2]=H[(j<<5)+m>>2];n=j|1;H[(n<<2)+l>>2]=H[(n<<5)+m>>2];n=j|2;H[(n<<2)+l>>2]=H[(n<<5)+m>>2];n=j|3;H[(n<<2)+l>>2]=H[(n<<5)+m>>2];j=j+4|0;if(o>>>0>j>>>0){continue}break}if(j>>>0>>0){while(1){H[(j<<2)+l>>2]=H[(j<<5)+m>>2];j=j+1|0;if((q|0)!=(j|0)){continue}break}}l=(s<<2)+l|0;m=(h<<2)+m|0;k=k+1|0;if((r|0)!=(k|0)){continue}break}break b}j=(j<<2)+A|0;if((q|0)==4){break p}if(!r){break b}m=q<<2;o=0;if(w>>>0>=3){break o}break n}if(!r){break b}o=0;if(w>>>0>=3){while(1){H[l>>2]=H[m>>2];j=s<<2;l=j+l|0;k=h<<2;m=k+m|0;H[l>>2]=H[m>>2];l=j+l|0;m=k+m|0;H[l>>2]=H[m>>2];l=j+l|0;m=k+m|0;H[l>>2]=H[m>>2];l=j+l|0;m=k+m|0;o=o+4|0;if((z|0)!=(o|0)){continue}break}}j=0;if(!v){break b}while(1){H[l>>2]=H[m>>2];l=(s<<2)+l|0;m=(h<<2)+m|0;j=j+1|0;if((v|0)!=(j|0)){continue}break}break b}if(!r){break b}E=q&-4;p=q&3;n=0;break m}if(!r){break b}o=0;if(w>>>0>=3){while(1){k=H[j+4>>2];H[l>>2]=H[j>>2];H[l+4>>2]=k;k=H[j+12>>2];H[l+8>>2]=H[j+8>>2];H[l+12>>2]=k;m=h<<2;j=m+j|0;n=H[j+12>>2];k=l;l=s<<2;k=k+l|0;H[k+8>>2]=H[j+8>>2];H[k+12>>2]=n;n=H[j+4>>2];H[k>>2]=H[j>>2];H[k+4>>2]=n;j=j+m|0;n=H[j+12>>2];k=l+k|0;H[k+8>>2]=H[j+8>>2];H[k+12>>2]=n;n=H[j+4>>2];H[k>>2]=H[j>>2];H[k+4>>2]=n;j=j+m|0;n=H[j+12>>2];k=l+k|0;H[k+8>>2]=H[j+8>>2];H[k+12>>2]=n;n=H[j+4>>2];H[k>>2]=H[j>>2];H[k+4>>2]=n;j=j+m|0;l=l+k|0;o=o+4|0;if((z|0)!=(o|0)){continue}break}}m=0;if(!v){break b}while(1){k=H[j+4>>2];H[l>>2]=H[j>>2];H[l+4>>2]=k;k=H[j+12>>2];H[l+8>>2]=H[j+8>>2];H[l+12>>2]=k;j=(h<<2)+j|0;l=(s<<2)+l|0;m=m+1|0;if((v|0)!=(m|0)){continue}break}break b}while(1){k=!m;if(!k){B(l,j,m)}p=j;j=h<<2;n=p+j|0;p=l;l=s<<2;p=p+l|0;if(!k){B(p,n,m)}n=j+n|0;p=l+p|0;if(!k){B(p,n,m)}n=j+n|0;p=l+p|0;if(!k){B(p,n,m)}j=j+n|0;l=l+p|0;o=o+4|0;if((z|0)!=(o|0)){continue}break}}k=0;if(!v){break b}while(1){if(m){B(l,j,m)}j=(h<<2)+j|0;l=(s<<2)+l|0;k=k+1|0;if((v|0)!=(k|0)){continue}break}break b}while(1){s:{if(!q){break s}k=0;j=0;o=0;if(q>>>0>=4){while(1){H[(j<<2)+l>>2]=H[(N(g,j)<<2)+m>>2];t=j|1;H[(t<<2)+l>>2]=H[(N(g,t)<<2)+m>>2];t=j|2;H[(t<<2)+l>>2]=H[(N(g,t)<<2)+m>>2];t=j|3;H[(t<<2)+l>>2]=H[(N(g,t)<<2)+m>>2];j=j+4|0;o=o+4|0;if((E|0)!=(o|0)){continue}break}}if(!p){break s}while(1){H[(j<<2)+l>>2]=H[(N(g,j)<<2)+m>>2];j=j+1|0;k=k+1|0;if((p|0)!=(k|0)){continue}break}}l=(s<<2)+l|0;m=(h<<2)+m|0;n=n+1|0;if((r|0)!=(n|0)){continue}break}break b}while(1){j=!l;if(!j){y(k,0,l)}p=k;k=h<<2;m=p+k|0;if(!j){y(m,0,l)}m=k+m|0;if(!j){y(m,0,l)}m=k+m|0;if(!j){y(m,0,l)}m=k+m|0;if(!j){y(m,0,l)}m=k+m|0;if(!j){y(m,0,l)}m=k+m|0;if(!j){y(m,0,l)}m=k+m|0;if(!j){y(m,0,l)}k=k+m|0;o=o+8|0;if((L|0)!=(o|0)){continue}break}}j=0;if(!G){break b}while(1){if(l){y(k,0,l)}k=(h<<2)+k|0;j=j+1|0;if((G|0)!=(j|0)){continue}break}break b}while(1){k=!m;if(!k){B(j,l,m)}p=l;l=s<<2;n=p+l|0;p=j;j=h<<2;p=p+j|0;if(!k){B(p,n,m)}n=l+n|0;p=j+p|0;if(!k){B(p,n,m)}n=l+n|0;p=j+p|0;if(!k){B(p,n,m)}l=l+n|0;j=j+p|0;o=o+4|0;if((z|0)!=(o|0)){continue}break}}k=0;if(!v){break b}while(1){if(m){B(j,l,m)}l=(s<<2)+l|0;j=(h<<2)+j|0;k=k+1|0;if((v|0)!=(k|0)){continue}break}break b}while(1){t:{if(!q){break t}k=0;j=0;o=0;if(q>>>0>=4){while(1){H[(N(g,j)<<2)+m>>2]=H[(j<<2)+l>>2];t=j|1;H[(N(t,g)<<2)+m>>2]=H[(t<<2)+l>>2];t=j|2;H[(N(t,g)<<2)+m>>2]=H[(t<<2)+l>>2];t=j|3;H[(N(t,g)<<2)+m>>2]=H[(t<<2)+l>>2];j=j+4|0;o=o+4|0;if((E|0)!=(o|0)){continue}break}}if(!p){break t}while(1){H[(N(g,j)<<2)+m>>2]=H[(j<<2)+l>>2];j=j+1|0;k=k+1|0;if((p|0)!=(k|0)){continue}break}}l=(s<<2)+l|0;m=(h<<2)+m|0;n=n+1|0;if((r|0)!=(n|0)){continue}break}}D=D+1|0;u=q+u|0;if(u>>>0>>0){continue}break}C=C+1|0;x=r+x|0;if(x>>>0>>0){continue}break}}return 1}function Qc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;h=oa-240|0;oa=h;r=1;a:{if(H[H[a>>2]+60>>2]|H[a+128>>2]){break a}b:{k=H[a+116>>2];c:{if(!k){d=H[a+120>>2];break c}f=H[b+16>>2];g=J[k+4>>1];d=H[a+120>>2];if(!(!d|!H[d+12>>2])){f=I[d+18|0]}d:{if(g){k=H[k>>2];while(1){i=k+N(e,6)|0;j=J[i>>1];if(j>>>0>=f>>>0){H[h+180>>2]=f;H[h+176>>2]=j;Ca(c,1,13715,h+176|0);r=0;break a}e:{i=J[i+4>>1];if(!i|(i|0)==65535){break e}i=i-1|0;if(i>>>0>>0){break e}H[h+164>>2]=f;H[h+160>>2]=i;Ca(c,1,13715,h+160|0);r=0;break a}e=e+1|0;if((g|0)!=(e|0)){continue}break}break d}if(f){break b}break c}while(1){f=f-1|0;e=0;while(1){if(J[k+N(e,6)>>1]!=(f|0)){e=e+1|0;if((g|0)!=(e|0)){continue}break b}break}if(f){continue}break}}f:{if(!d){break f}k=H[d+12>>2];if(!k){break f}g:{d=I[d+18|0];h:{if(d){e=0;j=1;while(1){g=H[b+16>>2];f=J[k+(e<<2)>>1];if(g>>>0<=f>>>0){H[h+148>>2]=g;H[h+144>>2]=f;Ca(c,1,13715,h+144|0);j=0}e=e+1|0;if((d|0)!=(e|0)){continue}break}g=Fa(d,4);if(!g){break h}e=0;while(1){f=k+(e<<2)|0;i=I[f+2|0];i:{if(i>>>0>=2){H[h+68>>2]=i;H[h+64>>2]=e;Ca(c,1,12094,h- -64|0);j=0;break i}f=I[f+3|0];if(f>>>0>=d>>>0){H[h+128>>2]=f;Ca(c,1,12038,h+128|0);j=0;break i}l=(i|0)!=1;m=(f<<2)+g|0;if(!(l|!H[m>>2])){H[h+80>>2]=f;Ca(c,1,11527,h+80|0);j=0;break i}if(!(i|!f)){H[h+100>>2]=f;H[h+96>>2]=e;Ca(c,1,11901,h+96|0);j=0;break i}if(!(l|(e|0)==(f|0))){H[h+120>>2]=f;H[h+116>>2]=e;H[h+112>>2]=e;Ca(c,1,11937,h+112|0);j=0;break i}H[m>>2]=1}e=e+1|0;if((d|0)!=(e|0)){continue}break}j=!j;e=0;while(1){j:{f=e<<2;if(I[(f+k|0)+2|0]?H[f+g>>2]:1){e=e+1|0;if((d|0)!=(e|0)){continue}if(j&1){break j}if(H[b+16>>2]!=1){break g}e=0;while(1){if(H[(e<<2)+g>>2]){e=e+1|0;if((d|0)!=(e|0)){continue}break g}break}i=0;Ca(c,2,9253,0);e=0;if(d>>>0>=4){j=d&252;f=0;while(1){m=k+(e<<2)|0;F[m+3|0]=e;F[m+2|0]=1;m=e|1;l=k+(m<<2)|0;F[l+3|0]=m;F[l+2|0]=1;m=e|2;l=k+(m<<2)|0;F[l+3|0]=m;F[l+2|0]=1;m=e|3;l=k+(m<<2)|0;F[l+3|0]=m;F[l+2|0]=1;e=e+4|0;f=f+4|0;if((j|0)!=(f|0)){continue}break}}d=d&3;if(!d){break g}while(1){f=k+(e<<2)|0;F[f+3|0]=e;F[f+2|0]=1;e=e+1|0;i=i+1|0;if((d|0)!=(i|0)){continue}break}break g}H[h+48>>2]=e;j=1;Ca(c,1,11101,h+48|0);e=e+1|0;if((d|0)!=(e|0)){continue}}break}Da(g);r=0;break a}g=Fa(d,4);if(g){break g}}r=0;Ca(c,1,12285,0);break a}Da(g)}d=H[a+120>>2];k:{if(!d){break k}t=H[d+12>>2];if(!t){Da(H[d+4>>2]);Da(H[H[a+120>>2]+8>>2]);Da(H[H[a+120>>2]>>2]);d=H[a+120>>2];g=H[d+12>>2];if(g){Da(g);d=H[a+120>>2]}Da(d);H[a+120>>2]=0;break k}m=H[b+24>>2];l:{k=I[d+18|0];m:{if(k){v=H[d>>2];j=H[d+4>>2];l=H[d+8>>2];e=0;n:{while(1){if(H[(m+N(J[t+(e<<2)>>1],52)|0)+44>>2]){e=e+1|0;if((k|0)!=(e|0)){continue}break n}break}H[h+32>>2]=e;Ca(c,1,13877,h+32|0);r=0;break a}g=Ga(N(k,52));if(!g){break m}i=0;while(1){d=t+(i<<2)|0;e=J[d>>1];f=N(I[d+2|0]?I[d+3|0]:i,52)+g|0;d=m+N(e,52)|0;e=H[d+4>>2];H[f>>2]=H[d>>2];H[f+4>>2]=e;H[f+48>>2]=H[d+48>>2];e=H[d+44>>2];H[f+40>>2]=H[d+40>>2];H[f+44>>2]=e;e=H[d+36>>2];H[f+32>>2]=H[d+32>>2];H[f+36>>2]=e;e=H[d+28>>2];H[f+24>>2]=H[d+24>>2];H[f+28>>2]=e;e=H[d+20>>2];H[f+16>>2]=H[d+16>>2];H[f+20>>2]=e;e=H[d+12>>2];H[f+8>>2]=H[d+8>>2];H[f+12>>2]=e;f=N(i,52)+g|0;d=Ja(N(H[d+8>>2],H[d+12>>2])<<2);H[f+44>>2]=d;if(!d){if(i){a=i&65535;while(1){Da(H[(N(a,52)+g|0)-8>>2]);a=a-1|0;if(a){continue}break}}Da(g);r=0;Ca(c,1,13825,0);break a}H[f+24>>2]=I[i+l|0];H[f+32>>2]=I[i+j|0];i=i+1|0;if((k|0)!=(i|0)){continue}break}u=J[H[a+120>>2]+16>>1];n=u-1|0;while(1){d=N(o,52)+g|0;i=N(H[d+12>>2],H[d+8>>2]);f=t+(o<<2)|0;e=H[(m+N(J[f>>1],52)|0)+44>>2];o:{if(!I[f+2|0]){if(!i){break o}l=H[d+44>>2];j=0;f=0;if(i>>>0>=4){q=i&-4;d=0;while(1){p=f<<2;H[p+l>>2]=H[e+p>>2];s=p|4;H[s+l>>2]=H[e+s>>2];s=p|8;H[s+l>>2]=H[e+s>>2];p=p|12;H[p+l>>2]=H[e+p>>2];f=f+4|0;d=d+4|0;if((q|0)!=(d|0)){continue}break}}d=i&3;if(!d){break o}while(1){i=f<<2;H[i+l>>2]=H[e+i>>2];f=f+1|0;j=j+1|0;if((d|0)!=(j|0)){continue}break}break o}if(!i){break o}d=I[f+3|0];j=(d<<2)+v|0;l=H[(N(d,52)+g|0)+44>>2];f=0;if((i|0)!=1){s=i&-2;d=0;while(1){q=f<<2;p=H[q+e>>2];H[l+q>>2]=H[j+(N(k,(p|0)>=0?(p|0)<(u|0)?p:n:0)<<2)>>2];q=q|4;p=H[q+e>>2];H[l+q>>2]=H[j+(N(k,(p|0)>=0?(p|0)<(u|0)?p:n:0)<<2)>>2];f=f+2|0;d=d+2|0;if((s|0)!=(d|0)){continue}break}}if(!(i&1)){break o}f=f<<2;d=H[f+e>>2];H[f+l>>2]=H[j+(N(k,(d|0)>=0?(d|0)<(u|0)?d:n:0)<<2)>>2]}o=o+1|0;if((k|0)!=(o|0)){continue}break}break l}g=Ga(N(k,52));if(g){break l}}r=0;Ca(c,1,13825,0);break a}d=H[b+16>>2];if(d){e=0;while(1){f=H[(m+N(e,52)|0)+44>>2];if(f){Da(f)}e=e+1|0;if((d|0)!=(e|0)){continue}break}}Da(m);H[b+16>>2]=k;H[b+24>>2]=g}e=H[a+116>>2];if(!e){break a}j=H[e>>2];l=J[e+4>>1];if(l){t=j+6|0;e=0;u=l-2&65535;i=1;while(1){d=H[b+16>>2];p=N(e,6)+j|0;f=J[p>>1];p:{if(d>>>0<=f>>>0){H[h+20>>2]=d;H[h+16>>2]=f;Ca(c,2,7334,h+16|0);break p}g=J[p+4>>1];if((g+1&65535)>>>0<=1){G[(H[b+24>>2]+N(f,52)|0)+48>>1]=J[p+2>>1];break p}k=g-1|0;m=k&65535;if(m>>>0>=d>>>0){H[h+4>>2]=d;H[h>>2]=m;Ca(c,2,7293,h);break p}q:{if(J[p+2>>1]|(f|0)==(m|0)){break q}g=H[b+24>>2];d=g+N(f,52)|0;H[h+232>>2]=H[d+48>>2];n=H[d+44>>2];H[h+224>>2]=H[d+40>>2];H[h+228>>2]=n;n=H[d+36>>2];H[h+216>>2]=H[d+32>>2];H[h+220>>2]=n;n=H[d+28>>2];H[h+208>>2]=H[d+24>>2];H[h+212>>2]=n;n=H[d+20>>2];H[h+200>>2]=H[d+16>>2];H[h+204>>2]=n;n=H[d+12>>2];H[h+192>>2]=H[d+8>>2];H[h+196>>2]=n;n=H[d+4>>2];H[h+184>>2]=H[d>>2];H[h+188>>2]=n;n=N(m,52);g=n+g|0;H[d+48>>2]=H[g+48>>2];o=H[g+44>>2];H[d+40>>2]=H[g+40>>2];H[d+44>>2]=o;o=H[g+36>>2];H[d+32>>2]=H[g+32>>2];H[d+36>>2]=o;o=H[g+28>>2];H[d+24>>2]=H[g+24>>2];H[d+28>>2]=o;o=H[g+20>>2];H[d+16>>2]=H[g+16>>2];H[d+20>>2]=o;o=H[g+12>>2];H[d+8>>2]=H[g+8>>2];H[d+12>>2]=o;o=H[g+4>>2];H[d>>2]=H[g>>2];H[d+4>>2]=o;g=H[h+188>>2];d=n+H[b+24>>2]|0;H[d>>2]=H[h+184>>2];H[d+4>>2]=g;H[d+48>>2]=H[h+232>>2];g=H[h+228>>2];H[d+40>>2]=H[h+224>>2];H[d+44>>2]=g;g=H[h+220>>2];H[d+32>>2]=H[h+216>>2];H[d+36>>2]=g;g=H[h+212>>2];H[d+24>>2]=H[h+208>>2];H[d+28>>2]=g;g=H[h+204>>2];H[d+16>>2]=H[h+200>>2];H[d+20>>2]=g;g=H[h+196>>2];H[d+8>>2]=H[h+192>>2];H[d+12>>2]=g;if(l>>>0<=e+1>>>0){break q}g=i;if(!(e-l&1)){g=k;d=N(i,6)+j|0;n=J[d>>1];r:{if((n|0)!=(f|0)){g=f;if((n|0)!=(m|0)){break r}}G[d>>1]=g}g=i+1|0}if((u|0)==(e&65535)){break q}while(1){d=k;n=N(g,6);o=n+j|0;q=J[o>>1];s:{if((q|0)!=(f|0)){d=f;if((m|0)!=(q|0)){break s}}G[o>>1]=d}d=k;n=n+t|0;o=J[n>>1];t:{if((o|0)!=(f|0)){d=f;if((m|0)!=(o|0)){break t}}G[n>>1]=d}g=g+2|0;if((l|0)!=(g&65535)){continue}break}}G[(H[b+24>>2]+N(f,52)|0)+48>>1]=J[p+2>>1]}i=i+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}e=H[a+116>>2];j=H[e>>2]}if(j){Da(j);e=H[a+116>>2]}Da(e);H[a+116>>2]=0;break a}r=0;Ca(c,1,9499,0)}oa=h+240|0;return r}function $c(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=O(0),p=0;k=oa-48|0;oa=k;H[a+8>>2]=1;a:{b:{d=k+40|0;c:{if((Ka(b,d,2,c)|0)!=2){break c}Ea(d,k+44|0,2);if(H[k+44>>2]!=65359){break c}H[a+8>>2]=2;d=H[b+56>>2];e=d-2|0;d=H[b+60>>2]-(d>>>0<2)|0;g=H[a+224>>2];H[g>>2]=e;H[g+4>>2]=d;H[k+16>>2]=e;H[k+20>>2]=d;Ca(c,4,12769,k+16|0);f=H[a+224>>2];j=H[f>>2];e=H[f+24>>2];d=e+1|0;g=H[f+32>>2];if(d>>>0<=g>>>0){g=H[f+28>>2];break b}o=O(O(g>>>0)+O(100));if(o=O(0)){d=~~o>>>0}else{d=0}H[f+32>>2]=d;g=Ia(H[f+28>>2],N(d,24));if(g){H[f+28>>2]=g;e=H[f+24>>2];d=e+1|0;break b}Da(H[f+28>>2]);H[f+32>>2]=0;H[f+24>>2]=0;H[f+28>>2]=0;Ca(c,1,3899,0)}Ca(c,1,15656,0);a=0;break a}e=N(e,24)+g|0;H[e+16>>2]=2;H[e+8>>2]=j;H[e+12>>2]=j>>31;G[e>>1]=65359;H[f+24>>2]=d;if((Ka(b,H[a+16>>2],2,c)|0)!=2){Ca(c,1,2472,0);a=0;break a}Ea(H[a+16>>2],k+40|0,2);d:{e:{g=H[k+40>>2];if((g|0)!=65424){while(1){e=24912;if(g>>>0<=65279){H[k>>2]=g;Ca(c,1,2268,k);a=0;break a}while(1){d=e;f=H[d>>2];if(f){e=d+12|0;if((f|0)!=(g|0)){continue}}break}f:{g:{if(f){break g}h=2;Ca(c,2,3847,0);e=2472;h:{i:{if((Ka(b,H[a+16>>2],2,c)|0)!=2){break i}while(1){Ea(H[a+16>>2],k+44|0,2);f=24912;g=H[k+44>>2];if(g>>>0>=65280){while(1){d=f;i=H[d>>2];if(i){f=d+12|0;if((g|0)!=(i|0)){continue}}break}if(!(H[d+4>>2]&H[a+8>>2])){e=5397;break i}if(i){if((i|0)==65424){H[k+40>>2]=65424;break f}j=H[b+56>>2];f=H[a+224>>2];g=H[f+24>>2];e=g+1|0;d=H[f+32>>2];if(e>>>0<=d>>>0){d=H[f+28>>2];break h}o=O(O(d>>>0)+O(100));if(o=O(0)){d=~~o>>>0}else{d=0}H[f+32>>2]=d;d=Ia(H[f+28>>2],N(d,24));if(d){H[f+28>>2]=d;g=H[f+24>>2];e=g+1|0;break h}Da(H[f+28>>2]);H[f+32>>2]=0;H[f+24>>2]=0;H[f+28>>2]=0;e=3899;break i}h=h+2|0}if((Ka(b,H[a+16>>2],2,c)|0)==2){continue}break}}Ca(c,1,e,0);Ca(c,1,9847,0);a=0;break a}d=N(g,24)+d|0;H[d+16>>2]=h;g=j-h|0;H[d+8>>2]=g;H[d+12>>2]=g>>31;G[d>>1]=0;H[f+24>>2]=e;H[k+40>>2]=i;g=24912;if((i|0)==65424){break f}while(1){d=g;f=H[d>>2];if(!f){break g}g=d+12|0;if((f|0)!=(i|0)){continue}break}}if(!(H[d+4>>2]&H[a+8>>2])){Ca(c,1,5397,0);a=0;break a}if((Ka(b,H[a+16>>2],2,c)|0)!=2){Ca(c,1,2472,0);a=0;break a}Ea(H[a+16>>2],k+36|0,2);e=H[k+36>>2];if(e>>>0<=1){Ca(c,1,6074,0);a=0;break a}e=e-2|0;H[k+36>>2]=e;g=H[a+16>>2];if(K[a+20>>2]>>0){g=Ia(g,e);if(!g){Da(H[a+16>>2]);H[a+16>>2]=0;H[a+20>>2]=0;Ca(c,1,4973,0);a=0;break a}H[a+16>>2]=g;e=H[k+36>>2];H[a+20>>2]=e}e=Ka(b,g,e,c);if((e|0)!=H[k+36>>2]){Ca(c,1,2472,0);a=0;break a}if(!(sa[H[d+8>>2]](a,H[a+16>>2],e,c)|0)){Ca(c,1,2490,0);a=0;break a}j=H[b+56>>2];i=H[k+36>>2];d=H[a+224>>2];g=H[d+24>>2];h=g+1|0;e=H[d+32>>2];j:{if(h>>>0<=e>>>0){e=H[d+28>>2];break j}o=O(O(e>>>0)+O(100));if(o=O(0)){e=~~o>>>0}else{e=0}H[d+32>>2]=e;e=Ia(H[d+28>>2],N(e,24));if(!e){break d}H[d+28>>2]=e;g=H[d+24>>2];h=g+1|0}e=N(g,24)+e|0;H[e+16>>2]=i+4;g=(j-i|0)-4|0;H[e+8>>2]=g;H[e+12>>2]=g>>31;G[e>>1]=f;H[d+24>>2]=h;if((Ka(b,H[a+16>>2],2,c)|0)!=2){Ca(c,1,2472,0);a=0;break a}m=(f|0)==65372?1:m;l=(f|0)==65362?1:l;n=(f|0)==65361?1:n;Ea(H[a+16>>2],k+40|0,2);g=H[k+40>>2];if((g|0)!=65424){continue}}break}if(n){break e}}Ca(c,1,4785,0);a=0;break a}if(!l){Ca(c,1,4831,0);a=0;break a}if(!m){Ca(c,1,4877,0);a=0;break a}d=0;e=0;h=0;j=oa-16|0;oa=j;m=1;k:{if(!(F[a+212|0]&1)){break k}l:{f=H[a+136>>2];if(!f){break l}m:{while(1){g=H[a+140>>2]+(h<<3)|0;l=H[g>>2];if(l){i=H[g+4>>2];g=d-i|0;g=d>>>0>=g>>>0?g:0;if(d>>>0>>0){f=i-d|0;l=d+l|0;while(1){if(f>>>0<4){d=5671;break m}Ea(l,j+12|0,4);d=H[j+12>>2];if((d^-1)>>>0>>0){d=5645;break m}i=f-4|0;n=i>>>0>>0;g=n?d-i|0:g;e=d+e|0;f=i-d|0;l=((n?0:d)+l|0)+4|0;if(d>>>0>>0){continue}break}f=H[a+136>>2]}d=g}h=h+1|0;if(h>>>0>>0){continue}break}if(!d){break l}m=0;Ca(c,1,3067,0);break k}m=0;Ca(c,1,d,0);break k}d=Ga(e);H[a+160>>2]=d;if(!d){m=0;Ca(c,1,4337,0);break k}H[a+148>>2]=e;h=H[a+140>>2];n:{f=H[a+136>>2];if(f){e=0;d=0;g=0;while(1){l=g<<3;n=l+h|0;i=H[n>>2];if(i){h=H[a+160>>2]+d|0;f=H[n+4>>2];o:{if(f>>>0<=e>>>0){if(f){B(h,i,f)}d=d+f|0;e=e-f|0;break o}if(e){B(h,i,e)}d=d+e|0;h=f-e|0;e=e+i|0;while(1){if(h>>>0<4){break n}Ea(e,j+8|0,4);e=e+4|0;i=H[a+160>>2]+d|0;f=h-4|0;h=H[j+8>>2];if(f>>>0>>0){if(f){B(i,e,f)}d=d+f|0;e=H[j+8>>2]-f|0;break o}if(h){B(i,e,h)}h=H[j+8>>2];d=h+d|0;e=e+h|0;h=f-h|0;if(h){continue}break}e=0}Da(H[l+H[a+140>>2]>>2]);h=H[a+140>>2];f=l+h|0;H[f>>2]=0;H[f+4>>2]=0;f=H[a+136>>2]}g=g+1|0;if(g>>>0>>0){continue}break}e=H[a+148>>2];d=H[a+160>>2]}H[a+168>>2]=e;H[a+144>>2]=d;H[a+136>>2]=0;Da(h);H[a+140>>2]=0;break k}m=0;Ca(c,1,5671,0)}oa=j+16|0;if(!m){Ca(c,1,8085,0);a=0;break a}Ca(c,4,11754,0);d=H[a+224>>2];e=H[b+56>>2];e=e-2|0;H[d+8>>2]=e;H[d+12>>2]=0;b=0;h=0;i=oa-16|0;oa=i;g=H[a+68>>2];p:{if(!g){H[a+76>>2]=1;break p}if(H[a+76>>2]){break p}d=H[a+72>>2];j=H[a+224>>2];e=H[j+40>>2];if((g|0)!=1){m=d+8|0;l=g&-2;while(1){n=b<<3;p=J[n+d>>1];f=e+N(p,40)|0;H[f>>2]=p;H[f+8>>2]=H[f+8>>2]+1;n=J[m+n>>1];f=e+N(n,40)|0;H[f>>2]=n;H[f+8>>2]=H[f+8>>2]+1;b=b+2|0;h=h+2|0;if((l|0)!=(h|0)){continue}break}}if(g&1){f=J[(b<<3)+d>>1];b=e+N(f,40)|0;H[b>>2]=f;H[b+8>>2]=H[b+8>>2]+1}f=H[j+36>>2];q:{if(f){b=0;while(1){if(!H[(e+N(b,40)|0)+8>>2]){H[i>>2]=b;Ca(c,1,9304,i);break q}b=b+1|0;if((f|0)!=(b|0)){continue}break}}f=H[j+8>>2];b=H[j+12>>2];e=0;while(1){r:{l=e<<3;m=H[H[a+224>>2]+40>>2]+N(J[l+d>>1],40)|0;h=H[m+16>>2];if(!h){h=Fa(H[m+8>>2],24);H[m+16>>2]=h;if(!h){break r}g=H[a+68>>2];d=H[a+72>>2]}p=h;h=H[m+4>>2];j=p+N(h,24)|0;H[j>>2]=f;H[j+4>>2]=b;l=H[(d+l|0)+4>>2];f=l+f|0;H[j+16>>2]=f;b=f>>>0>>0?b+1|0:b;H[j+20>>2]=b;H[m+4>>2]=h+1;e=e+1|0;if(g>>>0>e>>>0){continue}break p}break}Ca(c,1,6882,0)}H[a+76>>2]=1;if(!H[a+68>>2]){break p}d=H[H[a+224>>2]+40>>2];b=0;while(1){c=N(J[H[a+72>>2]+(b<<3)>>1],40);d=c+d|0;H[d+8>>2]=0;Da(H[d+16>>2]);d=H[H[a+224>>2]+40>>2];H[(c+d|0)+16>>2]=0;b=b+1|0;if(b>>>0>2]){continue}break}}oa=i+16|0;H[a+8>>2]=8;a=1;break a}Da(H[d+28>>2]);H[d+32>>2]=0;H[d+24>>2]=0;H[d+28>>2]=0;Ca(c,1,3899,0);a=0}oa=k+48|0;return a|0}function ve(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;f=oa-160|0;oa=f;a:{if(c>>>0<=35){c=0;Ca(d,1,6095,0);break a}c=c-36|0;h=(c>>>0)/3|0;if((N(h,3)|0)!=(c|0)){c=0;Ca(d,1,6095,0);break a}j=H[a+96>>2];c=f+156|0;Ea(b,c,2);G[a+104>>1]=H[f+156>>2];Ea(b+2|0,j+8|0,4);Ea(b+6|0,j+12|0,4);Ea(b+10|0,j,4);Ea(b+14|0,j+4|0,4);Ea(b+18|0,a+116|0,4);Ea(b+22|0,a+120|0,4);Ea(b+26|0,a+108|0,4);Ea(b+30|0,a+112|0,4);Ea(b+34|0,c,2);b:{c:{d:{c=H[f+156>>2];if(c>>>0<=16384){H[j+16>>2]=c;if((c|0)!=(h|0)){H[f+132>>2]=h;H[f+128>>2]=c;Ca(d,1,14980,f+128|0);c=0;break a}c=H[j+4>>2];g=H[j+12>>2];l=H[j+8>>2];e=H[j>>2];if(!(c>>>0>>0&l>>>0>e>>>0)){H[f+120>>2]=g-c;H[f+124>>2]=0-(c>>>0>g>>>0);H[f+112>>2]=l-e;H[f+116>>2]=0-(e>>>0>l>>>0);Ca(d,1,14542,f+112|0);c=0;break a}i=H[a+116>>2];k=H[a+120>>2];if(!(k?i:0)){H[f+4>>2]=k;H[f>>2]=i;Ca(d,1,15094,f);c=0;break a}e:{n=H[a+108>>2];f:{if(n>>>0>e>>>0){break f}i=i+n|0;if(e>>>0>=(i>>>0>>0?-1:i)>>>0){break f}i=H[a+112>>2];if(i>>>0>c>>>0){break f}k=i+k|0;if(c>>>0<(i>>>0>k>>>0?-1:k)>>>0){break e}}c=0;Ca(d,1,2792,0);break a}g:{if(H[a+248>>2]){break g}i=H[a+240>>2];if(!i){break g}k=H[a+244>>2];if(!k){break g}e=l-e|0;c=g-c|0;if((e|0)==(i|0)&(c|0)==(k|0)){break g}H[f+108>>2]=c;H[f+104>>2]=e;H[f+100>>2]=k;H[f+96>>2]=i;Ca(d,1,14006,f+96|0);c=0;break a}e=Fa(h,52);H[j+24>>2]=e;if(!e){break d}h:{if(!H[j+16>>2]){break h}c=f+152|0;Ea(b+36|0,c,1);h=H[f+152>>2];k=h>>>7|0;H[e+32>>2]=k;n=(h&127)+1|0;H[e+24>>2]=n;l=H[a+248>>2];Ea(b+37|0,c,1);H[e>>2]=H[f+152>>2];Ea(b+38|0,c,1);g=H[f+152>>2];H[e+4>>2]=g;c=0;i=H[e>>2];if(i-256>>>0<4294967041){h=0;break b}h=0;if(g-256>>>0<4294967041){break b}g=H[e+24>>2];if(g>>>0>31){break c}H[e+36>>2]=0;H[e+40>>2]=H[a+184>>2];h=1;if(K[j+16>>2]<=1){break h}k=l?0:k;l=l?0:n;b=b+39|0;while(1){Ea(b,f+152|0,1);i=H[f+152>>2];g=i>>>7|0;H[e+84>>2]=g;i=(i&127)+1|0;H[e+76>>2]=i;if(!(H[a+248>>2]|(I[a+212|0]&4|(i|0)==(l|0)&(g|0)==(k|0)))){H[f+84>>2]=g;H[f+80>>2]=i;H[f+76>>2]=h;H[f+72>>2]=k;H[f+68>>2]=l;H[f+64>>2]=h;Ca(d,2,14778,f- -64|0)}g=f+152|0;Ea(b+1|0,g,1);H[e+52>>2]=H[f+152>>2];Ea(b+2|0,g,1);g=H[f+152>>2];H[e+56>>2]=g;i=H[e+52>>2];if(i-256>>>0<4294967041|g-256>>>0<=4294967040){break b}g=H[e+76>>2];if(g>>>0>=32){break c}b=b+3|0;H[e+88>>2]=0;H[e+92>>2]=H[a+184>>2];e=e+52|0;h=h+1|0;if(h>>>0>2]){continue}break}}c=0;h=H[a+116>>2];if(!h){break a}g=H[a+120>>2];if(!g){break a}l=0-!h|0;e=l;p=H[a+108>>2];k=H[j+8>>2]-p|0;i=h-1|0;b=k+i|0;e=k>>>0>b>>>0?e+1|0:e;b=Ke(b,e,h,0);H[a+128>>2]=b;n=0-!g|0;e=n;q=H[a+112>>2];o=H[j+12>>2]-q|0;m=o;k=g-1|0;o=o+k|0;e=m>>>0>o>>>0?e+1|0:e;e=Ke(o,e,g,0);H[a+132>>2]=e;i:{if(!(!b|!e)){if(b>>>0<=65535/(e>>>0)>>>0){break i}}H[f+20>>2]=e;H[f+16>>2]=b;Ca(d,1,14120,f+16|0);break a}o=N(b,e);j:{if(I[a+92|0]&2){H[a+28>>2]=(H[a+28>>2]-p>>>0)/(h>>>0);H[a+32>>2]=(H[a+32>>2]-q>>>0)/(g>>>0);e=l;b=H[a+36>>2]-p|0;m=b;b=b+i|0;e=m>>>0>b>>>0?e+1|0:e;v=a,w=Ke(b,e,h,0),H[v+36>>2]=w;e=n;b=H[a+40>>2]-q|0;m=b;b=b+k|0;e=m>>>0>b>>>0?e+1|0:e;v=a,w=Ke(b,e,g,0),H[v+40>>2]=w;break j}H[a+40>>2]=e;H[a+36>>2]=b;H[a+28>>2]=0;H[a+32>>2]=0}b=Fa(o,5644);H[a+180>>2]=b;if(!b){Ca(d,1,3935,0);break a}b=Fa(H[j+16>>2],1080);H[H[a+12>>2]+5584>>2]=b;if(!H[H[a+12>>2]+5584>>2]){Ca(d,1,3935,0);break a}b=Fa(10,20);H[H[a+12>>2]+5616>>2]=b;b=H[a+12>>2];if(!H[b+5616>>2]){Ca(d,1,3935,0);break a}H[b+5624>>2]=10;b=Fa(10,20);H[H[a+12>>2]+5628>>2]=b;b=H[a+12>>2];if(!H[b+5628>>2]){Ca(d,1,3935,0);break a}H[b+5636>>2]=10;h=H[j+16>>2];k:{if(!h){break k}g=H[j+24>>2];b=0;if((h|0)!=1){l=h&-2;e=0;while(1){i=g+N(b,52)|0;if(!H[i+32>>2]){H[(H[H[a+12>>2]+5584>>2]+N(b,1080)|0)+1076>>2]=1<>2]-1}i=b|1;k=g+N(i,52)|0;if(!H[k+32>>2]){H[(H[H[a+12>>2]+5584>>2]+N(i,1080)|0)+1076>>2]=1<>2]-1}b=b+2|0;e=e+2|0;if((l|0)!=(e|0)){continue}break}}if(!(h&1)){break k}e=g+N(b,52)|0;if(H[e+32>>2]){break k}H[(H[H[a+12>>2]+5584>>2]+N(b,1080)|0)+1076>>2]=1<>2]-1}if(o){b=H[a+180>>2];e=0;while(1){h=Fa(H[j+16>>2],1080);H[b+5584>>2]=h;if(!h){Ca(d,1,3935,0);break a}b=b+5644|0;e=e+1|0;if(o>>>0>e>>>0){continue}break}}b=N(H[a+132>>2],H[a+128>>2]);H[H[a+224>>2]+36>>2]=b;b=Fa(b,40);d=H[a+224>>2];H[d+40>>2]=b;e=0;l:{if(!b){break l}e=1;if(!H[d+36>>2]){break l}d=0;while(1){m:{e=0;g=N(d,40);b=g+b|0;H[b+20>>2]=0;H[b+28>>2]=100;h=Fa(100,24);l=H[a+224>>2];b=H[l+40>>2];H[(g+b|0)+24>>2]=h;if(!h){break m}e=1;d=d+1|0;if(d>>>0>2]){continue}}break}}if(!e){break a}H[a+8>>2]=4;r=H[j+16>>2];if(r){b=H[a+112>>2];d=H[a+120>>2];c=b+N(d,H[a+132>>2]-1|0)|0;d=c+d|0;c=c>>>0>d>>>0?-1:d;d=H[j+12>>2];c=c>>>0>>0?c:d;l=c-1|0;k=0-!c|0;c=H[a+108>>2];d=H[a+116>>2];a=c+N(d,H[a+128>>2]-1|0)|0;d=a+d|0;a=a>>>0>d>>>0?-1:d;d=H[j+8>>2];a=a>>>0>>0?a:d;i=a-1|0;n=0-!a|0;a=H[j+4>>2];b=a>>>0>>0?b:a;o=b-1|0;p=0-!b|0;a=H[j>>2];b=a>>>0>>0?c:a;q=b-1|0;u=0-!b|0;a=H[j+24>>2];b=0;while(1){e=p;d=H[a+4>>2];c=d+o|0;j=Ke(c,c>>>0>>0?e+1|0:e,d,0);H[a+20>>2]=j;e=u;h=H[a>>2];c=h+q|0;s=Ke(c,c>>>0>>0?e+1|0:e,h,0);H[a+16>>2]=s;c=H[a+40>>2];g=c&31;if((c&63)>>>0>=32){e=-1<>>32-g}g=m^-1;e=e^-1;m=e;e=k;t=d+l|0;e=t>>>0>>0?e+1|0:e;e=Ke(t,e,d,0)-j|0;d=m;j=e;e=e+g|0;d=j>>>0>e>>>0?d+1|0:d;j=e;e=c&31;if((c&63)>>>0>=32){d=d>>>e|0}else{d=((1<>>e}H[a+12>>2]=d;e=n;d=h+i|0;e=d>>>0>>0?e+1|0:e;d=Ke(d,e,h,0)-s|0;e=m;d=d+g|0;e=d>>>0>>0?e+1|0:e;h=d;d=c&31;if((c&63)>>>0>=32){c=e>>>d|0}else{c=((1<>>d}H[a+8>>2]=c;a=a+52|0;b=b+1|0;if((r|0)!=(b|0)){continue}break}}c=1;break a}H[f+144>>2]=c;Ca(d,1,7932,f+144|0);c=0;break a}c=0;H[j+16>>2]=0;Ca(d,1,3935,0);break a}H[f+52>>2]=g;H[f+48>>2]=h;Ca(d,1,15402,f+48|0);break a}H[f+40>>2]=g;H[f+36>>2]=i;H[f+32>>2]=h;Ca(d,1,14340,f+32|0)}oa=f+160|0;return c|0}function Fc(a,b,c,d,e,f,g){var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0;j=oa+-64|0;oa=j;H[j+60>>2]=b;z=j+39|0;t=j+40|0;a:{b:{c:{d:{e:while(1){h=0;f:while(1){k=b;if((o^2147483647)<(h|0)){break d}o=h+o|0;g:{h:{i:{j:{h=b;i=I[h|0];if(i){while(1){k:{b=i&255;l:{if(!b){b=h;break l}if((b|0)!=37){break k}i=h;while(1){if(I[i+1|0]!=37){b=i;break l}h=h+1|0;n=I[i+2|0];b=i+2|0;i=b;if((n|0)==37){continue}break}}h=h-k|0;y=o^2147483647;if((h|0)>(y|0)){break d}if(a){Ma(a,k,h)}if(h){continue f}H[j+60>>2]=b;h=b+1|0;q=-1;i=F[b+1|0]-48|0;if(!(I[b+2|0]!=36|i>>>0>9)){x=1;q=i;h=b+3|0}H[j+60>>2]=h;l=0;i=F[h|0];b=i-32|0;m:{if(b>>>0>31){n=h;break m}n=h;b=1<>2]=n;l=b|l;i=F[h+1|0];b=i-32|0;if(b>>>0>=32){break m}h=n;b=1<>>0>9)){p:{if(!a){H[(b<<2)+e>>2]=10;b=0;break p}b=H[(b<<3)+d>>2]}p=b;b=n+3|0;i=1;break o}if(x){break j}b=n+1|0;if(!a){H[j+60>>2]=b;x=0;p=0;break n}h=H[c>>2];H[c>>2]=h+4;p=H[h>>2];i=0}x=i;H[j+60>>2]=b;if((p|0)>=0){break n}p=0-p|0;l=l|8192;break n}p=Ec(j+60|0);if((p|0)<0){break d}b=H[j+60>>2]}h=0;m=-1;u=0;q:{if(I[b|0]!=46){break q}if(I[b+1|0]==42){i=F[b+2|0]-48|0;r:{if(!(I[b+3|0]!=36|i>>>0>9)){b=b+4|0;s:{if(!a){H[(i<<2)+e>>2]=10;m=0;break s}m=H[(i<<3)+d>>2]}break r}if(x){break j}b=b+2|0;m=0;if(!a){break r}i=H[c>>2];H[c>>2]=i+4;m=H[i>>2]}H[j+60>>2]=b;u=(m|0)>=0;break q}H[j+60>>2]=b+1;m=Ec(j+60|0);b=H[j+60>>2];u=1}while(1){v=h;n=28;r=b;i=F[b|0];if(i-123>>>0<4294967238){break c}b=b+1|0;h=I[(i+N(h,58)|0)+25263|0];if((h-1&255)>>>0<8){continue}break}H[j+60>>2]=b;t:{if((h|0)!=27){if(!h){break c}if((q|0)>=0){if(!a){H[(q<<2)+e>>2]=h;continue e}h=(q<<3)+d|0;i=H[h+4>>2];H[j+48>>2]=H[h>>2];H[j+52>>2]=i;break t}if(!a){break g}Dc(j+48|0,h,c,g);break t}if((q|0)>=0){break c}h=0;if(!a){continue f}}if(I[a|0]&32){break b}i=l&-65537;l=l&8192?i:l;q=0;w=1072;n=t;u:{v:{w:{x:{y:{z:{A:{B:{C:{D:{E:{F:{G:{H:{I:{J:{K:{r=I[r|0];h=r<<24>>24;h=v?(r&15)==3?h&-45:h:h;switch(h-88|0){case 0:case 32:break G;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 10:case 16:case 18:case 19:case 20:case 21:case 25:case 26:case 28:case 30:case 31:break h;case 9:case 13:case 14:case 15:break u;case 11:break B;case 12:case 17:break E;case 22:break I;case 23:break F;case 24:break H;case 27:break A;case 29:break J;default:break K}}L:{switch(h-65|0){case 1:case 3:break h;case 0:case 4:case 5:case 6:break u;case 2:break z;default:break L}}if((h|0)==83){break y}break h}i=H[j+48>>2];r=H[j+52>>2];w=1072;break D}h=0;M:{switch(v|0){case 0:H[H[j+48>>2]>>2]=o;continue f;case 1:H[H[j+48>>2]>>2]=o;continue f;case 2:k=H[j+48>>2];H[k>>2]=o;H[k+4>>2]=o>>31;continue f;case 3:G[H[j+48>>2]>>1]=o;continue f;case 4:F[H[j+48>>2]]=o;continue f;case 6:H[H[j+48>>2]>>2]=o;continue f;case 7:break M;default:continue f}}k=H[j+48>>2];H[k>>2]=o;H[k+4>>2]=o>>31;continue f}m=m>>>0<=8?8:m;l=l|8;h=120}b=t;k=H[j+52>>2];r=k;i=H[j+48>>2];s=i;if(i|k){A=h&32;while(1){b=b-1|0;F[b|0]=A|I[(s&15)+25792|0];v=!k&s>>>0>15|(k|0)!=0;s=(k&15)<<28|s>>>4;k=k>>>4|0;if(v){continue}break}}k=b;if(!(l&8)|!(i|r)){break C}w=(h>>>4|0)+1072|0;q=2;break C}b=t;k=H[j+52>>2];r=k;i=H[j+48>>2];s=i;if(i|k){while(1){b=b-1|0;F[b|0]=s&7|48;v=!k&s>>>0>7|(k|0)!=0;s=(k&7)<<29|s>>>3;k=k>>>3|0;if(v){continue}break}}k=b;if(!(l&8)){break C}b=t-b|0;m=(b|0)<(m|0)?m:b+1|0;break C}i=H[j+48>>2];b=H[j+52>>2];r=b;if((b|0)<0){h=0-(b+((i|0)!=0)|0)|0;r=h;i=0-i|0;H[j+48>>2]=i;H[j+52>>2]=h;q=1;w=1072;break D}if(l&2048){q=1;w=1073;break D}q=l&1;w=q?1074:1072}k=cb(i,r,t)}if((m|0)<0&u){break d}l=u?l&-65537:l;if(!((i|r)!=0|m)){k=t;m=0;break h}b=!(i|r)+(t-k|0)|0;m=(b|0)<(m|0)?m:b;break h}h=I[j+48|0];break i}h=m>>>0>=2147483647?2147483647:m;l=h;n=(h|0)!=0;b=H[j+48>>2];k=b?b:1686;b=k;N:{O:{P:{Q:{if(!(b&3)|!h){break Q}while(1){if(!I[b|0]){break P}l=l-1|0;n=(l|0)!=0;b=b+1|0;if(!(b&3)){break Q}if(l){continue}break}}if(!n){break O}if(!(!I[b|0]|l>>>0<4)){while(1){n=H[b>>2];if(((16843008-n|n)&-2139062144)!=-2139062144){break P}b=b+4|0;l=l-4|0;if(l>>>0>3){continue}break}}if(!l){break O}}while(1){if(!I[b|0]){break N}b=b+1|0;l=l-1|0;if(l){continue}break}}b=0}b=b?b-k|0:h;n=b+k|0;if((m|0)>=0){l=i;m=b;break h}l=i;m=b;if(I[n|0]){break d}break h}h=H[j+48>>2];if(h|H[j+52>>2]){break x}h=0;break i}if(m){i=H[j+48>>2];break w}h=0;Oa(a,32,p,0,l);break v}H[j+12>>2]=0;H[j+8>>2]=h;i=j+8|0;H[j+48>>2]=i;m=-1}h=0;while(1){R:{k=H[i>>2];if(!k){break R}k=Cc(j+4|0,k);if((k|0)<0){break b}if(k>>>0>m-h>>>0){break R}i=i+4|0;h=h+k|0;if(m>>>0>h>>>0){continue}}break}n=61;if((h|0)<0){break c}Oa(a,32,p,h,l);if(!h){h=0;break v}n=0;i=H[j+48>>2];while(1){k=H[i>>2];if(!k){break v}m=j+4|0;k=Cc(m,k);n=k+n|0;if(n>>>0>h>>>0){break v}Ma(a,m,k);i=i+4|0;if(h>>>0>n>>>0){continue}break}}Oa(a,32,p,h,l^8192);h=(h|0)<(p|0)?p:h;continue f}if((m|0)<0&u){break d}n=61;h=sa[f|0](a,M[j+48>>3],p,m,l,h)|0;if((h|0)>=0){continue f}break c}i=I[h+1|0];h=h+1|0;continue}}if(a){break a}if(!x){break g}h=1;while(1){a=H[(h<<2)+e>>2];if(a){Dc((h<<3)+d|0,a,c,g);o=1;h=h+1|0;if((h|0)!=10){continue}break a}break}if(h>>>0>=10){o=1;break a}while(1){if(H[(h<<2)+e>>2]){break j}o=1;h=h+1|0;if((h|0)!=10){continue}break}break a}n=28;break c}F[j+39|0]=h;m=1;k=z;l=i}i=n-k|0;m=(i|0)<(m|0)?m:i;if((m|0)>(q^2147483647)){break d}n=61;b=m+q|0;h=(b|0)<(p|0)?p:b;if((y|0)<(h|0)){break c}Oa(a,32,h,b,l);Ma(a,w,q);Oa(a,48,h,b,l^65536);Oa(a,48,m,i,0);Ma(a,k,i);Oa(a,32,h,b,l^8192);b=H[j+60>>2];continue}break}break}o=0;break a}n=61}H[6597]=n}o=-1}oa=j- -64|0;return o}function qd(a,b,c,d,e,f){a=a|0;b=+b;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,t=0,u=0,v=0,w=0,y=0,z=0,A=0;m=oa-560|0;oa=m;H[m+44>>2]=0;x(+b);h=s(1)|0;s(0)|0;a:{if((h|0)<0){u=1;z=1082;b=-b;x(+b);h=s(1)|0;s(0)|0;break a}if(e&2048){u=1;z=1085;break a}u=e&1;z=u?1088:1083;A=!u}b:{if((h&2146435072)==2146435072){h=u+3|0;Oa(a,32,c,h,e&-65537);Ma(a,z,u);d=f&32;Ma(a,b!=b?d?1207:1435:d?1312:1476,3);Oa(a,32,c,h,e^8192);n=(c|0)>(h|0)?c:h;break b}w=m+16|0;c:{d:{e:{b=Bc(b,m+44|0);b=b+b;if(b!=0){h=H[m+44>>2];H[m+44>>2]=h-1;y=f|32;if((y|0)!=97){break e}break c}y=f|32;if((y|0)==97){break c}l=H[m+44>>2];break d}l=h-29|0;H[m+44>>2]=l;b=b*268435456}k=(d|0)<0?6:d;r=(m+48|0)+((l|0)>=0?288:0)|0;h=r;while(1){d=b<4294967295&b>=0?~~b>>>0:0;H[h>>2]=d;h=h+4|0;b=(b-+(d>>>0))*1e9;if(b!=0){continue}break}f:{if((l|0)<=0){i=l;g=h;j=r;break f}j=r;i=l;while(1){o=i>>>0>=29?29:i;g=h-4|0;g:{if(j>>>0>g>>>0){break g}p=0;while(1){q=0;d=H[g>>2];i=o&31;n=p;if((o&63)>>>0>=32){p=d<>>32-i;d=d<>>0>i>>>0?q+1|0:q;p=Ke(i,q,1e9,0);n=Ie(p,ra,-1e9);d=q;q=i+n|0;H[g>>2]=q;g=g-4|0;if(j>>>0<=g>>>0){continue}break}if(!d&i>>>0<1e9){break g}j=j-4|0;H[j>>2]=p}while(1){g=h;if(j>>>0>>0){h=g-4|0;if(!H[h>>2]){continue}}break}i=H[m+44>>2]-o|0;H[m+44>>2]=i;h=g;if((i|0)>0){continue}break}}if((i|0)<0){v=((k+25>>>0)/9|0)+1|0;p=(y|0)==102;while(1){d=0-i|0;n=d>>>0>=9?9:d;h:{if(g>>>0<=j>>>0){h=H[j>>2]?0:4;break h}q=1e9>>>n|0;o=-1<>2];H[h>>2]=(d>>>n|0)+i;i=N(q,d&o);h=h+4|0;if(h>>>0>>0){continue}break}h=H[j>>2]?0:4;if(!i){break h}H[g>>2]=i;g=g+4|0}i=n+H[m+44>>2]|0;H[m+44>>2]=i;j=h+j|0;d=p?r:j;g=g-d>>2>(v|0)?d+(v<<2)|0:g;if((i|0)<0){continue}break}}i=0;i:{if(g>>>0<=j>>>0){break i}i=N(r-j>>2,9);h=10;d=H[j>>2];if(d>>>0<10){break i}while(1){i=i+1|0;h=N(h,10);if(d>>>0>=h>>>0){continue}break}}d=(k-((y|0)!=102?i:0)|0)-((y|0)==103&(k|0)!=0)|0;if((d|0)<(N(g-r>>2,9)-9|0)){h=(m+48|0)+((l|0)<0?-4092:-3804)|0;l=d+9216|0;d=(l|0)/9|0;n=h+(d<<2)|0;h=10;d=l+N(d,-9)|0;if((d|0)<=7){while(1){h=N(h,10);d=d+1|0;if((d|0)!=8){continue}break}}l=H[n>>2];v=(l>>>0)/(h>>>0)|0;o=N(v,h);d=n+4|0;j:{if((l|0)==(o|0)&(d|0)==(g|0)){break j}l=l-o|0;k:{if(!(v&1)){b=9007199254740992;if(!(F[n-4|0]&1)|((h|0)!=1e9|j>>>0>=n>>>0)){break k}}b=9007199254740994}t=(d|0)==(g|0)?1:1.5;d=h>>>1|0;t=d>>>0>l>>>0?.5:(d|0)==(l|0)?t:1.5;if(!(I[z|0]!=45|A)){t=-t;b=-b}H[n>>2]=o;if(b+t==b){break j}d=h+o|0;H[n>>2]=d;if(d>>>0>=1e9){while(1){H[n>>2]=0;n=n-4|0;if(n>>>0>>0){j=j-4|0;H[j>>2]=0}d=H[n>>2]+1|0;H[n>>2]=d;if(d>>>0>999999999){continue}break}}i=N(r-j>>2,9);h=10;d=H[j>>2];if(d>>>0<10){break j}while(1){i=i+1|0;h=N(h,10);if(d>>>0>=h>>>0){continue}break}}d=n+4|0;g=d>>>0>>0?d:g}while(1){l=g;o=g>>>0<=j>>>0;if(!o){g=g-4|0;if(!H[g>>2]){continue}}break}l:{if((y|0)!=103){p=e&8;break l}h=k?k:1;d=(h|0)>(i|0)&(i|0)>-5;k=(d?i^-1:-1)+h|0;f=(d?-1:-2)+f|0;p=e&8;if(p){break l}g=-9;m:{if(o){break m}o=H[l-4>>2];if(!o){break m}d=10;g=0;if((o>>>0)%10|0){break m}while(1){h=g;g=g+1|0;d=N(d,10);if(!((o>>>0)%(d>>>0)|0)){continue}break}g=h^-1}d=N(l-r>>2,9);if((f&-33)==70){p=0;d=(d+g|0)-9|0;d=(d|0)>0?d:0;k=(d|0)>(k|0)?k:d;break l}p=0;d=((d+i|0)+g|0)-9|0;d=(d|0)>0?d:0;k=(d|0)>(k|0)?k:d}n=-1;o=k|p;if(((o?2147483645:2147483646)|0)<(k|0)){break b}q=(((o|0)!=0)+k|0)+1|0;h=f&-33;n:{if((h|0)==70){if((q^2147483647)<(i|0)){break b}g=(i|0)>0?i:0;break n}d=i>>31;g=cb((d^i)-d|0,0,w);if((w-g|0)<=1){while(1){g=g-1|0;F[g|0]=48;if((w-g|0)<2){continue}break}}v=g-2|0;F[v|0]=f;F[g-1|0]=(i|0)<0?45:43;g=w-v|0;if((g|0)>(q^2147483647)){break b}}d=g+q|0;if((d|0)>(u^2147483647)){break b}i=d+u|0;Oa(a,32,c,i,e);Ma(a,z,u);Oa(a,48,c,i,e^65536);o:{p:{q:{if((h|0)==70){h=m+16|9;f=j>>>0>r>>>0?r:j;j=f;while(1){g=cb(H[j>>2],0,h);r:{if((f|0)!=(j|0)){if(m+16>>>0>=g>>>0){break r}while(1){g=g-1|0;F[g|0]=48;if(m+16>>>0>>0){continue}break}break r}if((g|0)!=(h|0)){break r}g=g-1|0;F[g|0]=48}Ma(a,g,h-g|0);j=j+4|0;if(r>>>0>=j>>>0){continue}break}if(o){Ma(a,1684,1)}if((k|0)<=0|j>>>0>=l>>>0){break q}while(1){g=cb(H[j>>2],0,h);if(g>>>0>m+16>>>0){while(1){g=g-1|0;F[g|0]=48;if(m+16>>>0>>0){continue}break}}Ma(a,g,(k|0)>=9?9:k);g=k-9|0;j=j+4|0;if(l>>>0<=j>>>0){break p}d=(k|0)>9;k=g;if(d){continue}break}break p}s:{if((k|0)<0){break s}f=j>>>0>>0?l:j+4|0;l=m+16|9;h=j;while(1){g=cb(H[h>>2],0,l);if((l|0)==(g|0)){g=g-1|0;F[g|0]=48}t:{if((h|0)!=(j|0)){if(m+16>>>0>=g>>>0){break t}while(1){g=g-1|0;F[g|0]=48;if(m+16>>>0>>0){continue}break}break t}Ma(a,g,1);g=g+1|0;if(!(k|p)){break t}Ma(a,1684,1)}d=l-g|0;Ma(a,g,(d|0)<(k|0)?d:k);k=k-d|0;h=h+4|0;if(f>>>0<=h>>>0){break s}if((k|0)>=0){continue}break}}Oa(a,48,k+18|0,18,0);Ma(a,v,w-v|0);break o}g=k}Oa(a,48,g+9|0,9,0)}Oa(a,32,c,i,e^8192);n=(c|0)>(i|0)?c:i;break b}k=(f<<26>>31&9)+z|0;u:{if(d>>>0>11){break u}g=12-d|0;t=16;while(1){t=t*16;g=g-1|0;if(g){continue}break}if(I[k|0]==45){b=-(t+(-b-t));break u}b=b+t-t}h=H[m+44>>2];g=h>>31;g=cb((g^h)-g|0,0,w);if((w|0)==(g|0)){g=g-1|0;F[g|0]=48;h=H[m+44>>2]}r=u|2;j=f&32;l=g-2|0;F[l|0]=f+15;F[g-1|0]=(h|0)<0?45:43;g=!(e&8)&(d|0)<=0;h=m+16|0;while(1){f=h;i=P(b)<2147483647?~~b:-2147483648;F[h|0]=j|I[i+25792|0];b=(b-+(i|0))*16;h=h+1|0;if(!(g&b==0|(h-(m+16|0)|0)!=1)){F[f+1|0]=46;h=f+2|0}if(b!=0){continue}break}n=-1;g=w-l|0;f=g+r|0;if((2147483645-f|0)<(d|0)){break b}i=f;f=m+16|0;j=h-f|0;d=d?(j-2|0)<(d|0)?d+2|0:j:j;h=i+d|0;Oa(a,32,c,h,e);Ma(a,k,r);Oa(a,48,c,h,e^65536);Ma(a,f,j);Oa(a,48,d-j|0,0,0);Ma(a,l,g);Oa(a,32,c,h,e^8192);n=(c|0)>(h|0)?c:h}oa=m+560|0;return n|0}function Zc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0;j=oa-80|0;oa=j;H[j+76>>2]=1;a:{b:{if(H[a+128>>2]!=1|H[a+132>>2]!=1|(H[a+108>>2]|H[a+112>>2])){break b}k=H[a+100>>2];if(H[k>>2]|H[k+4>>2]|(H[k+8>>2]!=H[a+116>>2]|H[k+12>>2]!=H[a+120>>2])){break b}if(!Za(a,j+72|0,0,j+68|0,j- -64|0,j+60|0,j+56|0,j+52|0,j+76|0,b,c)){break a}c:{d:{if(!H[j+76>>2]){break d}if(!gb(a,H[j+72>>2],0,0,b,c)){break d}b=H[a+100>>2];if(H[b+16>>2]){break c}d=1;break a}Ca(c,1,8776,0);break a}e=H[b+24>>2];while(1){b=N(g,52);Da(H[(b+e|0)+44>>2]);c=H[a+100>>2];e=H[c+24>>2];k=b+e|0;d=H[a+232>>2];n=H[H[H[d+20>>2]>>2]+20>>2]+N(g,76)|0;H[k+44>>2]=H[n+36>>2];H[k+36>>2]=H[(b+H[H[d+24>>2]+24>>2]|0)+36>>2];H[n+36>>2]=0;d=1;g=g+1|0;if(g>>>0>2]){continue}break}break a}H[a+80>>2]=0;H[a+84>>2]=0;Da(H[a+88>>2]);H[a+88>>2]=0;e:{if(!(H[a+28>>2]|H[a+32>>2]|H[a+36>>2]!=H[a+128>>2])){k=2;if(H[a+40>>2]==H[a+132>>2]){break e}}k=2;if(H[a+76>>2]){break e}if(!Fb(b)){break e}r=H[a+128>>2];k=N(r,H[a+132>>2]);if(k){i=k&1;h=H[H[a+224>>2]+40>>2];f:{if((k|0)==1){k=0;break f}l=k&-2;k=0;while(1){d=h+N(g,40)|0;f=H[d+4>>2];if(f){m=(H[d+16>>2]+N(f,24)|0)-8|0;f=H[m>>2];o=f;p=f>>>0>k>>>0;f=H[m+4>>2];m=p&(f|0)>=(n|0)|(f|0)>(n|0);k=m?o:k;n=m?f:n}f=H[d+44>>2];if(f){f=(H[d+56>>2]+N(f,24)|0)-8|0;d=H[f>>2];o=d;m=d>>>0>k>>>0;d=H[f+4>>2];f=m&(d|0)>=(n|0)|(d|0)>(n|0);k=f?o:k;n=f?d:n}g=g+2|0;e=e+2|0;if((l|0)!=(e|0)){continue}break}}g:{if(!i){break g}d=h+N(g,40)|0;h=H[d+4>>2];if(!h){break g}h=(H[d+16>>2]+N(h,24)|0)-8|0;d=H[h>>2];f=d;g=d>>>0>k>>>0;d=H[h+4>>2];h=g&(d|0)>=(n|0)|(d|0)>(n|0);k=h?f:k;n=h?d:n}k=k+2|0;n=k>>>0<2?n+1|0:n}else{k=2;n=0}g=0;f=H[a+32>>2];q=H[a+40>>2];h:{if(f>>>0>=q>>>0){break h}h=H[a+28>>2];i=H[a+36>>2];if(h>>>0>=i>>>0){break h}l=i-h&3;t=H[H[a+224>>2]+40>>2];u=h-i>>>0>4294967292;while(1){m=t+N(N(f,r),40)|0;d=h;e=0;if(l){while(1){g=H[(m+N(d,40)|0)+4>>2]+g|0;d=d+1|0;e=e+1|0;if((l|0)!=(e|0)){continue}break}}if(!u){while(1){e=m+N(d,40)|0;g=H[e+124>>2]+(H[e+84>>2]+(H[e+44>>2]+(H[e+4>>2]+g|0)|0)|0)|0;d=d+4|0;if((i|0)!=(d|0)){continue}break}}f=f+1|0;if((q|0)!=(f|0)){continue}break}}f=Ga(g<<3);H[a+88>>2]=f;if(!g|!f){break e}g=0;d=H[a+40>>2];i=H[a+32>>2];i:{if(d>>>0<=i>>>0){break i}e=H[a+36>>2];if(e>>>0<=K[a+28>>2]){break i}while(1){l=H[a+28>>2];if(l>>>0>>0){t=H[H[a+224>>2]+40>>2]+N(N(H[a+128>>2],i),40)|0;while(1){h=t+N(l,40)|0;d=H[h+4>>2];if(d){r=d&3;h=H[h+16>>2];q=0;j:{if(d>>>0<4){d=0;break j}u=h+72|0;v=h+48|0;w=h+24|0;x=d&-4;d=0;f=0;while(1){m=N(d,24);p=m+h|0;s=H[p+4>>2];e=g<<3;o=e+H[a+88>>2]|0;H[o>>2]=H[p>>2];H[o+4>>2]=s;p=m+w|0;s=H[p+4>>2];o=e+H[a+88>>2]|0;H[o+8>>2]=H[p>>2];H[o+12>>2]=s;p=m+v|0;s=H[p+4>>2];o=e+H[a+88>>2]|0;H[o+16>>2]=H[p>>2];H[o+20>>2]=s;m=m+u|0;o=H[m+4>>2];e=e+H[a+88>>2]|0;H[e+24>>2]=H[m>>2];H[e+28>>2]=o;d=d+4|0;g=g+4|0;f=f+4|0;if((x|0)!=(f|0)){continue}break}}if(r){while(1){f=h+N(d,24)|0;m=H[f+4>>2];e=H[a+88>>2]+(g<<3)|0;H[e>>2]=H[f>>2];H[e+4>>2]=m;d=d+1|0;g=g+1|0;q=q+1|0;if((r|0)!=(q|0)){continue}break}}e=H[a+36>>2]}l=l+1|0;if(l>>>0>>0){continue}break}d=H[a+40>>2]}i=i+1|0;if(i>>>0>>0){continue}break}f=H[a+88>>2]}H[a+84>>2]=g;e=oa-208|0;oa=e;H[e+8>>2]=1;H[e+12>>2]=0;l=g<<3;k:{if(!l){break k}H[e+16>>2]=8;H[e+20>>2]=8;d=8;g=8;i=2;while(1){h=d;d=(g+8|0)+d|0;H[(e+16|0)+(i<<2)>>2]=d;i=i+1|0;g=h;if(d>>>0>>0){continue}break}h=(f+l|0)-8|0;l:{if(h>>>0<=f>>>0){g=0;i=1;d=1;h=0;break l}i=1;d=1;while(1){m:{if((i&3)==3){Gb(f,d,e+16|0);xb(e+8|0,2);d=d+2|0;break m}l=e+16|0;g=d-1|0;n:{if(K[l+(g<<2)>>2]>=h-f>>>0){wb(f,i,H[e+12>>2],d,0,l);break n}Gb(f,d,e+16|0)}if((d|0)==1){vb(e+8|0,1);d=0;break m}vb(e+8|0,g);d=1}i=H[e+8>>2]|1;H[e+8>>2]=i;f=f+8|0;if(h>>>0>f>>>0){continue}break}g=H[e+12>>2];h=(g|0)!=0}wb(f,i,g,d,0,e+16|0);i=H[e+8>>2];if(!(h|((d|0)!=1|(i|0)!=1))){break k}while(1){o:{if((d|0)<=1){h=Jc(i,g);xb(e+8|0,h);d=d+h|0;break o}g=e+8|0;vb(g,2);H[e+8>>2]=H[e+8>>2]^7;xb(g,1);l=f-8|0;i=e+16|0;h=d-2|0;wb(l-H[i+(h<<2)>>2]|0,H[e+8>>2],H[e+12>>2],d-1|0,1,i);vb(g,1);d=H[e+8>>2]|1;H[e+8>>2]=d;wb(l,d,H[e+12>>2],h,1,i);d=h}f=f-8|0;g=H[e+12>>2];i=H[e+8>>2];if(g|((d|0)!=1|(i|0)!=1)){continue}break}}oa=e+208|0}d=H[a+128>>2];e=0;p:{while(1){q:{if(!(!H[H[a+180>>2]+5596>>2]|((d|0)!=1|H[a+132>>2]!=1))){H[j+72>>2]=0;H[a+228>>2]=0;H[a+8>>2]=H[a+8>>2]|128;d=0;break q}d=0;if(!Za(a,j+72|0,0,j+68|0,j- -64|0,j+60|0,j+56|0,j+52|0,j+76|0,b,c)){break a}if(!H[j+76>>2]){break p}d=H[j+72>>2]}h=d+1|0;f=gb(a,d,0,0,b,c);g=N(H[a+128>>2],H[a+132>>2]);if(!f){H[j+4>>2]=g;H[j>>2]=h;Ca(c,1,7537,j);d=0;break a}H[j+36>>2]=g;H[j+32>>2]=h;Ca(c,4,11795,j+32|0);if(!Sc(H[a+232>>2],H[H[a+100>>2]+24>>2])){d=0;break a}r:{if(!(H[a+128>>2]!=1|H[a+132>>2]!=1)){g=H[a+100>>2];f=H[a+96>>2];if(H[g>>2]!=H[f>>2]|H[g+4>>2]!=H[f+4>>2]|(H[g+8>>2]!=H[f+8>>2]|H[g+12>>2]!=H[f+12>>2])){break r}}d=H[a+180>>2]+N(d,5644)|0;g=H[d+5596>>2];if(!g){break r}Da(g);H[d+5596>>2]=0;H[d+5600>>2]=0}H[j+16>>2]=h;Ca(c,4,16601,j+16|0);if(!(Sa(b)|ra)&H[a+8>>2]==64){break p}e=e+1|0;d=H[a+128>>2];if((e|0)==(N(d,H[a+132>>2])|0)){break p}h=H[a+84>>2];if(!h|(h|0)!=H[a+80>>2]){continue}break}zc(b,k,n,c)}d=Rc(a,c)}oa=j+80|0;return d|0}function $a(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;d=H[a+32>>2];a:{if(d){break a}b:{h=H[a+16>>2];if((h|0)>=6){b=H[a+8>>2];f=H[a+12>>2];d=h;break b}b=H[a+20>>2];c:{d:{if((b|0)>=5){c=H[a>>2];d=H[c>>2];H[a>>2]=c+4;g=b-4|0;break d}if((b|0)<=0){d=-1;break c}c=H[a>>2];e:{if((b|0)==1){e=-1;b=0;break e}e=-1;f=b-1|0;k=f&1;f:{if((b|0)==2){d=0;i=b;break f}j=f&-2;d=0;f=c;i=b;while(1){H[a>>2]=f+1;l=I[f|0];c=f+2|0;H[a>>2]=c;H[a+20>>2]=i-1;f=I[f+1|0];i=i-2|0;H[a+20>>2]=i;e=((255<>2]=f;c=I[c|0];H[a+20>>2]=i-1;e=(255<>2]=c+1;d=(255<>2]=g}b=H[a+24>>2];c=d>>>24|0;H[a+24>>2]=(c|0)==255;g=d>>>16&255;k=(g|0)==255;f=d&255;e=(f|0)==255;j=b+e|0;b=d>>>8&255;i=(b|0)==255;j=k+(j+i|0)|0;d=(h-j|0)+32|0;H[a+16>>2]=d;l=H[a+12>>2];b=c|(g|(b|f<<(e?7:8))<<(i?7:8))<<(k?7:8);f=(j-h|0)+32|0;c=f&31;if((f&63)>>>0>=32){i=b<>>32-c;g=b<>2];c=i|l;f=c;H[a+8>>2]=b;H[a+12>>2]=c;if((d|0)>=6){break b}d=0;break a}e=H[a+28>>2];i=H[(e<<2)+20752>>2];g:{if((f|0)<0){d=d-1|0;c=(-1<=11?11:e)+1|0;break g}g=b;h=63-i|0;c=h&31;if((h&63)>>>0>=32){g=f>>>c|0}else{g=((1<>>c}c=(g&(-1<>2]=d;H[a+28>>2]=e;g=b;h=i&31;if((i&63)>>>0>=32){b=b<>>32-h|f<>2]=g;H[a+12>>2]=b;i=H[a+44>>2]|c>>31;j=H[a+40>>2]&-64|c;H[a+40>>2]=j;H[a+44>>2]=i;if((d|0)<6){d=1;break a}b=H[(e<<2)+20752>>2];h:{if((f|0)<0){d=d-1|0;c=(-1<=11?11:e)+1|0;break h}k=g;h=63-b|0;c=h&31;if((h&63)>>>0>=32){k=f>>>c|0}else{k=((1<>>c}c=(k&(-1<>2]=d;H[a+28>>2]=e;k=g;h=b&31;if((b&63)>>>0>=32){b=g<>>32-h|f<>2]=k;H[a+12>>2]=b;b=c>>31<<7|c>>>25|i;h=b;j=j&-8065|c<<7;H[a+40>>2]=j;H[a+44>>2]=b;if((d|0)<6){d=2;break a}b=H[(e<<2)+20752>>2];i:{if((f|0)<0){d=d-1|0;c=(-1<=11?11:e)+1|0;break i}g=k;i=63-b|0;c=i&31;if((i&63)>>>0>=32){g=f>>>c|0}else{g=((1<>>c}c=(g&(-1<>2]=d;H[a+28>>2]=e;l=k;g=b&31;if((b&63)>>>0>=32){i=k<>>32-g|f<>2]=g;f=i;H[a+12>>2]=f;b=c>>31<<14|c>>>18|h;i=b;k=j&-1032193|c<<14;H[a+40>>2]=k;H[a+44>>2]=b;if((d|0)<6){d=3;break a}b=H[(e<<2)+20752>>2];j:{if((f|0)<0){d=d-1|0;c=(-1<=11?11:e)+1|0;break j}j=g;h=63-b|0;c=h&31;if((h&63)>>>0>=32){j=f>>>c|0}else{j=((1<>>c}c=(j&(-1<>2]=d;H[a+28>>2]=e;j=g;h=b&31;if((b&63)>>>0>=32){b=g<>>32-h|f<>2]=g;H[a+12>>2]=b;b=c>>31<<21|c>>>11|i;j=b;k=k&-132120577|c<<21;H[a+40>>2]=k;H[a+44>>2]=b;if((d|0)<6){d=4;break a}b=H[(e<<2)+20752>>2];k:{if((f|0)<0){c=(-1<=11?11:e)+1|0;d=d-1|0;break k}h=g;i=63-b|0;c=i&31;if((i&63)>>>0>=32){i=f>>>c|0}else{i=((1<>>c}c=(i&(-1<>2]=d;H[a+28>>2]=h;i=g;e=b&31;if((b&63)>>>0>=32){b=g<>>32-e|f<>2]=g;f=b;H[a+12>>2]=b;b=j&-4|(c>>31<<28|c>>>4);j=b;k=k&268435455|c<<28;H[a+40>>2]=k;H[a+44>>2]=b;if((d|0)<6){d=5;break a}b=H[(h<<2)+20752>>2];l:{if((f|0)<0){e=(-1<=11?11:h)+1|0;i=d-1|0;break l}i=g;e=63-b|0;c=e&31;if((e&63)>>>0>=32){i=f>>>c|0}else{i=((1<>>c}e=(i&(-1<>2]=i;H[a+28>>2]=h;d=g;c=b&31;if((b&63)>>>0>=32){b=d<>>32-c|f<>2]=g;H[a+12>>2]=b;b=j&-505|e<<3;l=b;H[a+40>>2]=k;H[a+44>>2]=b;d=6;if((i|0)<6){break a}b=H[(h<<2)+20752>>2];m:{if((c|0)<0){e=(-1<=11?11:h)+1|0;d=i-1|0;break m}d=g;e=63-b|0;f=e&31;if((e&63)>>>0>=32){f=c>>>f|0}else{f=((1<>>f}e=(f&(-1<>2]=d;H[a+28>>2]=h;j=g;f=b&31;if((b&63)>>>0>=32){i=g<>>32-f|c<>2]=g;f=i;H[a+12>>2]=f;i=k;b=l&-64513|e<<10;k=b;H[a+40>>2]=i;H[a+44>>2]=b;if((d|0)<6){d=7;break a}b=H[(h<<2)+20752>>2];n:{if((f|0)<0){d=d-1|0;c=(-1<=11?11:h)+1|0;break n}j=g;e=63-b|0;c=e&31;if((e&63)>>>0>=32){j=f>>>c|0}else{j=((1<>>c}c=(j&(-1<>2]=d;H[a+28>>2]=e;d=g;e=b&31;if((b&63)>>>0>=32){b=d<>>32-e|f<>2]=g;H[a+12>>2]=b;H[a+40>>2]=i;H[a+44>>2]=k&-8257537|c<<17;d=8}H[a+32>>2]=d-1;f=H[a+44>>2];b=f>>>7|0;c=H[a+40>>2];H[a+40>>2]=(f&127)<<25|c>>>7;H[a+44>>2]=b;return c&127}function ec(a,b,c,d,e,f,g,h,i){var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,z=0,A=0;p=oa-32|0;oa=p;H[p+24>>2]=f;r=H[(N(H[d+28>>2],76)+b|0)+28>>2]+N(H[d+32>>2],152)|0;a:{if(!(H[d+40>>2]|!H[r+24>>2])){k=r+28|0;while(1){b:{if(ac(k)){break b}b=H[d+36>>2];if(b>>>0>=K[k+24>>2]/40>>>0){Ca(i,1,2836,0);break a}b=H[k+20>>2]+N(b,40)|0;rc(H[b+32>>2]);rc(H[b+36>>2]);o=N(H[b+20>>2],H[b+16>>2]);if(!o){break b}b=H[b+24>>2];if(o>>>0>=8){q=o&-8;j=0;while(1){H[b+516>>2]=0;H[b+520>>2]=0;H[b+448>>2]=0;H[b+452>>2]=0;H[b+380>>2]=0;H[b+384>>2]=0;H[b+312>>2]=0;H[b+316>>2]=0;H[b+244>>2]=0;H[b+248>>2]=0;H[b+176>>2]=0;H[b+180>>2]=0;H[b+108>>2]=0;H[b+112>>2]=0;H[b+40>>2]=0;H[b+44>>2]=0;b=b+544|0;j=j+8|0;if((q|0)!=(j|0)){continue}break}}j=0;o=o&7;if(!o){break b}while(1){H[b+40>>2]=0;H[b+44>>2]=0;b=b+68|0;j=j+1|0;if((o|0)!=(j|0)){continue}break}}k=k+36|0;n=n+1|0;if(n>>>0>2]){continue}break}}q=f;c:{if(!(I[c|0]&2)){break c}if(h>>>0<=5){Ca(i,2,4196,0);break c}if(!(I[f|0]==255&I[f+1|0]==145)){Ca(i,2,4238,0);break c}q=f+6|0;H[p+24>>2]=q}l=Ga(20);if(!l){break a}d:{if(F[a+108|0]&1){q=H[a+40>>2];o=a+44|0;h=a+40|0;break d}if(I[c+5640|0]&2){q=H[c+5168>>2];o=c+5180|0;h=c+5168|0;break d}H[p+28>>2]=(f+h|0)-q;o=p+28|0;h=p+24|0}a=H[o>>2];H[l+12>>2]=0;H[l+16>>2]=0;H[l+8>>2]=q;H[l>>2]=q;H[l+4>>2]=a+q;if(!Ta(l,1)){tc(l);a=uc(l);hb(l);a=a+q|0;b=H[h>>2];d=H[o>>2];if(I[c|0]&4){if(b+(d-a|0)>>>0<=1){Ca(i,1,4422,0);break a}if(!(I[a|0]==255&I[a+1|0]==146)){Ca(i,1,4401,0);break a}a=a+2|0}a=a-b|0;H[o>>2]=d-a;H[h>>2]=a+b;H[e>>2]=0;H[g>>2]=H[p+24>>2]-f;x=1;break a}if(H[r+24>>2]){t=r+28|0;while(1){a=H[d+36>>2];b=H[t+20>>2];e:{if(ac(t)){break e}u=b+N(a,40)|0;z=N(H[u+20>>2],H[u+16>>2]);if(!z){break e}k=H[u+24>>2];v=0;while(1){f:{g:{if(!H[k+40>>2]){a=pc(l,H[u+32>>2],v,H[d+40>>2]+1|0);break g}a=Ta(l,1)}if(!a){H[k+36>>2]=0;break f}if(!H[k+40>>2]){b=0;while(1){a=b;b=b+1|0;if(!pc(l,H[u+36>>2],v,a)){continue}break}b=H[t+28>>2];H[k+32>>2]=3;H[k+24>>2]=b;H[k+28>>2]=(b-a|0)+1}a=1;h:{if(!Ta(l,1)){break h}a=2;if(!Ta(l,1)){break h}a=Ta(l,2);if((a|0)!=3){a=a+3|0;break h}a=Ta(l,5);if((a|0)!=31){a=a+6|0;break h}a=Ta(l,7)+37|0}H[k+36>>2]=a;b=0;while(1){a=b;b=b+1|0;if(Ta(l,1)){continue}break}H[k+32>>2]=a+H[k+32>>2];i:{a=H[k+40>>2];j:{k:{if(!a){a=H[(H[c+5584>>2]+N(H[d+28>>2],1080)|0)+16>>2];if(!H[k+48>>2]){b=Ia(H[k>>2],240);if(!b){break i}H[k>>2]=b;y(b+N(H[k+48>>2],24)|0,0,240);H[k+48>>2]=10}j=H[k>>2];nb(j);b=a&4?1:a&1?10:109;a=0;break k}b=H[k>>2];n=a-1|0;j=b+N(n,24)|0;if(H[j+4>>2]!=H[j+12>>2]){break j}n=H[(H[c+5584>>2]+N(H[d+28>>2],1080)|0)+16>>2];j=H[k+48>>2];if(j>>>0>>0){j=j+10|0;b=Ia(b,N(j,24));if(!b){break i}H[k>>2]=b;y(b+N(H[k+48>>2],24)|0,0,240);H[k+48>>2]=j;b=H[k>>2]}j=N(a,24)+b|0;nb(j);b=1;l:{if(n&4){break l}b=109;if(!(n&1)){break l}b=H[j-12>>2];b=(b|0)==1?2:(b|0)==10?2:1}}n=a;H[j+12>>2]=b}a=H[k+36>>2];if(I[(H[c+5584>>2]+N(H[d+28>>2],1080)|0)+16|0]&64){while(1){m=N(n,24);s=n?a:1;H[(m+H[k>>2]|0)+16>>2]=s;w=H[k+32>>2];j=0;b=a;if(s>>>0>=2){while(1){j=j+1|0;s=b>>>0>3;b=b>>>1|0;if(s){continue}break}}b=j+w|0;if(b>>>0>=33){H[p+16>>2]=b;Ca(i,1,15535,p+16|0);break i}j=Ta(l,b);b=H[k>>2];m=m+b|0;H[m+20>>2]=j;a=a-H[m+16>>2]|0;if((a|0)<=0){break f}j=H[(H[c+5584>>2]+N(H[d+28>>2],1080)|0)+16>>2];m=H[k+48>>2];if(m>>>0>>0){m=m+10|0;b=Ia(b,N(m,24));if(!b){break i}H[k>>2]=b;y(b+N(H[k+48>>2],24)|0,0,240);H[k+48>>2]=m;b=H[k>>2]}n=n+1|0;b=b+N(n,24)|0;nb(b);if(j&4){H[b+12>>2]=1;continue}if(j&1){j=b;b=H[b-12>>2];H[j+12>>2]=(b|0)==1?2:(b|0)==10?2:1}else{H[b+12>>2]=109}continue}}while(1){m=N(n,24);j=m+H[k>>2]|0;b=H[j+12>>2]-H[j+4>>2]|0;b=(a|0)>(b|0)?b:a;H[j+16>>2]=b;s=H[k+32>>2];j=0;if(b>>>0>=2){while(1){j=j+1|0;w=b>>>0>3;b=b>>>1|0;if(w){continue}break}}b=j+s|0;if(b>>>0>=33){H[p>>2]=b;Ca(i,1,15535,p);break i}j=Ta(l,b);b=H[k>>2];m=m+b|0;H[m+20>>2]=j;a=a-H[m+16>>2]|0;if((a|0)<=0){break f}j=H[(H[c+5584>>2]+N(H[d+28>>2],1080)|0)+16>>2];m=H[k+48>>2];if(m>>>0>>0){m=m+10|0;b=Ia(b,N(m,24));if(!b){break i}H[k>>2]=b;y(b+N(H[k+48>>2],24)|0,0,240);H[k+48>>2]=m;b=H[k>>2]}n=n+1|0;b=b+N(n,24)|0;nb(b);if(j&4){H[b+12>>2]=1;continue}if(j&1){j=b;b=H[b-12>>2];H[j+12>>2]=(b|0)==1?2:(b|0)==10?2:1}else{H[b+12>>2]=109}continue}}hb(l);break a}k=k+68|0;v=v+1|0;if((z|0)!=(v|0)){continue}break}}t=t+36|0;A=A+1|0;if(A>>>0>2]){continue}break}}if(!tc(l)){hb(l);break a}a=uc(l);hb(l);b=a+q|0;a=H[h>>2];if(I[c|0]&4){if(a+(H[o>>2]-b|0)>>>0<=1){Ca(i,1,4422,0);break a}if(!(I[b|0]==255&I[b+1|0]==146)){Ca(i,1,4401,0);break a}b=b+2|0}if((a|0)==(b|0)){break a}H[o>>2]=H[o>>2]+(a-b|0);H[h>>2]=b;x=1;H[e>>2]=1;H[g>>2]=H[p+24>>2]-f}oa=p+32|0;return x}function Eb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;o=N(c,5);j=(c<<2)+b|0;e=H[a>>2];f=H[a+12>>2]<<5;h=e+f|0;l=e-f|0;e=H[a+16>>2];k=H[a+28>>2];i=H[a+20>>2];q=H[a+8>>2];a:{b:{if(h&15|(b&15|d>>>0<8)){if(e>>>0>=i>>>0){break a}c:{switch(d-1|0){case 1:f=e+1|0;if(i-e&1){g=h+(e<<6)|0;e=(e<<2)+b|0;L[g>>2]=L[e>>2];L[g+4>>2]=L[e+(c<<2)>>2];e=f}if((f|0)==(i|0)){break a}while(1){f=h+(e<<6)|0;g=(e<<2)+b|0;L[f>>2]=L[g>>2];r=f;f=c<<2;L[r+4>>2]=L[f+g>>2];g=e+1|0;j=h+(g<<6)|0;g=(g<<2)+b|0;L[j>>2]=L[g>>2];L[j+4>>2]=L[f+g>>2];e=e+2|0;if((i|0)!=(e|0)){continue}break};break a;case 0:break c;default:break b}}f=e;j=i-e&3;if(j){while(1){L[h+(f<<6)>>2]=L[(f<<2)+b>>2];f=f+1|0;g=g+1|0;if((j|0)!=(g|0)){continue}break}}if(e-i>>>0>4294967292){break a}while(1){L[h+(f<<6)>>2]=L[(f<<2)+b>>2];e=f+1|0;L[h+(e<<6)>>2]=L[(e<<2)+b>>2];e=f+2|0;L[h+(e<<6)>>2]=L[(e<<2)+b>>2];e=f+3|0;L[h+(e<<6)>>2]=L[(e<<2)+b>>2];f=f+4|0;if((i|0)!=(f|0)){continue}break}break a}if(e>>>0>=i>>>0){break a}n=c<<4;m=N(c,12);s=c<<3;while(1){f=h+(e<<6)|0;g=(e<<2)+b|0;L[f>>2]=L[g>>2];p=c<<2;L[f+4>>2]=L[p+g>>2];L[f+8>>2]=L[g+s>>2];L[f+12>>2]=L[g+m>>2];L[f+16>>2]=L[g+n>>2];g=e+o<<2;L[f+20>>2]=L[g+b>>2];g=g+j|0;L[f+24>>2]=L[g>>2];L[f+28>>2]=L[g+p>>2];e=e+1|0;if((i|0)!=(e|0)){continue}break}break a}n=c<<4;m=N(c,12);s=c<<3;p=(d|0)==5;r=(d|0)==7;while(1){f=h+(e<<6)|0;g=(e<<2)+b|0;L[f>>2]=L[g>>2];t=c<<2;L[f+4>>2]=L[g+t>>2];L[f+8>>2]=L[g+s>>2];d:{if((d|0)==3){break d}L[f+12>>2]=L[g+m>>2];if((d|0)==4){break d}L[f+16>>2]=L[g+n>>2];if(p){break d}g=e+o<<2;L[f+20>>2]=L[g+b>>2];if((d|0)==6){break d}g=g+j|0;L[f+24>>2]=L[g>>2];if(r){break d}L[f+28>>2]=L[g+t>>2]}e=e+1|0;if((i|0)!=(e|0)){continue}break}}b=(q<<2)+b|0;i=b+(c<<2)|0;e=H[a+24>>2];h=l+32|0;e:{if(h&15|(b&15|d>>>0<8)){if(e>>>0>=k>>>0){break e}f:{switch(d-1|0){case 1:a=e+1|0;if(k-e&1){d=h+(e<<6)|0;e=b+(e<<2)|0;L[d>>2]=L[e>>2];L[d+4>>2]=L[e+(c<<2)>>2];e=a}if((a|0)==(k|0)){break e}while(1){a=h+(e<<6)|0;d=b+(e<<2)|0;L[a>>2]=L[d>>2];f=a;a=c<<2;L[f+4>>2]=L[a+d>>2];d=e+1|0;f=h+(d<<6)|0;d=b+(d<<2)|0;L[f>>2]=L[d>>2];L[f+4>>2]=L[a+d>>2];e=e+2|0;if((k|0)!=(e|0)){continue}break};break e;case 0:f=e;a=k-e&3;if(a){g=0;while(1){L[h+(f<<6)>>2]=L[b+(f<<2)>>2];f=f+1|0;g=g+1|0;if((a|0)!=(g|0)){continue}break}}if(e-k>>>0>4294967292){break e}while(1){L[h+(f<<6)>>2]=L[b+(f<<2)>>2];a=f+1|0;L[h+(a<<6)>>2]=L[b+(a<<2)>>2];a=f+2|0;L[h+(a<<6)>>2]=L[b+(a<<2)>>2];a=f+3|0;L[h+(a<<6)>>2]=L[b+(a<<2)>>2];f=f+4|0;if((k|0)!=(f|0)){continue}break};break e;default:break f}}g=c<<4;j=N(c,12);l=c<<3;q=(d|0)==5;n=(d|0)==7;while(1){a=h+(e<<6)|0;f=b+(e<<2)|0;L[a>>2]=L[f>>2];m=c<<2;L[a+4>>2]=L[m+f>>2];L[a+8>>2]=L[f+l>>2];g:{if((d|0)==3){break g}L[a+12>>2]=L[f+j>>2];if((d|0)==4){break g}L[a+16>>2]=L[f+g>>2];if(q){break g}f=e+o<<2;L[a+20>>2]=L[f+b>>2];if((d|0)==6){break g}f=f+i|0;L[a+24>>2]=L[f>>2];if(n){break g}L[a+28>>2]=L[f+m>>2]}e=e+1|0;if((k|0)!=(e|0)){continue}break}break e}if(e>>>0>=k>>>0){break e}f=c<<4;g=N(c,12);j=c<<3;while(1){a=h+(e<<6)|0;d=b+(e<<2)|0;L[a>>2]=L[d>>2];l=c<<2;L[a+4>>2]=L[l+d>>2];L[a+8>>2]=L[d+j>>2];L[a+12>>2]=L[d+g>>2];L[a+16>>2]=L[d+f>>2];d=e+o<<2;L[a+20>>2]=L[d+b>>2];d=d+i|0;L[a+24>>2]=L[d>>2];L[a+28>>2]=L[d+l>>2];e=e+1|0;if((k|0)!=(e|0)){continue}break}}}function Tb(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;d=oa-176|0;oa=d;a:{if(b&384){Pa(5943,11,c);break a}b:{if(!(b&1)){break b}e=H[a+96>>2];if(!e){break b}f=oa-80|0;oa=f;Pa(1792,13,c);F[f+79|0]=0;F[f+78|0]=9;g=H[e+4>>2];H[f+68>>2]=H[e>>2];H[f+72>>2]=g;j=f+78|0;H[f+64>>2]=j;Ha(c,7520,f- -64|0);g=H[e+12>>2];H[f+52>>2]=H[e+8>>2];H[f+56>>2]=g;H[f+48>>2]=j;Ha(c,7503,f+48|0);H[f+36>>2]=H[e+16>>2];H[f+32>>2]=j;Ha(c,7277,f+32|0);if(!(!H[e+24>>2]|!H[e+16>>2])){while(1){l=f+78|0;H[f+16>>2]=l;H[f+20>>2]=m;Ha(c,1824,f+16|0);j=H[e+24>>2];g=oa-48|0;oa=g;F[g+46|0]=9;F[g+47|0]=0;F[g+45|0]=9;n=N(m,52)+j|0;j=H[n+4>>2];H[g+36>>2]=H[n>>2];H[g+40>>2]=j;j=g+45|0;H[g+32>>2]=j;Ha(c,7209,g+32|0);H[g+20>>2]=H[n+24>>2];H[g+16>>2]=j;Ha(c,7455,g+16|0);H[g+4>>2]=H[n+32>>2];H[g>>2]=j;Ha(c,7428,g);oa=g+48|0;H[f>>2]=l;Ha(c,1702,f);m=m+1|0;if(m>>>0>2]){continue}break}}Pa(1710,2,c);oa=f+80|0}if(!(!(b&2)|!H[a+96>>2])){Pa(1931,36,c);e=H[a+112>>2];H[d+160>>2]=H[a+108>>2];H[d+164>>2]=e;Ha(c,2425,d+160|0);e=H[a+120>>2];H[d+144>>2]=H[a+116>>2];H[d+148>>2]=e;Ha(c,2391,d+144|0);e=H[a+132>>2];H[d+128>>2]=H[a+128>>2];H[d+132>>2]=e;Ha(c,2409,d+128|0);Sb(H[a+12>>2],H[H[a+96>>2]+16>>2],c);Pa(1710,2,c)}c:{if(!(b&8)|!H[a+96>>2]){break c}e=N(H[a+128>>2],H[a+132>>2]);if(!e){break c}h=H[a+180>>2];while(1){Sb(h,H[H[a+96>>2]+16>>2],c);h=h+5644|0;k=k+1|0;if((e|0)!=(k|0)){continue}break}}if(!(b&16)){break a}i=H[a+224>>2];Pa(1893,37,c);e=H[i>>2];b=H[i+4>>2];a=H[i+12>>2];H[d+120>>2]=H[i+8>>2];H[d+124>>2]=a;H[d+112>>2]=e;H[d+116>>2]=b;Ha(c,5730,d+112|0);Pa(1875,17,c);if(!(!H[i+28>>2]|!H[i+24>>2])){h=0;while(1){a=H[i+28>>2]+N(h,24)|0;g=J[a>>1];e=H[a+8>>2];b=H[a+12>>2];H[d+96>>2]=H[a+16>>2];H[d+88>>2]=e;H[d+92>>2]=b;H[d+80>>2]=g;Ha(c,7397,d+80|0);h=h+1|0;if(h>>>0>2]){continue}break}}Pa(1708,4,c);j=H[i+40>>2];d:{if(!j){break d}g=H[i+36>>2];if(!g){break d}k=0;h=0;while(1){a=j+N(h,40)|0;e=H[a+4>>2];e:{if(!e){break e}l=H[a+16>>2];if(!l){break e}b=H[l>>2];a=H[l+4>>2];if((a|0)<0){a=1}else{a=!b&(a|0)<=0}if(a|(H[l+8>>2]|H[l+12>>2])){break e}if(Kc(1439)){break d}}k=e+k|0;h=h+1|0;if((g|0)!=(h|0)){continue}break}if(!k){break d}Pa(1858,16,c);if(H[i+36>>2]){k=H[i+40>>2];n=0;while(1){f=N(n,40);l=H[(f+k|0)+4>>2];H[d+68>>2]=l;H[d+64>>2]=n;Ha(c,7467,d- -64|0);k=H[i+40>>2];f:{if(!l){break f}h=0;if(!H[(f+k|0)+16>>2]){break f}while(1){m=H[(f+H[i+40>>2]|0)+16>>2]+N(h,24)|0;j=H[m>>2];g=H[m+4>>2];e=H[m+8>>2];b=H[m+12>>2];a=H[m+20>>2];H[d+56>>2]=H[m+16>>2];H[d+60>>2]=a;H[d+48>>2]=e;H[d+52>>2]=b;H[d+40>>2]=j;H[d+44>>2]=g;H[d+32>>2]=h;Ha(c,10938,d+32|0);h=h+1|0;if((l|0)!=(h|0)){continue}break}k=H[i+40>>2]}a=f+k|0;g:{if(!H[a+24>>2]){break g}h=0;if(!H[a+20>>2]){break g}while(1){a=H[(f+k|0)+24>>2]+N(h,24)|0;g=J[a>>1];e=H[a+8>>2];b=H[a+12>>2];H[d+16>>2]=H[a+16>>2];H[d+8>>2]=e;H[d+12>>2]=b;H[d>>2]=g;Ha(c,7397,d);h=h+1|0;k=H[i+40>>2];if(h>>>0>2]){continue}break}}n=n+1|0;if(n>>>0>2]){continue}break}}Pa(1708,4,c)}Pa(1710,2,c)}oa=d+176|0}function De(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=oa-128|0;oa=e;H[e+120>>2]=0;a:{if((c|0)!=8){Ca(d,1,4047,0);Ca(d,1,4047,0);break a}Ea(b,a+228|0,2);Ea(b+2|0,e+124|0,4);Ea(b+6|0,e+116|0,1);Ea(b+7|0,e+120|0,1);c=H[a+228>>2];i=H[a+128>>2];if(c>>>0>=N(i,H[a+132>>2])>>>0){H[e+112>>2]=c;Ca(d,1,7843,e+112|0);break a}h=H[a+180>>2]+N(c,5644)|0;j=(c>>>0)/(i>>>0)|0;b=H[e+116>>2];b:{f=H[a+44>>2];if((f|0)>=0&(c|0)!=(f|0)){break b}f=H[h+5588>>2]+1|0;if((f|0)==(b|0)){break b}H[e+104>>2]=f;H[e+100>>2]=b;H[e+96>>2]=c;Ca(d,1,7867,e+96|0);f=0;break a}H[h+5588>>2]=b;c:{b=H[e+124>>2];if(b-1>>>0<=12){if((b|0)!=12){break c}H[e+64>>2]=12;Ca(d,2,11864,e- -64|0);b=H[e+124>>2]}if(!b){Ca(d,4,10695,0);H[a+56>>2]=1}d:{e:{f:{g:{g=H[h+5592>>2];if(g){b=H[e+116>>2];if(b>>>0>>0){break g}H[e+52>>2]=g;H[e+48>>2]=b;Ca(d,1,5150,e+48|0);H[a+56>>2]=1;f=0;break a}f=H[e+120>>2];if(f){break f}break d}f=H[e+120>>2];if(!f){break e}}g=(I[a+92|0]>>>4&1)+f|0;H[e+120>>2]=g;b=H[e+116>>2];f=H[h+5592>>2];if(b>>>0>f-1>>>0){H[e+20>>2]=f;H[e+16>>2]=b;Ca(d,1,5051,e+16|0);H[a+56>>2]=1;f=0;break a}if(b>>>0>=g>>>0){H[e+36>>2]=g;H[e+32>>2]=b;Ca(d,1,5250,e+32|0);H[a+56>>2]=1;f=0;break a}H[h+5592>>2]=g}if((H[e+116>>2]+1|0)!=(g|0)){break d}F[a+92|0]=I[a+92|0]|1}b=H[e+124>>2];H[a+8>>2]=16;H[a+24>>2]=H[a+56>>2]?0:b-12|0;f=H[a+44>>2];h:{if((f|0)==-1){f=4;b=c-N(j,i)|0;if(!(b>>>0>2]|b>>>0>=K[a+36>>2]|j>>>0>2])){f=j>>>0>=K[a+40>>2]?4:0}F[a+92|0]=I[a+92|0]&251|f;b=H[a+228>>2];break h}b=H[a+228>>2];F[a+92|0]=I[a+92|0]&251|((f|0)!=(b|0)?4:0)}c=H[H[a+224>>2]+40>>2]+N(b,40)|0;H[c>>2]=b;H[c+12>>2]=H[e+116>>2];f=H[e+120>>2];if(!H[a+76>>2]){if(K[c+4>>2]>=f>>>0){f=1;break a}H[e>>2]=b;Ca(d,2,1612,e);H[a+76>>2]=1;f=H[e+120>>2]}b=H[a+228>>2];c=H[H[a+224>>2]+40>>2];if(f){b=N(b,40)+c|0;H[b+4>>2]=f;c=H[e+120>>2];H[b+8>>2]=c;b=H[b+16>>2];if(!b){b=Fa(c,24);H[(H[H[a+224>>2]+40>>2]+N(H[a+228>>2],40)|0)+16>>2]=b;if(b){f=1;break a}f=0;Ca(d,1,6947,0);break a}b=Ia(b,N(c,24));c=H[H[a+224>>2]+40>>2]+N(H[a+228>>2],40)|0;if(!b){Da(H[c+16>>2]);f=0;H[(H[H[a+224>>2]+40>>2]+N(H[a+228>>2],40)|0)+16>>2]=0;Ca(d,1,6947,0);break a}H[c+16>>2]=b;f=1;break a}i:{f=N(b,40)+c|0;g=H[f+16>>2];if(g){break i}H[f+8>>2]=10;g=Fa(10,24);c=H[H[a+224>>2]+40>>2];b=H[a+228>>2];H[(c+N(b,40)|0)+16>>2]=g;if(g){break i}f=0;H[(N(b,40)+c|0)+8>>2]=0;Ca(d,1,6947,0);break a}b=N(b,40)+c|0;c=H[e+116>>2];if(K[b+8>>2]>c>>>0){f=1;break a}f=1;h=b;b=c+1|0;H[h+8>>2]=b;b=Ia(g,N(b,24));c=H[H[a+224>>2]+40>>2]+N(H[a+228>>2],40)|0;if(!b){Da(H[c+16>>2]);f=0;a=H[H[a+224>>2]+40>>2]+N(H[a+228>>2],40)|0;H[a+8>>2]=0;H[a+16>>2]=0;Ca(d,1,6947,0);break a}H[c+16>>2]=b;break a}H[e+80>>2]=b;Ca(d,1,12133,e+80|0);f=0}oa=e+128|0;return f|0}function qb(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0;g=H[a+8>>2];e=g+H[a+4>>2]|0;a:{if(!H[a+12>>2]){if((e|0)<2|(d|0)<=0){break a}q=e&2147483644;m=e&3;r=e&1;s=g+1|0;h=H[a>>2];o=h+(e<<2)|0;t=e-4>>>1|0;a=e-1|0;u=h+(a<<2)|0;v=N(c,g)<<2;l=e>>>0<4;w=N(a>>>1|0,c)<<2;while(1){g=H[b+v>>2];e=H[b>>2]-(g+1>>1)|0;i=0;a=0;if(!l){while(1){j=a+1|0;x=H[(N(j,c)<<2)+b>>2];f=H[(N(a+s|0,c)<<2)+b>>2];p=h+(i<<2)|0;H[p>>2]=e;k=e;e=x-((g+f|0)+2>>2)|0;H[p+4>>2]=(k+e>>1)+g;i=i+2|0;k=(a|0)!=(t|0);g=f;a=j;if(k){continue}break}}H[h+(i<<2)>>2]=e;if(r){a=H[b+w>>2]-(g+1>>1)|0;H[u>>2]=a;e=a+e>>1;a=-8}else{a=-4}H[a+o>>2]=e+g;e=0;a=0;g=0;if(!l){while(1){H[(N(a,c)<<2)+b>>2]=H[h+(a<<2)>>2];f=a|1;H[(N(f,c)<<2)+b>>2]=H[h+(f<<2)>>2];f=a|2;H[(N(f,c)<<2)+b>>2]=H[h+(f<<2)>>2];f=a|3;H[(N(f,c)<<2)+b>>2]=H[h+(f<<2)>>2];a=a+4|0;g=g+4|0;if((q|0)!=(g|0)){continue}break}}if(m){while(1){H[(N(a,c)<<2)+b>>2]=H[h+(a<<2)>>2];a=a+1|0;e=e+1|0;if((m|0)!=(e|0)){continue}break}}b=b+4|0;n=n+1|0;if((n|0)!=(d|0)){continue}break}break a}b:{switch(e-1|0){case 0:if((d|0)<=0){break a}if(d>>>0>=4){c=d&2147483644;a=0;while(1){H[b>>2]=H[b>>2]/2;H[b+4>>2]=H[b+4>>2]/2;H[b+8>>2]=H[b+8>>2]/2;H[b+12>>2]=H[b+12>>2]/2;b=b+16|0;a=a+4|0;if((c|0)!=(a|0)){continue}break}}c=d&3;if(!c){break a}a=0;while(1){H[b>>2]=H[b>>2]/2;b=b+4|0;a=a+1|0;if((c|0)!=(a|0)){continue}break};break a;case 1:if((d|0)<=0){break a}a=H[a>>2];e=0;g=N(c,g)<<2;while(1){f=b+g|0;j=H[b>>2]-(H[f>>2]+1>>1)|0;H[a+4>>2]=j;f=j+H[f>>2]|0;H[a>>2]=f;H[b>>2]=f;H[(c<<2)+b>>2]=H[a+4>>2];b=b+4|0;e=e+1|0;if((e|0)!=(d|0)){continue}break};break a;default:break b}}if((e|0)<3|(d|0)<=0){break a}q=e&2147483644;m=e&3;h=H[a>>2];r=(h+(e<<2)|0)-4|0;a=e-2|0;s=h+(a<<2)|0;o=e&1;f=!o;t=((e-f|0)-4>>>1|0)+1|0;u=N(c,g)<<2;v=a-f>>>0<2;w=N((e>>>1|0)-1|0,c)<<2;x=e-1>>>0<3;while(1){l=b+u|0;g=H[l+(c<<2)>>2];a=H[l>>2];e=H[b>>2]-((g+a|0)+2>>2)|0;H[h>>2]=e+a;i=1;a=1;if(!v){while(1){p=H[(N(a,c)<<2)+b>>2];j=a+1|0;f=H[l+(N(j,c)<<2)>>2];y=h+(i<<2)|0;H[y>>2]=e;k=e;e=p-((g+f|0)+2>>2)|0;H[y+4>>2]=(k+e>>1)+g;i=i+2|0;k=(a|0)!=(t|0);a=j;g=f;if(k){continue}break}}H[h+(i<<2)>>2]=e;c:{if(!o){a=H[b+w>>2]-(g+1>>1)|0;H[s>>2]=(e+a>>1)+g;break c}a=e+g|0}H[r>>2]=a;e=0;a=0;g=0;if(!x){while(1){H[(N(a,c)<<2)+b>>2]=H[h+(a<<2)>>2];f=a|1;H[(N(f,c)<<2)+b>>2]=H[h+(f<<2)>>2];f=a|2;H[(N(f,c)<<2)+b>>2]=H[h+(f<<2)>>2];f=a|3;H[(N(f,c)<<2)+b>>2]=H[h+(f<<2)>>2];a=a+4|0;g=g+4|0;if((q|0)!=(g|0)){continue}break}}if(m){while(1){H[(N(a,c)<<2)+b>>2]=H[h+(a<<2)>>2];a=a+1|0;e=e+1|0;if((m|0)!=(e|0)){continue}break}}b=b+4|0;n=n+1|0;if((n|0)!=(d|0)){continue}break}}}function Nb(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;r=oa-16|0;oa=r;a:{if(!c){Ca(d,1,11629,0);break a}t=H[c+16>>2];i=H[a+96>>2];if(t>>>0>2]){Ca(d,1,10570,0);break a}f=H[a+128>>2];g=N(f,H[a+132>>2]);if(g>>>0<=e>>>0){H[r>>2]=e;H[r+4>>2]=g-1;Ca(d,1,16362,r);g=0;break a}j=(e>>>0)/(f>>>0)|0;f=e-N(j,f)|0;h=H[a+108>>2]+N(f,H[a+116>>2])|0;H[c>>2]=h;g=H[i>>2];l=g>>>0>>0?h:g;H[c>>2]=l;f=H[a+108>>2]+N(H[a+116>>2],f+1|0)|0;H[c+8>>2]=f;g=H[H[a+96>>2]+8>>2];f=f>>>0>>0?f:g;H[c+8>>2]=f;i=H[a+112>>2]+N(j,H[a+120>>2])|0;H[c+4>>2]=i;g=H[H[a+96>>2]+4>>2];h=g>>>0>>0?i:g;H[c+4>>2]=h;i=H[a+112>>2]+N(H[a+120>>2],j+1|0)|0;H[c+12>>2]=i;g=H[H[a+96>>2]+12>>2];g=g>>>0>i>>>0?i:g;H[c+12>>2]=g;i=H[a+96>>2];m=H[i+16>>2];if(m){u=g-1|0;v=(g>>31)-!g|0;w=f-1|0;x=(f>>31)-!f|0;y=h-1|0;z=0-!h|0;A=l-1|0;B=0-!l|0;C=H[i+24>>2];g=H[c+24>>2];while(1){i=H[(C+N(q,52)|0)+40>>2];H[g+40>>2]=i;f=B;l=H[g>>2];h=l+A|0;f=l>>>0>h>>>0?f+1|0:f;n=Ke(h,f,l,0);H[g+16>>2]=n;f=z;h=H[g+4>>2];j=h+y|0;f=h>>>0>j>>>0?f+1|0:f;f=Ke(j,f,h,0);H[g+20>>2]=f;j=f;p=i;f=i&31;if((i&63)>>>0>=32){k=-1<>>32-f;f=-1<>31)+(i>>>0>>0)|0)|0;j=o;o=p&31;if((p&63)>>>0>=32){o=k>>o}else{o=((1<>>o}k=h>>31;s=k+v|0;j=h+u|0;s=j>>>0>>0?s+1|0:s;j=Je(j,s,h,k);h=i-j|0;j=f-((j>>31)+(i>>>0>>0)|0)|0;k=p&31;if((p&63)>>>0>=32){j=j>>k}else{j=((1<>>k}H[g+12>>2]=o-j;j=f-((n>>31)+(i>>>0>>0)|0)|0;h=i-n|0;n=p&31;if((p&63)>>>0>=32){n=j>>n}else{n=((1<>>n}j=l>>31;k=j+x|0;h=l+w|0;k=h>>>0>>0?k+1|0:k;l=Je(h,k,l,j);h=i-l|0;i=f-((l>>31)+(i>>>0>>0)|0)|0;f=h;h=p&31;if((p&63)>>>0>=32){f=i>>h}else{f=((1<>>h}H[g+8>>2]=n-f;g=g+52|0;q=q+1|0;if((q|0)!=(m|0)){continue}break}}if(m>>>0>>0){g=H[c+24>>2];while(1){f=N(m,52);Da(H[(f+g|0)+44>>2]);g=H[c+24>>2];H[(f+g|0)+44>>2]=0;m=m+1|0;if(m>>>0>2]){continue}break}H[c+16>>2]=H[H[a+96>>2]+16>>2]}g=H[a+100>>2];if(g){Va(g)}f=zb();H[a+100>>2]=f;g=0;if(!f){break a}Lb(c,f);H[a+44>>2]=e;if(!Ya(H[a+216>>2],24,d)){break a}h=H[a+216>>2];e=H[h>>2];m=H[h+8>>2];b:{if(e){g=1;i=e&1;if((e|0)==1){e=0}else{f=e&-2;q=0;while(1){e=0;c:{if(!g){break c}e=0;if(!(sa[H[m>>2]](a,b,d)|0)){break c}e=(sa[H[m+4>>2]](a,b,d)|0)!=0}g=e;m=m+8|0;q=q+2|0;if((f|0)!=(q|0)){continue}break}e=!g}g=i?0:g;if(!(e|!i)){g=(sa[H[m>>2]](a,b,d)|0)!=0}Qa(h);if(g){break b}Va(H[a+96>>2]);g=0;H[a+96>>2]=0;break a}Qa(h)}g=Ob(a,c)}oa=r+16|0;return g|0}function hc(a,b,c,d,e,f,g){var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;a:{n=N(e,3);h=H[b>>2]>>>n|0;if(h&2097168){break a}h=h&495;if(!h){break a}o=a+28|0;l=o+(I[h+H[a+108>>2]|0]<<2)|0;H[a+104>>2]=l;k=H[l>>2];i=H[k>>2];h=H[a+4>>2]-i|0;H[a+4>>2]=h;j=H[a>>2];b:{if(j>>>16>>>0>>0){m=H[k+4>>2];H[a+4>>2]=i;h=h>>>0>>0;H[l>>2]=H[k+(h?8:12)>>2];k=h?m:!m;h=H[a+8>>2];while(1){c:{if(h){break c}h=H[a+16>>2];m=h+1|0;l=I[h+1|0];if(I[h|0]==255){if(l>>>0>=144){H[a+12>>2]=H[a+12>>2]+1;j=j+65280|0;h=8;break c}H[a+16>>2]=m;j=(l<<9)+j|0;h=7;break c}H[a+16>>2]=m;h=8;j=(l<<8)+j|0}h=h-1|0;H[a+8>>2]=h;j=j<<1;H[a>>2]=j;i=i<<1;H[a+4>>2]=i;if(i>>>0<32768){continue}break}h=i;break b}j=j-(i<<16)|0;H[a>>2]=j;if(!(h&32768)){m=H[k+4>>2];i=h>>>0>>0;H[l>>2]=H[k+(i?12:8)>>2];k=i?!m:m;i=H[a+8>>2];while(1){d:{if(i){break d}i=H[a+16>>2];m=i+1|0;l=I[i+1|0];if(I[i|0]==255){if(l>>>0>=144){H[a+12>>2]=H[a+12>>2]+1;j=j+65280|0;i=8;break d}H[a+16>>2]=m;j=(l<<9)+j|0;i=7;break d}H[a+16>>2]=m;i=8;j=(l<<8)+j|0}i=i-1|0;H[a+8>>2]=i;j=j<<1;H[a>>2]=j;h=h<<1;H[a+4>>2]=h;if(h>>>0<32768){continue}break}break b}k=H[k+4>>2]}e:{if(!k){break e}p=b-4|0;i=H[b>>2];k=H[b+4>>2]>>>n+17&4|(H[p>>2]>>>n+19&1|(i>>>n+16&64|i>>>n&170|i>>>(e?n+12|0:14)&16));m=o+(I[k+24384|0]<<2)|0;H[a+104>>2]=m;l=H[m>>2];i=H[l>>2];h=h-i|0;H[a+4>>2]=h;o=I[k+24640|0];f:{if(j>>>16>>>0>>0){k=H[l+4>>2];H[a+4>>2]=i;h=h>>>0>>0;H[m>>2]=H[l+(h?8:12)>>2];l=h?k:!k;h=H[a+8>>2];while(1){g:{if(h){break g}h=H[a+16>>2];m=h+1|0;k=I[h+1|0];if(I[h|0]==255){if(k>>>0>=144){H[a+12>>2]=H[a+12>>2]+1;j=j+65280|0;h=8;break g}H[a+16>>2]=m;j=(k<<9)+j|0;h=7;break g}H[a+16>>2]=m;h=8;j=(k<<8)+j|0}h=h-1|0;H[a+8>>2]=h;j=j<<1;H[a>>2]=j;i=i<<1;H[a+4>>2]=i;if(i>>>0<32768){continue}break}break f}k=j-(i<<16)|0;H[a>>2]=k;if(!(h&32768)){j=H[l+4>>2];i=h>>>0>>0;H[m>>2]=H[l+(i?12:8)>>2];l=i?!j:j;j=H[a+8>>2];while(1){h:{if(j){break h}j=H[a+16>>2];m=j+1|0;i=I[j+1|0];if(I[j|0]==255){if(i>>>0>=144){H[a+12>>2]=H[a+12>>2]+1;k=k+65280|0;j=8;break h}H[a+16>>2]=m;k=(i<<9)+k|0;j=7;break h}H[a+16>>2]=m;j=8;k=(i<<8)+k|0}j=j-1|0;H[a+8>>2]=j;k=k<<1;H[a>>2]=k;h=h<<1;H[a+4>>2]=h;if(h>>>0<32768){continue}break}break f}l=H[l+4>>2]}H[c>>2]=(l|0)==(o|0)?d:0-d|0;H[p>>2]=H[p>>2]|32<>2]=H[b>>2]|(c<<19|16)<>2]=H[b+4>>2]|8<>2]=H[a+4>>2]|32768;H[a>>2]=H[a>>2]|c<<31|65536;a=a-4|0;H[a>>2]=H[a>>2]|131072}if((e|0)!=3){break e}a=(f<<2)+b|0;H[a+4>>2]=H[a+4>>2]|1;H[a>>2]=H[a>>2]|c<<18|2;a=a-4|0;H[a>>2]=H[a>>2]|4}H[b>>2]=H[b>>2]|2097152<>2];a:{if(!(!(H[H[a+180>>2]+5596>>2]?H[a+128>>2]!=1|H[a+132>>2]!=1:1)|H[a+8>>2]==8)){Ca(g,1,10614,0);break a}m=H[b+16>>2];b:{if(!m){break b}k=H[a+184>>2];l=H[b+24>>2];if(m>>>0>=8){p=m&-8;while(1){H[(N(i,52)+l|0)+40>>2]=k;H[(N(i|1,52)+l|0)+40>>2]=k;H[(N(i|2,52)+l|0)+40>>2]=k;H[(N(i|3,52)+l|0)+40>>2]=k;H[(N(i|4,52)+l|0)+40>>2]=k;H[(N(i|5,52)+l|0)+40>>2]=k;H[(N(i|6,52)+l|0)+40>>2]=k;H[(N(i|7,52)+l|0)+40>>2]=k;i=i+8|0;n=n+8|0;if((p|0)!=(n|0)){continue}break}}m=m&7;if(!m){break b}while(1){H[(N(i,52)+l|0)+40>>2]=k;i=i+1|0;o=o+1|0;if((m|0)!=(o|0)){continue}break}}if(!(c|d|e|f)){Ca(g,4,6344,0);H[a+28>>2]=0;H[a+32>>2]=0;c=H[a+132>>2];H[a+36>>2]=H[a+128>>2];H[a+40>>2]=c;H[b>>2]=H[j>>2];H[b+4>>2]=H[j+4>>2];H[b+8>>2]=H[j+8>>2];H[b+12>>2]=H[j+12>>2];i=Ab(b,g);break a}if((c|0)<0){H[h>>2]=c;Ca(g,1,12602,h);i=0;break a}i=H[j+8>>2];if(i>>>0>>0){H[h+20>>2]=i;H[h+16>>2]=c;Ca(g,1,13070,h+16|0);i=0;break a}i=H[j>>2];c:{if(i>>>0>c>>>0){H[h+196>>2]=i;H[h+192>>2]=c;Ca(g,2,13422,h+192|0);H[a+28>>2]=0;c=H[j>>2];break c}H[a+28>>2]=(c-H[a+108>>2]>>>0)/K[a+116>>2]}H[b>>2]=c;if((d|0)<0){H[h+32>>2]=d;Ca(g,1,12538,h+32|0);i=0;break a}c=H[j+12>>2];if(c>>>0>>0){H[h+52>>2]=c;H[h+48>>2]=d;Ca(g,1,12897,h+48|0);i=0;break a}c=H[j+4>>2];d:{if(c>>>0>d>>>0){H[h+180>>2]=c;H[h+176>>2]=d;Ca(g,2,13247,h+176|0);H[a+32>>2]=0;d=H[j+4>>2];break d}H[a+32>>2]=(d-H[a+112>>2]>>>0)/K[a+120>>2]}H[b+4>>2]=d;i=0;if((e|0)<=0){H[h+64>>2]=e;Ca(g,1,12472,h- -64|0);break a}c=H[j>>2];if(c>>>0>e>>>0){H[h+84>>2]=c;H[h+80>>2]=e;Ca(g,1,13333,h+80|0);break a}c=H[j+8>>2];e:{if(c>>>0>>0){H[h+164>>2]=c;H[h+160>>2]=e;Ca(g,2,12982,h+160|0);H[a+36>>2]=H[a+128>>2];e=H[j+8>>2];break e}k=0;d=e-H[a+108>>2]|0;l=d;c=H[a+116>>2];d=d+c|0;k=l>>>0>d>>>0?1:k;q=a,r=Ke(d-1|0,k-!d|0,c,0),H[q+36>>2]=r}H[b+8>>2]=e;if((f|0)<=0){H[h+96>>2]=f;Ca(g,1,12405,h+96|0);break a}c=H[j+4>>2];if(c>>>0>f>>>0){H[h+116>>2]=c;H[h+112>>2]=f;Ca(g,1,13157,h+112|0);break a}c=H[j+12>>2];f:{if(c>>>0>>0){H[h+148>>2]=c;H[h+144>>2]=f;Ca(g,2,12808,h+144|0);H[a+40>>2]=H[a+132>>2];f=H[j+12>>2];break f}e=0;d=f-H[a+112>>2]|0;l=d;c=H[a+120>>2];d=d+c|0;e=l>>>0>d>>>0?1:e;q=a,r=Ke(d-1|0,e-!d|0,c,0),H[q+40>>2]=r}H[b+12>>2]=f;F[a+92|0]=I[a+92|0]|2;if(!Ab(b,g)){break a}a=H[b>>2];c=H[b+4>>2];d=H[b+12>>2];H[h+136>>2]=H[b+8>>2];H[h+140>>2]=d;H[h+128>>2]=a;H[h+132>>2]=c;Ca(g,4,7566,h+128|0);i=1}oa=h+208|0;return i|0}function gc(a,b,c,d,e,f){var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;a:{m=N(e,3);g=H[b>>2]>>>m|0;if(g&2097168){break a}n=a+28|0;k=n+(I[H[a+108>>2]+(g&495)|0]<<2)|0;H[a+104>>2]=k;j=H[k>>2];h=H[j>>2];g=H[a+4>>2]-h|0;H[a+4>>2]=g;i=H[a>>2];b:{if(i>>>16>>>0>>0){l=H[j+4>>2];H[a+4>>2]=h;g=g>>>0>>0;H[k>>2]=H[j+(g?8:12)>>2];j=g?l:!l;g=H[a+8>>2];while(1){c:{if(g){break c}g=H[a+16>>2];l=g+1|0;k=I[g+1|0];if(I[g|0]==255){if(k>>>0>=144){H[a+12>>2]=H[a+12>>2]+1;i=i+65280|0;g=8;break c}H[a+16>>2]=l;i=(k<<9)+i|0;g=7;break c}H[a+16>>2]=l;g=8;i=(k<<8)+i|0}g=g-1|0;H[a+8>>2]=g;i=i<<1;H[a>>2]=i;h=h<<1;H[a+4>>2]=h;if(h>>>0<32768){continue}break}g=h;break b}i=i-(h<<16)|0;H[a>>2]=i;if(!(g&32768)){l=H[j+4>>2];h=g>>>0>>0;H[k>>2]=H[j+(h?12:8)>>2];j=h?!l:l;h=H[a+8>>2];while(1){d:{if(h){break d}h=H[a+16>>2];l=h+1|0;k=I[h+1|0];if(I[h|0]==255){if(k>>>0>=144){H[a+12>>2]=H[a+12>>2]+1;i=i+65280|0;h=8;break d}H[a+16>>2]=l;i=(k<<9)+i|0;h=7;break d}H[a+16>>2]=l;h=8;i=(k<<8)+i|0}h=h-1|0;H[a+8>>2]=h;i=i<<1;H[a>>2]=i;g=g<<1;H[a+4>>2]=g;if(g>>>0<32768){continue}break}break b}j=H[j+4>>2]}if(!j){break a}j=n;n=b-4|0;h=H[b>>2];o=H[b+4>>2]>>>m+17&4|(H[n>>2]>>>m+19&1|(h>>>m+16&64|h>>>m&170|h>>>(e?m+12|0:14)&16));l=j+(I[o+24384|0]<<2)|0;H[a+104>>2]=l;k=H[l>>2];h=H[k>>2];g=g-h|0;H[a+4>>2]=g;e:{if(i>>>16>>>0>>0){j=H[k+4>>2];H[a+4>>2]=h;g=g>>>0>>0;H[l>>2]=H[k+(g?8:12)>>2];k=g?j:!j;g=H[a+8>>2];while(1){f:{if(g){break f}g=H[a+16>>2];l=g+1|0;j=I[g+1|0];if(I[g|0]==255){if(j>>>0>=144){H[a+12>>2]=H[a+12>>2]+1;i=i+65280|0;g=8;break f}H[a+16>>2]=l;i=(j<<9)+i|0;g=7;break f}H[a+16>>2]=l;g=8;i=(j<<8)+i|0}g=g-1|0;H[a+8>>2]=g;i=i<<1;H[a>>2]=i;h=h<<1;H[a+4>>2]=h;if(h>>>0<32768){continue}break}break e}j=i-(h<<16)|0;H[a>>2]=j;if(!(g&32768)){i=H[k+4>>2];h=g>>>0>>0;H[l>>2]=H[k+(h?12:8)>>2];k=h?!i:i;i=H[a+8>>2];while(1){g:{if(i){break g}i=H[a+16>>2];l=i+1|0;h=I[i+1|0];if(I[i|0]==255){if(h>>>0>=144){H[a+12>>2]=H[a+12>>2]+1;j=j+65280|0;i=8;break g}H[a+16>>2]=l;j=(h<<9)+j|0;i=7;break g}H[a+16>>2]=l;i=8;j=(h<<8)+j|0}i=i-1|0;H[a+8>>2]=i;j=j<<1;H[a>>2]=j;g=g<<1;H[a+4>>2]=g;if(g>>>0<32768){continue}break}break e}k=H[k+4>>2]}g=c;c=I[o+24640|0];H[g>>2]=(c|0)==(k|0)?d:0-d|0;H[n>>2]=H[n>>2]|32<>2]=H[b>>2]|(d<<19|16)<>2]=H[b+4>>2]|8<>2]<<2)+b|0;H[c+4>>2]=H[c+4>>2]|32768;H[c>>2]=H[c>>2]|d<<31|65536;c=c-4|0;H[c>>2]=H[c>>2]|131072}if((e|0)!=3){break a}a=(H[a+124>>2]<<2)+b|0;H[a+4>>2]=H[a+4>>2]|4;H[a+12>>2]=H[a+12>>2]|1;H[a+8>>2]=H[a+8>>2]|d<<18|2}}function Zd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;e=oa-112|0;oa=e;j=1024;a:{b:{h=Fa(1,1024);if(h){l=e+92|0;k=e+108|0;while(1){c:{d:{d=e+104|0;e:{if((Ka(b,d,8,c)|0)!=8){break e}Ea(d,e+88|0,4);Ea(k,l,4);f=8;f:{g:{h:{i:{switch(H[e+88>>2]){case 0:d=Sa(b);g=ra;if((g|0)<0){g=1}else{g=d>>>0<4294967288&(g|0)<=0}if(g){break h}Ca(c,1,8449,0);break e;case 1:break i;default:break f}}d=e+104|0;if((Ka(b,d,8,c)|0)!=8){break e}Ea(d,e+100|0,4);if(!H[e+100>>2]){break g}Ca(c,1,8449,0);break e}H[e+88>>2]=d+8;break f}Ea(k,e+88|0,4);f=16}d=H[e+92>>2];if((d|0)==1785737827){b=H[a+100>>2];if(b&4){H[a+100>>2]=b|8;break e}Ca(c,1,5702,0);Da(h);a=0;break a}i=H[e+88>>2];if(!i){Ca(c,1,3268,0);Da(h);a=0;break a}if(f>>>0>i>>>0){H[e+4>>2]=d;H[e>>2]=i;Ca(c,1,13933,e);break b}j:{k:{l:{m:{n:{o:{p:{q:{r:{s:{if((d|0)<=1668246641){if((d|0)==1651532643){break r}if((d|0)==1667523942){break p}if((d|0)!=1668112752){break s}g=25296;break n}if((d|0)<=1783635999){if((d|0)==1668246642){break o}g=25264;if((d|0)==1768449138){break n}if((d|0)!=1718909296){break s}g=25240;break l}if((d|0)==1885564018){break q}if((d|0)==1783636e3){break m}g=25248;if((d|0)==1785737832){break l}}d=H[a+100>>2];if(d&1){break j}Ca(c,1,2062,0);Da(h);a=0;break a}g=25280;break n}g=25288;break n}g=25304;break n}g=25272}H[e+76>>2]=d&255;H[e+64>>2]=d>>>24;H[e+72>>2]=d>>>8&255;H[e+68>>2]=d>>>16&255;Ca(c,2,2011,e- -64|0);f=i-f|0;if(I[a+100|0]&4){break k}d=H[e+92>>2];H[e+48>>2]=d>>>24;H[e+60>>2]=d&255;H[e+52>>2]=d>>>16&255;H[e+56>>2]=d>>>8&255;Ca(c,2,6771,e+48|0);H[a+100>>2]=H[a+100>>2]|2147483647;d=ub(b,f,c);if(!ra&(d|0)==(f|0)){continue}Ca(c,1,3748,0);Da(h);a=0;break a}g=25232}f=i-f|0}d=f;f=Sa(b);i=ra;if((i|0)<0){f=1}else{f=(i|0)<=0&d>>>0>f>>>0}if(f){f=H[e+88>>2];a=H[e+92>>2];m=e,n=Sa(b),H[m+40>>2]=n;H[e+36>>2]=d;H[e+32>>2]=a&255;H[e+20>>2]=a>>>24;H[e+16>>2]=f;H[e+28>>2]=a>>>8&255;H[e+24>>2]=a>>>16&255;Ca(c,1,15680,e+16|0);break b}if(d>>>0<=j>>>0){f=h;break c}j=d;f=Ia(h,d);if(f){break c}Da(h);Ca(c,1,2193,0);a=0;break a}if(!(d&2)){Ca(c,1,2132,0);Da(h);a=0;break a}H[a+100>>2]=d|2147483647;d=i-f|0;f=ub(b,d,c);if(!ra&(d|0)==(f|0)){continue}if(!(I[a+100|0]&8)){break d}Ca(c,2,3748,0)}Da(h);a=1;break a}Ca(c,1,3748,0);Da(h);a=0;break a}if((Ka(b,f,d,c)|0)!=(d|0)){Ca(c,1,3798,0);Da(f);a=0;break a}h=f;if(sa[H[g+4>>2]](a,f,d,c)|0){continue}break}Da(f);a=0;break a}Ca(c,1,4923,0);a=0;break a}Da(h);a=0}oa=e+112|0;return a|0}function le(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=oa-16|0;oa=g;if(H[a+8>>2]==16){h=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{h=H[a+12>>2]}a:{if(c>>>0<=1){Ca(d,1,4721,0);a=0;break a}Ea(b,g+12|0,2);if(H[g+12>>2]){Ca(d,2,5897,0);a=1;break a}if(c>>>0<=6){Ca(d,1,4721,0);a=0;break a}Ea(b+2|0,g+8|0,1);j=H[h+5628>>2];a=j;b:{c:{d:{e=H[h+5632>>2];if(!e){break d}i=H[g+8>>2];while(1){if((i|0)==H[a>>2]){break d}a=a+20|0;f=f+1|0;if((e|0)!=(f|0)){continue}break}break c}if((e|0)!=(f|0)){break b}}if((e|0)==H[h+5636>>2]){a=e+10|0;H[h+5636>>2]=a;a=Ia(j,N(a,20));if(!a){Da(H[h+5628>>2]);H[h+5636>>2]=0;H[h+5628>>2]=0;H[h+5632>>2]=0;Ca(d,1,4747,0);a=0;break a}H[h+5628>>2]=a;e=H[h+5632>>2];f=N(H[h+5636>>2]-e|0,20);if(f){y(a+N(e,20)|0,0,f)}j=H[h+5628>>2];e=H[h+5632>>2]}a=N(e,20)+j|0;n=1}H[a>>2]=H[g+8>>2];Ea(b+3|0,g+12|0,2);if(H[g+12>>2]){Ca(d,2,5897,0);a=1;break a}Ea(b+5|0,g+4|0,2);f=H[g+4>>2];if(f>>>0>=2){Ca(d,2,3130,0);a=1;break a}e=c-7|0;if(f){c=b+7|0;j=0;while(1){if(e>>>0<=2){Ca(d,1,4721,0);a=0;break a}Ea(c,g+12|0,1);if(H[g+12>>2]!=1){Ca(d,2,5579,0);a=1;break a}Ea(c+1|0,g,2);f=H[g>>2];b=f&32767;H[a+4>>2]=b;i=e-3|0;e=(f>>>15|0)+1|0;k=N(e,b)+2|0;if(i>>>0>>0){Ca(d,1,4721,0);a=0;break a}c=c+3|0;f=0;if(b){while(1){Ea(c,g+12|0,e);if(H[g+12>>2]!=(f|0)){Ca(d,2,6259,0);a=1;break a}c=c+e|0;f=f+1|0;if(f>>>0>2]){continue}break}}Ea(c,g,2);e=H[g>>2];b=e&32767;H[g>>2]=b;if((b|0)!=H[a+4>>2]){Ca(d,2,3306,0);a=1;break a}e=(e>>>15|0)+1|0;l=N(e,b)+3|0;k=i-k|0;if(l>>>0>k>>>0){Ca(d,1,4721,0);a=0;break a}c=c+2|0;f=0;if(b){while(1){Ea(c,g+12|0,e);if(H[g+12>>2]!=(f|0)){Ca(d,2,6259,0);a=1;break a}c=c+e|0;f=f+1|0;if(f>>>0>2]){continue}break}}Ea(c,g+12|0,3);e=H[g+12>>2];H[a+8>>2]=0;H[a+12>>2]=0;F[a+16|0]=!(e&65536)|I[a+16|0]&254;i=e&255;H[g+8>>2]=i;e:{if(!i){break e}m=H[h+5620>>2];if(m){f=H[h+5616>>2];b=0;while(1){if((i|0)==H[f+8>>2]){H[a+8>>2]=f;break e}f=f+20|0;b=b+1|0;if((m|0)!=(b|0)){continue}break}}Ca(d,1,4721,0);a=0;break a}e=e>>>8&255;H[g+8>>2]=e;f:{if(!e){break f}i=H[h+5620>>2];if(i){f=H[h+5616>>2];b=0;while(1){if((e|0)==H[f+8>>2]){H[a+12>>2]=f;break f}f=f+20|0;b=b+1|0;if((i|0)!=(b|0)){continue}break}}Ca(d,1,4721,0);a=0;break a}e=k-l|0;c=c+3|0;j=j+1|0;if(j>>>0>2]){continue}break}}if(e){Ca(d,1,4721,0);a=0;break a}a=1;if(!n){break a}H[h+5632>>2]=H[h+5632>>2]+1;a=1}oa=g+16|0;return a|0}function gd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(K[a+44>>2]>=8){i=H[a+40>>2];l=8;while(1){k=H[a+12>>2]<<5;e=H[a>>2];g=H[a+36>>2];b=H[a+16>>2];h=H[a+20>>2];a:{if(b>>>0>=h>>>0){break a}j=e+k|0;d=b+1|0;if(h-b&1){c=j+(b<<6)|0;b=(N(b,g)<<2)+i|0;f=H[b+4>>2];H[c>>2]=H[b>>2];H[c+4>>2]=f;f=H[b+28>>2];H[c+24>>2]=H[b+24>>2];H[c+28>>2]=f;f=H[b+20>>2];H[c+16>>2]=H[b+16>>2];H[c+20>>2]=f;f=H[b+12>>2];H[c+8>>2]=H[b+8>>2];H[c+12>>2]=f;b=d}if((d|0)==(h|0)){break a}while(1){d=(N(b,g)<<2)+i|0;f=H[d+4>>2];c=j+(b<<6)|0;H[c>>2]=H[d>>2];H[c+4>>2]=f;f=H[d+28>>2];H[c+24>>2]=H[d+24>>2];H[c+28>>2]=f;f=H[d+20>>2];H[c+16>>2]=H[d+16>>2];H[c+20>>2]=f;f=H[d+12>>2];H[c+8>>2]=H[d+8>>2];H[c+12>>2]=f;d=b+1|0;c=j+(d<<6)|0;d=(N(d,g)<<2)+i|0;f=H[d+28>>2];H[c+24>>2]=H[d+24>>2];H[c+28>>2]=f;f=H[d+20>>2];H[c+16>>2]=H[d+16>>2];H[c+20>>2]=f;f=H[d+12>>2];H[c+8>>2]=H[d+8>>2];H[c+12>>2]=f;f=H[d+4>>2];H[c>>2]=H[d>>2];H[c+4>>2]=f;b=b+2|0;if((h|0)!=(b|0)){continue}break}}b=H[a+24>>2];h=H[a+28>>2];b:{if(b>>>0>=h>>>0){break b}j=(e-k|0)+32|0;k=(N(g,H[a+8>>2])<<2)+i|0;d=b+1|0;if(h-b&1){c=j+(b<<6)|0;b=k+(N(b,g)<<2)|0;e=H[b+4>>2];H[c>>2]=H[b>>2];H[c+4>>2]=e;e=H[b+28>>2];H[c+24>>2]=H[b+24>>2];H[c+28>>2]=e;e=H[b+20>>2];H[c+16>>2]=H[b+16>>2];H[c+20>>2]=e;e=H[b+12>>2];H[c+8>>2]=H[b+8>>2];H[c+12>>2]=e;b=d}if((d|0)==(h|0)){break b}while(1){d=k+(N(b,g)<<2)|0;e=H[d+4>>2];c=j+(b<<6)|0;H[c>>2]=H[d>>2];H[c+4>>2]=e;e=H[d+28>>2];H[c+24>>2]=H[d+24>>2];H[c+28>>2]=e;e=H[d+20>>2];H[c+16>>2]=H[d+16>>2];H[c+20>>2]=e;e=H[d+12>>2];H[c+8>>2]=H[d+8>>2];H[c+12>>2]=e;d=b+1|0;c=j+(d<<6)|0;d=k+(N(d,g)<<2)|0;e=H[d+28>>2];H[c+24>>2]=H[d+24>>2];H[c+28>>2]=e;e=H[d+20>>2];H[c+16>>2]=H[d+16>>2];H[c+20>>2]=e;e=H[d+12>>2];H[c+8>>2]=H[d+8>>2];H[c+12>>2]=e;e=H[d+4>>2];H[c>>2]=H[d>>2];H[c+4>>2]=e;b=b+2|0;if((h|0)!=(b|0)){continue}break}}Wa(a);b=0;if(H[a+32>>2]){while(1){d=H[a>>2]+(b<<5)|0;c=H[d+4>>2];g=(N(H[a+36>>2],b)<<2)+i|0;H[g>>2]=H[d>>2];H[g+4>>2]=c;c=H[d+28>>2];H[g+24>>2]=H[d+24>>2];H[g+28>>2]=c;c=H[d+20>>2];H[g+16>>2]=H[d+16>>2];H[g+20>>2]=c;c=H[d+12>>2];H[g+8>>2]=H[d+8>>2];H[g+12>>2]=c;b=b+1|0;if(b>>>0>2]){continue}break}}i=i+32|0;l=l+8|0;if(l>>>0<=K[a+44>>2]){continue}break}}Da(H[a>>2]);Da(a)}function pd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;c=H[b>>2]+7&-8;H[b>>2]=c+16;q=a;b=H[c>>2];a=H[c+4>>2];d=H[c+8>>2];c=H[c+12>>2];r=c;g=oa-32|0;oa=g;f=c&65535;e=d;d=0;c=c>>>16&32767;o=c;a:{if(c-15361>>>0<=2045){c=f<<4|e>>>28;d=e<<4|a>>>28;f=o-15360|0;a=a&268435455;b:{if((a|0)==134217728&(b|0)!=0|a>>>0>134217728){d=d+1|0;c=d?c:c+1|0;break b}if(b|(a|0)!=134217728){break b}a=d;d=d+(d&1)|0;c=a>>>0>d>>>0?c+1|0:c}a=d;d=c>>>0>1048575;b=d?0:a;a=d?0:c;c=0;e=f;f=d+f|0;e=e>>>0>f>>>0?1:c;break a}if(!(!(b|e|(a|f))|((c|0)!=32767|(d|0)!=0))){b=e;e=f<<4|b>>>28;b=b<<4|a>>>28;a=e|524288;f=2047;e=0;break a}if(o>>>0>17406){b=0;a=0;f=2047;e=0;break a}j=!(c|d);p=j?15360:15361;k=p-o|0;if((k|0)>112){b=0;a=0;f=0;e=0;break a}d=b;c=a;l=e;e=j?f:f|65536;f=e;h=l;m=128-k|0;c:{if(m&64){e=d;c=m+-64|0;d=c&31;if((c&63)>>>0>=32){c=b<>>32-d|a<>>0>=32){j=h<>>32-i|e<>>0>=32){e=0;h=c>>>h|0}else{e=c>>>h|0;h=((1<>>h}h=n|h;e=e|j;n=d;i=m&31;if((m&63)>>>0>=32){j=d<>>32-i|c<>2]=d;H[g+20>>2]=c;H[g+24>>2]=h;H[g+28>>2]=e;d:{if(k&64){c=l;b=k+-64|0;a=b&31;if((b&63)>>>0>=32){e=0;b=f>>>a|0}else{e=f>>>a|0;b=((1<>>a}a=e;l=0;f=0;break d}if(!k){break d}e=l;c=64-k|0;d=c&31;if((c&63)>>>0>=32){c=e<>>32-d|f<>>0>=32){j=0;a=a>>>b|0}else{j=a>>>b|0;a=((1<>>b}b=l|a;a=c|j;d=k&31;if((k&63)>>>0>=32){c=0;l=f>>>d|0}else{c=f>>>d|0;l=((1<>>d}f=c}H[g>>2]=b;H[g+4>>2]=a;H[g+8>>2]=l;H[g+12>>2]=f;a=H[g+8>>2];d=a<<4;a=H[g+12>>2]<<4|a>>>28;f=H[g>>2];b=H[g+4>>2];e=b;b=b>>>28|d;c=e&268435455;f=f|(o|0)!=(p|0)&(H[g+16>>2]|H[g+24>>2]|(H[g+20>>2]|H[g+28>>2]))!=0;e:{if((c|0)==134217728&(f|0)!=0|c>>>0>134217728){b=b+1|0;a=b?a:a+1|0;break e}if(f|(c|0)!=134217728){break e}c=a;a=b;b=b+(b&1)|0;a=a>>>0>b>>>0?c+1|0:c}f=a>>>0>1048575;a=f?a^1048576:a;e=0}oa=g+32|0;u(0,b|0);u(1,a|(r&-2147483648|f<<20));s=q,t=+w(),M[s>>3]=t}function Sc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;q=H[a+24>>2];if(!H[q+16>>2]){return 1}r=H[q+24>>2];o=H[H[H[a+20>>2]>>2]+20>>2];while(1){e=H[r+36>>2];H[b+36>>2]=e;c=N(e,152);e=H[o+28>>2];d=c+e|0;u=H[a+64>>2];a:{if(u){e=e+N(H[o+24>>2],152)|0;p=H[e-144>>2]-H[e-152>>2]|0;c=d+12|0;f=d+4|0;e=H[d+8>>2];h=H[d>>2];g=36;break a}c=d+148|0;f=d+140|0;e=H[d+144>>2];h=H[d+136>>2];p=e-h|0;g=52}v=H[g+o>>2];b:{c:{if(!v){break c}l=H[f>>2];n=H[c>>2];i=e-h|0;f=H[b+40>>2];c=f&31;if((f&63)>>>0>=32){d=-1<>>32-c;c=-1<>2];k=m+j|0;g=d^-1;c=g;c=k>>>0>>0?c+1|0:c;d=f&31;if((f&63)>>>0>=32){k=c>>>d|0}else{k=((1<>>d}d=H[b+8>>2];j=H[b+16>>2];m=j+m|0;c=g;c=m>>>0>>0?c+1|0:c;g=f&31;if((f&63)>>>0>=32){f=c>>>g|0}else{f=((1<>>g}c=f+d|0;d:{if(f>>>0>>0){s=h-f|0;g=0;if(c>>>0>=e>>>0){m=0;e=i;break d}e=c-h|0;m=i-e|0;break d}g=f-h|0;if(c>>>0>=e>>>0){e=i-g|0;s=0;m=0;break d}m=e-c|0;s=0;e=d}c=n-l|0;f=H[b+12>>2];i=f+k|0;e:{if(k>>>0>>0){t=l-k|0;k=0;j=0;if(i>>>0>=n>>>0){break e}j=c;c=i-l|0;j=j-c|0;break e}k=k-l|0;if(i>>>0>=n>>>0){c=c-k|0;t=0;j=0;break e}t=0;c=f;j=n-i|0}h=0;if((g|k|(m|j)|(c|e))<0){break b}i=N(k,p)+g|0;g=H[b+44>>2];l=N(d,t)+s|0;f:{g:{if(!(i|g|(l|(d|0)!=(p|0))|(d|0)!=(e|0))){if((c|0)!=(f|0)){break g}e=(u?36:52)+o|0;H[b+44>>2]=H[e>>2];H[e>>2]=0;break c}if(g){break f}}Ie(f,0,d);if(ra|!f){break b}d=N(d,f);if(d>>>0>1073741823){break b}d=Ja(d<<2);H[b+44>>2]=d;if(!d){break b}f=H[b+8>>2];g=H[b+12>>2];if((f|0)==(e|0)&(g|0)==(c|0)){break f}f=N(f,g)<<2;if(!f){break f}y(d,0,f)}if(!c){break c}g=c&1;e=e<<2;h=H[b+44>>2]+(l<<2)|0;d=(i<<2)+v|0;if((c|0)!=1){i=c&2147483646;c=0;while(1){l=!e;if(!l){B(h,d,e)}n=p<<2;d=n+d|0;f=(H[b+8>>2]<<2)+h|0;if(!l){B(f,d,e)}d=d+n|0;h=f+(H[b+8>>2]<<2)|0;c=c+2|0;if((i|0)!=(c|0)){continue}break}}if(!g|!e){break c}B(h,d,e)}o=o+76|0;r=r+52|0;b=b+52|0;h=1;w=w+1|0;if(w>>>0>2]){continue}}break}return h}function Bb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0;if(a){a:{if(H[a>>2]){b=H[a+12>>2];if(b){mb(b);Da(H[a+12>>2]);H[a+12>>2]=0}b=H[a+16>>2];if(b){Da(b);H[a+16>>2]=0;H[a+20>>2]=0}Da(H[a+64>>2]);H[a+60>>2]=0;H[a+64>>2]=0;Da(H[a+72>>2]);H[a+72>>2]=0;Da(H[a+88>>2]);H[a+88>>2]=0;break a}b=H[a+44>>2];if(b){Da(b);H[a+44>>2]=0}b=H[a+32>>2];if(b){Da(b);H[a+32>>2]=0;H[a+36>>2]=0}b=H[a+52>>2];if(!b){break a}Da(b);H[a+52>>2]=0;H[a+56>>2]=0}dc(H[a+232>>2]);b=H[a+180>>2];if(b){e=N(H[a+128>>2],H[a+132>>2]);if(e){while(1){mb(b);b=b+5644|0;c=c+1|0;if((e|0)!=(c|0)){continue}break}b=H[a+180>>2]}Da(b);H[a+180>>2]=0}b=H[a+140>>2];if(b){c=H[a+136>>2];if(c){b=0;while(1){e=H[H[a+140>>2]+(b<<3)>>2];if(e){Da(e);c=H[a+136>>2]}b=b+1|0;if(c>>>0>b>>>0){continue}break}b=H[a+140>>2]}H[a+136>>2]=0;Da(b);H[a+140>>2]=0}Da(H[a+160>>2]);H[a+144>>2]=0;H[a+160>>2]=0;Da(H[a+124>>2]);H[a+124>>2]=0;if(!(I[a+212|0]&2)){Da(H[a+192>>2])}y(a+104|0,0,112);sb(H[a+216>>2]);H[a+216>>2]=0;sb(H[a+220>>2]);H[a+216>>2]=0;d=H[a+224>>2];if(d){b=H[d+28>>2];if(b){Da(b);H[d+28>>2]=0}c=H[d+40>>2];if(c){if(H[d+36>>2]){while(1){e=N(g,40);b=H[(e+c|0)+36>>2];if(b){Da(b);c=H[d+40>>2];H[(e+c|0)+36>>2]=0}b=H[(c+e|0)+16>>2];if(b){Da(b);c=H[d+40>>2];H[(e+c|0)+16>>2]=0}b=H[(c+e|0)+24>>2];if(b){Da(b);c=H[d+40>>2];H[(e+c|0)+24>>2]=0}g=g+1|0;if(g>>>0>2]){continue}break}}Da(c);H[d+40>>2]=0}Da(d)}H[a+224>>2]=0;Va(H[a+96>>2]);H[a+96>>2]=0;Va(H[a+100>>2]);H[a+100>>2]=0;f=H[a+236>>2];if(f){b:{if(!H[f+8>>2]){break b}if(H[f+12>>2]){H[f+40>>2]=0;while(1){if(H[f+24>>2]>0){continue}break}}H[f+16>>2]=1;Da(H[f>>2]);c=H[f+28>>2];if(!c){break b}while(1){b=H[c+4>>2];Da(c);H[f+28>>2]=b;c=b;if(b){continue}break}}d=H[f+36>>2];if(d){g=H[d+4>>2];if((g|0)>0){b=0;while(1){e=H[d>>2]+N(b,12)|0;c=H[e+8>>2];if(c){sa[c|0](H[e+4>>2]);g=H[d+4>>2]}b=b+1|0;if((g|0)>(b|0)){continue}break}}Da(H[d>>2]);Da(d)}Da(f)}H[a+236>>2]=0;Da(a)}}function ke(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;g=oa-16|0;oa=g;if(H[a+8>>2]==16){h=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{h=H[a+12>>2]}a:{if(!c){Ca(d,1,4259,0);break a}i=H[a+96>>2];e=1;Ea(b,g+8|0,1);f=H[g+8>>2];if(f>>>0>=2){Ca(d,2,9792,0);break a}if((f+1|0)!=(c|0)){e=0;Ca(d,2,4259,0);break a}d=H[i+16>>2];b:{if(!d){break b}e=H[h+5584>>2];if(d>>>0>=8){i=d&-8;c=0;while(1){H[e+8636>>2]=0;H[e+7556>>2]=0;H[e+6476>>2]=0;H[e+5396>>2]=0;H[e+4316>>2]=0;H[e+3236>>2]=0;H[e+2156>>2]=0;H[e+1076>>2]=0;e=e+8640|0;c=c+8|0;if((i|0)!=(c|0)){continue}break}}d=d&7;if(!d){break b}c=0;while(1){H[e+1076>>2]=0;e=e+1080|0;c=c+1|0;if((d|0)!=(c|0)){continue}break}}c=H[h+5608>>2];if(c){Da(c);H[h+5608>>2]=0;f=H[g+8>>2]}if(!f){e=1;break a}i=0;while(1){b=b+1|0;Ea(b,g+12|0,1);c:{if(!H[h+5632>>2]){break c}d=H[h+5628>>2];if(H[d>>2]!=H[g+12>>2]){break c}f=H[d+4>>2];j=H[a+96>>2];if((f|0)!=H[j+16>>2]){break c}c=H[d+8>>2];if(c){e=0;f=N(f,f);if(H[c+16>>2]!=(N(f,H[(H[c>>2]<<2)+24896>>2])|0)){break a}k=Ga(f<<2);H[h+5608>>2]=k;if(!k){break a}sa[H[(H[c>>2]<<2)+25200>>2]](H[c+12>>2],k,f)}c=H[d+12>>2];if(!c){break c}e=0;d=H[j+16>>2];if(H[c+16>>2]!=(N(d,H[(H[c>>2]<<2)+24896>>2])|0)){break a}f=Ga(d<<2);if(!f){break a}sa[H[(H[c>>2]<<2)+25216>>2]](H[c+12>>2],f,d);c=H[j+16>>2];d:{if(!c){break d}j=c&7;e=H[h+5584>>2];e:{if(c>>>0<8){c=f;break e}k=c&-8;d=0;c=f;while(1){H[e+1076>>2]=H[c>>2];H[e+2156>>2]=H[c+4>>2];H[e+3236>>2]=H[c+8>>2];H[e+4316>>2]=H[c+12>>2];H[e+5396>>2]=H[c+16>>2];H[e+6476>>2]=H[c+20>>2];H[e+7556>>2]=H[c+24>>2];H[e+8636>>2]=H[c+28>>2];e=e+8640|0;c=c+32|0;d=d+8|0;if((k|0)!=(d|0)){continue}break}}d=0;if(!j){break d}while(1){H[e+1076>>2]=H[c>>2];e=e+1080|0;c=c+4|0;d=d+1|0;if((j|0)!=(d|0)){continue}break}}Da(f)}e=1;i=i+1|0;if(i>>>0>2]){continue}break}}oa=g+16|0;return e|0}function Cb(a,b,c,d,e,f,g,h){var i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;m=H[H[a+24>>2]+24>>2]+N(b,52)|0;l=H[m+4>>2];k=l-1|0;o=H[a+60>>2];j=k+o|0;p=0-!l|0;i=p;r=H[H[H[a+20>>2]>>2]+20>>2]+N(b,76)|0;n=H[r+12>>2];i=Ke(j,j>>>0>>0?i+1|0:i,l,0);q=i>>>0>n>>>0?n:i;j=H[m>>2];m=j-1|0;s=H[a+56>>2];n=m+s|0;o=0-!j|0;i=o;t=H[r+8>>2];i=Ke(n,n>>>0>>0?i+1|0:i,j,0);n=i>>>0>t>>>0?t:i;i=p;t=H[r+4>>2];s=H[a+52>>2];k=s+k|0;i=Ke(k,k>>>0>>0?i+1|0:i,l,0);k=i>>>0>>0?t:i;i=o;p=H[r>>2];l=m;m=H[a+48>>2];l=l+m|0;i=Ke(l,l>>>0>>0?i+1|0:i,j,0);i=i>>>0

>>0?p:i;l=0;p=H[(H[H[a+32>>2]+5584>>2]+N(b,1080)|0)+20>>2];c=H[r+20>>2]+(c?0-c|0:-1)|0;a:{if(!c){a=n;l=i;b=k;break a}m=c-1|0;j=(d&1)<>>0>>0){a=c&31;l=i-j|0;if((c&63)>>>0>=32){i=-1<>>32-a;a=-1<>>0>>0?i+1|0:i;b=a;a=c&31;if((c&63)>>>0>=32){l=i>>>a|0}else{l=((1<>>a}}a=0;b=0;d=d>>>1<>>0>>0){b=c&31;o=k-d|0;if((c&63)>>>0>=32){i=-1<>>32-b;b=-1<>>0>>0?i+1|0:i;k=b;b=c&31;if((c&63)>>>0>=32){b=i>>>b|0}else{b=((1<>>b}}if(j>>>0>>0){a=c&31;k=n-j|0;if((c&63)>>>0>=32){i=-1<>>32-a;a=-1<>>0>>0?i+1|0:i;j=a;a=c&31;if((c&63)>>>0>=32){a=i>>>a|0}else{a=((1<>>a}}if(d>>>0>=q>>>0){q=0;break a}k=q-d|0;d=c&31;if((c&63)>>>0>=32){i=-1<>>32-d;d=-1<>>0>>0?i+1|0:i;j=d;d=c&31;if((c&63)>>>0>=32){q=i>>>d|0}else{q=((1<>>d}}c=(p|0)==1?2:3;d=c+a|0;d=(a>>>0>d>>>0?-1:d)>>>0>e>>>0;a=c+q|0;d=d&(a>>>0>>0?-1:a)>>>0>f>>>0;a=l-c|0;d=d&(a>>>0<=l>>>0?a:0)>>>0>>0;a=b-c|0;return d&(a>>>0<=b>>>0?a:0)>>>0>>0}function Ee(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;e=oa-80|0;oa=e;H[e+76>>2]=1;k=H[a+44>>2];d=H[H[a+224>>2]+40>>2];a:{b:{if(!d|!H[d+16>>2]){break b}c:{d=d+N(k,40)|0;if(!H[d+4>>2]){d=H[a+52>>2];f=H[a+48>>2]+2|0;d=f>>>0<2?d+1|0:d;if(fb(b,f,d,c)){break c}Ca(c,1,5440,0);break a}d=H[d+16>>2];if(!fb(b,H[d>>2],H[d+4>>2],c)){Ca(c,1,5440,0);break a}if((Ka(b,H[a+16>>2],2,c)|0)!=2){Ca(c,1,2472,0);break a}Ea(H[a+16>>2],e+72|0,2);if(H[e+72>>2]==65424){break c}Ca(c,1,4073,0);break a}if(H[a+8>>2]!=256){break b}H[a+8>>2]=8}h=N(H[a+132>>2],H[a+128>>2]);d:{if(!h){break d}f=H[a+180>>2];d=0;if(h>>>0>=8){i=h&-8;while(1){H[(f+N(d,5644)|0)+5588>>2]=-1;H[(f+N(d|1,5644)|0)+5588>>2]=-1;H[(f+N(d|2,5644)|0)+5588>>2]=-1;H[(f+N(d|3,5644)|0)+5588>>2]=-1;H[(f+N(d|4,5644)|0)+5588>>2]=-1;H[(f+N(d|5,5644)|0)+5588>>2]=-1;H[(f+N(d|6,5644)|0)+5588>>2]=-1;H[(f+N(d|7,5644)|0)+5588>>2]=-1;d=d+8|0;j=j+8|0;if((i|0)!=(j|0)){continue}break}}h=h&7;if(!h){break d}while(1){H[(f+N(d,5644)|0)+5588>>2]=-1;d=d+1|0;g=g+1|0;if((h|0)!=(g|0)){continue}break}}g=0;if(!Za(a,e+72|0,0,e+68|0,e- -64|0,e+60|0,e+56|0,e+52|0,e+76|0,b,c)){break a}h=k+1|0;while(1){e:{if(!H[e+76>>2]){break e}d=H[e+72>>2];if(!gb(a,d,0,0,b,c)){break a}i=H[a+128>>2];j=H[a+132>>2];f=d+1|0;H[e+32>>2]=f;H[e+36>>2]=N(i,j);Ca(c,4,11795,e+32|0);if(!Sc(H[a+232>>2],H[H[a+100>>2]+24>>2])){break a}g=H[a+180>>2]+N(d,5644)|0;i=H[g+5596>>2];if(i){Da(i);H[g+5596>>2]=0;H[g+5600>>2]=0}H[e+16>>2]=f;Ca(c,4,16601,e+16|0);if((d|0)==(k|0)){d=H[a+224>>2];f=H[d+8>>2];d=H[d+12>>2];f=f+2|0;d=f>>>0<2?d+1|0:d;if(fb(b,f,d,c)){break e}g=0;Ca(c,1,5440,0);break a}H[e+4>>2]=h;H[e>>2]=f;Ca(c,2,13648,e);g=0;if(Za(a,e+72|0,0,e+68|0,e- -64|0,e+60|0,e+56|0,e+52|0,e+76|0,b,c)){continue}break a}break}g=Rc(a,c)}oa=e+80|0;return g|0}function qc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;j=oa-256|0;oa=j;a:{if(!a){a=0;break a}if(!(H[a>>2]==(b|0)&H[a+4>>2]==(c|0))){H[a+4>>2]=c;H[a>>2]=b;H[j>>2]=c;H[j+128>>2]=b;e=c;g=b;while(1){o=i;i=i+1|0;h=i<<2;n=(e+1|0)/2|0;H[h+j>>2]=n;k=h+(j+128|0)|0;h=(g+1|0)/2|0;H[k>>2]=h;m=N(e,g);f=m+f|0;e=n;g=h;if(m>>>0>1){continue}break}H[a+8>>2]=f;b:{c:{d:{if(!f){b=H[a+12>>2];if(!b){break d}Da(b);H[a+12>>2]=0;break d}e=f<<4;if(e>>>0<=K[a+16>>2]){break b}f=Ia(H[a+12>>2],e);if(f){break c}Ca(d,1,6451,0);b=H[a+12>>2];if(!b){break d}Da(b);H[a+12>>2]=0}Da(a);a=0;break a}H[a+12>>2]=f;c=H[a+16>>2];b=e-c|0;if(b){y(c+f|0,0,b)}H[a+16>>2]=e;c=H[a+4>>2];b=H[a>>2]}g=H[a+12>>2];if(o){d=0;e=(N(b,c)<<4)+g|0;f=e;while(1){b=d<<2;k=H[b+j>>2];e:{if((k|0)<=0){break e}m=k-1|0;l=0;f:{g:{c=H[b+(j+128|0)>>2];if((c|0)<=0){n=k&1;i=0;if((k|0)!=1){break g}b=f;break f}while(1){b=f;f=c;while(1){h:{H[g>>2]=e;if((f|0)==1){g=g+16|0;e=e+16|0;break h}H[g+16>>2]=e;e=e+16|0;g=g+32|0;h=(f|0)>2;f=f-2|0;if(h){continue}}break}h=((l|0)==(m|0)|l)&1;f=h?e:b+(c<<4)|0;e=h?e:b;l=l+1|0;if((k|0)!=(l|0)){continue}break}break e}h=k&2147483646;while(1){b=(i|0)==(m|0);i=i+2|0;e=b?e:f;f=e;b=e;l=l+2|0;if((h|0)!=(l|0)){continue}break}}if(!n){f=e;break e}f=(c<<4)+b|0;c=((i|0)==(m|0)|i)&1;f=c?e:f;e=c?e:b}d=d+1|0;if((o|0)!=(d|0)){continue}break}}H[g>>2]=0}c=H[a+8>>2];if(!c){break a}e=H[a+12>>2];if(c>>>0>=4){b=c&-4;g=0;while(1){H[e+60>>2]=0;H[e+52>>2]=999;H[e+56>>2]=0;H[e+44>>2]=0;H[e+36>>2]=999;H[e+40>>2]=0;H[e+28>>2]=0;H[e+20>>2]=999;H[e+24>>2]=0;H[e+12>>2]=0;H[e+4>>2]=999;H[e+8>>2]=0;e=e- -64|0;g=g+4|0;if((b|0)!=(g|0)){continue}break}}b=c&3;if(!b){break a}g=0;while(1){H[e+12>>2]=0;H[e+4>>2]=999;H[e+8>>2]=0;e=e+16|0;g=g+1|0;if((b|0)!=(g|0)){continue}break}}oa=j+256|0;return a}function ob(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=H[a+16>>2];if(g>>>0>=32){return H[a+8>>2]}d=H[a+20>>2];a:{if((d|0)>=4){b=H[a>>2];c=H[b-3>>2];d=d-4|0;H[a+20>>2]=d;H[a>>2]=b-4;break a}if((d|0)<=0){break a}k=d&1;b=H[a>>2];b:{if((d|0)==1){e=24;break b}j=d&2147483646;e=24;while(1){h=b-1|0;H[a>>2]=h;i=I[b|0];b=b-2|0;H[a>>2]=b;H[a+20>>2]=d-1;h=I[h|0];d=d-2|0;H[a+20>>2]=d;c=i<>2]=b-1;b=I[b|0];H[a+20>>2]=d-1;c=b<>2];j=c&255;H[a+24>>2]=j>>>0>143;b=b?(c&2130706432)==2130706432?7:8:8;h=b+(c>>>0<=2415919103?8:(c&8323072)==8323072?7:8)|0;f=c>>>16&255;i=h+(f>>>0<=143?8:(c&32512)==32512?7:8)|0;e=c>>>8&255;k=i+(g+(e>>>0<=143?8:(c&127)==127?7:8)|0)|0;H[a+16>>2]=k;l=H[a+12>>2];b=f<>>24|e<>>0>=32){e=b<>>32-c;b=b<>2];b=e|l;h=b;H[a+8>>2]=g;H[a+12>>2]=b;if(k>>>0<=31){c:{if((d|0)>=4){b=H[a>>2];c=H[b-3>>2];H[a+20>>2]=d-4;H[a>>2]=b-4;break c}if((d|0)<=0){c=0;break c}i=d&1;b=H[a>>2];d:{if((d|0)==1){e=24;c=0;break d}l=d&2147483646;e=24;c=0;f=0;while(1){m=b-1|0;H[a>>2]=m;n=I[b|0];b=b-2|0;H[a>>2]=b;H[a+20>>2]=d-1;m=I[m|0];d=d-2|0;H[a+20>>2]=d;c=n<>2]=b-1;b=I[b|0];H[a+20>>2]=d-1;c=b<>2]=d>>>0>143;j=j>>>0<=143?8:(c&2130706432)==2130706432?7:8;i=j+(c>>>0<=2415919103?8:(c&8323072)==8323072?7:8)|0;f=c>>>16&255;l=i+(f>>>0<=143?8:(c&32512)==32512?7:8)|0;e=c>>>8&255;H[a+16>>2]=l+((e>>>0<=143?8:(c&127)==127?7:8)+k|0);b=a;a=f<>>24|e<>>0>=32){d=a<>>32-c;a=a<>2]=g;H[b+12>>2]=d|h}return g}function _c(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=H[a+96>>2];l=N(H[a+128>>2],H[a+132>>2]);a:{if(l){b=H[j+16>>2];m=N(b,1080);k=N(b,b)<<2;e=H[a+12>>2];b=H[a+180>>2];while(1){n=H[b+5584>>2];B(b,e,5644);H[b+5608>>2]=0;H[b+5588>>2]=-1;H[b+5168>>2]=0;H[b+5636>>2]=0;H[b+5616>>2]=0;H[b+5624>>2]=0;H[b+5628>>2]=0;H[b+5584>>2]=n;F[b+5640|0]=I[b+5640|0]&252;b:{if(!H[e+5608>>2]){break b}d=Ga(k);H[b+5608>>2]=d;if(!d){return 0}if(!k){break b}B(d,H[e+5608>>2],k)}d=N(H[e+5624>>2],20);f=Ga(d);H[b+5616>>2]=f;i=0;if(!f){break a}if(d){B(f,H[e+5616>>2],d)}g=H[e+5620>>2];if(g){d=H[e+5616>>2];f=H[b+5616>>2];h=0;while(1){if(H[d+12>>2]){g=Ga(H[d+16>>2]);H[f+12>>2]=g;if(!g){return 0}o=H[d+16>>2];if(o){B(g,H[d+12>>2],o)}g=H[e+5620>>2]}H[b+5624>>2]=H[b+5624>>2]+1;f=f+20|0;d=d+20|0;h=h+1|0;if(h>>>0>>0){continue}break}}d=N(H[e+5636>>2],20);f=Ga(d);H[b+5628>>2]=f;if(!f){break a}if(d){B(f,H[e+5628>>2],d)}i=H[e+5636>>2];H[b+5636>>2]=i;if(i){d=H[e+5628>>2];f=H[b+5628>>2];h=0;while(1){g=H[d+8>>2];if(g){H[f+8>>2]=H[b+5616>>2]+(g-H[e+5616>>2]|0)}g=H[d+12>>2];if(g){H[f+12>>2]=H[b+5616>>2]+(g-H[e+5616>>2]|0)}f=f+20|0;d=d+20|0;h=h+1|0;if((i|0)!=(h|0)){continue}break}}if(m){B(n,H[e+5584>>2],m)}b=b+5644|0;p=p+1|0;if((p|0)!=(l|0)){continue}break}}i=1;e=Fa(1,72);b=0;c:{if(!e){break c}F[e+40|0]=I[e+40|0]&254|1;d=Fa(1,4);H[e+20>>2]=d;b=e;if(d){break c}Da(b);b=0}H[a+232>>2]=b;if(!b){return 0}f=H[a+236>>2];e=0;H[b+28>>2]=a+104;H[b+24>>2]=j;d=Fa(1,848);H[H[b+20>>2]>>2]=d;d:{if(!d){break d}d=Fa(H[j+16>>2],76);h=H[H[b+20>>2]>>2];H[h+20>>2]=d;if(!d){break d}H[h+16>>2]=H[j+16>>2];e=H[a+188>>2];H[b+44>>2]=f;H[b>>2]=e;e=1}if(e){break a}dc(H[a+232>>2]);i=0;H[a+232>>2]=0;Ca(c,1,3668,0)}return i|0}function Na(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;h=H[a+16>>2];if(h>>>0>=32){return H[a+8>>2]}d=H[a+24>>2];a:{if((d|0)>=4){b=H[a>>2];c=H[b>>2];g=d-4|0;H[a+24>>2]=g;H[a>>2]=b+4;break a}c=H[a+28>>2]?-1:0;if((d|0)<=0){g=d;break a}j=d&1;b=H[a>>2];b:{if((d|0)==1){f=b;break b}i=d&2147483646;while(1){H[a>>2]=b+1;k=I[b|0];f=b+2|0;H[a>>2]=f;H[a+24>>2]=d-1;b=I[b+1|0];d=d-2|0;H[a+24>>2]=d;c=((255<>2]=f+1;b=I[f|0];H[a+24>>2]=d-1;c=(255<>2];i=c>>>24|0;H[a+20>>2]=(i|0)==255;f=c>>>16&255;d=c>>>8&255;b=b?7:8;c=c&255;e=b+((c|0)==255?7:8)|0;k=((d|0)==255?7:8)+e|0;j=(h+((f|0)==255?7:8)|0)+k|0;H[a+16>>2]=j;l=H[a+12>>2];b=c|(d<>>0>=32){f=b<>>32-c;b=b<>2];b=f|l;k=b;H[a+8>>2]=h;H[a+12>>2]=b;if(j>>>0<=31){c:{if((g|0)>=4){b=H[a>>2];d=H[b>>2];H[a+24>>2]=g-4;H[a>>2]=b+4;break c}e=0;d=H[a+28>>2]?-1:0;if((g|0)<=0){break c}l=g&1;b=H[a>>2];d:{if((g|0)==1){c=b;break d}m=g&2147483646;f=0;while(1){H[a>>2]=b+1;n=I[b|0];c=b+2|0;H[a>>2]=c;H[a+24>>2]=g-1;b=I[b+1|0];g=g-2|0;H[a+24>>2]=g;d=((255<>2]=c+1;b=I[c|0];H[a+24>>2]=g-1;d=(255<>>24|0;H[a+20>>2]=(c|0)==255;f=d>>>16&255;g=d>>>8&255;e=(i|0)==255?7:8;d=d&255;i=e+((d|0)==255?7:8)|0;l=((g|0)==255?7:8)+i|0;H[a+16>>2]=(((f|0)==255?7:8)+j|0)+l;b=a;a=d|(g<>>0>=32){f=a<>>32-c;a=a<>2]=h;H[b+12>>2]=f|k}return h}function Wc(a,b,c,d,e){var f=0,g=0,h=0,i=0,j=0,k=0;i=oa-32|0;oa=i;if(H[a+8>>2]==16){f=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{f=H[a+12>>2]}a:{if(K[d>>2]<=4){a=0;Ca(e,1,2607,0);break a}f=H[f+5584>>2]+N(b,1080)|0;Ea(c,f+4|0,1);h=H[f+4>>2]+1|0;H[f+4>>2]=h;if(h>>>0>=34){H[i+4>>2]=33;H[i>>2]=h;Ca(e,1,7635,i);a=0;break a}g=H[a+184>>2];if(g>>>0>=h>>>0){H[i+24>>2]=h;H[i+20>>2]=g;H[i+16>>2]=b;Ca(e,1,16423,i+16|0);H[a+8>>2]=H[a+8>>2]|32768;a=0;break a}Ea(c+1|0,f+8|0,1);H[f+8>>2]=H[f+8>>2]+2;Ea(c+2|0,f+12|0,1);a=H[f+12>>2]+2|0;H[f+12>>2]=a;b=H[f+8>>2];if(!(!(b>>>0>10|a>>>0>10)&a+b>>>0<13)){a=0;Ca(e,1,5468,0);break a}Ea(c+3|0,f+16|0,1);if(I[f+16|0]&128){a=0;Ca(e,1,6564,0);break a}Ea(c+4|0,f+20|0,1);if(K[f+20>>2]>=2){a=0;Ca(e,1,6499,0);break a}b=H[d>>2]-5|0;H[d>>2]=b;a=1;h=H[f+4>>2];if(!(F[f|0]&1)){if(!h){break a}d=f+944|0;e=f+812|0;b=0;c=0;if(h>>>0>=4){k=h&-4;g=0;while(1){f=c<<2;H[f+e>>2]=15;H[d+f>>2]=15;j=f|4;H[j+e>>2]=15;H[d+j>>2]=15;j=f|8;H[j+e>>2]=15;H[d+j>>2]=15;f=f|12;H[f+e>>2]=15;H[d+f>>2]=15;c=c+4|0;g=g+4|0;if((k|0)!=(g|0)){continue}break}}f=h&3;if(!f){break a}while(1){a=c<<2;H[a+e>>2]=15;H[a+d>>2]=15;a=1;c=c+1|0;b=b+1|0;if((f|0)!=(b|0)){continue}break}break a}if(b>>>0>=h>>>0){b:{if(!h){g=0;break b}Ea(c+5|0,i+28|0,1);a=H[i+28>>2];H[f+944>>2]=a>>>4;H[f+812>>2]=a&15;g=H[f+4>>2];if(g>>>0>=2){h=f+944|0;k=f+812|0;a=c+6|0;c=1;while(1){Ea(a,i+28|0,1);c:{b=H[i+28>>2];if(b>>>0>=16){g=b&15;if(g){break c}}a=0;Ca(e,1,6025,0);break a}j=c<<2;H[j+k>>2]=g;H[h+j>>2]=b>>>4;a=a+1|0;c=c+1|0;g=H[f+4>>2];if(c>>>0>>0){continue}break}}b=H[d>>2]}H[d>>2]=b-g;a=1;break a}a=0;Ca(e,1,2607,0)}oa=i+32|0;return a}function Ce(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;f=oa-16|0;oa=f;H[f+12>>2]=c;j=H[a+96>>2];if(H[a+8>>2]==16){e=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{e=H[a+12>>2]}F[e+5640|0]=I[e+5640|0]|1;a:{if(c>>>0<=4){c=0;Ca(d,1,4565,0);break a}Ea(b,e,1);if(K[e>>2]>=8){c=0;Ca(d,1,4531,0);break a}Ea(b+1|0,f+8|0,1);c=H[f+8>>2];H[e+4>>2]=c;if((c|0)>=5){Ca(d,1,4490,0);H[e+4>>2]=-1}Ea(b+2|0,e+8|0,2);l=H[e+8>>2];if(l-65536>>>0<=4294901760){H[f>>2]=l;Ca(d,1,8111,f);c=0;break a}c=H[a+188>>2];H[e+12>>2]=c?c:l;Ea(b+4|0,e+16|0,1);if(K[e+16>>2]>=2){c=0;Ca(d,1,5536,0);break a}o=b+5|0;H[f+12>>2]=H[f+12>>2]-5;m=H[j+16>>2];b:{if(!m){break b}g=H[e>>2]&1;h=H[e+5584>>2];b=0;if(m>>>0>=8){p=h+7560|0;q=h+6480|0;r=h+5400|0;s=h+4320|0;l=h+3240|0;j=h+2160|0;e=h+1080|0;c=m&-8;while(1){i=N(b,1080);H[i+h>>2]=g;H[e+i>>2]=g;H[j+i>>2]=g;H[i+l>>2]=g;H[i+s>>2]=g;H[i+r>>2]=g;H[i+q>>2]=g;H[i+p>>2]=g;b=b+8|0;k=k+8|0;if((c|0)!=(k|0)){continue}break}}c=m&7;if(!c){break b}while(1){H[N(b,1080)+h>>2]=g;b=b+1|0;n=n+1|0;if((c|0)!=(n|0)){continue}break}}c=0;if(!Wc(a,0,o,f+12|0,d)){Ca(d,1,4565,0);break a}if(H[f+12>>2]){Ca(d,1,4565,0);break a}if(H[a+8>>2]==16){b=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{b=H[a+12>>2]}if(K[H[a+96>>2]+16>>2]>=2){b=H[b+5584>>2];j=H[b+4>>2]<<2;n=b+944|0;e=b+812|0;k=1;c=b;while(1){H[c+1084>>2]=H[b+4>>2];H[c+1088>>2]=H[b+8>>2];H[c+1092>>2]=H[b+12>>2];H[c+1096>>2]=H[b+16>>2];H[c+1100>>2]=H[b+20>>2];d=!j;if(!d){B(c+1892|0,e,j)}if(!d){B(c+2024|0,n,j)}c=c+1080|0;k=k+1|0;if(k>>>0>2]+16>>2]){continue}break}}c=1}oa=f+16|0;return c|0}function jc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;H[a+8>>2]=0;H[a+12>>2]=0;H[a>>2]=b;H[a+28>>2]=d;H[a+16>>2]=0;H[a+20>>2]=0;h=c-1|0;H[a+24>>2]=h;n=b&3;a:{if((c|0)<=0){e=b;b=d;break a}e=b+1|0;H[a>>2]=e;b=I[b|0]}g=b;i=8;H[a+16>>2]=8;j=(g|0)==255;H[a+20>>2]=j;H[a+8>>2]=g;H[a+12>>2]=0;b:{if((n|0)==3){break b}k=c-2|0;H[a+24>>2]=k;c:{if((c|0)<2){b=e;e=d;break c}b=e+1|0;H[a>>2]=b;e=I[e|0]}j=(e|0)==255;H[a+20>>2]=j;i=(g|0)==255?15:16;H[a+16>>2]=i;g=g|e<<8;H[a+8>>2]=g;H[a+12>>2]=0;if((n|0)==2){e=b;c=h;h=k;break b}o=c-3|0;H[a+24>>2]=o;d:{if((c|0)<3){f=b;b=d;break d}f=b+1|0;H[a>>2]=f;b=I[b|0]}j=(b|0)==255;H[a+20>>2]=j;l=((e|0)==255?7:8)+i|0;H[a+16>>2]=l;e=i&31;if((i&63)>>>0>=32){m=b<>>32-e;e=b<>2]=g;H[a+12>>2]=m;if((n|0)==1){e=f;i=l;c=k;h=o;break b}h=c-4|0;H[a+24>>2]=h;e:{if((c|0)<4){e=f;c=d;break e}e=f+1|0;H[a>>2]=e;c=I[f|0]}j=(c|0)==255;H[a+20>>2]=j;i=l+((b|0)==255?7:8)|0;H[a+16>>2]=i;b=l&31;if((l&63)>>>0>=32){f=c<>>32-b;b=c<>2]=g;H[a+12>>2]=b;c=o}f:{if((c|0)>=5){d=H[e>>2];H[a+24>>2]=c-5;H[a>>2]=e+4;break f}b=0;d=d?-1:0;if((c|0)<2){break f}while(1){c=e+1|0;H[a>>2]=c;e=I[e|0];f=h-1|0;H[a+24>>2]=f;d=(255<>>0>1;e=c;h=f;if(k){continue}break}}b=d>>>24|0;H[a+20>>2]=(b|0)==255;c=d>>>16&255;e=d>>>8&255;h=j?7:8;d=d&255;f=h+((d|0)==255?7:8)|0;k=((e|0)==255?7:8)+f|0;H[a+16>>2]=(((c|0)==255?7:8)+i|0)+k;b=d|(e<>>0>=32){d=a<>>32-b;a=a<>2]=a|g;H[c+12>>2]=d|m}function Ab(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;j=oa-32|0;oa=j;p=H[a+16>>2];a:{if(!p){k=1;break a}d=H[a>>2];c=d>>31;h=c;b:{if((c|0)<0){break b}e=H[a+4>>2];c=e>>31;l=c;if((c|0)<0){break b}f=H[a+8>>2];c=f>>31;m=c;if((c|0)<0){break b}i=H[a+12>>2];c=i>>31;if((c|0)<0){break b}a=H[a+24>>2];s=d-1|0;t=h-!d|0;u=e-1|0;v=l-!e|0;w=f-1|0;x=m-!f|0;y=i-1|0;z=c-!i|0;while(1){c=t;d=H[a>>2];e=d+s|0;c=d>>>0>e>>>0?c+1|0:c;h=Ke(e,c,d,0);H[a+16>>2]=h;c=v;e=H[a+4>>2];f=e+u|0;c=e>>>0>f>>>0?c+1|0:c;l=Ke(f,c,e,0);H[a+20>>2]=l;i=H[a+40>>2];f=i&31;if((i&63)>>>0>=32){c=1<>>32-f}n=g;k=c;f=n-1|0;c=c-!n|0;m=c;q=d>>31;g=q+x|0;r=d+w|0;g=r>>>0>>0?g+1|0:g;d=Je(r,g,d,q);c=(d>>31)+c|0;g=d;d=d+f|0;c=g>>>0>d>>>0?c+1|0:c;g=d;d=i&31;if((i&63)>>>0>=32){d=c>>d}else{d=((1<>>d}c=(h>>31)+m|0;g=h;h=f+h|0;c=g>>>0>h>>>0?c+1|0:c;g=d;d=i&31;if((i&63)>>>0>=32){c=c>>d}else{c=((1<>>d}c=g-c|0;if((c|0)<0){H[j+4>>2]=c;H[j>>2]=o;Ca(b,1,13510,j);k=0;break a}H[a+8>>2]=c;d=e>>31;c=d+z|0;h=e+y|0;c=h>>>0>>0?c+1|0:c;d=Je(h,c,e,d);c=(d>>31)+m|0;e=d;d=d+f|0;c=e>>>0>d>>>0?c+1|0:c;e=d;d=i&31;if((i&63)>>>0>=32){e=c>>d}else{e=((1<>>d}c=k+(l>>31)|0;d=l+n|0;c=d>>>0>>0?c+1|0:c;f=d-1|0;h=e;d=c-!d|0;e=f;c=i&31;if((i&63)>>>0>=32){c=d>>c}else{c=((1<>>c}c=h-c|0;if((c|0)<0){H[j+20>>2]=c;H[j+16>>2]=o;Ca(b,1,13579,j+16|0);k=0;break a}H[a+12>>2]=c;a=a+52|0;k=1;o=o+1|0;if((p|0)!=(o|0)){continue}break}break a}Ca(b,1,6720,0)}oa=j+32|0;return k}function sc(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;j=oa-256|0;oa=j;f=Fa(1,20);a:{if(!f){Ca(c,1,6413,0);f=0;break a}H[f+4>>2]=b;H[f>>2]=a;H[j>>2]=b;H[j+128>>2]=a;while(1){p=g;g=g+1|0;h=g<<2;d=(b+1|0)/2|0;H[h+j>>2]=d;m=h+(j+128|0)|0;h=(a+1|0)/2|0;H[m>>2]=h;i=N(a,b);e=i+e|0;b=d;a=h;if(i>>>0>1){continue}break}H[f+8>>2]=e;if(!e){Da(f);f=0;break a}d=Fa(e,16);H[f+12>>2]=d;if(!d){Ca(c,1,3564,0);Da(f);f=0;break a}l=H[f+8>>2];H[f+16>>2]=l<<4;a=d;if(p){e=(N(H[f+4>>2],H[f>>2])<<4)+d|0;b=e;while(1){c=n<<2;i=H[c+j>>2];b:{if((i|0)<=0){break b}o=i-1|0;h=0;c:{c=H[c+(j+128|0)>>2];if((c|0)<=0){g=0;if((i|0)!=1){k=i&2147483646;while(1){m=(g|0)==(o|0);g=g+2|0;e=m?b:e;b=e;h=h+2|0;if((k|0)!=(h|0)){continue}break}}if(i&1){break c}b=e;break b}while(1){g=e;e=c;while(1){d:{H[a>>2]=b;if((e|0)==1){a=a+16|0;b=b+16|0;break d}H[a+16>>2]=b;b=b+16|0;a=a+32|0;k=(e|0)>2;e=e-2|0;if(k){continue}}break}k=((h|0)==(o|0)|h)&1;e=k?b:g+(c<<4)|0;b=k?b:g;h=h+1|0;if((i|0)!=(h|0)){continue}break}break b}g=((g|0)==(o|0)|g)&1;c=g?b:(c<<4)+e|0;b=g?b:e;e=c}n=n+1|0;if((n|0)!=(p|0)){continue}break}}H[a>>2]=0;e:{if(!l){break e}if(l>>>0>=4){a=l&-4;b=0;while(1){H[d+60>>2]=0;H[d+52>>2]=999;H[d+56>>2]=0;H[d+44>>2]=0;H[d+36>>2]=999;H[d+40>>2]=0;H[d+28>>2]=0;H[d+20>>2]=999;H[d+24>>2]=0;H[d+12>>2]=0;H[d+4>>2]=999;H[d+8>>2]=0;d=d- -64|0;b=b+4|0;if((a|0)!=(b|0)){continue}break}}a=l&3;if(!a){break e}b=0;while(1){H[d+12>>2]=0;H[d+4>>2]=999;H[d+8>>2]=0;d=d+16|0;b=b+1|0;if((a|0)!=(b|0)){continue}break}}}oa=j+256|0;return f}function Ia(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!b){return 0}a:{if(!a){a=kb(8,b);break a}if(!b){Da(a);a=0;break a}b:{if(b>>>0>4294967239){break b}h=b>>>0<=8?8:b+3&-4;b=h+8|0;c:{d:{k=a-4|0;f=k;c=H[f>>2];e=c+f|0;j=H[e>>2];g=j+e|0;e:{f:{if(H[g-4>>2]!=(j|0)){d=b+f|0;if(d+16>>>0<=g>>>0){c=H[e+4>>2];e=H[e+8>>2];H[c+8>>2]=e;H[e+4>>2]=c;c=g-d|0;H[d>>2]=c;H[(d+(c&-4)|0)-4>>2]=c|1;e=H[d>>2]-8|0;g:{if(e>>>0<=127){c=(e>>>3|0)-1|0;break g}g=Q(e);c=((e>>>29-g^4)-(g<<2)|0)+110|0;if(e>>>0<=4095){break g}c=((e>>>30-g^2)-(g<<1)|0)+71|0;c=c>>>0>=63?63:c}e=c<<4;H[d+4>>2]=e+26400;e=e+26408|0;H[d+8>>2]=H[e>>2];H[e>>2]=d;H[H[d+8>>2]+4>>2]=d;e=H[6859];d=c&31;if((c&63)>>>0>=32){c=1<>>32-d}H[6858]=g|H[6858];H[6859]=c|e;H[f>>2]=b;break d}if(d>>>0>g>>>0){break f}b=H[e+4>>2];d=H[e+8>>2];H[b+8>>2]=d;H[d+4>>2]=b;b=c+j|0;H[f>>2]=b;break d}if(c>>>0>=b+16>>>0){H[f>>2]=b;H[(f+(b&-4)|0)-4>>2]=b;d=b+f|0;b=c-b|0;H[d>>2]=b;H[(d+(b&-4)|0)-4>>2]=b|1;c=H[d>>2]-8|0;h:{if(c>>>0<=127){b=(c>>>3|0)-1|0;break h}f=Q(c);b=((c>>>29-f^4)-(f<<2)|0)+110|0;if(c>>>0<=4095){break h}b=((c>>>30-f^2)-(f<<1)|0)+71|0;b=b>>>0>=63?63:b}c=b<<4;H[d+4>>2]=c+26400;c=c+26408|0;H[d+8>>2]=H[c>>2];H[c>>2]=d;H[H[d+8>>2]+4>>2]=d;c=H[6859];d=b&31;if((b&63)>>>0>=32){b=1<>>32-d}H[6858]=e|H[6858];H[6859]=b|c;d=1;break c}d=1;if(b>>>0<=c>>>0){break e}}d=0}break c}H[(f+(b&-4)|0)-4>>2]=b;d=1}if(d){break a}b=kb(8,h);if(!b){break b}i=H[k>>2]-8|0;eb(b,a,h>>>0>>0?h:i);Da(a);i=b}a=i}return a}function Qb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0;a:{d=Fa(1,48);if(d){b=H[a+224>>2];c=H[b+4>>2];H[d>>2]=H[b>>2];H[d+4>>2]=c;c=H[b+12>>2];H[d+8>>2]=H[b+8>>2];H[d+12>>2]=c;c=H[b+20>>2];H[d+16>>2]=H[b+16>>2];H[d+20>>2]=c;c=H[b+24>>2];H[d+24>>2]=c;f=Ga(N(c,24));H[d+28>>2]=f;if(!f){Da(d);return 0}b=H[H[a+224>>2]+28>>2];b:{if(b){c=N(H[d+24>>2],24);if(!c){break b}B(f,b,c);break b}Da(f);H[d+28>>2]=0}c=H[H[a+224>>2]+36>>2];H[d+36>>2]=c;b=Fa(c,40);H[d+40>>2]=b;if(!b){Da(H[d+28>>2]);Da(d);return 0}c:{if(H[H[a+224>>2]+40>>2]){if(!H[d+36>>2]){break c}while(1){e=N(h,40);c=H[(e+H[H[a+224>>2]+40>>2]|0)+20>>2];H[(b+e|0)+20>>2]=c;g=Ga(N(c,24));c=H[d+40>>2];f=c+e|0;H[f+24>>2]=g;if(!g){if(h){b=0;while(1){Da(H[(H[d+40>>2]+N(b,40)|0)+24>>2]);b=b+1|0;if((h|0)!=(b|0)){continue}break}c=H[d+40>>2]}break a}b=H[(e+H[H[a+224>>2]+40>>2]|0)+24>>2];d:{if(b){c=N(H[f+20>>2],24);if(c){B(g,b,c)}b=H[d+40>>2];break d}Da(g);b=H[d+40>>2];H[(e+b|0)+24>>2]=0}c=H[(e+H[H[a+224>>2]+40>>2]|0)+4>>2];H[(b+e|0)+4>>2]=c;g=Ga(N(c,24));c=H[d+40>>2];f=c+e|0;H[f+16>>2]=g;if(!g){if(h){b=0;while(1){a=N(b,40);Da(H[(a+H[d+40>>2]|0)+24>>2]);Da(H[(a+H[d+40>>2]|0)+16>>2]);b=b+1|0;if((h|0)!=(b|0)){continue}break}c=H[d+40>>2]}break a}b=H[(e+H[H[a+224>>2]+40>>2]|0)+16>>2];e:{if(b){c=N(H[f+4>>2],24);if(c){B(g,b,c)}b=H[d+40>>2];break e}Da(g);b=H[d+40>>2];H[(e+b|0)+16>>2]=0}c=b+e|0;H[c+32>>2]=0;H[c+36>>2]=0;h=h+1|0;if(h>>>0>2]){continue}break}break c}Da(b);H[d+40>>2]=0}}else{d=0}return d|0}Da(c);Da(H[d+28>>2]);Da(d);return 0}function kb(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;a:{b:{while(1){if(a-1&a|b>>>0>4294967239){break b}j=a>>>0>8;a=j?a:8;d=H[6859];e=d;g=H[6858];b=b>>>0<=8?8:b+3&-4;c:{if(b>>>0<=127){i=(b>>>3|0)-1|0;break c}c=Q(b);i=((b>>>29-c^4)-(c<<2)|0)+110|0;if(b>>>0<=4095){break c}c=((b>>>30-c^2)-(c<<1)|0)+71|0;i=c>>>0>=63?63:c}h=i;f=h&31;if((h&63)>>>0>=32){c=0;d=d>>>f|0}else{c=d>>>f|0;d=((1<>>f}if(d|c){while(1){f=c;d:{if(c|d){e=c-1|0;g=e+1|0;i=e;e=d-1|0;g=(e|0)!=-1?g:i;c=Q(c^g);c=(c|0)==32?Q(d^e)+32|0:c;e=63-c|0;ra=0-(c>>>0>63)|0;break d}ra=0;e=64}g=e;e=g&31;if((g&63)>>>0>=32){c=0;i=f>>>e|0}else{c=f>>>e|0;i=((1<>>e}h=g+h|0;d=h<<4;f=H[d+26408>>2];e=d+26400|0;e:{if((f|0)!=(e|0)){d=Ib(f,a,b);if(d){break a}d=H[f+4>>2];g=H[f+8>>2];H[d+8>>2]=g;H[g+4>>2]=d;H[f+8>>2]=e;H[f+4>>2]=H[e+4>>2];H[e+4>>2]=f;H[H[f+4>>2]+8>>2]=f;h=h+1|0;d=(c&1)<<31|i>>>1;c=c>>>1|0;break e}d=H[6859];k=27432,l=H[6858]&Ne(-2,-1,h),H[k>>2]=l;H[6859]=ra&d;d=i^1}if(c|d){continue}break}g=H[6858];e=H[6859]}c=Q(e);f=63-((c|0)==32?Q(g)+32|0:c)|0;f:{if(!(e|g)){c=0;break f}d=f<<4;c=H[d+26408>>2];if(!e&g>>>0<1073741824){break f}h=99;e=d+26400|0;if((e|0)==(c|0)){break f}while(1){if(!h){break f}d=Ib(c,a,b);if(d){break a}h=h-1|0;c=H[c+8>>2];if((e|0)!=(c|0)){continue}break}}if(Lc((j?a+48|0:48)+b|0)){continue}break}if(!c){break b}f=(f<<4)+26400|0;if((f|0)==(c|0)){break b}while(1){d=Ib(c,a,b);if(d){break a}c=H[c+8>>2];if((f|0)!=(c|0)){continue}break}}d=0}return d}function Fd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=H[a+48>>2];if(e>>>0>=b>>>0){H[a+48>>2]=e-b;H[a+36>>2]=H[a+36>>2]+b;e=c+H[a+60>>2]|0;d=b+H[a+56>>2]|0;e=d>>>0>>0?e+1|0:e;H[a+56>>2]=d;H[a+60>>2]=e;ra=c;return b|0}if(I[a+68|0]&4){H[a+48>>2]=0;H[a+36>>2]=e+H[a+36>>2];g=H[a+60>>2];c=H[a+56>>2];b=c+e|0;H[a+56>>2]=b;H[a+60>>2]=b>>>0>>0?g+1|0:g;ra=e?0:-1;return(e?e:-1)|0}if(e){H[a+48>>2]=0;H[a+36>>2]=H[a+32>>2];h=b;f=e;b=b-e|0;c=c-(e>>>0>h>>>0)|0}a:{if((c|0)>0){h=1}else{h=!!b&(c|0)>=0}if(h){while(1){h=H[a+12>>2];e=c+g|0;i=b+f|0;e=H[a+60>>2]+(i>>>0>>0?e+1|0:e)|0;j=i;i=i+H[a+56>>2]|0;e=j>>>0>i>>>0?e+1|0:e;if((e|0)==(h|0)&i>>>0>K[a+8>>2]|e>>>0>h>>>0){Ca(d,4,15630,0);H[a+48>>2]=0;H[a+36>>2]=H[a+32>>2];b=g+H[a+60>>2]|0;c=f+H[a+56>>2]|0;b=c>>>0>>0?b+1|0:b;H[a+56>>2]=c;H[a+60>>2]=b;d=H[a+8>>2];f=d-c|0;e=H[a+12>>2];g=e-((c>>>0>d>>>0)+b|0)|0;h=sa[H[a+28>>2]](d,e,H[a>>2])|0;i=H[a+68>>2];if(h){H[a+56>>2]=d;H[a+60>>2]=e}H[a+68>>2]=i|4;a=(c|0)==(d|0)&(b|0)==(e|0);b=a?-1:f;break a}e=sa[H[a+24>>2]](b,c,H[a>>2])|0;h=ra;i=h;if((e&i)==-1){Ca(d,4,15630,0);H[a+68>>2]=H[a+68>>2]|4;e=g+H[a+60>>2]|0;b=f+H[a+56>>2]|0;e=b>>>0>>0?e+1|0:e;H[a+56>>2]=b;H[a+60>>2]=e;a=!(g|f);b=a?-1:f;break a}g=g+i|0;f=e+f|0;g=f>>>0>>0?g+1|0:g;h=b;b=b-e|0;c=c-((e>>>0>h>>>0)+i|0)|0;if(!!b&(c|0)>=0|(c|0)>0){continue}break}}b=g+H[a+60>>2]|0;c=f+H[a+56>>2]|0;b=c>>>0>>0?b+1|0:b;H[a+56>>2]=c;H[a+60>>2]=b;ra=g;return f|0}ra=a?-1:g;return b|0}function Jd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=oa-80|0;oa=e;a:{if(c>>>0<=2){Ca(d,1,14478,0);break a}if(I[a+124|0]){Ca(d,4,11193,0);g=1;break a}g=1;Ea(b,a+40|0,1);Ea(b+1|0,a+52|0,1);Ea(b+2|0,a+44|0,1);f=b+3|0;b:{c:{d:{e:{f:{h=H[a+40>>2];switch(h-1|0){case 0:break f;case 1:break e;default:break d}}if(c>>>0<=6){H[e+16>>2]=c;Ca(d,1,15155,e+16|0);g=0;break a}if(!((c|0)==7|H[a+48>>2]==14)){H[e+48>>2]=c;Ca(d,2,15155,e+48|0)}Ea(f,a+48|0,4);if(H[a+48>>2]!=14){break b}f=Ga(36);if(!f){g=0;Ca(d,1,7993,0);break a}H[f>>2]=14;H[e+64>>2]=0;H[e+56>>2]=0;H[e+72>>2]=0;H[e+60>>2]=0;H[e+68>>2]=0;H[e+76>>2]=0;g=4470064;H[e+52>>2]=4470064;H[f+4>>2]=1145390592;g:{if((c|0)!=7){if((c|0)==35){Ea(b+7|0,e+76|0,4);Ea(b+11|0,e+72|0,4);Ea(b+15|0,e+68|0,4);Ea(b+19|0,e- -64|0,4);Ea(b+23|0,e+60|0,4);Ea(b+27|0,e+56|0,4);Ea(b+31|0,e+52|0,4);H[f+4>>2]=0;g=H[e+52>>2];c=H[e+56>>2];d=H[e+64>>2];i=H[e+68>>2];j=H[e+76>>2];h=H[e+72>>2];b=H[e+60>>2];break g}H[e+32>>2]=c;Ca(d,2,15191,e+32|0)}c=0;d=0;h=0;b=0}H[f+24>>2]=b;H[f+16>>2]=i;H[f+8>>2]=j;H[f+32>>2]=g;H[f+28>>2]=c;H[f+20>>2]=d;H[f+12>>2]=h;H[a+112>>2]=0;H[a+108>>2]=f;break b}b=c-3|0;H[a+112>>2]=b;d=Fa(1,b);H[a+108>>2]=d;if(!d){break c}if((c|0)<=3){break b}c=0;while(1){Ea(f,e+76|0,1);F[H[a+108>>2]+c|0]=H[e+76>>2];f=f+1|0;c=c+1|0;if((b|0)!=(c|0)){continue}break}break b}if(h>>>0<3){break a}H[e>>2]=h;Ca(d,4,15950,e);break a}g=0;H[a+112>>2]=0;break a}g=1;F[a+124|0]=1}oa=e+80|0;return g|0}function Ka(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0;h=H[a+48>>2];if(h>>>0>=c>>>0){if(c){B(b,H[a+36>>2],c)}H[a+36>>2]=H[a+36>>2]+c;H[a+48>>2]=H[a+48>>2]-c;b=H[a+60>>2];d=H[a+56>>2]+c|0;b=d>>>0>>0?b+1|0:b;H[a+56>>2]=d;H[a+60>>2]=b;return c}if(I[a+68|0]&4){if(h){B(b,H[a+36>>2],h)}b=H[a+48>>2];H[a+48>>2]=0;H[a+36>>2]=b+H[a+36>>2];g=H[a+60>>2];c=b;b=H[a+56>>2]+b|0;g=c>>>0>b>>>0?g+1|0:g;H[a+56>>2]=b;H[a+60>>2]=g;return h?h:-1}a:{if(h){if(h){B(b,H[a+36>>2],h)}i=H[a+32>>2];H[a+36>>2]=i;e=H[a+48>>2];H[a+48>>2]=0;f=H[a+60>>2];g=H[a+56>>2]+e|0;f=g>>>0>>0?f+1|0:f;H[a+56>>2]=g;H[a+60>>2]=f;c=c-e|0;b=b+e|0;break a}i=H[a+32>>2];H[a+36>>2]=i}b:{while(1){c:{e=H[a>>2];f=H[a+16>>2];g=H[a+64>>2];d:{if(g>>>0>c>>>0){f=sa[f|0](i,g,e)|0;H[a+48>>2]=f;if((f|0)==-1){break b}if(c>>>0>f>>>0){if(f){B(b,H[a+36>>2],f)}i=H[a+32>>2];H[a+36>>2]=i;e=H[a+48>>2];break d}if(c){B(b,H[a+36>>2],c)}H[a+36>>2]=H[a+36>>2]+c;H[a+48>>2]=H[a+48>>2]-c;b=H[a+60>>2];d=H[a+56>>2]+c|0;b=d>>>0>>0?b+1|0:b;H[a+56>>2]=d;H[a+60>>2]=b;return c+h|0}e=sa[f|0](b,c,e)|0;H[a+48>>2]=e;if((e|0)==-1){break b}if(c>>>0<=e>>>0){break c}i=H[a+32>>2];H[a+36>>2]=i;f=e}H[a+48>>2]=0;g=H[a+60>>2];j=H[a+56>>2]+e|0;g=j>>>0>>0?g+1|0:g;H[a+56>>2]=j;H[a+60>>2]=g;b=b+e|0;c=c-e|0;h=f+h|0;continue}break}H[a+48>>2]=0;H[a+36>>2]=H[a+32>>2];f=H[a+60>>2];b=H[a+56>>2]+e|0;f=b>>>0>>0?f+1|0:f;H[a+56>>2]=b;H[a+60>>2]=f;return e+h|0}Ca(d,4,15630,0);H[a+48>>2]=0;H[a+68>>2]=H[a+68>>2]|4;return h?h:-1}function Rb(a){a=a|0;var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=oa-16|0;oa=g;o=H[H[a+96>>2]+16>>2];b=Fa(1,56);H[g+12>>2]=b;a:{if(!b){break a}j=H[H[a+96>>2]+16>>2];H[b+24>>2]=j;H[b>>2]=H[a+108>>2];H[b+4>>2]=H[a+112>>2];H[b+8>>2]=H[a+116>>2];H[b+12>>2]=H[a+120>>2];H[b+16>>2]=H[a+128>>2];h=H[a+132>>2];H[b+52>>2]=0;H[b+20>>2]=h;i=H[a+12>>2];H[b+32>>2]=H[i>>2];H[b+36>>2]=H[i+4>>2];H[b+40>>2]=H[i+8>>2];H[b+44>>2]=H[i+16>>2];a=Fa(j,1080);H[b+48>>2]=a;if(a){if(o){while(1){a=N(k,1080);d=a+H[b+48>>2]|0;c=a+H[i+5584>>2]|0;H[d+4>>2]=H[c>>2];a=H[c+4>>2];H[d+8>>2]=a;H[d+12>>2]=H[c+8>>2];H[d+16>>2]=H[c+12>>2];H[d+20>>2]=H[c+16>>2];H[d+24>>2]=H[c+20>>2];b:{if(a>>>0>32){break b}if(a){B(d+948|0,c+944|0,a)}a=H[c+4>>2];if(!a){break b}B(d+816|0,c+812|0,a)}a=H[c+24>>2];H[d+28>>2]=a;H[d+808>>2]=H[c+804>>2];f=1;c:{if((a|0)!=1){a=N(H[c+4>>2],3);if(a-3>>>0>95){break c}f=a-2|0}p=f&1;l=d+420|0;m=d+32|0;n=c+28|0;a=0;if((f|0)!=1){j=f&-2;f=0;while(1){h=a<<2;e=(a<<3)+n|0;H[h+m>>2]=H[e+4>>2];H[h+l>>2]=H[e>>2];e=a|1;h=e<<2;e=(e<<3)+n|0;H[h+m>>2]=H[e+4>>2];H[h+l>>2]=H[e>>2];a=a+2|0;f=f+2|0;if((j|0)!=(f|0)){continue}break}}if(!p){break c}e=a<<2;a=(a<<3)+n|0;H[e+m>>2]=H[a+4>>2];H[e+l>>2]=H[a>>2]}H[d+812>>2]=H[c+808>>2];k=k+1|0;if((k|0)!=(o|0)){continue}break}}e=b;break a}if(g+12|0){a=H[g+12>>2];b=H[a+48>>2];if(b){Da(b);a=H[g+12>>2]}Da(a);H[g+12>>2]=0}}oa=g+16|0;return e|0}function kc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;f=H[a+28>>2]+N(b,152)|0;d=H[f-144>>2]-H[f-152>>2]|0;e=H[f-140>>2]-H[f-148>>2]|0;c=e>>>0>=64?64:e;g=d>>>0>=64?64:d;a:{if(!(!d|!e|(!g|!c)|g>>>0>4294967295/(c>>>0)>>>2>>>0)){f=Fa(1,28);H[f+12>>2]=c;H[f+8>>2]=g;H[f+4>>2]=e;H[f>>2]=d;h=e;e=c+e|0;i=h>>>0>e>>>0?1:i;e=Ke(e-1|0,i-!e|0,c,0);H[f+20>>2]=e;c=0;h=d;d=d+g|0;c=h>>>0>d>>>0?1:c;c=Ke(d-1|0,c-!d|0,g,0);H[f+16>>2]=c;Ie(e,0,c);b:{if(ra){break b}c=Fa(4,N(c,e));H[f+24>>2]=c;if(!c){break b}break a}Da(f)}f=0}if(!f){return 0}c:{if(b){while(1){o=N(n,152);e=o+H[a+28>>2]|0;c=H[e+24>>2];if(c){r=e+28|0;d=H[e+20>>2];g=H[e+16>>2];l=0;while(1){if(N(d,g)){i=N(l,36)+r|0;m=0;while(1){k=H[i+20>>2]+N(m,40)|0;c=H[k+20>>2];j=H[k+16>>2];if(N(c,j)){g=0;while(1){d=H[k+24>>2]+N(g,68)|0;p=H[d+60>>2];if(p){j=H[d+12>>2];s=H[d+20>>2];t=H[d+16>>2];q=H[d+8>>2];d=q-H[i>>2]|0;h=H[i+16>>2];if(h&1){c=H[a+28>>2]+o|0;d=(H[c-144>>2]+d|0)-H[c-152>>2]|0}c=j-H[i+4>>2]|0;if(h&2){h=c;c=H[a+28>>2]+o|0;c=(h+H[c-140>>2]|0)-H[c-148>>2]|0}h=d;d=t-q|0;if(!ab(f,h,c,h+d|0,(s-j|0)+c|0,p,1,d)){break c}j=H[k+16>>2];c=H[k+20>>2]}g=g+1|0;if(g>>>0>>0){continue}break}g=H[e+16>>2];d=H[e+20>>2]}m=m+1|0;if(m>>>0>>0){continue}break}c=H[e+24>>2]}l=l+1|0;if(l>>>0>>0){continue}break}}n=n+1|0;if((n|0)!=(b|0)){continue}break}}return f}Xa(f);return 0}function Ob(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0;a:{b:{e=H[a+60>>2];if(!e){if(H[b+16>>2]){break b}return 1}i=Ga(N(e,52));if(!i){break a}e=0;if(H[b+16>>2]){d=H[b+24>>2];while(1){e=N(f,52);Da(H[(e+d|0)+44>>2]);d=H[b+24>>2];H[(e+d|0)+44>>2]=0;f=f+1|0;e=H[b+16>>2];if(f>>>0>>0){continue}break}}if(H[a+60>>2]){f=H[H[a+100>>2]+24>>2];e=0;while(1){h=N(H[H[a+64>>2]+(e<<2)>>2],52);d=h+f|0;c=H[d+4>>2];g=i+N(e,52)|0;H[g>>2]=H[d>>2];H[g+4>>2]=c;H[g+48>>2]=H[d+48>>2];c=H[d+44>>2];H[g+40>>2]=H[d+40>>2];H[g+44>>2]=c;c=H[d+36>>2];H[g+32>>2]=H[d+32>>2];H[g+36>>2]=c;c=H[d+28>>2];H[g+24>>2]=H[d+24>>2];H[g+28>>2]=c;c=H[d+20>>2];H[g+16>>2]=H[d+16>>2];H[g+20>>2]=c;c=H[d+12>>2];H[g+8>>2]=H[d+8>>2];H[g+12>>2]=c;f=H[H[a+100>>2]+24>>2];c=h+f|0;H[g+36>>2]=H[c+36>>2];H[g+44>>2]=H[c+44>>2];H[c+44>>2]=0;e=e+1|0;c=H[a+60>>2];if(e>>>0>>0){continue}break}e=H[b+16>>2]}if(e){d=H[H[a+100>>2]+24>>2];f=0;while(1){c=N(f,52);Da(H[(c+d|0)+44>>2]);d=H[H[a+100>>2]+24>>2];H[(c+d|0)+44>>2]=0;f=f+1|0;if(f>>>0>2]){continue}break}c=H[a+60>>2]}H[b+16>>2]=c;Da(H[b+24>>2]);H[b+24>>2]=i;return 1}e=H[b+24>>2];f=H[H[a+100>>2]+24>>2];while(1){h=N(d,52);c=h+e|0;H[c+36>>2]=H[(f+h|0)+36>>2];Da(H[c+44>>2]);e=H[b+24>>2];f=H[H[a+100>>2]+24>>2];c=h+f|0;H[(h+e|0)+44>>2]=H[c+44>>2];H[c+44>>2]=0;d=d+1|0;if(d>>>0>2]){continue}break}return 1}Va(H[a+96>>2]);H[a+96>>2]=0;return 0}function oe(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;h=oa-16|0;oa=h;if(H[a+8>>2]==16){f=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{f=H[a+12>>2]}a:{if(c>>>0<=1){Ca(d,1,4132,0);a=0;break a}Ea(b,h+12|0,2);b:{if(H[h+12>>2]){Ca(d,2,3608,0);break b}if(c>>>0<=6){Ca(d,1,4132,0);a=0;break a}Ea(b+2|0,h+12|0,2);e=H[f+5616>>2];k=I[h+12|0];c:{d:{e:{g=H[f+5620>>2];if(!g){a=e;break e}a=e;while(1){if(H[a+8>>2]==(k|0)){break e}a=a+20|0;i=i+1|0;if((i|0)!=(g|0)){continue}break}break d}if((g|0)!=(i|0)){break c}}if(H[f+5624>>2]==(g|0)){a=g+10|0;H[f+5624>>2]=a;a=Ia(e,N(a,20));e=H[f+5616>>2];if(!a){Da(e);H[f+5624>>2]=0;H[f+5616>>2]=0;H[f+5620>>2]=0;Ca(d,1,4158,0);a=0;break a}f:{if((a|0)==(e|0)){break f}l=H[f+5632>>2];if(!l){break f}m=H[f+5628>>2];i=0;while(1){g=N(i,20)+m|0;j=H[g+8>>2];if(j){H[g+8>>2]=a+(j-e|0)}j=H[g+12>>2];if(j){H[g+12>>2]=a+(j-e|0)}i=i+1|0;if((l|0)!=(i|0)){continue}break}}H[f+5616>>2]=a;e=H[f+5620>>2];g=N(H[f+5624>>2]-e|0,20);if(g){y(a+N(e,20)|0,0,g)}g=H[f+5620>>2];e=H[f+5616>>2]}H[f+5620>>2]=g+1;a=N(g,20)+e|0}e=H[a+12>>2];if(e){Da(e);H[a+12>>2]=0;H[a+16>>2]=0}H[a+8>>2]=k;e=H[h+12>>2];H[a>>2]=e>>>10&3;H[a+4>>2]=e>>>8&3;Ea(b+4|0,h+12|0,2);if(H[h+12>>2]){Ca(d,2,3023,0);break b}c=c-6|0;e=Ga(c);H[a+12>>2]=e;if(!e){Ca(d,1,4132,0);a=0;break a}if(c){B(e,b+6|0,c)}H[a+16>>2]=c}a=1}oa=h+16|0;return a|0}function Wa(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;a:{b:{if(!H[a+12>>2]){k=1;if(H[a+4>>2]>0|H[a+8>>2]>1){break b}break a}e=1;if(H[a+8>>2]>0){break b}if(H[a+4>>2]<2){break a}}b=H[a>>2];f=b+(e<<5)|0;g=H[a+16>>2];h=H[a+20>>2];if(g>>>0>>0){d=g;while(1){c=(d<<6)+f|0;L[c>>2]=L[c>>2]*O(1.2301740646362305);L[c+4>>2]=L[c+4>>2]*O(1.2301740646362305);L[c+8>>2]=L[c+8>>2]*O(1.2301740646362305);L[c+12>>2]=L[c+12>>2]*O(1.2301740646362305);L[c+16>>2]=L[c+16>>2]*O(1.2301740646362305);L[c+20>>2]=L[c+20>>2]*O(1.2301740646362305);L[c+24>>2]=L[c+24>>2]*O(1.2301740646362305);L[c+28>>2]=L[c+28>>2]*O(1.2301740646362305);d=d+1|0;if((h|0)!=(d|0)){continue}break}}i=b+(k<<5)|0;j=H[a+28>>2];c=H[a+24>>2];if(j>>>0>c>>>0){d=c;while(1){b=(d<<6)+i|0;L[b>>2]=L[b>>2]*O(1.625732421875);L[b+4>>2]=L[b+4>>2]*O(1.625732421875);L[b+8>>2]=L[b+8>>2]*O(1.625732421875);L[b+12>>2]=L[b+12>>2]*O(1.625732421875);L[b+16>>2]=L[b+16>>2]*O(1.625732421875);L[b+20>>2]=L[b+20>>2]*O(1.625732421875);L[b+24>>2]=L[b+24>>2]*O(1.625732421875);L[b+28>>2]=L[b+28>>2]*O(1.625732421875);d=d+1|0;if((j|0)!=(d|0)){continue}break}}b=f+32|0;d=H[a+8>>2];a=H[a+4>>2];e=a-e|0;e=(d|0)<(e|0)?d:e;pb(i,b,g,h,e,O(-.4435068666934967));l=i+32|0;d=d-k|0;a=(a|0)<(d|0)?a:d;pb(f,l,c,j,a,O(-.8829110860824585));pb(i,b,g,h,e,O(.05298011749982834));pb(f,l,c,j,a,O(1.5861343145370483))}}function dc(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;if(a){b=H[a+20>>2];if(b){g=H[b>>2];if(g){d=H[g+20>>2];if(H[g+16>>2]){i=F[a+40|0]&1?16:17;while(1){c=H[d+28>>2];if(c){b=H[d+32>>2];l=(b>>>0)/152|0;j=0;if(b>>>0>=152){while(1){b=H[c+48>>2];if(b){f=H[c+52>>2];h=(f>>>0)/40|0;e=0;if(f>>>0>=40){while(1){bb(H[b+32>>2]);H[b+32>>2]=0;bb(H[b+36>>2]);H[b+36>>2]=0;sa[i|0](b);b=b+40|0;e=e+1|0;if((h|0)!=(e|0)){continue}break}b=H[c+48>>2]}Da(b);H[c+48>>2]=0}b=H[c+84>>2];if(b){f=H[c+88>>2];h=(f>>>0)/40|0;e=0;if(f>>>0>=40){while(1){bb(H[b+32>>2]);H[b+32>>2]=0;bb(H[b+36>>2]);H[b+36>>2]=0;sa[i|0](b);b=b+40|0;e=e+1|0;if((h|0)!=(e|0)){continue}break}b=H[c+84>>2]}Da(b);H[c+84>>2]=0}b=H[c+120>>2];if(b){f=H[c+124>>2];h=(f>>>0)/40|0;e=0;if(f>>>0>=40){while(1){bb(H[b+32>>2]);H[b+32>>2]=0;bb(H[b+36>>2]);H[b+36>>2]=0;sa[i|0](b);b=b+40|0;e=e+1|0;if((h|0)!=(e|0)){continue}break}b=H[c+120>>2]}Da(b);H[c+120>>2]=0}c=c+152|0;j=j+1|0;if((l|0)!=(j|0)){continue}break}c=H[d+28>>2]}Da(c);H[d+28>>2]=0}a:{if(!H[d+40>>2]){break a}b=H[d+36>>2];if(!b){break a}Da(b);H[d+44>>2]=0;H[d+48>>2]=0;H[d+36>>2]=0;H[d+40>>2]=0}Da(H[d+52>>2]);d=d+76|0;k=k+1|0;if(k>>>0>2]){continue}break}d=H[g+20>>2]}Da(d);H[g+20>>2]=0;Da(H[H[a+20>>2]>>2]);b=H[a+20>>2];H[b>>2]=0}Da(b);H[a+20>>2]=0}Da(H[a+68>>2]);Da(a)}}function lc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;c=H[a+8>>2];f=c+H[a+4>>2]|0;a:{if(!H[a+12>>2]){if((f|0)<2){break a}h=(c<<2)+b|0;d=H[h>>2];e=H[b>>2]-(d+1>>1)|0;i=H[a>>2];b:{if(f>>>0<4){c=d;break b}k=(f-4>>>1|0)+1|0;a=1;while(1){c=a<<2;m=H[c+b>>2];c=H[c+h>>2];l=i+(g<<2)|0;H[l>>2]=e;j=e;e=m-((c+d|0)+2>>2)|0;H[l+4>>2]=(j+e>>1)+d;g=g+2|0;j=(a|0)!=(k|0);d=c;a=a+1|0;if(j){continue}break}}H[i+(g<<2)>>2]=e;if(f&1){d=f-1|0;a=H[(d<<1)+b>>2]-(c+1>>1)|0;H[i+(d<<2)>>2]=a;e=a+e>>1;d=-8}else{d=-4}a=f<<2;H[d+(a+i|0)>>2]=c+e;if(!a){break a}B(b,i,a);return}c:{switch(f-1|0){case 0:H[b>>2]=H[b>>2]/2;return;case 1:a=H[a>>2];c=(c<<2)+b|0;d=H[b>>2]-(H[c>>2]+1>>1)|0;H[a+4>>2]=d;H[a>>2]=d+H[c>>2];c=H[a+4>>2];H[b>>2]=H[a>>2];H[b+4>>2]=c;return;default:break c}}if((f|0)<3){break a}h=H[a>>2];k=(c<<2)+b|0;d=H[k+4>>2];a=H[k>>2];e=H[b>>2]-((d+a|0)+2>>2)|0;H[h>>2]=e+a;g=1;m=f-2|0;l=f&1;a=!l;d:{if(m-a>>>0<2){c=d;break d}o=((f-a|0)-4>>>1|0)+1|0;a=1;while(1){p=H[(a<<2)+b>>2];j=a+1|0;c=H[k+(j<<2)>>2];n=h+(g<<2)|0;H[n>>2]=e;i=e;e=p-((c+d|0)+2>>2)|0;H[n+4>>2]=(i+e>>1)+d;g=g+2|0;i=(a|0)!=(o|0);d=c;a=j;if(i){continue}break}}H[h+(g<<2)>>2]=e;e:{if(!l){g=H[((f<<1)+b|0)-4>>2]-(c+1>>1)|0;H[h+(m<<2)>>2]=(g+e>>1)+c;break e}g=c+e|0}a=f<<2;H[(a+h|0)-4>>2]=g;if(!a){break a}B(b,h,a)}}function bc(a,b){var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;e=H[a+24>>2];j=H[e+16>>2];if(!j){return 0}f=H[e+24>>2];e=H[H[H[a+20>>2]>>2]+20>>2];a:{b:{if(!b){b=0;while(1){c=H[f+24>>2];a=H[e+28>>2]+N(H[e+24>>2],152)|0;d=H[a-140>>2];g=H[a-144>>2]-H[a-152>>2]|0;a=H[a-148>>2];h=d-a|0;Ie(g,0,h);if(!(!ra|(a|0)==(d|0))){break a}a=(c>>>3|0)+((c&7)!=0)|0;c=(a|0)==3?4:a;a=!c;d=N(g,h);Ie(c,0,d);if(!(!ra|a)){break a}a=-1;c=N(c,d);if(c>>>0>(b^-1)>>>0){break b}e=e+76|0;f=f+52|0;b=b+c|0;a=b;i=i+1|0;if((j|0)!=(i|0)){continue}break}break b}b=0;if(!H[a+64>>2]){while(1){c=H[f+24>>2];a=H[e+28>>2]+N(H[e+24>>2],152)|0;d=H[a-4>>2];g=H[a-8>>2]-H[a-16>>2]|0;a=H[a-12>>2];h=d-a|0;Ie(g,0,h);if(!(!ra|(a|0)==(d|0))){break a}a=(c>>>3|0)+((c&7)!=0)|0;c=(a|0)==3?4:a;a=!c;d=N(g,h);Ie(c,0,d);if(!(!ra|a)){break a}a=-1;c=N(c,d);if(c>>>0>(b^-1)>>>0){break b}e=e+76|0;f=f+52|0;b=b+c|0;a=b;i=i+1|0;if((j|0)!=(i|0)){continue}break}break b}while(1){c=H[f+24>>2];a=H[e+28>>2]+N(H[e+24>>2],152)|0;d=H[a-140>>2];g=H[a-144>>2]-H[a-152>>2]|0;a=H[a-148>>2];h=d-a|0;Ie(g,0,h);if(!(!ra|(a|0)==(d|0))){break a}a=(c>>>3|0)+((c&7)!=0)|0;c=(a|0)==3?4:a;a=!c;d=N(g,h);Ie(c,0,d);if(!(!ra|a)){break a}a=-1;c=N(c,d);if(c>>>0>(b^-1)>>>0){break b}e=e+76|0;f=f+52|0;b=b+c|0;a=b;i=i+1|0;if((j|0)!=(i|0)){continue}break}}return a}return-1}function Sb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;d=oa-256|0;oa=d;if(a){Pa(1806,17,c);H[d+240>>2]=H[a>>2];Ha(c,2348,d+240|0);H[d+224>>2]=H[a+4>>2];Ha(c,2361,d+224|0);H[d+208>>2]=H[a+8>>2];Ha(c,7260,d+208|0);H[d+192>>2]=H[a+16>>2];Ha(c,2319,d+192|0);if((b|0)>0){while(1){e=H[a+5584>>2];H[d+176>>2]=h;Ha(c,1844,d+176|0);e=e+N(h,1080)|0;H[d+160>>2]=H[e>>2];Ha(c,2347,d+160|0);H[d+144>>2]=H[e+4>>2];Ha(c,7374,d+144|0);H[d+128>>2]=H[e+8>>2];Ha(c,7162,d+128|0);H[d+112>>2]=H[e+12>>2];Ha(c,7178,d+112|0);H[d+96>>2]=H[e+16>>2];Ha(c,2330,d+96|0);H[d+80>>2]=H[e+20>>2];Ha(c,7440,d+80|0);Pa(1567,23,c);if(H[e+4>>2]){i=e+944|0;j=e+812|0;f=0;while(1){g=f<<2;k=H[j+g>>2];H[d+68>>2]=H[i+g>>2];H[d+64>>2]=k;Ha(c,1693,d- -64|0);f=f+1|0;if(f>>>0>2]){continue}break}}Mc(c);H[d+48>>2]=H[e+24>>2];Ha(c,7194,d+48|0);H[d+32>>2]=H[e+804>>2];Ha(c,7243,d+32|0);i=1;Pa(1591,20,c);a:{if(H[e+24>>2]!=1){f=H[e+4>>2];if((f|0)<=0){break a}i=N(f,3)-2|0}j=e+28|0;f=0;while(1){g=j+(f<<3)|0;l=d,m=Ne(H[g>>2],H[g+4>>2],32),H[l+16>>2]=m;H[d+20>>2]=ra;Ha(c,1693,d+16|0);f=f+1|0;if((i|0)!=(f|0)){continue}break}}Mc(c);H[d>>2]=H[e+808>>2];Ha(c,7226,d);Pa(1707,5,c);h=h+1|0;if((h|0)!=(b|0)){continue}break}}Pa(1708,4,c)}oa=d+256|0}function Ge(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;a:{b:{c:{d:{e:{f:{g:{h:{i:{j:{e=b;if(e){if(!c){break j}if(!d){break i}e=Q(d)-Q(e)|0;if(e>>>0<=31){break h}break b}if((d|0)==1|d>>>0>1){break b}b=(a>>>0)/(c>>>0)|0;pa=a-N(b,c)|0;qa=0;ra=0;return b}if(!a){break g}if(!d){break f}f=d-1|0;if(f&d){break f}pa=a;qa=e&f;a=e>>>He(d)|0;ra=0;return a}f=c-1|0;if(!(f&c)){break e}k=(Q(c)+33|0)-Q(e)|0;g=0-k|0;break c}k=e+1|0;g=63-e|0;break c}pa=0;a=(e>>>0)/(d>>>0)|0;qa=e-N(a,d)|0;ra=0;return a}e=Q(d)-Q(e)|0;if(e>>>0<31){break d}break b}pa=a&f;qa=0;if((c|0)==1){break a}c=He(c);d=c&31;if((c&63)>>>0>=32){e=0;a=b>>>d|0}else{e=b>>>d|0;a=((1<>>d}ra=e;return a}k=e+1|0;g=63-e|0}f=a;e=k&63;h=e&31;if((e&63)>>>0>=32){e=0;f=b>>>h|0}else{e=b>>>h|0;f=((1<>>h}h=g&63;g=a;i=h&31;if((h&63)>>>0>=32){j=a<>>32-i|b<>>31;f=f<<1|b>>>31;l=e;i=g-(e+(f>>>0>h>>>0)|0)|0;m=i>>31;j=m;e=f;i=c&j;f=e-i|0;e=l-((d&j)+(e>>>0>>0)|0)|0;j=b<<1|a>>>31;a=n|a<<1;b=j|o;l=m&1;n=l;k=k-1|0;if(k){continue}break}}pa=f;qa=e;j=b<<1|a>>>31;a=l|a<<1;ra=j|o;return a}pa=a;qa=b;a=0;b=0}ra=b;return a}function Vc(a,b,c,d,e){var f=0,g=0,h=0,i=0;h=oa-16|0;oa=h;if(H[a+8>>2]==16){a=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{a=H[a+12>>2]}f=H[d>>2];a:{if(!f){d=0;Ca(e,1,2642,0);break a}a=H[a+5584>>2];H[d>>2]=f-1;Ea(c,h+12|0,1);g=N(b,1080)+a|0;a=H[h+12>>2];H[g+804>>2]=a>>>5;b=a&31;H[g+24>>2]=b;a=c+1|0;b:{c:{d:{e:{f:{switch(b|0){case 0:f=H[d>>2];break e;case 1:break d;default:break f}}f=H[d>>2]>>>1|0}if(f>>>0>=98){H[h+4>>2]=97;H[h+8>>2]=97;H[h>>2]=f;Ca(e,2,16056,h);b=H[g+24>>2]}if(b){b=f;if(b){break d}a=0;break c}if(f){b=g+28|0;c=0;while(1){Ea(a,h+12|0,1);if(c>>>0<=96){e=H[h+12>>2];i=b+(c<<3)|0;H[i+4>>2]=0;H[i>>2]=e>>>3}a=a+1|0;c=c+1|0;if((f|0)!=(c|0)){continue}break}}a=H[d>>2];if(a>>>0>>0){d=0;break a}a=a-f|0;break b}e=g+28|0;c=0;while(1){Ea(a,h+12|0,2);if(c>>>0<=96){f=e+(c<<3)|0;i=H[h+12>>2];H[f+4>>2]=i&2047;H[f>>2]=i>>>11}a=a+2|0;c=c+1|0;if((c|0)!=(b|0)){continue}break}a=b<<1}b=H[d>>2];if(a>>>0>b>>>0){d=0;break a}a=b-a|0}H[d>>2]=a;d=1;if(H[g+24>>2]!=1){break a}f=g+28|0;c=H[g+32>>2];e=H[g+28>>2];a=1;while(1){b=f+(a<<3)|0;H[b+4>>2]=c;H[b+12>>2]=c;g=e-((a>>>0)/3|0)|0;H[b+8>>2]=(g|0)>0?g:0;g=b;b=e-((a-1>>>0)/3|0)|0;H[g>>2]=(b|0)>0?b:0;a=a+2|0;if((a|0)!=97){continue}break}}oa=h+16|0;return d}function ue(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;f=oa-32|0;oa=f;g=1;a:{if(c>>>0<=1){g=0;Ca(d,1,10062,0);break a}if(H[a+76>>2]){break a}Ea(b,f+28|0,1);Ea(b+1|0,f+24|0,1);e=H[f+24>>2];i=e>>>4&3;if((i|0)==3){H[a+76>>2]=1;Ca(d,2,11558,0);break a}c=c-2|0;j=(e>>>5&2)+2|0;h=i+j|0;e=(c>>>0)/(h>>>0)|0;if((c|0)!=(N(e,h)|0)){H[a+76>>2]=1;Ca(d,2,11139,0);break a}if(c>>>0>>0){break a}b:{c=H[a+68>>2];if(c>>>0<=(e^-1)>>>0){c=c+e|0;if(c>>>0<536870912){break b}}H[a+76>>2]=1;Ca(d,2,9400,0);break a}h=Ia(H[a+72>>2],c<<3);if(!h){H[a+76>>2]=1;Ca(d,2,9443,0);break a}c=b+2|0;H[a+72>>2]=h;c:{if(i){k=e>>>0<=1?1:e;e=0;while(1){Ea(c,f+20|0,i);b=H[f+20>>2];if(b>>>0>=N(H[a+132>>2],H[a+128>>2])>>>0){break c}b=c+i|0;Ea(b,f+16|0,j);c=H[a+68>>2];g=h+(c<<3)|0;G[g>>1]=H[f+20>>2];H[g+4>>2]=H[f+16>>2];g=1;H[a+68>>2]=c+1;c=b+j|0;e=e+1|0;if((k|0)!=(e|0)){continue}break}break a}i=e>>>0<=1?1:e;b=H[a+68>>2];e=0;while(1){H[f+20>>2]=b;if(N(H[a+132>>2],H[a+128>>2])>>>0<=b>>>0){break c}Ea(c,f+16|0,j);k=H[a+68>>2];g=h+(k<<3)|0;G[g>>1]=b;H[g+4>>2]=H[f+16>>2];g=1;b=k+1|0;H[a+68>>2]=b;c=c+j|0;e=e+1|0;if((i|0)!=(e|0)){continue}break}break a}H[a+76>>2]=1;H[f>>2]=b;Ca(d,2,7799,f)}oa=f+32|0;return g|0}function Ld(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;h=oa-16|0;oa=h;a:{if(!(I[a+100|0]&2)){Ca(d,1,11356,0);a=0;break a}H[a+104>>2]=0;b:{c:{d:{if(c){while(1){if(c>>>0<=7){Ca(d,1,3403,0);break b}g=h+12|0;Ea(b,g,4);e=H[h+12>>2];Ea(b+4|0,g,4);f=8;g=H[h+12>>2];e:{f:{g:{switch(e|0){case 1:if(c>>>0<16){e=3443;break c}Ea(b+8|0,h+8|0,4);if(H[h+8>>2]){e=8449;break c}Ea(b+12|0,h+12|0,4);e=H[h+12>>2];if(e){break f}e=3268;break c;case 0:break g;default:break e}}Ca(d,1,3268,0);break b}f=16}if(e>>>0>>0){Ca(d,1,9148,0);break b}if(c>>>0>>0){Ca(d,1,9076,0);a=0;break a}h:{i:{j=b+f|0;k=e-f|0;j:{k:{l:{m:{if((g|0)<=1668246641){if((g|0)==1651532643){break m}if((g|0)==1667523942){break k}if((g|0)!=1668112752){break i}f=25296;break j}if((g|0)==1885564018){break l}f=25264;if((g|0)==1768449138){break j}if((g|0)!=1668246642){break i}f=25272;break j}f=25280;break j}f=25288;break j}f=25304}if(sa[H[f+4>>2]](a,j,k,d)|0){break h}a=0;break a}H[a+104>>2]=H[a+104>>2]|2147483647}i=(g|0)==1768449138?1:i;b=b+e|0;c=c-e|0;if(c){continue}break}if(i){break d}}Ca(d,1,8976,0);a=0;break a}F[a+132|0]=1;H[a+100>>2]=H[a+100>>2]|4;a=1;break a}Ca(d,1,e,0)}Ca(d,1,1968,0);a=0}oa=h+16|0;return a|0}function Pb(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;a:{if(!c){break a}b:{e=H[a+184>>2];if(!e){break b}g=H[a+96>>2];if(!g|!H[g+16>>2]|(e|0)!=H[H[g+24>>2]+40>>2]){break b}h=H[c+16>>2];if(!h){break b}f=H[c+24>>2];if(H[f+40>>2]|H[f+44>>2]){break b}g=0;if(h>>>0>=8){j=h&-8;while(1){H[(f+N(g,52)|0)+40>>2]=e;H[(f+N(g|1,52)|0)+40>>2]=e;H[(f+N(g|2,52)|0)+40>>2]=e;H[(f+N(g|3,52)|0)+40>>2]=e;H[(f+N(g|4,52)|0)+40>>2]=e;H[(f+N(g|5,52)|0)+40>>2]=e;H[(f+N(g|6,52)|0)+40>>2]=e;H[(f+N(g|7,52)|0)+40>>2]=e;g=g+8|0;k=k+8|0;if((j|0)!=(k|0)){continue}break}}h=h&7;if(h){while(1){H[(f+N(g,52)|0)+40>>2]=e;g=g+1|0;l=l+1|0;if((h|0)!=(l|0)){continue}break}}if(Ab(c,d)){break b}return 0}f=H[a+100>>2];if(!f){f=zb();H[a+100>>2]=f;if(!f){break a}}Lb(c,f);if(!Ya(H[a+216>>2],22,d)){break a}h=H[a+216>>2];e=H[h>>2];f=H[h+8>>2];c:{if(e){i=1;j=e&1;if((e|0)==1){e=0}else{k=e&-2;g=0;while(1){e=0;d:{if(!i){break d}e=0;if(!(sa[H[f>>2]](a,b,d)|0)){break d}e=(sa[H[f+4>>2]](a,b,d)|0)!=0}i=e;f=f+8|0;g=g+2|0;if((k|0)!=(g|0)){continue}break}e=!i}i=j?0:i;if(!(e|!j)){i=(sa[H[f>>2]](a,b,d)|0)!=0}Qa(h);if(i){break c}Va(H[a+96>>2]);H[a+96>>2]=0;return 0}Qa(h)}i=Ob(a,c)}return i|0}function Yd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(!Ya(H[b+8>>2],54,d)){return 0}j=H[b+4>>2];e=H[j>>2];h=H[j+8>>2];a:{if(e){f=1;k=e&1;if((e|0)==1){e=0}else{e=e&-2;while(1){i=0;b:{if(!f){break b}i=0;if(!(sa[H[h>>2]](b,a,d)|0)){break b}i=(sa[H[h+4>>2]](b,a,d)|0)!=0}f=i;h=h+8|0;g=g+2|0;if((e|0)!=(g|0)){continue}break}e=!f}f=k?0:f;if(!(e|!k)){f=(sa[H[h>>2]](b,a,d)|0)!=0}Qa(j);if(f){break a}return 0}Qa(j)}j=H[b+8>>2];e=H[j>>2];h=H[j+8>>2];c:{if(e){f=1;k=e&1;if((e|0)==1){e=0}else{e=e&-2;g=0;while(1){i=0;d:{if(!f){break d}i=0;if(!(sa[H[h>>2]](b,a,d)|0)){break d}i=(sa[H[h+4>>2]](b,a,d)|0)!=0}f=i;h=h+8|0;g=g+2|0;if((e|0)!=(g|0)){continue}break}e=!f}f=k?0:f;if(!(e|!k)){f=(sa[H[h>>2]](b,a,d)|0)!=0}Qa(j);if(f){break c}return 0}Qa(j)}if(!I[b+132|0]){Ca(d,1,11696,0);return 0}if(!I[b+133|0]){Ca(d,1,11667,0);return 0}d=Yb(a,H[b>>2],c,d);e:{if(!c){break e}a=H[c>>2];if(!a){break e}g=1;f:{g:{switch(H[b+48>>2]-12|0){case 5:g=2;break f;case 6:g=3;break f;case 12:g=4;break f;case 0:g=5;break f;case 4:break f;default:break g}}g=-1}H[a+20>>2]=g;c=H[b+108>>2];if(!c){break e}H[a+28>>2]=c;H[a+32>>2]=H[b+112>>2];H[b+108>>2]=0}return d|0}function Lb(a,b){var c=0,d=0,e=0,f=0,g=0;H[b>>2]=H[a>>2];H[b+4>>2]=H[a+4>>2];H[b+8>>2]=H[a+8>>2];H[b+12>>2]=H[a+12>>2];c=H[b+24>>2];if(c){d=H[b+16>>2];if(d){c=0;while(1){f=H[(H[b+24>>2]+N(c,52)|0)+44>>2];if(f){Da(f);d=H[b+16>>2]}c=c+1|0;if(d>>>0>c>>>0){continue}break}c=H[b+24>>2]}Da(c);H[b+24>>2]=0}c=H[a+16>>2];H[b+16>>2]=c;c=Ga(N(c,52));H[b+24>>2]=c;if(c){if(H[b+16>>2]){f=0;while(1){g=N(f,52);c=g+c|0;d=H[a+24>>2]+g|0;e=H[d+4>>2];H[c>>2]=H[d>>2];H[c+4>>2]=e;H[c+48>>2]=H[d+48>>2];e=H[d+44>>2];H[c+40>>2]=H[d+40>>2];H[c+44>>2]=e;e=H[d+36>>2];H[c+32>>2]=H[d+32>>2];H[c+36>>2]=e;e=H[d+28>>2];H[c+24>>2]=H[d+24>>2];H[c+28>>2]=e;e=H[d+20>>2];H[c+16>>2]=H[d+16>>2];H[c+20>>2]=e;e=H[d+12>>2];H[c+8>>2]=H[d+8>>2];H[c+12>>2]=e;c=H[b+24>>2];H[(g+c|0)+44>>2]=0;f=f+1|0;if(f>>>0>2]){continue}break}}H[b+20>>2]=H[a+20>>2];c=H[a+32>>2];H[b+32>>2]=c;a:{if(c){c=Ga(c);H[b+28>>2]=c;if(!c){H[b+28>>2]=0;H[b+32>>2]=0;return}b=H[a+32>>2];if(!b){break a}B(c,H[a+28>>2],b);return}H[b+28>>2]=0}return}H[b+16>>2]=0;H[b+24>>2]=0}function Yb(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0;f=zb();H[b+96>>2]=f;a:{b:{if(!f){break b}c:{if(Ya(H[b+220>>2],18,d)){if(Ya(H[b+220>>2],19,d)){break c}}break a}i=H[b+220>>2];e=H[i>>2];g=H[i+8>>2];d:{if(e){f=1;k=e&1;if((e|0)==1){e=0}else{e=e&-2;while(1){h=0;e:{if(!f){break e}h=0;if(!(sa[H[g>>2]](b,a,d)|0)){break e}h=(sa[H[g+4>>2]](b,a,d)|0)!=0}f=h;g=g+8|0;j=j+2|0;if((e|0)!=(j|0)){continue}break}e=!f}f=k?0:f;if(!(e|!k)){f=(sa[H[g>>2]](b,a,d)|0)!=0}Qa(i);if(f){break d}break a}Qa(i)}f:{if(Ya(H[b+216>>2],20,d)){if(Ya(H[b+216>>2],21,d)){break f}}break a}i=H[b+216>>2];e=H[i>>2];g=H[i+8>>2];g:{if(e){f=1;k=e&1;if((e|0)==1){e=0}else{e=e&-2;j=0;while(1){h=0;h:{if(!f){break h}h=0;if(!(sa[H[g>>2]](b,a,d)|0)){break h}h=(sa[H[g+4>>2]](b,a,d)|0)!=0}f=h;g=g+8|0;j=j+2|0;if((e|0)!=(j|0)){continue}break}e=!f}f=k?0:f;if(!(e|!k)){f=(sa[H[g>>2]](b,a,d)|0)!=0}Qa(i);if(f){break g}break a}Qa(i)}a=zb();H[c>>2]=a;if(!a){break b}Lb(H[b+96>>2],a);l=1}return l|0}Va(H[b+96>>2]);H[b+96>>2]=0;return 0}function pb(a,b,c,d,e,f){var g=0,h=O(0),i=0,j=O(0);g=(c<<6)+b|0;a=c?g+-64|0:a;i=d>>>0>>0?d:e;a:{if(i>>>0<=c>>>0){b=a;break a}h=L[a>>2];while(1){b=g;g=b-32|0;j=h;h=L[b>>2];L[g>>2]=O(O(j+h)*f)+L[g>>2];g=b-28|0;L[g>>2]=O(O(L[a+4>>2]+L[b+4>>2])*f)+L[g>>2];g=b-24|0;L[g>>2]=O(O(L[a+8>>2]+L[b+8>>2])*f)+L[g>>2];g=b-20|0;L[g>>2]=O(O(L[a+12>>2]+L[b+12>>2])*f)+L[g>>2];g=b-16|0;L[g>>2]=O(O(L[a+16>>2]+L[b+16>>2])*f)+L[g>>2];g=b-12|0;L[g>>2]=O(O(L[a+20>>2]+L[b+20>>2])*f)+L[g>>2];g=b-8|0;L[g>>2]=O(O(L[a+24>>2]+L[b+24>>2])*f)+L[g>>2];g=b-4|0;L[g>>2]=O(O(L[a+28>>2]+L[b+28>>2])*f)+L[g>>2];g=b- -64|0;a=b;c=c+1|0;if((i|0)!=(c|0)){continue}break}}if(d>>>0>e>>>0){a=g-32|0;f=O(f+f);L[a>>2]=O(L[b>>2]*f)+L[a>>2];a=g-28|0;L[a>>2]=O(L[b+4>>2]*f)+L[a>>2];a=g-24|0;L[a>>2]=O(L[b+8>>2]*f)+L[a>>2];a=g-20|0;L[a>>2]=O(L[b+12>>2]*f)+L[a>>2];a=g-16|0;L[a>>2]=O(L[b+16>>2]*f)+L[a>>2];a=g-12|0;L[a>>2]=O(L[b+20>>2]*f)+L[a>>2];a=g-8|0;L[a>>2]=O(L[b+24>>2]*f)+L[a>>2];a=g-4|0;L[a>>2]=O(L[b+28>>2]*f)+L[a>>2]}}function Lc(a){var b=0,c=0,d=0,e=0,f=0;d=H[6518];b=a+7&-8;c=b+7&-8;a=d+c|0;a:{b:{if(!(a>>>0<=d>>>0?c:0)){if(a>>>0<=ta()<<16>>>0){break b}if(ka(a|0)|0){break b}}H[6597]=48;d=-1;break a}H[6518]=a}if((d|0)!=-1){a=b+d|0;H[a-4>>2]=16;c=a-16|0;H[c>>2]=16;b=H[6856];if(b){f=H[b+8>>2]}else{f=0}c:{d:{if((f|0)==(d|0)){e=d-(H[d-4>>2]&-2)|0;f=H[e-4>>2];H[b+8>>2]=a;a=e-(f&-2)|0;if(F[(a+H[a>>2]|0)-4|0]&1){b=H[a+4>>2];e=H[a+8>>2];H[b+8>>2]=e;H[e+4>>2]=b;b=c-a|0;H[a>>2]=b;break c}a=d-16|0;break d}H[d>>2]=16;H[d+8>>2]=a;H[d+4>>2]=b;H[d+12>>2]=16;H[6856]=d;a=d+16|0}b=c-a|0;H[a>>2]=b}H[((b&-4)+a|0)-4>>2]=b|1;c=H[a>>2]-8|0;e:{if(c>>>0<=127){b=(c>>>3|0)-1|0;break e}e=Q(c);b=((c>>>29-e^4)-(e<<2)|0)+110|0;if(c>>>0<=4095){break e}b=((c>>>30-e^2)-(e<<1)|0)+71|0;b=b>>>0>=63?63:b}c=b<<4;H[a+4>>2]=c+26400;c=c+26408|0;H[a+8>>2]=H[c>>2];H[c>>2]=a;H[H[a+8>>2]+4>>2]=a;c=H[6858];e=H[6859];a=b&31;if((b&63)>>>0>=32){b=1<>>32-a}H[6858]=f|c;H[6859]=b|e}return(d|0)!=-1}function Hd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0;f=oa-16|0;oa=f;a:{if(H[a+120>>2]|c>>>0<3){break a}Ea(b,f+12|0,2);k=J[f+12>>1];if(k-1025>>>0<=4294966271){H[f>>2]=k;Ca(d,1,3526,f);break a}Ea(b+2|0,f+12|0,1);i=J[f+12>>1];if(!i){Ca(d,1,3174,0);break a}if(i+3>>>0>c>>>0){break a}h=Ga(N(i,k)<<2);if(!h){break a}j=Ga(i);if(!j){Da(h);break a}l=Ga(i);if(!l){Da(h);Da(j);break a}g=Ga(20);if(!g){Da(h);Da(j);Da(l);break a}d=b+3|0;H[g+8>>2]=j;H[g+4>>2]=l;G[g+16>>1]=k;H[g>>2]=h;m=H[f+12>>2];H[g+12>>2]=0;F[g+18|0]=m;H[a+120>>2]=g;while(1){Ea(d,f+12|0,1);F[e+j|0]=(I[f+12|0]&127)+1;F[e+l|0]=(H[f+12>>2]&128)>>>7;d=d+1|0;e=e+1|0;if((i|0)!=(e|0)){continue}break}g=0;while(1){e=0;a=0;while(1){e=I[e+j|0]+7>>>3|0;e=e>>>0>=4?4:e;if((e+(d-b|0)|0)>(c|0)){e=0;break a}Ea(d,f+12|0,e);H[h>>2]=H[f+12>>2];h=h+4|0;d=d+e|0;a=a+1|0;e=a&65535;if(i>>>0>e>>>0){continue}break}e=1;g=g+1|0;if((g&65535)>>>0>>0){continue}break}}oa=f+16|0;return e|0}function zd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;f=-1;e=-1;if(!(I[a+68|0]&8)){f=H[a+32>>2];H[a+36>>2]=f;a:{b:{c:{e=H[a+48>>2];if(e){while(1){e=sa[H[a+20>>2]](f,e,H[a>>2])|0;if((e|0)==-1){break c}f=e+H[a+36>>2]|0;H[a+36>>2]=f;e=H[a+48>>2]-e|0;H[a+48>>2]=e;if(e){continue}break}f=H[a+32>>2]}H[a+36>>2]=f;if(!!b&(c|0)>=0|(c|0)>0){break b}f=0;e=0;break a}H[a+68>>2]=H[a+68>>2]|8;Ca(d,4,15604,0);H[a+48>>2]=0;H[a+68>>2]=H[a+68>>2]|8;ra=-1;return-1}f=0;e=0;while(1){g=sa[H[a+24>>2]](b,c,H[a>>2])|0;h=ra;i=h;if((g&h)==-1){Ca(d,4,15589,0);H[a+68>>2]=H[a+68>>2]|8;b=e+H[a+60>>2]|0;c=f+H[a+56>>2]|0;b=c>>>0>>0?b+1|0:b;H[a+56>>2]=c;H[a+60>>2]=b;a=!(e|f);b=a?-1:f;ra=a?-1:e;return b|0}e=e+i|0;f=f+g|0;e=f>>>0>>0?e+1|0:e;h=b;b=b-g|0;c=c-(i+(g>>>0>h>>>0)|0)|0;if(!!b&(c|0)>=0|(c|0)>0){continue}break}}b=e+H[a+60>>2]|0;c=f+H[a+56>>2]|0;b=c>>>0>>0?b+1|0:b;H[a+56>>2]=c;H[a+60>>2]=b}ra=e;return f|0}function Kc(a){var b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;b=a;a:{if(b&3){while(1){c=I[b|0];if(!c|(c|0)==61){break a}b=b+1|0;if(b&3){continue}break}}b:{c:{d=H[b>>2];if(((d|16843008-d)&-2139062144)!=-2139062144){break c}while(1){c=d^1027423549;if(((16843008-c|c)&-2139062144)!=-2139062144){break c}d=H[b+4>>2];c=b+4|0;b=c;if(((16843008-d|d)&-2139062144)==-2139062144){continue}break}break b}c=b}while(1){b=c;d=I[b|0];if(!d){break a}c=b+1|0;if((d|0)!=61){continue}break}}if((a|0)==(b|0)){return 0}g=b-a|0;d:{if(I[g+a|0]){break d}f=H[6860];if(!f){break d}b=H[f>>2];if(!b){break d}while(1){e:{d=a;c=b;h=g;e=0;f:{if(!g){break f}e=I[d|0];if(e){g:{while(1){i=I[c|0];if((i|0)!=(e|0)|!i){break g}h=h-1|0;if(!h){break g}c=c+1|0;e=I[d+1|0];d=d+1|0;if(e){continue}break}e=0}}else{e=0}e=e-I[c|0]|0}if(!e){b=b+g|0;if(I[b|0]==61){break e}}b=H[f+4>>2];f=f+4|0;if(b){continue}break d}break}j=b+1|0}return j}function qe(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;g=oa-16|0;oa=g;a:{if(c>>>0<=1){Ca(d,1,3983,0);a=0;break a}if(F[a+212|0]&1){Ca(d,1,12668,0);a=0;break a}a=H[a+180>>2]+N(H[a+228>>2],5644)|0;F[a+5640|0]=I[a+5640|0]|2;Ea(b,g+12|0,1);e=H[a+5164>>2];b:{if(!e){f=H[g+12>>2]+1|0;e=Fa(f,8);H[a+5164>>2]=e;if(!e){Ca(d,1,4009,0);a=0;break a}H[a+5160>>2]=f;break b}f=H[g+12>>2];if(f>>>0>2]){break b}h=e;e=f+1|0;f=Ia(h,e<<3);if(!f){Ca(d,1,4009,0);a=0;break a}H[a+5164>>2]=f;h=H[a+5160>>2];i=e-h<<3;if(i){y(f+(h<<3)|0,0,i)}H[a+5160>>2]=e;e=H[a+5164>>2]}h=e;e=H[g+12>>2];if(H[h+(e<<3)>>2]){H[g>>2]=e;Ca(d,1,7063,g);a=0;break a}c=c-1|0;e=Ga(c);a=H[a+5164>>2];f=H[g+12>>2];H[a+(f<<3)>>2]=e;if(!e){Ca(d,1,4009,0);a=0;break a}H[(a+(f<<3)|0)+4>>2]=c;if(c){B(H[a+(H[g+12>>2]<<3)>>2],b+1|0,c)}a=1}oa=g+16|0;return a|0}function Ib(a,b,c){var d=0,e=0,f=0,g=0;e=a+4|0;d=(e+b|0)-1&0-b;b=H[a>>2];if(d+c>>>0<=(b+a|0)-4>>>0){f=H[a+4>>2];g=H[a+8>>2];H[f+8>>2]=g;H[g+4>>2]=f;if((d|0)!=(e|0)){d=d-e|0;f=a-(H[a-4>>2]&-2)|0;e=d+H[f>>2]|0;H[f>>2]=e;H[(f+(e&-4)|0)-4>>2]=e;a=a+d|0;b=b-d|0;H[a>>2]=b}a:{if(c+24>>>0<=b>>>0){e=a+c|0;b=(b-c|0)-8|0;H[e+8>>2]=b;g=e+8|0;H[(g+(b&-4)|0)-4>>2]=b|1;d=H[e+8>>2]-8|0;b:{if(d>>>0<=127){b=(d>>>3|0)-1|0;break b}f=Q(d);b=((d>>>29-f^4)-(f<<2)|0)+110|0;if(d>>>0<=4095){break b}b=((d>>>30-f^2)-(f<<1)|0)+71|0;b=b>>>0>=63?63:b}d=b<<4;H[e+12>>2]=d+26400;d=d+26408|0;H[e+16>>2]=H[d>>2];H[d>>2]=g;H[H[e+16>>2]+4>>2]=g;d=H[6858];f=H[6859];e=b&31;if((b&63)>>>0>=32){b=1<>>32-e}H[6858]=g|d;H[6859]=b|f;b=c+8|0;H[a>>2]=b;c=(b&-4)+a|0;break a}c=a+b|0}H[c-4>>2]=b;a=a+4|0}else{a=0}return a}function we(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;g=oa-16|0;oa=g;i=H[H[a+96>>2]+16>>2];h=i>>>0<257?1:2;e=(h<<1)+5|0;f=(c>>>0)/(e>>>0)|0;a:{if(!((N(e,f)|0)==(c|0)&c>>>0>=e>>>0)){Ca(d,1,4643,0);a=0;break a}if(H[a+8>>2]==16){e=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{e=H[a+12>>2]}a=0;c=I[e+5640|0];a=c&4?H[e+420>>2]+1|0:a;f=f+a|0;if(f>>>0>=32){H[g>>2]=f;Ca(d,1,7781,g);a=0;break a}F[e+5640|0]=c|4;if(a>>>0>>0){c=(e+N(a,148)|0)+424|0;while(1){Ea(b,c,1);b=b+1|0;Ea(b,c+4|0,h);b=b+h|0;Ea(b,c+8|0,2);d=H[c+8>>2];j=H[e+8>>2];H[c+8>>2]=d>>>0>>0?d:j;Ea(b+2|0,c+12|0,1);b=b+3|0;Ea(b,c+16|0,h);b=b+h|0;Ea(b,g+12|0,1);H[c+36>>2]=H[g+12>>2];d=H[c+16>>2];H[c+16>>2]=d>>>0>>0?d:i;c=c+148|0;b=b+1|0;a=a+1|0;if((f|0)!=(a|0)){continue}break}}H[e+420>>2]=f-1;a=1}oa=g+16|0;return a|0}function mb(a){var b=0,c=0,d=0,e=0;a:{if(!a){break a}b=H[a+5164>>2];if(b){c=H[a+5160>>2];if(c){b=0;while(1){d=H[H[a+5164>>2]+(b<<3)>>2];if(d){Da(d);c=H[a+5160>>2]}b=b+1|0;if(c>>>0>b>>>0){continue}break}b=H[a+5164>>2]}H[a+5160>>2]=0;Da(b);H[a+5164>>2]=0}b=H[a+5172>>2];if(b){Da(b);H[a+5172>>2]=0}b=H[a+5584>>2];if(b){Da(b);H[a+5584>>2]=0}b=H[a+5612>>2];if(b){Da(b);H[a+5612>>2]=0}b=H[a+5608>>2];if(b){Da(b);H[a+5608>>2]=0}b=H[a+5628>>2];if(b){Da(b);H[a+5636>>2]=0;H[a+5628>>2]=0;H[a+5632>>2]=0}b=H[a+5616>>2];if(b){e=H[a+5620>>2];if(e){c=0;while(1){d=H[b+12>>2];if(d){Da(d);H[b+12>>2]=0;e=H[a+5620>>2]}b=b+20|0;c=c+1|0;if(e>>>0>c>>>0){continue}break}b=H[a+5616>>2]}Da(b);H[a+5616>>2]=0}b=H[a+5604>>2];if(b){Da(b);H[a+5604>>2]=0}b=H[a+5596>>2];if(!b){break a}Da(b);H[a+5596>>2]=0;H[a+5600>>2]=0}}function Kd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=oa-32|0;oa=e;a:{if(H[a+72>>2]){Ca(d,2,7015,0);c=1;break a}if((c|0)!=14){c=0;Ca(d,1,14445,0);break a}Ea(b,a+16|0,4);Ea(b+4|0,a+12|0,4);Ea(b+8|0,a+20|0,2);f=H[a+12>>2];b:{g=H[a+16>>2];c=H[a+20>>2];c:{if(!g){break c}c=H[a+20>>2];if(!f){break c}if(c){break b}c=0}H[e+8>>2]=c;H[e+4>>2]=g;H[e>>2]=f;Ca(d,1,14289,e);c=0;break a}if(c-16385>>>0<=4294950911){c=0;Ca(d,1,14203,0);break a}c=Fa(c,12);H[a+72>>2]=c;if(!c){c=0;Ca(d,1,14240,0);break a}c=1;Ea(b+10|0,a+24|0,1);Ea(b+11|0,a+28|0,1);f=H[a+28>>2];if((f|0)!=7){H[e+16>>2]=f;Ca(d,4,16272,e+16|0)}Ea(b+12|0,a+32|0,1);Ea(b+13|0,a+36|0,1);b=H[a>>2];F[b+212|0]=I[b+212|0]&251|(H[a+24>>2]==255?4:0);b=H[a>>2];H[b+240>>2]=H[a+12>>2];H[b+244>>2]=H[a+16>>2];F[a+133|0]=1}oa=e+32|0;return c|0}function Dc(a,b,c,d){a:{switch(b-9|0){case 0:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=H[b>>2];return;case 6:b=H[c>>2];H[c>>2]=b+4;b=G[b>>1];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 7:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=J[b>>1];H[a+4>>2]=0;return;case 8:b=H[c>>2];H[c>>2]=b+4;b=F[b|0];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 9:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=I[b|0];H[a+4>>2]=0;return;case 16:b=H[c>>2]+7&-8;H[c>>2]=b+8;M[a>>3]=M[b>>3];return;case 17:sa[d|0](a,c);default:return;case 1:case 4:case 14:b=H[c>>2];H[c>>2]=b+4;b=H[b>>2];H[a>>2]=b;H[a+4>>2]=b>>31;return;case 2:case 5:case 11:case 15:b=H[c>>2];H[c>>2]=b+4;H[a>>2]=H[b>>2];H[a+4>>2]=0;return;case 3:case 10:case 12:case 13:break a}}b=H[c>>2]+7&-8;H[c>>2]=b+8;c=H[b+4>>2];H[a>>2]=H[b>>2];H[a+4>>2]=c}function re(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;g=oa-16|0;oa=g;a:{if(c>>>0<=1){Ca(d,1,4311,0);a=0;break a}F[a+212|0]=I[a+212|0]|1;Ea(b,g+12|0,1);e=H[a+140>>2];b:{if(!e){f=H[g+12>>2]+1|0;e=Fa(f,8);H[a+140>>2]=e;if(!e){Ca(d,1,4337,0);a=0;break a}H[a+136>>2]=f;break b}f=H[g+12>>2];if(f>>>0>2]){break b}h=e;e=f+1|0;f=Ia(h,e<<3);if(!f){Ca(d,1,4337,0);a=0;break a}H[a+140>>2]=f;h=H[a+136>>2];i=e-h<<3;if(i){y(f+(h<<3)|0,0,i)}H[a+136>>2]=e;e=H[a+140>>2]}h=e;e=H[g+12>>2];if(H[h+(e<<3)>>2]){H[g>>2]=e;Ca(d,1,7085,g);a=0;break a}c=c-1|0;e=Ga(c);a=H[a+140>>2];f=H[g+12>>2];H[a+(f<<3)>>2]=e;if(!e){Ca(d,1,4337,0);a=0;break a}H[(a+(f<<3)|0)+4>>2]=c;if(c){B(H[a+(H[g+12>>2]<<3)>>2],b+1|0,c)}a=1}oa=g+16|0;return a|0}function ud(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;d=oa-32|0;oa=d;e=H[a+28>>2];H[d+16>>2]=e;f=H[a+20>>2];H[d+28>>2]=c;H[d+24>>2]=b;b=f-e|0;H[d+20>>2]=b;f=b+c|0;i=2;b=d+16|0;a:{while(1){b:{c:{d:{if(!Hb(_(H[a+60>>2],b|0,i|0,d+12|0)|0)){g=H[d+12>>2];if((g|0)==(f|0)){break d}if((g|0)>=0){break c}break b}if((f|0)!=-1){break b}}b=H[a+44>>2];H[a+28>>2]=b;H[a+20>>2]=b;H[a+16>>2]=b+H[a+48>>2];a=c;break a}h=H[b+4>>2];j=h>>>0>>0;e=(j?8:0)+b|0;h=g-(j?h:0)|0;H[e>>2]=h+H[e>>2];b=(j?12:4)+b|0;H[b>>2]=H[b>>2]-h;f=f-g|0;i=i-j|0;b=e;continue}break}H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a>>2]=H[a>>2]|32;a=0;if((i|0)==2){break a}a=c-H[b+4>>2]|0}oa=d+32|0;return a|0}function Da(a){a=a|0;var b=0,c=0,d=0,e=0,f=0;if(a){b=a-4|0;f=H[b>>2];c=f;d=b;e=H[a-8>>2];a=e&-2;if((a|0)!=(e|0)){d=b-a|0;c=H[d+4>>2];e=H[d+8>>2];H[c+8>>2]=e;H[e+4>>2]=c;c=a+f|0}a=b+f|0;b=H[a>>2];if((b|0)!=H[(a+b|0)-4>>2]){f=H[a+4>>2];a=H[a+8>>2];H[f+8>>2]=a;H[a+4>>2]=f;c=b+c|0}H[d>>2]=c;H[((c&-4)+d|0)-4>>2]=c|1;b=H[d>>2]-8|0;a:{if(b>>>0<=127){a=(b>>>3|0)-1|0;break a}c=Q(b);a=((b>>>29-c^4)-(c<<2)|0)+110|0;if(b>>>0<=4095){break a}a=((b>>>30-c^2)-(c<<1)|0)+71|0;a=a>>>0>=63?63:a}b=a<<4;H[d+4>>2]=b+26400;b=b+26408|0;H[d+8>>2]=H[b>>2];H[b>>2]=d;H[H[d+8>>2]+4>>2]=d;b=H[6858];c=H[6859];d=a&31;if((a&63)>>>0>=32){a=1<>>32-d}H[6858]=e|b;H[6859]=a|c}}function hd(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;if(K[a+44>>2]>=8){e=H[a+36>>2];j=e<<5;k=N(e,28);l=N(e,24);m=N(e,20);n=e<<4;o=N(e,12);p=e<<3;f=H[a+40>>2];g=8;while(1){Eb(a,f,H[a+36>>2],8);Wa(a);h=H[a+32>>2];if(h){i=H[a>>2];b=0;while(1){c=(b<<2)+f|0;d=i+(b<<5)|0;L[c>>2]=L[d>>2];L[c+(e<<2)>>2]=L[d+4>>2];L[c+p>>2]=L[d+8>>2];L[c+o>>2]=L[d+12>>2];b=b+1|0;if((h|0)!=(b|0)){continue}break}i=H[a>>2];b=0;while(1){c=(b<<2)+f|0;d=i+(b<<5)|0;L[c+n>>2]=L[d+16>>2];L[c+m>>2]=L[d+20>>2];L[c+l>>2]=L[d+24>>2];L[c+k>>2]=L[d+28>>2];b=b+1|0;if((h|0)!=(b|0)){continue}break}}f=f+j|0;g=g+8|0;if(g>>>0<=K[a+44>>2]){continue}break}}Da(H[a>>2]);Da(a)}function Ed(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0;e=oa-16|0;oa=e;a:{if(H[a+116>>2]){break a}if(c>>>0<=1){Ca(d,1,8882,0);break a}Ea(b,e+12|0,2);f=H[e+12>>2];h=f&65535;if(!h){Ca(d,1,8915,0);break a}if(N(h,6)+2>>>0>c>>>0){Ca(d,1,8882,0);break a}d=Ga(N(f,6));if(!d){break a}c=Ga(8);H[a+116>>2]=c;if(!c){Da(d);break a}H[c>>2]=d;f=c;c=J[e+12>>1];G[f+4>>1]=c;if(!c){g=1;break a}c=0;while(1){g=e+12|0;Ea(b+2|0,g,2);f=d+N(c,6)|0;G[f>>1]=H[e+12>>2];Ea(b+4|0,g,2);G[f+2>>1]=H[e+12>>2];b=b+6|0;Ea(b,g,2);G[f+4>>1]=H[e+12>>2];g=1;c=c+1|0;if(c>>>0>2]+4>>1]){continue}break}}oa=e+16|0;return g|0}function Xb(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;g=oa-32|0;oa=g;f=H[a+96>>2];a:{if(!f){Ca(d,1,13752,0);e=0;break a}f=Fa(4,H[f+16>>2]);e=0;if(!f){break a}if(b){j=H[a+96>>2];while(1){b:{e=H[(h<<2)+c>>2];c:{if(e>>>0>=K[j+16>>2]){H[g+16>>2]=e;Ca(d,1,2443,g+16|0);break c}i=f+(e<<2)|0;if(!H[i>>2]){break b}H[g>>2]=e;Ca(d,1,3487,g)}Da(f);e=0;break a}H[i>>2]=1;h=h+1|0;if((h|0)!=(b|0)){continue}break}}Da(f);Da(H[a+64>>2]);d:{if(b){d=b<<2;e=Ga(d);H[a+64>>2]=e;if(!e){H[a+60>>2]=0;e=0;break a}if(!d){break d}B(e,c,d);break d}H[a+64>>2]=0}H[a+60>>2]=b;e=1}oa=g+32|0;return e|0}function Pc(a){a=a|0;var b=0,c=0;if(a){Bb(H[a>>2]);H[a>>2]=0;b=H[a+72>>2];if(b){Da(b);H[a+72>>2]=0}b=H[a+68>>2];if(b){Da(b);H[a+68>>2]=0}b=H[a+108>>2];if(b){Da(b);H[a+108>>2]=0}b=H[a+116>>2];if(b){c=H[b>>2];if(c){Da(c);b=H[a+116>>2];H[b>>2]=0}Da(b);H[a+116>>2]=0}b=H[a+120>>2];if(b){c=H[b+12>>2];if(c){Da(c);b=H[a+120>>2];H[b+12>>2]=0}c=H[b+4>>2];if(c){Da(c);b=H[a+120>>2];H[b+4>>2]=0}c=H[b+8>>2];if(c){Da(c);b=H[a+120>>2];H[b+8>>2]=0}c=H[b>>2];if(c){Da(c);b=H[a+120>>2];H[b>>2]=0}Da(b);H[a+120>>2]=0}b=H[a+4>>2];if(b){sb(b);H[a+4>>2]=0}b=H[a+8>>2];if(b){sb(b);H[a+8>>2]=0}Da(a)}}function Ub(){var a=0,b=0,c=0;a:{a=Fa(1,256);if(a){H[a>>2]=1;H[a+208>>2]=1;F[a+212|0]=I[a+212|0]|6;b=Fa(1,5644);H[a+12>>2]=b;if(!b){break a}b=Fa(1,1e3);H[a+16>>2]=b;if(!b){break a}H[a+48>>2]=0;H[a+52>>2]=0;H[a+44>>2]=-1;H[a+20>>2]=1e3;b:{c=Fa(1,48);if(c){H[c+24>>2]=0;H[c+32>>2]=100;b=Fa(100,24);H[c+28>>2]=b;if(b){break b}Da(c)}H[a+224>>2]=0;break a}H[c+40>>2]=0;H[a+224>>2]=c;b=tb();H[a+220>>2]=b;if(!b){break a}b=tb();H[a+216>>2]=b;if(!b){break a}c:{if(!Kc(1419)){break c}}b=vc();H[a+236>>2]=b;if(!b){b=vc();H[a+236>>2]=b;if(!b){break a}}}else{a=0}return a}Bb(a);return 0}function wb(a,b,c,d,e,f){var g=0,h=0,i=0,j=0,k=0,l=0;g=oa-240|0;oa=g;H[g+236>>2]=c;H[g+232>>2]=b;H[g>>2]=a;l=!e;a:{b:{c:{d:{if((b|0)!=1){h=a;i=1;break d}h=a;i=1;if(c){break d}e=a;break c}while(1){j=(d<<2)+f|0;e=h-H[j>>2]|0;if((db(e,a)|0)<=0){e=h;break c}k=l^-1;l=1;e:{if(!((k|(d|0)<2)&1)){j=H[j-8>>2];k=h-8|0;if((db(k,e)|0)>=0){break e}if((db(k-j|0,e)|0)>=0){break e}}H[(i<<2)+g>>2]=e;b=Jc(b,c);xb(g+232|0,b);i=i+1|0;d=b+d|0;h=e;c=H[g+236>>2];b=H[g+232>>2];if(c|(b|0)!=1){continue}break b}break}e=h;break b}if(!l){break a}}Ic(g,i);Gb(e,d,f)}oa=g+240|0}function Gc(a,b,c,d,e){var f=0,g=0,h=0;f=oa-208|0;oa=f;H[f+204>>2]=c;c=f+160|0;y(c,0,40);H[f+200>>2]=H[f+204>>2];a:{if((Fc(0,b,f+200|0,f+80|0,c,d,e)|0)<0){break a}c=H[a+76>>2]<0;g=H[a>>2];H[a>>2]=g&-33;b:{c:{d:{if(!H[a+48>>2]){H[a+48>>2]=80;H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;h=H[a+44>>2];H[a+44>>2]=f;break d}if(H[a+16>>2]){break c}}if(Kb(a)){break b}}Fc(a,b,f+200|0,f+80|0,f+160|0,d,e)}if(h){sa[H[a+36>>2]](a,0,0)|0;H[a+48>>2]=0;H[a+44>>2]=h;H[a+28>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0}H[a>>2]=H[a>>2]|g&32;if(c){break a}}oa=f+208|0}function Be(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=oa-16|0;oa=e;if(H[a+8>>2]==16){g=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{g=H[a+12>>2]}h=H[a+96>>2];f=K[h+16>>2]<257?1:2;a:{if(f>>>0>=c>>>0){c=0;Ca(d,1,4669,0);break a}H[e+12>>2]=(f^-1)+c;Ea(b,e+8|0,f);i=H[e+8>>2];if(i>>>0>=K[h+16>>2]){c=0;Ca(d,1,14067,0);break a}c=1;b=b+f|0;Ea(b,H[g+5584>>2]+N(i,1080)|0,1);if(!Wc(a,H[e+8>>2],b+1|0,e+12|0,d)){c=0;Ca(d,1,4669,0);break a}if(!H[e+12>>2]){break a}c=0;Ca(d,1,4669,0)}oa=e+16|0;return c|0}function Rc(a,b){var c=0,d=0,e=0,f=0,g=0;f=oa-32|0;oa=f;c=H[a+60>>2];a:{b:{if(c){g=1;while(1){e=H[H[a+64>>2]+(d<<2)>>2];if(!H[(H[H[a+100>>2]+24>>2]+N(e,52)|0)+44>>2]){H[f+16>>2]=e;Ca(b,2,7604,f+16|0);g=0;c=H[a+60>>2]}d=d+1|0;if(c>>>0>d>>>0){continue}break}break b}g=1;c=H[a+100>>2];e=1;if(!H[c+16>>2]){break a}while(1){if(!H[(H[c+24>>2]+N(d,52)|0)+44>>2]){H[f>>2]=d;Ca(b,2,7604,f);g=0;c=H[a+100>>2]}d=d+1|0;if(d>>>0>2]){continue}break}}e=1;if(g){break a}Ca(b,1,2897,0);e=0}oa=f+32|0;return e}function Gd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0;f=oa-16|0;oa=f;e=H[a+120>>2];a:{if(!e){Ca(d,1,8836,0);c=0;break a}if(H[e+12>>2]){Ca(d,1,11598,0);c=0;break a}e=I[e+18|0];g=e<<2;if(g>>>0>c>>>0){Ca(d,1,8803,0);c=0;break a}g=Ga(g);c=0;if(!g){break a}if(e){d=0;while(1){c=f+12|0;Ea(b,c,2);h=g+(d<<2)|0;G[h>>1]=H[f+12>>2];Ea(b+2|0,c,1);F[h+2|0]=H[f+12>>2];Ea(b+3|0,c,1);F[h+3|0]=H[f+12>>2];b=b+4|0;d=d+1|0;if((e|0)!=(d|0)){continue}break}}H[H[a+120>>2]+12>>2]=g;c=1}oa=f+16|0;return c|0}function me(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0;e=oa-16|0;oa=e;g=H[H[a+96>>2]+16>>2];a:{if((g+2|0)!=(c|0)){Ca(d,1,4617,0);break a}Ea(b,e+12|0,2);if(H[e+12>>2]!=(g|0)){Ca(d,1,4617,0);break a}if(!g){f=1;break a}c=b+2|0;a=H[H[a+96>>2]+24>>2];b=0;while(1){Ea(c,e+8|0,1);f=H[e+8>>2];h=f&127;i=h+1|0;H[a+24>>2]=i;H[a+32>>2]=f>>>7&1;if(h>>>0>=31){H[e+4>>2]=i;H[e>>2]=b;Ca(d,1,15402,e);f=0;break a}a=a+52|0;f=1;c=c+1|0;b=b+1|0;if((g|0)!=(b|0)){continue}break}}oa=e+16|0;return f|0}function ye(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0;e=oa-16|0;oa=e;a:{b:{h=e+8|0;c:{if(K[H[a+96>>2]+16>>2]<=256){if(c){f=-1;g=1;break c}Ca(d,1,4695,0);a=0;break a}if(c>>>0<=1){break b}f=-2;g=2}Ea(b,h,g);H[e+12>>2]=c+f;c=H[e+8>>2];f=H[H[a+96>>2]+16>>2];if(c>>>0>=f>>>0){H[e+4>>2]=f;H[e>>2]=c;Ca(d,1,7712,e);a=0;break a}if(!Vc(a,c,b+g|0,e+12|0,d)){Ca(d,1,4695,0);a=0;break a}a=1;if(!H[e+12>>2]){break a}Ca(d,1,4695,0);a=0;break a}Ca(d,1,4695,0);a=0}oa=e+16|0;return a|0}function pc(a,b,c,d){var e=0,f=0,g=0;g=oa-128|0;oa=g;f=g;c=H[b+12>>2]+(c<<4)|0;e=H[c>>2];a:{if(!e){b=c;break a}while(1){H[f>>2]=c;f=f+4|0;b=e;c=b;e=H[c>>2];if(e){continue}break}}e=0;while(1){c=H[b+8>>2];if((e|0)>(c|0)){H[b+8>>2]=e;c=e}b:{if((c|0)>=(d|0)){break b}while(1){if(H[b+4>>2]<=(c|0)){break b}c:{if(Ta(a,1)){H[b+4>>2]=c;break c}c=c+1|0}if((c|0)<(d|0)){continue}break}}H[b+8>>2]=c;if((f|0)!=(g|0)){f=f-4|0;b=H[f>>2];e=c;continue}break}oa=g+128|0;return H[b+4>>2]<(d|0)}function Qd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;f=H[a+32>>2];H[a+36>>2]=f;a:{e=H[a+48>>2];if(e){while(1){e=sa[H[a+20>>2]](f,e,H[a>>2])|0;if((e|0)==-1){break a}f=e+H[a+36>>2]|0;H[a+36>>2]=f;e=H[a+48>>2]-e|0;H[a+48>>2]=e;if(e){continue}break}f=H[a+32>>2]}H[a+48>>2]=0;H[a+36>>2]=f;if(!(sa[H[a+28>>2]](b,c,H[a>>2])|0)){H[a+68>>2]=H[a+68>>2]|8;return 0}H[a+56>>2]=b;H[a+60>>2]=c;return 1}H[a+68>>2]=H[a+68>>2]|8;Ca(d,4,15604,0);H[a+68>>2]=H[a+68>>2]|8;return 0}function Ca(a,b,c,d){var e=0,f=0;e=oa-528|0;oa=e;a:{if(!a){break a}b:{c:{switch(b-1|0){case 0:b=a+12|0;break b;case 1:b=a+16|0;a=a+4|0;break b;case 3:break c;default:break a}}b=a+20|0;a=a+8|0}b=H[b>>2];if(!b|!c){break a}f=H[a>>2];y(e,0,512);H[e+524>>2]=d;a=oa-160|0;oa=a;H[a+148>>2]=e;H[a+152>>2]=511;y(a,0,144);H[a+76>>2]=-1;H[a+36>>2]=103;H[a+80>>2]=-1;H[a+44>>2]=a+159;H[a+84>>2]=a+148;F[e|0]=0;Gc(a,c,d,104,105);oa=a+160|0;F[e+511|0]=0;sa[b|0](e,f)}oa=e+528|0}function Md(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;if(H[a+100>>2]!=1){Ca(d,1,11401,0);return 0}a:{if(c>>>0<=7){break a}Ea(b,a+56|0,4);Ea(b+4|0,a+60|0,4);if(c&3){break a}c=c-8|0;e=c>>>2|0;H[a+64>>2]=e;b:{if(!c){break b}c=Fa(e,4);H[a+68>>2]=c;if(!c){Ca(d,1,2235,0);return 0}if(!H[a+64>>2]){break b}d=b+8|0;c=0;while(1){Ea(d,H[a+68>>2]+(c<<2)|0,4);d=d+4|0;c=c+1|0;if(c>>>0>2]){continue}break}}H[a+100>>2]=H[a+100>>2]|2;return 1}Ca(d,1,5955,0);return 0}function rc(a){var b=0,c=0,d=0;a:{if(!a){break a}b=H[a+8>>2];if(!b){break a}a=H[a+12>>2];if(b>>>0>=4){d=b&-4;while(1){H[a+60>>2]=0;H[a+52>>2]=999;H[a+56>>2]=0;H[a+44>>2]=0;H[a+36>>2]=999;H[a+40>>2]=0;H[a+28>>2]=0;H[a+20>>2]=999;H[a+24>>2]=0;H[a+12>>2]=0;H[a+4>>2]=999;H[a+8>>2]=0;a=a- -64|0;c=c+4|0;if((d|0)!=(c|0)){continue}break}}b=b&3;if(!b){break a}c=0;while(1){H[a+12>>2]=0;H[a+4>>2]=999;H[a+8>>2]=0;a=a+16|0;c=c+1|0;if((b|0)!=(c|0)){continue}break}}} +function ze(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=oa-16|0;oa=e;H[e+12>>2]=c;a:{if(!(!Vc(a,0,b,e+12|0,d)|H[e+12>>2])){if(H[a+8>>2]==16){b=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{b=H[a+12>>2]}f=1;if(K[H[a+96>>2]+16>>2]<2){break a}c=H[b+5584>>2];g=c+28|0;b=1;d=c;while(1){H[d+1104>>2]=H[c+24>>2];H[d+1884>>2]=H[c+804>>2];B(d+1108|0,g,776);d=d+1080|0;b=b+1|0;if(b>>>0>2]+16>>2]){continue}break}break a}Ca(d,1,4591,0)}oa=e+16|0;return f|0}function Cc(a,b){a:{b:{if(b>>>0<=127){break b}c:{if(!H[H[6885]>>2]){if((b&-128)==57216){break b}break c}if(b>>>0<=2047){F[a+1|0]=b&63|128;F[a|0]=b>>>6|192;a=2;break a}if(!((b&-8192)!=57344&b>>>0>=55296)){F[a+2|0]=b&63|128;F[a|0]=b>>>12|224;F[a+1|0]=b>>>6&63|128;a=3;break a}if(b-65536>>>0<=1048575){F[a+3|0]=b&63|128;F[a|0]=b>>>18|240;F[a+2|0]=b>>>6&63|128;F[a+1|0]=b>>>12&63|128;a=4;break a}}H[6597]=25;a=-1;break a}F[a|0]=b;a=1}return a}function _d(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0,i=0,j=0;if(!Ya(H[a+8>>2],54,c)){return 0}h=H[a+8>>2];d=H[h>>2];f=H[h+8>>2];a:{if(d){e=1;i=d&1;if((d|0)==1){d=0}else{d=d&-2;while(1){g=0;b:{if(!e){break b}g=0;if(!(sa[H[f>>2]](a,b,c)|0)){break b}g=(sa[H[f+4>>2]](a,b,c)|0)!=0}e=g;f=f+8|0;j=j+2|0;if((d|0)!=(j|0)){continue}break}d=!e}e=i?0:e;if(!(d|!i)){e=(sa[H[f>>2]](a,b,c)|0)!=0}Qa(h);if(e){break a}return 0}Qa(h)}return 1}function Ae(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=oa-16|0;oa=e;g=H[H[a+96>>2]+16>>2];f=g>>>0<257?1:2;a:{if((f+2|0)!=(c|0)){a=0;Ca(d,1,4285,0);break a}if(H[a+8>>2]==16){c=H[a+180>>2]+N(H[a+228>>2],5644)|0}else{c=H[a+12>>2]}Ea(b,e+12|0,f);a=1;b=b+f|0;Ea(b,e+8|0,1);f=H[e+12>>2];if(f>>>0>=g>>>0){H[e+4>>2]=g;H[e>>2]=f;Ca(d,1,14923,e);a=0;break a}Ea(b+1|0,(H[c+5584>>2]+N(f,1080)|0)+808|0,1)}oa=e+16|0;return a|0}function Fe(){var a=0,b=0,c=0;while(1){b=a<<4;c=b+26400|0;H[b+26404>>2]=c;H[b+26408>>2]=c;a=a+1|0;if((a|0)!=64){continue}break}Lc(48);a=oa-16|0;oa=a;a:{if(ma(a+12|0,a+8|0)|0){break a}b=yb((H[a+12>>2]<<2)+4|0);H[6860]=b;if(!b){break a}b=yb(H[a+8>>2]);if(b){c=H[6860];H[c+(H[a+12>>2]<<2)>>2]=0;if(!(la(c|0,b|0)|0)){break a}}H[6860]=0}oa=a+16|0;H[6876]=8192;H[6874]=94352;H[6867]=42;H[6885]=27608;H[6875]=65536}function Jb(a,b,c){var d=0,e=0,f=0;d=H[c+16>>2];a:{if(!d){if(Kb(c)){break a}d=H[c+16>>2]}e=H[c+20>>2];if(d-e>>>0>>0){return sa[H[c+36>>2]](c,a,b)|0}b:{c:{if(!b|H[c+80>>2]<0){break c}d=b;while(1){f=a+d|0;if(I[f-1|0]!=10){d=d-1|0;if(d){continue}break c}break}e=sa[H[c+36>>2]](c,a,d)|0;if(e>>>0>>0){break a}b=b-d|0;e=H[c+20>>2];break b}f=a;d=0}eb(e,f,b);H[c+20>>2]=H[c+20>>2]+b;e=b+d|0}return e}function Ne(a,b,c){var d=0,e=0,f=0,g=0;g=c&63;f=g;e=f&31;if(f>>>0>=32){f=-1>>>e|0}else{d=-1>>>e|0;f=d|(1<>>0>=32){d=f<>>32-e|d<>>0>=32){d=-1<>>32-d}a=c&a;b=b&d;d=e&31;if(e>>>0>=32){c=0;a=b>>>d|0}else{c=b>>>d|0;a=((1<>>d}a=a|g;ra=c|f;return a} +function ib(a,b,c){var d=0;if(!H[a+12>>2]){sa[b|0](c,H[a+36>>2]);return}d=Ga(8);a:{if(!d){break a}H[d+4>>2]=c;H[d>>2]=b;b=Ga(8);if(!b){Da(d);return}H[b>>2]=d;c=N(H[a+4>>2],100);H[a+40>>2]=c;while(1){if((c|0)>2]){continue}break}H[b+4>>2]=H[a+20>>2];H[a+20>>2]=b;H[a+24>>2]=H[a+24>>2]+1;b=H[a+28>>2];if(!b){break a}H[H[b>>2]+8>>2]=0;H[a+28>>2]=H[b+4>>2];H[a+32>>2]=H[a+32>>2]-1;Da(b)}}function Xc(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;H[a+184>>2]=b;d=H[a+96>>2];a:{if(!d){break a}f=H[d+24>>2];if(!f){break a}e=H[a+12>>2];if(!e|!H[e+5584>>2]){break a}e=H[d+16>>2];if(!e){return 1}d=0;while(1){if(K[(H[H[a+12>>2]+5584>>2]+N(d,1080)|0)+4>>2]<=b>>>0){Ca(c,1,9177,0);return 0}H[(N(d,52)+f|0)+40>>2]=b;g=1;d=d+1|0;if((e|0)!=(d|0)){continue}break}}return g|0}function Mc(a){var b=0,c=0;b=H[a+76>>2];if(!((b|0)>=0&(!b|H[6867]!=(b&1073741823)))){a:{if(H[a+80>>2]==10){break a}b=H[a+20>>2];if((b|0)==H[a+16>>2]){break a}H[a+20>>2]=b+1;F[b|0]=10;return}Nc(a);return}b=a+76|0;c=H[b>>2];H[b>>2]=c?c:1073741823;b:{c:{if(H[a+80>>2]==10){break c}c=H[a+20>>2];if((c|0)==H[a+16>>2]){break c}H[a+20>>2]=c+1;F[c|0]=10;break b}Nc(a)}H[b>>2]=0}function La(a,b,c,d,e,f,g,h){var i=0,j=0;i=+O(e-a|0);j=i*1.402;if(P(j)<2147483647){e=~~j}else{e=-2147483648}e=e+c|0;H[f>>2]=(e|0)>=0?(b|0)>(e|0)?e:b:0;j=+O(d-a|0);i=j*.344+i*.714;if(P(i)<2147483647){a=~~i}else{a=-2147483648}a=c-a|0;H[g>>2]=(a|0)>=0?(a|0)<(b|0)?a:b:0;i=j*1.772;if(P(i)<2147483647){a=~~i}else{a=-2147483648}a=a+c|0;H[h>>2]=(a|0)>=0?(a|0)<(b|0)?a:b:0}function od(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0;e=H[a+84>>2];f=H[e>>2];d=H[e+4>>2];h=H[a+28>>2];g=H[a+20>>2]-h|0;g=d>>>0>>0?d:g;if(g){eb(f,h,g);f=g+H[e>>2]|0;H[e>>2]=f;d=H[e+4>>2]-g|0;H[e+4>>2]=d}d=c>>>0>d>>>0?d:c;if(d){eb(f,b,d);f=d+H[e>>2]|0;H[e>>2]=f;H[e+4>>2]=H[e+4>>2]-d}F[f|0]=0;b=H[a+44>>2];H[a+28>>2]=b;H[a+20>>2]=b;return c|0}function Db(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;if(a){c=H[a+4>>2];if(c){Da(c);H[a+4>>2]=0}if(b){c=a;while(1){d=H[c+200>>2];if(d){e=0;f=H[c+196>>2];if(f){while(1){g=H[d+12>>2];if(g){Da(g);H[d+12>>2]=0;f=H[c+196>>2]}d=d+16|0;e=e+1|0;if(e>>>0>>0){continue}break}d=H[c+200>>2]}Da(d);H[c+200>>2]=0}c=c+240|0;h=h+1|0;if((h|0)!=(b|0)){continue}break}}Da(a)}}function Cd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0,h=0;e=H[c+8>>2];d=e>>>0<=1?1:e;f=H[c+4>>2];g=f-H[c>>2]|0;while(1){h=d;d=d<<1;if(h-g>>>0>>0){continue}break}if((e|0)!=(h|0)){d=Ga(h);if(!d){return-1}e=H[c>>2];if(e){if(g){B(d,e,g)}Da(H[c>>2])}H[c+8>>2]=h;H[c>>2]=d;f=d+g|0;H[c+4>>2]=f}if(b){B(f,a,b)}H[c+4>>2]=H[c+4>>2]+b;return b|0}function ic(a){H[a+100>>2]=20832;H[a+96>>2]=20832;H[a+92>>2]=20832;H[a+88>>2]=20832;H[a+84>>2]=20832;H[a+80>>2]=20832;H[a+76>>2]=20832;H[a+72>>2]=20832;H[a+68>>2]=20832;H[a+64>>2]=20832;H[a+60>>2]=20832;H[a+56>>2]=20832;H[a+52>>2]=20832;H[a+48>>2]=20832;H[a+44>>2]=20832;H[a+40>>2]=20832;H[a+36>>2]=20832;H[a+32>>2]=20832;H[a+28>>2]=20832}function Ta(a,b){var c=0,d=0,e=0,f=0;if((b|0)<=0){return 0}c=H[a+12>>2];d=H[a+16>>2];while(1){e=b;a:{if(d){break a}c=c<<8&65280;H[a+12>>2]=c;d=(c|0)==65280?7:8;H[a+16>>2]=d;b=H[a+8>>2];if(b>>>0>=K[a+4>>2]){break a}H[a+8>>2]=b+1;c=I[b|0]|c;H[a+12>>2]=c}d=d-1|0;H[a+16>>2]=d;b=e-1|0;f=(c>>>d&1)<>>0>1){continue}break}return f}function Id(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;f=oa-16|0;oa=f;e=H[a+24>>2];if((e|0)!=255){H[f>>2]=e;Ca(d,2,2678,f)}a:{b:{if(H[a+20>>2]==(c|0)){if(c){break b}e=1;break a}e=0;Ca(d,1,14510,0);break a}c=0;while(1){e=1;Ea(b,(H[a+72>>2]+N(c,12)|0)+8|0,1);b=b+1|0;c=c+1|0;if(c>>>0>2]){continue}break}}oa=f+16|0;return e|0}function Ea(a,b,c){var d=0,e=0;H[b>>2]=0;a:{if(!c){break a}d=c&3;b=b+c|0;if(c>>>0>=4){e=c&-4;c=0;while(1){F[b-1|0]=I[a|0];F[b-2|0]=I[a+1|0];F[b-3|0]=I[a+2|0];b=b-4|0;F[b|0]=I[a+3|0];a=a+4|0;c=c+4|0;if((e|0)!=(c|0)){continue}break}}if(!d){break a}c=0;while(1){b=b-1|0;F[b|0]=I[a|0];a=a+1|0;c=c+1|0;if((d|0)!=(c|0)){continue}break}}}function se(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0;e=oa-16|0;oa=e;a:{if(!c){Ca(d,1,4106,0);a=0;break a}Ea(b,e+12|0,1);f=c-1|0;a=1;if(!f){break a}a=0;c=0;while(1){b=b+1|0;Ea(b,e+8|0,1);g=H[e+8>>2];c=g<<24>>31&(g&127|c)<<7;a=a+1|0;if((f|0)!=(a|0)){continue}break}a=1;if(!c){break a}Ca(d,1,4106,0);a=0}oa=e+16|0;return a|0}function nc(a,b,c,d){var e=0,f=0,g=O(0),h=0,i=O(0),j=0,k=O(0);if(d){while(1){e=f<<2;h=e+b|0;i=L[h>>2];j=a+e|0;g=L[j>>2];e=c+e|0;k=L[e>>2];L[j>>2]=O(k*O(1.4019999504089355))+g;L[h>>2]=O(g+O(i*O(-.3441300094127655)))+O(k*O(-.714139997959137));L[e>>2]=g+O(i*O(1.7719999551773071));f=f+1|0;if((f|0)!=(d|0)){continue}break}}}function Gb(a,b,c){var d=0,e=0,f=0,g=0,h=0,i=0;f=oa-240|0;oa=f;H[f>>2]=a;g=1;a:{if((b|0)<2){break a}d=a;while(1){d=d-8|0;h=b-2|0;e=d-H[(h<<2)+c>>2]|0;if((db(a,e)|0)>=0){if((db(a,d)|0)>=0){break a}}i=e;e=(db(e,d)|0)>=0;d=e?i:d;H[(g<<2)+f>>2]=d;g=g+1|0;b=e?b-1|0:h;if((b|0)>1){continue}break}}Ic(f,g);oa=f+240|0}function Ic(a,b){var c=0,d=0,e=0,f=0,g=0,h=0;c=8;f=oa-256|0;oa=f;if((b|0)>=2){h=(b<<2)+a|0;H[h>>2]=f;while(1){e=c>>>0>=256?256:c;eb(H[h>>2],H[a>>2],e);d=0;while(1){g=(d<<2)+a|0;d=d+1|0;eb(H[g>>2],H[(d<<2)+a>>2],e);H[g>>2]=H[g>>2]+e;if((b|0)!=(d|0)){continue}break}c=c-e|0;if(c){continue}break}}oa=f+256|0}function cd(a){a=a|0;var b=0,c=0,d=0,e=0;b=H[a+24>>2];if(b){c=H[a+28>>2];e=(c>>>0)/52|0;if(c>>>0>=52){while(1){c=H[b>>2];if(c){Da(c-1|0);H[b>>2]=0}c=H[b+4>>2];if(c){Da(c);H[b+4>>2]=0}c=H[b+8>>2];if(c){Da(c);H[b+8>>2]=0}b=b+52|0;d=d+1|0;if((e|0)!=(d|0)){continue}break}b=H[a+24>>2]}Da(b);H[a+24>>2]=0}}function dd(a){a=a|0;var b=0,c=0,d=0,e=0;b=H[a+24>>2];if(b){c=H[a+28>>2];e=(c>>>0)/68|0;if(c>>>0>=68){while(1){c=H[b>>2];if(c){Da(c);H[b>>2]=0}c=H[b+4>>2];if(c){Da(c);H[b+4>>2]=0}Da(H[b+60>>2]);H[b+60>>2]=0;b=b+68|0;d=d+1|0;if((e|0)!=(d|0)){continue}break}b=H[a+24>>2]}Da(b);H[a+24>>2]=0}}function id(a,b){a=a|0;b=b|0;var c=0,d=0;c=H[a+32>>2];b=H[a+28>>2];d=b+8|0;if(c>>>0>=d>>>0){while(1){qb(a,H[a+24>>2]+(b<<2)|0,H[a+20>>2],8);c=H[a+32>>2];b=d;d=b+8|0;if(c>>>0>=d>>>0){continue}break}}if(b>>>0>>0){qb(a,H[a+24>>2]+(b<<2)|0,H[a+20>>2],c-b|0)}Da(H[a>>2]);Da(a)}function cb(a,b,c){var d=0,e=0,f=0;a:{if(!b){d=a;e=b;break a}while(1){d=Ke(a,b,10,0);e=ra;a=Ie(d,e,246)+a|0;c=c-1|0;F[c|0]=a|48;f=b>>>0>9;a=d;b=e;if(f){continue}break}}if(d|e){while(1){c=c-1|0;a=(d>>>0)/10|0;F[c|0]=N(a,246)+d|48;b=d>>>0>9;d=a;if(b){continue}break}}return c}function Nd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=oa-16|0;oa=e;a:{if(H[a+100>>2]){Ca(d,1,11302,0);a=0;break a}if((c|0)!=4){Ca(d,1,5991,0);a=0;break a}Ea(b,e+12|0,4);if(H[e+12>>2]!=218793738){Ca(d,1,5007,0);a=0;break a}H[a+100>>2]=H[a+100>>2]|1;a=1}oa=e+16|0;return a|0}function Ya(a,b,c){var d=0,e=0;a:{d=H[a>>2];e=H[a+4>>2];b:{if((d|0)!=(e|0)){e=H[a+8>>2];break b}d=e+10|0;H[a+4>>2]=d;e=Ia(H[a+8>>2],d<<2);if(!e){break a}H[a+8>>2]=e;d=H[a>>2]}H[(d<<2)+e>>2]=b;H[a>>2]=d+1;return 1}Da(H[a+8>>2]);H[a>>2]=0;H[a+4>>2]=0;Ca(c,1,6123,0);return 0}function Nc(a){var b=0,c=0,d=0;c=oa-16|0;oa=c;F[c+15|0]=10;b=H[a+16>>2];a:{if(!b){if(Kb(a)){break a}b=H[a+16>>2]}d=b;b=H[a+20>>2];if(!((d|0)==(b|0)|H[a+80>>2]==10)){H[a+20>>2]=b+1;F[b|0]=10;break a}if((sa[H[a+36>>2]](a,c+15|0,1)|0)!=1){break a}}oa=c+16|0}function Ec(a){var b=0,c=0,d=0,e=0,f=0;d=H[a>>2];b=F[d|0]-48|0;if(b>>>0>9){return 0}while(1){e=-1;if(c>>>0<=214748364){c=N(c,10);e=(c^2147483647)>>>0>>0?-1:c+b|0}b=d+1|0;H[a>>2]=b;f=F[d+1|0];c=e;d=b;b=f-48|0;if(b>>>0<10){continue}break}return c}function Bc(a,b){var c=0,d=0,e=0;x(+a);d=s(1)|0;e=s(0)|0;c=d>>>20&2047;if((c|0)!=2047){if(!c){if(a==0){c=0}else{a=Bc(a*0x10000000000000000,b);c=H[b>>2]+-64|0}H[b>>2]=c;return a}H[b>>2]=c-1022;u(0,e|0);u(1,d&-2146435073|1071644672);a=+w()}return a}function de(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=O(0),f=0,g=0;d=oa-16|0;oa=d;if(c){while(1){Yc(a,d+12|0);e=L[d+12>>2];if(O(P(e))>2]=f;b=b+4|0;a=a+4|0;g=g+1|0;if((g|0)!=(c|0)){continue}break}}oa=d+16|0}function Va(a){var b=0,c=0,d=0;if(a){b=H[a+24>>2];if(b){c=H[a+16>>2];if(c){b=0;while(1){d=H[(H[a+24>>2]+N(b,52)|0)+44>>2];if(d){Da(d);c=H[a+16>>2]}b=b+1|0;if(c>>>0>b>>>0){continue}break}b=H[a+24>>2]}Da(b)}b=H[a+28>>2];if(b){Da(b)}Da(a)}}function ce(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;d=oa-16|0;oa=d;if(c){while(1){Vb(a,d+8|0);e=M[d+8>>3];if(P(e)<2147483647){f=~~e}else{f=-2147483648}H[b>>2]=f;b=b+4|0;a=a+8|0;g=g+1|0;if((g|0)!=(c|0)){continue}break}}oa=d+16|0}function Bd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0;d=H[c+4>>2];e=H[c>>2]+H[c+8>>2]|0;if((d|0)==(e|0)){ra=-1;return-1}H[c+4>>2]=a+d;f=a;c=e-d|0;d=c;e=a>>>0>>0;a=c>>31;c=e&(a|0)>=(b|0)|(a|0)>(b|0);d=c?f:d;ra=c?b:a;return d|0}function Je(a,b,c,d){var e=0,f=0,g=0,h=0;f=b^d;g=f>>31;e=b>>31;a=a^e;h=a-e|0;e=(b^e)-((a>>>0>>0)+e|0)|0;a=d>>31;b=c^a;f=f>>31;a=Ke(h,e,b-a|0,(a^d)-((a>>>0>b>>>0)+a|0)|0)^f;b=a-f|0;ra=(g^ra)-((a>>>0>>0)+g|0)|0;return b}function Xa(a){var b=0,c=0,d=0,e=0;if(a){b=H[a+20>>2];c=H[a+16>>2];if(N(b,c)){while(1){e=H[H[a+24>>2]+(d<<2)>>2];if(e){Da(e);c=H[a+16>>2];b=H[a+20>>2]}d=d+1|0;if(d>>>0>>0){continue}break}}Da(H[a+24>>2]);Da(a)}}function oc(a,b,c,d){var e=0,f=0,g=0,h=0,i=0,j=0,k=0;if(d){while(1){e=f<<2;g=e+a|0;h=c+e|0;i=H[h>>2];j=b+e|0;k=H[j>>2];e=H[g>>2]-(i+k>>2)|0;H[g>>2]=e+i;H[j>>2]=e;H[h>>2]=e+k;f=f+1|0;if((f|0)!=(d|0)){continue}break}}}function fb(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;H[a+48>>2]=0;H[a+36>>2]=H[a+32>>2];e=sa[H[a+28>>2]](b,c,H[a>>2])|0;d=H[a+68>>2];if(!e){H[a+68>>2]=d|4;return 0}H[a+56>>2]=b;H[a+60>>2]=c;H[a+68>>2]=d&-5;return 1}function Oa(a,b,c,d,e){var f=0;f=oa-256|0;oa=f;if(!(e&73728|(c|0)<=(d|0))){d=c-d|0;c=d>>>0<256;Oc(f,b,c?d:256);if(!c){while(1){Ma(a,f,256);d=d-256|0;if(d>>>0>255){continue}break}}Ma(a,f,d)}oa=f+256|0}function Ie(a,b,c){var d=0,e=0,f=0,g=0,h=0;e=c>>>16|0;d=a>>>16|0;h=N(e,d);f=c&65535;a=a&65535;g=N(f,a);d=(g>>>16|0)+N(d,f)|0;a=(d&65535)+N(a,e)|0;ra=h+N(b,c)+(d>>>16)+(a>>>16)|0;return g&65535|a<<16}function Kb(a){var b=0;b=H[a+72>>2];H[a+72>>2]=b-1|b;b=H[a>>2];if(b&8){H[a>>2]=b|32;return-1}H[a+4>>2]=0;H[a+8>>2]=0;b=H[a+44>>2];H[a+28>>2]=b;H[a+20>>2]=b;H[a+16>>2]=b+H[a+48>>2];return 0}function tc(a){var b=0,c=0;a:{if(I[a+12|0]==255){H[a+12>>2]=65280;H[a+16>>2]=7;b=H[a+8>>2];c=0;if(b>>>0>=K[a+4>>2]){break a}H[a+8>>2]=b+1;H[a+12>>2]=I[b|0]|65280}H[a+16>>2]=0;c=1}return c}function Dd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;e=H[c+4>>2];d=H[c>>2]+H[c+8>>2]|0;if((e|0)==(d|0)){return-1}d=d-e|0;b=b>>>0>d>>>0?d:b;if(b){B(a,e,b)}H[c+4>>2]=b+H[c+4>>2];return b|0}function he(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=oa-16|0;oa=d;if(c){while(1){Yc(a,d+12|0);L[b>>2]=L[d+12>>2];b=b+4|0;a=a+4|0;e=e+1|0;if((e|0)!=(c|0)){continue}break}}oa=d+16|0}function ge(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0;d=oa-16|0;oa=d;if(c){while(1){Vb(a,d+8|0);L[b>>2]=M[d+8>>3];b=b+4|0;a=a+8|0;e=e+1|0;if((e|0)!=(c|0)){continue}break}}oa=d+16|0}function jd(a,b){a=a|0;b=b|0;b=H[a+28>>2];if(b>>>0>2]){while(1){lc(a,H[a+24>>2]+(N(H[a+20>>2],b)<<2)|0);b=b+1|0;if(b>>>0>2]){continue}break}}Da(H[a>>2]);Da(a)}function nd(a,b){a=a|0;b=+b;var c=0;ja(a|0,0)|0;a=(a|0)==2?27:(a|0)==1?26:14;a:{if(H[7170]>>>a-1&1){H[7202]=H[7202]|1<>2];if(c){sa[c|0](a)}}}function Tc(a,b){a=a|0;b=b|0;var c=0,d=0;c=H[a>>2];d=H[b>>2];a=H[a+4>>2];b=H[b+4>>2];return(c>>>0>d>>>0&(a|0)>=(b|0)|(a|0)>(b|0))-(c>>>0>>0&(a|0)<=(b|0)|(a|0)<(b|0))|0}function vd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0;e=oa-16|0;oa=e;a=Hb(fa(H[a+60>>2],b|0,c|0,d&255,e+8|0)|0);oa=e+16|0;ra=a?-1:H[e+12>>2];return(a?-1:H[e+8>>2])|0}function yc(a,b,c,d){var e=0,f=0;e=oa-16|0;oa=e;if(c){while(1){Ea(a,e+12|0,d);L[b>>2]=K[e+12>>2];b=b+4|0;a=a+d|0;f=f+1|0;if((f|0)!=(c|0)){continue}break}}oa=e+16|0}function xc(a,b,c,d){var e=0,f=0;e=oa-16|0;oa=e;if(c){while(1){Ea(a,e+12|0,d);H[b>>2]=H[e+12>>2];b=b+4|0;a=a+d|0;f=f+1|0;if((f|0)!=(c|0)){continue}break}}oa=e+16|0}function Vb(a,b){F[b+7|0]=I[a|0];F[b+6|0]=I[a+1|0];F[b+5|0]=I[a+2|0];F[b+4|0]=I[a+3|0];F[b+3|0]=I[a+4|0];F[b+2|0]=I[a+5|0];F[b+1|0]=I[a+6|0];F[b|0]=I[a+7|0]}function Td(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;if(c){Ca(d,2,10224,0);if(!Nb(H[a>>2],b,c,d,e)){Ca(d,1,6210,0);return 0}a=Qc(a,c,d)}else{a=0}return a|0}function Sa(a){var b=0,c=0,d=0,e=0;b=H[a+12>>2];e=b;c=H[a+8>>2];if(!(b|c)){ra=0;return 0}d=H[a+56>>2];b=c-d|0;ra=e-(H[a+60>>2]+(c>>>0>>0)|0)|0;return b}function Xd(a,b,c,d,e,f,g,h,i,j,k){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;return Za(H[a>>2],b,c,d,e,f,g,h,i,j,k)|0}function wc(a,b){var c=0;c=oa-16|0;oa=c;if(a){if(b&3){a=28}else{a=kb(b,a);H[c+12>>2]=a;a=a?0:48}a=a?0:H[c+12>>2]}else{a=0}oa=c+16|0;return a}function ed(a){a=a|0;var b=0;if(a){b=H[a+116>>2];if(b){Da(b);H[a+116>>2]=0}b=H[a+120>>2];if(b){Da(b);H[a+120>>2]=0}Da(H[a+148>>2]);Da(a)}} +function vb(a,b){var c=0,d=0;a:{if(b>>>0<=31){d=H[a>>2];c=a+4|0;break a}b=b-32|0;c=a}c=H[c>>2];H[a>>2]=d<>2]=c<>>32-b}function xb(a,b){var c=0,d=0;c=H[a+4>>2];a:{if(b>>>0<=31){d=H[a>>2];break a}b=b-32|0;d=c;c=0}H[a+4>>2]=c>>>b;H[a>>2]=c<<32-b|d>>>b}function be(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(!c){return 0}if(!Pb(H[a>>2],b,c,d)){Ca(d,1,6210,0);return 0}return Qc(a,c,d)|0}function pe(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(H[H[a+96>>2]+16>>2]<<2!=(c|0)){Ca(d,1,4464,0);a=0}else{a=1}return a|0}function vc(){var a=0,b=0;a=Fa(1,44);a:{if(a){H[a+16>>2]=0;b=Fa(1,8);H[a+36>>2]=b;if(b){break a}Da(a)}a=0}return a}function $b(a,b){a=a|0;b=b|0;if(!(!a|!b)){H[a+188>>2]=H[b+4>>2];H[a+184>>2]=H[b>>2];H[a+248>>2]=H[b+8248>>2]&2}}function tb(){var a=0,b=0;a=Fa(1,12);if(a){H[a+4>>2]=10;b=Fa(10,4);H[a+8>>2]=b;if(b){return a}Da(a)}return 0}function Ud(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;return Wb(H[a>>2],b,c,d,e,f,g)|0}function jb(a){var b=0;if(a){b=H[a+4>>2];if(b){sa[b|0](H[a>>2])}Da(H[a+32>>2]);H[a+32>>2]=0;Da(a)}}function _b(a,b){a=a|0;b=b|0;a:{if(!a){break a}H[a+208>>2]=b;if(!b){break a}F[a+92|0]=I[a+92|0]|8}}function Ad(a,b,c){a=a|0;b=b|0;c=c|0;b=H[c+8>>2];H[c+4>>2]=H[c>>2]+(a>>>0>b>>>0?b:a);return 1}function Wd(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return gb(H[a>>2],b,c,d,e,f)|0}function te(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;if(c){a=1}else{Ca(d,1,4375,0);a=0}return a|0}function nb(a){H[a>>2]=0;H[a+4>>2]=0;H[a+16>>2]=0;H[a+20>>2]=0;H[a+8>>2]=0;H[a+12>>2]=0}function ad(a,b,c){a=a|0;b=b|0;c=c|0;return!H[a+8>>2]&(H[a+216>>2]!=0&H[a+220>>2]!=0)}function Ua(a){if(H[a+12>>2]){H[a+40>>2]=0;while(1){if(H[a+24>>2]>0){continue}break}}}function Yc(a,b){F[b+3|0]=I[a|0];F[b+2|0]=I[a+1|0];F[b+1|0]=I[a+2|0];F[b|0]=I[a+3|0]}function lb(a){if(a){sa[H[(H[a+76>>2]?20:16)+a>>2]](H[a+48>>2]);H[a+48>>2]=0;Da(a)}}function ae(a,b){a=a|0;b=b|0;$b(H[a>>2],b);F[a+124|0]=0;H[a+128>>2]=H[b+8248>>2]&1}function Fa(a,b){if(!a|!b){a=0}else{b=N(a,b);a=kb(8,b);if(a){Oc(a,0,b)}}return a}function Ha(a,b,c){var d=0;d=oa-16|0;oa=d;H[d+12>>2]=c;Gc(a,b,c,0,0);oa=d+16|0}function Me(a){var b=0;while(1){if(a){a=a-1&a;b=b+1|0;continue}break}return b}function bb(a){var b=0;if(a){b=H[a+12>>2];if(b){Da(b);H[a+12>>2]=0}Da(a)}}function Vd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Xb(H[a>>2],b,c,d)|0}function Pa(a,b,c){a:{if(H[c+76>>2]<0){a=Jb(a,b,c);break a}a=Jb(a,b,c)}}function Jc(a,b){a=Hc(a-1|0);if(!a){a=Hc(b);a=a?a|32:0}return a}function ac(a){return H[a+12>>2]==H[a+4>>2]|H[a+8>>2]==H[a>>2]}function Od(a,b,c){a=a|0;b=b|0;c=c|0;return Xc(H[a>>2],b,c)|0}function sb(a){var b=0;if(a){b=H[a+8>>2];if(b){Da(b)}Da(a)}}function Hc(a){var b=0,c=0,d=0;return b=He(a),c=0,d=a,d?b:c}function rd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ra=0;return 0}function ab(a,b,c,d,e,f,g,h){return mc(a,b,c,d,e,f,g,h,0)}function zc(a,b,c,d){return sa[H[a+44>>2]](a,b,c,d)|0}function _a(a,b,c){H[((b<<2)+a|0)+28>>2]=(c<<5)+20832}function Mb(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return 1}function Sd(a,b,c){a=a|0;b=b|0;c=c|0;Tb(H[a>>2],b,c)}function ub(a,b,c){return sa[H[a+40>>2]](a,b,0,c)|0}function ne(a,b,c){a=a|0;b=b|0;c=c|0;ra=-1;return-1}function He(a){if(a){return 31-Q(a-1^a)|0}return 32}function Ra(a,b,c,d,e,f,g,h){mc(a,b,c,d,e,f,g,h,1)}function td(a){a=a|0;return Hb(Z(H[a+60>>2])|0)|0}function Hb(a){if(!a){return 0}H[6597]=a;return-1}function je(a,b,c){a=a|0;b=b|0;c=c|0;yc(a,b,c,2)}function ie(a,b,c){a=a|0;b=b|0;c=c|0;yc(a,b,c,4)}function fe(a,b,c){a=a|0;b=b|0;c=c|0;xc(a,b,c,2)}function ee(a,b,c){a=a|0;b=b|0;c=c|0;xc(a,b,c,4)}function Ma(a,b,c){if(!(I[a|0]&32)){Jb(b,c,a)}}function Le(a,b,c){Ge(a,0,b,c);ra=qa;return pa}function xe(a,b,c){a=a|0;b=b|0;c=c|0;return 0}function Zb(a,b,c){a=a|0;b=b|0;c=c|0;return 1}function Uc(a,b,c){a=a|0;b=b|0;c=c|0;return-1}function Ke(a,b,c,d){a=Ge(a,b,c,d);return a}function Ga(a){if(!a){return 0}return yb(a)}function Oc(a,b,c){if(c){y(a,b<<24>>24,c)}}function $d(a,b){a=a|0;b=b|0;_b(H[a>>2],b)}function uc(a){return H[a+8>>2]-H[a>>2]|0}function ld(a){a=a|0;ha();ga(a+128|0);D()}function Rd(a){a=a|0;return Qb(H[a>>2])|0}function Pd(a){a=a|0;return Rb(H[a>>2])|0}function yb(a){a=a|0;return kb(8,a)|0}function bd(a,b){a=a|0;b=b|0;return 0}function xd(a,b){a=a|0;b=b|0;$(a|0)}function wd(a,b){a=a|0;b=b|0;Y(a|0)}function Fb(a){return H[a+28>>2]!=2}function eb(a,b,c){if(c){B(a,b,c)}}function db(a,b){return Tc(a,b)}function rb(a){return wc(a,32)}function Ja(a){return wc(a,16)}function zb(){return Fa(1,36)}function sd(a){a=a|0;return 0}function md(a){a=a|0;Ac();D()}function cc(a,b){a=a|0;b=b|0}function hb(a){if(a){Da(a)}}function Qa(a){H[a>>2]=0}function kd(){Ac();D()}function Ac(){ia();D()} +// EMSCRIPTEN_END_FUNCS +a=I;m(n);var sa=[null,cc,xe,ne,Uc,Uc,fb,Qd,Fd,zd,jd,id,hd,gd,fd,ed,dd,cd,Zb,ad,$c,_c,Zc,Tc,Ee,De,Ce,Be,Ae,ze,ye,we,ve,ue,te,se,re,qe,pe,Mb,oe,me,Mb,Mb,le,ke,je,ie,he,ge,fe,ee,de,ce,Zd,Nd,Md,Ld,Kd,Jd,Id,Hd,Gd,Ed,Dd,Cd,Bd,Ad,Qb,Rb,Tb,Zb,Pb,_b,$b,Bb,Yb,bd,Xb,Xc,Nb,Wb,gb,Za,Rd,Pd,Sd,_d,be,bd,Vd,Od,Td,Ud,$d,ae,Pc,Wd,Xd,Yd,cc,xd,wd,od,qd,pd,kd,td,ud,vd,sd,rd,ld,md];function ta(){return E.byteLength/65536|0}function ya(za){za=za|0;var ua=ta()|0;var va=ua+za|0;if(ua{Module["instantiateWasm"](info,(mod,inst)=>{resolve(receiveInstance(mod,inst))})})}wasmBinaryFile??=findWasmBinary();var result=instantiateSync(wasmBinaryFile,info);return receiveInstance(result[0])}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var __abort_js=()=>abort("");var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{func();maybeExit()}catch(e){handleException(e)}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};function _copy_pixels_1(compG_ptr,nb_pixels){compG_ptr>>=2;const imageData=Module.imageData=new Uint8ClampedArray(nb_pixels);const compG=HEAP32.subarray(compG_ptr,compG_ptr+nb_pixels);imageData.set(compG)}function _copy_pixels_3(compR_ptr,compG_ptr,compB_ptr,nb_pixels){compR_ptr>>=2;compG_ptr>>=2;compB_ptr>>=2;const imageData=Module.imageData=new Uint8ClampedArray(nb_pixels*3);const compR=HEAP32.subarray(compR_ptr,compR_ptr+nb_pixels);const compG=HEAP32.subarray(compG_ptr,compG_ptr+nb_pixels);const compB=HEAP32.subarray(compB_ptr,compB_ptr+nb_pixels);for(let i=0;i>=2;compG_ptr>>=2;compB_ptr>>=2;compA_ptr>>=2;const imageData=Module.imageData=new Uint8ClampedArray(nb_pixels*4);const compR=HEAP32.subarray(compR_ptr,compR_ptr+nb_pixels);const compG=HEAP32.subarray(compG_ptr,compG_ptr+nb_pixels);const compB=HEAP32.subarray(compB_ptr,compB_ptr+nb_pixels);const compA=HEAP32.subarray(compA_ptr,compA_ptr+nb_pixels);for(let i=0;i2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var _environ_get=(__environ,environ_buf)=>{var bufSize=0;var envp=0;for(var string of getEnvStrings()){var ptr=environ_buf+bufSize;HEAPU32[__environ+envp>>2]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4}return 0};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;for(var string of strings){bufSize+=lengthBytesUTF8(string)+1}HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var _fd_close=fd=>52;var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN;function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);return 70}var printCharBuffers=[null,[],[]];var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str};var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer));buffer.length=0}else{buffer.push(curr)}};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0};function _gray_to_rgba(compG_ptr,nb_pixels){compG_ptr>>=2;const imageData=Module.imageData=new Uint8ClampedArray(nb_pixels*4);const compG=HEAP32.subarray(compG_ptr,compG_ptr+nb_pixels);for(let i=0;i>=2;compA_ptr>>=2;const imageData=Module.imageData=new Uint8ClampedArray(nb_pixels*4);const compG=HEAP32.subarray(compG_ptr,compG_ptr+nb_pixels);const compA=HEAP32.subarray(compA_ptr,compA_ptr+nb_pixels);for(let i=0;i>=2;compG_ptr>>=2;compB_ptr>>=2;const imageData=Module.imageData=new Uint8ClampedArray(nb_pixels*4);const compR=HEAP32.subarray(compR_ptr,compR_ptr+nb_pixels);const compG=HEAP32.subarray(compG_ptr,compG_ptr+nb_pixels);const compB=HEAP32.subarray(compB_ptr,compB_ptr+nb_pixels);for(let i=0;i{HEAP8.set(array,buffer)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"]}Module["writeArrayToMemory"]=writeArrayToMemory;var wasmImports={m:__abort_js,l:__emscripten_runtime_keepalive_clear,n:__setitimer_js,g:_copy_pixels_1,f:_copy_pixels_3,e:_copy_pixels_4,o:_emscripten_resize_heap,p:_environ_get,q:_environ_sizes_get,b:_fd_close,j:_fd_seek,c:_fd_write,r:_gray_to_rgba,i:_graya_to_rgba,d:_jsPrintWarning,k:_proc_exit,h:_rgb_to_rgba,a:_storeErrorMessage};var wasmExports=createWasm();var ___wasm_call_ctors=wasmExports["t"];var _malloc=Module["_malloc"]=wasmExports["u"];var _free=Module["_free"]=wasmExports["v"];var _jp2_decode=Module["_jp2_decode"]=wasmExports["w"];var __emscripten_timeout=wasmExports["x"];var dynCall_iji=Module["dynCall_iji"]=wasmExports["dynCall_iji"];var dynCall_jji=Module["dynCall_jji"]=wasmExports["dynCall_jji"];var dynCall_iiji=Module["dynCall_iiji"]=wasmExports["dynCall_iiji"];var dynCall_jiji=Module["dynCall_jiji"]=wasmExports["dynCall_jiji"];function run(){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}function preInit(){if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}preInit();run();moduleRtn=Module; + + + return moduleRtn; +} +); +})(); +export default OpenJPEG; diff --git a/tools/ui/node_modules/pdfjs-dist/wasm/qcms_bg.wasm b/tools/ui/node_modules/pdfjs-dist/wasm/qcms_bg.wasm new file mode 100644 index 0000000000000000000000000000000000000000..411e6750dccce2d59acd23c998fa798d00ce2b73 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/wasm/qcms_bg.wasm @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6017eca5939cde1836e88e6d8cd27ae039246f206515ea4487bdfd0e3fb16e26 +size 94519 diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/altText_add.svg b/tools/ui/node_modules/pdfjs-dist/web/images/altText_add.svg new file mode 100644 index 0000000000000000000000000000000000000000..3451b536ce7253b9341022f1fc2d7138f7840f79 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/altText_add.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/altText_disclaimer.svg b/tools/ui/node_modules/pdfjs-dist/web/images/altText_disclaimer.svg new file mode 100644 index 0000000000000000000000000000000000000000..6fe79e710c82a0361e535b3988d349d48b62eed3 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/altText_disclaimer.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/altText_done.svg b/tools/ui/node_modules/pdfjs-dist/web/images/altText_done.svg new file mode 100644 index 0000000000000000000000000000000000000000..f54924ebf92890ce3148ade2313f471cc385b710 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/altText_done.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/altText_spinner.svg b/tools/ui/node_modules/pdfjs-dist/web/images/altText_spinner.svg new file mode 100644 index 0000000000000000000000000000000000000000..fedb4724f7ed39a065b50d47d05e84d18953a853 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/altText_spinner.svg @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/altText_warning.svg b/tools/ui/node_modules/pdfjs-dist/web/images/altText_warning.svg new file mode 100644 index 0000000000000000000000000000000000000000..03014ceab2506cc0f706a0ab16ec479eb93e83da --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/altText_warning.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-check.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-check.svg new file mode 100644 index 0000000000000000000000000000000000000000..71cd16df576f158da70e8007c946cf25ad25e397 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-check.svg @@ -0,0 +1,11 @@ + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-comment.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-comment.svg new file mode 100644 index 0000000000000000000000000000000000000000..86f1f17249f0a2e49e54a6610fa928c91815c2d7 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-comment.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-help.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-help.svg new file mode 100644 index 0000000000000000000000000000000000000000..00938fefe048b07fede7186d235179fe6ac2482c --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-help.svg @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-insert.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-insert.svg new file mode 100644 index 0000000000000000000000000000000000000000..519ef6826e56b178cbad9d91adf0b7a870696602 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-insert.svg @@ -0,0 +1,10 @@ + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-key.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-key.svg new file mode 100644 index 0000000000000000000000000000000000000000..8d09d5378d5be7d1350e08c3ece3d87e2e711a96 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-key.svg @@ -0,0 +1,11 @@ + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-newparagraph.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-newparagraph.svg new file mode 100644 index 0000000000000000000000000000000000000000..38d2497da9112076d3e88876d03aedbb1437a1a2 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-newparagraph.svg @@ -0,0 +1,11 @@ + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-noicon.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-noicon.svg new file mode 100644 index 0000000000000000000000000000000000000000..c07d1080832bebea22ad1cf45fe3bac16ca90642 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-noicon.svg @@ -0,0 +1,7 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-note.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-note.svg new file mode 100644 index 0000000000000000000000000000000000000000..70173651c7e2a3d53492f234e7444c9d775b3b2c --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-note.svg @@ -0,0 +1,42 @@ + + + + + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-paperclip.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-paperclip.svg new file mode 100644 index 0000000000000000000000000000000000000000..2bed2250aee5b1e1aa4b884ae5eb984ad6aa1c91 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-paperclip.svg @@ -0,0 +1,6 @@ + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-paragraph.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-paragraph.svg new file mode 100644 index 0000000000000000000000000000000000000000..6ae5212b75d6855aa2cf7964de2b27650a6a2b80 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-paragraph.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/annotation-pushpin.svg b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-pushpin.svg new file mode 100644 index 0000000000000000000000000000000000000000..6e0896cf4ac0e9d2368ea4cfb11fe106b3855dbf --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/annotation-pushpin.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorFreeHighlight.svg b/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorFreeHighlight.svg new file mode 100644 index 0000000000000000000000000000000000000000..513f6bdfdaa928912c1220fee3d95f2978c8cdf0 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorFreeHighlight.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorFreeText.svg b/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorFreeText.svg new file mode 100644 index 0000000000000000000000000000000000000000..de2838ef102b5b7666fa192bc7d620b9b0fffb3b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorFreeText.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorInk.svg b/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorInk.svg new file mode 100644 index 0000000000000000000000000000000000000000..1dadb5c0155e91dd36fdaf6a0e270627fd314f8a --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorInk.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorTextHighlight.svg b/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorTextHighlight.svg new file mode 100644 index 0000000000000000000000000000000000000000..800340cb5b18aba3528973b7a9e846ddda450ba4 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/cursor-editorTextHighlight.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/editor-toolbar-delete.svg b/tools/ui/node_modules/pdfjs-dist/web/images/editor-toolbar-delete.svg new file mode 100644 index 0000000000000000000000000000000000000000..f84520d85a3406933e8f5d5d66f7c56c90a375ed --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/editor-toolbar-delete.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/editor-toolbar-edit.svg b/tools/ui/node_modules/pdfjs-dist/web/images/editor-toolbar-edit.svg new file mode 100644 index 0000000000000000000000000000000000000000..692de38d32c5b40287f132b0646a528a8dbf08d2 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/editor-toolbar-edit.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/loading-icon.gif b/tools/ui/node_modules/pdfjs-dist/web/images/loading-icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..ca493f4ea0fb6062ce83989c96d22c343fbe844a --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/loading-icon.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:483c4a0396691993a641ec409c44b8b7e1daab0ae7e2b2944c4bc59520bb7655 +size 2545 diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_closingButton.svg b/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_closingButton.svg new file mode 100644 index 0000000000000000000000000000000000000000..8a40715ded3a5c48b9a4eac09182b4be4a6a647b --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_closingButton.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_info.svg b/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_info.svg new file mode 100644 index 0000000000000000000000000000000000000000..b12b6be4aa63b8061316d8f5fb9e05b6365ed924 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_info.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_warning.svg b/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_warning.svg new file mode 100644 index 0000000000000000000000000000000000000000..011cfcf3e146018947ccc73682cc1469ca2e5d14 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/messageBar_warning.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/toolbarButton-editorHighlight.svg b/tools/ui/node_modules/pdfjs-dist/web/images/toolbarButton-editorHighlight.svg new file mode 100644 index 0000000000000000000000000000000000000000..b3cd7fda9c960be975f276950a7b7c25966d0c8d --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/toolbarButton-editorHighlight.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/tools/ui/node_modules/pdfjs-dist/web/images/toolbarButton-menuArrow.svg b/tools/ui/node_modules/pdfjs-dist/web/images/toolbarButton-menuArrow.svg new file mode 100644 index 0000000000000000000000000000000000000000..82ffeaabb9e497590979506a13f761b908ca6bd7 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/images/toolbarButton-menuArrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.css b/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.css new file mode 100644 index 0000000000000000000000000000000000000000..5806f80c5edf76e4acb111d09eccb3e93f5eb5cd --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.css @@ -0,0 +1,4938 @@ +/* Copyright 2014 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.messageBar{ + --closing-button-icon:url(images/messageBar_closingButton.svg); + --message-bar-close-button-color:var(--text-primary-color); + --message-bar-close-button-color-hover:var(--text-primary-color); + --message-bar-close-button-border-radius:4px; + --message-bar-close-button-border:none; + --csstools-light-dark-toggle--0:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.14); + --message-bar-close-button-hover-bg-color:var(--csstools-light-dark-toggle--0, rgb(21 20 26 / 0.14)); + --csstools-light-dark-toggle--1:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.21); + --message-bar-close-button-active-bg-color:var(--csstools-light-dark-toggle--1, rgb(21 20 26 / 0.21)); + --csstools-light-dark-toggle--2:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.07); + --message-bar-close-button-focus-bg-color:var(--csstools-light-dark-toggle--2, rgb(21 20 26 / 0.07)); +} + +@supports (color: light-dark(red, red)) and (color: rgb(0 0 0 / 0)){ +.messageBar{ + --message-bar-close-button-hover-bg-color:light-dark( + rgb(21 20 26 / 0.14), + rgb(251 251 254 / 0.14) + ); + --message-bar-close-button-active-bg-color:light-dark( + rgb(21 20 26 / 0.21), + rgb(251 251 254 / 0.21) + ); + --message-bar-close-button-focus-bg-color:light-dark( + rgb(21 20 26 / 0.07), + rgb(251 251 254 / 0.07) + ); +} +} + +@supports not (color: light-dark(tan, tan)){ + +.messageBar *{ + --csstools-light-dark-toggle--0:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.14); + --message-bar-close-button-hover-bg-color:var(--csstools-light-dark-toggle--0, rgb(21 20 26 / 0.14)); + --csstools-light-dark-toggle--1:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.21); + --message-bar-close-button-active-bg-color:var(--csstools-light-dark-toggle--1, rgb(21 20 26 / 0.21)); + --csstools-light-dark-toggle--2:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.07); + --message-bar-close-button-focus-bg-color:var(--csstools-light-dark-toggle--2, rgb(21 20 26 / 0.07)); + } +} + +@media screen and (forced-colors: active){ + +.messageBar{ + --message-bar-close-button-color:ButtonText; + --message-bar-close-button-border:1px solid ButtonText; + --message-bar-close-button-hover-bg-color:ButtonText; + --message-bar-close-button-active-bg-color:ButtonText; + --message-bar-close-button-focus-bg-color:ButtonText; + --message-bar-close-button-color-hover:HighlightText; +} + } + +.messageBar{ + + display:flex; + position:relative; + padding:8px 8px 8px 16px; + flex-direction:column; + justify-content:center; + align-items:center; + gap:8px; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + + border-radius:4px; + + border:1px solid var(--message-bar-border-color); + background:var(--message-bar-bg-color); + color:var(--message-bar-fg-color); +} + +.messageBar > div{ + display:flex; + align-items:flex-start; + gap:8px; + align-self:stretch; + } + +:is(.messageBar > div)::before{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--message-bar-icon); + mask-image:var(--message-bar-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--message-bar-icon-color); + flex-shrink:0; + } + +.messageBar button{ + cursor:pointer; + } + +:is(.messageBar button):focus-visible{ + outline:var(--focus-ring-outline); + outline-offset:2px; + } + +.messageBar .closeButton{ + width:32px; + height:32px; + background:none; + border-radius:var(--message-bar-close-button-border-radius); + border:var(--message-bar-close-button-border); + + display:flex; + align-items:center; + justify-content:center; + } + +:is(.messageBar .closeButton)::before{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--closing-button-icon); + mask-image:var(--closing-button-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--message-bar-close-button-color); + } + +:is(.messageBar .closeButton):is(:hover,:active,:focus)::before{ + background-color:var(--message-bar-close-button-color-hover); + } + +:is(.messageBar .closeButton):hover{ + background-color:var(--message-bar-close-button-hover-bg-color); + } + +:is(.messageBar .closeButton):active{ + background-color:var(--message-bar-close-button-active-bg-color); + } + +:is(.messageBar .closeButton):focus{ + background-color:var(--message-bar-close-button-focus-bg-color); + } + +:is(.messageBar .closeButton) > span{ + display:inline-block; + width:0; + height:0; + overflow:hidden; + } + +#editorUndoBar{ + --csstools-light-dark-toggle--3:var(--csstools-color-scheme--light) #fbfbfe; + --text-primary-color:var(--csstools-light-dark-toggle--3, #15141a); + + --message-bar-icon:url(images/messageBar_info.svg); + --csstools-light-dark-toggle--4:var(--csstools-color-scheme--light) #73a7f3; + --message-bar-icon-color:var(--csstools-light-dark-toggle--4, #0060df); + --csstools-light-dark-toggle--5:var(--csstools-color-scheme--light) #003070; + --message-bar-bg-color:var(--csstools-light-dark-toggle--5, #deeafc); + --message-bar-fg-color:var(--text-primary-color); + --csstools-light-dark-toggle--6:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.08); + --message-bar-border-color:var(--csstools-light-dark-toggle--6, rgb(0 0 0 / 0.08)); + + --csstools-light-dark-toggle--7:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.08); + + --undo-button-bg-color:var(--csstools-light-dark-toggle--7, rgb(21 20 26 / 0.07)); + --csstools-light-dark-toggle--8:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.14); + --undo-button-bg-color-hover:var(--csstools-light-dark-toggle--8, rgb(21 20 26 / 0.14)); + --csstools-light-dark-toggle--9:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.21); + --undo-button-bg-color-active:var(--csstools-light-dark-toggle--9, rgb(21 20 26 / 0.21)); + + --csstools-light-dark-toggle--10:var(--csstools-color-scheme--light) #0df; + + --undo-button-border:1px solid var(--csstools-light-dark-toggle--10, #0060df); + + --undo-button-fg-color:var(--message-bar-fg-color); + --undo-button-fg-color-hover:var(--undo-button-fg-color); + --undo-button-fg-color-active:var(--undo-button-fg-color); +} + +@supports (color: light-dark(red, red)){ +#editorUndoBar{ + --text-primary-color:light-dark(#15141a, #fbfbfe); + --message-bar-icon-color:light-dark(#0060df, #73a7f3); + --message-bar-bg-color:light-dark(#deeafc, #003070); +} +} + +@supports (color: light-dark(red, red)) and (color: rgb(0 0 0 / 0)){ +#editorUndoBar{ + --message-bar-border-color:light-dark( + rgb(0 0 0 / 0.08), + rgb(255 255 255 / 0.08) + ); + + --undo-button-bg-color:light-dark( + rgb(21 20 26 / 0.07), + rgb(255 255 255 / 0.08) + ); + --undo-button-bg-color-hover:light-dark( + rgb(21 20 26 / 0.14), + rgb(255 255 255 / 0.14) + ); + --undo-button-bg-color-active:light-dark( + rgb(21 20 26 / 0.21), + rgb(255 255 255 / 0.21) + ); +} +} + +@supports (color: light-dark(red, red)){ +#editorUndoBar{ + + --undo-button-border:1px solid light-dark(#0060df, #0df); +} +} + +@supports not (color: light-dark(tan, tan)){ + +#editorUndoBar *{ + --csstools-light-dark-toggle--3:var(--csstools-color-scheme--light) #fbfbfe; + --text-primary-color:var(--csstools-light-dark-toggle--3, #15141a); + --csstools-light-dark-toggle--4:var(--csstools-color-scheme--light) #73a7f3; + --message-bar-icon-color:var(--csstools-light-dark-toggle--4, #0060df); + --csstools-light-dark-toggle--5:var(--csstools-color-scheme--light) #003070; + --message-bar-bg-color:var(--csstools-light-dark-toggle--5, #deeafc); + --csstools-light-dark-toggle--6:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.08); + --message-bar-border-color:var(--csstools-light-dark-toggle--6, rgb(0 0 0 / 0.08)); + + --csstools-light-dark-toggle--7:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.08); + + --undo-button-bg-color:var(--csstools-light-dark-toggle--7, rgb(21 20 26 / 0.07)); + --csstools-light-dark-toggle--8:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.14); + --undo-button-bg-color-hover:var(--csstools-light-dark-toggle--8, rgb(21 20 26 / 0.14)); + --csstools-light-dark-toggle--9:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.21); + --undo-button-bg-color-active:var(--csstools-light-dark-toggle--9, rgb(21 20 26 / 0.21)); + + --csstools-light-dark-toggle--10:var(--csstools-color-scheme--light) #0df; + + --undo-button-border:1px solid var(--csstools-light-dark-toggle--10, #0060df); + } +} + +@media screen and (forced-colors: active){ + +#editorUndoBar{ + --text-primary-color:CanvasText; + + --message-bar-icon-color:CanvasText; + --message-bar-bg-color:Canvas; + --message-bar-border-color:CanvasText; + + --undo-button-bg-color:ButtonText; + --undo-button-bg-color-hover:SelectedItem; + --undo-button-bg-color-active:SelectedItem; + + --undo-button-fg-color:ButtonFace; + --undo-button-fg-color-hover:SelectedItemText; + --undo-button-fg-color-active:SelectedItemText; + + --undo-button-border:none; +} + } + +#editorUndoBar{ + + position:fixed; + top:50px; + left:50%; + transform:translateX(-50%); + z-index:10; + + padding-block:8px; + padding-inline:16px 8px; + + font:menu; + font-size:15px; + + cursor:default; +} + +#editorUndoBar button{ + cursor:pointer; + } + +#editorUndoBar #editorUndoBarUndoButton{ + border-radius:4px; + font-weight:590; + line-height:19.5px; + color:var(--undo-button-fg-color); + border:var(--undo-button-border); + padding:4px 16px; + margin-inline-start:8px; + height:32px; + + background-color:var(--undo-button-bg-color); + } + +:is(#editorUndoBar #editorUndoBarUndoButton):hover{ + background-color:var(--undo-button-bg-color-hover); + color:var(--undo-button-fg-color-hover); + } + +:is(#editorUndoBar #editorUndoBarUndoButton):active{ + background-color:var(--undo-button-bg-color-active); + color:var(--undo-button-fg-color-active); + } + +#editorUndoBar > div{ + align-items:center; + } + +.dialog{ + --csstools-light-dark-toggle--11:var(--csstools-color-scheme--light) #1c1b22; + --dialog-bg-color:var(--csstools-light-dark-toggle--11, white); + --csstools-light-dark-toggle--12:var(--csstools-color-scheme--light) #1c1b22; + --dialog-border-color:var(--csstools-light-dark-toggle--12, white); + --csstools-light-dark-toggle--13:var(--csstools-color-scheme--light) #15141a; + --dialog-shadow:0 2px 14px 0 var(--csstools-light-dark-toggle--13, rgb(58 57 68 / 0.2)); + --csstools-light-dark-toggle--14:var(--csstools-color-scheme--light) #fbfbfe; + --text-primary-color:var(--csstools-light-dark-toggle--14, #15141a); + --csstools-light-dark-toggle--15:var(--csstools-color-scheme--light) #cfcfd8; + --text-secondary-color:var(--csstools-light-dark-toggle--15, #5b5b66); + --hover-filter:brightness(0.9); + --csstools-light-dark-toggle--16:var(--csstools-color-scheme--light) #0df; + --link-fg-color:var(--csstools-light-dark-toggle--16, #0060df); + --csstools-light-dark-toggle--17:var(--csstools-color-scheme--light) #80ebff; + --link-hover-fg-color:var(--csstools-light-dark-toggle--17, #0250bb); + --csstools-light-dark-toggle--18:var(--csstools-color-scheme--light) #52525e; + --separator-color:var(--csstools-light-dark-toggle--18, #f0f0f4); + + --textarea-border-color:#8f8f9d; + --csstools-light-dark-toggle--19:var(--csstools-color-scheme--light) #42414d; + --textarea-bg-color:var(--csstools-light-dark-toggle--19, white); + --textarea-fg-color:var(--text-secondary-color); + + --csstools-light-dark-toggle--20:var(--csstools-color-scheme--light) #2b2a33; + + --radio-bg-color:var(--csstools-light-dark-toggle--20, #f0f0f4); + --csstools-light-dark-toggle--21:var(--csstools-color-scheme--light) #15141a; + --radio-checked-bg-color:var(--csstools-light-dark-toggle--21, #fbfbfe); + --radio-border-color:#8f8f9d; + --csstools-light-dark-toggle--22:var(--csstools-color-scheme--light) #0df; + --radio-checked-border-color:var(--csstools-light-dark-toggle--22, #0060df); + + --csstools-light-dark-toggle--23:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.07); + + --button-secondary-bg-color:var(--csstools-light-dark-toggle--23, rgb(21 20 26 / 0.07)); + --button-secondary-fg-color:var(--text-primary-color); + --button-secondary-border-color:var(--button-secondary-bg-color); + --csstools-light-dark-toggle--24:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.21); + --button-secondary-active-bg-color:var(--csstools-light-dark-toggle--24, rgb(21 20 26 / 0.21)); + --button-secondary-active-fg-color:var(--button-secondary-fg-color); + --button-secondary-active-border-color:var(--button-secondary-bg-color); + --csstools-light-dark-toggle--25:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.14); + --button-secondary-hover-bg-color:var(--csstools-light-dark-toggle--25, rgb(21 20 26 / 0.14)); + --button-secondary-hover-fg-color:var(--button-secondary-fg-color); + --button-secondary-hover-border-color:var(--button-secondary-hover-bg-color); + --button-secondary-disabled-bg-color:var(--button-secondary-bg-color); + --button-secondary-disabled-border-color:var( + --button-secondary-border-color + ); + --button-secondary-disabled-fg-color:var(--button-secondary-fg-color); + + --csstools-light-dark-toggle--26:var(--csstools-color-scheme--light) #0df; + + --button-primary-bg-color:var(--csstools-light-dark-toggle--26, #0060df); + --csstools-light-dark-toggle--27:var(--csstools-color-scheme--light) #15141a; + --button-primary-fg-color:var(--csstools-light-dark-toggle--27, #fbfbfe); + --button-primary-border-color:var(--button-primary-bg-color); + --csstools-light-dark-toggle--28:var(--csstools-color-scheme--light) #aaf2ff; + --button-primary-active-bg-color:var(--csstools-light-dark-toggle--28, #054096); + --button-primary-active-fg-color:var(--button-primary-fg-color); + --button-primary-active-border-color:var(--button-primary-active-bg-color); + --csstools-light-dark-toggle--29:var(--csstools-color-scheme--light) #80ebff; + --button-primary-hover-bg-color:var(--csstools-light-dark-toggle--29, #0250bb); + --button-primary-hover-fg-color:var(--button-primary-fg-color); + --button-primary-hover-border-color:var(--button-primary-hover-bg-color); + --button-primary-disabled-bg-color:var(--button-primary-bg-color); + --button-primary-disabled-border-color:var(--button-primary-border-color); + --button-primary-disabled-fg-color:var(--button-primary-fg-color); + --button-disabled-opacity:0.4; + + --csstools-light-dark-toggle--30:var(--csstools-color-scheme--light) #42414d; + + --input-text-bg-color:var(--csstools-light-dark-toggle--30, white); + --input-text-fg-color:var(--text-primary-color); +} + +@supports (color: light-dark(red, red)){ +.dialog{ + --dialog-bg-color:light-dark(white, #1c1b22); + --dialog-border-color:light-dark(white, #1c1b22); +} +} + +@supports (color: light-dark(red, red)) and (color: rgb(0 0 0 / 0)){ +.dialog{ + --dialog-shadow:0 2px 14px 0 light-dark(rgb(58 57 68 / 0.2), #15141a); +} +} + +@supports (color: light-dark(red, red)){ +.dialog{ + --text-primary-color:light-dark(#15141a, #fbfbfe); + --text-secondary-color:light-dark(#5b5b66, #cfcfd8); + --link-fg-color:light-dark(#0060df, #0df); + --link-hover-fg-color:light-dark(#0250bb, #80ebff); + --separator-color:light-dark(#f0f0f4, #52525e); + --textarea-bg-color:light-dark(white, #42414d); + + --radio-bg-color:light-dark(#f0f0f4, #2b2a33); + --radio-checked-bg-color:light-dark(#fbfbfe, #15141a); + --radio-checked-border-color:light-dark(#0060df, #0df); +} +} + +@supports (color: light-dark(red, red)) and (color: rgb(0 0 0 / 0)){ +.dialog{ + + --button-secondary-bg-color:light-dark( + rgb(21 20 26 / 0.07), + rgb(251 251 254 / 0.07) + ); + --button-secondary-active-bg-color:light-dark( + rgb(21 20 26 / 0.21), + rgb(251 251 254 / 0.21) + ); + --button-secondary-hover-bg-color:light-dark( + rgb(21 20 26 / 0.14), + rgb(251 251 254 / 0.14) + ); +} +} + +@supports (color: light-dark(red, red)){ +.dialog{ + + --button-primary-bg-color:light-dark(#0060df, #0df); + --button-primary-fg-color:light-dark(#fbfbfe, #15141a); + --button-primary-active-bg-color:light-dark(#054096, #aaf2ff); + --button-primary-hover-bg-color:light-dark(#0250bb, #80ebff); + + --input-text-bg-color:light-dark(white, #42414d); +} +} + +@supports not (color: light-dark(tan, tan)){ + +.dialog *{ + --csstools-light-dark-toggle--11:var(--csstools-color-scheme--light) #1c1b22; + --dialog-bg-color:var(--csstools-light-dark-toggle--11, white); + --csstools-light-dark-toggle--12:var(--csstools-color-scheme--light) #1c1b22; + --dialog-border-color:var(--csstools-light-dark-toggle--12, white); + --csstools-light-dark-toggle--13:var(--csstools-color-scheme--light) #15141a; + --dialog-shadow:0 2px 14px 0 var(--csstools-light-dark-toggle--13, rgb(58 57 68 / 0.2)); + --csstools-light-dark-toggle--14:var(--csstools-color-scheme--light) #fbfbfe; + --text-primary-color:var(--csstools-light-dark-toggle--14, #15141a); + --csstools-light-dark-toggle--15:var(--csstools-color-scheme--light) #cfcfd8; + --text-secondary-color:var(--csstools-light-dark-toggle--15, #5b5b66); + --csstools-light-dark-toggle--16:var(--csstools-color-scheme--light) #0df; + --link-fg-color:var(--csstools-light-dark-toggle--16, #0060df); + --csstools-light-dark-toggle--17:var(--csstools-color-scheme--light) #80ebff; + --link-hover-fg-color:var(--csstools-light-dark-toggle--17, #0250bb); + --csstools-light-dark-toggle--18:var(--csstools-color-scheme--light) #52525e; + --separator-color:var(--csstools-light-dark-toggle--18, #f0f0f4); + --csstools-light-dark-toggle--19:var(--csstools-color-scheme--light) #42414d; + --textarea-bg-color:var(--csstools-light-dark-toggle--19, white); + + --csstools-light-dark-toggle--20:var(--csstools-color-scheme--light) #2b2a33; + + --radio-bg-color:var(--csstools-light-dark-toggle--20, #f0f0f4); + --csstools-light-dark-toggle--21:var(--csstools-color-scheme--light) #15141a; + --radio-checked-bg-color:var(--csstools-light-dark-toggle--21, #fbfbfe); + --csstools-light-dark-toggle--22:var(--csstools-color-scheme--light) #0df; + --radio-checked-border-color:var(--csstools-light-dark-toggle--22, #0060df); + + --csstools-light-dark-toggle--23:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.07); + + --button-secondary-bg-color:var(--csstools-light-dark-toggle--23, rgb(21 20 26 / 0.07)); + --csstools-light-dark-toggle--24:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.21); + --button-secondary-active-bg-color:var(--csstools-light-dark-toggle--24, rgb(21 20 26 / 0.21)); + --csstools-light-dark-toggle--25:var(--csstools-color-scheme--light) rgb(251 251 254 / 0.14); + --button-secondary-hover-bg-color:var(--csstools-light-dark-toggle--25, rgb(21 20 26 / 0.14)); + + --csstools-light-dark-toggle--26:var(--csstools-color-scheme--light) #0df; + + --button-primary-bg-color:var(--csstools-light-dark-toggle--26, #0060df); + --csstools-light-dark-toggle--27:var(--csstools-color-scheme--light) #15141a; + --button-primary-fg-color:var(--csstools-light-dark-toggle--27, #fbfbfe); + --csstools-light-dark-toggle--28:var(--csstools-color-scheme--light) #aaf2ff; + --button-primary-active-bg-color:var(--csstools-light-dark-toggle--28, #054096); + --csstools-light-dark-toggle--29:var(--csstools-color-scheme--light) #80ebff; + --button-primary-hover-bg-color:var(--csstools-light-dark-toggle--29, #0250bb); + + --csstools-light-dark-toggle--30:var(--csstools-color-scheme--light) #42414d; + + --input-text-bg-color:var(--csstools-light-dark-toggle--30, white); + } +} + +@media (prefers-color-scheme: dark){ + +.dialog{ + --hover-filter:brightness(1.4); + --button-disabled-opacity:0.6; +} + } + +@media screen and (forced-colors: active){ + +.dialog{ + --dialog-bg-color:Canvas; + --dialog-border-color:CanvasText; + --dialog-shadow:none; + --text-primary-color:CanvasText; + --text-secondary-color:CanvasText; + --hover-filter:none; + --link-fg-color:LinkText; + --link-hover-fg-color:LinkText; + --separator-color:CanvasText; + + --textarea-border-color:ButtonBorder; + --textarea-bg-color:Field; + --textarea-fg-color:ButtonText; + + --radio-bg-color:ButtonFace; + --radio-checked-bg-color:ButtonFace; + --radio-border-color:ButtonText; + --radio-checked-border-color:ButtonText; + + --button-secondary-bg-color:HighlightText; + --button-secondary-fg-color:ButtonText; + --button-secondary-border-color:ButtonText; + --button-secondary-active-bg-color:HighlightText; + --button-secondary-active-fg-color:SelectedItem; + --button-secondary-active-border-color:ButtonText; + --button-secondary-hover-bg-color:HighlightText; + --button-secondary-hover-fg-color:SelectedItem; + --button-secondary-hover-border-color:SelectedItem; + --button-secondary-disabled-fg-color:GrayText; + --button-secondary-disabled-border-color:GrayText; + + --button-primary-bg-color:ButtonText; + --button-primary-fg-color:HighlightText; + --button-primary-border-color:ButtonText; + --button-primary-active-bg-color:SelectedItem; + --button-primary-active-fg-color:HighlightText; + --button-primary-active-border-color:ButtonText; + --button-primary-hover-bg-color:SelectedItem; + --button-primary-hover-fg-color:HighlightText; + --button-primary-hover-border-color:SelectedItem; + --button-primary-disabled-bg-color:GrayText; + --button-primary-disabled-fg-color:ButtonFace; + --button-primary-disabled-border-color:GrayText; + --button-disabled-opacity:1; + + --input-text-bg-color:HighlightText; + --input-text-fg-color:FieldText; +} + } + +.dialog{ + + font:message-box; + font-size:13px; + font-weight:400; + line-height:150%; + border-radius:4px; + padding:12px 16px; + border:1px solid var(--dialog-border-color); + background:var(--dialog-bg-color); + color:var(--text-primary-color); + box-shadow:var(--dialog-shadow); +} + +:is(.dialog .mainContainer) *:focus-visible{ + outline:var(--focus-ring-outline); + outline-offset:2px; + } + +:is(.dialog .mainContainer) .title{ + display:flex; + width:auto; + flex-direction:column; + justify-content:flex-end; + align-items:flex-start; + gap:12px; + } + +:is(:is(.dialog .mainContainer) .title) > span{ + font-size:13px; + font-style:normal; + font-weight:590; + line-height:150%; + } + +:is(.dialog .mainContainer) .dialogSeparator{ + width:100%; + height:0; + margin-block:4px; + border-top:1px solid var(--separator-color); + border-bottom:none; + } + +:is(.dialog .mainContainer) .dialogButtonsGroup{ + display:flex; + gap:12px; + align-self:flex-end; + } + +:is(.dialog .mainContainer) .radio{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:4px; + } + +:is(:is(.dialog .mainContainer) .radio) > .radioButton{ + display:flex; + gap:8px; + align-self:stretch; + align-items:center; + } + +:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input{ + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + box-sizing:border-box; + width:16px; + height:16px; + border-radius:50%; + background-color:var(--radio-bg-color); + border:1px solid var(--radio-border-color); + } + +:is(:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input):hover{ + filter:var(--hover-filter); + } + +:is(:is(:is(:is(.dialog .mainContainer) .radio) > .radioButton) input):checked{ + background-color:var(--radio-checked-bg-color); + border:4px solid var(--radio-checked-border-color); + } + +:is(:is(.dialog .mainContainer) .radio) > .radioLabel{ + display:flex; + padding-inline-start:24px; + align-items:flex-start; + gap:10px; + align-self:stretch; + } + +:is(:is(:is(.dialog .mainContainer) .radio) > .radioLabel) > span{ + flex:1 0 0; + font-size:11px; + color:var(--text-secondary-color); + } + +:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton)){ + border-radius:4px; + border:1px solid; + font:menu; + font-weight:590; + font-size:13px; + padding:4px 16px; + width:auto; + height:32px; + } + +:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))):hover{ + cursor:pointer; + filter:var(--hover-filter); + } + +:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))) > span{ + color:inherit; + font:inherit; + } + +.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))){ + color:var(--button-secondary-fg-color); + background-color:var(--button-secondary-bg-color); + border-color:var(--button-secondary-border-color); + } + +.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))):hover{ + color:var(--button-secondary-hover-fg-color); + background-color:var(--button-secondary-hover-bg-color); + border-color:var(--button-secondary-hover-border-color); + } + +.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))):active{ + color:var(--button-secondary-active-fg-color); + background-color:var(--button-secondary-active-bg-color); + border-color:var(--button-secondary-active-border-color); + } + +.secondaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))):disabled{ + background-color:var(--button-secondary-disabled-bg-color); + border-color:var(--button-secondary-disabled-border-color); + color:var(--button-secondary-disabled-fg-color); + opacity:var(--button-disabled-opacity); + } + +.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))){ + color:var(--button-primary-fg-color); + background-color:var(--button-primary-bg-color); + border-color:var(--button-primary-border-color); + opacity:1; + } + +.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))):hover{ + color:var(--button-primary-hover-fg-color); + background-color:var(--button-primary-hover-bg-color); + border-color:var(--button-primary-hover-border-color); + } + +.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))):active{ + color:var(--button-primary-active-fg-color); + background-color:var(--button-primary-active-bg-color); + border-color:var(--button-primary-active-border-color); + } + +.primaryButton:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))):disabled{ + background-color:var(--button-primary-disabled-bg-color); + border-color:var(--button-primary-disabled-border-color); + color:var(--button-primary-disabled-fg-color); + opacity:var(--button-disabled-opacity); + } + +:is(:is(.dialog .mainContainer) button:not(:is(.toggle-button,.closeButton,.clearInputButton))):disabled{ + pointer-events:none; + } + +:is(.dialog .mainContainer) a{ + color:var(--link-fg-color); + } + +:is(:is(.dialog .mainContainer) a):hover{ + color:var(--link-hover-fg-color); + } + +:is(.dialog .mainContainer) textarea{ + font:inherit; + padding:8px; + resize:none; + margin:0; + box-sizing:border-box; + border-radius:4px; + border:1px solid var(--textarea-border-color); + background:var(--textarea-bg-color); + color:var(--textarea-fg-color); + } + +:is(:is(.dialog .mainContainer) textarea):focus{ + outline-offset:0; + border-color:transparent; + } + +:is(:is(.dialog .mainContainer) textarea):disabled{ + pointer-events:none; + opacity:0.4; + } + +:is(.dialog .mainContainer) input[type="text"]{ + background-color:var(--input-text-bg-color); + color:var(--input-text-fg-color); + } + +:is(.dialog .mainContainer) .messageBar{ + --csstools-light-dark-toggle--31:var(--csstools-color-scheme--light) #5a3100; + --message-bar-bg-color:var(--csstools-light-dark-toggle--31, #ffebcd); + --csstools-light-dark-toggle--32:var(--csstools-color-scheme--light) #fbfbfe; + --message-bar-fg-color:var(--csstools-light-dark-toggle--32, #15141a); + --csstools-light-dark-toggle--33:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.08); + --message-bar-border-color:var(--csstools-light-dark-toggle--33, rgb(0 0 0 / 0.08)); + --message-bar-icon:url(images/messageBar_warning.svg); + --csstools-light-dark-toggle--34:var(--csstools-color-scheme--light) #e49c49; + --message-bar-icon-color:var(--csstools-light-dark-toggle--34, #cd411e); + } + +@supports (color: light-dark(red, red)){ +:is(.dialog .mainContainer) .messageBar{ + --message-bar-bg-color:light-dark(#ffebcd, #5a3100); + --message-bar-fg-color:light-dark(#15141a, #fbfbfe); + } +} + +@supports (color: light-dark(red, red)) and (color: rgb(0 0 0 / 0)){ +:is(.dialog .mainContainer) .messageBar{ + --message-bar-border-color:light-dark( + rgb(0 0 0 / 0.08), + rgb(255 255 255 / 0.08) + ); + } +} + +@supports (color: light-dark(red, red)){ +:is(.dialog .mainContainer) .messageBar{ + --message-bar-icon-color:light-dark(#cd411e, #e49c49); + } +} + +@supports not (color: light-dark(tan, tan)){ + +:is(:is(.dialog .mainContainer) .messageBar) *{ + --csstools-light-dark-toggle--31:var(--csstools-color-scheme--light) #5a3100; + --message-bar-bg-color:var(--csstools-light-dark-toggle--31, #ffebcd); + --csstools-light-dark-toggle--32:var(--csstools-color-scheme--light) #fbfbfe; + --message-bar-fg-color:var(--csstools-light-dark-toggle--32, #15141a); + --csstools-light-dark-toggle--33:var(--csstools-color-scheme--light) rgb(255 255 255 / 0.08); + --message-bar-border-color:var(--csstools-light-dark-toggle--33, rgb(0 0 0 / 0.08)); + --csstools-light-dark-toggle--34:var(--csstools-color-scheme--light) #e49c49; + --message-bar-icon-color:var(--csstools-light-dark-toggle--34, #cd411e); + } +} + +@media screen and (forced-colors: active){ + +:is(.dialog .mainContainer) .messageBar{ + --message-bar-bg-color:HighlightText; + --message-bar-fg-color:CanvasText; + --message-bar-border-color:CanvasText; + --message-bar-icon-color:CanvasText; + } + } + +:is(.dialog .mainContainer) .messageBar{ + + align-self:stretch; + } + +:is(:is(:is(.dialog .mainContainer) .messageBar) > div)::before,:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div{ + margin-block:4px; + } + +:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:8px; + flex:1 0 0; + } + +:is(:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div) .title{ + font-size:13px; + font-weight:590; + } + +:is(:is(:is(:is(.dialog .mainContainer) .messageBar) > div) > div) .description{ + font-size:13px; + } + +:is(.dialog .mainContainer) .toggler{ + display:flex; + align-items:center; + gap:8px; + align-self:stretch; + } + +:is(:is(.dialog .mainContainer) .toggler) > .togglerLabel{ + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + } + +.textLayer{ + position:absolute; + text-align:initial; + inset:0; + overflow:clip; + opacity:1; + line-height:1; + -webkit-text-size-adjust:none; + -moz-text-size-adjust:none; + text-size-adjust:none; + forced-color-adjust:none; + transform-origin:0 0; + caret-color:CanvasText; + z-index:0; +} + +.textLayer.highlighting{ + touch-action:none; + } + +.textLayer :is(span,br){ + color:transparent; + position:absolute; + white-space:pre; + cursor:text; + transform-origin:0% 0%; + } + +.textLayer > :not(.markedContent),.textLayer .markedContent span:not(.markedContent){ + z-index:1; + } + +.textLayer span.markedContent{ + top:0; + height:0; + } + +.textLayer span[role="img"]{ + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + cursor:default; + } + +.textLayer .highlight{ + --highlight-bg-color:rgb(180 0 170 / 0.25); + --highlight-selected-bg-color:rgb(0 100 0 / 0.25); + --highlight-backdrop-filter:none; + --highlight-selected-backdrop-filter:none; + } + +@media screen and (forced-colors: active){ + +.textLayer .highlight{ + --highlight-bg-color:transparent; + --highlight-selected-bg-color:transparent; + --highlight-backdrop-filter:var(--hcm-highlight-filter); + --highlight-selected-backdrop-filter:var( + --hcm-highlight-selected-filter + ); + } + } + +.textLayer .highlight{ + + margin:-1px; + padding:1px; + background-color:var(--highlight-bg-color); + -webkit-backdrop-filter:var(--highlight-backdrop-filter); + backdrop-filter:var(--highlight-backdrop-filter); + border-radius:4px; + } + +.appended:is(.textLayer .highlight){ + position:initial; + } + +.begin:is(.textLayer .highlight){ + border-radius:4px 0 0 4px; + } + +.end:is(.textLayer .highlight){ + border-radius:0 4px 4px 0; + } + +.middle:is(.textLayer .highlight){ + border-radius:0; + } + +.selected:is(.textLayer .highlight){ + background-color:var(--highlight-selected-bg-color); + -webkit-backdrop-filter:var(--highlight-selected-backdrop-filter); + backdrop-filter:var(--highlight-selected-backdrop-filter); + } + +.textLayer ::-moz-selection{ + background:rgba(0 0 255 / 0.25); + background:color-mix(in srgb, AccentColor, transparent 75%); + } + +.textLayer ::selection{ + background:rgba(0 0 255 / 0.25); + background:color-mix(in srgb, AccentColor, transparent 75%); + } + +.textLayer br::-moz-selection{ + background:transparent; + } + +.textLayer br::selection{ + background:transparent; + } + +.textLayer .endOfContent{ + display:block; + position:absolute; + inset:100% 0 0; + z-index:0; + cursor:default; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + } + +.textLayer.selecting .endOfContent{ + top:0; + } + +.annotationLayer{ + --csstools-color-scheme--light:initial; + color-scheme:only light; + + --annotation-unfocused-field-background:url("data:image/svg+xml;charset=UTF-8,"); + --comment-edit-image:url(images/comment_editButton.svg); + --input-focus-border-color:Highlight; + --input-focus-outline:1px solid Canvas; + --input-unfocused-border-color:transparent; + --input-disabled-border-color:transparent; + --input-hover-border-color:black; + --link-outline:none; +} + +@media screen and (forced-colors: active){ + +.annotationLayer{ + --input-focus-border-color:CanvasText; + --input-unfocused-border-color:ActiveText; + --input-disabled-border-color:GrayText; + --input-hover-border-color:Highlight; + --link-outline:1.5px solid LinkText; +} + + .annotationLayer .textWidgetAnnotation :is(input,textarea):required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required{ + outline:1.5px solid selectedItem; + } + + .annotationLayer .linkAnnotation{ + outline:var(--link-outline); + } + + :is(.annotationLayer .linkAnnotation):hover{ + -webkit-backdrop-filter:var(--hcm-highlight-filter); + backdrop-filter:var(--hcm-highlight-filter); + } + + :is(.annotationLayer .linkAnnotation) > a:hover{ + opacity:0 !important; + background:none !important; + box-shadow:none; + } + + .annotationLayer .popupAnnotation .popup{ + outline:calc(1.5px * var(--total-scale-factor)) solid CanvasText !important; + background-color:ButtonFace !important; + color:ButtonText !important; + } + + .annotationLayer .highlightArea:hover::after{ + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + -webkit-backdrop-filter:var(--hcm-highlight-filter); + backdrop-filter:var(--hcm-highlight-filter); + content:""; + pointer-events:none; + } + + .annotationLayer .popupAnnotation.focused .popup{ + outline:calc(3px * var(--total-scale-factor)) solid Highlight !important; + } + } + +.annotationLayer{ + + position:absolute; + top:0; + left:0; + pointer-events:none; + transform-origin:0 0; +} + +.annotationLayer[data-main-rotation="90"] .norotate{ + transform:rotate(270deg) translateX(-100%); + } + +.annotationLayer[data-main-rotation="180"] .norotate{ + transform:rotate(180deg) translate(-100%, -100%); + } + +.annotationLayer[data-main-rotation="270"] .norotate{ + transform:rotate(90deg) translateY(-100%); + } + +.annotationLayer.disabled section,.annotationLayer.disabled .popup{ + pointer-events:none; + } + +.annotationLayer .annotationContent{ + position:absolute; + width:100%; + height:100%; + pointer-events:none; + } + +.freetext:is(.annotationLayer .annotationContent){ + background:transparent; + border:none; + inset:0; + overflow:visible; + white-space:nowrap; + font:10px sans-serif; + line-height:1.35; + } + +.annotationLayer section{ + position:absolute; + text-align:initial; + pointer-events:auto; + box-sizing:border-box; + transform-origin:0 0; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + } + +:is(.annotationLayer section):has(div.annotationContent) canvas.annotationContent{ + display:none; + } + +:is(.annotationLayer section) .overlaidText{ + position:absolute; + top:0; + left:0; + width:0; + height:0; + display:inline-block; + overflow:hidden; + } + +.textLayer.selecting ~ .annotationLayer section{ + pointer-events:none; + } + +.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton) > a{ + position:absolute; + font-size:1em; + top:0; + left:0; + width:100%; + height:100%; + } + +.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton):not(.hasBorder) > a:hover{ + opacity:0.2; + background-color:rgb(255 255 0); + } + +.annotationLayer .linkAnnotation.hasBorder:hover{ + background-color:rgb(255 255 0 / 0.2); + } + +.annotationLayer .hasBorder{ + background-size:100% 100%; + } + +.annotationLayer .textAnnotation img{ + position:absolute; + cursor:pointer; + width:100%; + height:100%; + top:0; + left:0; + } + +.annotationLayer .textWidgetAnnotation :is(input,textarea),.annotationLayer .choiceWidgetAnnotation select,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{ + background-image:var(--annotation-unfocused-field-background); + border:2px solid var(--input-unfocused-border-color); + box-sizing:border-box; + font:calc(9px * var(--total-scale-factor)) sans-serif; + height:100%; + margin:0; + vertical-align:top; + width:100%; + } + +.annotationLayer .textWidgetAnnotation :is(input,textarea):required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required{ + outline:1.5px solid red; + } + +.annotationLayer .choiceWidgetAnnotation select option{ + padding:0; + } + +.annotationLayer .buttonWidgetAnnotation.radioButton input{ + border-radius:50%; + } + +.annotationLayer .textWidgetAnnotation textarea{ + resize:none; + } + +.annotationLayer .textWidgetAnnotation [disabled]:is(input,textarea),.annotationLayer .choiceWidgetAnnotation select[disabled],.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input[disabled]{ + background:none; + border:2px solid var(--input-disabled-border-color); + cursor:not-allowed; + } + +.annotationLayer .textWidgetAnnotation :is(input,textarea):hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:hover{ + border:2px solid var(--input-hover-border-color); + } + +.annotationLayer .textWidgetAnnotation :is(input,textarea):hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .buttonWidgetAnnotation.checkBox input:hover{ + border-radius:2px; + } + +.annotationLayer .textWidgetAnnotation :is(input,textarea):focus,.annotationLayer .choiceWidgetAnnotation select:focus{ + background:none; + border:2px solid var(--input-focus-border-color); + border-radius:2px; + outline:var(--input-focus-outline); + } + +.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) :focus{ + background-image:none; + background-color:transparent; + } + +.annotationLayer .buttonWidgetAnnotation.checkBox :focus{ + border:2px solid var(--input-focus-border-color); + border-radius:2px; + outline:var(--input-focus-outline); + } + +.annotationLayer .buttonWidgetAnnotation.radioButton :focus{ + border:2px solid var(--input-focus-border-color); + outline:var(--input-focus-outline); + } + +.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after,.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before{ + background-color:CanvasText; + content:""; + display:block; + position:absolute; + } + +.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after{ + height:80%; + left:45%; + width:1px; + } + +.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before{ + transform:rotate(45deg); + } + +.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after{ + transform:rotate(-45deg); + } + +.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before{ + border-radius:50%; + height:50%; + left:25%; + top:25%; + width:50%; + } + +.annotationLayer .textWidgetAnnotation input.comb{ + font-family:monospace; + padding-left:2px; + padding-right:0; + } + +.annotationLayer .textWidgetAnnotation input.comb:focus{ + width:103%; + } + +.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{ + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + } + +.annotationLayer .fileAttachmentAnnotation .popupTriggerArea{ + height:100%; + width:100%; + } + +.annotationLayer .popupAnnotation{ + position:absolute; + font-size:calc(9px * var(--total-scale-factor)); + pointer-events:none; + width:-moz-max-content; + width:max-content; + max-width:45%; + height:auto; + } + +.annotationLayer .popup{ + background-color:rgb(255 255 153); + color:black; + box-shadow:0 calc(2px * var(--total-scale-factor)) calc(5px * var(--total-scale-factor)) rgb(136 136 136); + border-radius:calc(2px * var(--total-scale-factor)); + outline:1.5px solid rgb(255 255 74); + padding:calc(6px * var(--total-scale-factor)); + cursor:pointer; + font:message-box; + white-space:normal; + word-wrap:break-word; + pointer-events:auto; + -webkit-user-select:text; + -moz-user-select:text; + user-select:text; + } + +.annotationLayer .popupAnnotation.focused .popup{ + outline-width:3px; + } + +.annotationLayer .popup *{ + font-size:calc(9px * var(--total-scale-factor)); + } + +.annotationLayer .popup > .header{ + display:inline-block; + } + +.annotationLayer .popup > .header > .title{ + display:inline; + font-weight:bold; + } + +.annotationLayer .popup > .header .popupDate{ + display:inline-block; + margin-left:calc(5px * var(--total-scale-factor)); + width:-moz-fit-content; + width:fit-content; + } + +.annotationLayer .popupContent{ + border-top:1px solid rgb(51 51 51); + margin-top:calc(2px * var(--total-scale-factor)); + padding-top:calc(2px * var(--total-scale-factor)); + } + +.annotationLayer .richText > *{ + white-space:pre-wrap; + font-size:calc(9px * var(--total-scale-factor)); + } + +.annotationLayer .popupTriggerArea{ + cursor:pointer; + } + +:is(.annotationLayer .popupTriggerArea):hover{ + -webkit-backdrop-filter:var(--hcm-highlight-filter); + backdrop-filter:var(--hcm-highlight-filter); + } + +.annotationLayer section svg{ + position:absolute; + width:100%; + height:100%; + top:0; + left:0; + } + +.annotationLayer .annotationTextContent{ + position:absolute; + width:100%; + height:100%; + opacity:0; + color:transparent; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + pointer-events:none; + } + +:is(.annotationLayer .annotationTextContent) span{ + width:100%; + display:inline-block; + } + +.annotationLayer svg.quadrilateralsContainer{ + contain:strict; + width:0; + height:0; + position:absolute; + top:0; + left:0; + z-index:-1; + } + +:root{ + --xfa-unfocused-field-background:url("data:image/svg+xml;charset=UTF-8,"); + --xfa-focus-outline:auto; +} + +@media screen and (forced-colors: active){ + :root{ + --xfa-focus-outline:2px solid CanvasText; + } + .xfaLayer *:required{ + outline:1.5px solid selectedItem; + } +} + +.xfaLayer{ + --csstools-color-scheme--light:initial; + color-scheme:only light; + + background-color:transparent; +} + +.xfaLayer .highlight{ + margin:-1px; + padding:1px; + background-color:rgb(239 203 237); + border-radius:4px; +} + +.xfaLayer .highlight.appended{ + position:initial; +} + +.xfaLayer .highlight.begin{ + border-radius:4px 0 0 4px; +} + +.xfaLayer .highlight.end{ + border-radius:0 4px 4px 0; +} + +.xfaLayer .highlight.middle{ + border-radius:0; +} + +.xfaLayer .highlight.selected{ + background-color:rgb(203 223 203); +} + +.xfaPage{ + overflow:hidden; + position:relative; +} + +.xfaContentarea{ + position:absolute; +} + +.xfaPrintOnly{ + display:none; +} + +.xfaLayer{ + position:absolute; + text-align:initial; + top:0; + left:0; + transform-origin:0 0; + line-height:1.2; +} + +.xfaLayer *{ + color:inherit; + font:inherit; + font-style:inherit; + font-weight:inherit; + font-kerning:inherit; + letter-spacing:-0.01px; + text-align:inherit; + text-decoration:inherit; + box-sizing:border-box; + background-color:transparent; + padding:0; + margin:0; + pointer-events:auto; + line-height:inherit; +} + +.xfaLayer *:required{ + outline:1.5px solid red; +} + +.xfaLayer div, +.xfaLayer svg, +.xfaLayer svg *{ + pointer-events:none; +} + +.xfaLayer a{ + color:blue; +} + +.xfaRich li{ + margin-left:3em; +} + +.xfaFont{ + color:black; + font-weight:normal; + font-kerning:none; + font-size:10px; + font-style:normal; + letter-spacing:0; + text-decoration:none; + vertical-align:0; +} + +.xfaCaption{ + overflow:hidden; + flex:0 0 auto; +} + +.xfaCaptionForCheckButton{ + overflow:hidden; + flex:1 1 auto; +} + +.xfaLabel{ + height:100%; + width:100%; +} + +.xfaLeft{ + display:flex; + flex-direction:row; + align-items:center; +} + +.xfaRight{ + display:flex; + flex-direction:row-reverse; + align-items:center; +} + +:is(.xfaLeft, .xfaRight) > :is(.xfaCaption, .xfaCaptionForCheckButton){ + max-height:100%; +} + +.xfaTop{ + display:flex; + flex-direction:column; + align-items:flex-start; +} + +.xfaBottom{ + display:flex; + flex-direction:column-reverse; + align-items:flex-start; +} + +:is(.xfaTop, .xfaBottom) > :is(.xfaCaption, .xfaCaptionForCheckButton){ + width:100%; +} + +.xfaBorder{ + background-color:transparent; + position:absolute; + pointer-events:none; +} + +.xfaWrapped{ + width:100%; + height:100%; +} + +:is(.xfaTextfield, .xfaSelect):focus{ + background-image:none; + background-color:transparent; + outline:var(--xfa-focus-outline); + outline-offset:-1px; +} + +:is(.xfaCheckbox, .xfaRadio):focus{ + outline:var(--xfa-focus-outline); +} + +.xfaTextfield, +.xfaSelect{ + height:100%; + width:100%; + flex:1 1 auto; + border:none; + resize:none; + background-image:var(--xfa-unfocused-field-background); +} + +.xfaSelect{ + padding-inline:2px; +} + +:is(.xfaTop, .xfaBottom) > :is(.xfaTextfield, .xfaSelect){ + flex:0 1 auto; +} + +.xfaButton{ + cursor:pointer; + width:100%; + height:100%; + border:none; + text-align:center; +} + +.xfaLink{ + width:100%; + height:100%; + position:absolute; + top:0; + left:0; +} + +.xfaCheckbox, +.xfaRadio{ + width:100%; + height:100%; + flex:0 0 auto; + border:none; +} + +.xfaRich{ + white-space:pre-wrap; + width:100%; + height:100%; +} + +.xfaImage{ + -o-object-position:left top; + object-position:left top; + -o-object-fit:contain; + object-fit:contain; + width:100%; + height:100%; +} + +.xfaLrTb, +.xfaRlTb, +.xfaTb{ + display:flex; + flex-direction:column; + align-items:stretch; +} + +.xfaLr{ + display:flex; + flex-direction:row; + align-items:stretch; +} + +.xfaRl{ + display:flex; + flex-direction:row-reverse; + align-items:stretch; +} + +.xfaTb > div{ + justify-content:left; +} + +.xfaPosition{ + position:relative; +} + +.xfaArea{ + position:relative; +} + +.xfaValignMiddle{ + display:flex; + align-items:center; +} + +.xfaTable{ + display:flex; + flex-direction:column; + align-items:stretch; +} + +.xfaTable .xfaRow{ + display:flex; + flex-direction:row; + align-items:stretch; +} + +.xfaTable .xfaRlRow{ + display:flex; + flex-direction:row-reverse; + align-items:stretch; + flex:1; +} + +.xfaTable .xfaRlRow > div{ + flex:1; +} + +:is(.xfaNonInteractive, .xfaDisabled, .xfaReadOnly) :is(input, textarea){ + background:initial; +} + +@media print{ + .xfaTextfield, + .xfaSelect{ + background:transparent; + } + + .xfaSelect{ + -webkit-appearance:none; + -moz-appearance:none; + appearance:none; + text-indent:1px; + text-overflow:""; + } +} + +.canvasWrapper svg{ + transform:none; + } + +.moving:is(.canvasWrapper svg){ + z-index:100000; + } + +[data-main-rotation="90"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="90"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){ + transform:matrix(0, 1, -1, 0, 1, 0); + } + +[data-main-rotation="180"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="180"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){ + transform:matrix(-1, 0, 0, -1, 1, 1); + } + +[data-main-rotation="270"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) mask,[data-main-rotation="270"]:is(.highlight:is(.canvasWrapper svg),.highlightOutline:is(.canvasWrapper svg)) use:not(.clip,.mask){ + transform:matrix(0, -1, 1, 0, 0, 1); + } + +.draw:is(.canvasWrapper svg){ + position:absolute; + mix-blend-mode:normal; + } + +.draw[data-draw-rotation="90"]:is(.canvasWrapper svg){ + transform:rotate(90deg); + } + +.draw[data-draw-rotation="180"]:is(.canvasWrapper svg){ + transform:rotate(180deg); + } + +.draw[data-draw-rotation="270"]:is(.canvasWrapper svg){ + transform:rotate(270deg); + } + +.highlight:is(.canvasWrapper svg){ + --blend-mode:multiply; + } + +@media screen and (forced-colors: active){ + +.highlight:is(.canvasWrapper svg){ + --blend-mode:difference; + } + } + +.highlight:is(.canvasWrapper svg){ + + position:absolute; + mix-blend-mode:var(--blend-mode); + } + +.highlight:is(.canvasWrapper svg):not(.free){ + fill-rule:evenodd; + } + +.highlightOutline:is(.canvasWrapper svg){ + position:absolute; + mix-blend-mode:normal; + fill-rule:evenodd; + fill:none; + } + +.highlightOutline.hovered:is(.canvasWrapper svg):not(.free):not(.selected){ + stroke:var(--hover-outline-color); + stroke-width:var(--outline-width); + } + +.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .mainOutline{ + stroke:var(--outline-around-color); + stroke-width:calc( + var(--outline-width) + 2 * var(--outline-around-width) + ); + } + +.highlightOutline.selected:is(.canvasWrapper svg):not(.free) .secondaryOutline{ + stroke:var(--outline-color); + stroke-width:var(--outline-width); + } + +.highlightOutline.free.hovered:is(.canvasWrapper svg):not(.selected){ + stroke:var(--hover-outline-color); + stroke-width:calc(2 * var(--outline-width)); + } + +.highlightOutline.free.selected:is(.canvasWrapper svg) .mainOutline{ + stroke:var(--outline-around-color); + stroke-width:calc( + 2 * (var(--outline-width) + var(--outline-around-width)) + ); + } + +.highlightOutline.free.selected:is(.canvasWrapper svg) .secondaryOutline{ + stroke:var(--outline-color); + stroke-width:calc(2 * var(--outline-width)); + } + +.toggle-button{ + --button-background-color:color-mix(in srgb, currentColor 7%, transparent); + --button-background-color-hover:color-mix( + in srgb, + currentColor 14%, + transparent + ); + --button-background-color-active:color-mix( + in srgb, + currentColor 21%, + transparent + ); + --csstools-light-dark-toggle--35:var(--csstools-color-scheme--light) #0df; + --color-accent-primary:var(--csstools-light-dark-toggle--35, #0060df); + --csstools-light-dark-toggle--36:var(--csstools-color-scheme--light) #80ebff; + --color-accent-primary-hover:var(--csstools-light-dark-toggle--36, #0250bb); + --csstools-light-dark-toggle--37:var(--csstools-color-scheme--light) #aaf2ff; + --color-accent-primary-active:var(--csstools-light-dark-toggle--37, #054096); + --border-radius-circle:9999px; + --border-width:1px; + --size-item-small:16px; + --size-item-large:32px; + --csstools-light-dark-toggle--38:var(--csstools-color-scheme--light) #1c1b22; + --color-canvas:var(--csstools-light-dark-toggle--38, white); + --background-color-canvas:var(--color-canvas); + --csstools-light-dark-toggle--39:var(--csstools-color-scheme--light) #f9f9fa; + --border-color-interactive:var(--csstools-light-dark-toggle--39, #8f8f9d); + --border-color-interactive-hover:var(--border-color-interactive); + --border-color-interactive-active:var(--border-color-interactive); +} + +@supports (color: light-dark(red, red)){ +.toggle-button{ + --color-accent-primary:light-dark(#0060df, #0df); + --color-accent-primary-hover:light-dark(#0250bb, #80ebff); + --color-accent-primary-active:light-dark(#054096, #aaf2ff); + --color-canvas:light-dark(white, #1c1b22); + --border-color-interactive:light-dark(#8f8f9d, #f9f9fa); +} +} + +@supports not (color: light-dark(tan, tan)){ + +.toggle-button *{ + --csstools-light-dark-toggle--35:var(--csstools-color-scheme--light) #0df; + --color-accent-primary:var(--csstools-light-dark-toggle--35, #0060df); + --csstools-light-dark-toggle--36:var(--csstools-color-scheme--light) #80ebff; + --color-accent-primary-hover:var(--csstools-light-dark-toggle--36, #0250bb); + --csstools-light-dark-toggle--37:var(--csstools-color-scheme--light) #aaf2ff; + --color-accent-primary-active:var(--csstools-light-dark-toggle--37, #054096); + --csstools-light-dark-toggle--38:var(--csstools-color-scheme--light) #1c1b22; + --color-canvas:var(--csstools-light-dark-toggle--38, white); + --csstools-light-dark-toggle--39:var(--csstools-color-scheme--light) #f9f9fa; + --border-color-interactive:var(--csstools-light-dark-toggle--39, #8f8f9d); + } +} + +@media (forced-colors: active){ + +.toggle-button{ + --color-accent-primary:ButtonText; + --color-accent-primary-hover:SelectedItem; + --color-accent-primary-active:SelectedItem; + --button-background-color:ButtonFace; + --border-color-interactive:ButtonText; + --border-color-interactive-hover:SelectedItem; + --border-color-interactive-active:ButtonText; + --color-canvas:ButtonText; + --background-color-canvas:Canvas; +} + } + +.toggle-button{ + --toggle-background-color:var(--button-background-color); + --toggle-background-color-hover:var(--button-background-color-hover); + --toggle-background-color-active:var(--button-background-color-active); + --toggle-background-color-pressed:var(--color-accent-primary); + --toggle-background-color-pressed-hover:var(--color-accent-primary-hover); + --toggle-background-color-pressed-active:var(--color-accent-primary-active); + --toggle-border-color:var(--border-color-interactive); + --toggle-border-color-hover:var(--toggle-border-color); + --toggle-border-color-active:var(--toggle-border-color); + --toggle-border-radius:var(--border-radius-circle); + --toggle-border-width:var(--border-width); + --toggle-height:var(--size-item-small); + --toggle-width:var(--size-item-large); + --toggle-dot-background-color:var(--toggle-border-color); + --toggle-dot-background-color-hover:var(--toggle-dot-background-color); + --toggle-dot-background-color-active:var(--toggle-dot-background-color); + --toggle-dot-background-color-on-pressed:var(--background-color-canvas); + --toggle-dot-margin:1px; + --toggle-dot-height:calc( + var(--toggle-height) - 2 * var(--toggle-dot-margin) - 2 * + var(--toggle-border-width) + ); + --toggle-dot-width:var(--toggle-dot-height); + --toggle-dot-transform-x:calc( + var(--toggle-width) - 4 * var(--toggle-dot-margin) - var(--toggle-dot-width) + ); + --input-width:var(--toggle-width); + + -webkit-appearance:none; + + -moz-appearance:none; + + appearance:none; + padding:0; + border:var(--toggle-border-width) solid var(--toggle-border-color); + height:var(--toggle-height); + width:var(--toggle-width); + border-radius:var(--toggle-border-radius); + background-color:var(--toggle-background-color); + box-sizing:border-box; +} + +.toggle-button:focus-visible{ + outline:var(--focus-outline); + outline-offset:var(--focus-outline-offset); + } + +.toggle-button:enabled:hover{ + background-color:var(--toggle-background-color-hover); + border-color:var(--toggle-border-color); + } + +.toggle-button:enabled:hover:active{ + background-color:var(--toggle-background-color-active); + border-color:var(--toggle-border-color); + } + +.toggle-button::before{ + display:block; + content:""; + background-color:var(--toggle-dot-background-color); + height:var(--toggle-dot-height); + width:var(--toggle-dot-width); + margin:var(--toggle-dot-margin); + border-radius:var(--toggle-border-radius); + translate:0; + } + +.toggle-button[aria-pressed="true"]{ + background-color:var(--toggle-background-color-pressed); + border-color:transparent; +} + +.toggle-button[aria-pressed="true"]:enabled:hover{ + background-color:var(--toggle-background-color-pressed-hover); + border-color:transparent; + } + +.toggle-button[aria-pressed="true"]:enabled:hover:active{ + background-color:var(--toggle-background-color-pressed-active); + border-color:transparent; + } + +.toggle-button[aria-pressed="true"]::before{ + translate:var(--toggle-dot-transform-x); + background-color:var(--toggle-dot-background-color-on-pressed); + } + +.toggle-button[aria-pressed="true"]:enabled:hover::before,.toggle-button[aria-pressed="true"]:enabled:hover:active::before{ + background-color:var(--toggle-dot-background-color-on-pressed); + } + +.toggle-button[aria-pressed="true"]:-moz-locale-dir(rtl)::before,[dir="rtl"] .toggle-button[aria-pressed="true"]::before{ + translate:calc(-1 * var(--toggle-dot-transform-x)); + } + +@media (prefers-reduced-motion: no-preference){ + .toggle-button::before{ + transition:translate 100ms; + } +} + +@media (prefers-contrast){ + .toggle-button:enabled:hover{ + border-color:var(--toggle-border-color-hover); + } + + .toggle-button:enabled:hover:active{ + border-color:var(--toggle-border-color-active); + } + + .toggle-button[aria-pressed="true"]:enabled{ + border-color:var(--toggle-border-color); + position:relative; + } + + .toggle-button[aria-pressed="true"]:enabled:hover{ + border-color:var(--toggle-border-color-hover); + } + + .toggle-button[aria-pressed="true"]:enabled:hover:active{ + background-color:var(--toggle-dot-background-color-active); + border-color:var(--toggle-dot-background-color-hover); + } + + .toggle-button:enabled:hover::before, + .toggle-button:enabled:hover:active::before{ + background-color:var(--toggle-dot-background-color-hover); + } +} + +@media (forced-colors){ + .toggle-button{ + --toggle-dot-background-color:var(--color-accent-primary); + --toggle-dot-background-color-hover:var(--color-accent-primary-hover); + --toggle-dot-background-color-active:var(--color-accent-primary-active); + --toggle-dot-background-color-on-pressed:var(--button-background-color); + --toggle-border-color-hover:var(--border-color-interactive-hover); + --toggle-border-color-active:var(--border-color-interactive-active); + } + + .toggle-button[aria-pressed="true"]:enabled::after{ + border:1px solid var(--button-background-color); + content:""; + position:absolute; + height:var(--toggle-height); + width:var(--toggle-width); + display:block; + border-radius:var(--toggle-border-radius); + inset:-2px; + } + + .toggle-button[aria-pressed="true"]:enabled:hover:active::after{ + border-color:var(--toggle-border-color-active); + } +} + +:root{ + --clear-signature-button-icon:url(images/editor-toolbar-delete.svg); + --csstools-light-dark-toggle--40:var(--csstools-color-scheme--light) #2b2a33; + --signature-bg:var(--csstools-light-dark-toggle--40, #f9f9fb); + --csstools-light-dark-toggle--41:var(--csstools-color-scheme--light) var(--signature-bg); + --signature-hover-bg:var(--csstools-light-dark-toggle--41, #f0f0f4); + --button-signature-bg:transparent; + --button-signature-color:var(--main-color); + --csstools-light-dark-toggle--42:var(--csstools-color-scheme--light) #5b5b66; + --button-signature-active-bg:var(--csstools-light-dark-toggle--42, #cfcfd8); + --button-signature-active-border:none; + --button-signature-active-color:var(--button-signature-color); + --button-signature-border:none; + --csstools-light-dark-toggle--43:var(--csstools-color-scheme--light) #52525e; + --button-signature-hover-bg:var(--csstools-light-dark-toggle--43, #e0e0e6); + --button-signature-hover-color:var(--button-signature-color); +} + +@supports (color: light-dark(red, red)){ +:root{ + --signature-bg:light-dark(#f9f9fb, #2b2a33); + --signature-hover-bg:light-dark(#f0f0f4, var(--signature-bg)); + --button-signature-active-bg:light-dark(#cfcfd8, #5b5b66); + --button-signature-hover-bg:light-dark(#e0e0e6, #52525e); +} +} + +@supports not (color: light-dark(tan, tan)){ + +:root *{ + --csstools-light-dark-toggle--40:var(--csstools-color-scheme--light) #2b2a33; + --signature-bg:var(--csstools-light-dark-toggle--40, #f9f9fb); + --csstools-light-dark-toggle--41:var(--csstools-color-scheme--light) var(--signature-bg); + --signature-hover-bg:var(--csstools-light-dark-toggle--41, #f0f0f4); + --csstools-light-dark-toggle--42:var(--csstools-color-scheme--light) #5b5b66; + --button-signature-active-bg:var(--csstools-light-dark-toggle--42, #cfcfd8); + --csstools-light-dark-toggle--43:var(--csstools-color-scheme--light) #52525e; + --button-signature-hover-bg:var(--csstools-light-dark-toggle--43, #e0e0e6); + } +} + +@media screen and (forced-colors: active){ + +:root{ + --signature-bg:HighlightText; + --signature-hover-bg:var(--signature-bg); + --button-signature-bg:HighlightText; + --button-signature-color:ButtonText; + --button-signature-active-bg:ButtonText; + --button-signature-active-color:HighlightText; + --button-signature-border:1px solid ButtonText; + --button-signature-hover-bg:Highlight; + --button-signature-hover-color:HighlightText; +} + } + +.signatureDialog{ + --primary-color:var(--text-primary-color); + --border-color:#8f8f9d; + --open-link-fg:var(--link-fg-color); + --open-link-hover-fg:var(--link-hover-fg-color); +} + +@media screen and (forced-colors: active){ + +.signatureDialog{ + --primary-color:ButtonText; + --border-color:ButtonText; + --open-link-fg:ButtonText; + --open-link-hover-fg:ButtonText; +} + } + +.signatureDialog{ + + width:570px; + max-width:100%; + min-width:300px; + padding:16px 0; +} + +.signatureDialog .mainContainer{ + width:100%; + display:flex; + flex-direction:column; + align-items:flex-start; + gap:12px; + } + +:is(.signatureDialog .mainContainer) span:not([role="sectionhead"]){ + font-size:13px; + font-style:normal; + font-weight:400; + line-height:normal; + } + +:is(.signatureDialog .mainContainer) .title{ + margin-inline-start:16px; + } + +.signatureDialog .inputWithClearButton{ + --button-dimension:24px; + --clear-button-icon:url(images/messageBar_closingButton.svg); + + width:100%; + position:relative; + display:flex; + align-items:center; + justify-content:center; + } + +:is(.signatureDialog .inputWithClearButton) > input{ + width:100%; + height:32px; + padding-inline:8px calc(4px + var(--button-dimension)); + box-sizing:border-box; + border-radius:4px; + border:1px solid var(--border-color); + } + +:is(.signatureDialog .inputWithClearButton) .clearInputButton{ + position:absolute; + inset-block-start:4px; + inset-inline-end:4px; + display:inline-block; + width:var(--button-dimension); + height:var(--button-dimension); + background-color:var(--input-text-fg-color); + -webkit-mask-size:cover; + mask-size:cover; + -webkit-mask-image:var(--clear-button-icon); + mask-image:var(--clear-button-icon); + padding:0; + border:0; + } + +#addSignatureDialog{ + --secondary-color:var(--text-secondary-color); + --bg-hover:#e0e0e6; + --tab-top-line-active-color:#0060df; + --tab-top-line-active-hover-color:var(--tab-text-hover-color); + --tab-top-line-hover-color:#8f8f9d; + --tab-top-line-inactive-color:#cfcfd8; + --tab-bottom-line-active-color:var(--tab-top-line-inactive-color); + --tab-bottom-line-hover-color:var(--tab-top-line-inactive-color); + --tab-bottom-line-inactive-color:var(--tab-top-line-inactive-color); + --tab-bg:var(--dialog-bg-color); + --tab-bg-active-color:var(--tab-bg); + --tab-bg-active-hover-color:var(--bg-hover); + --tab-bg-hover:var(--bg-hover); + --tab-panel-border:none; + --tab-panel-border-radius:4px; + --tab-text-color:var(--primary-color); + --tab-text-active-color:var(--tab-top-line-active-color); + --tab-text-active-hover-color:var(--tab-text-hover-color); + --tab-text-hover-color:var(--tab-text-color); + --signature-placeholder-color:var(--secondary-color); + --signature-draw-placeholder-color:var(--primary-color); + --signature-color:var(--primary-color); + --clear-signature-button-border-width:0; + --clear-signature-button-border-style:solid; + --clear-signature-button-border-color:transparent; + --clear-signature-button-border-disabled-color:transparent; + --clear-signature-button-color:var(--primary-color); + --clear-signature-button-hover-color:var(--clear-signature-button-color); + --clear-signature-button-active-color:var(--clear-signature-button-color); + --clear-signature-button-disabled-color:var(--clear-signature-button-color); + --clear-signature-button-focus-color:var(--clear-signature-button-color); + --clear-signature-button-bg:var(--dialog-bg-color); + --clear-signature-button-bg-hover:var(--bg-hover); + --clear-signature-button-bg-active:#cfcfd8; + --clear-signature-button-bg-focus:#f0f0f4; + --clear-signature-button-bg-disabled:color-mix( + in srgb, + #f0f0f4, + transparent 40% + ); + --save-warning-color:var(--secondary-color); + --thickness-bg:var(--dialog-bg-color); + --thickness-label-color:var(--primary-color); + --thickness-slider-color:var(--primary-color); + --thickness-border:none; + --draw-cursor:url(images/cursor-editorInk.svg) 0 16, pointer; +} + +@media (prefers-color-scheme: dark){ + +#addSignatureDialog{ + --dialog-bg-color:#42414d; + --bg-hover:#52525e; + --primary-color:#fbfbfe; + --secondary-color:#cfcfd8; + --tab-top-line-active-color:#0df; + --tab-top-line-inactive-color:#8f8f9d; + --clear-signature-button-bg-active:#5b5b66; + --clear-signature-button-bg-focus:#2b2a33; + --clear-signature-button-bg-disabled:color-mix( + in srgb, + #2b2a33, + transparent 40% + ); +} + } + +@media screen and (forced-colors: active){ + +#addSignatureDialog{ + --secondary-color:ButtonText; + --bg:HighlightText; + --bg-hover:var(--bg); + --tab-top-line-active-color:ButtonText; + --tab-top-line-active-hover-color:HighlightText; + --tab-top-line-hover-color:SelectedItem; + --tab-top-line-inactive-color:ButtonText; + --tab-bottom-line-active-color:var(--tab-top-line-active-color); + --tab-bottom-line-hover-color:var(--tab-top-line-hover-color); + --tab-bg:var(--bg); + --tab-bg-active-color:SelectedItem; + --tab-bg-active-hover-color:SelectedItem; + --tab-panel-border:1px solid ButtonText; + --tab-panel-border-radius:8px; + --tab-text-color:ButtonText; + --tab-text-active-color:HighlightText; + --tab-text-active-hover-color:HighlightText; + --tab-text-hover-color:SelectedItem; + --signature-color:ButtonText; + --clear-signature-button-border-width:1px; + --clear-signature-button-border-style:solid; + --clear-signature-button-border-color:ButtonText; + --clear-signature-button-border-disabled-color:GrayText; + --clear-signature-button-color:ButtonText; + --clear-signature-button-hover-color:HighlightText; + --clear-signature-button-active-color:SelectedItem; + --clear-signature-button-focus-color:CanvasText; + --clear-signature-button-disabled-color:GrayText; + --clear-signature-button-bg:var(--bg); + --clear-signature-button-bg-hover:SelectedItem; + --clear-signature-button-bg-active:var(--bg); + --clear-signature-button-bg-focus:var(--bg); + --clear-signature-button-bg-disabled:var(--bg); + --thickness-bg:Canvas; + --thickness-label-color:CanvasText; + --thickness-slider-color:ButtonText; + --thickness-border:1px solid var(--border-color); +} + } + +#addSignatureDialog #addSignatureDialogLabel{ + overflow:hidden; + position:absolute; + inset:0; + width:0; + height:0; + } + +#addSignatureDialog.waiting::after{ + content:""; + cursor:wait; + position:absolute; + inset:0; + width:100%; + height:100%; + } + +:is(#addSignatureDialog .mainContainer) [role="tablist"]{ + width:100%; + display:flex; + align-items:flex-start; + gap:0; + } + +:is(:is(#addSignatureDialog .mainContainer) [role="tablist"]) > [role="tab"]{ + flex:1 0 0; + align-self:stretch; + background-color:var(--tab-bg); + padding-inline:0; + cursor:default; + + border-inline:0; + border-block-width:1px; + border-block-style:solid; + border-block-start-color:var(--tab-top-line-inactive-color); + border-block-end-color:var(--tab-bottom-line-inactive-color); + border-radius:0; + + font:menu; + font-size:13px; + font-style:normal; + line-height:normal; + font-weight:400; + color:var(--tab-text-color); + } + +:is(:is(:is(#addSignatureDialog .mainContainer) [role="tablist"]) > [role="tab"]):hover{ + border-block-start-width:2px; + border-block-start-color:var(--tab-top-line-hover-color); + border-block-end-color:var(--tab-bottom-line-hover-color); + background-color:var(--tab-bg-hover); + color:var(--tab-text-hover-color); + } + +:is(:is(:is(#addSignatureDialog .mainContainer) [role="tablist"]) > [role="tab"]):focus-visible{ + outline:2px solid var(--tab-top-line-active-color); + outline-offset:-2px; + } + +[aria-selected="true"]:is(:is(:is(#addSignatureDialog .mainContainer) [role="tablist"]) > [role="tab"]){ + border-block-start-width:2px; + border-block-start-color:var(--tab-top-line-active-color); + border-block-end-color:var(--tab-bottom-line-active-color); + background-color:var(--tab-bg-active-color); + font-weight:590; + color:var(--tab-text-active-color); + } + +[aria-selected="true"]:is(:is(:is(#addSignatureDialog .mainContainer) [role="tablist"]) > [role="tab"]):hover{ + border-block-start-color:var(--tab-top-line-active-hover-color); + background-color:var(--tab-bg-active-hover-color); + color:var(--tab-text-active-hover-color); + } + +:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer{ + width:100%; + height:auto; + display:flex; + flex-direction:column; + align-items:flex-end; + align-self:stretch; + gap:12px; + padding-inline:16px; + box-sizing:border-box; + } + +:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]{ + position:relative; + width:100%; + height:220px; + background-color:var(--signature-bg); + border:var(--tab-panel-border); + border-radius:var(--tab-panel-border-radius); + } + +:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) > svg{ + position:absolute; + inset:0; + width:100%; + height:100%; + background-color:transparent; + } + +#addSignatureTypeContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]){ + display:none; + } + +#addSignatureTypeContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #addSignatureTypeInput{ + position:absolute; + inset:0; + width:100%; + height:100%; + border:0; + padding:0; + text-align:center; + color:var(--signature-color); + background-color:transparent; + border-radius:var(--tab-panel-border-radius); + + font-family:"Brush script", "Apple Chancery", "Segoe script", "Freestyle Script", "Palace Script MT", "Brush Script MT", TK, cursive, serif; + font-size:44px; + font-style:italic; + font-weight:400; + } + +:is(#addSignatureTypeContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #addSignatureTypeInput)::-moz-placeholder{ + color:var(--signature-placeholder-color); + text-align:center; + + font:menu; + font-style:normal; + font-weight:274; + font-size:44px; + line-height:normal; + } + +:is(#addSignatureTypeContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #addSignatureTypeInput)::placeholder{ + color:var(--signature-placeholder-color); + text-align:center; + + font:menu; + font-style:normal; + font-weight:274; + font-size:44px; + line-height:normal; + } + +#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]){ + display:none; + } + +#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) > span{ + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + display:grid; + align-items:center; + justify-content:center; + + background-color:transparent; + color:var(--signature-placeholder-color); + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + } + +#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) > svg{ + stroke:var(--signature-color); + fill:none; + stroke-opacity:1; + stroke-linecap:round; + stroke-linejoin:round; + stroke-miterlimit:10; + } + +:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) > svg):hover{ + cursor:var(--draw-cursor); + } + +#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness{ + position:absolute; + width:100%; + inset-block-end:0; + display:grid; + align-items:center; + justify-content:center; + pointer-events:none; + } + +:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > span{ + color:var(--signature-draw-placeholder-color); + } + +:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div{ + width:auto; + height:auto; + display:flex; + align-items:center; + justify-content:center; + gap:8px; + padding:6px 8px 7px; + margin:0; + background-color:var(--thickness-bg); + border-radius:4px 4px 0 0; + border-inline:var(--thickness-border); + border-top:var(--thickness-border); + pointer-events:auto; + position:relative; + top:1px; + } + +:is(:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div) > label{ + color:var(--thickness-label-color); + } + +:is(:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div) > input{ + width:100px; + height:14px; + background-color:transparent; + } + +:is(:is(:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div) > input)::-webkit-slider-runnable-track,:is(:is(:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div) > input)::-moz-range-track,:is(:is(:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div) > input)::-moz-range-progress{ + background-color:var(--thickness-slider-color); + } + +:is(:is(:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div) > input)::-webkit-slider-thumb,:is(:is(:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div) > input)::-moz-range-thumb{ + background-color:var(--thickness-bg); + } + +:is(:is(#addSignatureDrawContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #thickness) > div) > input{ + + border-radius:4.5px; + border:0; + color:var(--signature-color); + } + +#addSignatureImageContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]){ + display:none; + } + +#addSignatureImageContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) > svg{ + stroke:none; + stroke-width:0; + fill:var(--signature-color); + fill-opacity:1; + } + +#addSignatureImageContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #addSignatureImagePlaceholder{ + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + background-color:transparent; + display:flex; + flex-direction:column; + align-items:center; + justify-content:center; + } + +:is(#addSignatureImageContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #addSignatureImagePlaceholder) span{ + color:var(--signature-placeholder-color); + } + +:is(#addSignatureImageContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #addSignatureImagePlaceholder) a{ + color:var(--open-link-fg); + text-decoration:underline; + cursor:pointer; + } + +:is(:is(#addSignatureImageContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #addSignatureImagePlaceholder) a):hover{ + color:var(--open-link-hover-fg); + } + +#addSignatureImageContainer:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > [role="tabpanel"]) #addSignatureFilePicker{ + visibility:hidden; + position:relative; + width:0; + height:0; + } + +[data-selected="type"]:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > #addSignatureTypeContainer,[data-selected="draw"]:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > #addSignatureDrawContainer,[data-selected="image"]:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) > #addSignatureImageContainer{ + display:block; + } + +:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls{ + display:flex; + flex-direction:column; + justify-content:center; + align-items:flex-start; + gap:12px; + align-self:stretch; + } + +:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer{ + display:flex; + align-items:flex-end; + gap:16px; + align-self:stretch; + } + +:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #addSignatureDescriptionContainer{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:4px; + flex:1 0 0; + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #addSignatureDescriptionContainer):has(input:disabled) > label{ + opacity:0.4; + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #addSignatureDescriptionContainer) > label{ + width:auto; + } + +:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton{ + display:flex; + height:32px; + padding:4px 8px; + align-items:center; + background-color:var(--clear-signature-button-bg); + border-width:var(--clear-signature-button-border-width); + border-style:var(--clear-signature-button-border-style); + border-color:var(--clear-signature-button-border-color); + border-radius:4px; + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton) > span{ + display:flex; + height:24px; + align-items:center; + gap:4px; + flex-shrink:0; + + color:var(--clear-signature-button-color); + } + +:is(:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton) > span)::after{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--clear-signature-button-icon); + mask-image:var(--clear-signature-button-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--clear-signature-button-color); + flex-shrink:0; + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):hover{ + background-color:var(--clear-signature-button-bg-hover); + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):hover > span{ + color:var(--clear-signature-button-hover-color); + } + +:is(:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):hover > span)::after{ + background-color:var(--clear-signature-button-hover-color); + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):active{ + background-color:var(--clear-signature-button-bg-active); + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):active > span{ + color:var(--clear-signature-button-active-color); + } + +:is(:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):active > span)::after{ + background-color:var(--clear-signature-button-active-color); + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):focus-visible{ + background-color:var(--clear-signature-button-bg-focus); + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):focus-visible > span{ + color:var(--clear-signature-button-focus-color); + } + +:is(:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):focus-visible > span)::after{ + background-color:var(--clear-signature-button-focus-color); + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):disabled{ + background-color:var(--clear-signature-button-bg-disabled); + border-color:var(--clear-signature-button-border-disabled-color); + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):disabled > span{ + color:var(--clear-signature-button-disabled-color); + } + +:is(:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #horizontalContainer) #clearSignatureButton):disabled > span)::after{ + background-color:var( + --clear-signature-button-disabled-color + ); + } + +:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #addSignatureSaveContainer{ + display:grid; + grid-template-columns:max-content auto; + gap:4px; + width:100%; + } + +:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #addSignatureSaveContainer) > input{ + margin:0; + } + +:is(:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #addSignatureSaveContainer) > input):disabled + label{ + opacity:0.4; + } + +:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #addSignatureSaveContainer) > label{ + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; + } + +:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #addSignatureSaveContainer):not(.fullStorage) #addSignatureSaveWarning{ + display:none; + } + +.fullStorage:is(:is(:is(:is(#addSignatureDialog .mainContainer) #addSignatureActionContainer) #addSignatureControls) #addSignatureSaveContainer) #addSignatureSaveWarning{ + display:block; + opacity:1; + color:var(--save-warning-color); + font-size:11px; + } + +#editSignatureDescriptionDialog .mainContainer{ + padding-inline:16px; + box-sizing:border-box; + } + +:is(#editSignatureDescriptionDialog .mainContainer) .title{ + margin-inline-start:0; + } + +:is(#editSignatureDescriptionDialog .mainContainer) #editSignatureDescriptionAndView{ + width:auto; + display:flex; + justify-content:flex-end; + align-items:flex-start; + gap:12px; + align-self:stretch; + } + +:is(:is(#editSignatureDescriptionDialog .mainContainer) #editSignatureDescriptionAndView) #editSignatureDescriptionContainer{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:4px; + flex:1 1 auto; + } + +:is(:is(#editSignatureDescriptionDialog .mainContainer) #editSignatureDescriptionAndView) > svg{ + width:210px; + height:180px; + padding:8px; + background-color:var(--signature-bg); + } + +:is(:is(:is(#editSignatureDescriptionDialog .mainContainer) #editSignatureDescriptionAndView) > svg) > path{ + stroke:var(--button-signature-color); + stroke-width:1px; + stroke-linecap:round; + stroke-linejoin:round; + stroke-miterlimit:10; + vector-effect:non-scaling-stroke; + fill:none; + } + +.contours:is(:is(:is(:is(#editSignatureDescriptionDialog .mainContainer) #editSignatureDescriptionAndView) > svg) > path){ + fill:var(--button-signature-color); + stroke-width:0.5px; + } + +#editorSignatureParamsToolbar{ + padding:8px; +} + +#editorSignatureParamsToolbar #addSignatureDoorHanger{ + gap:8px; + padding:2px; + } + +:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer{ + height:32px; + display:flex; + justify-content:space-between; + align-items:center; + align-self:stretch; + gap:8px; + } + +:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) button{ + border:var(--button-signature-border); + border-radius:4px; + background-color:var(--button-signature-bg); + color:var(--button-signature-color); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) button):hover{ + background-color:var(--button-signature-hover-bg); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) button):active{ + border:var(--button-signature-active-border); + background-color:var(--button-signature-active-bg); + color:var(--button-signature-active-color); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) button):active::before{ + background-color:var(--button-signature-active-color); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) button):focus-visible{ + outline:var(--focus-ring-outline); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) button):focus-visible::before{ + background-color:var(--button-signature-color); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .deleteButton)::before{ + -webkit-mask-image:var(--clear-signature-button-icon); + mask-image:var(--clear-signature-button-icon); + } + +:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton{ + width:calc(0.8 * var(--editor-toolbar-min-width)); + height:100%; + min-height:var(--menuitem-height); + aspect-ratio:unset; + display:flex; + align-items:center; + justify-content:flex-start; + outline:none; + border-radius:4px; + box-sizing:border-box; + font:message-box; + position:relative; + flex:1 1 auto; + padding:0; + gap:8px; + text-align:start; + white-space:normal; + cursor:default; + overflow:hidden; + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton) > svg{ + display:inline-block; + height:100%; + aspect-ratio:1; + background-color:var(--signature-bg); + flex:none; + padding:4px; + box-sizing:border-box; + border:none; + border-radius:4px; + } + +:is(:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton) > svg) > path{ + stroke:var(--button-signature-color); + stroke-width:1px; + stroke-linecap:round; + stroke-linejoin:round; + stroke-miterlimit:10; + vector-effect:non-scaling-stroke; + fill:none; + } + +.contours:is(:is(:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton) > svg) > path){ + fill:var(--button-signature-color); + stroke-width:0.5px; + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton):is(:hover,:active) > svg{ + border-radius:4px 0 0 4px; + background-color:var(--signature-hover-bg); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton):hover > span{ + color:var(--button-signature-hover-color); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton):active{ + background-color:var(--button-signature-active-bg); + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton):is([disabled="disabled"],[disabled]){ + opacity:0.5; + pointer-events:none; + } + +:is(:is(:is(#editorSignatureParamsToolbar #addSignatureDoorHanger) .toolbarAddSignatureButtonContainer) .toolbarAddSignatureButton) > span{ + height:auto; + text-overflow:ellipsis; + white-space:nowrap; + flex:1 1 auto; + font:menu; + font-size:13px; + font-style:normal; + font-weight:400; + line-height:normal; + overflow:hidden; + } + +.editDescription.altText{ + --alt-text-add-image:url(images/editor-toolbar-edit.svg) !important; +} + +.editDescription.altText::before{ + width:16px !important; + height:16px !important; + } + +#commentManagerDialog{ + --comment-actions-button-icon:url(images/comment-actionsButton.svg); + --comment-close-button-icon:url(images/comment-closeButton.svg); + + --default-dialog-bg-color:#ffff98; + --dialog-base-color:var(--default-dialog-bg-color); + --dialog-bg-color:color-mix(in srgb, var(--dialog-base-color), white 30%); + --dialog-border-color:var(--dialog-base-color); + + --menuitem-bg-color:transparent; + --menuitem-fg-color:black; + --menuitem-hover-bg-color:#3383e7; + --menuitem-hover-fg-color:white; + + --comment-text-input-bg:white; + --comment-text-input-fg:black; + --comment-text-input-border:#0060df; + --comment-focus-outline-color:#0060df; + + --hover-filter:brightness(0.9); + --text-primary-color:#15141a; + + --button-secondary-bg-color:#f0f0f4; + --button-secondary-active-bg-color:color-mix( + in srgb, + var(--button-secondary-bg-color), + black 14% + ); + --button-secondary-hover-bg-color:color-mix( + in srgb, + var(--button-secondary-bg-color), + black 7% + ); + + --button-primary-bg-color:#0060df; + --button-primary-fg-color:#fbfbfe; + --button-primary-active-bg-color:#0050c0; + --button-primary-hover-bg-color:#0250bb; + + --menu-bg-color:rgb(253 250 244); + --menu-button-border-color:transparent; + --menu-button-focus-outline-color:var(--comment-text-input-border); +} + +@media screen and (forced-colors: active){ + +#commentManagerDialog{ + --hover-filter:none; + --text-primary-color:CanvasText; + --button-secondary-bg-color:HighlightText; + --button-secondary-active-bg-color:HighlightText; + --button-secondary-hover-bg-color:HighlightText; + --button-primary-bg-color:ButtonText; + --button-primary-fg-color:HighlightText; + --button-primary-active-bg-color:SelectedItem; + --button-primary-hover-bg-color:SelectedItem; + + --menu-button-border-color:Canvas; + --menu-button-focus-outline-color:CanvasText; +} + } + +#commentManagerDialog{ + + width:308px; + padding:8px 16px 16px; + overflow:visible; + position:absolute; + margin:0; + + border-radius:4px; + border:1px solid var(--dialog-border-color); + background:var(--dialog-bg-color); + box-shadow:0 2px 14px 0 rgb(58 57 68 / 0.2); +} + +#commentManagerDialog .mainContainer{ + width:100%; + height:auto; + display:flex; + flex-direction:column; + align-items:flex-start; + gap:4px; + } + +:is(#commentManagerDialog .mainContainer) *:focus-visible{ + outline:2px solid var(--comment-focus-outline-color); + outline-offset:0; + } + +:is(#commentManagerDialog .mainContainer) #commentManagerToolbar{ + width:100%; + display:flex; + justify-content:flex-end; + align-items:flex-start; + gap:8px; + align-self:stretch; + + cursor:move; + } + +:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) > button{ + --csstools-color-scheme--light:initial; + color-scheme:light; + width:24px; + height:24px; + padding:0; + border:none; + + cursor:pointer; + } + +:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) > button)::before{ + content:""; + display:inline-block; + width:100%; + height:100%; + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + } + +#commentActionsButton:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) > button)::before{ + -webkit-mask-image:var(--comment-actions-button-icon); + mask-image:var(--comment-actions-button-icon); + } + +#commentCloseButton:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) > button)::before{ + -webkit-mask-image:var(--comment-close-button-icon); + mask-image:var(--comment-close-button-icon); + } + +:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) > button) > span{ + display:inline-block; + width:0; + height:0; + overflow:hidden; + } + +:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) menu{ + width:-moz-max-content; + width:max-content; + min-width:90px; + display:flex; + flex-direction:column; + align-items:center; + gap:1px; + padding:5px 6px; + cursor:auto; + z-index:1; + margin:0; + + position:absolute; + top:8px; + right:-6.5px; + + border-radius:6px; + border:0.5px solid #b4b4b6; + background-color:var(--menu-bg-color); + box-shadow:1px -1px 0 0 #fff inset, -1px 1px 0 0 #fff inset, -1px -1px 0 0 #fff inset, 1px 1px 0 0 #fff inset, 0 0 15px 0 rgb(0 0 0 / 0.25); + } + +:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) menu) button{ + background-color:var(--menu-bg-color); + width:100%; + height:24px; + padding:0; + box-sizing:border-box; + display:flex; + border:2px solid var(--menu-button-border-color); + color:var(--menuitem-fg-color); + } + +:is(:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) menu) button):hover{ + background-color:var(--menuitem-hover-bg-color); + color:var(--menuitem-hover-fg-color); + } + +:is(:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) menu) button):is(:focus-visible,:focus){ + outline:none; + border:2px solid var(--menu-button-focus-outline-color); + } + +:is(:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) menu) button):disabled{ + opacity:0.5; + pointer-events:none; + } + +:is(:is(:is(:is(#commentManagerDialog .mainContainer) #commentManagerToolbar) menu) button) span{ + align-content:center; + width:100%; + max-width:-moz-min-content; + max-width:min-content; + padding-inline:8px; + color:inherit; + text-align:start; + font:menu; + font-size:15px; + font-weight:400; + line-height:normal; + } + +:is(#commentManagerDialog .mainContainer) #commentManagerTextInput{ + width:100%; + min-height:132px; + resize:none; + box-sizing:border-box; + margin-bottom:12px; + + border-radius:4px; + border:2px solid var(--comment-text-input-border); + background-color:var(--comment-text-input-bg); + color:var(--comment-text-input-fg); + } + +:is(#commentManagerDialog .mainContainer) #commentManagerTextView{ + width:100%; + height:-moz-max-content; + height:max-content; + resize:none; + box-sizing:border-box; + margin-bottom:12px; + + border:none; + background-color:transparent; + color:var(--comment-text-input-fg); + } + +:is(#commentManagerDialog .mainContainer) .dialogButtonsGroup{ + gap:8px; + } + +:is(:is(#commentManagerDialog .mainContainer) .dialogButtonsGroup) #commentManagerSaveButton:disabled{ + background-color:color-mix( + in srgb, + var(--button-primary-disabled-bg-color), + transparent 50% + ); + border-color:color-mix( + in srgb, + var(--button-primary-disabled-border-color), + transparent 50% + ); + opacity:1; + } + +.annotationLayer{ + --comment-inline-button-bg:#e0e0e6; + --comment-inline-button-fg:black; + --comment-inline-button-border-color:#8f8f9d; + --comment-button-dim:24px; + --comment-button-offset:calc(var(--comment-button-dim) / 2); +} + +.annotationLayer .annotationCommentButton{ + position:absolute; + width:var(--comment-button-dim); + height:var(--comment-button-dim); + background-color:var(--comment-inline-button-bg); + cursor:auto; + z-index:1; + border:1px solid var(--comment-inline-button-border-color); + border-radius:4px; + padding:2px; + margin:0; + box-sizing:border-box; + pointer-events:auto; + } + +:is(.annotationLayer .annotationCommentButton)::before{ + content:""; + display:inline-block; + width:100%; + height:100%; + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-size:cover; + mask-size:cover; + -webkit-mask-image:var(--comment-edit-image); + mask-image:var(--comment-edit-image); + background-color:var(--comment-inline-button-fg); + margin:0; + padding:0; + } + +:root{ + --editor-toolbar-vert-offset:6px; + --outline-width:2px; + --outline-color:#0060df; + --outline-around-width:1px; + --outline-around-color:#f0f0f4; + --hover-outline-around-color:var(--outline-around-color); + --focus-outline:solid var(--outline-width) var(--outline-color); + --unfocus-outline:solid var(--outline-width) transparent; + --focus-outline-around:solid var(--outline-around-width) var(--outline-around-color); + --hover-outline-color:#8f8f9d; + --hover-outline:solid var(--outline-width) var(--hover-outline-color); + --hover-outline-around:solid var(--outline-around-width) var(--hover-outline-around-color); + --freetext-line-height:1.35; + --freetext-padding:2px; + --resizer-bg-color:var(--outline-color); + --resizer-size:6px; + --resizer-shift:calc( + 0px - (var(--outline-width) + var(--resizer-size)) / 2 - + var(--outline-around-width) + ); + --editorFreeText-editing-cursor:text; + --editorInk-editing-cursor:url(images/cursor-editorInk.svg) 0 16, pointer; + --editorHighlight-editing-cursor:url(images/cursor-editorTextHighlight.svg) 24 24, text; + --editorFreeHighlight-editing-cursor:url(images/cursor-editorFreeHighlight.svg) 1 18, pointer; + + --new-alt-text-warning-image:url(images/altText_warning.svg); +} + +.textLayer.highlighting{ + cursor:var(--editorFreeHighlight-editing-cursor); + } + +.textLayer.highlighting:not(.free) span{ + cursor:var(--editorHighlight-editing-cursor); + } + +[role="img"]:is(.textLayer.highlighting:not(.free) span){ + cursor:var(--editorFreeHighlight-editing-cursor); + } + +.textLayer.highlighting.free span{ + cursor:var(--editorFreeHighlight-editing-cursor); + } + +:is(#viewerContainer.pdfPresentationMode:fullscreen,.annotationEditorLayer.disabled) .noAltTextBadge{ + display:none !important; + } + +@media (min-resolution: 1.1dppx){ + :root{ + --editorFreeText-editing-cursor:url(images/cursor-editorFreeText.svg) 0 16, text; + } +} + +@media screen and (forced-colors: active){ + :root{ + --outline-color:CanvasText; + --outline-around-color:ButtonFace; + --resizer-bg-color:ButtonText; + --hover-outline-color:Highlight; + --hover-outline-around-color:SelectedItemText; + } +} + +[data-editor-rotation="90"]{ + transform:rotate(90deg); +} + +[data-editor-rotation="180"]{ + transform:rotate(180deg); +} + +[data-editor-rotation="270"]{ + transform:rotate(270deg); +} + +.annotationEditorLayer{ + background:transparent; + position:absolute; + inset:0; + font-size:calc(100px * var(--total-scale-factor)); + transform-origin:0 0; + cursor:auto; +} + +.annotationEditorLayer .selectedEditor{ + z-index:100000 !important; + } + +.annotationEditorLayer.drawing *{ + pointer-events:none !important; + } + +.annotationEditorLayer.getElements{ + pointer-events:auto !important; + } + +.annotationEditorLayer.getElements > div{ + pointer-events:auto !important; + } + +.annotationEditorLayer.waiting{ + content:""; + cursor:wait; + position:absolute; + inset:0; + width:100%; + height:100%; +} + +.annotationEditorLayer.disabled{ + pointer-events:none; +} + +.annotationEditorLayer.disabled.highlightEditing :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor){ + pointer-events:auto; + } + +.annotationEditorLayer.freetextEditing{ + cursor:var(--editorFreeText-editing-cursor); +} + +.annotationEditorLayer.inkEditing{ + cursor:var(--editorInk-editing-cursor); +} + +.annotationEditorLayer .draw{ + box-sizing:border-box; +} + +.annotationEditorLayer + :is(.freeTextEditor, .inkEditor, .stampEditor, .signatureEditor){ + position:absolute; + background:transparent; + z-index:1; + transform-origin:0 0; + cursor:auto; + max-width:100%; + max-height:100%; + border:var(--unfocus-outline); +} + +.draggable.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)){ + cursor:move; + } + +.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)){ + border:var(--focus-outline); + outline:var(--focus-outline-around); + } + +.selectedEditor:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor))::before{ + content:""; + position:absolute; + inset:0; + border:var(--focus-outline-around); + pointer-events:none; + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)):hover:not(.selectedEditor){ + border:var(--hover-outline); + outline:var(--hover-outline-around); + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)):hover:not(.selectedEditor)::before{ + content:""; + position:absolute; + inset:0; + border:var(--focus-outline-around); + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar{ + --editor-toolbar-delete-image:url(images/editor-toolbar-delete.svg); + --csstools-light-dark-toggle--44:var(--csstools-color-scheme--light) #2b2a33; + --editor-toolbar-bg-color:var(--csstools-light-dark-toggle--44, #f0f0f4); + --editor-toolbar-highlight-image:url(images/toolbarButton-editorHighlight.svg); + --editor-toolbar-comment-edit-image:url(images/comment-editButton.svg); + --csstools-light-dark-toggle--45:var(--csstools-color-scheme--light) #fbfbfe; + --editor-toolbar-fg-color:var(--csstools-light-dark-toggle--45, #2e2e56); + --editor-toolbar-border-color:#8f8f9d; + --editor-toolbar-hover-border-color:var(--editor-toolbar-border-color); + --csstools-light-dark-toggle--46:var(--csstools-color-scheme--light) #52525e; + --editor-toolbar-hover-bg-color:var(--csstools-light-dark-toggle--46, #e0e0e6); + --editor-toolbar-hover-fg-color:var(--editor-toolbar-fg-color); + --editor-toolbar-hover-outline:none; + --csstools-light-dark-toggle--47:var(--csstools-color-scheme--light) #0df; + --editor-toolbar-focus-outline-color:var(--csstools-light-dark-toggle--47, #0060df); + --editor-toolbar-shadow:0 2px 6px 0 rgb(58 57 68 / 0.2); + --editor-toolbar-height:28px; + --editor-toolbar-padding:2px; + --csstools-light-dark-toggle--48:var(--csstools-color-scheme--light) #54ffbd; + --alt-text-done-color:var(--csstools-light-dark-toggle--48, #2ac3a2); + --csstools-light-dark-toggle--49:var(--csstools-color-scheme--light) #80ebff; + --alt-text-warning-color:var(--csstools-light-dark-toggle--49, #0090ed); + --alt-text-hover-done-color:var(--alt-text-done-color); + --alt-text-hover-warning-color:var(--alt-text-warning-color); + } + +@supports (color: light-dark(red, red)){ +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar{ + --editor-toolbar-bg-color:light-dark(#f0f0f4, #2b2a33); + --editor-toolbar-fg-color:light-dark(#2e2e56, #fbfbfe); + --editor-toolbar-hover-bg-color:light-dark(#e0e0e6, #52525e); + --editor-toolbar-focus-outline-color:light-dark(#0060df, #0df); + --alt-text-done-color:light-dark(#2ac3a2, #54ffbd); + --alt-text-warning-color:light-dark(#0090ed, #80ebff); + } +} + +@supports not (color: light-dark(tan, tan)){ + +:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) *{ + --csstools-light-dark-toggle--44:var(--csstools-color-scheme--light) #2b2a33; + --editor-toolbar-bg-color:var(--csstools-light-dark-toggle--44, #f0f0f4); + --csstools-light-dark-toggle--45:var(--csstools-color-scheme--light) #fbfbfe; + --editor-toolbar-fg-color:var(--csstools-light-dark-toggle--45, #2e2e56); + --csstools-light-dark-toggle--46:var(--csstools-color-scheme--light) #52525e; + --editor-toolbar-hover-bg-color:var(--csstools-light-dark-toggle--46, #e0e0e6); + --csstools-light-dark-toggle--47:var(--csstools-color-scheme--light) #0df; + --editor-toolbar-focus-outline-color:var(--csstools-light-dark-toggle--47, #0060df); + --csstools-light-dark-toggle--48:var(--csstools-color-scheme--light) #54ffbd; + --alt-text-done-color:var(--csstools-light-dark-toggle--48, #2ac3a2); + --csstools-light-dark-toggle--49:var(--csstools-color-scheme--light) #80ebff; + --alt-text-warning-color:var(--csstools-light-dark-toggle--49, #0090ed); + } +} + +@media screen and (forced-colors: active){ + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar{ + --editor-toolbar-bg-color:ButtonFace; + --editor-toolbar-fg-color:ButtonText; + --editor-toolbar-border-color:ButtonText; + --editor-toolbar-hover-border-color:AccentColor; + --editor-toolbar-hover-bg-color:ButtonFace; + --editor-toolbar-hover-fg-color:AccentColor; + --editor-toolbar-hover-outline:2px solid var(--editor-toolbar-hover-border-color); + --editor-toolbar-focus-outline-color:ButtonBorder; + --editor-toolbar-shadow:none; + --alt-text-done-color:var(--editor-toolbar-fg-color); + --alt-text-warning-color:var(--editor-toolbar-fg-color); + --alt-text-hover-done-color:var(--editor-toolbar-hover-fg-color); + --alt-text-hover-warning-color:var(--editor-toolbar-hover-fg-color); + } + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar{ + + display:flex; + width:-moz-fit-content; + width:fit-content; + height:var(--editor-toolbar-height); + flex-direction:column; + justify-content:center; + align-items:center; + cursor:default; + pointer-events:auto; + box-sizing:content-box; + padding:var(--editor-toolbar-padding); + + position:absolute; + inset-inline-end:0; + inset-block-start:calc(100% + var(--editor-toolbar-vert-offset)); + + border-radius:6px; + background-color:var(--editor-toolbar-bg-color); + border:1px solid var(--editor-toolbar-border-color); + box-shadow:var(--editor-toolbar-shadow); + } + +.hidden:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar){ + display:none; + } + +:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar):has(:focus-visible){ + border-color:transparent; + } + +[dir="ltr"] :is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar){ + transform-origin:100% 0; + } + +[dir="rtl"] :is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar){ + transform-origin:0 0; + } + +:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons{ + display:flex; + justify-content:center; + align-items:center; + gap:0; + height:100%; + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) button{ + padding:0; + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .divider{ + width:0; + height:calc( + 2 * var(--editor-toolbar-padding) + var(--editor-toolbar-height) + ); + border-left:1px solid var(--editor-toolbar-border-color); + border-right:none; + display:inline-block; + margin-inline:2px; + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .highlightButton{ + width:var(--editor-toolbar-height); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .highlightButton)::before{ + content:""; + -webkit-mask-image:var(--editor-toolbar-highlight-image); + mask-image:var(--editor-toolbar-highlight-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + background-color:var(--editor-toolbar-fg-color); + width:100%; + height:100%; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .highlightButton):hover::before{ + background-color:var(--editor-toolbar-hover-fg-color); + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .delete{ + width:var(--editor-toolbar-height); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .delete)::before{ + content:""; + -webkit-mask-image:var(--editor-toolbar-delete-image); + mask-image:var(--editor-toolbar-delete-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + background-color:var(--editor-toolbar-fg-color); + width:100%; + height:100%; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .delete):hover::before{ + background-color:var(--editor-toolbar-hover-fg-color); + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) > *{ + height:var(--editor-toolbar-height); + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) > :not(.divider){ + border:none; + background-color:transparent; + cursor:pointer; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) > :not(.divider)):hover{ + border-radius:2px; + background-color:var(--editor-toolbar-hover-bg-color); + color:var(--editor-toolbar-hover-fg-color); + outline:var(--editor-toolbar-hover-outline); + outline-offset:1px; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) > :not(.divider)):hover:active{ + outline:none; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) > :not(.divider)):focus-visible{ + border-radius:2px; + outline:2px solid var(--editor-toolbar-focus-outline-color); + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText{ + --alt-text-add-image:url(images/altText_add.svg); + --alt-text-done-image:url(images/altText_done.svg); + + display:flex; + align-items:center; + justify-content:center; + width:-moz-max-content; + width:max-content; + padding-inline:8px; + pointer-events:all; + font:menu; + font-weight:590; + font-size:12px; + color:var(--editor-toolbar-fg-color); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText):disabled{ + pointer-events:none; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText)::before{ + content:""; + -webkit-mask-image:var(--alt-text-add-image); + mask-image:var(--alt-text-add-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + width:12px; + height:13px; + background-color:var(--editor-toolbar-fg-color); + margin-inline-end:4px; + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText):hover::before{ + background-color:var(--editor-toolbar-hover-fg-color); + } + +.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText)::before{ + -webkit-mask-image:var(--alt-text-done-image); + mask-image:var(--alt-text-done-image); + } + +.new:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText)::before{ + width:16px; + height:16px; + -webkit-mask-image:var(--new-alt-text-warning-image); + mask-image:var(--new-alt-text-warning-image); + background-color:var(--alt-text-warning-color); + -webkit-mask-size:cover; + mask-size:cover; + } + +.new:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText):hover::before{ + background-color:var(--alt-text-hover-warning-color); + } + +.new.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText)::before{ + -webkit-mask-image:var(--alt-text-done-image); + mask-image:var(--alt-text-done-image); + background-color:var(--alt-text-done-color); + } + +.new.done:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText):hover::before{ + background-color:var(--alt-text-hover-done-color); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip{ + display:none; + word-wrap:anywhere; + } + +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + --csstools-light-dark-toggle--50:var(--csstools-color-scheme--light) #1c1b22; + --alt-text-tooltip-bg:var(--csstools-light-dark-toggle--50, #f0f0f4); + --csstools-light-dark-toggle--51:var(--csstools-color-scheme--light) #fbfbfe; + --alt-text-tooltip-fg:var(--csstools-light-dark-toggle--51, #15141a); + --alt-text-tooltip-border:#8f8f9d; + --csstools-light-dark-toggle--52:var(--csstools-color-scheme--light) #15141a; + --alt-text-tooltip-shadow:0px 2px 6px 0px var(--csstools-light-dark-toggle--52, rgb(58 57 68 / 0.2)); + } + +@supports (color: light-dark(red, red)){ +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + --alt-text-tooltip-bg:light-dark(#f0f0f4, #1c1b22); + --alt-text-tooltip-fg:light-dark(#15141a, #fbfbfe); + } +} + +@supports (color: light-dark(red, red)) and (color: rgb(0 0 0 / 0)){ +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + --alt-text-tooltip-shadow:0px 2px 6px 0px light-dark(rgb(58 57 68 / 0.2), #15141a); + } +} + +@supports not (color: light-dark(tan, tan)){ + +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip) *{ + --csstools-light-dark-toggle--50:var(--csstools-color-scheme--light) #1c1b22; + --alt-text-tooltip-bg:var(--csstools-light-dark-toggle--50, #f0f0f4); + --csstools-light-dark-toggle--51:var(--csstools-color-scheme--light) #fbfbfe; + --alt-text-tooltip-fg:var(--csstools-light-dark-toggle--51, #15141a); + --csstools-light-dark-toggle--52:var(--csstools-color-scheme--light) #15141a; + --alt-text-tooltip-shadow:0px 2px 6px 0px var(--csstools-light-dark-toggle--52, rgb(58 57 68 / 0.2)); + } +} + +@media screen and (forced-colors: active){ + +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + --alt-text-tooltip-bg:Canvas; + --alt-text-tooltip-fg:CanvasText; + --alt-text-tooltip-border:CanvasText; + --alt-text-tooltip-shadow:none; + } + } + +.show:is(:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .altText) .tooltip){ + + display:inline-flex; + flex-direction:column; + align-items:center; + justify-content:center; + position:absolute; + top:calc(100% + 2px); + inset-inline-start:0; + padding-block:2px 3px; + padding-inline:3px; + max-width:300px; + width:-moz-max-content; + width:max-content; + height:auto; + font-size:12px; + + border:0.5px solid var(--alt-text-tooltip-border); + background:var(--alt-text-tooltip-bg); + box-shadow:var(--alt-text-tooltip-shadow); + color:var(--alt-text-tooltip-fg); + + pointer-events:none; + } + +:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .comment{ + width:var(--editor-toolbar-height); + } + +:is(:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.highlightEditor,.signatureEditor),.textLayer) .editToolbar) .buttons) .comment)::before{ + content:""; + -webkit-mask-image:var(--editor-toolbar-comment-edit-image); + mask-image:var(--editor-toolbar-comment-edit-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + background-color:var(--editor-toolbar-fg-color); + width:100%; + height:100%; + } + +.annotationEditorLayer .freeTextEditor{ + padding:calc(var(--freetext-padding) * var(--total-scale-factor)); + width:auto; + height:auto; + touch-action:none; +} + +.annotationEditorLayer .freeTextEditor .internal{ + background:transparent; + border:none; + inset:0; + overflow:visible; + white-space:nowrap; + font:10px sans-serif; + line-height:var(--freetext-line-height); + text-align:start; + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; +} + +.annotationEditorLayer .freeTextEditor .overlay{ + position:absolute; + display:none; + background:transparent; + inset:0; + width:100%; + height:100%; +} + +.annotationEditorLayer freeTextEditor .overlay.enabled{ + display:block; +} + +.annotationEditorLayer .freeTextEditor .internal:empty::before{ + content:attr(default-content); + color:gray; +} + +.annotationEditorLayer .freeTextEditor .internal:focus{ + outline:none; + -webkit-user-select:auto; + -moz-user-select:auto; + user-select:auto; +} + +.annotationEditorLayer .inkEditor{ + width:100%; + height:100%; +} + +.annotationEditorLayer .inkEditor.editing{ + cursor:inherit; +} + +.annotationEditorLayer .inkEditor .inkEditorCanvas{ + position:absolute; + inset:0; + width:100%; + height:100%; + touch-action:none; +} + +.annotationEditorLayer .stampEditor{ + width:auto; + height:auto; +} + +:is(.annotationEditorLayer .stampEditor) canvas{ + position:absolute; + width:100%; + height:100%; + margin:0; + top:0; + left:0; + } + +:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + --csstools-light-dark-toggle--53:var(--csstools-color-scheme--light) #52525e; + --no-alt-text-badge-border-color:var(--csstools-light-dark-toggle--53, #f0f0f4); + --csstools-light-dark-toggle--54:var(--csstools-color-scheme--light) #fbfbfe; + --no-alt-text-badge-bg-color:var(--csstools-light-dark-toggle--54, #cfcfd8); + --csstools-light-dark-toggle--55:var(--csstools-color-scheme--light) #15141a; + --no-alt-text-badge-fg-color:var(--csstools-light-dark-toggle--55, #5b5b66); + } + +@supports (color: light-dark(red, red)){ +:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + --no-alt-text-badge-border-color:light-dark(#f0f0f4, #52525e); + --no-alt-text-badge-bg-color:light-dark(#cfcfd8, #fbfbfe); + --no-alt-text-badge-fg-color:light-dark(#5b5b66, #15141a); + } +} + +@supports not (color: light-dark(tan, tan)){ + +:is(:is(.annotationEditorLayer .stampEditor) .noAltTextBadge) *{ + --csstools-light-dark-toggle--53:var(--csstools-color-scheme--light) #52525e; + --no-alt-text-badge-border-color:var(--csstools-light-dark-toggle--53, #f0f0f4); + --csstools-light-dark-toggle--54:var(--csstools-color-scheme--light) #fbfbfe; + --no-alt-text-badge-bg-color:var(--csstools-light-dark-toggle--54, #cfcfd8); + --csstools-light-dark-toggle--55:var(--csstools-color-scheme--light) #15141a; + --no-alt-text-badge-fg-color:var(--csstools-light-dark-toggle--55, #5b5b66); + } +} + +@media screen and (forced-colors: active){ + +:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + --no-alt-text-badge-border-color:ButtonText; + --no-alt-text-badge-bg-color:ButtonFace; + --no-alt-text-badge-fg-color:ButtonText; + } + } + +:is(.annotationEditorLayer .stampEditor) .noAltTextBadge{ + + position:absolute; + inset-inline-end:5px; + inset-block-end:5px; + display:inline-flex; + width:32px; + height:32px; + padding:3px; + justify-content:center; + align-items:center; + pointer-events:none; + z-index:1; + + border-radius:2px; + border:1px solid var(--no-alt-text-badge-border-color); + background:var(--no-alt-text-badge-bg-color); + } + +:is(:is(.annotationEditorLayer .stampEditor) .noAltTextBadge)::before{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--new-alt-text-warning-image); + mask-image:var(--new-alt-text-warning-image); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--no-alt-text-badge-fg-color); + } + +:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers{ + position:absolute; + inset:0; + } + +.hidden:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers){ + display:none; + } + +:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer{ + width:var(--resizer-size); + height:var(--resizer-size); + background:content-box var(--resizer-bg-color); + border:var(--focus-outline-around); + border-radius:2px; + position:absolute; + } + +.topLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer){ + top:var(--resizer-shift); + left:var(--resizer-shift); + } + +.topMiddle:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer){ + top:var(--resizer-shift); + left:calc(50% + var(--resizer-shift)); + } + +.topRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer){ + top:var(--resizer-shift); + right:var(--resizer-shift); + } + +.middleRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer){ + top:calc(50% + var(--resizer-shift)); + right:var(--resizer-shift); + } + +.bottomRight:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer){ + bottom:var(--resizer-shift); + right:var(--resizer-shift); + } + +.bottomMiddle:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer){ + bottom:var(--resizer-shift); + left:calc(50% + var(--resizer-shift)); + } + +.bottomLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer){ + bottom:var(--resizer-shift); + left:var(--resizer-shift); + } + +.middleLeft:is(:is(:is(.annotationEditorLayer :is(.freeTextEditor,.inkEditor,.stampEditor,.signatureEditor)) > .resizers) > .resizer){ + top:calc(50% + var(--resizer-shift)); + left:var(--resizer-shift); + } + +.topLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer),.bottomRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer){ + cursor:nwse-resize; + } + +.topMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer),.bottomMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer){ + cursor:ns-resize; + } + +.topRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer),.bottomLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer){ + cursor:nesw-resize; + } + +.middleRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer),.middleLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="180"],[data-editor-rotation="0"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="90"],[data-editor-rotation="270"])) > .resizers > .resizer){ + cursor:ew-resize; + } + +.topLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer),.bottomRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer){ + cursor:nesw-resize; + } + +.topMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer),.bottomMiddle:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer){ + cursor:ew-resize; + } + +.topRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer),.bottomLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer){ + cursor:nwse-resize; + } + +.middleRight:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer),.middleLeft:is(:is(.annotationEditorLayer[data-main-rotation="0"] :is([data-editor-rotation="90"],[data-editor-rotation="270"]),.annotationEditorLayer[data-main-rotation="90"] :is([data-editor-rotation="0"],[data-editor-rotation="180"]),.annotationEditorLayer[data-main-rotation="180"] :is([data-editor-rotation="270"],[data-editor-rotation="90"]),.annotationEditorLayer[data-main-rotation="270"] :is([data-editor-rotation="180"],[data-editor-rotation="0"])) > .resizers > .resizer){ + cursor:ns-resize; + } + +:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar{ + rotate:270deg; + } + +[dir="ltr"] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar){ + inset-inline-end:calc(0px - var(--editor-toolbar-vert-offset)); + inset-block-start:0; + } + +[dir="rtl"] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="90"],[data-main-rotation="90"] [data-editor-rotation="0"],[data-main-rotation="180"] [data-editor-rotation="270"],[data-main-rotation="270"] [data-editor-rotation="180"])) .editToolbar){ + inset-inline-end:calc(100% + var(--editor-toolbar-vert-offset)); + inset-block-start:0; + } + +:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="180"],[data-main-rotation="90"] [data-editor-rotation="90"],[data-main-rotation="180"] [data-editor-rotation="0"],[data-main-rotation="270"] [data-editor-rotation="270"])) .editToolbar{ + rotate:180deg; + inset-inline-end:100%; + inset-block-start:calc(0pc - var(--editor-toolbar-vert-offset)); + } + +:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar{ + rotate:90deg; + } + +[dir="ltr"] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar){ + inset-inline-end:calc(100% + var(--editor-toolbar-vert-offset)); + inset-block-start:100%; + } + +[dir="rtl"] :is(:is(.annotationEditorLayer :is([data-main-rotation="0"] [data-editor-rotation="270"],[data-main-rotation="90"] [data-editor-rotation="180"],[data-main-rotation="180"] [data-editor-rotation="90"],[data-main-rotation="270"] [data-editor-rotation="0"])) .editToolbar){ + inset-inline-start:calc(0px - var(--editor-toolbar-vert-offset)); + inset-block-start:0; + } + +.dialog.altText::backdrop{ + -webkit-mask:url(#alttext-manager-mask); + mask:url(#alttext-manager-mask); + } + +.dialog.altText.positioned{ + margin:0; + } + +.dialog.altText #altTextContainer{ + width:300px; + height:-moz-fit-content; + height:fit-content; + display:inline-flex; + flex-direction:column; + align-items:flex-start; + gap:16px; + } + +:is(.dialog.altText #altTextContainer) #overallDescription{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:4px; + align-self:stretch; + } + +:is(:is(.dialog.altText #altTextContainer) #overallDescription) span{ + align-self:stretch; + } + +:is(:is(.dialog.altText #altTextContainer) #overallDescription) .title{ + font-size:13px; + font-style:normal; + font-weight:590; + } + +:is(.dialog.altText #altTextContainer) #addDescription{ + display:flex; + flex-direction:column; + align-items:stretch; + gap:8px; + } + +:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea{ + flex:1; + padding-inline:24px 10px; + } + +:is(:is(:is(.dialog.altText #altTextContainer) #addDescription) .descriptionArea) textarea{ + width:100%; + min-height:75px; + } + +:is(.dialog.altText #altTextContainer) #buttons{ + display:flex; + justify-content:flex-end; + align-items:flex-start; + gap:8px; + align-self:stretch; + } + +.dialog.newAltText{ + --new-alt-text-ai-disclaimer-icon:url(images/altText_disclaimer.svg); + --new-alt-text-spinner-icon:url(images/altText_spinner.svg); + --csstools-light-dark-toggle--56:var(--csstools-color-scheme--light) #2b2a33; + --preview-image-bg-color:var(--csstools-light-dark-toggle--56, #f0f0f4); + --preview-image-border:none; +} + +@supports (color: light-dark(red, red)){ +.dialog.newAltText{ + --preview-image-bg-color:light-dark(#f0f0f4, #2b2a33); +} +} + +@supports not (color: light-dark(tan, tan)){ + +.dialog.newAltText *{ + --csstools-light-dark-toggle--56:var(--csstools-color-scheme--light) #2b2a33; + --preview-image-bg-color:var(--csstools-light-dark-toggle--56, #f0f0f4); + } +} + +@media screen and (forced-colors: active){ + +.dialog.newAltText{ + --preview-image-bg-color:ButtonFace; + --preview-image-border:1px solid ButtonText; +} + } + +.dialog.newAltText{ + + width:80%; + max-width:570px; + min-width:300px; + padding:0; +} + +.dialog.newAltText.noAi #newAltTextDisclaimer,.dialog.newAltText.noAi #newAltTextCreateAutomatically{ + display:none !important; + } + +.dialog.newAltText.aiInstalling #newAltTextCreateAutomatically{ + display:none !important; + } + +.dialog.newAltText.aiInstalling #newAltTextDownloadModel{ + display:flex !important; + } + +.dialog.newAltText.error #newAltTextNotNow{ + display:none !important; + } + +.dialog.newAltText.error #newAltTextCancel{ + display:inline-block !important; + } + +.dialog.newAltText:not(.error) #newAltTextError{ + display:none !important; + } + +.dialog.newAltText #newAltTextContainer{ + display:flex; + width:auto; + padding:16px; + flex-direction:column; + justify-content:flex-end; + align-items:flex-start; + gap:12px; + flex:0 1 auto; + line-height:normal; + } + +:is(.dialog.newAltText #newAltTextContainer) #mainContent{ + display:flex; + justify-content:flex-end; + align-items:flex-start; + gap:12px; + align-self:stretch; + flex:1 1 auto; + } + +:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionAndSettings{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:16px; + flex:1 0 0; + align-self:stretch; + } + +:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:8px; + align-self:stretch; + flex:1 1 auto; + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer{ + width:100%; + height:70px; + position:relative; + } + +:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea{ + width:100%; + height:100%; + padding:8px; + } + +:is(:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea)::-moz-placeholder{ + color:var(--text-secondary-color); + } + +:is(:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea)::placeholder{ + color:var(--text-secondary-color); + } + +:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) .altTextSpinner{ + display:none; + position:absolute; + width:16px; + height:16px; + inset-inline-start:8px; + inset-block-start:8px; + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--text-secondary-color); + pointer-events:none; + } + +.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea::-moz-placeholder{ + color:transparent; + } + +.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) textarea::placeholder{ + color:transparent; + } + +.loading:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescriptionContainer) .altTextSpinner{ + display:inline-block; + -webkit-mask-image:var(--new-alt-text-spinner-icon); + mask-image:var(--new-alt-text-spinner-icon); + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDescription{ + font-size:11px; + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDisclaimer{ + display:flex; + flex-direction:row; + align-items:flex-start; + gap:4px; + font-size:11px; + } + +:is(:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #descriptionInstruction) #newAltTextDisclaimer)::before{ + content:""; + display:inline-block; + width:17px; + height:16px; + -webkit-mask-image:var(--new-alt-text-ai-disclaimer-icon); + mask-image:var(--new-alt-text-ai-disclaimer-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--text-secondary-color); + flex:1 0 auto; + } + +:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextDownloadModel{ + display:flex; + align-items:center; + gap:4px; + align-self:stretch; + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextDownloadModel)::before{ + content:""; + display:inline-block; + width:16px; + height:16px; + -webkit-mask-image:var(--new-alt-text-spinner-icon); + mask-image:var(--new-alt-text-spinner-icon); + -webkit-mask-size:cover; + mask-size:cover; + background-color:var(--text-secondary-color); + } + +:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextImagePreview{ + width:180px; + aspect-ratio:1; + display:flex; + justify-content:center; + align-items:center; + flex:0 0 auto; + background-color:var(--preview-image-bg-color); + border:var(--preview-image-border); + } + +:is(:is(:is(.dialog.newAltText #newAltTextContainer) #mainContent) #newAltTextImagePreview) > canvas{ + max-width:100%; + max-height:100%; + } + +.colorPicker{ + --csstools-light-dark-toggle--57:var(--csstools-color-scheme--light) #80ebff; + --hover-outline-color:var(--csstools-light-dark-toggle--57, #0250bb); + --csstools-light-dark-toggle--58:var(--csstools-color-scheme--light) #aaf2ff; + --selected-outline-color:var(--csstools-light-dark-toggle--58, #0060df); + --csstools-light-dark-toggle--59:var(--csstools-color-scheme--light) #52525e; + --swatch-border-color:var(--csstools-light-dark-toggle--59, #cfcfd8); +} + +@supports (color: light-dark(red, red)){ +.colorPicker{ + --hover-outline-color:light-dark(#0250bb, #80ebff); + --selected-outline-color:light-dark(#0060df, #aaf2ff); + --swatch-border-color:light-dark(#cfcfd8, #52525e); +} +} + +@supports not (color: light-dark(tan, tan)){ + +.colorPicker *{ + --csstools-light-dark-toggle--57:var(--csstools-color-scheme--light) #80ebff; + --hover-outline-color:var(--csstools-light-dark-toggle--57, #0250bb); + --csstools-light-dark-toggle--58:var(--csstools-color-scheme--light) #aaf2ff; + --selected-outline-color:var(--csstools-light-dark-toggle--58, #0060df); + --csstools-light-dark-toggle--59:var(--csstools-color-scheme--light) #52525e; + --swatch-border-color:var(--csstools-light-dark-toggle--59, #cfcfd8); + } +} + +@media screen and (forced-colors: active){ + +.colorPicker{ + --hover-outline-color:Highlight; + --selected-outline-color:var(--hover-outline-color); + --swatch-border-color:ButtonText; +} + } + +.colorPicker .swatch{ + width:16px; + height:16px; + border:1px solid var(--swatch-border-color); + border-radius:100%; + outline-offset:2px; + box-sizing:border-box; + forced-color-adjust:none; + } + +.colorPicker button:is(:hover,.selected) > .swatch{ + border:none; + } + +.basicColorPicker{ + width:28px; +} + +.basicColorPicker::-moz-color-swatch{ + border-radius:100%; + } + +.basicColorPicker::-webkit-color-swatch{ + border-radius:100%; + } + +.annotationEditorLayer[data-main-rotation="0"] .highlightEditor:not(.free) > .editToolbar{ + rotate:0deg; + } + +.annotationEditorLayer[data-main-rotation="90"] .highlightEditor:not(.free) > .editToolbar{ + rotate:270deg; + } + +.annotationEditorLayer[data-main-rotation="180"] .highlightEditor:not(.free) > .editToolbar{ + rotate:180deg; + } + +.annotationEditorLayer[data-main-rotation="270"] .highlightEditor:not(.free) > .editToolbar{ + rotate:90deg; + } + +.annotationEditorLayer .highlightEditor{ + position:absolute; + background:transparent; + z-index:1; + cursor:auto; + max-width:100%; + max-height:100%; + border:none; + outline:none; + pointer-events:none; + transform-origin:0 0; + } + +:is(.annotationEditorLayer .highlightEditor):not(.free){ + transform:none; + } + +:is(.annotationEditorLayer .highlightEditor) .internal{ + position:absolute; + top:0; + left:0; + width:100%; + height:100%; + pointer-events:auto; + } + +.disabled:is(.annotationEditorLayer .highlightEditor) .internal{ + pointer-events:none; + } + +.selectedEditor:is(.annotationEditorLayer .highlightEditor) .internal{ + cursor:pointer; + } + +:is(.annotationEditorLayer .highlightEditor) .editToolbar{ + --editor-toolbar-colorpicker-arrow-image:url(images/toolbarButton-menuArrow.svg); + + transform-origin:center !important; + } + +:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker{ + position:relative; + width:auto; + display:flex; + justify-content:center; + align-items:center; + gap:4px; + padding:4px; + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker)::after{ + content:""; + -webkit-mask-image:var(--editor-toolbar-colorpicker-arrow-image); + mask-image:var(--editor-toolbar-colorpicker-arrow-image); + -webkit-mask-repeat:no-repeat; + mask-repeat:no-repeat; + -webkit-mask-position:center; + mask-position:center; + display:inline-block; + background-color:var(--editor-toolbar-fg-color); + width:12px; + height:12px; + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):hover::after{ + background-color:var(--editor-toolbar-hover-fg-color); + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):has(.dropdown:not(.hidden)){ + background-color:var(--editor-toolbar-hover-bg-color); + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker):has(.dropdown:not(.hidden))::after{ + scale:-1; + } + +:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown{ + position:absolute; + display:flex; + justify-content:center; + align-items:center; + flex-direction:column; + gap:11px; + padding-block:8px; + border-radius:6px; + background-color:var(--editor-toolbar-bg-color); + border:1px solid var(--editor-toolbar-border-color); + box-shadow:var(--editor-toolbar-shadow); + inset-block-start:calc(100% + 4px); + width:calc(100% + 2 * var(--editor-toolbar-padding)); + } + +:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button{ + width:100%; + height:auto; + border:none; + cursor:pointer; + display:flex; + justify-content:center; + align-items:center; + background:none; + } + +:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button):is(:active,:focus-visible){ + outline:none; + } + +:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button) > .swatch{ + outline-offset:2px; + } + +[aria-selected="true"]:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button) > .swatch{ + outline:2px solid var(--selected-outline-color); + } + +:is(:is(:is(:is(:is(:is(.annotationEditorLayer .highlightEditor) .editToolbar) .buttons) .colorPicker) .dropdown) button):is(:hover,:active,:focus-visible) > .swatch{ + outline:2px solid var(--hover-outline-color); + } + +.editorParamsToolbar:has(#highlightParamsToolbarContainer){ + padding:unset; +} + +#highlightParamsToolbarContainer{ + gap:16px; + padding-inline:10px; + padding-block-end:12px; +} + +#highlightParamsToolbarContainer .colorPicker{ + display:flex; + flex-direction:column; + gap:8px; + } + +:is(#highlightParamsToolbarContainer .colorPicker) .dropdown{ + display:flex; + justify-content:space-between; + align-items:center; + flex-direction:row; + height:auto; + } + +:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button{ + width:auto; + height:auto; + border:none; + cursor:pointer; + display:flex; + justify-content:center; + align-items:center; + background:none; + flex:0 0 auto; + padding:0; + } + +:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button) .swatch{ + width:24px; + height:24px; + } + +:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button):is(:active,:focus-visible){ + outline:none; + } + +[aria-selected="true"]:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button) > .swatch{ + outline:2px solid var(--selected-outline-color); + } + +:is(:is(:is(#highlightParamsToolbarContainer .colorPicker) .dropdown) button):is(:hover,:active,:focus-visible) > .swatch{ + outline:2px solid var(--hover-outline-color); + } + +#highlightParamsToolbarContainer #editorHighlightThickness{ + display:flex; + flex-direction:column; + align-items:center; + gap:4px; + align-self:stretch; + } + +:is(#highlightParamsToolbarContainer #editorHighlightThickness) .editorParamsLabel{ + height:auto; + align-self:stretch; + } + +:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{ + display:flex; + justify-content:space-between; + align-items:center; + align-self:stretch; + + --csstools-light-dark-toggle--60:var(--csstools-color-scheme--light) #80808e; + + --example-color:var(--csstools-light-dark-toggle--60, #bfbfc9); + } + +@supports (color: light-dark(red, red)){ +:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{ + + --example-color:light-dark(#bfbfc9, #80808e); + } +} + +@supports not (color: light-dark(tan, tan)){ + +:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker) *{ + + --csstools-light-dark-toggle--60:var(--csstools-color-scheme--light) #80808e; + + --example-color:var(--csstools-light-dark-toggle--60, #bfbfc9); + } +} + +@media screen and (forced-colors: active){ + +:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker{ + --example-color:CanvasText; + } + } + +:is(:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker) > .editorParamsSlider[disabled]){ + opacity:0.4; + } + +:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker)::before,:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker)::after{ + content:""; + width:8px; + aspect-ratio:1; + display:block; + border-radius:100%; + background-color:var(--example-color); + } + +:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker)::after{ + width:24px; + } + +:is(:is(#highlightParamsToolbarContainer #editorHighlightThickness) .thicknessPicker) .editorParamsSlider{ + width:unset; + height:14px; + } + +#highlightParamsToolbarContainer #editorHighlightVisibility{ + display:flex; + flex-direction:column; + align-items:flex-start; + gap:8px; + align-self:stretch; + } + +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ + --csstools-light-dark-toggle--61:var(--csstools-color-scheme--light) #8f8f9d; + --divider-color:var(--csstools-light-dark-toggle--61, #d7d7db); + } + +@supports (color: light-dark(red, red)){ +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ + --divider-color:light-dark(#d7d7db, #8f8f9d); + } +} + +@supports not (color: light-dark(tan, tan)){ + +:is(:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider) *{ + --csstools-light-dark-toggle--61:var(--csstools-color-scheme--light) #8f8f9d; + --divider-color:var(--csstools-light-dark-toggle--61, #d7d7db); + } +} + +@media screen and (forced-colors: active){ + +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ + --divider-color:CanvasText; + } + } + +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .divider{ + + margin-block:4px; + width:100%; + height:1px; + background-color:var(--divider-color); + } + +:is(#highlightParamsToolbarContainer #editorHighlightVisibility) .toggler{ + display:flex; + justify-content:space-between; + align-items:center; + align-self:stretch; + } + +#altTextSettingsDialog{ + padding:16px; +} + +#altTextSettingsDialog #altTextSettingsContainer{ + display:flex; + width:573px; + flex-direction:column; + gap:16px; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) .mainContainer{ + gap:16px; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) .description{ + color:var(--text-secondary-color); + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings{ + display:flex; + flex-direction:column; + gap:12px; + } + +:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) button{ + width:-moz-fit-content; + width:fit-content; + } + +.download:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings) #deleteModelButton{ + display:none; + } + +:is(:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings):not(.download) #downloadModelButton{ + display:none; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticAltText,:is(#altTextSettingsDialog #altTextSettingsContainer) #altTextEditor{ + display:flex; + flex-direction:column; + gap:8px; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) #createModelDescription,:is(#altTextSettingsDialog #altTextSettingsContainer) #aiModelSettings,:is(#altTextSettingsDialog #altTextSettingsContainer) #showAltTextDialogDescription{ + padding-inline-start:40px; + } + +:is(#altTextSettingsDialog #altTextSettingsContainer) #automaticSettings{ + display:flex; + flex-direction:column; + gap:16px; + } + +:root{ + --csstools-color-scheme--light:initial; + color-scheme:light dark; + + --viewer-container-height:0; + --pdfViewer-padding-bottom:0; + --page-margin:1px auto -8px; + --page-border:9px solid transparent; + --spreadHorizontalWrapped-margin-LR:-3.5px; + --loading-icon-delay:400ms; + --csstools-light-dark-toggle--62:var(--csstools-color-scheme--light) #0df; + --focus-ring-color:var(--csstools-light-dark-toggle--62, #0060df); + --focus-ring-outline:2px solid var(--focus-ring-color); +} + +@supports (color: light-dark(red, red)){ +:root{ + --focus-ring-color:light-dark(#0060df, #0df); +} +} + +@supports not (color: light-dark(tan, tan)){ + +:root *{ + --csstools-light-dark-toggle--62:var(--csstools-color-scheme--light) #0df; + --focus-ring-color:var(--csstools-light-dark-toggle--62, #0060df); + } +} + +@media (prefers-color-scheme: dark){ + +:root{ + --csstools-color-scheme--light:; +} +} + +@media screen and (forced-colors: active){ + +:root{ + --pdfViewer-padding-bottom:9px; + --page-margin:8px auto -1px; + --page-border:1px solid CanvasText; + --spreadHorizontalWrapped-margin-LR:3.5px; + --focus-ring-color:CanvasText; +} + } + +[data-main-rotation="90"]{ + transform:rotate(90deg) translateY(-100%); +} +[data-main-rotation="180"]{ + transform:rotate(180deg) translate(-100%, -100%); +} +[data-main-rotation="270"]{ + transform:rotate(270deg) translateX(-100%); +} + +#hiddenCopyElement, +.hiddenCanvasElement{ + position:absolute; + top:0; + left:0; + width:0; + height:0; + display:none; +} + +.pdfViewer{ + --scale-factor:1; + --page-bg-color:unset; + + padding-bottom:var(--pdfViewer-padding-bottom); + + --hcm-highlight-filter:none; + --hcm-highlight-selected-filter:none; +} + +@media screen and (forced-colors: active){ + +.pdfViewer{ + --hcm-highlight-filter:invert(100%); +} + } + +.pdfViewer.copyAll{ + cursor:wait; + } + +.pdfViewer .canvasWrapper{ + overflow:hidden; + width:100%; + height:100%; + } + +:is(.pdfViewer .canvasWrapper) canvas{ + position:absolute; + top:0; + left:0; + margin:0; + display:block; + width:100%; + height:100%; + contain:content; + } + +:is(:is(.pdfViewer .canvasWrapper) canvas) .structTree{ + contain:strict; + } + +.pdfViewer .page{ + --user-unit:1; + --total-scale-factor:calc(var(--scale-factor) * var(--user-unit)); + --scale-round-x:1px; + --scale-round-y:1px; + + direction:ltr; + width:816px; + height:1056px; + margin:var(--page-margin); + position:relative; + overflow:visible; + border:var(--page-border); + background-clip:content-box; + background-color:var(--page-bg-color, rgb(255 255 255)); +} + +.pdfViewer .dummyPage{ + position:relative; + width:0; + height:var(--viewer-container-height); +} + +.pdfViewer.noUserSelect{ + -webkit-user-select:none; + -moz-user-select:none; + user-select:none; +} + +.pdfViewer.removePageBorders .page{ + margin:0 auto 10px; + border:none; +} + +.pdfViewer.singlePageView{ + display:inline-block; +} + +.pdfViewer.singlePageView .page{ + margin:0; + border:none; +} + +.pdfViewer:is(.scrollHorizontal, .scrollWrapped), +.spread{ + margin-inline:3.5px; + text-align:center; +} + +.pdfViewer.scrollHorizontal, +.spread{ + white-space:nowrap; +} + +.pdfViewer.removePageBorders, +.pdfViewer:is(.scrollHorizontal, .scrollWrapped) .spread{ + margin-inline:0; +} + +.spread :is(.page, .dummyPage), +.pdfViewer:is(.scrollHorizontal, .scrollWrapped) :is(.page, .spread){ + display:inline-block; + vertical-align:middle; +} + +.spread .page, +.pdfViewer:is(.scrollHorizontal, .scrollWrapped) .page{ + margin-inline:var(--spreadHorizontalWrapped-margin-LR); +} + +.pdfViewer.removePageBorders .spread .page, +.pdfViewer.removePageBorders:is(.scrollHorizontal, .scrollWrapped) .page{ + margin-inline:5px; +} + +.pdfViewer .page.loadingIcon::after{ + position:absolute; + top:0; + left:0; + content:""; + width:100%; + height:100%; + background:url("images/loading-icon.gif") center no-repeat; + display:none; + transition-property:display; + transition-delay:var(--loading-icon-delay); + z-index:5; + contain:strict; +} + +.pdfViewer .page.loading::after{ + display:block; +} + +.pdfViewer .page:not(.loading)::after{ + transition-property:none; + display:none; +} + +.pdfPresentationMode .pdfViewer{ + padding-bottom:0; +} + +.pdfPresentationMode .spread{ + margin:0; +} + +.pdfPresentationMode .pdfViewer .page{ + margin:0 auto; + border:2px solid transparent; +} diff --git a/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.d.mts b/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..0350ce49b3172b1e49d84399c6afffa57375aa38 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.d.mts @@ -0,0 +1 @@ +export * from "../types/web/pdf_viewer.component.js"; diff --git a/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.mjs b/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.mjs new file mode 100644 index 0000000000000000000000000000000000000000..c037155406d3ac6b352cbf35cdcbf1c844964ab8 --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.mjs @@ -0,0 +1,9134 @@ +/** + * @licstart The following is the entire license notice for the + * JavaScript code in this page + * + * Copyright 2024 Mozilla Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @licend The above is the entire license notice for the + * JavaScript code in this page + */ + +/** + * pdfjsVersion = 5.4.54 + * pdfjsBuild = 295fb3ec4 + */ + +;// ./web/pdfjs.js +const { + AbortException, + AnnotationEditorLayer, + AnnotationEditorParamsType, + AnnotationEditorType, + AnnotationEditorUIManager, + AnnotationLayer, + AnnotationMode, + AnnotationType, + build, + ColorPicker, + createValidAbsoluteUrl, + DOMSVGFactory, + DrawLayer, + FeatureTest, + fetchData, + getDocument, + getFilenameFromUrl, + getPdfFilenameFromUrl, + getRGB, + getUuid, + getXfaPageViewport, + GlobalWorkerOptions, + ImageKind, + InvalidPDFException, + isDataScheme, + isPdfFile, + isValidExplicitDest, + MathClamp, + noContextMenu, + normalizeUnicode, + OPS, + OutputScale, + PasswordResponses, + PDFDataRangeTransport, + PDFDateString, + PDFWorker, + PermissionFlag, + PixelsPerInch, + RenderingCancelledException, + ResponseException, + setLayerDimensions, + shadow, + SignatureExtractor, + stopEvent, + SupportedImageMimeTypes, + TextLayer, + TouchManager, + updateUrlHash, + Util, + VerbosityLevel, + version, + XfaLayer +} = globalThis.pdfjsLib; + +;// ./web/ui_utils.js + +const DEFAULT_SCALE_VALUE = "auto"; +const DEFAULT_SCALE = 1.0; +const DEFAULT_SCALE_DELTA = 1.1; +const MIN_SCALE = 0.1; +const MAX_SCALE = 10.0; +const UNKNOWN_SCALE = 0; +const MAX_AUTO_SCALE = 1.25; +const SCROLLBAR_PADDING = 40; +const VERTICAL_PADDING = 5; +const RenderingStates = { + INITIAL: 0, + RUNNING: 1, + PAUSED: 2, + FINISHED: 3 +}; +const PresentationModeState = { + UNKNOWN: 0, + NORMAL: 1, + CHANGING: 2, + FULLSCREEN: 3 +}; +const SidebarView = { + UNKNOWN: -1, + NONE: 0, + THUMBS: 1, + OUTLINE: 2, + ATTACHMENTS: 3, + LAYERS: 4 +}; +const TextLayerMode = { + DISABLE: 0, + ENABLE: 1, + ENABLE_PERMISSIONS: 2 +}; +const ScrollMode = { + UNKNOWN: -1, + VERTICAL: 0, + HORIZONTAL: 1, + WRAPPED: 2, + PAGE: 3 +}; +const SpreadMode = { + UNKNOWN: -1, + NONE: 0, + ODD: 1, + EVEN: 2 +}; +const CursorTool = { + SELECT: 0, + HAND: 1, + ZOOM: 2 +}; +const AutoPrintRegExp = /\bprint\s*\(/; +function scrollIntoView(element, spot, scrollMatches = false) { + let parent = element.offsetParent; + if (!parent) { + console.error("offsetParent is not set -- cannot scroll"); + return; + } + let offsetY = element.offsetTop + element.clientTop; + let offsetX = element.offsetLeft + element.clientLeft; + while (parent.clientHeight === parent.scrollHeight && parent.clientWidth === parent.scrollWidth || scrollMatches && (parent.classList.contains("markedContent") || getComputedStyle(parent).overflow === "hidden")) { + offsetY += parent.offsetTop; + offsetX += parent.offsetLeft; + parent = parent.offsetParent; + if (!parent) { + return; + } + } + if (spot) { + if (spot.top !== undefined) { + offsetY += spot.top; + } + if (spot.left !== undefined) { + offsetX += spot.left; + parent.scrollLeft = offsetX; + } + } + parent.scrollTop = offsetY; +} +function watchScroll(viewAreaElement, callback, abortSignal = undefined) { + const debounceScroll = function (evt) { + if (rAF) { + return; + } + rAF = window.requestAnimationFrame(function viewAreaElementScrolled() { + rAF = null; + const currentX = viewAreaElement.scrollLeft; + const lastX = state.lastX; + if (currentX !== lastX) { + state.right = currentX > lastX; + } + state.lastX = currentX; + const currentY = viewAreaElement.scrollTop; + const lastY = state.lastY; + if (currentY !== lastY) { + state.down = currentY > lastY; + } + state.lastY = currentY; + callback(state); + }); + }; + const state = { + right: true, + down: true, + lastX: viewAreaElement.scrollLeft, + lastY: viewAreaElement.scrollTop, + _eventHandler: debounceScroll + }; + let rAF = null; + viewAreaElement.addEventListener("scroll", debounceScroll, { + useCapture: true, + signal: abortSignal + }); + abortSignal?.addEventListener("abort", () => window.cancelAnimationFrame(rAF), { + once: true + }); + return state; +} +function parseQueryString(query) { + const params = new Map(); + for (const [key, value] of new URLSearchParams(query)) { + params.set(key.toLowerCase(), value); + } + return params; +} +const InvisibleCharsRegExp = /[\x00-\x1F]/g; +function removeNullCharacters(str, replaceInvisible = false) { + if (!InvisibleCharsRegExp.test(str)) { + return str; + } + if (replaceInvisible) { + return str.replaceAll(InvisibleCharsRegExp, m => m === "\x00" ? "" : " "); + } + return str.replaceAll("\x00", ""); +} +function binarySearchFirstItem(items, condition, start = 0) { + let minIndex = start; + let maxIndex = items.length - 1; + if (maxIndex < 0 || !condition(items[maxIndex])) { + return items.length; + } + if (condition(items[minIndex])) { + return minIndex; + } + while (minIndex < maxIndex) { + const currentIndex = minIndex + maxIndex >> 1; + const currentItem = items[currentIndex]; + if (condition(currentItem)) { + maxIndex = currentIndex; + } else { + minIndex = currentIndex + 1; + } + } + return minIndex; +} +function approximateFraction(x) { + if (Math.floor(x) === x) { + return [x, 1]; + } + const xinv = 1 / x; + const limit = 8; + if (xinv > limit) { + return [1, limit]; + } else if (Math.floor(xinv) === xinv) { + return [1, xinv]; + } + const x_ = x > 1 ? xinv : x; + let a = 0, + b = 1, + c = 1, + d = 1; + while (true) { + const p = a + c, + q = b + d; + if (q > limit) { + break; + } + if (x_ <= p / q) { + c = p; + d = q; + } else { + a = p; + b = q; + } + } + let result; + if (x_ - a / b < c / d - x_) { + result = x_ === x ? [a, b] : [b, a]; + } else { + result = x_ === x ? [c, d] : [d, c]; + } + return result; +} +function floorToDivide(x, div) { + return x - x % div; +} +function getPageSizeInches({ + view, + userUnit, + rotate +}) { + const [x1, y1, x2, y2] = view; + const changeOrientation = rotate % 180 !== 0; + const width = (x2 - x1) / 72 * userUnit; + const height = (y2 - y1) / 72 * userUnit; + return { + width: changeOrientation ? height : width, + height: changeOrientation ? width : height + }; +} +function backtrackBeforeAllVisibleElements(index, views, top) { + if (index < 2) { + return index; + } + let elt = views[index].div; + let pageTop = elt.offsetTop + elt.clientTop; + if (pageTop >= top) { + elt = views[index - 1].div; + pageTop = elt.offsetTop + elt.clientTop; + } + for (let i = index - 2; i >= 0; --i) { + elt = views[i].div; + if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) { + break; + } + index = i; + } + return index; +} +function getVisibleElements({ + scrollEl, + views, + sortByVisibility = false, + horizontal = false, + rtl = false +}) { + const top = scrollEl.scrollTop, + bottom = top + scrollEl.clientHeight; + const left = scrollEl.scrollLeft, + right = left + scrollEl.clientWidth; + function isElementBottomAfterViewTop(view) { + const element = view.div; + const elementBottom = element.offsetTop + element.clientTop + element.clientHeight; + return elementBottom > top; + } + function isElementNextAfterViewHorizontally(view) { + const element = view.div; + const elementLeft = element.offsetLeft + element.clientLeft; + const elementRight = elementLeft + element.clientWidth; + return rtl ? elementLeft < right : elementRight > left; + } + const visible = [], + ids = new Set(), + numViews = views.length; + let firstVisibleElementInd = binarySearchFirstItem(views, horizontal ? isElementNextAfterViewHorizontally : isElementBottomAfterViewTop); + if (firstVisibleElementInd > 0 && firstVisibleElementInd < numViews && !horizontal) { + firstVisibleElementInd = backtrackBeforeAllVisibleElements(firstVisibleElementInd, views, top); + } + let lastEdge = horizontal ? right : -1; + for (let i = firstVisibleElementInd; i < numViews; i++) { + const view = views[i], + element = view.div; + const currentWidth = element.offsetLeft + element.clientLeft; + const currentHeight = element.offsetTop + element.clientTop; + const viewWidth = element.clientWidth, + viewHeight = element.clientHeight; + const viewRight = currentWidth + viewWidth; + const viewBottom = currentHeight + viewHeight; + if (lastEdge === -1) { + if (viewBottom >= bottom) { + lastEdge = viewBottom; + } + } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) { + break; + } + if (viewBottom <= top || currentHeight >= bottom || viewRight <= left || currentWidth >= right) { + continue; + } + const minY = Math.max(0, top - currentHeight); + const minX = Math.max(0, left - currentWidth); + const hiddenHeight = minY + Math.max(0, viewBottom - bottom); + const hiddenWidth = minX + Math.max(0, viewRight - right); + const fractionHeight = (viewHeight - hiddenHeight) / viewHeight, + fractionWidth = (viewWidth - hiddenWidth) / viewWidth; + const percent = fractionHeight * fractionWidth * 100 | 0; + visible.push({ + id: view.id, + x: currentWidth, + y: currentHeight, + visibleArea: percent === 100 ? null : { + minX, + minY, + maxX: Math.min(viewRight, right) - currentWidth, + maxY: Math.min(viewBottom, bottom) - currentHeight + }, + view, + percent, + widthPercent: fractionWidth * 100 | 0 + }); + ids.add(view.id); + } + const first = visible[0], + last = visible.at(-1); + if (sortByVisibility) { + visible.sort(function (a, b) { + const pc = a.percent - b.percent; + if (Math.abs(pc) > 0.001) { + return -pc; + } + return a.id - b.id; + }); + } + return { + first, + last, + views: visible, + ids + }; +} +function normalizeWheelEventDirection(evt) { + let delta = Math.hypot(evt.deltaX, evt.deltaY); + const angle = Math.atan2(evt.deltaY, evt.deltaX); + if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) { + delta = -delta; + } + return delta; +} +function normalizeWheelEventDelta(evt) { + const deltaMode = evt.deltaMode; + let delta = normalizeWheelEventDirection(evt); + const MOUSE_PIXELS_PER_LINE = 30; + const MOUSE_LINES_PER_PAGE = 30; + if (deltaMode === WheelEvent.DOM_DELTA_PIXEL) { + delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE; + } else if (deltaMode === WheelEvent.DOM_DELTA_LINE) { + delta /= MOUSE_LINES_PER_PAGE; + } + return delta; +} +function isValidRotation(angle) { + return Number.isInteger(angle) && angle % 90 === 0; +} +function isValidScrollMode(mode) { + return Number.isInteger(mode) && Object.values(ScrollMode).includes(mode) && mode !== ScrollMode.UNKNOWN; +} +function isValidSpreadMode(mode) { + return Number.isInteger(mode) && Object.values(SpreadMode).includes(mode) && mode !== SpreadMode.UNKNOWN; +} +function isPortraitOrientation(size) { + return size.width <= size.height; +} +const animationStarted = new Promise(function (resolve) { + window.requestAnimationFrame(resolve); +}); +const docStyle = document.documentElement.style; +class ProgressBar { + #classList = null; + #disableAutoFetchTimeout = null; + #percent = 0; + #style = null; + #visible = true; + constructor(bar) { + this.#classList = bar.classList; + this.#style = bar.style; + } + get percent() { + return this.#percent; + } + set percent(val) { + this.#percent = MathClamp(val, 0, 100); + if (isNaN(val)) { + this.#classList.add("indeterminate"); + return; + } + this.#classList.remove("indeterminate"); + this.#style.setProperty("--progressBar-percent", `${this.#percent}%`); + } + setWidth(viewer) { + if (!viewer) { + return; + } + const container = viewer.parentNode; + const scrollbarWidth = container.offsetWidth - viewer.offsetWidth; + if (scrollbarWidth > 0) { + this.#style.setProperty("--progressBar-end-offset", `${scrollbarWidth}px`); + } + } + setDisableAutoFetch(delay = 5000) { + if (this.#percent === 100 || isNaN(this.#percent)) { + return; + } + if (this.#disableAutoFetchTimeout) { + clearTimeout(this.#disableAutoFetchTimeout); + } + this.show(); + this.#disableAutoFetchTimeout = setTimeout(() => { + this.#disableAutoFetchTimeout = null; + this.hide(); + }, delay); + } + hide() { + if (!this.#visible) { + return; + } + this.#visible = false; + this.#classList.add("hidden"); + } + show() { + if (this.#visible) { + return; + } + this.#visible = true; + this.#classList.remove("hidden"); + } +} +function getActiveOrFocusedElement() { + let curRoot = document; + let curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus"); + while (curActiveOrFocused?.shadowRoot) { + curRoot = curActiveOrFocused.shadowRoot; + curActiveOrFocused = curRoot.activeElement || curRoot.querySelector(":focus"); + } + return curActiveOrFocused; +} +function apiPageLayoutToViewerModes(layout) { + let scrollMode = ScrollMode.VERTICAL, + spreadMode = SpreadMode.NONE; + switch (layout) { + case "SinglePage": + scrollMode = ScrollMode.PAGE; + break; + case "OneColumn": + break; + case "TwoPageLeft": + scrollMode = ScrollMode.PAGE; + case "TwoColumnLeft": + spreadMode = SpreadMode.ODD; + break; + case "TwoPageRight": + scrollMode = ScrollMode.PAGE; + case "TwoColumnRight": + spreadMode = SpreadMode.EVEN; + break; + } + return { + scrollMode, + spreadMode + }; +} +function apiPageModeToSidebarView(mode) { + switch (mode) { + case "UseNone": + return SidebarView.NONE; + case "UseThumbs": + return SidebarView.THUMBS; + case "UseOutlines": + return SidebarView.OUTLINE; + case "UseAttachments": + return SidebarView.ATTACHMENTS; + case "UseOC": + return SidebarView.LAYERS; + } + return SidebarView.NONE; +} +function toggleCheckedBtn(button, toggle, view = null) { + button.classList.toggle("toggled", toggle); + button.setAttribute("aria-checked", toggle); + view?.classList.toggle("hidden", !toggle); +} +function toggleExpandedBtn(button, toggle, view = null) { + button.classList.toggle("toggled", toggle); + button.setAttribute("aria-expanded", toggle); + view?.classList.toggle("hidden", !toggle); +} +const calcRound = function () { + const e = document.createElement("div"); + e.style.width = "round(down, calc(1.6666666666666665 * 792px), 1px)"; + return e.style.width === "calc(1320px)" ? Math.fround : x => x; +}(); + +;// ./web/pdf_find_utils.js +const CharacterType = { + SPACE: 0, + ALPHA_LETTER: 1, + PUNCT: 2, + HAN_LETTER: 3, + KATAKANA_LETTER: 4, + HIRAGANA_LETTER: 5, + HALFWIDTH_KATAKANA_LETTER: 6, + THAI_LETTER: 7 +}; +function isAlphabeticalScript(charCode) { + return charCode < 0x2e80; +} +function isAscii(charCode) { + return (charCode & 0xff80) === 0; +} +function isAsciiAlpha(charCode) { + return charCode >= 0x61 && charCode <= 0x7a || charCode >= 0x41 && charCode <= 0x5a; +} +function isAsciiDigit(charCode) { + return charCode >= 0x30 && charCode <= 0x39; +} +function isAsciiSpace(charCode) { + return charCode === 0x20 || charCode === 0x09 || charCode === 0x0d || charCode === 0x0a; +} +function isHan(charCode) { + return charCode >= 0x3400 && charCode <= 0x9fff || charCode >= 0xf900 && charCode <= 0xfaff; +} +function isKatakana(charCode) { + return charCode >= 0x30a0 && charCode <= 0x30ff; +} +function isHiragana(charCode) { + return charCode >= 0x3040 && charCode <= 0x309f; +} +function isHalfwidthKatakana(charCode) { + return charCode >= 0xff60 && charCode <= 0xff9f; +} +function isThai(charCode) { + return (charCode & 0xff80) === 0x0e00; +} +function getCharacterType(charCode) { + if (isAlphabeticalScript(charCode)) { + if (isAscii(charCode)) { + if (isAsciiSpace(charCode)) { + return CharacterType.SPACE; + } else if (isAsciiAlpha(charCode) || isAsciiDigit(charCode) || charCode === 0x5f) { + return CharacterType.ALPHA_LETTER; + } + return CharacterType.PUNCT; + } else if (isThai(charCode)) { + return CharacterType.THAI_LETTER; + } else if (charCode === 0xa0) { + return CharacterType.SPACE; + } + return CharacterType.ALPHA_LETTER; + } + if (isHan(charCode)) { + return CharacterType.HAN_LETTER; + } else if (isKatakana(charCode)) { + return CharacterType.KATAKANA_LETTER; + } else if (isHiragana(charCode)) { + return CharacterType.HIRAGANA_LETTER; + } else if (isHalfwidthKatakana(charCode)) { + return CharacterType.HALFWIDTH_KATAKANA_LETTER; + } + return CharacterType.ALPHA_LETTER; +} +let NormalizeWithNFKC; +function getNormalizeWithNFKC() { + NormalizeWithNFKC ||= ` ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩`; + return NormalizeWithNFKC; +} + +;// ./web/pdf_find_controller.js + + +const FindState = { + FOUND: 0, + NOT_FOUND: 1, + WRAPPED: 2, + PENDING: 3 +}; +const FIND_TIMEOUT = 250; +const MATCH_SCROLL_OFFSET_TOP = -50; +const MATCH_SCROLL_OFFSET_LEFT = -400; +const CHARACTERS_TO_NORMALIZE = { + "\u2010": "-", + "\u2018": "'", + "\u2019": "'", + "\u201A": "'", + "\u201B": "'", + "\u201C": '"', + "\u201D": '"', + "\u201E": '"', + "\u201F": '"', + "\u00BC": "1/4", + "\u00BD": "1/2", + "\u00BE": "3/4" +}; +const DIACRITICS_EXCEPTION = new Set([0x3099, 0x309a, 0x094d, 0x09cd, 0x0a4d, 0x0acd, 0x0b4d, 0x0bcd, 0x0c4d, 0x0ccd, 0x0d3b, 0x0d3c, 0x0d4d, 0x0dca, 0x0e3a, 0x0eba, 0x0f84, 0x1039, 0x103a, 0x1714, 0x1734, 0x17d2, 0x1a60, 0x1b44, 0x1baa, 0x1bab, 0x1bf2, 0x1bf3, 0x2d7f, 0xa806, 0xa82c, 0xa8c4, 0xa953, 0xa9c0, 0xaaf6, 0xabed, 0x0c56, 0x0f71, 0x0f72, 0x0f7a, 0x0f7b, 0x0f7c, 0x0f7d, 0x0f80, 0x0f74]); +let DIACRITICS_EXCEPTION_STR; +const DIACRITICS_REG_EXP = /\p{M}+/gu; +const SPECIAL_CHARS_REG_EXP = /([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu; +const NOT_DIACRITIC_FROM_END_REG_EXP = /([^\p{M}])\p{M}*$/u; +const NOT_DIACRITIC_FROM_START_REG_EXP = /^\p{M}*([^\p{M}])/u; +const SYLLABLES_REG_EXP = /[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g; +const SYLLABLES_LENGTHS = new Map(); +const FIRST_CHAR_SYLLABLES_REG_EXP = "[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]"; +const NFKC_CHARS_TO_NORMALIZE = new Map(); +let noSyllablesRegExp = null; +let withSyllablesRegExp = null; +function normalize(text, options = {}) { + const syllablePositions = []; + let m; + while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) { + let { + index + } = m; + for (const char of m[0]) { + let len = SYLLABLES_LENGTHS.get(char); + if (!len) { + len = char.normalize("NFD").length; + SYLLABLES_LENGTHS.set(char, len); + } + syllablePositions.push([len, index++]); + } + } + const hasSyllables = syllablePositions.length > 0; + const ignoreDashEOL = options.ignoreDashEOL ?? false; + let normalizationRegex; + if (!hasSyllables && noSyllablesRegExp) { + normalizationRegex = noSyllablesRegExp; + } else if (hasSyllables && withSyllablesRegExp) { + normalizationRegex = withSyllablesRegExp; + } else { + const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(""); + const toNormalizeWithNFKC = getNormalizeWithNFKC(); + const CJK = "(?:\\p{Ideographic}|[\u3040-\u30FF])"; + const HKDiacritics = "(?:\u3099|\u309A)"; + const BrokenWord = `\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})`; + const regexps = [`[${replace}]`, `[${toNormalizeWithNFKC}]`, `${HKDiacritics}\\n`, "\\p{M}+(?:-\\n)?", `${BrokenWord}`, "\\S-\\n", `${CJK}\\n`, "\\n", hasSyllables ? FIRST_CHAR_SYLLABLES_REG_EXP : "\\u0000"]; + normalizationRegex = new RegExp(regexps.map(r => `(${r})`).join("|"), "gum"); + if (hasSyllables) { + withSyllablesRegExp = normalizationRegex; + } else { + noSyllablesRegExp = normalizationRegex; + } + } + const rawDiacriticsPositions = []; + while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) { + rawDiacriticsPositions.push([m[0].length, m.index]); + } + let normalized = text.normalize("NFD"); + const positions = [0, 0]; + let rawDiacriticsIndex = 0; + let syllableIndex = 0; + let shift = 0; + let shiftOrigin = 0; + let eol = 0; + let hasDiacritics = false; + normalized = normalized.replace(normalizationRegex, (match, p1, p2, p3, p4, p5, p6, p7, p8, p9, i) => { + i -= shiftOrigin; + if (p1) { + const replacement = CHARACTERS_TO_NORMALIZE[p1]; + const jj = replacement.length; + for (let j = 1; j < jj; j++) { + positions.push(i - shift + j, shift - j); + } + shift -= jj - 1; + return replacement; + } + if (p2) { + let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2); + if (!replacement) { + replacement = p2.normalize("NFKC"); + NFKC_CHARS_TO_NORMALIZE.set(p2, replacement); + } + const jj = replacement.length; + for (let j = 1; j < jj; j++) { + positions.push(i - shift + j, shift - j); + } + shift -= jj - 1; + return replacement; + } + if (p3) { + hasDiacritics = true; + if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { + ++rawDiacriticsIndex; + } else { + positions.push(i - 1 - shift + 1, shift - 1); + shift -= 1; + shiftOrigin += 1; + } + positions.push(i - shift + 1, shift); + shiftOrigin += 1; + eol += 1; + return p3.charAt(0); + } + if (p4) { + const hasTrailingDashEOL = p4.endsWith("\n"); + const len = hasTrailingDashEOL ? p4.length - 2 : p4.length; + hasDiacritics = true; + let jj = len; + if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) { + jj -= rawDiacriticsPositions[rawDiacriticsIndex][0]; + ++rawDiacriticsIndex; + } + for (let j = 1; j <= jj; j++) { + positions.push(i - 1 - shift + j, shift - j); + } + shift -= jj; + shiftOrigin += jj; + if (hasTrailingDashEOL) { + i += len - 1; + positions.push(i - shift + 1, 1 + shift); + shift += 1; + shiftOrigin += 1; + eol += 1; + return p4.slice(0, len); + } + return p4; + } + if (p5) { + if (ignoreDashEOL) { + shiftOrigin += 1; + eol += 1; + return p5.slice(0, -1); + } + const len = p5.length - 2; + positions.push(i - shift + len, 1 + shift); + shift += 1; + shiftOrigin += 1; + eol += 1; + return p5.slice(0, -2); + } + if (p6) { + shiftOrigin += 1; + eol += 1; + return p6.slice(0, -1); + } + if (p7) { + const len = p7.length - 1; + positions.push(i - shift + len, shift); + shiftOrigin += 1; + eol += 1; + return p7.slice(0, -1); + } + if (p8) { + positions.push(i - shift + 1, shift - 1); + shift -= 1; + shiftOrigin += 1; + eol += 1; + return " "; + } + if (i + eol === syllablePositions[syllableIndex]?.[1]) { + const newCharLen = syllablePositions[syllableIndex][0] - 1; + ++syllableIndex; + for (let j = 1; j <= newCharLen; j++) { + positions.push(i - (shift - j), shift - j); + } + shift -= newCharLen; + shiftOrigin += newCharLen; + } + return p9; + }); + positions.push(normalized.length, shift); + const starts = new Uint32Array(positions.length >> 1); + const shifts = new Int32Array(positions.length >> 1); + for (let i = 0, ii = positions.length; i < ii; i += 2) { + starts[i >> 1] = positions[i]; + shifts[i >> 1] = positions[i + 1]; + } + return [normalized, [starts, shifts], hasDiacritics]; +} +function getOriginalIndex(diffs, pos, len) { + if (!diffs) { + return [pos, len]; + } + const [starts, shifts] = diffs; + const start = pos; + const end = pos + len - 1; + let i = binarySearchFirstItem(starts, x => x >= start); + if (starts[i] > start) { + --i; + } + let j = binarySearchFirstItem(starts, x => x >= end, i); + if (starts[j] > end) { + --j; + } + const oldStart = start + shifts[i]; + const oldEnd = end + shifts[j]; + const oldLen = oldEnd + 1 - oldStart; + return [oldStart, oldLen]; +} +class PDFFindController { + #state = null; + #updateMatchesCountOnProgress = true; + #visitedPagesCount = 0; + constructor({ + linkService, + eventBus, + updateMatchesCountOnProgress = true + }) { + this._linkService = linkService; + this._eventBus = eventBus; + this.#updateMatchesCountOnProgress = updateMatchesCountOnProgress; + this.onIsPageVisible = null; + this.#reset(); + eventBus._on("find", this.#onFind.bind(this)); + eventBus._on("findbarclose", this.#onFindBarClose.bind(this)); + } + get highlightMatches() { + return this._highlightMatches; + } + get pageMatches() { + return this._pageMatches; + } + get pageMatchesLength() { + return this._pageMatchesLength; + } + get selected() { + return this._selected; + } + get state() { + return this.#state; + } + setDocument(pdfDocument) { + if (this._pdfDocument) { + this.#reset(); + } + if (!pdfDocument) { + return; + } + this._pdfDocument = pdfDocument; + this._firstPageCapability.resolve(); + } + #onFind(state) { + if (!state) { + return; + } + const pdfDocument = this._pdfDocument; + const { + type + } = state; + if (this.#state === null || this.#shouldDirtyMatch(state)) { + this._dirtyMatch = true; + } + this.#state = state; + if (type !== "highlightallchange") { + this.#updateUIState(FindState.PENDING); + } + this._firstPageCapability.promise.then(() => { + if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) { + return; + } + this.#extractText(); + const findbarClosed = !this._highlightMatches; + const pendingTimeout = !!this._findTimeout; + if (this._findTimeout) { + clearTimeout(this._findTimeout); + this._findTimeout = null; + } + if (!type) { + this._findTimeout = setTimeout(() => { + this.#nextMatch(); + this._findTimeout = null; + }, FIND_TIMEOUT); + } else if (this._dirtyMatch) { + this.#nextMatch(); + } else if (type === "again") { + this.#nextMatch(); + if (findbarClosed && this.#state.highlightAll) { + this.#updateAllPages(); + } + } else if (type === "highlightallchange") { + if (pendingTimeout) { + this.#nextMatch(); + } else { + this._highlightMatches = true; + } + this.#updateAllPages(); + } else { + this.#nextMatch(); + } + }); + } + scrollMatchIntoView({ + element = null, + selectedLeft = 0, + pageIndex = -1, + matchIndex = -1 + }) { + if (!this._scrollMatches || !element) { + return; + } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) { + return; + } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) { + return; + } + this._scrollMatches = false; + const spot = { + top: MATCH_SCROLL_OFFSET_TOP, + left: selectedLeft + MATCH_SCROLL_OFFSET_LEFT + }; + scrollIntoView(element, spot, true); + } + #reset() { + this._highlightMatches = false; + this._scrollMatches = false; + this._pdfDocument = null; + this._pageMatches = []; + this._pageMatchesLength = []; + this.#visitedPagesCount = 0; + this.#state = null; + this._selected = { + pageIdx: -1, + matchIdx: -1 + }; + this._offset = { + pageIdx: null, + matchIdx: null, + wrapped: false + }; + this._extractTextPromises = []; + this._pageContents = []; + this._pageDiffs = []; + this._hasDiacritics = []; + this._matchesCountTotal = 0; + this._pagesToSearch = null; + this._pendingFindMatches = new Set(); + this._resumePageIdx = null; + this._dirtyMatch = false; + clearTimeout(this._findTimeout); + this._findTimeout = null; + this._firstPageCapability = Promise.withResolvers(); + } + get #query() { + const { + query + } = this.#state; + if (typeof query === "string") { + if (query !== this._rawQuery) { + this._rawQuery = query; + [this._normalizedQuery] = normalize(query); + } + return this._normalizedQuery; + } + return (query || []).filter(q => !!q).map(q => normalize(q)[0]); + } + #shouldDirtyMatch(state) { + const newQuery = state.query, + prevQuery = this.#state.query; + const newType = typeof newQuery, + prevType = typeof prevQuery; + if (newType !== prevType) { + return true; + } + if (newType === "string") { + if (newQuery !== prevQuery) { + return true; + } + } else if (JSON.stringify(newQuery) !== JSON.stringify(prevQuery)) { + return true; + } + switch (state.type) { + case "again": + const pageNumber = this._selected.pageIdx + 1; + const linkService = this._linkService; + return pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !(this.onIsPageVisible?.(pageNumber) ?? true); + case "highlightallchange": + return false; + } + return true; + } + #isEntireWord(content, startIdx, length) { + let match = content.slice(0, startIdx).match(NOT_DIACRITIC_FROM_END_REG_EXP); + if (match) { + const first = content.charCodeAt(startIdx); + const limit = match[1].charCodeAt(0); + if (getCharacterType(first) === getCharacterType(limit)) { + return false; + } + } + match = content.slice(startIdx + length).match(NOT_DIACRITIC_FROM_START_REG_EXP); + if (match) { + const last = content.charCodeAt(startIdx + length - 1); + const limit = match[1].charCodeAt(0); + if (getCharacterType(last) === getCharacterType(limit)) { + return false; + } + } + return true; + } + #convertToRegExpString(query, hasDiacritics) { + const { + matchDiacritics + } = this.#state; + let isUnicode = false; + query = query.replaceAll(SPECIAL_CHARS_REG_EXP, (match, p1, p2, p3, p4, p5) => { + if (p1) { + return `[ ]*\\${p1}[ ]*`; + } + if (p2) { + return `[ ]*${p2}[ ]*`; + } + if (p3) { + return "[ ]+"; + } + if (matchDiacritics) { + return p4 || p5; + } + if (p4) { + return DIACRITICS_EXCEPTION.has(p4.charCodeAt(0)) ? p4 : ""; + } + if (hasDiacritics) { + isUnicode = true; + return `${p5}\\p{M}*`; + } + return p5; + }); + const trailingSpaces = "[ ]*"; + if (query.endsWith(trailingSpaces)) { + query = query.slice(0, query.length - trailingSpaces.length); + } + if (matchDiacritics) { + if (hasDiacritics) { + DIACRITICS_EXCEPTION_STR ||= String.fromCharCode(...DIACRITICS_EXCEPTION); + isUnicode = true; + query = `${query}(?=[${DIACRITICS_EXCEPTION_STR}]|[^\\p{M}]|$)`; + } + } + return [isUnicode, query]; + } + #calculateMatch(pageIndex) { + if (!this.#state) { + return; + } + const query = this.#query; + if (query.length === 0) { + return; + } + const pageContent = this._pageContents[pageIndex]; + const matcherResult = this.match(query, pageContent, pageIndex); + const matches = this._pageMatches[pageIndex] = []; + const matchesLength = this._pageMatchesLength[pageIndex] = []; + const diffs = this._pageDiffs[pageIndex]; + matcherResult?.forEach(({ + index, + length + }) => { + const [matchPos, matchLen] = getOriginalIndex(diffs, index, length); + if (matchLen) { + matches.push(matchPos); + matchesLength.push(matchLen); + } + }); + if (this.#state.highlightAll) { + this.#updatePage(pageIndex); + } + if (this._resumePageIdx === pageIndex) { + this._resumePageIdx = null; + this.#nextPageMatch(); + } + const pageMatchesCount = matches.length; + this._matchesCountTotal += pageMatchesCount; + if (this.#updateMatchesCountOnProgress) { + if (pageMatchesCount > 0) { + this.#updateUIResultsCount(); + } + } else if (++this.#visitedPagesCount === this._linkService.pagesCount) { + this.#updateUIResultsCount(); + } + } + match(query, pageContent, pageIndex) { + const hasDiacritics = this._hasDiacritics[pageIndex]; + let isUnicode = false; + if (typeof query === "string") { + [isUnicode, query] = this.#convertToRegExpString(query, hasDiacritics); + } else { + query = query.sort().reverse().map(q => { + const [isUnicodePart, queryPart] = this.#convertToRegExpString(q, hasDiacritics); + isUnicode ||= isUnicodePart; + return `(${queryPart})`; + }).join("|"); + } + if (!query) { + return undefined; + } + const { + caseSensitive, + entireWord + } = this.#state; + const flags = `g${isUnicode ? "u" : ""}${caseSensitive ? "" : "i"}`; + query = new RegExp(query, flags); + const matches = []; + let match; + while ((match = query.exec(pageContent)) !== null) { + if (entireWord && !this.#isEntireWord(pageContent, match.index, match[0].length)) { + continue; + } + matches.push({ + index: match.index, + length: match[0].length + }); + } + return matches; + } + #extractText() { + if (this._extractTextPromises.length > 0) { + return; + } + let deferred = Promise.resolve(); + const textOptions = { + disableNormalization: true + }; + const pdfDoc = this._pdfDocument; + for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) { + const { + promise, + resolve + } = Promise.withResolvers(); + this._extractTextPromises[i] = promise; + deferred = deferred.then(async () => { + if (pdfDoc !== this._pdfDocument) { + resolve(); + return; + } + await pdfDoc.getPage(i + 1).then(pdfPage => pdfPage.getTextContent(textOptions)).then(textContent => { + const strBuf = []; + for (const textItem of textContent.items) { + strBuf.push(textItem.str); + if (textItem.hasEOL) { + strBuf.push("\n"); + } + } + [this._pageContents[i], this._pageDiffs[i], this._hasDiacritics[i]] = normalize(strBuf.join("")); + resolve(); + }, reason => { + console.error(`Unable to get text content for page ${i + 1}`, reason); + this._pageContents[i] = ""; + this._pageDiffs[i] = null; + this._hasDiacritics[i] = false; + resolve(); + }); + }); + } + } + #updatePage(index) { + if (this._scrollMatches && this._selected.pageIdx === index) { + this._linkService.page = index + 1; + } + this._eventBus.dispatch("updatetextlayermatches", { + source: this, + pageIndex: index + }); + } + #updateAllPages() { + this._eventBus.dispatch("updatetextlayermatches", { + source: this, + pageIndex: -1 + }); + } + #nextMatch() { + const previous = this.#state.findPrevious; + const currentPageIndex = this._linkService.page - 1; + const numPages = this._linkService.pagesCount; + this._highlightMatches = true; + if (this._dirtyMatch) { + this._dirtyMatch = false; + this._selected.pageIdx = this._selected.matchIdx = -1; + this._offset.pageIdx = currentPageIndex; + this._offset.matchIdx = null; + this._offset.wrapped = false; + this._resumePageIdx = null; + this._pageMatches.length = 0; + this._pageMatchesLength.length = 0; + this.#visitedPagesCount = 0; + this._matchesCountTotal = 0; + this.#updateAllPages(); + for (let i = 0; i < numPages; i++) { + if (this._pendingFindMatches.has(i)) { + continue; + } + this._pendingFindMatches.add(i); + this._extractTextPromises[i].then(() => { + this._pendingFindMatches.delete(i); + this.#calculateMatch(i); + }); + } + } + const query = this.#query; + if (query.length === 0) { + this.#updateUIState(FindState.FOUND); + return; + } + if (this._resumePageIdx) { + return; + } + const offset = this._offset; + this._pagesToSearch = numPages; + if (offset.matchIdx !== null) { + const numPageMatches = this._pageMatches[offset.pageIdx].length; + if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) { + offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1; + this.#updateMatch(true); + return; + } + this.#advanceOffsetPage(previous); + } + this.#nextPageMatch(); + } + #matchesReady(matches) { + const offset = this._offset; + const numMatches = matches.length; + const previous = this.#state.findPrevious; + if (numMatches) { + offset.matchIdx = previous ? numMatches - 1 : 0; + this.#updateMatch(true); + return true; + } + this.#advanceOffsetPage(previous); + if (offset.wrapped) { + offset.matchIdx = null; + if (this._pagesToSearch < 0) { + this.#updateMatch(false); + return true; + } + } + return false; + } + #nextPageMatch() { + if (this._resumePageIdx !== null) { + console.error("There can only be one pending page."); + } + let matches = null; + do { + const pageIdx = this._offset.pageIdx; + matches = this._pageMatches[pageIdx]; + if (!matches) { + this._resumePageIdx = pageIdx; + break; + } + } while (!this.#matchesReady(matches)); + } + #advanceOffsetPage(previous) { + const offset = this._offset; + const numPages = this._linkService.pagesCount; + offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1; + offset.matchIdx = null; + this._pagesToSearch--; + if (offset.pageIdx >= numPages || offset.pageIdx < 0) { + offset.pageIdx = previous ? numPages - 1 : 0; + offset.wrapped = true; + } + } + #updateMatch(found = false) { + let state = FindState.NOT_FOUND; + const wrapped = this._offset.wrapped; + this._offset.wrapped = false; + if (found) { + const previousPage = this._selected.pageIdx; + this._selected.pageIdx = this._offset.pageIdx; + this._selected.matchIdx = this._offset.matchIdx; + state = wrapped ? FindState.WRAPPED : FindState.FOUND; + if (previousPage !== -1 && previousPage !== this._selected.pageIdx) { + this.#updatePage(previousPage); + } + } + this.#updateUIState(state, this.#state.findPrevious); + if (this._selected.pageIdx !== -1) { + this._scrollMatches = true; + this.#updatePage(this._selected.pageIdx); + } + } + #onFindBarClose(evt) { + const pdfDocument = this._pdfDocument; + this._firstPageCapability.promise.then(() => { + if (!this._pdfDocument || pdfDocument && this._pdfDocument !== pdfDocument) { + return; + } + if (this._findTimeout) { + clearTimeout(this._findTimeout); + this._findTimeout = null; + } + if (this._resumePageIdx) { + this._resumePageIdx = null; + this._dirtyMatch = true; + } + this.#updateUIState(FindState.FOUND); + this._highlightMatches = false; + this.#updateAllPages(); + }); + } + #requestMatchesCount() { + const { + pageIdx, + matchIdx + } = this._selected; + let current = 0, + total = this._matchesCountTotal; + if (matchIdx !== -1) { + for (let i = 0; i < pageIdx; i++) { + current += this._pageMatches[i]?.length || 0; + } + current += matchIdx + 1; + } + if (current < 1 || current > total) { + current = total = 0; + } + return { + current, + total + }; + } + #updateUIResultsCount() { + this._eventBus.dispatch("updatefindmatchescount", { + source: this, + matchesCount: this.#requestMatchesCount() + }); + } + #updateUIState(state, previous = false) { + if (!this.#updateMatchesCountOnProgress && (this.#visitedPagesCount !== this._linkService.pagesCount || state === FindState.PENDING)) { + return; + } + this._eventBus.dispatch("updatefindcontrolstate", { + source: this, + state, + previous, + entireWord: this.#state?.entireWord ?? null, + matchesCount: this.#requestMatchesCount(), + rawQuery: this.#state?.query ?? null + }); + } +} + +;// ./web/pdf_link_service.js + + +const DEFAULT_LINK_REL = "noopener noreferrer nofollow"; +const LinkTarget = { + NONE: 0, + SELF: 1, + BLANK: 2, + PARENT: 3, + TOP: 4 +}; +class PDFLinkService { + externalLinkEnabled = true; + constructor({ + eventBus, + externalLinkTarget = null, + externalLinkRel = null, + ignoreDestinationZoom = false + } = {}) { + this.eventBus = eventBus; + this.externalLinkTarget = externalLinkTarget; + this.externalLinkRel = externalLinkRel; + this._ignoreDestinationZoom = ignoreDestinationZoom; + this.baseUrl = null; + this.pdfDocument = null; + this.pdfViewer = null; + this.pdfHistory = null; + } + setDocument(pdfDocument, baseUrl = null) { + this.baseUrl = baseUrl; + this.pdfDocument = pdfDocument; + } + setViewer(pdfViewer) { + this.pdfViewer = pdfViewer; + } + setHistory(pdfHistory) { + this.pdfHistory = pdfHistory; + } + get pagesCount() { + return this.pdfDocument ? this.pdfDocument.numPages : 0; + } + get page() { + return this.pdfDocument ? this.pdfViewer.currentPageNumber : 1; + } + set page(value) { + if (this.pdfDocument) { + this.pdfViewer.currentPageNumber = value; + } + } + get rotation() { + return this.pdfDocument ? this.pdfViewer.pagesRotation : 0; + } + set rotation(value) { + if (this.pdfDocument) { + this.pdfViewer.pagesRotation = value; + } + } + get isInPresentationMode() { + return this.pdfDocument ? this.pdfViewer.isInPresentationMode : false; + } + async goToDestination(dest) { + if (!this.pdfDocument) { + return; + } + let namedDest, explicitDest, pageNumber; + if (typeof dest === "string") { + namedDest = dest; + explicitDest = await this.pdfDocument.getDestination(dest); + } else { + namedDest = null; + explicitDest = await dest; + } + if (!Array.isArray(explicitDest)) { + console.error(`goToDestination: "${explicitDest}" is not a valid destination array, for dest="${dest}".`); + return; + } + const [destRef] = explicitDest; + if (destRef && typeof destRef === "object") { + pageNumber = this.pdfDocument.cachedPageNumber(destRef); + if (!pageNumber) { + try { + pageNumber = (await this.pdfDocument.getPageIndex(destRef)) + 1; + } catch { + console.error(`goToDestination: "${destRef}" is not a valid page reference, for dest="${dest}".`); + return; + } + } + } else if (Number.isInteger(destRef)) { + pageNumber = destRef + 1; + } + if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) { + console.error(`goToDestination: "${pageNumber}" is not a valid page number, for dest="${dest}".`); + return; + } + if (this.pdfHistory) { + this.pdfHistory.pushCurrentPosition(); + this.pdfHistory.push({ + namedDest, + explicitDest, + pageNumber + }); + } + this.pdfViewer.scrollPageIntoView({ + pageNumber, + destArray: explicitDest, + ignoreDestinationZoom: this._ignoreDestinationZoom + }); + const ac = new AbortController(); + this.eventBus._on("textlayerrendered", evt => { + if (evt.pageNumber === pageNumber) { + evt.source.textLayer.div.focus(); + ac.abort(); + } + }, { + signal: ac.signal + }); + } + goToPage(val) { + if (!this.pdfDocument) { + return; + } + const pageNumber = typeof val === "string" && this.pdfViewer.pageLabelToPageNumber(val) || val | 0; + if (!(Number.isInteger(pageNumber) && pageNumber > 0 && pageNumber <= this.pagesCount)) { + console.error(`PDFLinkService.goToPage: "${val}" is not a valid page.`); + return; + } + if (this.pdfHistory) { + this.pdfHistory.pushCurrentPosition(); + this.pdfHistory.pushPage(pageNumber); + } + this.pdfViewer.scrollPageIntoView({ + pageNumber + }); + } + addLinkAttributes(link, url, newWindow = false) { + if (!url || typeof url !== "string") { + throw new Error('A valid "url" parameter must provided.'); + } + const target = newWindow ? LinkTarget.BLANK : this.externalLinkTarget, + rel = this.externalLinkRel; + if (this.externalLinkEnabled) { + link.href = link.title = url; + } else { + link.href = ""; + link.title = `Disabled: ${url}`; + link.onclick = () => false; + } + let targetStr = ""; + switch (target) { + case LinkTarget.NONE: + break; + case LinkTarget.SELF: + targetStr = "_self"; + break; + case LinkTarget.BLANK: + targetStr = "_blank"; + break; + case LinkTarget.PARENT: + targetStr = "_parent"; + break; + case LinkTarget.TOP: + targetStr = "_top"; + break; + } + link.target = targetStr; + link.rel = typeof rel === "string" ? rel : DEFAULT_LINK_REL; + } + getDestinationHash(dest) { + if (typeof dest === "string") { + if (dest.length > 0) { + return this.getAnchorUrl("#" + escape(dest)); + } + } else if (Array.isArray(dest)) { + const str = JSON.stringify(dest); + if (str.length > 0) { + return this.getAnchorUrl("#" + escape(str)); + } + } + return this.getAnchorUrl(""); + } + getAnchorUrl(anchor) { + return this.baseUrl ? this.baseUrl + anchor : anchor; + } + setHash(hash) { + if (!this.pdfDocument) { + return; + } + let pageNumber, dest; + if (hash.includes("=")) { + const params = parseQueryString(hash); + if (params.has("search")) { + const query = params.get("search").replaceAll('"', ""), + phrase = params.get("phrase") === "true"; + this.eventBus.dispatch("findfromurlhash", { + source: this, + query: phrase ? query : query.match(/\S+/g) + }); + } + if (params.has("page")) { + pageNumber = params.get("page") | 0 || 1; + } + if (params.has("zoom")) { + const zoomArgs = params.get("zoom").split(","); + const zoomArg = zoomArgs[0]; + const zoomArgNumber = parseFloat(zoomArg); + if (!zoomArg.includes("Fit")) { + dest = [null, { + name: "XYZ" + }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg]; + } else if (zoomArg === "Fit" || zoomArg === "FitB") { + dest = [null, { + name: zoomArg + }]; + } else if (zoomArg === "FitH" || zoomArg === "FitBH" || zoomArg === "FitV" || zoomArg === "FitBV") { + dest = [null, { + name: zoomArg + }, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null]; + } else if (zoomArg === "FitR") { + if (zoomArgs.length !== 5) { + console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'); + } else { + dest = [null, { + name: zoomArg + }, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0]; + } + } else { + console.error(`PDFLinkService.setHash: "${zoomArg}" is not a valid zoom value.`); + } + } + if (dest) { + this.pdfViewer.scrollPageIntoView({ + pageNumber: pageNumber || this.page, + destArray: dest, + allowNegativeOffset: true + }); + } else if (pageNumber) { + this.page = pageNumber; + } + if (params.has("pagemode")) { + this.eventBus.dispatch("pagemode", { + source: this, + mode: params.get("pagemode") + }); + } + if (params.has("nameddest")) { + this.goToDestination(params.get("nameddest")); + } + return; + } + dest = unescape(hash); + try { + dest = JSON.parse(dest); + if (!Array.isArray(dest)) { + dest = dest.toString(); + } + } catch {} + if (typeof dest === "string" || isValidExplicitDest(dest)) { + this.goToDestination(dest); + return; + } + console.error(`PDFLinkService.setHash: "${unescape(hash)}" is not a valid destination.`); + } + executeNamedAction(action) { + if (!this.pdfDocument) { + return; + } + switch (action) { + case "GoBack": + this.pdfHistory?.back(); + break; + case "GoForward": + this.pdfHistory?.forward(); + break; + case "NextPage": + this.pdfViewer.nextPage(); + break; + case "PrevPage": + this.pdfViewer.previousPage(); + break; + case "LastPage": + this.page = this.pagesCount; + break; + case "FirstPage": + this.page = 1; + break; + default: + break; + } + this.eventBus.dispatch("namedaction", { + source: this, + action + }); + } + async executeSetOCGState(action) { + if (!this.pdfDocument) { + return; + } + const pdfDocument = this.pdfDocument, + optionalContentConfig = await this.pdfViewer.optionalContentConfigPromise; + if (pdfDocument !== this.pdfDocument) { + return; + } + optionalContentConfig.setOCGState(action); + this.pdfViewer.optionalContentConfigPromise = Promise.resolve(optionalContentConfig); + } +} +class SimpleLinkService extends PDFLinkService { + setDocument(pdfDocument, baseUrl = null) {} +} + +;// ./web/annotation_layer_builder.js + + +class AnnotationLayerBuilder { + #annotations = null; + #externalHide = false; + #onAppend = null; + #eventAbortController = null; + #linksInjected = false; + constructor({ + pdfPage, + linkService, + downloadManager, + annotationStorage = null, + imageResourcesPath = "", + renderForms = true, + enableScripting = false, + hasJSActionsPromise = null, + fieldObjectsPromise = null, + annotationCanvasMap = null, + accessibilityManager = null, + annotationEditorUIManager = null, + onAppend = null + }) { + this.pdfPage = pdfPage; + this.linkService = linkService; + this.downloadManager = downloadManager; + this.imageResourcesPath = imageResourcesPath; + this.renderForms = renderForms; + this.annotationStorage = annotationStorage; + this.enableScripting = enableScripting; + this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false); + this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null); + this._annotationCanvasMap = annotationCanvasMap; + this._accessibilityManager = accessibilityManager; + this._annotationEditorUIManager = annotationEditorUIManager; + this.#onAppend = onAppend; + this.annotationLayer = null; + this.div = null; + this._cancelled = false; + this._eventBus = linkService.eventBus; + } + async render({ + viewport, + intent = "display", + structTreeLayer = null + }) { + if (this.div) { + if (this._cancelled || !this.annotationLayer) { + return; + } + this.annotationLayer.update({ + viewport: viewport.clone({ + dontFlip: true + }) + }); + return; + } + const [annotations, hasJSActions, fieldObjects] = await Promise.all([this.pdfPage.getAnnotations({ + intent + }), this._hasJSActionsPromise, this._fieldObjectsPromise]); + if (this._cancelled) { + return; + } + const div = this.div = document.createElement("div"); + div.className = "annotationLayer"; + this.#onAppend?.(div); + if (annotations.length === 0) { + this.#annotations = annotations; + this.hide(true); + return; + } + this.#initAnnotationLayer(viewport, structTreeLayer); + await this.annotationLayer.render({ + annotations, + imageResourcesPath: this.imageResourcesPath, + renderForms: this.renderForms, + linkService: this.linkService, + downloadManager: this.downloadManager, + annotationStorage: this.annotationStorage, + enableScripting: this.enableScripting, + hasJSActions, + fieldObjects + }); + this.#annotations = annotations; + if (this.linkService.isInPresentationMode) { + this.#updatePresentationModeState(PresentationModeState.FULLSCREEN); + } + if (!this.#eventAbortController) { + this.#eventAbortController = new AbortController(); + this._eventBus?._on("presentationmodechanged", evt => { + this.#updatePresentationModeState(evt.state); + }, { + signal: this.#eventAbortController.signal + }); + } + } + #initAnnotationLayer(viewport, structTreeLayer) { + this.annotationLayer = new AnnotationLayer({ + div: this.div, + accessibilityManager: this._accessibilityManager, + annotationCanvasMap: this._annotationCanvasMap, + annotationEditorUIManager: this._annotationEditorUIManager, + page: this.pdfPage, + viewport: viewport.clone({ + dontFlip: true + }), + structTreeLayer + }); + } + cancel() { + this._cancelled = true; + this.#eventAbortController?.abort(); + this.#eventAbortController = null; + } + hide(internal = false) { + this.#externalHide = !internal; + if (!this.div) { + return; + } + this.div.hidden = true; + } + hasEditableAnnotations() { + return !!this.annotationLayer?.hasEditableAnnotations(); + } + async injectLinkAnnotations({ + inferredLinks, + viewport, + structTreeLayer = null + }) { + if (this.#annotations === null) { + throw new Error("`render` method must be called before `injectLinkAnnotations`."); + } + if (this._cancelled || this.#linksInjected) { + return; + } + this.#linksInjected = true; + const newLinks = this.#annotations.length ? this.#checkInferredLinks(inferredLinks) : inferredLinks; + if (!newLinks.length) { + return; + } + if (!this.annotationLayer) { + this.#initAnnotationLayer(viewport, structTreeLayer); + setLayerDimensions(this.div, viewport); + } + await this.annotationLayer.addLinkAnnotations(newLinks, this.linkService); + if (!this.#externalHide) { + this.div.hidden = false; + } + } + #updatePresentationModeState(state) { + if (!this.div) { + return; + } + let disableFormElements = false; + switch (state) { + case PresentationModeState.FULLSCREEN: + disableFormElements = true; + break; + case PresentationModeState.NORMAL: + break; + default: + return; + } + for (const section of this.div.childNodes) { + if (section.hasAttribute("data-internal-link")) { + continue; + } + section.inert = disableFormElements; + } + } + #checkInferredLinks(inferredLinks) { + function annotationRects(annot) { + if (!annot.quadPoints) { + return [annot.rect]; + } + const rects = []; + for (let i = 2, ii = annot.quadPoints.length; i < ii; i += 8) { + const trX = annot.quadPoints[i]; + const trY = annot.quadPoints[i + 1]; + const blX = annot.quadPoints[i + 2]; + const blY = annot.quadPoints[i + 3]; + rects.push([blX, blY, trX, trY]); + } + return rects; + } + function intersectAnnotations(annot1, annot2) { + const intersections = []; + const annot1Rects = annotationRects(annot1); + const annot2Rects = annotationRects(annot2); + for (const rect1 of annot1Rects) { + for (const rect2 of annot2Rects) { + const intersection = Util.intersect(rect1, rect2); + if (intersection) { + intersections.push(intersection); + } + } + } + return intersections; + } + function areaRects(rects) { + let totalArea = 0; + for (const rect of rects) { + totalArea += Math.abs((rect[2] - rect[0]) * (rect[3] - rect[1])); + } + return totalArea; + } + return inferredLinks.filter(link => { + let linkAreaRects; + for (const annotation of this.#annotations) { + if (annotation.annotationType !== AnnotationType.LINK || !annotation.url) { + continue; + } + const intersections = intersectAnnotations(annotation, link); + if (intersections.length === 0) { + continue; + } + linkAreaRects ??= areaRects(annotationRects(link)); + if (areaRects(intersections) / linkAreaRects > 0.5) { + return false; + } + } + return true; + }); + } +} + +;// ./web/download_manager.js + +function download(blobUrl, filename) { + const a = document.createElement("a"); + if (!a.click) { + throw new Error('DownloadManager: "a.click()" is not supported.'); + } + a.href = blobUrl; + a.target = "_parent"; + if ("download" in a) { + a.download = filename; + } + (document.body || document.documentElement).append(a); + a.click(); + a.remove(); +} +class DownloadManager { + #openBlobUrls = new WeakMap(); + downloadData(data, filename, contentType) { + const blobUrl = URL.createObjectURL(new Blob([data], { + type: contentType + })); + download(blobUrl, filename); + } + openOrDownloadData(data, filename, dest = null) { + const isPdfData = isPdfFile(filename); + const contentType = isPdfData ? "application/pdf" : ""; + this.downloadData(data, filename, contentType); + return false; + } + download(data, url, filename) { + let blobUrl; + if (data) { + blobUrl = URL.createObjectURL(new Blob([data], { + type: "application/pdf" + })); + } else { + if (!createValidAbsoluteUrl(url, "http://example.com")) { + console.error(`download - not a valid URL: ${url}`); + return; + } + blobUrl = url + "#pdfjs.action=download"; + } + download(blobUrl, filename); + } +} + +;// ./web/event_utils.js +const WaitOnType = { + EVENT: "event", + TIMEOUT: "timeout" +}; +async function waitOnEventOrTimeout({ + target, + name, + delay = 0 +}) { + if (typeof target !== "object" || !(name && typeof name === "string") || !(Number.isInteger(delay) && delay >= 0)) { + throw new Error("waitOnEventOrTimeout - invalid parameters."); + } + const { + promise, + resolve + } = Promise.withResolvers(); + const ac = new AbortController(); + function handler(type) { + ac.abort(); + clearTimeout(timeout); + resolve(type); + } + const evtMethod = target instanceof EventBus ? "_on" : "addEventListener"; + target[evtMethod](name, handler.bind(null, WaitOnType.EVENT), { + signal: ac.signal + }); + const timeout = setTimeout(handler.bind(null, WaitOnType.TIMEOUT), delay); + return promise; +} +class EventBus { + #listeners = Object.create(null); + on(eventName, listener, options = null) { + this._on(eventName, listener, { + external: true, + once: options?.once, + signal: options?.signal + }); + } + off(eventName, listener, options = null) { + this._off(eventName, listener); + } + dispatch(eventName, data) { + const eventListeners = this.#listeners[eventName]; + if (!eventListeners || eventListeners.length === 0) { + return; + } + let externalListeners; + for (const { + listener, + external, + once + } of eventListeners.slice(0)) { + if (once) { + this._off(eventName, listener); + } + if (external) { + (externalListeners ||= []).push(listener); + continue; + } + listener(data); + } + if (externalListeners) { + for (const listener of externalListeners) { + listener(data); + } + externalListeners = null; + } + } + _on(eventName, listener, options = null) { + let rmAbort = null; + if (options?.signal instanceof AbortSignal) { + const { + signal + } = options; + if (signal.aborted) { + console.error("Cannot use an `aborted` signal."); + return; + } + const onAbort = () => this._off(eventName, listener); + rmAbort = () => signal.removeEventListener("abort", onAbort); + signal.addEventListener("abort", onAbort); + } + const eventListeners = this.#listeners[eventName] ||= []; + eventListeners.push({ + listener, + external: options?.external === true, + once: options?.once === true, + rmAbort + }); + } + _off(eventName, listener, options = null) { + const eventListeners = this.#listeners[eventName]; + if (!eventListeners) { + return; + } + for (let i = 0, ii = eventListeners.length; i < ii; i++) { + const evt = eventListeners[i]; + if (evt.listener === listener) { + evt.rmAbort?.(); + eventListeners.splice(i, 1); + return; + } + } + } +} +class FirefoxEventBus extends EventBus { + #externalServices; + #globalEventNames; + #isInAutomation; + constructor(globalEventNames, externalServices, isInAutomation) { + super(); + this.#globalEventNames = globalEventNames; + this.#externalServices = externalServices; + this.#isInAutomation = isInAutomation; + } + dispatch(eventName, data) { + throw new Error("Not implemented: FirefoxEventBus.dispatch"); + } +} + +;// ./node_modules/@fluent/bundle/esm/types.js +class FluentType { + constructor(value) { + this.value = value; + } + valueOf() { + return this.value; + } +} +class FluentNone extends FluentType { + constructor(value = "???") { + super(value); + } + toString(scope) { + return `{${this.value}}`; + } +} +class FluentNumber extends FluentType { + constructor(value, opts = {}) { + super(value); + this.opts = opts; + } + toString(scope) { + if (scope) { + try { + const nf = scope.memoizeIntlObject(Intl.NumberFormat, this.opts); + return nf.format(this.value); + } catch (err) { + scope.reportError(err); + } + } + return this.value.toString(10); + } +} +class FluentDateTime extends FluentType { + static supportsValue(value) { + if (typeof value === "number") return true; + if (value instanceof Date) return true; + if (value instanceof FluentType) return FluentDateTime.supportsValue(value.valueOf()); + if ("Temporal" in globalThis) { + const _Temporal = globalThis.Temporal; + if (value instanceof _Temporal.Instant || value instanceof _Temporal.PlainDateTime || value instanceof _Temporal.PlainDate || value instanceof _Temporal.PlainMonthDay || value instanceof _Temporal.PlainTime || value instanceof _Temporal.PlainYearMonth) { + return true; + } + } + return false; + } + constructor(value, opts = {}) { + if (value instanceof FluentDateTime) { + opts = { + ...value.opts, + ...opts + }; + value = value.value; + } else if (value instanceof FluentType) { + value = value.valueOf(); + } + if (typeof value === "object" && "calendarId" in value && opts.calendar === undefined) { + opts = { + ...opts, + calendar: value.calendarId + }; + } + super(value); + this.opts = opts; + } + [Symbol.toPrimitive](hint) { + return hint === "string" ? this.toString() : this.toNumber(); + } + toNumber() { + const value = this.value; + if (typeof value === "number") return value; + if (value instanceof Date) return value.getTime(); + if ("epochMilliseconds" in value) { + return value.epochMilliseconds; + } + if ("toZonedDateTime" in value) { + return value.toZonedDateTime("UTC").epochMilliseconds; + } + throw new TypeError("Unwrapping a non-number value as a number"); + } + toString(scope) { + if (scope) { + try { + const dtf = scope.memoizeIntlObject(Intl.DateTimeFormat, this.opts); + return dtf.format(this.value); + } catch (err) { + scope.reportError(err); + } + } + if (typeof this.value === "number" || this.value instanceof Date) { + return new Date(this.value).toISOString(); + } + return this.value.toString(); + } +} +;// ./node_modules/@fluent/bundle/esm/resolver.js + +const MAX_PLACEABLES = 100; +const FSI = "\u2068"; +const PDI = "\u2069"; +function match(scope, selector, key) { + if (key === selector) { + return true; + } + if (key instanceof FluentNumber && selector instanceof FluentNumber && key.value === selector.value) { + return true; + } + if (selector instanceof FluentNumber && typeof key === "string") { + let category = scope.memoizeIntlObject(Intl.PluralRules, selector.opts).select(selector.value); + if (key === category) { + return true; + } + } + return false; +} +function getDefault(scope, variants, star) { + if (variants[star]) { + return resolvePattern(scope, variants[star].value); + } + scope.reportError(new RangeError("No default")); + return new FluentNone(); +} +function getArguments(scope, args) { + const positional = []; + const named = Object.create(null); + for (const arg of args) { + if (arg.type === "narg") { + named[arg.name] = resolveExpression(scope, arg.value); + } else { + positional.push(resolveExpression(scope, arg)); + } + } + return { + positional, + named + }; +} +function resolveExpression(scope, expr) { + switch (expr.type) { + case "str": + return expr.value; + case "num": + return new FluentNumber(expr.value, { + minimumFractionDigits: expr.precision + }); + case "var": + return resolveVariableReference(scope, expr); + case "mesg": + return resolveMessageReference(scope, expr); + case "term": + return resolveTermReference(scope, expr); + case "func": + return resolveFunctionReference(scope, expr); + case "select": + return resolveSelectExpression(scope, expr); + default: + return new FluentNone(); + } +} +function resolveVariableReference(scope, { + name +}) { + let arg; + if (scope.params) { + if (Object.prototype.hasOwnProperty.call(scope.params, name)) { + arg = scope.params[name]; + } else { + return new FluentNone(`$${name}`); + } + } else if (scope.args && Object.prototype.hasOwnProperty.call(scope.args, name)) { + arg = scope.args[name]; + } else { + scope.reportError(new ReferenceError(`Unknown variable: $${name}`)); + return new FluentNone(`$${name}`); + } + if (arg instanceof FluentType) { + return arg; + } + switch (typeof arg) { + case "string": + return arg; + case "number": + return new FluentNumber(arg); + case "object": + if (FluentDateTime.supportsValue(arg)) { + return new FluentDateTime(arg); + } + default: + scope.reportError(new TypeError(`Variable type not supported: $${name}, ${typeof arg}`)); + return new FluentNone(`$${name}`); + } +} +function resolveMessageReference(scope, { + name, + attr +}) { + const message = scope.bundle._messages.get(name); + if (!message) { + scope.reportError(new ReferenceError(`Unknown message: ${name}`)); + return new FluentNone(name); + } + if (attr) { + const attribute = message.attributes[attr]; + if (attribute) { + return resolvePattern(scope, attribute); + } + scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`)); + return new FluentNone(`${name}.${attr}`); + } + if (message.value) { + return resolvePattern(scope, message.value); + } + scope.reportError(new ReferenceError(`No value: ${name}`)); + return new FluentNone(name); +} +function resolveTermReference(scope, { + name, + attr, + args +}) { + const id = `-${name}`; + const term = scope.bundle._terms.get(id); + if (!term) { + scope.reportError(new ReferenceError(`Unknown term: ${id}`)); + return new FluentNone(id); + } + if (attr) { + const attribute = term.attributes[attr]; + if (attribute) { + scope.params = getArguments(scope, args).named; + const resolved = resolvePattern(scope, attribute); + scope.params = null; + return resolved; + } + scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`)); + return new FluentNone(`${id}.${attr}`); + } + scope.params = getArguments(scope, args).named; + const resolved = resolvePattern(scope, term.value); + scope.params = null; + return resolved; +} +function resolveFunctionReference(scope, { + name, + args +}) { + let func = scope.bundle._functions[name]; + if (!func) { + scope.reportError(new ReferenceError(`Unknown function: ${name}()`)); + return new FluentNone(`${name}()`); + } + if (typeof func !== "function") { + scope.reportError(new TypeError(`Function ${name}() is not callable`)); + return new FluentNone(`${name}()`); + } + try { + let resolved = getArguments(scope, args); + return func(resolved.positional, resolved.named); + } catch (err) { + scope.reportError(err); + return new FluentNone(`${name}()`); + } +} +function resolveSelectExpression(scope, { + selector, + variants, + star +}) { + let sel = resolveExpression(scope, selector); + if (sel instanceof FluentNone) { + return getDefault(scope, variants, star); + } + for (const variant of variants) { + const key = resolveExpression(scope, variant.key); + if (match(scope, sel, key)) { + return resolvePattern(scope, variant.value); + } + } + return getDefault(scope, variants, star); +} +function resolveComplexPattern(scope, ptn) { + if (scope.dirty.has(ptn)) { + scope.reportError(new RangeError("Cyclic reference")); + return new FluentNone(); + } + scope.dirty.add(ptn); + const result = []; + const useIsolating = scope.bundle._useIsolating && ptn.length > 1; + for (const elem of ptn) { + if (typeof elem === "string") { + result.push(scope.bundle._transform(elem)); + continue; + } + scope.placeables++; + if (scope.placeables > MAX_PLACEABLES) { + scope.dirty.delete(ptn); + throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` + `max allowed is ${MAX_PLACEABLES}`); + } + if (useIsolating) { + result.push(FSI); + } + result.push(resolveExpression(scope, elem).toString(scope)); + if (useIsolating) { + result.push(PDI); + } + } + scope.dirty.delete(ptn); + return result.join(""); +} +function resolvePattern(scope, value) { + if (typeof value === "string") { + return scope.bundle._transform(value); + } + return resolveComplexPattern(scope, value); +} +;// ./node_modules/@fluent/bundle/esm/scope.js +class Scope { + constructor(bundle, errors, args) { + this.dirty = new WeakSet(); + this.params = null; + this.placeables = 0; + this.bundle = bundle; + this.errors = errors; + this.args = args; + } + reportError(error) { + if (!this.errors || !(error instanceof Error)) { + throw error; + } + this.errors.push(error); + } + memoizeIntlObject(ctor, opts) { + let cache = this.bundle._intls.get(ctor); + if (!cache) { + cache = {}; + this.bundle._intls.set(ctor, cache); + } + let id = JSON.stringify(opts); + if (!cache[id]) { + cache[id] = new ctor(this.bundle.locales, opts); + } + return cache[id]; + } +} +;// ./node_modules/@fluent/bundle/esm/builtins.js + +function values(opts, allowed) { + const unwrapped = Object.create(null); + for (const [name, opt] of Object.entries(opts)) { + if (allowed.includes(name)) { + unwrapped[name] = opt.valueOf(); + } + } + return unwrapped; +} +const NUMBER_ALLOWED = ["unitDisplay", "currencyDisplay", "useGrouping", "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "minimumSignificantDigits", "maximumSignificantDigits"]; +function NUMBER(args, opts) { + let arg = args[0]; + if (arg instanceof FluentNone) { + return new FluentNone(`NUMBER(${arg.valueOf()})`); + } + if (arg instanceof FluentNumber) { + return new FluentNumber(arg.valueOf(), { + ...arg.opts, + ...values(opts, NUMBER_ALLOWED) + }); + } + if (arg instanceof FluentDateTime) { + return new FluentNumber(arg.toNumber(), { + ...values(opts, NUMBER_ALLOWED) + }); + } + throw new TypeError("Invalid argument to NUMBER"); +} +const DATETIME_ALLOWED = ["dateStyle", "timeStyle", "fractionalSecondDigits", "dayPeriod", "hour12", "weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName"]; +function DATETIME(args, opts) { + let arg = args[0]; + if (arg instanceof FluentNone) { + return new FluentNone(`DATETIME(${arg.valueOf()})`); + } + if (arg instanceof FluentDateTime || arg instanceof FluentNumber) { + return new FluentDateTime(arg, values(opts, DATETIME_ALLOWED)); + } + throw new TypeError("Invalid argument to DATETIME"); +} +;// ./node_modules/@fluent/bundle/esm/memoizer.js +const cache = new Map(); +function getMemoizerForLocale(locales) { + const stringLocale = Array.isArray(locales) ? locales.join(" ") : locales; + let memoizer = cache.get(stringLocale); + if (memoizer === undefined) { + memoizer = new Map(); + cache.set(stringLocale, memoizer); + } + return memoizer; +} +;// ./node_modules/@fluent/bundle/esm/bundle.js + + + + + +class FluentBundle { + constructor(locales, { + functions, + useIsolating = true, + transform = v => v + } = {}) { + this._terms = new Map(); + this._messages = new Map(); + this.locales = Array.isArray(locales) ? locales : [locales]; + this._functions = { + NUMBER: NUMBER, + DATETIME: DATETIME, + ...functions + }; + this._useIsolating = useIsolating; + this._transform = transform; + this._intls = getMemoizerForLocale(locales); + } + hasMessage(id) { + return this._messages.has(id); + } + getMessage(id) { + return this._messages.get(id); + } + addResource(res, { + allowOverrides = false + } = {}) { + const errors = []; + for (let i = 0; i < res.body.length; i++) { + let entry = res.body[i]; + if (entry.id.startsWith("-")) { + if (allowOverrides === false && this._terms.has(entry.id)) { + errors.push(new Error(`Attempt to override an existing term: "${entry.id}"`)); + continue; + } + this._terms.set(entry.id, entry); + } else { + if (allowOverrides === false && this._messages.has(entry.id)) { + errors.push(new Error(`Attempt to override an existing message: "${entry.id}"`)); + continue; + } + this._messages.set(entry.id, entry); + } + } + return errors; + } + formatPattern(pattern, args = null, errors = null) { + if (typeof pattern === "string") { + return this._transform(pattern); + } + let scope = new Scope(this, errors, args); + try { + let value = resolveComplexPattern(scope, pattern); + return value.toString(scope); + } catch (err) { + if (scope.errors && err instanceof Error) { + scope.errors.push(err); + return new FluentNone().toString(scope); + } + throw err; + } + } +} +;// ./node_modules/@fluent/bundle/esm/resource.js +const RE_MESSAGE_START = /^(-?[a-zA-Z][\w-]*) *= */gm; +const RE_ATTRIBUTE_START = /\.([a-zA-Z][\w-]*) *= */y; +const RE_VARIANT_START = /\*?\[/y; +const RE_NUMBER_LITERAL = /(-?[0-9]+(?:\.([0-9]+))?)/y; +const RE_IDENTIFIER = /([a-zA-Z][\w-]*)/y; +const RE_REFERENCE = /([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y; +const RE_FUNCTION_NAME = /^[A-Z][A-Z0-9_-]*$/; +const RE_TEXT_RUN = /([^{}\n\r]+)/y; +const RE_STRING_RUN = /([^\\"\n\r]*)/y; +const RE_STRING_ESCAPE = /\\([\\"])/y; +const RE_UNICODE_ESCAPE = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y; +const RE_LEADING_NEWLINES = /^\n+/; +const RE_TRAILING_SPACES = / +$/; +const RE_BLANK_LINES = / *\r?\n/g; +const RE_INDENT = /( *)$/; +const TOKEN_BRACE_OPEN = /{\s*/y; +const TOKEN_BRACE_CLOSE = /\s*}/y; +const TOKEN_BRACKET_OPEN = /\[\s*/y; +const TOKEN_BRACKET_CLOSE = /\s*] */y; +const TOKEN_PAREN_OPEN = /\s*\(\s*/y; +const TOKEN_ARROW = /\s*->\s*/y; +const TOKEN_COLON = /\s*:\s*/y; +const TOKEN_COMMA = /\s*,?\s*/y; +const TOKEN_BLANK = /\s+/y; +class FluentResource { + constructor(source) { + this.body = []; + RE_MESSAGE_START.lastIndex = 0; + let cursor = 0; + while (true) { + let next = RE_MESSAGE_START.exec(source); + if (next === null) { + break; + } + cursor = RE_MESSAGE_START.lastIndex; + try { + this.body.push(parseMessage(next[1])); + } catch (err) { + if (err instanceof SyntaxError) { + continue; + } + throw err; + } + } + function test(re) { + re.lastIndex = cursor; + return re.test(source); + } + function consumeChar(char, errorClass) { + if (source[cursor] === char) { + cursor++; + return true; + } + if (errorClass) { + throw new errorClass(`Expected ${char}`); + } + return false; + } + function consumeToken(re, errorClass) { + if (test(re)) { + cursor = re.lastIndex; + return true; + } + if (errorClass) { + throw new errorClass(`Expected ${re.toString()}`); + } + return false; + } + function match(re) { + re.lastIndex = cursor; + let result = re.exec(source); + if (result === null) { + throw new SyntaxError(`Expected ${re.toString()}`); + } + cursor = re.lastIndex; + return result; + } + function match1(re) { + return match(re)[1]; + } + function parseMessage(id) { + let value = parsePattern(); + let attributes = parseAttributes(); + if (value === null && Object.keys(attributes).length === 0) { + throw new SyntaxError("Expected message value or attributes"); + } + return { + id, + value, + attributes + }; + } + function parseAttributes() { + let attrs = Object.create(null); + while (test(RE_ATTRIBUTE_START)) { + let name = match1(RE_ATTRIBUTE_START); + let value = parsePattern(); + if (value === null) { + throw new SyntaxError("Expected attribute value"); + } + attrs[name] = value; + } + return attrs; + } + function parsePattern() { + let first; + if (test(RE_TEXT_RUN)) { + first = match1(RE_TEXT_RUN); + } + if (source[cursor] === "{" || source[cursor] === "}") { + return parsePatternElements(first ? [first] : [], Infinity); + } + let indent = parseIndent(); + if (indent) { + if (first) { + return parsePatternElements([first, indent], indent.length); + } + indent.value = trim(indent.value, RE_LEADING_NEWLINES); + return parsePatternElements([indent], indent.length); + } + if (first) { + return trim(first, RE_TRAILING_SPACES); + } + return null; + } + function parsePatternElements(elements = [], commonIndent) { + while (true) { + if (test(RE_TEXT_RUN)) { + elements.push(match1(RE_TEXT_RUN)); + continue; + } + if (source[cursor] === "{") { + elements.push(parsePlaceable()); + continue; + } + if (source[cursor] === "}") { + throw new SyntaxError("Unbalanced closing brace"); + } + let indent = parseIndent(); + if (indent) { + elements.push(indent); + commonIndent = Math.min(commonIndent, indent.length); + continue; + } + break; + } + let lastIndex = elements.length - 1; + let lastElement = elements[lastIndex]; + if (typeof lastElement === "string") { + elements[lastIndex] = trim(lastElement, RE_TRAILING_SPACES); + } + let baked = []; + for (let element of elements) { + if (element instanceof Indent) { + element = element.value.slice(0, element.value.length - commonIndent); + } + if (element) { + baked.push(element); + } + } + return baked; + } + function parsePlaceable() { + consumeToken(TOKEN_BRACE_OPEN, SyntaxError); + let selector = parseInlineExpression(); + if (consumeToken(TOKEN_BRACE_CLOSE)) { + return selector; + } + if (consumeToken(TOKEN_ARROW)) { + let variants = parseVariants(); + consumeToken(TOKEN_BRACE_CLOSE, SyntaxError); + return { + type: "select", + selector, + ...variants + }; + } + throw new SyntaxError("Unclosed placeable"); + } + function parseInlineExpression() { + if (source[cursor] === "{") { + return parsePlaceable(); + } + if (test(RE_REFERENCE)) { + let [, sigil, name, attr = null] = match(RE_REFERENCE); + if (sigil === "$") { + return { + type: "var", + name + }; + } + if (consumeToken(TOKEN_PAREN_OPEN)) { + let args = parseArguments(); + if (sigil === "-") { + return { + type: "term", + name, + attr, + args + }; + } + if (RE_FUNCTION_NAME.test(name)) { + return { + type: "func", + name, + args + }; + } + throw new SyntaxError("Function names must be all upper-case"); + } + if (sigil === "-") { + return { + type: "term", + name, + attr, + args: [] + }; + } + return { + type: "mesg", + name, + attr + }; + } + return parseLiteral(); + } + function parseArguments() { + let args = []; + while (true) { + switch (source[cursor]) { + case ")": + cursor++; + return args; + case undefined: + throw new SyntaxError("Unclosed argument list"); + } + args.push(parseArgument()); + consumeToken(TOKEN_COMMA); + } + } + function parseArgument() { + let expr = parseInlineExpression(); + if (expr.type !== "mesg") { + return expr; + } + if (consumeToken(TOKEN_COLON)) { + return { + type: "narg", + name: expr.name, + value: parseLiteral() + }; + } + return expr; + } + function parseVariants() { + let variants = []; + let count = 0; + let star; + while (test(RE_VARIANT_START)) { + if (consumeChar("*")) { + star = count; + } + let key = parseVariantKey(); + let value = parsePattern(); + if (value === null) { + throw new SyntaxError("Expected variant value"); + } + variants[count++] = { + key, + value + }; + } + if (count === 0) { + return null; + } + if (star === undefined) { + throw new SyntaxError("Expected default variant"); + } + return { + variants, + star + }; + } + function parseVariantKey() { + consumeToken(TOKEN_BRACKET_OPEN, SyntaxError); + let key; + if (test(RE_NUMBER_LITERAL)) { + key = parseNumberLiteral(); + } else { + key = { + type: "str", + value: match1(RE_IDENTIFIER) + }; + } + consumeToken(TOKEN_BRACKET_CLOSE, SyntaxError); + return key; + } + function parseLiteral() { + if (test(RE_NUMBER_LITERAL)) { + return parseNumberLiteral(); + } + if (source[cursor] === '"') { + return parseStringLiteral(); + } + throw new SyntaxError("Invalid expression"); + } + function parseNumberLiteral() { + let [, value, fraction = ""] = match(RE_NUMBER_LITERAL); + let precision = fraction.length; + return { + type: "num", + value: parseFloat(value), + precision + }; + } + function parseStringLiteral() { + consumeChar('"', SyntaxError); + let value = ""; + while (true) { + value += match1(RE_STRING_RUN); + if (source[cursor] === "\\") { + value += parseEscapeSequence(); + continue; + } + if (consumeChar('"')) { + return { + type: "str", + value + }; + } + throw new SyntaxError("Unclosed string literal"); + } + } + function parseEscapeSequence() { + if (test(RE_STRING_ESCAPE)) { + return match1(RE_STRING_ESCAPE); + } + if (test(RE_UNICODE_ESCAPE)) { + let [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE); + let codepoint = parseInt(codepoint4 || codepoint6, 16); + return codepoint <= 0xd7ff || 0xe000 <= codepoint ? String.fromCodePoint(codepoint) : "�"; + } + throw new SyntaxError("Unknown escape sequence"); + } + function parseIndent() { + let start = cursor; + consumeToken(TOKEN_BLANK); + switch (source[cursor]) { + case ".": + case "[": + case "*": + case "}": + case undefined: + return false; + case "{": + return makeIndent(source.slice(start, cursor)); + } + if (source[cursor - 1] === " ") { + return makeIndent(source.slice(start, cursor)); + } + return false; + } + function trim(text, re) { + return text.replace(re, ""); + } + function makeIndent(blank) { + let value = blank.replace(RE_BLANK_LINES, "\n"); + let length = RE_INDENT.exec(blank)[1].length; + return new Indent(value, length); + } + } +} +class Indent { + constructor(value, length) { + this.value = value; + this.length = length; + } +} +;// ./node_modules/@fluent/bundle/esm/index.js + + + +;// ./node_modules/@fluent/dom/esm/overlay.js +const reOverlay = /<|&#?\w+;/; +const TEXT_LEVEL_ELEMENTS = { + "http://www.w3.org/1999/xhtml": ["em", "strong", "small", "s", "cite", "q", "dfn", "abbr", "data", "time", "code", "var", "samp", "kbd", "sub", "sup", "i", "b", "u", "mark", "bdi", "bdo", "span", "br", "wbr"] +}; +const LOCALIZABLE_ATTRIBUTES = { + "http://www.w3.org/1999/xhtml": { + global: ["title", "aria-description", "aria-label", "aria-valuetext"], + a: ["download"], + area: ["download", "alt"], + input: ["alt", "placeholder"], + menuitem: ["label"], + menu: ["label"], + optgroup: ["label"], + option: ["label"], + track: ["label"], + img: ["alt"], + textarea: ["placeholder"], + th: ["abbr"] + }, + "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul": { + global: ["accesskey", "aria-label", "aria-valuetext", "label", "title", "tooltiptext"], + description: ["value"], + key: ["key", "keycode"], + label: ["value"], + textbox: ["placeholder", "value"] + } +}; +function translateElement(element, translation) { + const { + value + } = translation; + if (typeof value === "string") { + if (element.localName === "title" && element.namespaceURI === "http://www.w3.org/1999/xhtml") { + element.textContent = value; + } else if (!reOverlay.test(value)) { + element.textContent = value; + } else { + const templateElement = element.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml", "template"); + templateElement.innerHTML = value; + overlayChildNodes(templateElement.content, element); + } + } + overlayAttributes(translation, element); +} +function overlayChildNodes(fromFragment, toElement) { + for (const childNode of fromFragment.childNodes) { + if (childNode.nodeType === childNode.TEXT_NODE) { + continue; + } + if (childNode.hasAttribute("data-l10n-name")) { + const sanitized = getNodeForNamedElement(toElement, childNode); + fromFragment.replaceChild(sanitized, childNode); + continue; + } + if (isElementAllowed(childNode)) { + const sanitized = createSanitizedElement(childNode); + fromFragment.replaceChild(sanitized, childNode); + continue; + } + console.warn(`An element of forbidden type "${childNode.localName}" was found in ` + "the translation. Only safe text-level elements and elements with " + "data-l10n-name are allowed."); + fromFragment.replaceChild(createTextNodeFromTextContent(childNode), childNode); + } + toElement.textContent = ""; + toElement.appendChild(fromFragment); +} +function hasAttribute(attributes, name) { + if (!attributes) { + return false; + } + for (let attr of attributes) { + if (attr.name === name) { + return true; + } + } + return false; +} +function overlayAttributes(fromElement, toElement) { + const explicitlyAllowed = toElement.hasAttribute("data-l10n-attrs") ? toElement.getAttribute("data-l10n-attrs").split(",").map(i => i.trim()) : null; + for (const attr of Array.from(toElement.attributes)) { + if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && !hasAttribute(fromElement.attributes, attr.name)) { + toElement.removeAttribute(attr.name); + } + } + if (!fromElement.attributes) { + return; + } + for (const attr of Array.from(fromElement.attributes)) { + if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) && toElement.getAttribute(attr.name) !== attr.value) { + toElement.setAttribute(attr.name, attr.value); + } + } +} +function getNodeForNamedElement(sourceElement, translatedChild) { + const childName = translatedChild.getAttribute("data-l10n-name"); + const sourceChild = sourceElement.querySelector(`[data-l10n-name="${childName}"]`); + if (!sourceChild) { + console.warn(`An element named "${childName}" wasn't found in the source.`); + return createTextNodeFromTextContent(translatedChild); + } + if (sourceChild.localName !== translatedChild.localName) { + console.warn(`An element named "${childName}" was found in the translation ` + `but its type ${translatedChild.localName} didn't match the ` + `element found in the source (${sourceChild.localName}).`); + return createTextNodeFromTextContent(translatedChild); + } + sourceElement.removeChild(sourceChild); + const clone = sourceChild.cloneNode(false); + return shallowPopulateUsing(translatedChild, clone); +} +function createSanitizedElement(element) { + const clone = element.ownerDocument.createElement(element.localName); + return shallowPopulateUsing(element, clone); +} +function createTextNodeFromTextContent(element) { + return element.ownerDocument.createTextNode(element.textContent); +} +function isElementAllowed(element) { + const allowed = TEXT_LEVEL_ELEMENTS[element.namespaceURI]; + return allowed && allowed.includes(element.localName); +} +function isAttrNameLocalizable(name, element, explicitlyAllowed = null) { + if (explicitlyAllowed && explicitlyAllowed.includes(name)) { + return true; + } + const allowed = LOCALIZABLE_ATTRIBUTES[element.namespaceURI]; + if (!allowed) { + return false; + } + const attrName = name.toLowerCase(); + const elemName = element.localName; + if (allowed.global.includes(attrName)) { + return true; + } + if (!allowed[elemName]) { + return false; + } + if (allowed[elemName].includes(attrName)) { + return true; + } + if (element.namespaceURI === "http://www.w3.org/1999/xhtml" && elemName === "input" && attrName === "value") { + const type = element.type.toLowerCase(); + if (type === "submit" || type === "button" || type === "reset") { + return true; + } + } + return false; +} +function shallowPopulateUsing(fromElement, toElement) { + toElement.textContent = fromElement.textContent; + overlayAttributes(fromElement, toElement); + return toElement; +} +;// ./node_modules/cached-iterable/src/cached_iterable.mjs +class CachedIterable extends Array { + static from(iterable) { + if (iterable instanceof this) { + return iterable; + } + return new this(iterable); + } +} +;// ./node_modules/cached-iterable/src/cached_sync_iterable.mjs + +class CachedSyncIterable extends CachedIterable { + constructor(iterable) { + super(); + if (Symbol.iterator in Object(iterable)) { + this.iterator = iterable[Symbol.iterator](); + } else { + throw new TypeError("Argument must implement the iteration protocol."); + } + } + [Symbol.iterator]() { + const cached = this; + let cur = 0; + return { + next() { + if (cached.length <= cur) { + cached.push(cached.iterator.next()); + } + return cached[cur++]; + } + }; + } + touchNext(count = 1) { + let idx = 0; + while (idx++ < count) { + const last = this[this.length - 1]; + if (last && last.done) { + break; + } + this.push(this.iterator.next()); + } + return this[this.length - 1]; + } +} +;// ./node_modules/cached-iterable/src/cached_async_iterable.mjs + +class CachedAsyncIterable extends CachedIterable { + constructor(iterable) { + super(); + if (Symbol.asyncIterator in Object(iterable)) { + this.iterator = iterable[Symbol.asyncIterator](); + } else if (Symbol.iterator in Object(iterable)) { + this.iterator = iterable[Symbol.iterator](); + } else { + throw new TypeError("Argument must implement the iteration protocol."); + } + } + [Symbol.asyncIterator]() { + const cached = this; + let cur = 0; + return { + async next() { + if (cached.length <= cur) { + cached.push(cached.iterator.next()); + } + return cached[cur++]; + } + }; + } + async touchNext(count = 1) { + let idx = 0; + while (idx++ < count) { + const last = this[this.length - 1]; + if (last && (await last).done) { + break; + } + this.push(this.iterator.next()); + } + return this[this.length - 1]; + } +} +;// ./node_modules/cached-iterable/src/index.mjs + + +;// ./node_modules/@fluent/dom/esm/localization.js + +class Localization { + constructor(resourceIds = [], generateBundles) { + this.resourceIds = resourceIds; + this.generateBundles = generateBundles; + this.onChange(true); + } + addResourceIds(resourceIds, eager = false) { + this.resourceIds.push(...resourceIds); + this.onChange(eager); + return this.resourceIds.length; + } + removeResourceIds(resourceIds) { + this.resourceIds = this.resourceIds.filter(r => !resourceIds.includes(r)); + this.onChange(); + return this.resourceIds.length; + } + async formatWithFallback(keys, method) { + const translations = []; + let hasAtLeastOneBundle = false; + for await (const bundle of this.bundles) { + hasAtLeastOneBundle = true; + const missingIds = keysFromBundle(method, bundle, keys, translations); + if (missingIds.size === 0) { + break; + } + if (typeof console !== "undefined") { + const locale = bundle.locales[0]; + const ids = Array.from(missingIds).join(", "); + console.warn(`[fluent] Missing translations in ${locale}: ${ids}`); + } + } + if (!hasAtLeastOneBundle && typeof console !== "undefined") { + console.warn(`[fluent] Request for keys failed because no resource bundles got generated. + keys: ${JSON.stringify(keys)}. + resourceIds: ${JSON.stringify(this.resourceIds)}.`); + } + return translations; + } + formatMessages(keys) { + return this.formatWithFallback(keys, messageFromBundle); + } + formatValues(keys) { + return this.formatWithFallback(keys, valueFromBundle); + } + async formatValue(id, args) { + const [val] = await this.formatValues([{ + id, + args + }]); + return val; + } + handleEvent() { + this.onChange(); + } + onChange(eager = false) { + this.bundles = CachedAsyncIterable.from(this.generateBundles(this.resourceIds)); + if (eager) { + this.bundles.touchNext(2); + } + } +} +function valueFromBundle(bundle, errors, message, args) { + if (message.value) { + return bundle.formatPattern(message.value, args, errors); + } + return null; +} +function messageFromBundle(bundle, errors, message, args) { + const formatted = { + value: null, + attributes: null + }; + if (message.value) { + formatted.value = bundle.formatPattern(message.value, args, errors); + } + let attrNames = Object.keys(message.attributes); + if (attrNames.length > 0) { + formatted.attributes = new Array(attrNames.length); + for (let [i, name] of attrNames.entries()) { + let value = bundle.formatPattern(message.attributes[name], args, errors); + formatted.attributes[i] = { + name, + value + }; + } + } + return formatted; +} +function keysFromBundle(method, bundle, keys, translations) { + const messageErrors = []; + const missingIds = new Set(); + keys.forEach(({ + id, + args + }, i) => { + if (translations[i] !== undefined) { + return; + } + let message = bundle.getMessage(id); + if (message) { + messageErrors.length = 0; + translations[i] = method(bundle, messageErrors, message, args); + if (messageErrors.length > 0 && typeof console !== "undefined") { + const locale = bundle.locales[0]; + const errors = messageErrors.join(", "); + console.warn(`[fluent][resolver] errors in ${locale}/${id}: ${errors}.`); + } + } else { + missingIds.add(id); + } + }); + return missingIds; +} +;// ./node_modules/@fluent/dom/esm/dom_localization.js + + +const L10NID_ATTR_NAME = "data-l10n-id"; +const L10NARGS_ATTR_NAME = "data-l10n-args"; +const L10N_ELEMENT_QUERY = `[${L10NID_ATTR_NAME}]`; +class DOMLocalization extends Localization { + constructor(resourceIds, generateBundles) { + super(resourceIds, generateBundles); + this.roots = new Set(); + this.pendingrAF = null; + this.pendingElements = new Set(); + this.windowElement = null; + this.mutationObserver = null; + this.observerConfig = { + attributes: true, + characterData: false, + childList: true, + subtree: true, + attributeFilter: [L10NID_ATTR_NAME, L10NARGS_ATTR_NAME] + }; + } + onChange(eager = false) { + super.onChange(eager); + if (this.roots) { + this.translateRoots(); + } + } + setAttributes(element, id, args) { + element.setAttribute(L10NID_ATTR_NAME, id); + if (args) { + element.setAttribute(L10NARGS_ATTR_NAME, JSON.stringify(args)); + } else { + element.removeAttribute(L10NARGS_ATTR_NAME); + } + return element; + } + getAttributes(element) { + return { + id: element.getAttribute(L10NID_ATTR_NAME), + args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null) + }; + } + connectRoot(newRoot) { + for (const root of this.roots) { + if (root === newRoot || root.contains(newRoot) || newRoot.contains(root)) { + throw new Error("Cannot add a root that overlaps with existing root."); + } + } + if (this.windowElement) { + if (this.windowElement !== newRoot.ownerDocument.defaultView) { + throw new Error(`Cannot connect a root: + DOMLocalization already has a root from a different window.`); + } + } else { + this.windowElement = newRoot.ownerDocument.defaultView; + this.mutationObserver = new this.windowElement.MutationObserver(mutations => this.translateMutations(mutations)); + } + this.roots.add(newRoot); + this.mutationObserver.observe(newRoot, this.observerConfig); + } + disconnectRoot(root) { + this.roots.delete(root); + this.pauseObserving(); + if (this.roots.size === 0) { + this.mutationObserver = null; + if (this.windowElement && this.pendingrAF) { + this.windowElement.cancelAnimationFrame(this.pendingrAF); + } + this.windowElement = null; + this.pendingrAF = null; + this.pendingElements.clear(); + return true; + } + this.resumeObserving(); + return false; + } + translateRoots() { + const roots = Array.from(this.roots); + return Promise.all(roots.map(root => this.translateFragment(root))); + } + pauseObserving() { + if (!this.mutationObserver) { + return; + } + this.translateMutations(this.mutationObserver.takeRecords()); + this.mutationObserver.disconnect(); + } + resumeObserving() { + if (!this.mutationObserver) { + return; + } + for (const root of this.roots) { + this.mutationObserver.observe(root, this.observerConfig); + } + } + translateMutations(mutations) { + for (const mutation of mutations) { + switch (mutation.type) { + case "attributes": + if (mutation.target.hasAttribute("data-l10n-id")) { + this.pendingElements.add(mutation.target); + } + break; + case "childList": + for (const addedNode of mutation.addedNodes) { + if (addedNode.nodeType === addedNode.ELEMENT_NODE) { + if (addedNode.childElementCount) { + for (const element of this.getTranslatables(addedNode)) { + this.pendingElements.add(element); + } + } else if (addedNode.hasAttribute(L10NID_ATTR_NAME)) { + this.pendingElements.add(addedNode); + } + } + } + break; + } + } + if (this.pendingElements.size > 0) { + if (this.pendingrAF === null) { + this.pendingrAF = this.windowElement.requestAnimationFrame(() => { + this.translateElements(Array.from(this.pendingElements)); + this.pendingElements.clear(); + this.pendingrAF = null; + }); + } + } + } + translateFragment(frag) { + return this.translateElements(this.getTranslatables(frag)); + } + async translateElements(elements) { + if (!elements.length) { + return undefined; + } + const keys = elements.map(this.getKeysForElement); + const translations = await this.formatMessages(keys); + return this.applyTranslations(elements, translations); + } + applyTranslations(elements, translations) { + this.pauseObserving(); + for (let i = 0; i < elements.length; i++) { + if (translations[i] !== undefined) { + translateElement(elements[i], translations[i]); + } + } + this.resumeObserving(); + } + getTranslatables(element) { + const nodes = Array.from(element.querySelectorAll(L10N_ELEMENT_QUERY)); + if (typeof element.hasAttribute === "function" && element.hasAttribute(L10NID_ATTR_NAME)) { + nodes.push(element); + } + return nodes; + } + getKeysForElement(element) { + return { + id: element.getAttribute(L10NID_ATTR_NAME), + args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null) + }; + } +} +;// ./node_modules/@fluent/dom/esm/index.js + + +;// ./web/l10n.js +class L10n { + #dir; + #elements; + #lang; + #l10n; + constructor({ + lang, + isRTL + }, l10n = null) { + this.#lang = L10n.#fixupLangCode(lang); + this.#l10n = l10n; + this.#dir = isRTL ?? L10n.#isRTL(this.#lang) ? "rtl" : "ltr"; + } + _setL10n(l10n) { + this.#l10n = l10n; + } + getLanguage() { + return this.#lang; + } + getDirection() { + return this.#dir; + } + async get(ids, args = null, fallback) { + if (Array.isArray(ids)) { + ids = ids.map(id => ({ + id + })); + const messages = await this.#l10n.formatMessages(ids); + return messages.map(message => message.value); + } + const messages = await this.#l10n.formatMessages([{ + id: ids, + args + }]); + return messages[0]?.value || fallback; + } + async translate(element) { + (this.#elements ||= new Set()).add(element); + try { + this.#l10n.connectRoot(element); + await this.#l10n.translateRoots(); + } catch {} + } + async translateOnce(element) { + try { + await this.#l10n.translateElements([element]); + } catch (ex) { + console.error("translateOnce:", ex); + } + } + async destroy() { + if (this.#elements) { + for (const element of this.#elements) { + this.#l10n.disconnectRoot(element); + } + this.#elements.clear(); + this.#elements = null; + } + this.#l10n.pauseObserving(); + } + pause() { + this.#l10n.pauseObserving(); + } + resume() { + this.#l10n.resumeObserving(); + } + static #fixupLangCode(langCode) { + langCode = langCode?.toLowerCase() || "en-us"; + const PARTIAL_LANG_CODES = { + en: "en-us", + es: "es-es", + fy: "fy-nl", + ga: "ga-ie", + gu: "gu-in", + hi: "hi-in", + hy: "hy-am", + nb: "nb-no", + ne: "ne-np", + nn: "nn-no", + pa: "pa-in", + pt: "pt-pt", + sv: "sv-se", + zh: "zh-cn" + }; + return PARTIAL_LANG_CODES[langCode] || langCode; + } + static #isRTL(lang) { + const shortCode = lang.split("-", 1)[0]; + return ["ar", "he", "fa", "ps", "ur"].includes(shortCode); + } +} +const GenericL10n = null; + +;// ./web/genericl10n.js + + + + +function PLATFORM() { + const { + isAndroid, + isLinux, + isMac, + isWindows + } = FeatureTest.platform; + if (isLinux) { + return "linux"; + } + if (isWindows) { + return "windows"; + } + if (isMac) { + return "macos"; + } + if (isAndroid) { + return "android"; + } + return "other"; +} +function createBundle(lang, text) { + const resource = new FluentResource(text); + const bundle = new FluentBundle(lang, { + functions: { + PLATFORM + } + }); + const errors = bundle.addResource(resource); + if (errors.length) { + console.error("L10n errors", errors); + } + return bundle; +} +class genericl10n_GenericL10n extends L10n { + constructor(lang) { + super({ + lang + }); + const generateBundles = !lang ? genericl10n_GenericL10n.#generateBundlesFallback.bind(genericl10n_GenericL10n, this.getLanguage()) : genericl10n_GenericL10n.#generateBundles.bind(genericl10n_GenericL10n, "en-us", this.getLanguage()); + this._setL10n(new DOMLocalization([], generateBundles)); + } + static async *#generateBundles(defaultLang, baseLang) { + const { + baseURL, + paths + } = await this.#getPaths(); + const langs = [baseLang]; + if (defaultLang !== baseLang) { + const shortLang = baseLang.split("-", 1)[0]; + if (shortLang !== baseLang) { + langs.push(shortLang); + } + langs.push(defaultLang); + } + const bundles = langs.map(lang => [lang, this.#createBundle(lang, baseURL, paths)]); + for (const [lang, bundlePromise] of bundles) { + const bundle = await bundlePromise; + if (bundle) { + yield bundle; + } else if (lang === "en-us") { + yield this.#createBundleFallback(lang); + } + } + } + static async #createBundle(lang, baseURL, paths) { + const path = paths[lang]; + if (!path) { + return null; + } + const url = new URL(path, baseURL); + const text = await fetchData(url, "text"); + return createBundle(lang, text); + } + static async #getPaths() { + try { + const { + href + } = document.querySelector(`link[type="application/l10n"]`); + const paths = await fetchData(href, "json"); + return { + baseURL: href.substring(0, href.lastIndexOf("/") + 1) || "./", + paths + }; + } catch {} + return { + baseURL: "./", + paths: Object.create(null) + }; + } + static async *#generateBundlesFallback(lang) { + yield this.#createBundleFallback(lang); + } + static async #createBundleFallback(lang) { + const text = "pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Properties\u2026\npdfjs-document-properties-button-label = Document Properties\u2026\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: \"short\", timeStyle: \"medium\") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } \xD7 { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } \xD7 { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing\u2026\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in document\u2026\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: \"short\", timeStyle: \"medium\") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-color-picker-free-text-input =\n .title = Change text color\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-color-picker-ink-input =\n .title = Change drawing color\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-editor-signature-button =\n .title = Add signature\npdfjs-editor-signature-button-label = Add signature\npdfjs-editor-highlight-editor =\n .aria-label = Highlight editor\npdfjs-editor-ink-editor =\n .aria-label = Drawing editor\npdfjs-editor-signature-editor1 =\n .aria-description = Signature editor: { $description }\npdfjs-editor-stamp-editor =\n .aria-label = Image editor\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-remove-signature-button =\n .title = Remove signature\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-editor-add-signature-container =\n .aria-label = Signature controls and saved signatures\npdfjs-editor-signature-add-signature-button =\n .title = Add new signature\npdfjs-editor-signature-add-signature-button-label = Add new signature\npdfjs-editor-add-saved-signature-button =\n .title = Saved signature: { $description }\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start typing\u2026\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\u2019t see the image or when it doesn\u2019t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, \u201CA young man sits down at a table to eat a meal\u201D\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner \u2014 resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle \u2014 resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner \u2014 resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right \u2014 resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner \u2014 resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle \u2014 resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner \u2014 resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left \u2014 resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description here\u2026\npdfjs-editor-new-alt-text-description = Short description for people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn\u2019t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading\u2026\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close\npdfjs-editor-highlight-added-alert = Highlight added\npdfjs-editor-freetext-added-alert = Text added\npdfjs-editor-ink-added-alert = Drawing added\npdfjs-editor-stamp-added-alert = Image added\npdfjs-editor-signature-added-alert = Signature added\npdfjs-editor-undo-bar-message-highlight = Highlight removed\npdfjs-editor-undo-bar-message-freetext = Text removed\npdfjs-editor-undo-bar-message-ink = Drawing removed\npdfjs-editor-undo-bar-message-stamp = Image removed\npdfjs-editor-undo-bar-message-signature = Signature removed\npdfjs-editor-undo-bar-message-multiple =\n { $count ->\n [one] { $count } annotation removed\n *[other] { $count } annotations removed\n }\npdfjs-editor-undo-bar-undo-button =\n .title = Undo\npdfjs-editor-undo-bar-undo-button-label = Undo\npdfjs-editor-undo-bar-close-button =\n .title = Close\npdfjs-editor-undo-bar-close-button-label = Close\npdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use.\npdfjs-editor-add-signature-dialog-title = Add a signature\npdfjs-editor-add-signature-type-button = Type\n .title = Type\npdfjs-editor-add-signature-draw-button = Draw\n .title = Draw\npdfjs-editor-add-signature-image-button = Image\n .title = Image\npdfjs-editor-add-signature-type-input =\n .aria-label = Type your signature\n .placeholder = Type your signature\npdfjs-editor-add-signature-draw-placeholder = Draw your signature\npdfjs-editor-add-signature-draw-thickness-range-label = Thickness\npdfjs-editor-add-signature-draw-thickness-range =\n .title = Drawing thickness: { $thickness }\npdfjs-editor-add-signature-image-placeholder = Drag a file here to upload\npdfjs-editor-add-signature-image-browse-link =\n { PLATFORM() ->\n [macos] Or choose image files\n *[other] Or browse image files\n }\npdfjs-editor-add-signature-description-label = Description (alt text)\npdfjs-editor-add-signature-description-input =\n .title = Description (alt text)\npdfjs-editor-add-signature-description-default-when-drawing = Signature\npdfjs-editor-add-signature-clear-button-label = Clear signature\npdfjs-editor-add-signature-clear-button =\n .title = Clear signature\npdfjs-editor-add-signature-save-checkbox = Save signature\npdfjs-editor-add-signature-save-warning-message = You\u2019ve reached the limit of 5 saved signatures. Remove one to save more.\npdfjs-editor-add-signature-image-upload-error-title = Couldn\u2019t upload image\npdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image.\npdfjs-editor-add-signature-image-no-data-error-title = Can\u2019t convert this image into a signature\npdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image.\npdfjs-editor-add-signature-error-close-button = Close\npdfjs-editor-add-signature-cancel-button = Cancel\npdfjs-editor-add-signature-add-button = Add\npdfjs-editor-delete-signature-button1 =\n .title = Remove saved signature\npdfjs-editor-delete-signature-button-label1 = Remove saved signature\npdfjs-editor-add-signature-edit-button-label = Edit description\npdfjs-editor-edit-signature-dialog-title = Edit description\npdfjs-editor-edit-signature-update-button = Update\npdfjs-editor-edit-comment-actions-button-label = Actions\npdfjs-editor-edit-comment-actions-button =\n .title = Actions\npdfjs-editor-edit-comment-close-button-label = Close\npdfjs-editor-edit-comment-close-button =\n .title = Close\npdfjs-editor-edit-comment-actions-edit-button-label = Edit\npdfjs-editor-edit-comment-actions-delete-button-label = Delete\npdfjs-editor-edit-comment-manager-text-input =\n .placeholder = Enter your comment\npdfjs-editor-edit-comment-manager-cancel-button = Cancel\npdfjs-editor-edit-comment-manager-save-button = Save\npdfjs-editor-edit-comment-button =\n .title = Edit comment"; + return createBundle(lang, text); + } +} + +;// ./web/pdf_history.js + + + +const HASH_CHANGE_TIMEOUT = 1000; +const POSITION_UPDATED_THRESHOLD = 50; +const UPDATE_VIEWAREA_TIMEOUT = 1000; +function getCurrentHash() { + return document.location.hash; +} +class PDFHistory { + #eventAbortController = null; + constructor({ + linkService, + eventBus + }) { + this.linkService = linkService; + this.eventBus = eventBus; + this._initialized = false; + this._fingerprint = ""; + this.reset(); + this.eventBus._on("pagesinit", () => { + this._isPagesLoaded = false; + this.eventBus._on("pagesloaded", evt => { + this._isPagesLoaded = !!evt.pagesCount; + }, { + once: true + }); + }); + } + initialize({ + fingerprint, + resetHistory = false, + updateUrl = false + }) { + if (!fingerprint || typeof fingerprint !== "string") { + console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.'); + return; + } + if (this._initialized) { + this.reset(); + } + const reInitialized = this._fingerprint !== "" && this._fingerprint !== fingerprint; + this._fingerprint = fingerprint; + this._updateUrl = updateUrl === true; + this._initialized = true; + this.#bindEvents(); + const state = window.history.state; + this._popStateInProgress = false; + this._blockHashChange = 0; + this._currentHash = getCurrentHash(); + this._numPositionUpdates = 0; + this._uid = this._maxUid = 0; + this._destination = null; + this._position = null; + if (!this.#isValidState(state, true) || resetHistory) { + const { + hash, + page, + rotation + } = this.#parseCurrentHash(true); + if (!hash || reInitialized || resetHistory) { + this.#pushOrReplaceState(null, true); + return; + } + this.#pushOrReplaceState({ + hash, + page, + rotation + }, true); + return; + } + const destination = state.destination; + this.#updateInternalState(destination, state.uid, true); + if (destination.rotation !== undefined) { + this._initialRotation = destination.rotation; + } + if (destination.dest) { + this._initialBookmark = JSON.stringify(destination.dest); + this._destination.page = null; + } else if (destination.hash) { + this._initialBookmark = destination.hash; + } else if (destination.page) { + this._initialBookmark = `page=${destination.page}`; + } + } + reset() { + if (this._initialized) { + this.#pageHide(); + this._initialized = false; + this.#unbindEvents(); + } + if (this._updateViewareaTimeout) { + clearTimeout(this._updateViewareaTimeout); + this._updateViewareaTimeout = null; + } + this._initialBookmark = null; + this._initialRotation = null; + } + push({ + namedDest = null, + explicitDest, + pageNumber + }) { + if (!this._initialized) { + return; + } + if (namedDest && typeof namedDest !== "string") { + console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`); + return; + } else if (!Array.isArray(explicitDest)) { + console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`); + return; + } else if (!this.#isValidPage(pageNumber)) { + if (pageNumber !== null || this._destination) { + console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`); + return; + } + } + const hash = namedDest || JSON.stringify(explicitDest); + if (!hash) { + return; + } + let forceReplace = false; + if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) { + if (this._destination.page) { + return; + } + forceReplace = true; + } + if (this._popStateInProgress && !forceReplace) { + return; + } + this.#pushOrReplaceState({ + dest: explicitDest, + hash, + page: pageNumber, + rotation: this.linkService.rotation + }, forceReplace); + if (!this._popStateInProgress) { + this._popStateInProgress = true; + Promise.resolve().then(() => { + this._popStateInProgress = false; + }); + } + } + pushPage(pageNumber) { + if (!this._initialized) { + return; + } + if (!this.#isValidPage(pageNumber)) { + console.error(`PDFHistory.pushPage: "${pageNumber}" is not a valid page number.`); + return; + } + if (this._destination?.page === pageNumber) { + return; + } + if (this._popStateInProgress) { + return; + } + this.#pushOrReplaceState({ + dest: null, + hash: `page=${pageNumber}`, + page: pageNumber, + rotation: this.linkService.rotation + }); + if (!this._popStateInProgress) { + this._popStateInProgress = true; + Promise.resolve().then(() => { + this._popStateInProgress = false; + }); + } + } + pushCurrentPosition() { + if (!this._initialized || this._popStateInProgress) { + return; + } + this.#tryPushCurrentPosition(); + } + back() { + if (!this._initialized || this._popStateInProgress) { + return; + } + const state = window.history.state; + if (this.#isValidState(state) && state.uid > 0) { + window.history.back(); + } + } + forward() { + if (!this._initialized || this._popStateInProgress) { + return; + } + const state = window.history.state; + if (this.#isValidState(state) && state.uid < this._maxUid) { + window.history.forward(); + } + } + get popStateInProgress() { + return this._initialized && (this._popStateInProgress || this._blockHashChange > 0); + } + get initialBookmark() { + return this._initialized ? this._initialBookmark : null; + } + get initialRotation() { + return this._initialized ? this._initialRotation : null; + } + #pushOrReplaceState(destination, forceReplace = false) { + const shouldReplace = forceReplace || !this._destination; + const newState = { + fingerprint: this._fingerprint, + uid: shouldReplace ? this._uid : this._uid + 1, + destination + }; + this.#updateInternalState(destination, newState.uid); + let newUrl; + if (this._updateUrl && destination?.hash) { + const { + href, + protocol + } = document.location; + if (protocol !== "file:") { + newUrl = updateUrlHash(href, destination.hash); + } + } + if (shouldReplace) { + window.history.replaceState(newState, "", newUrl); + } else { + window.history.pushState(newState, "", newUrl); + } + } + #tryPushCurrentPosition(temporary = false) { + if (!this._position) { + return; + } + let position = this._position; + if (temporary) { + position = Object.assign(Object.create(null), this._position); + position.temporary = true; + } + if (!this._destination) { + this.#pushOrReplaceState(position); + return; + } + if (this._destination.temporary) { + this.#pushOrReplaceState(position, true); + return; + } + if (this._destination.hash === position.hash) { + return; + } + if (!this._destination.page && (POSITION_UPDATED_THRESHOLD <= 0 || this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)) { + return; + } + let forceReplace = false; + if (this._destination.page >= position.first && this._destination.page <= position.page) { + if (this._destination.dest !== undefined || !this._destination.first) { + return; + } + forceReplace = true; + } + this.#pushOrReplaceState(position, forceReplace); + } + #isValidPage(val) { + return Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount; + } + #isValidState(state, checkReload = false) { + if (!state) { + return false; + } + if (state.fingerprint !== this._fingerprint) { + if (checkReload) { + if (typeof state.fingerprint !== "string" || state.fingerprint.length !== this._fingerprint.length) { + return false; + } + const [perfEntry] = performance.getEntriesByType("navigation"); + if (perfEntry?.type !== "reload") { + return false; + } + } else { + return false; + } + } + if (!Number.isInteger(state.uid) || state.uid < 0) { + return false; + } + if (state.destination === null || typeof state.destination !== "object") { + return false; + } + return true; + } + #updateInternalState(destination, uid, removeTemporary = false) { + if (this._updateViewareaTimeout) { + clearTimeout(this._updateViewareaTimeout); + this._updateViewareaTimeout = null; + } + if (removeTemporary && destination?.temporary) { + delete destination.temporary; + } + this._destination = destination; + this._uid = uid; + this._maxUid = Math.max(this._maxUid, uid); + this._numPositionUpdates = 0; + } + #parseCurrentHash(checkNameddest = false) { + const hash = unescape(getCurrentHash()).substring(1); + const params = parseQueryString(hash); + const nameddest = params.get("nameddest") || ""; + let page = params.get("page") | 0; + if (!this.#isValidPage(page) || checkNameddest && nameddest.length > 0) { + page = null; + } + return { + hash, + page, + rotation: this.linkService.rotation + }; + } + #updateViewarea({ + location + }) { + if (this._updateViewareaTimeout) { + clearTimeout(this._updateViewareaTimeout); + this._updateViewareaTimeout = null; + } + this._position = { + hash: location.pdfOpenParams.substring(1), + page: this.linkService.page, + first: location.pageNumber, + rotation: location.rotation + }; + if (this._popStateInProgress) { + return; + } + if (POSITION_UPDATED_THRESHOLD > 0 && this._isPagesLoaded && this._destination && !this._destination.page) { + this._numPositionUpdates++; + } + if (UPDATE_VIEWAREA_TIMEOUT > 0) { + this._updateViewareaTimeout = setTimeout(() => { + if (!this._popStateInProgress) { + this.#tryPushCurrentPosition(true); + } + this._updateViewareaTimeout = null; + }, UPDATE_VIEWAREA_TIMEOUT); + } + } + #popState({ + state + }) { + const newHash = getCurrentHash(), + hashChanged = this._currentHash !== newHash; + this._currentHash = newHash; + if (!state) { + this._uid++; + const { + hash, + page, + rotation + } = this.#parseCurrentHash(); + this.#pushOrReplaceState({ + hash, + page, + rotation + }, true); + return; + } + if (!this.#isValidState(state)) { + return; + } + this._popStateInProgress = true; + if (hashChanged) { + this._blockHashChange++; + waitOnEventOrTimeout({ + target: window, + name: "hashchange", + delay: HASH_CHANGE_TIMEOUT + }).then(() => { + this._blockHashChange--; + }); + } + const destination = state.destination; + this.#updateInternalState(destination, state.uid, true); + if (isValidRotation(destination.rotation)) { + this.linkService.rotation = destination.rotation; + } + if (destination.dest) { + this.linkService.goToDestination(destination.dest); + } else if (destination.hash) { + this.linkService.setHash(destination.hash); + } else if (destination.page) { + this.linkService.page = destination.page; + } + Promise.resolve().then(() => { + this._popStateInProgress = false; + }); + } + #pageHide() { + if (!this._destination || this._destination.temporary) { + this.#tryPushCurrentPosition(); + } + } + #bindEvents() { + if (this.#eventAbortController) { + return; + } + this.#eventAbortController = new AbortController(); + const { + signal + } = this.#eventAbortController; + this.eventBus._on("updateviewarea", this.#updateViewarea.bind(this), { + signal + }); + window.addEventListener("popstate", this.#popState.bind(this), { + signal + }); + window.addEventListener("pagehide", this.#pageHide.bind(this), { + signal + }); + } + #unbindEvents() { + this.#eventAbortController?.abort(); + this.#eventAbortController = null; + } +} +function isDestHashesEqual(destHash, pushHash) { + if (typeof destHash !== "string" || typeof pushHash !== "string") { + return false; + } + if (destHash === pushHash) { + return true; + } + const nameddest = parseQueryString(destHash).get("nameddest"); + if (nameddest === pushHash) { + return true; + } + return false; +} +function isDestArraysEqual(firstDest, secondDest) { + function isEntryEqual(first, second) { + if (typeof first !== typeof second) { + return false; + } + if (Array.isArray(first) || Array.isArray(second)) { + return false; + } + if (first !== null && typeof first === "object" && second !== null) { + if (Object.keys(first).length !== Object.keys(second).length) { + return false; + } + for (const key in first) { + if (!isEntryEqual(first[key], second[key])) { + return false; + } + } + return true; + } + return first === second || Number.isNaN(first) && Number.isNaN(second); + } + if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) { + return false; + } + if (firstDest.length !== secondDest.length) { + return false; + } + for (let i = 0, ii = firstDest.length; i < ii; i++) { + if (!isEntryEqual(firstDest[i], secondDest[i])) { + return false; + } + } + return true; +} + +;// ./web/annotation_editor_layer_builder.js + + +class AnnotationEditorLayerBuilder { + #annotationLayer = null; + #drawLayer = null; + #onAppend = null; + #structTreeLayer = null; + #textLayer = null; + #uiManager; + constructor(options) { + this.pdfPage = options.pdfPage; + this.accessibilityManager = options.accessibilityManager; + this.l10n = options.l10n; + this.l10n ||= new genericl10n_GenericL10n(); + this.annotationEditorLayer = null; + this.div = null; + this._cancelled = false; + this.#uiManager = options.uiManager; + this.#annotationLayer = options.annotationLayer || null; + this.#textLayer = options.textLayer || null; + this.#drawLayer = options.drawLayer || null; + this.#onAppend = options.onAppend || null; + this.#structTreeLayer = options.structTreeLayer || null; + } + async render({ + viewport, + intent = "display" + }) { + if (intent !== "display") { + return; + } + if (this._cancelled) { + return; + } + const clonedViewport = viewport.clone({ + dontFlip: true + }); + if (this.div) { + this.annotationEditorLayer.update({ + viewport: clonedViewport + }); + this.show(); + return; + } + const div = this.div = document.createElement("div"); + div.className = "annotationEditorLayer"; + div.hidden = true; + div.dir = this.#uiManager.direction; + this.#onAppend?.(div); + this.annotationEditorLayer = new AnnotationEditorLayer({ + uiManager: this.#uiManager, + div, + structTreeLayer: this.#structTreeLayer, + accessibilityManager: this.accessibilityManager, + pageIndex: this.pdfPage.pageNumber - 1, + l10n: this.l10n, + viewport: clonedViewport, + annotationLayer: this.#annotationLayer, + textLayer: this.#textLayer, + drawLayer: this.#drawLayer + }); + const parameters = { + viewport: clonedViewport, + div, + annotations: null, + intent + }; + this.annotationEditorLayer.render(parameters); + this.show(); + } + cancel() { + this._cancelled = true; + if (!this.div) { + return; + } + this.annotationEditorLayer.destroy(); + } + hide() { + if (!this.div) { + return; + } + this.annotationEditorLayer.pause(true); + this.div.hidden = true; + } + show() { + if (!this.div || this.annotationEditorLayer.isInvisible) { + return; + } + this.div.hidden = false; + this.annotationEditorLayer.pause(false); + } +} + +;// ./web/app_options.js +{ + var compatParams = new Map(); + const { + maxTouchPoints, + platform, + userAgent + } = navigator; + const isAndroid = /Android/.test(userAgent); + const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) || platform === "MacIntel" && maxTouchPoints > 1; + (function () { + if (isIOS || isAndroid) { + compatParams.set("maxCanvasPixels", 5242880); + } + })(); + (function () { + if (isAndroid) { + compatParams.set("useSystemFonts", false); + } + })(); +} +const OptionKind = { + BROWSER: 0x01, + VIEWER: 0x02, + API: 0x04, + WORKER: 0x08, + EVENT_DISPATCH: 0x10, + PREFERENCE: 0x80 +}; +const Type = { + BOOLEAN: 0x01, + NUMBER: 0x02, + OBJECT: 0x04, + STRING: 0x08, + UNDEFINED: 0x10 +}; +const defaultOptions = { + allowedGlobalEvents: { + value: null, + kind: OptionKind.BROWSER + }, + canvasMaxAreaInBytes: { + value: -1, + kind: OptionKind.BROWSER + OptionKind.API + }, + isInAutomation: { + value: false, + kind: OptionKind.BROWSER + }, + localeProperties: { + value: { + lang: navigator.language || "en-US" + }, + kind: OptionKind.BROWSER + }, + maxCanvasDim: { + value: 32767, + kind: OptionKind.BROWSER + OptionKind.VIEWER + }, + nimbusDataStr: { + value: "", + kind: OptionKind.BROWSER + }, + supportsCaretBrowsingMode: { + value: false, + kind: OptionKind.BROWSER + }, + supportsDocumentFonts: { + value: true, + kind: OptionKind.BROWSER + }, + supportsIntegratedFind: { + value: false, + kind: OptionKind.BROWSER + }, + supportsMouseWheelZoomCtrlKey: { + value: true, + kind: OptionKind.BROWSER + }, + supportsMouseWheelZoomMetaKey: { + value: true, + kind: OptionKind.BROWSER + }, + supportsPinchToZoom: { + value: true, + kind: OptionKind.BROWSER + }, + supportsPrinting: { + value: true, + kind: OptionKind.BROWSER + }, + toolbarDensity: { + value: 0, + kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH + }, + altTextLearnMoreUrl: { + value: "", + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + annotationEditorMode: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + annotationMode: { + value: 2, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + capCanvasAreaFactor: { + value: 200, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + cursorToolOnLoad: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + debuggerSrc: { + value: "./debugger.mjs", + kind: OptionKind.VIEWER + }, + defaultZoomDelay: { + value: 400, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + defaultZoomValue: { + value: "", + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + disableHistory: { + value: false, + kind: OptionKind.VIEWER + }, + disablePageLabels: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableAltText: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableAltTextModelDownload: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH + }, + enableAutoLinking: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableComment: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableDetailCanvas: { + value: true, + kind: OptionKind.VIEWER + }, + enableGuessAltText: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH + }, + enableHighlightFloatingButton: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableNewAltTextWhenAddingImage: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enablePermissions: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enablePrintAutoRotate: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableScripting: { + value: true, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableSignatureEditor: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableUpdatedAddImage: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + externalLinkRel: { + value: "noopener noreferrer nofollow", + kind: OptionKind.VIEWER + }, + externalLinkTarget: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + highlightEditorColors: { + value: "yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F," + "yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043", + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + historyUpdateUrl: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + ignoreDestinationZoom: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + imageResourcesPath: { + value: "./images/", + kind: OptionKind.VIEWER + }, + maxCanvasPixels: { + value: 2 ** 25, + kind: OptionKind.VIEWER + }, + minDurationToUpdateCanvas: { + value: 500, + kind: OptionKind.VIEWER + }, + forcePageColors: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + pageColorsBackground: { + value: "Canvas", + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + pageColorsForeground: { + value: "CanvasText", + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + pdfBugEnabled: { + value: false, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + printResolution: { + value: 150, + kind: OptionKind.VIEWER + }, + sidebarViewOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + scrollModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + spreadModeOnLoad: { + value: -1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + textLayerMode: { + value: 1, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + viewerCssTheme: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + viewOnLoad: { + value: 0, + kind: OptionKind.VIEWER + OptionKind.PREFERENCE + }, + cMapPacked: { + value: true, + kind: OptionKind.API + }, + cMapUrl: { + value: "../web/cmaps/", + kind: OptionKind.API + }, + disableAutoFetch: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableFontFace: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableRange: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + disableStream: { + value: false, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + docBaseUrl: { + value: "", + kind: OptionKind.API + }, + enableHWA: { + value: true, + kind: OptionKind.API + OptionKind.VIEWER + OptionKind.PREFERENCE + }, + enableXfa: { + value: true, + kind: OptionKind.API + OptionKind.PREFERENCE + }, + fontExtraProperties: { + value: false, + kind: OptionKind.API + }, + iccUrl: { + value: "../web/iccs/", + kind: OptionKind.API + }, + isEvalSupported: { + value: true, + kind: OptionKind.API + }, + isOffscreenCanvasSupported: { + value: true, + kind: OptionKind.API + }, + maxImageSize: { + value: -1, + kind: OptionKind.API + }, + pdfBug: { + value: false, + kind: OptionKind.API + }, + standardFontDataUrl: { + value: "../web/standard_fonts/", + kind: OptionKind.API + }, + useSystemFonts: { + value: undefined, + kind: OptionKind.API, + type: Type.BOOLEAN + Type.UNDEFINED + }, + verbosity: { + value: 1, + kind: OptionKind.API + }, + wasmUrl: { + value: "../web/wasm/", + kind: OptionKind.API + }, + workerPort: { + value: null, + kind: OptionKind.WORKER + }, + workerSrc: { + value: "../build/pdf.worker.mjs", + kind: OptionKind.WORKER + } +}; +{ + defaultOptions.defaultUrl = { + value: "compressed.tracemonkey-pldi-09.pdf", + kind: OptionKind.VIEWER + }; + defaultOptions.sandboxBundleSrc = { + value: "../build/pdf.sandbox.mjs", + kind: OptionKind.VIEWER + }; + defaultOptions.enableFakeMLManager = { + value: true, + kind: OptionKind.VIEWER + }; +} +{ + defaultOptions.disablePreferences = { + value: false, + kind: OptionKind.VIEWER + }; +} +class AppOptions { + static eventBus; + static #opts = new Map(); + static { + for (const name in defaultOptions) { + this.#opts.set(name, defaultOptions[name].value); + } + for (const [name, value] of compatParams) { + this.#opts.set(name, value); + } + this._hasInvokedSet = false; + this._checkDisablePreferences = () => { + if (this.get("disablePreferences")) { + return true; + } + if (this._hasInvokedSet) { + console.warn("The Preferences may override manually set AppOptions; " + 'please use the "disablePreferences"-option to prevent that.'); + } + return false; + }; + } + static get(name) { + return this.#opts.get(name); + } + static getAll(kind = null, defaultOnly = false) { + const options = Object.create(null); + for (const name in defaultOptions) { + const defaultOpt = defaultOptions[name]; + if (kind && !(kind & defaultOpt.kind)) { + continue; + } + options[name] = !defaultOnly ? this.#opts.get(name) : defaultOpt.value; + } + return options; + } + static set(name, value) { + this.setAll({ + [name]: value + }); + } + static setAll(options, prefs = false) { + this._hasInvokedSet ||= true; + let events; + for (const name in options) { + const defaultOpt = defaultOptions[name], + userOpt = options[name]; + if (!defaultOpt || !(typeof userOpt === typeof defaultOpt.value || Type[(typeof userOpt).toUpperCase()] & defaultOpt.type)) { + continue; + } + const { + kind + } = defaultOpt; + if (prefs && !(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)) { + continue; + } + if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) { + (events ||= new Map()).set(name, userOpt); + } + this.#opts.set(name, userOpt); + } + if (events) { + for (const [name, value] of events) { + this.eventBus.dispatch(name.toLowerCase(), { + source: this, + value + }); + } + } + } +} + +;// ./web/autolinker.js + + +function DOMRectToPDF({ + width, + height, + left, + top +}, pdfPageView) { + if (width === 0 || height === 0) { + return null; + } + const pageBox = pdfPageView.textLayer.div.getBoundingClientRect(); + const bottomLeft = pdfPageView.getPagePoint(left - pageBox.left, top - pageBox.top); + const topRight = pdfPageView.getPagePoint(left - pageBox.left + width, top - pageBox.top + height); + return Util.normalizeRect([bottomLeft[0], bottomLeft[1], topRight[0], topRight[1]]); +} +function calculateLinkPosition(range, pdfPageView) { + const rangeRects = range.getClientRects(); + if (rangeRects.length === 1) { + return { + rect: DOMRectToPDF(rangeRects[0], pdfPageView) + }; + } + const rect = [Infinity, Infinity, -Infinity, -Infinity]; + const quadPoints = []; + let i = 0; + for (const domRect of rangeRects) { + const normalized = DOMRectToPDF(domRect, pdfPageView); + if (normalized === null) { + continue; + } + quadPoints[i] = quadPoints[i + 4] = normalized[0]; + quadPoints[i + 1] = quadPoints[i + 3] = normalized[3]; + quadPoints[i + 2] = quadPoints[i + 6] = normalized[2]; + quadPoints[i + 5] = quadPoints[i + 7] = normalized[1]; + Util.rectBoundingBox(...normalized, rect); + i += 8; + } + return { + quadPoints, + rect + }; +} +function textPosition(container, offset) { + let currentContainer = container; + do { + if (currentContainer.nodeType === Node.TEXT_NODE) { + const currentLength = currentContainer.textContent.length; + if (offset <= currentLength) { + return [currentContainer, offset]; + } + offset -= currentLength; + } else if (currentContainer.firstChild) { + currentContainer = currentContainer.firstChild; + continue; + } + while (!currentContainer.nextSibling && currentContainer !== container) { + currentContainer = currentContainer.parentNode; + } + if (currentContainer !== container) { + currentContainer = currentContainer.nextSibling; + } + } while (currentContainer !== container); + throw new Error("Offset is bigger than container's contents length."); +} +function createLinkAnnotation({ + url, + index, + length +}, pdfPageView, id) { + const highlighter = pdfPageView._textHighlighter; + const [{ + begin, + end + }] = highlighter._convertMatches([index], [length]); + const range = new Range(); + range.setStart(...textPosition(highlighter.textDivs[begin.divIdx], begin.offset)); + range.setEnd(...textPosition(highlighter.textDivs[end.divIdx], end.offset)); + return { + id: `inferred_link_${id}`, + unsafeUrl: url, + url, + annotationType: AnnotationType.LINK, + rotation: 0, + ...calculateLinkPosition(range, pdfPageView), + borderStyle: null + }; +} +class Autolinker { + static #index = 0; + static #regex; + static findLinks(text) { + this.#regex ??= /\b(?:https?:\/\/|mailto:|www\.)(?:[\S--[\p{P}<>]]|\/|[\S--[\[\]]]+[\S--[\p{P}<>]])+|\b[\S--[@\p{Ps}\p{Pe}<>]]+@([\S--[\p{P}<>]]+(?:\.[\S--[\p{P}<>]]+)+)/gmv; + const [normalizedText, diffs] = normalize(text, { + ignoreDashEOL: true + }); + const matches = normalizedText.matchAll(this.#regex); + const links = []; + for (const match of matches) { + const [url, emailDomain] = match; + let raw; + if (url.startsWith("www.") || url.startsWith("http://") || url.startsWith("https://")) { + raw = url; + } else if (URL.canParse(`http://${emailDomain}`)) { + raw = url.startsWith("mailto:") ? url : `mailto:${url}`; + } else { + continue; + } + const absoluteURL = createValidAbsoluteUrl(raw, null, { + addDefaultProtocol: true + }); + if (absoluteURL) { + const [index, length] = getOriginalIndex(diffs, match.index, url.length); + links.push({ + url: absoluteURL.href, + index, + length + }); + } + } + return links; + } + static processLinks(pdfPageView) { + return this.findLinks(pdfPageView._textHighlighter.textContentItemsStr.join("\n")).map(link => createLinkAnnotation(link, pdfPageView, this.#index++)); + } +} + +;// ./web/base_pdf_page_view.js + + +class BasePDFPageView { + #loadingId = null; + #minDurationToUpdateCanvas = 0; + #renderError = null; + #renderingState = RenderingStates.INITIAL; + #showCanvas = null; + #startTime = 0; + #tempCanvas = null; + canvas = null; + div = null; + eventBus = null; + id = null; + pageColors = null; + renderingQueue = null; + renderTask = null; + resume = null; + constructor(options) { + this.eventBus = options.eventBus; + this.id = options.id; + this.pageColors = options.pageColors || null; + this.renderingQueue = options.renderingQueue; + this.#minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500; + } + get renderingState() { + return this.#renderingState; + } + set renderingState(state) { + if (state === this.#renderingState) { + return; + } + this.#renderingState = state; + if (this.#loadingId) { + clearTimeout(this.#loadingId); + this.#loadingId = null; + } + switch (state) { + case RenderingStates.PAUSED: + this.div.classList.remove("loading"); + this.#startTime = 0; + this.#showCanvas?.(false); + break; + case RenderingStates.RUNNING: + this.div.classList.add("loadingIcon"); + this.#loadingId = setTimeout(() => { + this.div.classList.add("loading"); + this.#loadingId = null; + }, 0); + this.#startTime = Date.now(); + break; + case RenderingStates.INITIAL: + case RenderingStates.FINISHED: + this.div.classList.remove("loadingIcon", "loading"); + this.#startTime = 0; + break; + } + } + _createCanvas(onShow, hideUntilComplete = false) { + const { + pageColors + } = this; + const hasHCM = !!(pageColors?.background && pageColors?.foreground); + const prevCanvas = this.canvas; + const updateOnFirstShow = !prevCanvas && !hasHCM && !hideUntilComplete; + let canvas = this.canvas = document.createElement("canvas"); + this.#showCanvas = isLastShow => { + if (updateOnFirstShow) { + let tempCanvas = this.#tempCanvas; + if (!isLastShow && this.#minDurationToUpdateCanvas > 0) { + if (Date.now() - this.#startTime < this.#minDurationToUpdateCanvas) { + return; + } + if (!tempCanvas) { + tempCanvas = this.#tempCanvas = canvas; + canvas = this.canvas = canvas.cloneNode(false); + onShow(canvas); + } + } + if (tempCanvas) { + const ctx = canvas.getContext("2d", { + alpha: false + }); + ctx.drawImage(tempCanvas, 0, 0); + if (isLastShow) { + this.#resetTempCanvas(); + } else { + this.#startTime = Date.now(); + } + return; + } + onShow(canvas); + this.#showCanvas = null; + return; + } + if (!isLastShow) { + return; + } + if (prevCanvas) { + prevCanvas.replaceWith(canvas); + prevCanvas.width = prevCanvas.height = 0; + } else { + onShow(canvas); + } + }; + return { + canvas, + prevCanvas + }; + } + #renderContinueCallback = cont => { + this.#showCanvas?.(false); + if (this.renderingQueue && !this.renderingQueue.isHighestPriority(this)) { + this.renderingState = RenderingStates.PAUSED; + this.resume = () => { + this.renderingState = RenderingStates.RUNNING; + cont(); + }; + return; + } + cont(); + }; + _resetCanvas() { + const { + canvas + } = this; + if (!canvas) { + return; + } + canvas.remove(); + canvas.width = canvas.height = 0; + this.canvas = null; + this.#resetTempCanvas(); + } + #resetTempCanvas() { + if (this.#tempCanvas) { + this.#tempCanvas.width = this.#tempCanvas.height = 0; + this.#tempCanvas = null; + } + } + async _drawCanvas(options, onCancel, onFinish) { + const renderTask = this.renderTask = this.pdfPage.render(options); + renderTask.onContinue = this.#renderContinueCallback; + renderTask.onError = error => { + if (error instanceof RenderingCancelledException) { + onCancel(); + this.#renderError = null; + } + }; + let error = null; + try { + await renderTask.promise; + this.#showCanvas?.(true); + } catch (e) { + if (e instanceof RenderingCancelledException) { + return; + } + error = e; + this.#showCanvas?.(true); + } finally { + this.#renderError = error; + if (renderTask === this.renderTask) { + this.renderTask = null; + } + } + this.renderingState = RenderingStates.FINISHED; + onFinish(renderTask); + if (error) { + throw error; + } + } + cancelRendering({ + cancelExtraDelay = 0 + } = {}) { + if (this.renderTask) { + this.renderTask.cancel(cancelExtraDelay); + this.renderTask = null; + } + this.resume = null; + } + dispatchPageRender() { + this.eventBus.dispatch("pagerender", { + source: this, + pageNumber: this.id + }); + } + dispatchPageRendered(cssTransform, isDetailView) { + this.eventBus.dispatch("pagerendered", { + source: this, + pageNumber: this.id, + cssTransform, + isDetailView, + timestamp: performance.now(), + error: this.#renderError + }); + } +} + +;// ./web/draw_layer_builder.js + +class DrawLayerBuilder { + #drawLayer = null; + constructor(options) { + this.pageIndex = options.pageIndex; + } + async render({ + intent = "display" + }) { + if (intent !== "display" || this.#drawLayer || this._cancelled) { + return; + } + this.#drawLayer = new DrawLayer({ + pageIndex: this.pageIndex + }); + } + cancel() { + this._cancelled = true; + if (!this.#drawLayer) { + return; + } + this.#drawLayer.destroy(); + this.#drawLayer = null; + } + setParent(parent) { + this.#drawLayer?.setParent(parent); + } + getDrawLayer() { + return this.#drawLayer; + } +} + +;// ./web/pdf_page_detail_view.js + + + +class PDFPageDetailView extends BasePDFPageView { + #detailArea = null; + renderingCancelled = false; + constructor({ + pageView + }) { + super(pageView); + this.pageView = pageView; + this.renderingId = "detail" + this.id; + this.div = pageView.div; + } + setPdfPage(pdfPage) { + this.pageView.setPdfPage(pdfPage); + } + get pdfPage() { + return this.pageView.pdfPage; + } + get renderingState() { + return super.renderingState; + } + set renderingState(value) { + this.renderingCancelled = false; + super.renderingState = value; + } + reset({ + keepCanvas = false + } = {}) { + const renderingCancelled = this.renderingCancelled || this.renderingState === RenderingStates.RUNNING || this.renderingState === RenderingStates.PAUSED; + this.cancelRendering(); + this.renderingState = RenderingStates.INITIAL; + this.renderingCancelled = renderingCancelled; + if (!keepCanvas) { + this._resetCanvas(); + } + } + #shouldRenderDifferentArea(visibleArea) { + if (!this.#detailArea) { + return true; + } + const minDetailX = this.#detailArea.minX; + const minDetailY = this.#detailArea.minY; + const maxDetailX = this.#detailArea.width + minDetailX; + const maxDetailY = this.#detailArea.height + minDetailY; + if (visibleArea.minX < minDetailX || visibleArea.minY < minDetailY || visibleArea.maxX > maxDetailX || visibleArea.maxY > maxDetailY) { + return true; + } + const { + width: maxWidth, + height: maxHeight, + scale + } = this.pageView.viewport; + if (this.#detailArea.scale !== scale) { + return true; + } + const paddingLeftSize = visibleArea.minX - minDetailX; + const paddingRightSize = maxDetailX - visibleArea.maxX; + const paddingTopSize = visibleArea.minY - minDetailY; + const paddingBottomSize = maxDetailY - visibleArea.maxY; + const MOVEMENT_THRESHOLD = 0.5; + const ratio = (1 + MOVEMENT_THRESHOLD) / MOVEMENT_THRESHOLD; + if (minDetailX > 0 && paddingRightSize / paddingLeftSize > ratio || maxDetailX < maxWidth && paddingLeftSize / paddingRightSize > ratio || minDetailY > 0 && paddingBottomSize / paddingTopSize > ratio || maxDetailY < maxHeight && paddingTopSize / paddingBottomSize > ratio) { + return true; + } + return false; + } + update({ + visibleArea = null, + underlyingViewUpdated = false + } = {}) { + if (underlyingViewUpdated) { + this.cancelRendering(); + this.renderingState = RenderingStates.INITIAL; + return; + } + if (!this.#shouldRenderDifferentArea(visibleArea)) { + return; + } + const { + viewport, + maxCanvasPixels, + capCanvasAreaFactor + } = this.pageView; + const visibleWidth = visibleArea.maxX - visibleArea.minX; + const visibleHeight = visibleArea.maxY - visibleArea.minY; + const visiblePixels = visibleWidth * visibleHeight * OutputScale.pixelRatio ** 2; + const maxDetailToVisibleLinearRatio = Math.sqrt(OutputScale.capPixels(maxCanvasPixels, capCanvasAreaFactor) / visiblePixels); + const maxOverflowScale = (maxDetailToVisibleLinearRatio - 1) / 2; + let overflowScale = Math.min(1, maxOverflowScale); + if (overflowScale < 0) { + overflowScale = 0; + } + const overflowWidth = visibleWidth * overflowScale; + const overflowHeight = visibleHeight * overflowScale; + const minX = Math.max(0, visibleArea.minX - overflowWidth); + const maxX = Math.min(viewport.width, visibleArea.maxX + overflowWidth); + const minY = Math.max(0, visibleArea.minY - overflowHeight); + const maxY = Math.min(viewport.height, visibleArea.maxY + overflowHeight); + const width = maxX - minX; + const height = maxY - minY; + this.#detailArea = { + minX, + minY, + width, + height, + scale: viewport.scale + }; + this.reset({ + keepCanvas: true + }); + } + async draw() { + if (this.pageView.detailView !== this) { + return undefined; + } + const hideUntilComplete = this.pageView.renderingState === RenderingStates.FINISHED || this.renderingState === RenderingStates.FINISHED; + if (this.renderingState !== RenderingStates.INITIAL) { + console.error("Must be in new state before drawing"); + this.reset(); + } + const { + div, + pdfPage, + viewport + } = this.pageView; + if (!pdfPage) { + this.renderingState = RenderingStates.FINISHED; + throw new Error("pdfPage is not loaded"); + } + this.renderingState = RenderingStates.RUNNING; + const canvasWrapper = this.pageView._ensureCanvasWrapper(); + const { + canvas, + prevCanvas + } = this._createCanvas(newCanvas => { + if (canvasWrapper.firstElementChild?.tagName === "CANVAS") { + canvasWrapper.firstElementChild.after(newCanvas); + } else { + canvasWrapper.prepend(newCanvas); + } + }, hideUntilComplete); + canvas.setAttribute("aria-hidden", "true"); + const { + width, + height + } = viewport; + const area = this.#detailArea; + const { + pixelRatio + } = OutputScale; + const transform = [pixelRatio, 0, 0, pixelRatio, -area.minX * pixelRatio, -area.minY * pixelRatio]; + canvas.width = area.width * pixelRatio; + canvas.height = area.height * pixelRatio; + const { + style + } = canvas; + style.width = `${area.width * 100 / width}%`; + style.height = `${area.height * 100 / height}%`; + style.top = `${area.minY * 100 / height}%`; + style.left = `${area.minX * 100 / width}%`; + const renderingPromise = this._drawCanvas(this.pageView._getRenderingContext(canvas, transform), () => { + this.canvas?.remove(); + this.canvas = prevCanvas; + }, () => { + this.dispatchPageRendered(false, true); + }); + div.setAttribute("data-loaded", true); + this.dispatchPageRender(); + return renderingPromise; + } +} + +;// ./web/struct_tree_layer_builder.js + +const PDF_ROLE_TO_HTML_ROLE = { + Document: null, + DocumentFragment: null, + Part: "group", + Sect: "group", + Div: "group", + Aside: "note", + NonStruct: "none", + P: null, + H: "heading", + Title: null, + FENote: "note", + Sub: "group", + Lbl: null, + Span: null, + Em: null, + Strong: null, + Link: "link", + Annot: "note", + Form: "form", + Ruby: null, + RB: null, + RT: null, + RP: null, + Warichu: null, + WT: null, + WP: null, + L: "list", + LI: "listitem", + LBody: null, + Table: "table", + TR: "row", + TH: "columnheader", + TD: "cell", + THead: "columnheader", + TBody: null, + TFoot: null, + Caption: null, + Figure: "figure", + Formula: null, + Artifact: null +}; +const HEADING_PATTERN = /^H(\d+)$/; +class StructTreeLayerBuilder { + #promise; + #treeDom = null; + #treePromise; + #elementAttributes = new Map(); + #rawDims; + #elementsToAddToTextLayer = null; + constructor(pdfPage, rawDims) { + this.#promise = pdfPage.getStructTree(); + this.#rawDims = rawDims; + } + async render() { + if (this.#treePromise) { + return this.#treePromise; + } + const { + promise, + resolve, + reject + } = Promise.withResolvers(); + this.#treePromise = promise; + try { + this.#treeDom = this.#walk(await this.#promise); + } catch (ex) { + reject(ex); + } + this.#promise = null; + this.#treeDom?.classList.add("structTree"); + resolve(this.#treeDom); + return promise; + } + async getAriaAttributes(annotationId) { + try { + await this.render(); + return this.#elementAttributes.get(annotationId); + } catch {} + return null; + } + hide() { + if (this.#treeDom && !this.#treeDom.hidden) { + this.#treeDom.hidden = true; + } + } + show() { + if (this.#treeDom?.hidden) { + this.#treeDom.hidden = false; + } + } + #setAttributes(structElement, htmlElement) { + const { + alt, + id, + lang + } = structElement; + if (alt !== undefined) { + let added = false; + const label = removeNullCharacters(alt); + for (const child of structElement.children) { + if (child.type === "annotation") { + let attrs = this.#elementAttributes.get(child.id); + if (!attrs) { + attrs = new Map(); + this.#elementAttributes.set(child.id, attrs); + } + attrs.set("aria-label", label); + added = true; + } + } + if (!added) { + htmlElement.setAttribute("aria-label", label); + } + } + if (id !== undefined) { + htmlElement.setAttribute("aria-owns", id); + } + if (lang !== undefined) { + htmlElement.setAttribute("lang", removeNullCharacters(lang, true)); + } + } + #addImageInTextLayer(node, element) { + const { + alt, + bbox, + children + } = node; + const child = children?.[0]; + if (!this.#rawDims || !alt || !bbox || child?.type !== "content") { + return false; + } + const { + id + } = child; + if (!id) { + return false; + } + element.setAttribute("aria-owns", id); + const img = document.createElement("span"); + (this.#elementsToAddToTextLayer ||= new Map()).set(id, img); + img.setAttribute("role", "img"); + img.setAttribute("aria-label", removeNullCharacters(alt)); + const { + pageHeight, + pageX, + pageY + } = this.#rawDims; + const calc = "calc(var(--total-scale-factor) *"; + const { + style + } = img; + style.width = `${calc}${bbox[2] - bbox[0]}px)`; + style.height = `${calc}${bbox[3] - bbox[1]}px)`; + style.left = `${calc}${bbox[0] - pageX}px)`; + style.top = `${calc}${pageHeight - bbox[3] + pageY}px)`; + return true; + } + addElementsToTextLayer() { + if (!this.#elementsToAddToTextLayer) { + return; + } + for (const [id, img] of this.#elementsToAddToTextLayer) { + document.getElementById(id)?.append(img); + } + this.#elementsToAddToTextLayer.clear(); + this.#elementsToAddToTextLayer = null; + } + #walk(node) { + if (!node) { + return null; + } + const element = document.createElement("span"); + if ("role" in node) { + const { + role + } = node; + const match = role.match(HEADING_PATTERN); + if (match) { + element.setAttribute("role", "heading"); + element.setAttribute("aria-level", match[1]); + } else if (PDF_ROLE_TO_HTML_ROLE[role]) { + element.setAttribute("role", PDF_ROLE_TO_HTML_ROLE[role]); + } + if (role === "Figure" && this.#addImageInTextLayer(node, element)) { + return element; + } + } + this.#setAttributes(node, element); + if (node.children) { + if (node.children.length === 1 && "id" in node.children[0]) { + this.#setAttributes(node.children[0], element); + } else { + for (const kid of node.children) { + element.append(this.#walk(kid)); + } + } + } + return element; + } +} + +;// ./web/text_accessibility.js + +class TextAccessibilityManager { + #enabled = false; + #textChildren = null; + #textNodes = new Map(); + #waitingElements = new Map(); + setTextMapping(textDivs) { + this.#textChildren = textDivs; + } + static #compareElementPositions(e1, e2) { + const rect1 = e1.getBoundingClientRect(); + const rect2 = e2.getBoundingClientRect(); + if (rect1.width === 0 && rect1.height === 0) { + return +1; + } + if (rect2.width === 0 && rect2.height === 0) { + return -1; + } + const top1 = rect1.y; + const bot1 = rect1.y + rect1.height; + const mid1 = rect1.y + rect1.height / 2; + const top2 = rect2.y; + const bot2 = rect2.y + rect2.height; + const mid2 = rect2.y + rect2.height / 2; + if (mid1 <= top2 && mid2 >= bot1) { + return -1; + } + if (mid2 <= top1 && mid1 >= bot2) { + return +1; + } + const centerX1 = rect1.x + rect1.width / 2; + const centerX2 = rect2.x + rect2.width / 2; + return centerX1 - centerX2; + } + enable() { + if (this.#enabled) { + throw new Error("TextAccessibilityManager is already enabled."); + } + if (!this.#textChildren) { + throw new Error("Text divs and strings have not been set."); + } + this.#enabled = true; + this.#textChildren = this.#textChildren.slice(); + this.#textChildren.sort(TextAccessibilityManager.#compareElementPositions); + if (this.#textNodes.size > 0) { + const textChildren = this.#textChildren; + for (const [id, nodeIndex] of this.#textNodes) { + const element = document.getElementById(id); + if (!element) { + this.#textNodes.delete(id); + continue; + } + this.#addIdToAriaOwns(id, textChildren[nodeIndex]); + } + } + for (const [element, isRemovable] of this.#waitingElements) { + this.addPointerInTextLayer(element, isRemovable); + } + this.#waitingElements.clear(); + } + disable() { + if (!this.#enabled) { + return; + } + this.#waitingElements.clear(); + this.#textChildren = null; + this.#enabled = false; + } + removePointerInTextLayer(element) { + if (!this.#enabled) { + this.#waitingElements.delete(element); + return; + } + const children = this.#textChildren; + if (!children || children.length === 0) { + return; + } + const { + id + } = element; + const nodeIndex = this.#textNodes.get(id); + if (nodeIndex === undefined) { + return; + } + const node = children[nodeIndex]; + this.#textNodes.delete(id); + let owns = node.getAttribute("aria-owns"); + if (owns?.includes(id)) { + owns = owns.split(" ").filter(x => x !== id).join(" "); + if (owns) { + node.setAttribute("aria-owns", owns); + } else { + node.removeAttribute("aria-owns"); + node.setAttribute("role", "presentation"); + } + } + } + #addIdToAriaOwns(id, node) { + const owns = node.getAttribute("aria-owns"); + if (!owns?.includes(id)) { + node.setAttribute("aria-owns", owns ? `${owns} ${id}` : id); + } + node.removeAttribute("role"); + } + addPointerInTextLayer(element, isRemovable) { + const { + id + } = element; + if (!id) { + return null; + } + if (!this.#enabled) { + this.#waitingElements.set(element, isRemovable); + return null; + } + if (isRemovable) { + this.removePointerInTextLayer(element); + } + const children = this.#textChildren; + if (!children || children.length === 0) { + return null; + } + const index = binarySearchFirstItem(children, node => TextAccessibilityManager.#compareElementPositions(element, node) < 0); + const nodeIndex = Math.max(0, index - 1); + const child = children[nodeIndex]; + this.#addIdToAriaOwns(id, child); + this.#textNodes.set(id, nodeIndex); + const parent = child.parentNode; + return parent?.classList.contains("markedContent") ? parent.id : null; + } + moveElementInDOM(container, element, contentElement, isRemovable) { + const id = this.addPointerInTextLayer(contentElement, isRemovable); + if (!container.hasChildNodes()) { + container.append(element); + return id; + } + const children = Array.from(container.childNodes).filter(node => node !== element); + if (children.length === 0) { + return id; + } + const elementToCompare = contentElement || element; + const index = binarySearchFirstItem(children, node => TextAccessibilityManager.#compareElementPositions(elementToCompare, node) < 0); + if (index === 0) { + children[0].before(element); + } else { + children[index - 1].after(element); + } + return id; + } +} + +;// ./web/text_highlighter.js +class TextHighlighter { + #eventAbortController = null; + constructor({ + findController, + eventBus, + pageIndex + }) { + this.findController = findController; + this.matches = []; + this.eventBus = eventBus; + this.pageIdx = pageIndex; + this.textDivs = null; + this.textContentItemsStr = null; + this.enabled = false; + } + setTextMapping(divs, texts) { + this.textDivs = divs; + this.textContentItemsStr = texts; + } + enable() { + if (!this.textDivs || !this.textContentItemsStr) { + throw new Error("Text divs and strings have not been set."); + } + if (this.enabled) { + throw new Error("TextHighlighter is already enabled."); + } + this.enabled = true; + if (!this.#eventAbortController) { + this.#eventAbortController = new AbortController(); + this.eventBus._on("updatetextlayermatches", evt => { + if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) { + this._updateMatches(); + } + }, { + signal: this.#eventAbortController.signal + }); + } + this._updateMatches(); + } + disable() { + if (!this.enabled) { + return; + } + this.enabled = false; + this.#eventAbortController?.abort(); + this.#eventAbortController = null; + this._updateMatches(true); + } + _convertMatches(matches, matchesLength) { + if (!matches) { + return []; + } + const { + textContentItemsStr + } = this; + let i = 0, + iIndex = 0; + const end = textContentItemsStr.length - 1; + const result = []; + for (let m = 0, mm = matches.length; m < mm; m++) { + let matchIdx = matches[m]; + while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) { + iIndex += textContentItemsStr[i].length; + i++; + } + if (i === textContentItemsStr.length) { + console.error("Could not find a matching mapping"); + } + const match = { + begin: { + divIdx: i, + offset: matchIdx - iIndex + } + }; + matchIdx += matchesLength[m]; + while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) { + iIndex += textContentItemsStr[i].length; + i++; + } + match.end = { + divIdx: i, + offset: matchIdx - iIndex + }; + result.push(match); + } + return result; + } + _renderMatches(matches) { + if (matches.length === 0) { + return; + } + const { + findController, + pageIdx + } = this; + const { + textContentItemsStr, + textDivs + } = this; + const isSelectedPage = pageIdx === findController.selected.pageIdx; + const selectedMatchIdx = findController.selected.matchIdx; + const highlightAll = findController.state.highlightAll; + let prevEnd = null; + const infinity = { + divIdx: -1, + offset: undefined + }; + function beginText(begin, className) { + const divIdx = begin.divIdx; + textDivs[divIdx].textContent = ""; + return appendTextToDiv(divIdx, 0, begin.offset, className); + } + function appendTextToDiv(divIdx, fromOffset, toOffset, className) { + let div = textDivs[divIdx]; + if (div.nodeType === Node.TEXT_NODE) { + const span = document.createElement("span"); + div.before(span); + span.append(div); + textDivs[divIdx] = span; + div = span; + } + const content = textContentItemsStr[divIdx].substring(fromOffset, toOffset); + const node = document.createTextNode(content); + if (className) { + const span = document.createElement("span"); + span.className = `${className} appended`; + span.append(node); + div.append(span); + if (className.includes("selected")) { + const { + left + } = span.getClientRects()[0]; + const parentLeft = div.getBoundingClientRect().left; + return left - parentLeft; + } + return 0; + } + div.append(node); + return 0; + } + let i0 = selectedMatchIdx, + i1 = i0 + 1; + if (highlightAll) { + i0 = 0; + i1 = matches.length; + } else if (!isSelectedPage) { + return; + } + let lastDivIdx = -1; + let lastOffset = -1; + for (let i = i0; i < i1; i++) { + const match = matches[i]; + const begin = match.begin; + if (begin.divIdx === lastDivIdx && begin.offset === lastOffset) { + continue; + } + lastDivIdx = begin.divIdx; + lastOffset = begin.offset; + const end = match.end; + const isSelected = isSelectedPage && i === selectedMatchIdx; + const highlightSuffix = isSelected ? " selected" : ""; + let selectedLeft = 0; + if (!prevEnd || begin.divIdx !== prevEnd.divIdx) { + if (prevEnd !== null) { + appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset); + } + beginText(begin); + } else { + appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset); + } + if (begin.divIdx === end.divIdx) { + selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, end.offset, "highlight" + highlightSuffix); + } else { + selectedLeft = appendTextToDiv(begin.divIdx, begin.offset, infinity.offset, "highlight begin" + highlightSuffix); + for (let n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) { + textDivs[n0].className = "highlight middle" + highlightSuffix; + } + beginText(end, "highlight end" + highlightSuffix); + } + prevEnd = end; + if (isSelected) { + findController.scrollMatchIntoView({ + element: textDivs[begin.divIdx], + selectedLeft, + pageIndex: pageIdx, + matchIndex: selectedMatchIdx + }); + } + } + if (prevEnd) { + appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset); + } + } + _updateMatches(reset = false) { + if (!this.enabled && !reset) { + return; + } + const { + findController, + matches, + pageIdx + } = this; + const { + textContentItemsStr, + textDivs + } = this; + let clearedUntilDivIdx = -1; + for (const match of matches) { + const begin = Math.max(clearedUntilDivIdx, match.begin.divIdx); + for (let n = begin, end = match.end.divIdx; n <= end; n++) { + const div = textDivs[n]; + div.textContent = textContentItemsStr[n]; + div.className = ""; + } + clearedUntilDivIdx = match.end.divIdx + 1; + } + if (!findController?.highlightMatches || reset) { + return; + } + const pageMatches = findController.pageMatches[pageIdx] || null; + const pageMatchesLength = findController.pageMatchesLength[pageIdx] || null; + this.matches = this._convertMatches(pageMatches, pageMatchesLength); + this._renderMatches(this.matches); + } +} + +;// ./web/text_layer_builder.js + + +class TextLayerBuilder { + #enablePermissions = false; + #onAppend = null; + #renderingDone = false; + #textLayer = null; + static #textLayers = new Map(); + static #selectionChangeAbortController = null; + constructor({ + pdfPage, + highlighter = null, + accessibilityManager = null, + enablePermissions = false, + onAppend = null + }) { + this.pdfPage = pdfPage; + this.highlighter = highlighter; + this.accessibilityManager = accessibilityManager; + this.#enablePermissions = enablePermissions === true; + this.#onAppend = onAppend; + this.div = document.createElement("div"); + this.div.tabIndex = 0; + this.div.className = "textLayer"; + } + async render({ + viewport, + textContentParams = null + }) { + if (this.#renderingDone && this.#textLayer) { + this.#textLayer.update({ + viewport, + onBefore: this.hide.bind(this) + }); + this.show(); + return; + } + this.cancel(); + this.#textLayer = new TextLayer({ + textContentSource: this.pdfPage.streamTextContent(textContentParams || { + includeMarkedContent: true, + disableNormalization: true + }), + container: this.div, + viewport + }); + const { + textDivs, + textContentItemsStr + } = this.#textLayer; + this.highlighter?.setTextMapping(textDivs, textContentItemsStr); + this.accessibilityManager?.setTextMapping(textDivs); + await this.#textLayer.render(); + this.#renderingDone = true; + const endOfContent = document.createElement("div"); + endOfContent.className = "endOfContent"; + this.div.append(endOfContent); + this.#bindMouse(endOfContent); + this.#onAppend?.(this.div); + this.highlighter?.enable(); + this.accessibilityManager?.enable(); + } + hide() { + if (!this.div.hidden && this.#renderingDone) { + this.highlighter?.disable(); + this.div.hidden = true; + } + } + show() { + if (this.div.hidden && this.#renderingDone) { + this.div.hidden = false; + this.highlighter?.enable(); + } + } + cancel() { + this.#textLayer?.cancel(); + this.#textLayer = null; + this.highlighter?.disable(); + this.accessibilityManager?.disable(); + TextLayerBuilder.#removeGlobalSelectionListener(this.div); + } + #bindMouse(end) { + const { + div + } = this; + div.addEventListener("mousedown", () => { + div.classList.add("selecting"); + }); + div.addEventListener("copy", event => { + if (!this.#enablePermissions) { + const selection = document.getSelection(); + event.clipboardData.setData("text/plain", removeNullCharacters(normalizeUnicode(selection.toString()))); + } + stopEvent(event); + }); + TextLayerBuilder.#textLayers.set(div, end); + TextLayerBuilder.#enableGlobalSelectionListener(); + } + static #removeGlobalSelectionListener(textLayerDiv) { + this.#textLayers.delete(textLayerDiv); + if (this.#textLayers.size === 0) { + this.#selectionChangeAbortController?.abort(); + this.#selectionChangeAbortController = null; + } + } + static #enableGlobalSelectionListener() { + if (this.#selectionChangeAbortController) { + return; + } + this.#selectionChangeAbortController = new AbortController(); + const { + signal + } = this.#selectionChangeAbortController; + const reset = (end, textLayer) => { + textLayer.append(end); + end.style.width = ""; + end.style.height = ""; + textLayer.classList.remove("selecting"); + }; + let isPointerDown = false; + document.addEventListener("pointerdown", () => { + isPointerDown = true; + }, { + signal + }); + document.addEventListener("pointerup", () => { + isPointerDown = false; + this.#textLayers.forEach(reset); + }, { + signal + }); + window.addEventListener("blur", () => { + isPointerDown = false; + this.#textLayers.forEach(reset); + }, { + signal + }); + document.addEventListener("keyup", () => { + if (!isPointerDown) { + this.#textLayers.forEach(reset); + } + }, { + signal + }); + var isFirefox, prevRange; + document.addEventListener("selectionchange", () => { + const selection = document.getSelection(); + if (selection.rangeCount === 0) { + this.#textLayers.forEach(reset); + return; + } + const activeTextLayers = new Set(); + for (let i = 0; i < selection.rangeCount; i++) { + const range = selection.getRangeAt(i); + for (const textLayerDiv of this.#textLayers.keys()) { + if (!activeTextLayers.has(textLayerDiv) && range.intersectsNode(textLayerDiv)) { + activeTextLayers.add(textLayerDiv); + } + } + } + for (const [textLayerDiv, endDiv] of this.#textLayers) { + if (activeTextLayers.has(textLayerDiv)) { + textLayerDiv.classList.add("selecting"); + } else { + reset(endDiv, textLayerDiv); + } + } + isFirefox ??= getComputedStyle(this.#textLayers.values().next().value).getPropertyValue("-moz-user-select") === "none"; + if (isFirefox) { + return; + } + const range = selection.getRangeAt(0); + const modifyStart = prevRange && (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 || range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0); + let anchor = modifyStart ? range.startContainer : range.endContainer; + if (anchor.nodeType === Node.TEXT_NODE) { + anchor = anchor.parentNode; + } + if (!modifyStart && range.endOffset === 0) { + do { + while (!anchor.previousSibling) { + anchor = anchor.parentNode; + } + anchor = anchor.previousSibling; + } while (!anchor.childNodes.length); + } + const parentTextLayer = anchor.parentElement?.closest(".textLayer"); + const endDiv = this.#textLayers.get(parentTextLayer); + if (endDiv) { + endDiv.style.width = parentTextLayer.style.width; + endDiv.style.height = parentTextLayer.style.height; + anchor.parentElement.insertBefore(endDiv, modifyStart ? anchor : anchor.nextSibling); + } + prevRange = range.cloneRange(); + }, { + signal + }); + } +} + +;// ./web/xfa_layer_builder.js + +class XfaLayerBuilder { + constructor({ + pdfPage, + annotationStorage = null, + linkService, + xfaHtml = null + }) { + this.pdfPage = pdfPage; + this.annotationStorage = annotationStorage; + this.linkService = linkService; + this.xfaHtml = xfaHtml; + this.div = null; + this._cancelled = false; + } + async render({ + viewport, + intent = "display" + }) { + if (intent === "print") { + const parameters = { + viewport: viewport.clone({ + dontFlip: true + }), + div: this.div, + xfaHtml: this.xfaHtml, + annotationStorage: this.annotationStorage, + linkService: this.linkService, + intent + }; + this.div = document.createElement("div"); + parameters.div = this.div; + return XfaLayer.render(parameters); + } + const xfaHtml = await this.pdfPage.getXfa(); + if (this._cancelled || !xfaHtml) { + return { + textDivs: [] + }; + } + const parameters = { + viewport: viewport.clone({ + dontFlip: true + }), + div: this.div, + xfaHtml, + annotationStorage: this.annotationStorage, + linkService: this.linkService, + intent + }; + if (this.div) { + return XfaLayer.update(parameters); + } + this.div = document.createElement("div"); + parameters.div = this.div; + return XfaLayer.render(parameters); + } + cancel() { + this._cancelled = true; + } + hide() { + if (!this.div) { + return; + } + this.div.hidden = true; + } +} + +;// ./web/pdf_page_view.js + + + + + + + + + + + + + + + + +const DEFAULT_LAYER_PROPERTIES = { + annotationEditorUIManager: null, + annotationStorage: null, + downloadManager: null, + enableScripting: false, + fieldObjectsPromise: null, + findController: null, + hasJSActionsPromise: null, + get linkService() { + return new SimpleLinkService(); + } +}; +const LAYERS_ORDER = new Map([["canvasWrapper", 0], ["textLayer", 1], ["annotationLayer", 2], ["annotationEditorLayer", 3], ["xfaLayer", 3]]); +class PDFPageView extends BasePDFPageView { + #annotationMode = AnnotationMode.ENABLE_FORMS; + #canvasWrapper = null; + #enableAutoLinking = true; + #hasRestrictedScaling = false; + #isEditing = false; + #layerProperties = null; + #needsRestrictedScaling = false; + #originalViewport = null; + #previousRotation = null; + #scaleRoundX = 1; + #scaleRoundY = 1; + #textLayerMode = TextLayerMode.ENABLE; + #userUnit = 1; + #useThumbnailCanvas = { + directDrawing: true, + initialOptionalContent: true, + regularAnnotations: true + }; + #layers = [null, null, null, null]; + constructor(options) { + super(options); + const container = options.container; + const defaultViewport = options.defaultViewport; + this.renderingId = "page" + this.id; + this.#layerProperties = options.layerProperties || DEFAULT_LAYER_PROPERTIES; + this.pdfPage = null; + this.pageLabel = null; + this.rotation = 0; + this.scale = options.scale || DEFAULT_SCALE; + this.viewport = defaultViewport; + this.pdfPageRotate = defaultViewport.rotation; + this._optionalContentConfigPromise = options.optionalContentConfigPromise || null; + this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE; + this.#annotationMode = options.annotationMode ?? AnnotationMode.ENABLE_FORMS; + this.imageResourcesPath = options.imageResourcesPath || ""; + this.enableDetailCanvas = options.enableDetailCanvas ?? true; + this.maxCanvasPixels = options.maxCanvasPixels ?? AppOptions.get("maxCanvasPixels"); + this.maxCanvasDim = options.maxCanvasDim || AppOptions.get("maxCanvasDim"); + this.capCanvasAreaFactor = options.capCanvasAreaFactor ?? AppOptions.get("capCanvasAreaFactor"); + this.#enableAutoLinking = options.enableAutoLinking !== false; + this.l10n = options.l10n; + this.l10n ||= new genericl10n_GenericL10n(); + this._isStandalone = !this.renderingQueue?.hasViewer(); + this._container = container; + this._annotationCanvasMap = null; + this.annotationLayer = null; + this.annotationEditorLayer = null; + this.textLayer = null; + this.xfaLayer = null; + this.structTreeLayer = null; + this.drawLayer = null; + this.detailView = null; + const div = document.createElement("div"); + div.className = "page"; + div.setAttribute("data-page-number", this.id); + div.setAttribute("role", "region"); + div.setAttribute("data-l10n-id", "pdfjs-page-landmark"); + div.setAttribute("data-l10n-args", JSON.stringify({ + page: this.id + })); + this.div = div; + this.#setDimensions(); + container?.append(div); + if (this._isStandalone) { + container?.style.setProperty("--scale-factor", this.scale * PixelsPerInch.PDF_TO_CSS_UNITS); + if (this.pageColors?.background) { + container?.style.setProperty("--page-bg-color", this.pageColors.background); + } + const { + optionalContentConfigPromise + } = options; + if (optionalContentConfigPromise) { + optionalContentConfigPromise.then(optionalContentConfig => { + if (optionalContentConfigPromise !== this._optionalContentConfigPromise) { + return; + } + this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility; + }); + } + if (!options.l10n) { + this.l10n.translate(this.div); + } + } + } + #addLayer(div, name) { + const pos = LAYERS_ORDER.get(name); + const oldDiv = this.#layers[pos]; + this.#layers[pos] = div; + if (oldDiv) { + oldDiv.replaceWith(div); + return; + } + for (let i = pos - 1; i >= 0; i--) { + const layer = this.#layers[i]; + if (layer) { + layer.after(div); + return; + } + } + this.div.prepend(div); + } + #setDimensions() { + const { + div, + viewport + } = this; + if (viewport.userUnit !== this.#userUnit) { + if (viewport.userUnit !== 1) { + div.style.setProperty("--user-unit", viewport.userUnit); + } else { + div.style.removeProperty("--user-unit"); + } + this.#userUnit = viewport.userUnit; + } + if (this.pdfPage) { + if (this.#previousRotation === viewport.rotation) { + return; + } + this.#previousRotation = viewport.rotation; + } + setLayerDimensions(div, viewport, true, false); + } + setPdfPage(pdfPage) { + if (this._isStandalone && (this.pageColors?.foreground === "CanvasText" || this.pageColors?.background === "Canvas")) { + this._container?.style.setProperty("--hcm-highlight-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight")); + this._container?.style.setProperty("--hcm-highlight-selected-filter", pdfPage.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "Highlight")); + } + this.pdfPage = pdfPage; + this.pdfPageRotate = pdfPage.rotate; + const totalRotation = (this.rotation + this.pdfPageRotate) % 360; + this.viewport = pdfPage.getViewport({ + scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS, + rotation: totalRotation + }); + this.#setDimensions(); + this.reset(); + } + destroy() { + this.reset(); + this.pdfPage?.cleanup(); + } + hasEditableAnnotations() { + return !!this.annotationLayer?.hasEditableAnnotations(); + } + get _textHighlighter() { + return shadow(this, "_textHighlighter", new TextHighlighter({ + pageIndex: this.id - 1, + eventBus: this.eventBus, + findController: this.#layerProperties.findController + })); + } + #dispatchLayerRendered(name, error) { + this.eventBus.dispatch(name, { + source: this, + pageNumber: this.id, + error + }); + } + async #renderAnnotationLayer() { + let error = null; + try { + await this.annotationLayer.render({ + viewport: this.viewport, + intent: "display", + structTreeLayer: this.structTreeLayer + }); + } catch (ex) { + console.error("#renderAnnotationLayer:", ex); + error = ex; + } finally { + this.#dispatchLayerRendered("annotationlayerrendered", error); + } + } + async #renderAnnotationEditorLayer() { + let error = null; + try { + await this.annotationEditorLayer.render({ + viewport: this.viewport, + intent: "display" + }); + } catch (ex) { + console.error("#renderAnnotationEditorLayer:", ex); + error = ex; + } finally { + this.#dispatchLayerRendered("annotationeditorlayerrendered", error); + } + } + async #renderDrawLayer() { + try { + await this.drawLayer.render({ + intent: "display" + }); + } catch (ex) { + console.error("#renderDrawLayer:", ex); + } + } + async #renderXfaLayer() { + let error = null; + try { + const result = await this.xfaLayer.render({ + viewport: this.viewport, + intent: "display" + }); + if (result?.textDivs && this._textHighlighter) { + this.#buildXfaTextContentItems(result.textDivs); + } + } catch (ex) { + console.error("#renderXfaLayer:", ex); + error = ex; + } finally { + if (this.xfaLayer?.div) { + this.l10n.pause(); + this.#addLayer(this.xfaLayer.div, "xfaLayer"); + this.l10n.resume(); + } + this.#dispatchLayerRendered("xfalayerrendered", error); + } + } + async #renderTextLayer() { + if (!this.textLayer) { + return; + } + let error = null; + try { + await this.textLayer.render({ + viewport: this.viewport + }); + } catch (ex) { + if (ex instanceof AbortException) { + return; + } + console.error("#renderTextLayer:", ex); + error = ex; + } + this.#dispatchLayerRendered("textlayerrendered", error); + this.#renderStructTreeLayer(); + } + async #renderStructTreeLayer() { + if (!this.textLayer) { + return; + } + const treeDom = await this.structTreeLayer?.render(); + if (treeDom) { + this.l10n.pause(); + this.structTreeLayer?.addElementsToTextLayer(); + if (this.canvas && treeDom.parentNode !== this.canvas) { + this.canvas.append(treeDom); + } + this.l10n.resume(); + } + this.structTreeLayer?.show(); + } + async #buildXfaTextContentItems(textDivs) { + const text = await this.pdfPage.getTextContent(); + const items = []; + for (const item of text.items) { + items.push(item.str); + } + this._textHighlighter.setTextMapping(textDivs, items); + this._textHighlighter.enable(); + } + async #injectLinkAnnotations(textLayerPromise) { + let error = null; + try { + await textLayerPromise; + if (!this.annotationLayer) { + return; + } + await this.annotationLayer.injectLinkAnnotations({ + inferredLinks: Autolinker.processLinks(this), + viewport: this.viewport, + structTreeLayer: this.structTreeLayer + }); + } catch (ex) { + console.error("#injectLinkAnnotations:", ex); + error = ex; + } + } + _resetCanvas() { + super._resetCanvas(); + this.#originalViewport = null; + } + reset({ + keepAnnotationLayer = false, + keepAnnotationEditorLayer = false, + keepXfaLayer = false, + keepTextLayer = false, + keepCanvasWrapper = false, + preserveDetailViewState = false + } = {}) { + this.cancelRendering({ + keepAnnotationLayer, + keepAnnotationEditorLayer, + keepXfaLayer, + keepTextLayer + }); + this.renderingState = RenderingStates.INITIAL; + const div = this.div; + const childNodes = div.childNodes, + annotationLayerNode = keepAnnotationLayer && this.annotationLayer?.div || null, + annotationEditorLayerNode = keepAnnotationEditorLayer && this.annotationEditorLayer?.div || null, + xfaLayerNode = keepXfaLayer && this.xfaLayer?.div || null, + textLayerNode = keepTextLayer && this.textLayer?.div || null, + canvasWrapperNode = keepCanvasWrapper && this.#canvasWrapper || null; + for (let i = childNodes.length - 1; i >= 0; i--) { + const node = childNodes[i]; + switch (node) { + case annotationLayerNode: + case annotationEditorLayerNode: + case xfaLayerNode: + case textLayerNode: + case canvasWrapperNode: + continue; + } + node.remove(); + const layerIndex = this.#layers.indexOf(node); + if (layerIndex >= 0) { + this.#layers[layerIndex] = null; + } + } + div.removeAttribute("data-loaded"); + if (annotationLayerNode) { + this.annotationLayer.hide(); + } + if (annotationEditorLayerNode) { + this.annotationEditorLayer.hide(); + } + if (xfaLayerNode) { + this.xfaLayer.hide(); + } + if (textLayerNode) { + this.textLayer.hide(); + } + this.structTreeLayer?.hide(); + if (!keepCanvasWrapper && this.#canvasWrapper) { + this.#canvasWrapper = null; + this._resetCanvas(); + } + if (!preserveDetailViewState) { + this.detailView?.reset({ + keepCanvas: keepCanvasWrapper + }); + if (!keepCanvasWrapper) { + this.detailView = null; + } + } + } + toggleEditingMode(isEditing) { + this.#isEditing = isEditing; + if (!this.hasEditableAnnotations()) { + return; + } + this.reset({ + keepAnnotationLayer: true, + keepAnnotationEditorLayer: true, + keepXfaLayer: true, + keepTextLayer: true, + keepCanvasWrapper: true + }); + } + updateVisibleArea(visibleArea) { + if (this.enableDetailCanvas) { + if (this.#needsRestrictedScaling && this.maxCanvasPixels > 0 && visibleArea) { + this.detailView ??= new PDFPageDetailView({ + pageView: this + }); + this.detailView.update({ + visibleArea + }); + } else if (this.detailView) { + this.detailView.reset(); + this.detailView = null; + } + } + } + update({ + scale = 0, + rotation = null, + optionalContentConfigPromise = null, + drawingDelay = -1 + }) { + this.scale = scale || this.scale; + if (typeof rotation === "number") { + this.rotation = rotation; + } + if (optionalContentConfigPromise instanceof Promise) { + this._optionalContentConfigPromise = optionalContentConfigPromise; + optionalContentConfigPromise.then(optionalContentConfig => { + if (optionalContentConfigPromise !== this._optionalContentConfigPromise) { + return; + } + this.#useThumbnailCanvas.initialOptionalContent = optionalContentConfig.hasInitialVisibility; + }); + } + this.#useThumbnailCanvas.directDrawing = true; + const totalRotation = (this.rotation + this.pdfPageRotate) % 360; + this.viewport = this.viewport.clone({ + scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS, + rotation: totalRotation + }); + this.#setDimensions(); + if (this._isStandalone) { + this._container?.style.setProperty("--scale-factor", this.viewport.scale); + } + this.#computeScale(); + if (this.canvas) { + const onlyCssZoom = this.#hasRestrictedScaling && this.#needsRestrictedScaling; + const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000; + if (postponeDrawing || onlyCssZoom) { + if (postponeDrawing && !onlyCssZoom && this.renderingState !== RenderingStates.FINISHED) { + this.cancelRendering({ + keepAnnotationLayer: true, + keepAnnotationEditorLayer: true, + keepXfaLayer: true, + keepTextLayer: true, + cancelExtraDelay: drawingDelay + }); + this.renderingState = RenderingStates.FINISHED; + this.#useThumbnailCanvas.directDrawing = false; + } + this.cssTransform({ + redrawAnnotationLayer: true, + redrawAnnotationEditorLayer: true, + redrawXfaLayer: true, + redrawTextLayer: !postponeDrawing, + hideTextLayer: postponeDrawing + }); + if (!postponeDrawing) { + this.detailView?.update({ + underlyingViewUpdated: true + }); + this.dispatchPageRendered(true, false); + } + return; + } + } + this.cssTransform({}); + this.reset({ + keepAnnotationLayer: true, + keepAnnotationEditorLayer: true, + keepXfaLayer: true, + keepTextLayer: true, + keepCanvasWrapper: true, + preserveDetailViewState: true + }); + this.detailView?.update({ + underlyingViewUpdated: true + }); + } + #computeScale() { + const { + width, + height + } = this.viewport; + const outputScale = this.outputScale = new OutputScale(); + if (this.maxCanvasPixels === 0) { + const invScale = 1 / this.scale; + outputScale.sx *= invScale; + outputScale.sy *= invScale; + this.#needsRestrictedScaling = true; + } else { + this.#needsRestrictedScaling = outputScale.limitCanvas(width, height, this.maxCanvasPixels, this.maxCanvasDim, this.capCanvasAreaFactor); + } + } + cancelRendering({ + keepAnnotationLayer = false, + keepAnnotationEditorLayer = false, + keepXfaLayer = false, + keepTextLayer = false, + cancelExtraDelay = 0 + } = {}) { + super.cancelRendering({ + cancelExtraDelay + }); + if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) { + this.textLayer.cancel(); + this.textLayer = null; + } + if (this.annotationLayer && (!keepAnnotationLayer || !this.annotationLayer.div)) { + this.annotationLayer.cancel(); + this.annotationLayer = null; + this._annotationCanvasMap = null; + } + if (this.structTreeLayer && !this.textLayer) { + this.structTreeLayer = null; + } + if (this.annotationEditorLayer && (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)) { + if (this.drawLayer) { + this.drawLayer.cancel(); + this.drawLayer = null; + } + this.annotationEditorLayer.cancel(); + this.annotationEditorLayer = null; + } + if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) { + this.xfaLayer.cancel(); + this.xfaLayer = null; + this._textHighlighter?.disable(); + } + } + cssTransform({ + redrawAnnotationLayer = false, + redrawAnnotationEditorLayer = false, + redrawXfaLayer = false, + redrawTextLayer = false, + hideTextLayer = false + }) { + const { + canvas + } = this; + if (!canvas) { + return; + } + const originalViewport = this.#originalViewport; + if (this.viewport !== originalViewport) { + const relativeRotation = (360 + this.viewport.rotation - originalViewport.rotation) % 360; + if (relativeRotation === 90 || relativeRotation === 270) { + const { + width, + height + } = this.viewport; + const scaleX = height / width; + const scaleY = width / height; + canvas.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX},${scaleY})`; + } else { + canvas.style.transform = relativeRotation === 0 ? "" : `rotate(${relativeRotation}deg)`; + } + } + if (redrawAnnotationLayer && this.annotationLayer) { + this.#renderAnnotationLayer(); + } + if (redrawAnnotationEditorLayer && this.annotationEditorLayer) { + if (this.drawLayer) { + this.#renderDrawLayer(); + } + this.#renderAnnotationEditorLayer(); + } + if (redrawXfaLayer && this.xfaLayer) { + this.#renderXfaLayer(); + } + if (this.textLayer) { + if (hideTextLayer) { + this.textLayer.hide(); + this.structTreeLayer?.hide(); + } else if (redrawTextLayer) { + this.#renderTextLayer(); + } + } + } + get width() { + return this.viewport.width; + } + get height() { + return this.viewport.height; + } + getPagePoint(x, y) { + return this.viewport.convertToPdfPoint(x, y); + } + _ensureCanvasWrapper() { + let canvasWrapper = this.#canvasWrapper; + if (!canvasWrapper) { + canvasWrapper = this.#canvasWrapper = document.createElement("div"); + canvasWrapper.classList.add("canvasWrapper"); + this.#addLayer(canvasWrapper, "canvasWrapper"); + } + return canvasWrapper; + } + _getRenderingContext(canvas, transform) { + return { + canvas, + transform, + viewport: this.viewport, + annotationMode: this.#annotationMode, + optionalContentConfigPromise: this._optionalContentConfigPromise, + annotationCanvasMap: this._annotationCanvasMap, + pageColors: this.pageColors, + isEditing: this.#isEditing + }; + } + async draw() { + if (this.renderingState !== RenderingStates.INITIAL) { + console.error("Must be in new state before drawing"); + this.reset(); + } + const { + div, + l10n, + pdfPage, + viewport + } = this; + if (!pdfPage) { + this.renderingState = RenderingStates.FINISHED; + throw new Error("pdfPage is not loaded"); + } + this.renderingState = RenderingStates.RUNNING; + const canvasWrapper = this._ensureCanvasWrapper(); + if (!this.textLayer && this.#textLayerMode !== TextLayerMode.DISABLE && !pdfPage.isPureXfa) { + this._accessibilityManager ||= new TextAccessibilityManager(); + this.textLayer = new TextLayerBuilder({ + pdfPage, + highlighter: this._textHighlighter, + accessibilityManager: this._accessibilityManager, + enablePermissions: this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS, + onAppend: textLayerDiv => { + this.l10n.pause(); + this.#addLayer(textLayerDiv, "textLayer"); + this.l10n.resume(); + } + }); + } + if (!this.annotationLayer && this.#annotationMode !== AnnotationMode.DISABLE) { + const { + annotationStorage, + annotationEditorUIManager, + downloadManager, + enableScripting, + fieldObjectsPromise, + hasJSActionsPromise, + linkService + } = this.#layerProperties; + this._annotationCanvasMap ||= new Map(); + this.annotationLayer = new AnnotationLayerBuilder({ + pdfPage, + annotationStorage, + imageResourcesPath: this.imageResourcesPath, + renderForms: this.#annotationMode === AnnotationMode.ENABLE_FORMS, + linkService, + downloadManager, + enableScripting, + hasJSActionsPromise, + fieldObjectsPromise, + annotationCanvasMap: this._annotationCanvasMap, + accessibilityManager: this._accessibilityManager, + annotationEditorUIManager, + onAppend: annotationLayerDiv => { + this.#addLayer(annotationLayerDiv, "annotationLayer"); + } + }); + } + const { + width, + height + } = viewport; + this.#originalViewport = viewport; + const { + canvas, + prevCanvas + } = this._createCanvas(newCanvas => { + canvasWrapper.prepend(newCanvas); + }); + canvas.setAttribute("role", "presentation"); + if (!this.outputScale) { + this.#computeScale(); + } + const { + outputScale + } = this; + this.#hasRestrictedScaling = this.#needsRestrictedScaling; + const sfx = approximateFraction(outputScale.sx); + const sfy = approximateFraction(outputScale.sy); + const canvasWidth = canvas.width = floorToDivide(calcRound(width * outputScale.sx), sfx[0]); + const canvasHeight = canvas.height = floorToDivide(calcRound(height * outputScale.sy), sfy[0]); + const pageWidth = floorToDivide(calcRound(width), sfx[1]); + const pageHeight = floorToDivide(calcRound(height), sfy[1]); + outputScale.sx = canvasWidth / pageWidth; + outputScale.sy = canvasHeight / pageHeight; + if (this.#scaleRoundX !== sfx[1]) { + div.style.setProperty("--scale-round-x", `${sfx[1]}px`); + this.#scaleRoundX = sfx[1]; + } + if (this.#scaleRoundY !== sfy[1]) { + div.style.setProperty("--scale-round-y", `${sfy[1]}px`); + this.#scaleRoundY = sfy[1]; + } + const transform = outputScale.scaled ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0] : null; + const resultPromise = this._drawCanvas(this._getRenderingContext(canvas, transform), () => { + prevCanvas?.remove(); + this._resetCanvas(); + }, renderTask => { + this.#useThumbnailCanvas.regularAnnotations = !renderTask.separateAnnots; + this.dispatchPageRendered(false, false); + }).then(async () => { + this.structTreeLayer ||= new StructTreeLayerBuilder(pdfPage, viewport.rawDims); + const textLayerPromise = this.#renderTextLayer(); + if (this.annotationLayer) { + await this.#renderAnnotationLayer(); + if (this.#enableAutoLinking && this.annotationLayer && this.textLayer) { + await this.#injectLinkAnnotations(textLayerPromise); + } + } + const { + annotationEditorUIManager + } = this.#layerProperties; + if (!annotationEditorUIManager) { + return; + } + this.drawLayer ||= new DrawLayerBuilder({ + pageIndex: this.id + }); + await this.#renderDrawLayer(); + this.drawLayer.setParent(canvasWrapper); + this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({ + uiManager: annotationEditorUIManager, + pdfPage, + l10n, + structTreeLayer: this.structTreeLayer, + accessibilityManager: this._accessibilityManager, + annotationLayer: this.annotationLayer?.annotationLayer, + textLayer: this.textLayer, + drawLayer: this.drawLayer.getDrawLayer(), + onAppend: annotationEditorLayerDiv => { + this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer"); + } + }); + this.#renderAnnotationEditorLayer(); + }); + if (pdfPage.isPureXfa) { + if (!this.xfaLayer) { + const { + annotationStorage, + linkService + } = this.#layerProperties; + this.xfaLayer = new XfaLayerBuilder({ + pdfPage, + annotationStorage, + linkService + }); + } + this.#renderXfaLayer(); + } + div.setAttribute("data-loaded", true); + this.dispatchPageRender(); + return resultPromise; + } + setPageLabel(label) { + this.pageLabel = typeof label === "string" ? label : null; + this.div.setAttribute("data-l10n-args", JSON.stringify({ + page: this.pageLabel ?? this.id + })); + if (this.pageLabel !== null) { + this.div.setAttribute("data-page-label", this.pageLabel); + } else { + this.div.removeAttribute("data-page-label"); + } + } + get thumbnailCanvas() { + const { + directDrawing, + initialOptionalContent, + regularAnnotations + } = this.#useThumbnailCanvas; + return directDrawing && initialOptionalContent && regularAnnotations ? this.canvas : null; + } +} + +;// ./web/generic_scripting.js + +async function docProperties(pdfDocument) { + const url = "", + baseUrl = ""; + const { + info, + metadata, + contentDispositionFilename, + contentLength + } = await pdfDocument.getMetadata(); + return { + ...info, + baseURL: baseUrl, + filesize: contentLength || (await pdfDocument.getDownloadInfo()).length, + filename: contentDispositionFilename || getPdfFilenameFromUrl(url), + metadata: metadata?.getRaw(), + authors: metadata?.get("dc:creator"), + numPages: pdfDocument.numPages, + URL: url + }; +} +class GenericScripting { + constructor(sandboxBundleSrc) { + this._ready = new Promise((resolve, reject) => { + const sandbox = import( + /*webpackIgnore: true*/ + /*@vite-ignore*/ + sandboxBundleSrc); + sandbox.then(pdfjsSandbox => { + resolve(pdfjsSandbox.QuickJSSandbox()); + }).catch(reject); + }); + } + async createSandbox(data) { + const sandbox = await this._ready; + sandbox.create(data); + } + async dispatchEventInSandbox(event) { + const sandbox = await this._ready; + setTimeout(() => sandbox.dispatchEvent(event), 0); + } + async destroySandbox() { + const sandbox = await this._ready; + sandbox.nukeSandbox(); + } +} + +;// ./web/pdf_scripting_manager.js + + +class PDFScriptingManager { + #closeCapability = null; + #destroyCapability = null; + #docProperties = null; + #eventAbortController = null; + #eventBus = null; + #externalServices = null; + #pdfDocument = null; + #pdfViewer = null; + #ready = false; + #scripting = null; + #willPrintCapability = null; + constructor({ + eventBus, + externalServices = null, + docProperties = null + }) { + this.#eventBus = eventBus; + this.#externalServices = externalServices; + this.#docProperties = docProperties; + } + setViewer(pdfViewer) { + this.#pdfViewer = pdfViewer; + } + async setDocument(pdfDocument) { + if (this.#pdfDocument) { + await this.#destroyScripting(); + } + this.#pdfDocument = pdfDocument; + if (!pdfDocument) { + return; + } + const [objects, calculationOrder, docActions] = await Promise.all([pdfDocument.getFieldObjects(), pdfDocument.getCalculationOrderIds(), pdfDocument.getJSActions()]); + if (!objects && !docActions) { + await this.#destroyScripting(); + return; + } + if (pdfDocument !== this.#pdfDocument) { + return; + } + try { + this.#scripting = this.#initScripting(); + } catch (error) { + console.error("setDocument:", error); + await this.#destroyScripting(); + return; + } + const eventBus = this.#eventBus; + this.#eventAbortController = new AbortController(); + const { + signal + } = this.#eventAbortController; + eventBus._on("updatefromsandbox", event => { + if (event?.source === window) { + this.#updateFromSandbox(event.detail); + } + }, { + signal + }); + eventBus._on("dispatcheventinsandbox", event => { + this.#scripting?.dispatchEventInSandbox(event.detail); + }, { + signal + }); + eventBus._on("pagechanging", ({ + pageNumber, + previous + }) => { + if (pageNumber === previous) { + return; + } + this.#dispatchPageClose(previous); + this.#dispatchPageOpen(pageNumber); + }, { + signal + }); + eventBus._on("pagerendered", ({ + pageNumber + }) => { + if (!this._pageOpenPending.has(pageNumber)) { + return; + } + if (pageNumber !== this.#pdfViewer.currentPageNumber) { + return; + } + this.#dispatchPageOpen(pageNumber); + }, { + signal + }); + eventBus._on("pagesdestroy", async () => { + await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber); + await this.#scripting?.dispatchEventInSandbox({ + id: "doc", + name: "WillClose" + }); + this.#closeCapability?.resolve(); + }, { + signal + }); + try { + const docProperties = await this.#docProperties(pdfDocument); + if (pdfDocument !== this.#pdfDocument) { + return; + } + await this.#scripting.createSandbox({ + objects, + calculationOrder, + appInfo: { + platform: navigator.platform, + language: navigator.language + }, + docInfo: { + ...docProperties, + actions: docActions + } + }); + eventBus.dispatch("sandboxcreated", { + source: this + }); + } catch (error) { + console.error("setDocument:", error); + await this.#destroyScripting(); + return; + } + await this.#scripting?.dispatchEventInSandbox({ + id: "doc", + name: "Open" + }); + await this.#dispatchPageOpen(this.#pdfViewer.currentPageNumber, true); + Promise.resolve().then(() => { + if (pdfDocument === this.#pdfDocument) { + this.#ready = true; + } + }); + } + async dispatchWillSave() { + return this.#scripting?.dispatchEventInSandbox({ + id: "doc", + name: "WillSave" + }); + } + async dispatchDidSave() { + return this.#scripting?.dispatchEventInSandbox({ + id: "doc", + name: "DidSave" + }); + } + async dispatchWillPrint() { + if (!this.#scripting) { + return; + } + await this.#willPrintCapability?.promise; + this.#willPrintCapability = Promise.withResolvers(); + try { + await this.#scripting.dispatchEventInSandbox({ + id: "doc", + name: "WillPrint" + }); + } catch (ex) { + this.#willPrintCapability.resolve(); + this.#willPrintCapability = null; + throw ex; + } + await this.#willPrintCapability.promise; + } + async dispatchDidPrint() { + return this.#scripting?.dispatchEventInSandbox({ + id: "doc", + name: "DidPrint" + }); + } + get destroyPromise() { + return this.#destroyCapability?.promise || null; + } + get ready() { + return this.#ready; + } + get _pageOpenPending() { + return shadow(this, "_pageOpenPending", new Set()); + } + get _visitedPages() { + return shadow(this, "_visitedPages", new Map()); + } + async #updateFromSandbox(detail) { + const pdfViewer = this.#pdfViewer; + const isInPresentationMode = pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode; + const { + id, + siblings, + command, + value + } = detail; + if (!id) { + switch (command) { + case "clear": + console.clear(); + break; + case "error": + console.error(value); + break; + case "layout": + if (!isInPresentationMode) { + const modes = apiPageLayoutToViewerModes(value); + pdfViewer.spreadMode = modes.spreadMode; + } + break; + case "page-num": + pdfViewer.currentPageNumber = value + 1; + break; + case "print": + await pdfViewer.pagesPromise; + this.#eventBus.dispatch("print", { + source: this + }); + break; + case "println": + console.log(value); + break; + case "zoom": + if (!isInPresentationMode) { + pdfViewer.currentScaleValue = value; + } + break; + case "SaveAs": + this.#eventBus.dispatch("download", { + source: this + }); + break; + case "FirstPage": + pdfViewer.currentPageNumber = 1; + break; + case "LastPage": + pdfViewer.currentPageNumber = pdfViewer.pagesCount; + break; + case "NextPage": + pdfViewer.nextPage(); + break; + case "PrevPage": + pdfViewer.previousPage(); + break; + case "ZoomViewIn": + if (!isInPresentationMode) { + pdfViewer.increaseScale(); + } + break; + case "ZoomViewOut": + if (!isInPresentationMode) { + pdfViewer.decreaseScale(); + } + break; + case "WillPrintFinished": + this.#willPrintCapability?.resolve(); + this.#willPrintCapability = null; + break; + } + return; + } + if (isInPresentationMode && detail.focus) { + return; + } + delete detail.id; + delete detail.siblings; + const ids = siblings ? [id, ...siblings] : [id]; + for (const elementId of ids) { + const element = document.querySelector(`[data-element-id="${elementId}"]`); + if (element) { + element.dispatchEvent(new CustomEvent("updatefromsandbox", { + detail + })); + } else { + this.#pdfDocument?.annotationStorage.setValue(elementId, detail); + } + } + } + async #dispatchPageOpen(pageNumber, initialize = false) { + const pdfDocument = this.#pdfDocument, + visitedPages = this._visitedPages; + if (initialize) { + this.#closeCapability = Promise.withResolvers(); + } + if (!this.#closeCapability) { + return; + } + const pageView = this.#pdfViewer.getPageView(pageNumber - 1); + if (pageView?.renderingState !== RenderingStates.FINISHED) { + this._pageOpenPending.add(pageNumber); + return; + } + this._pageOpenPending.delete(pageNumber); + const actionsPromise = (async () => { + const actions = await (!visitedPages.has(pageNumber) ? pageView.pdfPage?.getJSActions() : null); + if (pdfDocument !== this.#pdfDocument) { + return; + } + await this.#scripting?.dispatchEventInSandbox({ + id: "page", + name: "PageOpen", + pageNumber, + actions + }); + })(); + visitedPages.set(pageNumber, actionsPromise); + } + async #dispatchPageClose(pageNumber) { + const pdfDocument = this.#pdfDocument, + visitedPages = this._visitedPages; + if (!this.#closeCapability) { + return; + } + if (this._pageOpenPending.has(pageNumber)) { + return; + } + const actionsPromise = visitedPages.get(pageNumber); + if (!actionsPromise) { + return; + } + visitedPages.set(pageNumber, null); + await actionsPromise; + if (pdfDocument !== this.#pdfDocument) { + return; + } + await this.#scripting?.dispatchEventInSandbox({ + id: "page", + name: "PageClose", + pageNumber + }); + } + #initScripting() { + this.#destroyCapability = Promise.withResolvers(); + if (this.#scripting) { + throw new Error("#initScripting: Scripting already exists."); + } + return this.#externalServices.createScripting(); + } + async #destroyScripting() { + if (!this.#scripting) { + this.#pdfDocument = null; + this.#destroyCapability?.resolve(); + return; + } + if (this.#closeCapability) { + await Promise.race([this.#closeCapability.promise, new Promise(resolve => { + setTimeout(resolve, 1000); + })]).catch(() => {}); + this.#closeCapability = null; + } + this.#pdfDocument = null; + try { + await this.#scripting.destroySandbox(); + } catch {} + this.#willPrintCapability?.reject(new Error("Scripting destroyed.")); + this.#willPrintCapability = null; + this.#eventAbortController?.abort(); + this.#eventAbortController = null; + this._pageOpenPending.clear(); + this._visitedPages.clear(); + this.#scripting = null; + this.#ready = false; + this.#destroyCapability?.resolve(); + } +} + +;// ./web/pdf_scripting_manager.component.js + + +class PDFScriptingManagerComponents extends PDFScriptingManager { + constructor(options) { + if (!options.externalServices) { + window.addEventListener("updatefromsandbox", event => { + options.eventBus.dispatch("updatefromsandbox", { + source: window, + detail: event.detail + }); + }); + } + options.externalServices ||= { + createScripting: () => new GenericScripting(options.sandboxBundleSrc) + }; + options.docProperties ||= pdfDocument => docProperties(pdfDocument); + super(options); + } +} + +;// ./web/pdf_rendering_queue.js + + +const CLEANUP_TIMEOUT = 30000; +class PDFRenderingQueue { + constructor() { + this.pdfViewer = null; + this.pdfThumbnailViewer = null; + this.onIdle = null; + this.highestPriorityPage = null; + this.idleTimeout = null; + this.printing = false; + this.isThumbnailViewEnabled = false; + Object.defineProperty(this, "hasViewer", { + value: () => !!this.pdfViewer + }); + } + setViewer(pdfViewer) { + this.pdfViewer = pdfViewer; + } + setThumbnailViewer(pdfThumbnailViewer) { + this.pdfThumbnailViewer = pdfThumbnailViewer; + } + isHighestPriority(view) { + return this.highestPriorityPage === view.renderingId; + } + renderHighestPriority(currentlyVisiblePages) { + if (this.idleTimeout) { + clearTimeout(this.idleTimeout); + this.idleTimeout = null; + } + if (this.pdfViewer.forceRendering(currentlyVisiblePages)) { + return; + } + if (this.isThumbnailViewEnabled && this.pdfThumbnailViewer?.forceRendering()) { + return; + } + if (this.printing) { + return; + } + if (this.onIdle) { + this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT); + } + } + getHighestPriority(visible, views, scrolledDown, preRenderExtra = false, ignoreDetailViews = false) { + const visibleViews = visible.views, + numVisible = visibleViews.length; + if (numVisible === 0) { + return null; + } + for (let i = 0; i < numVisible; i++) { + const view = visibleViews[i].view; + if (!this.isViewFinished(view)) { + return view; + } + } + if (!ignoreDetailViews) { + for (let i = 0; i < numVisible; i++) { + const { + detailView + } = visibleViews[i].view; + if (detailView && !this.isViewFinished(detailView)) { + return detailView; + } + } + } + const firstId = visible.first.id, + lastId = visible.last.id; + if (lastId - firstId + 1 > numVisible) { + const visibleIds = visible.ids; + for (let i = 1, ii = lastId - firstId; i < ii; i++) { + const holeId = scrolledDown ? firstId + i : lastId - i; + if (visibleIds.has(holeId)) { + continue; + } + const holeView = views[holeId - 1]; + if (!this.isViewFinished(holeView)) { + return holeView; + } + } + } + let preRenderIndex = scrolledDown ? lastId : firstId - 2; + let preRenderView = views[preRenderIndex]; + if (preRenderView && !this.isViewFinished(preRenderView)) { + return preRenderView; + } + if (preRenderExtra) { + preRenderIndex += scrolledDown ? 1 : -1; + preRenderView = views[preRenderIndex]; + if (preRenderView && !this.isViewFinished(preRenderView)) { + return preRenderView; + } + } + return null; + } + isViewFinished(view) { + return view.renderingState === RenderingStates.FINISHED; + } + renderView(view) { + switch (view.renderingState) { + case RenderingStates.FINISHED: + return false; + case RenderingStates.PAUSED: + this.highestPriorityPage = view.renderingId; + view.resume(); + break; + case RenderingStates.RUNNING: + this.highestPriorityPage = view.renderingId; + break; + case RenderingStates.INITIAL: + this.highestPriorityPage = view.renderingId; + view.draw().finally(() => { + this.renderHighestPriority(); + }).catch(reason => { + if (reason instanceof RenderingCancelledException) { + return; + } + console.error("renderView:", reason); + }); + break; + } + return true; + } +} + +;// ./web/pdf_viewer.js + + + + + + +const DEFAULT_CACHE_SIZE = 10; +const PagesCountLimit = { + FORCE_SCROLL_MODE_PAGE: 10000, + FORCE_LAZY_PAGE_INIT: 5000, + PAUSE_EAGER_PAGE_INIT: 250 +}; +function isValidAnnotationEditorMode(mode) { + return Object.values(AnnotationEditorType).includes(mode) && mode !== AnnotationEditorType.DISABLE; +} +class PDFPageViewBuffer { + #buf = new Set(); + #size = 0; + constructor(size) { + this.#size = size; + } + push(view) { + const buf = this.#buf; + if (buf.has(view)) { + buf.delete(view); + } + buf.add(view); + if (buf.size > this.#size) { + this.#destroyFirstView(); + } + } + resize(newSize, idsToKeep = null) { + this.#size = newSize; + const buf = this.#buf; + if (idsToKeep) { + const ii = buf.size; + let i = 1; + for (const view of buf) { + if (idsToKeep.has(view.id)) { + buf.delete(view); + buf.add(view); + } + if (++i > ii) { + break; + } + } + } + while (buf.size > this.#size) { + this.#destroyFirstView(); + } + } + has(view) { + return this.#buf.has(view); + } + [Symbol.iterator]() { + return this.#buf.keys(); + } + #destroyFirstView() { + const firstView = this.#buf.keys().next().value; + firstView?.destroy(); + this.#buf.delete(firstView); + } +} +class PDFViewer { + #buffer = null; + #altTextManager = null; + #annotationEditorHighlightColors = null; + #annotationEditorMode = AnnotationEditorType.NONE; + #annotationEditorUIManager = null; + #annotationMode = AnnotationMode.ENABLE_FORMS; + #commentManager = null; + #containerTopLeft = null; + #editorUndoBar = null; + #enableHWA = false; + #enableHighlightFloatingButton = false; + #enablePermissions = false; + #enableUpdatedAddImage = false; + #enableNewAltTextWhenAddingImage = false; + #enableAutoLinking = true; + #eventAbortController = null; + #minDurationToUpdateCanvas = 0; + #mlManager = null; + #scrollTimeoutId = null; + #switchAnnotationEditorModeAC = null; + #switchAnnotationEditorModeTimeoutId = null; + #getAllTextInProgress = false; + #hiddenCopyElement = null; + #interruptCopyCondition = false; + #previousContainerHeight = 0; + #resizeObserver = new ResizeObserver(this.#resizeObserverCallback.bind(this)); + #scrollModePageState = null; + #scaleTimeoutId = null; + #signatureManager = null; + #supportsPinchToZoom = true; + #textLayerMode = TextLayerMode.ENABLE; + #viewerAlert = null; + constructor(options) { + const viewerVersion = "5.4.54"; + if (version !== viewerVersion) { + throw new Error(`The API version "${version}" does not match the Viewer version "${viewerVersion}".`); + } + this.container = options.container; + this.viewer = options.viewer || options.container.firstElementChild; + this.#viewerAlert = options.viewerAlert || null; + if (this.container?.tagName !== "DIV" || this.viewer?.tagName !== "DIV") { + throw new Error("Invalid `container` and/or `viewer` option."); + } + if (this.container.offsetParent && getComputedStyle(this.container).position !== "absolute") { + throw new Error("The `container` must be absolutely positioned."); + } + this.#resizeObserver.observe(this.container); + this.eventBus = options.eventBus; + this.linkService = options.linkService || new SimpleLinkService(); + this.downloadManager = options.downloadManager || null; + this.findController = options.findController || null; + this.#altTextManager = options.altTextManager || null; + this.#commentManager = options.commentManager || null; + this.#signatureManager = options.signatureManager || null; + this.#editorUndoBar = options.editorUndoBar || null; + if (this.findController) { + this.findController.onIsPageVisible = pageNumber => this._getVisiblePages().ids.has(pageNumber); + } + this._scriptingManager = options.scriptingManager || null; + this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE; + this.#annotationMode = options.annotationMode ?? AnnotationMode.ENABLE_FORMS; + this.#annotationEditorMode = options.annotationEditorMode ?? AnnotationEditorType.NONE; + this.#annotationEditorHighlightColors = options.annotationEditorHighlightColors || null; + this.#enableHighlightFloatingButton = options.enableHighlightFloatingButton === true; + this.#enableUpdatedAddImage = options.enableUpdatedAddImage === true; + this.#enableNewAltTextWhenAddingImage = options.enableNewAltTextWhenAddingImage === true; + this.imageResourcesPath = options.imageResourcesPath || ""; + this.enablePrintAutoRotate = options.enablePrintAutoRotate || false; + this.removePageBorders = options.removePageBorders || false; + this.maxCanvasPixels = options.maxCanvasPixels; + this.maxCanvasDim = options.maxCanvasDim; + this.capCanvasAreaFactor = options.capCanvasAreaFactor; + this.enableDetailCanvas = options.enableDetailCanvas ?? true; + this.l10n = options.l10n; + this.l10n ||= new genericl10n_GenericL10n(); + this.#enablePermissions = options.enablePermissions || false; + this.pageColors = options.pageColors || null; + this.#mlManager = options.mlManager || null; + this.#enableHWA = options.enableHWA || false; + this.#supportsPinchToZoom = options.supportsPinchToZoom !== false; + this.#enableAutoLinking = options.enableAutoLinking !== false; + this.#minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500; + this.defaultRenderingQueue = !options.renderingQueue; + if (this.defaultRenderingQueue) { + this.renderingQueue = new PDFRenderingQueue(); + this.renderingQueue.setViewer(this); + } else { + this.renderingQueue = options.renderingQueue; + } + const { + abortSignal + } = options; + abortSignal?.addEventListener("abort", () => { + this.#resizeObserver.disconnect(); + this.#resizeObserver = null; + }, { + once: true + }); + this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this), abortSignal); + this.presentationModeState = PresentationModeState.UNKNOWN; + this._resetView(); + if (this.removePageBorders) { + this.viewer.classList.add("removePageBorders"); + } + this.#updateContainerHeightCss(); + this.eventBus._on("thumbnailrendered", ({ + pageNumber, + pdfPage + }) => { + const pageView = this._pages[pageNumber - 1]; + if (!this.#buffer.has(pageView)) { + pdfPage?.cleanup(); + } + }); + if (!options.l10n) { + this.l10n.translate(this.container); + } + } + get pagesCount() { + return this._pages.length; + } + getPageView(index) { + return this._pages[index]; + } + getCachedPageViews() { + return new Set(this.#buffer); + } + get pageViewsReady() { + return this._pages.every(pageView => pageView?.pdfPage); + } + get renderForms() { + return this.#annotationMode === AnnotationMode.ENABLE_FORMS; + } + get enableScripting() { + return !!this._scriptingManager; + } + get currentPageNumber() { + return this._currentPageNumber; + } + set currentPageNumber(val) { + if (!Number.isInteger(val)) { + throw new Error("Invalid page number."); + } + if (!this.pdfDocument) { + return; + } + if (!this._setCurrentPageNumber(val, true)) { + console.error(`currentPageNumber: "${val}" is not a valid page.`); + } + } + _setCurrentPageNumber(val, resetCurrentPageView = false) { + if (this._currentPageNumber === val) { + if (resetCurrentPageView) { + this.#resetCurrentPageView(); + } + return true; + } + if (!(0 < val && val <= this.pagesCount)) { + return false; + } + const previous = this._currentPageNumber; + this._currentPageNumber = val; + this.eventBus.dispatch("pagechanging", { + source: this, + pageNumber: val, + pageLabel: this._pageLabels?.[val - 1] ?? null, + previous + }); + if (resetCurrentPageView) { + this.#resetCurrentPageView(); + } + return true; + } + get currentPageLabel() { + return this._pageLabels?.[this._currentPageNumber - 1] ?? null; + } + set currentPageLabel(val) { + if (!this.pdfDocument) { + return; + } + let page = val | 0; + if (this._pageLabels) { + const i = this._pageLabels.indexOf(val); + if (i >= 0) { + page = i + 1; + } + } + if (!this._setCurrentPageNumber(page, true)) { + console.error(`currentPageLabel: "${val}" is not a valid page.`); + } + } + get currentScale() { + return this._currentScale !== UNKNOWN_SCALE ? this._currentScale : DEFAULT_SCALE; + } + set currentScale(val) { + if (isNaN(val)) { + throw new Error("Invalid numeric scale."); + } + if (!this.pdfDocument) { + return; + } + this.#setScale(val, { + noScroll: false + }); + } + get currentScaleValue() { + return this._currentScaleValue; + } + set currentScaleValue(val) { + if (!this.pdfDocument) { + return; + } + this.#setScale(val, { + noScroll: false + }); + } + get pagesRotation() { + return this._pagesRotation; + } + set pagesRotation(rotation) { + if (!isValidRotation(rotation)) { + throw new Error("Invalid pages rotation angle."); + } + if (!this.pdfDocument) { + return; + } + rotation %= 360; + if (rotation < 0) { + rotation += 360; + } + if (this._pagesRotation === rotation) { + return; + } + this._pagesRotation = rotation; + const pageNumber = this._currentPageNumber; + this.refresh(true, { + rotation + }); + if (this._currentScaleValue) { + this.#setScale(this._currentScaleValue, { + noScroll: true + }); + } + this.eventBus.dispatch("rotationchanging", { + source: this, + pagesRotation: rotation, + pageNumber + }); + if (this.defaultRenderingQueue) { + this.update(); + } + } + get firstPagePromise() { + return this.pdfDocument ? this._firstPageCapability.promise : null; + } + get onePageRendered() { + return this.pdfDocument ? this._onePageRenderedCapability.promise : null; + } + get pagesPromise() { + return this.pdfDocument ? this._pagesCapability.promise : null; + } + get _layerProperties() { + const self = this; + return shadow(this, "_layerProperties", { + get annotationEditorUIManager() { + return self.#annotationEditorUIManager; + }, + get annotationStorage() { + return self.pdfDocument?.annotationStorage; + }, + get downloadManager() { + return self.downloadManager; + }, + get enableScripting() { + return !!self._scriptingManager; + }, + get fieldObjectsPromise() { + return self.pdfDocument?.getFieldObjects(); + }, + get findController() { + return self.findController; + }, + get hasJSActionsPromise() { + return self.pdfDocument?.hasJSActions(); + }, + get linkService() { + return self.linkService; + } + }); + } + #initializePermissions(permissions) { + const params = { + annotationEditorMode: this.#annotationEditorMode, + annotationMode: this.#annotationMode, + textLayerMode: this.#textLayerMode + }; + if (!permissions) { + return params; + } + if (!permissions.includes(PermissionFlag.COPY) && this.#textLayerMode === TextLayerMode.ENABLE) { + params.textLayerMode = TextLayerMode.ENABLE_PERMISSIONS; + } + if (!permissions.includes(PermissionFlag.MODIFY_CONTENTS)) { + params.annotationEditorMode = AnnotationEditorType.DISABLE; + } + if (!permissions.includes(PermissionFlag.MODIFY_ANNOTATIONS) && !permissions.includes(PermissionFlag.FILL_INTERACTIVE_FORMS) && this.#annotationMode === AnnotationMode.ENABLE_FORMS) { + params.annotationMode = AnnotationMode.ENABLE; + } + return params; + } + async #onePageRenderedOrForceFetch(signal) { + if (document.visibilityState === "hidden" || !this.container.offsetParent || this._getVisiblePages().views.length === 0) { + return; + } + const hiddenCapability = Promise.withResolvers(), + ac = new AbortController(); + document.addEventListener("visibilitychange", () => { + if (document.visibilityState === "hidden") { + hiddenCapability.resolve(); + } + }, { + signal: AbortSignal.any([signal, ac.signal]) + }); + await Promise.race([this._onePageRenderedCapability.promise, hiddenCapability.promise]); + ac.abort(); + } + async getAllText() { + const texts = []; + const buffer = []; + for (let pageNum = 1, pagesCount = this.pdfDocument.numPages; pageNum <= pagesCount; ++pageNum) { + if (this.#interruptCopyCondition) { + return null; + } + buffer.length = 0; + const page = await this.pdfDocument.getPage(pageNum); + const { + items + } = await page.getTextContent(); + for (const item of items) { + if (item.str) { + buffer.push(item.str); + } + if (item.hasEOL) { + buffer.push("\n"); + } + } + texts.push(removeNullCharacters(buffer.join(""))); + } + return texts.join("\n"); + } + #copyCallback(textLayerMode, event) { + const selection = document.getSelection(); + const { + focusNode, + anchorNode + } = selection; + if (anchorNode && focusNode && selection.containsNode(this.#hiddenCopyElement)) { + if (this.#getAllTextInProgress || textLayerMode === TextLayerMode.ENABLE_PERMISSIONS) { + stopEvent(event); + return; + } + this.#getAllTextInProgress = true; + const { + classList + } = this.viewer; + classList.add("copyAll"); + const ac = new AbortController(); + window.addEventListener("keydown", ev => this.#interruptCopyCondition = ev.key === "Escape", { + signal: ac.signal + }); + this.getAllText().then(async text => { + if (text !== null) { + await navigator.clipboard.writeText(text); + } + }).catch(reason => { + console.warn(`Something goes wrong when extracting the text: ${reason.message}`); + }).finally(() => { + this.#getAllTextInProgress = false; + this.#interruptCopyCondition = false; + ac.abort(); + classList.remove("copyAll"); + }); + stopEvent(event); + } + } + setDocument(pdfDocument) { + if (this.pdfDocument) { + this.eventBus.dispatch("pagesdestroy", { + source: this + }); + this._cancelRendering(); + this._resetView(); + this.findController?.setDocument(null); + this._scriptingManager?.setDocument(null); + this.#annotationEditorUIManager?.destroy(); + this.#annotationEditorUIManager = null; + } + this.pdfDocument = pdfDocument; + if (!pdfDocument) { + return; + } + const pagesCount = pdfDocument.numPages; + const firstPagePromise = pdfDocument.getPage(1); + const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig({ + intent: "display" + }); + const permissionsPromise = this.#enablePermissions ? pdfDocument.getPermissions() : Promise.resolve(); + const { + eventBus, + pageColors, + viewer + } = this; + this.#eventAbortController = new AbortController(); + const { + signal + } = this.#eventAbortController; + if (pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) { + console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document."); + const mode = this._scrollMode = ScrollMode.PAGE; + eventBus.dispatch("scrollmodechanged", { + source: this, + mode + }); + } + this._pagesCapability.promise.then(() => { + eventBus.dispatch("pagesloaded", { + source: this, + pagesCount + }); + }, () => {}); + const onBeforeDraw = evt => { + const pageView = this._pages[evt.pageNumber - 1]; + if (!pageView) { + return; + } + this.#buffer.push(pageView); + }; + eventBus._on("pagerender", onBeforeDraw, { + signal + }); + const onAfterDraw = evt => { + if (evt.cssTransform || evt.isDetailView) { + return; + } + this._onePageRenderedCapability.resolve({ + timestamp: evt.timestamp + }); + eventBus._off("pagerendered", onAfterDraw); + }; + eventBus._on("pagerendered", onAfterDraw, { + signal + }); + Promise.all([firstPagePromise, permissionsPromise]).then(([firstPdfPage, permissions]) => { + if (pdfDocument !== this.pdfDocument) { + return; + } + this._firstPageCapability.resolve(firstPdfPage); + this._optionalContentConfigPromise = optionalContentConfigPromise; + const { + annotationEditorMode, + annotationMode, + textLayerMode + } = this.#initializePermissions(permissions); + if (textLayerMode !== TextLayerMode.DISABLE) { + const element = this.#hiddenCopyElement = document.createElement("div"); + element.id = "hiddenCopyElement"; + viewer.before(element); + } + if (annotationEditorMode !== AnnotationEditorType.DISABLE) { + const mode = annotationEditorMode; + if (pdfDocument.isPureXfa) { + console.warn("Warning: XFA-editing is not implemented."); + } else if (isValidAnnotationEditorMode(mode)) { + this.#annotationEditorUIManager = new AnnotationEditorUIManager(this.container, viewer, this.#viewerAlert, this.#altTextManager, this.#commentManager, this.#signatureManager, eventBus, pdfDocument, pageColors, this.#annotationEditorHighlightColors, this.#enableHighlightFloatingButton, this.#enableUpdatedAddImage, this.#enableNewAltTextWhenAddingImage, this.#mlManager, this.#editorUndoBar, this.#supportsPinchToZoom); + eventBus.dispatch("annotationeditoruimanager", { + source: this, + uiManager: this.#annotationEditorUIManager + }); + if (mode !== AnnotationEditorType.NONE) { + this.#preloadEditingData(mode); + this.#annotationEditorUIManager.updateMode(mode); + } + } else { + console.error(`Invalid AnnotationEditor mode: ${mode}`); + } + } + const viewerElement = this._scrollMode === ScrollMode.PAGE ? null : viewer; + const scale = this.currentScale; + const viewport = firstPdfPage.getViewport({ + scale: scale * PixelsPerInch.PDF_TO_CSS_UNITS + }); + viewer.style.setProperty("--scale-factor", viewport.scale); + if (pageColors?.background) { + viewer.style.setProperty("--page-bg-color", pageColors.background); + } + if (pageColors?.foreground === "CanvasText" || pageColors?.background === "Canvas") { + viewer.style.setProperty("--hcm-highlight-filter", pdfDocument.filterFactory.addHighlightHCMFilter("highlight", "CanvasText", "Canvas", "HighlightText", "Highlight")); + viewer.style.setProperty("--hcm-highlight-selected-filter", pdfDocument.filterFactory.addHighlightHCMFilter("highlight_selected", "CanvasText", "Canvas", "HighlightText", "ButtonText")); + } + for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) { + const pageView = new PDFPageView({ + container: viewerElement, + eventBus, + id: pageNum, + scale, + defaultViewport: viewport.clone(), + optionalContentConfigPromise, + renderingQueue: this.renderingQueue, + textLayerMode, + annotationMode, + imageResourcesPath: this.imageResourcesPath, + maxCanvasPixels: this.maxCanvasPixels, + maxCanvasDim: this.maxCanvasDim, + capCanvasAreaFactor: this.capCanvasAreaFactor, + enableDetailCanvas: this.enableDetailCanvas, + pageColors, + l10n: this.l10n, + layerProperties: this._layerProperties, + enableHWA: this.#enableHWA, + enableAutoLinking: this.#enableAutoLinking, + minDurationToUpdateCanvas: this.#minDurationToUpdateCanvas + }); + this._pages.push(pageView); + } + this._pages[0]?.setPdfPage(firstPdfPage); + if (this._scrollMode === ScrollMode.PAGE) { + this.#ensurePageViewVisible(); + } else if (this._spreadMode !== SpreadMode.NONE) { + this._updateSpreadMode(); + } + this.#onePageRenderedOrForceFetch(signal).then(async () => { + if (pdfDocument !== this.pdfDocument) { + return; + } + this.findController?.setDocument(pdfDocument); + this._scriptingManager?.setDocument(pdfDocument); + if (this.#hiddenCopyElement) { + document.addEventListener("copy", this.#copyCallback.bind(this, textLayerMode), { + signal + }); + } + if (this.#annotationEditorUIManager) { + eventBus.dispatch("annotationeditormodechanged", { + source: this, + mode: this.#annotationEditorMode + }); + } + if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > PagesCountLimit.FORCE_LAZY_PAGE_INIT) { + this._pagesCapability.resolve(); + return; + } + let getPagesLeft = pagesCount - 1; + if (getPagesLeft <= 0) { + this._pagesCapability.resolve(); + return; + } + for (let pageNum = 2; pageNum <= pagesCount; ++pageNum) { + const promise = pdfDocument.getPage(pageNum).then(pdfPage => { + const pageView = this._pages[pageNum - 1]; + if (!pageView.pdfPage) { + pageView.setPdfPage(pdfPage); + } + if (--getPagesLeft === 0) { + this._pagesCapability.resolve(); + } + }, reason => { + console.error(`Unable to get page ${pageNum} to initialize viewer`, reason); + if (--getPagesLeft === 0) { + this._pagesCapability.resolve(); + } + }); + if (pageNum % PagesCountLimit.PAUSE_EAGER_PAGE_INIT === 0) { + await promise; + } + } + }); + eventBus.dispatch("pagesinit", { + source: this + }); + pdfDocument.getMetadata().then(({ + info + }) => { + if (pdfDocument !== this.pdfDocument) { + return; + } + if (info.Language) { + viewer.lang = info.Language; + } + }); + if (this.defaultRenderingQueue) { + this.update(); + } + }).catch(reason => { + console.error("Unable to initialize viewer", reason); + this._pagesCapability.reject(reason); + }); + } + setPageLabels(labels) { + if (!this.pdfDocument) { + return; + } + if (!labels) { + this._pageLabels = null; + } else if (!(Array.isArray(labels) && this.pdfDocument.numPages === labels.length)) { + this._pageLabels = null; + console.error(`setPageLabels: Invalid page labels.`); + } else { + this._pageLabels = labels; + } + for (let i = 0, ii = this._pages.length; i < ii; i++) { + this._pages[i].setPageLabel(this._pageLabels?.[i] ?? null); + } + } + _resetView() { + this._pages = []; + this._currentPageNumber = 1; + this._currentScale = UNKNOWN_SCALE; + this._currentScaleValue = null; + this._pageLabels = null; + this.#buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE); + this._location = null; + this._pagesRotation = 0; + this._optionalContentConfigPromise = null; + this._firstPageCapability = Promise.withResolvers(); + this._onePageRenderedCapability = Promise.withResolvers(); + this._pagesCapability = Promise.withResolvers(); + this._scrollMode = ScrollMode.VERTICAL; + this._previousScrollMode = ScrollMode.UNKNOWN; + this._spreadMode = SpreadMode.NONE; + this.#scrollModePageState = { + previousPageNumber: 1, + scrollDown: true, + pages: [] + }; + this.#eventAbortController?.abort(); + this.#eventAbortController = null; + this.viewer.textContent = ""; + this._updateScrollMode(); + this.viewer.removeAttribute("lang"); + this.#hiddenCopyElement?.remove(); + this.#hiddenCopyElement = null; + this.#cleanupTimeouts(); + this.#cleanupSwitchAnnotationEditorMode(); + } + #ensurePageViewVisible() { + if (this._scrollMode !== ScrollMode.PAGE) { + throw new Error("#ensurePageViewVisible: Invalid scrollMode value."); + } + const pageNumber = this._currentPageNumber, + state = this.#scrollModePageState, + viewer = this.viewer; + viewer.textContent = ""; + state.pages.length = 0; + if (this._spreadMode === SpreadMode.NONE && !this.isInPresentationMode) { + const pageView = this._pages[pageNumber - 1]; + viewer.append(pageView.div); + state.pages.push(pageView); + } else { + const pageIndexSet = new Set(), + parity = this._spreadMode - 1; + if (parity === -1) { + pageIndexSet.add(pageNumber - 1); + } else if (pageNumber % 2 !== parity) { + pageIndexSet.add(pageNumber - 1); + pageIndexSet.add(pageNumber); + } else { + pageIndexSet.add(pageNumber - 2); + pageIndexSet.add(pageNumber - 1); + } + const spread = document.createElement("div"); + spread.className = "spread"; + if (this.isInPresentationMode) { + const dummyPage = document.createElement("div"); + dummyPage.className = "dummyPage"; + spread.append(dummyPage); + } + for (const i of pageIndexSet) { + const pageView = this._pages[i]; + if (!pageView) { + continue; + } + spread.append(pageView.div); + state.pages.push(pageView); + } + viewer.append(spread); + } + state.scrollDown = pageNumber >= state.previousPageNumber; + state.previousPageNumber = pageNumber; + } + _scrollUpdate() { + if (this.pagesCount === 0) { + return; + } + if (this.#scrollTimeoutId) { + clearTimeout(this.#scrollTimeoutId); + } + this.#scrollTimeoutId = setTimeout(() => { + this.#scrollTimeoutId = null; + this.update(); + }, 100); + this.update(); + } + #scrollIntoView(pageView, pageSpot = null) { + const { + div, + id + } = pageView; + if (this._currentPageNumber !== id) { + this._setCurrentPageNumber(id); + } + if (this._scrollMode === ScrollMode.PAGE) { + this.#ensurePageViewVisible(); + this.update(); + } + if (!pageSpot && !this.isInPresentationMode) { + const left = div.offsetLeft + div.clientLeft, + right = left + div.clientWidth; + const { + scrollLeft, + clientWidth + } = this.container; + if (this._scrollMode === ScrollMode.HORIZONTAL || left < scrollLeft || right > scrollLeft + clientWidth) { + pageSpot = { + left: 0, + top: 0 + }; + } + } + scrollIntoView(div, pageSpot); + if (!this._currentScaleValue && this._location) { + this._location = null; + } + } + #isSameScale(newScale) { + return newScale === this._currentScale || Math.abs(newScale - this._currentScale) < 1e-15; + } + #setScaleUpdatePages(newScale, newValue, { + noScroll = false, + preset = false, + drawingDelay = -1, + origin = null + }) { + this._currentScaleValue = newValue.toString(); + if (this.#isSameScale(newScale)) { + if (preset) { + this.eventBus.dispatch("scalechanging", { + source: this, + scale: newScale, + presetValue: newValue + }); + } + return; + } + this.viewer.style.setProperty("--scale-factor", newScale * PixelsPerInch.PDF_TO_CSS_UNITS); + const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000; + this.refresh(true, { + scale: newScale, + drawingDelay: postponeDrawing ? drawingDelay : -1 + }); + if (postponeDrawing) { + this.#scaleTimeoutId = setTimeout(() => { + this.#scaleTimeoutId = null; + this.refresh(); + }, drawingDelay); + } + const previousScale = this._currentScale; + this._currentScale = newScale; + if (!noScroll) { + let page = this._currentPageNumber, + dest; + if (this._location && !(this.isInPresentationMode || this.isChangingPresentationMode)) { + page = this._location.pageNumber; + dest = [null, { + name: "XYZ" + }, this._location.left, this._location.top, null]; + } + this.scrollPageIntoView({ + pageNumber: page, + destArray: dest, + allowNegativeOffset: true + }); + if (Array.isArray(origin)) { + const scaleDiff = newScale / previousScale - 1; + const [top, left] = this.containerTopLeft; + this.container.scrollLeft += (origin[0] - left) * scaleDiff; + this.container.scrollTop += (origin[1] - top) * scaleDiff; + } + } + this.eventBus.dispatch("scalechanging", { + source: this, + scale: newScale, + presetValue: preset ? newValue : undefined + }); + if (this.defaultRenderingQueue) { + this.update(); + } + } + get #pageWidthScaleFactor() { + if (this._spreadMode !== SpreadMode.NONE && this._scrollMode !== ScrollMode.HORIZONTAL) { + return 2; + } + return 1; + } + #setScale(value, options) { + let scale = parseFloat(value); + if (scale > 0) { + options.preset = false; + this.#setScaleUpdatePages(scale, value, options); + } else { + const currentPage = this._pages[this._currentPageNumber - 1]; + if (!currentPage) { + return; + } + let hPadding = SCROLLBAR_PADDING, + vPadding = VERTICAL_PADDING; + if (this.isInPresentationMode) { + hPadding = vPadding = 4; + if (this._spreadMode !== SpreadMode.NONE) { + hPadding *= 2; + } + } else if (this.removePageBorders) { + hPadding = vPadding = 0; + } else if (this._scrollMode === ScrollMode.HORIZONTAL) { + [hPadding, vPadding] = [vPadding, hPadding]; + } + const pageWidthScale = (this.container.clientWidth - hPadding) / currentPage.width * currentPage.scale / this.#pageWidthScaleFactor; + const pageHeightScale = (this.container.clientHeight - vPadding) / currentPage.height * currentPage.scale; + switch (value) { + case "page-actual": + scale = 1; + break; + case "page-width": + scale = pageWidthScale; + break; + case "page-height": + scale = pageHeightScale; + break; + case "page-fit": + scale = Math.min(pageWidthScale, pageHeightScale); + break; + case "auto": + const horizontalScale = isPortraitOrientation(currentPage) ? pageWidthScale : Math.min(pageHeightScale, pageWidthScale); + scale = Math.min(MAX_AUTO_SCALE, horizontalScale); + break; + default: + console.error(`#setScale: "${value}" is an unknown zoom value.`); + return; + } + options.preset = true; + this.#setScaleUpdatePages(scale, value, options); + } + } + #resetCurrentPageView() { + const pageView = this._pages[this._currentPageNumber - 1]; + if (this.isInPresentationMode) { + this.#setScale(this._currentScaleValue, { + noScroll: true + }); + } + this.#scrollIntoView(pageView); + } + pageLabelToPageNumber(label) { + if (!this._pageLabels) { + return null; + } + const i = this._pageLabels.indexOf(label); + if (i < 0) { + return null; + } + return i + 1; + } + scrollPageIntoView({ + pageNumber, + destArray = null, + allowNegativeOffset = false, + ignoreDestinationZoom = false + }) { + if (!this.pdfDocument) { + return; + } + const pageView = Number.isInteger(pageNumber) && this._pages[pageNumber - 1]; + if (!pageView) { + console.error(`scrollPageIntoView: "${pageNumber}" is not a valid pageNumber parameter.`); + return; + } + if (this.isInPresentationMode || !destArray) { + this._setCurrentPageNumber(pageNumber, true); + return; + } + let x = 0, + y = 0; + let width = 0, + height = 0, + widthScale, + heightScale; + const changeOrientation = pageView.rotation % 180 !== 0; + const pageWidth = (changeOrientation ? pageView.height : pageView.width) / pageView.scale / PixelsPerInch.PDF_TO_CSS_UNITS; + const pageHeight = (changeOrientation ? pageView.width : pageView.height) / pageView.scale / PixelsPerInch.PDF_TO_CSS_UNITS; + let scale = 0; + switch (destArray[1].name) { + case "XYZ": + x = destArray[2]; + y = destArray[3]; + scale = destArray[4]; + x = x !== null ? x : 0; + y = y !== null ? y : pageHeight; + break; + case "Fit": + case "FitB": + scale = "page-fit"; + break; + case "FitH": + case "FitBH": + y = destArray[2]; + scale = "page-width"; + if (y === null && this._location) { + x = this._location.left; + y = this._location.top; + } else if (typeof y !== "number" || y < 0) { + y = pageHeight; + } + break; + case "FitV": + case "FitBV": + x = destArray[2]; + width = pageWidth; + height = pageHeight; + scale = "page-height"; + break; + case "FitR": + x = destArray[2]; + y = destArray[3]; + width = destArray[4] - x; + height = destArray[5] - y; + let hPadding = SCROLLBAR_PADDING, + vPadding = VERTICAL_PADDING; + if (this.removePageBorders) { + hPadding = vPadding = 0; + } + widthScale = (this.container.clientWidth - hPadding) / width / PixelsPerInch.PDF_TO_CSS_UNITS; + heightScale = (this.container.clientHeight - vPadding) / height / PixelsPerInch.PDF_TO_CSS_UNITS; + scale = Math.min(Math.abs(widthScale), Math.abs(heightScale)); + break; + default: + console.error(`scrollPageIntoView: "${destArray[1].name}" is not a valid destination type.`); + return; + } + if (!ignoreDestinationZoom) { + if (scale && scale !== this._currentScale) { + this.currentScaleValue = scale; + } else if (this._currentScale === UNKNOWN_SCALE) { + this.currentScaleValue = DEFAULT_SCALE_VALUE; + } + } + if (scale === "page-fit" && !destArray[4]) { + this.#scrollIntoView(pageView); + return; + } + const boundingRect = [pageView.viewport.convertToViewportPoint(x, y), pageView.viewport.convertToViewportPoint(x + width, y + height)]; + let left = Math.min(boundingRect[0][0], boundingRect[1][0]); + let top = Math.min(boundingRect[0][1], boundingRect[1][1]); + if (!allowNegativeOffset) { + left = Math.max(left, 0); + top = Math.max(top, 0); + } + this.#scrollIntoView(pageView, { + left, + top + }); + } + _updateLocation(firstPage) { + const currentScale = this._currentScale; + const currentScaleValue = this._currentScaleValue; + const normalizedScaleValue = parseFloat(currentScaleValue) === currentScale ? Math.round(currentScale * 10000) / 100 : currentScaleValue; + const pageNumber = firstPage.id; + const currentPageView = this._pages[pageNumber - 1]; + const container = this.container; + const topLeft = currentPageView.getPagePoint(container.scrollLeft - firstPage.x, container.scrollTop - firstPage.y); + const intLeft = Math.round(topLeft[0]); + const intTop = Math.round(topLeft[1]); + let pdfOpenParams = `#page=${pageNumber}`; + if (!this.isInPresentationMode) { + pdfOpenParams += `&zoom=${normalizedScaleValue},${intLeft},${intTop}`; + } + this._location = { + pageNumber, + scale: normalizedScaleValue, + top: intTop, + left: intLeft, + rotation: this._pagesRotation, + pdfOpenParams + }; + } + update() { + const visible = this._getVisiblePages(); + const visiblePages = visible.views, + numVisiblePages = visiblePages.length; + if (numVisiblePages === 0) { + return; + } + const newCacheSize = Math.max(DEFAULT_CACHE_SIZE, 2 * numVisiblePages + 1); + this.#buffer.resize(newCacheSize, visible.ids); + for (const { + view, + visibleArea + } of visiblePages) { + view.updateVisibleArea(visibleArea); + } + for (const view of this.#buffer) { + if (!visible.ids.has(view.id)) { + view.updateVisibleArea(null); + } + } + this.renderingQueue.renderHighestPriority(visible); + const isSimpleLayout = this._spreadMode === SpreadMode.NONE && (this._scrollMode === ScrollMode.PAGE || this._scrollMode === ScrollMode.VERTICAL); + const currentId = this._currentPageNumber; + let stillFullyVisible = false; + for (const page of visiblePages) { + if (page.percent < 100) { + break; + } + if (page.id === currentId && isSimpleLayout) { + stillFullyVisible = true; + break; + } + } + this._setCurrentPageNumber(stillFullyVisible ? currentId : visiblePages[0].id); + this._updateLocation(visible.first); + this.eventBus.dispatch("updateviewarea", { + source: this, + location: this._location + }); + } + #switchToEditAnnotationMode() { + const visible = this._getVisiblePages(); + const pagesToRefresh = []; + const { + ids, + views + } = visible; + for (const page of views) { + const { + view + } = page; + if (!view.hasEditableAnnotations()) { + ids.delete(view.id); + continue; + } + pagesToRefresh.push(page); + } + if (pagesToRefresh.length === 0) { + return null; + } + this.renderingQueue.renderHighestPriority({ + first: pagesToRefresh[0], + last: pagesToRefresh.at(-1), + views: pagesToRefresh, + ids + }); + return ids; + } + containsElement(element) { + return this.container.contains(element); + } + focus() { + this.container.focus(); + } + get _isContainerRtl() { + return getComputedStyle(this.container).direction === "rtl"; + } + get isInPresentationMode() { + return this.presentationModeState === PresentationModeState.FULLSCREEN; + } + get isChangingPresentationMode() { + return this.presentationModeState === PresentationModeState.CHANGING; + } + get isHorizontalScrollbarEnabled() { + return this.isInPresentationMode ? false : this.container.scrollWidth > this.container.clientWidth; + } + get isVerticalScrollbarEnabled() { + return this.isInPresentationMode ? false : this.container.scrollHeight > this.container.clientHeight; + } + _getVisiblePages() { + const views = this._scrollMode === ScrollMode.PAGE ? this.#scrollModePageState.pages : this._pages, + horizontal = this._scrollMode === ScrollMode.HORIZONTAL, + rtl = horizontal && this._isContainerRtl; + return getVisibleElements({ + scrollEl: this.container, + views, + sortByVisibility: true, + horizontal, + rtl + }); + } + cleanup() { + for (const pageView of this._pages) { + if (pageView.renderingState !== RenderingStates.FINISHED) { + pageView.reset(); + } + } + } + _cancelRendering() { + for (const pageView of this._pages) { + pageView.cancelRendering(); + } + } + async #ensurePdfPageLoaded(pageView) { + if (pageView.pdfPage) { + return pageView.pdfPage; + } + try { + const pdfPage = await this.pdfDocument.getPage(pageView.id); + if (!pageView.pdfPage) { + pageView.setPdfPage(pdfPage); + } + return pdfPage; + } catch (reason) { + console.error("Unable to get page for page view", reason); + return null; + } + } + #getScrollAhead(visible) { + if (visible.first?.id === 1) { + return true; + } else if (visible.last?.id === this.pagesCount) { + return false; + } + switch (this._scrollMode) { + case ScrollMode.PAGE: + return this.#scrollModePageState.scrollDown; + case ScrollMode.HORIZONTAL: + return this.scroll.right; + } + return this.scroll.down; + } + forceRendering(currentlyVisiblePages) { + const visiblePages = currentlyVisiblePages || this._getVisiblePages(); + const scrollAhead = this.#getScrollAhead(visiblePages); + const preRenderExtra = this._spreadMode !== SpreadMode.NONE && this._scrollMode !== ScrollMode.HORIZONTAL; + const ignoreDetailViews = this.#scaleTimeoutId !== null || this.#scrollTimeoutId !== null && visiblePages.views.some(page => page.detailView?.renderingCancelled); + const pageView = this.renderingQueue.getHighestPriority(visiblePages, this._pages, scrollAhead, preRenderExtra, ignoreDetailViews); + if (pageView) { + this.#ensurePdfPageLoaded(pageView).then(() => { + this.renderingQueue.renderView(pageView); + }); + return true; + } + return false; + } + get hasEqualPageSizes() { + const firstPageView = this._pages[0]; + for (let i = 1, ii = this._pages.length; i < ii; ++i) { + const pageView = this._pages[i]; + if (pageView.width !== firstPageView.width || pageView.height !== firstPageView.height) { + return false; + } + } + return true; + } + getPagesOverview() { + let initialOrientation; + return this._pages.map(pageView => { + const viewport = pageView.pdfPage.getViewport({ + scale: 1 + }); + const orientation = isPortraitOrientation(viewport); + if (initialOrientation === undefined) { + initialOrientation = orientation; + } else if (this.enablePrintAutoRotate && orientation !== initialOrientation) { + return { + width: viewport.height, + height: viewport.width, + rotation: (viewport.rotation - 90) % 360 + }; + } + return { + width: viewport.width, + height: viewport.height, + rotation: viewport.rotation + }; + }); + } + get optionalContentConfigPromise() { + if (!this.pdfDocument) { + return Promise.resolve(null); + } + if (!this._optionalContentConfigPromise) { + console.error("optionalContentConfigPromise: Not initialized yet."); + return this.pdfDocument.getOptionalContentConfig({ + intent: "display" + }); + } + return this._optionalContentConfigPromise; + } + set optionalContentConfigPromise(promise) { + if (!(promise instanceof Promise)) { + throw new Error(`Invalid optionalContentConfigPromise: ${promise}`); + } + if (!this.pdfDocument) { + return; + } + if (!this._optionalContentConfigPromise) { + return; + } + this._optionalContentConfigPromise = promise; + this.refresh(false, { + optionalContentConfigPromise: promise + }); + this.eventBus.dispatch("optionalcontentconfigchanged", { + source: this, + promise + }); + } + get scrollMode() { + return this._scrollMode; + } + set scrollMode(mode) { + if (this._scrollMode === mode) { + return; + } + if (!isValidScrollMode(mode)) { + throw new Error(`Invalid scroll mode: ${mode}`); + } + if (this.pagesCount > PagesCountLimit.FORCE_SCROLL_MODE_PAGE) { + return; + } + this._previousScrollMode = this._scrollMode; + this._scrollMode = mode; + this.eventBus.dispatch("scrollmodechanged", { + source: this, + mode + }); + this._updateScrollMode(this._currentPageNumber); + } + _updateScrollMode(pageNumber = null) { + const scrollMode = this._scrollMode, + viewer = this.viewer; + viewer.classList.toggle("scrollHorizontal", scrollMode === ScrollMode.HORIZONTAL); + viewer.classList.toggle("scrollWrapped", scrollMode === ScrollMode.WRAPPED); + if (!this.pdfDocument || !pageNumber) { + return; + } + if (scrollMode === ScrollMode.PAGE) { + this.#ensurePageViewVisible(); + } else if (this._previousScrollMode === ScrollMode.PAGE) { + this._updateSpreadMode(); + } + if (this._currentScaleValue && isNaN(this._currentScaleValue)) { + this.#setScale(this._currentScaleValue, { + noScroll: true + }); + } + this._setCurrentPageNumber(pageNumber, true); + this.update(); + } + get spreadMode() { + return this._spreadMode; + } + set spreadMode(mode) { + if (this._spreadMode === mode) { + return; + } + if (!isValidSpreadMode(mode)) { + throw new Error(`Invalid spread mode: ${mode}`); + } + this._spreadMode = mode; + this.eventBus.dispatch("spreadmodechanged", { + source: this, + mode + }); + this._updateSpreadMode(this._currentPageNumber); + } + _updateSpreadMode(pageNumber = null) { + if (!this.pdfDocument) { + return; + } + const viewer = this.viewer, + pages = this._pages; + if (this._scrollMode === ScrollMode.PAGE) { + this.#ensurePageViewVisible(); + } else { + viewer.textContent = ""; + if (this._spreadMode === SpreadMode.NONE) { + for (const pageView of this._pages) { + viewer.append(pageView.div); + } + } else { + const parity = this._spreadMode - 1; + let spread = null; + for (let i = 0, ii = pages.length; i < ii; ++i) { + if (spread === null) { + spread = document.createElement("div"); + spread.className = "spread"; + viewer.append(spread); + } else if (i % 2 === parity) { + spread = spread.cloneNode(false); + viewer.append(spread); + } + spread.append(pages[i].div); + } + } + } + if (!pageNumber) { + return; + } + if (this._currentScaleValue && isNaN(this._currentScaleValue)) { + this.#setScale(this._currentScaleValue, { + noScroll: true + }); + } + this._setCurrentPageNumber(pageNumber, true); + this.update(); + } + _getPageAdvance(currentPageNumber, previous = false) { + switch (this._scrollMode) { + case ScrollMode.WRAPPED: + { + const { + views + } = this._getVisiblePages(), + pageLayout = new Map(); + for (const { + id, + y, + percent, + widthPercent + } of views) { + if (percent === 0 || widthPercent < 100) { + continue; + } + let yArray = pageLayout.get(y); + if (!yArray) { + pageLayout.set(y, yArray ||= []); + } + yArray.push(id); + } + for (const yArray of pageLayout.values()) { + const currentIndex = yArray.indexOf(currentPageNumber); + if (currentIndex === -1) { + continue; + } + const numPages = yArray.length; + if (numPages === 1) { + break; + } + if (previous) { + for (let i = currentIndex - 1, ii = 0; i >= ii; i--) { + const currentId = yArray[i], + expectedId = yArray[i + 1] - 1; + if (currentId < expectedId) { + return currentPageNumber - expectedId; + } + } + } else { + for (let i = currentIndex + 1, ii = numPages; i < ii; i++) { + const currentId = yArray[i], + expectedId = yArray[i - 1] + 1; + if (currentId > expectedId) { + return expectedId - currentPageNumber; + } + } + } + if (previous) { + const firstId = yArray[0]; + if (firstId < currentPageNumber) { + return currentPageNumber - firstId + 1; + } + } else { + const lastId = yArray[numPages - 1]; + if (lastId > currentPageNumber) { + return lastId - currentPageNumber + 1; + } + } + break; + } + break; + } + case ScrollMode.HORIZONTAL: + { + break; + } + case ScrollMode.PAGE: + case ScrollMode.VERTICAL: + { + if (this._spreadMode === SpreadMode.NONE) { + break; + } + const parity = this._spreadMode - 1; + if (previous && currentPageNumber % 2 !== parity) { + break; + } else if (!previous && currentPageNumber % 2 === parity) { + break; + } + const { + views + } = this._getVisiblePages(), + expectedId = previous ? currentPageNumber - 1 : currentPageNumber + 1; + for (const { + id, + percent, + widthPercent + } of views) { + if (id !== expectedId) { + continue; + } + if (percent > 0 && widthPercent === 100) { + return 2; + } + break; + } + break; + } + } + return 1; + } + nextPage() { + const currentPageNumber = this._currentPageNumber, + pagesCount = this.pagesCount; + if (currentPageNumber >= pagesCount) { + return false; + } + const advance = this._getPageAdvance(currentPageNumber, false) || 1; + this.currentPageNumber = Math.min(currentPageNumber + advance, pagesCount); + return true; + } + previousPage() { + const currentPageNumber = this._currentPageNumber; + if (currentPageNumber <= 1) { + return false; + } + const advance = this._getPageAdvance(currentPageNumber, true) || 1; + this.currentPageNumber = Math.max(currentPageNumber - advance, 1); + return true; + } + updateScale({ + drawingDelay, + scaleFactor = null, + steps = null, + origin + }) { + if (steps === null && scaleFactor === null) { + throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided."); + } + if (!this.pdfDocument) { + return; + } + let newScale = this._currentScale; + if (scaleFactor > 0 && scaleFactor !== 1) { + newScale = Math.round(newScale * scaleFactor * 100) / 100; + } else if (steps) { + const delta = steps > 0 ? DEFAULT_SCALE_DELTA : 1 / DEFAULT_SCALE_DELTA; + const round = steps > 0 ? Math.ceil : Math.floor; + steps = Math.abs(steps); + do { + newScale = round((newScale * delta).toFixed(2) * 10) / 10; + } while (--steps > 0); + } + newScale = MathClamp(newScale, MIN_SCALE, MAX_SCALE); + this.#setScale(newScale, { + noScroll: false, + drawingDelay, + origin + }); + } + increaseScale(options = {}) { + this.updateScale({ + ...options, + steps: options.steps ?? 1 + }); + } + decreaseScale(options = {}) { + this.updateScale({ + ...options, + steps: -(options.steps ?? 1) + }); + } + #updateContainerHeightCss(height = this.container.clientHeight) { + if (height !== this.#previousContainerHeight) { + this.#previousContainerHeight = height; + docStyle.setProperty("--viewer-container-height", `${height}px`); + } + } + #resizeObserverCallback(entries) { + for (const entry of entries) { + if (entry.target === this.container) { + this.#updateContainerHeightCss(Math.floor(entry.borderBoxSize[0].blockSize)); + this.#containerTopLeft = null; + break; + } + } + } + get containerTopLeft() { + return this.#containerTopLeft ||= [this.container.offsetTop, this.container.offsetLeft]; + } + #cleanupTimeouts() { + if (this.#scaleTimeoutId !== null) { + clearTimeout(this.#scaleTimeoutId); + this.#scaleTimeoutId = null; + } + if (this.#scrollTimeoutId !== null) { + clearTimeout(this.#scrollTimeoutId); + this.#scrollTimeoutId = null; + } + } + #cleanupSwitchAnnotationEditorMode() { + this.#switchAnnotationEditorModeAC?.abort(); + this.#switchAnnotationEditorModeAC = null; + if (this.#switchAnnotationEditorModeTimeoutId !== null) { + clearTimeout(this.#switchAnnotationEditorModeTimeoutId); + this.#switchAnnotationEditorModeTimeoutId = null; + } + } + #preloadEditingData(mode) { + switch (mode) { + case AnnotationEditorType.STAMP: + this.#mlManager?.loadModel("altText"); + break; + case AnnotationEditorType.SIGNATURE: + this.#signatureManager?.loadSignatures(); + break; + } + } + get annotationEditorMode() { + return this.#annotationEditorUIManager ? this.#annotationEditorMode : AnnotationEditorType.DISABLE; + } + set annotationEditorMode({ + mode, + editId = null, + isFromKeyboard = false, + mustEnterInEditMode = false, + editComment = false + }) { + if (!this.#annotationEditorUIManager) { + throw new Error(`The AnnotationEditor is not enabled.`); + } + if (this.#annotationEditorMode === mode) { + return; + } + if (!isValidAnnotationEditorMode(mode)) { + throw new Error(`Invalid AnnotationEditor mode: ${mode}`); + } + if (!this.pdfDocument) { + return; + } + this.#preloadEditingData(mode); + const { + eventBus, + pdfDocument + } = this; + const updater = async () => { + this.#cleanupSwitchAnnotationEditorMode(); + this.#annotationEditorMode = mode; + await this.#annotationEditorUIManager.updateMode(mode, editId, isFromKeyboard, mustEnterInEditMode, editComment); + if (mode !== this.#annotationEditorMode || pdfDocument !== this.pdfDocument) { + return; + } + eventBus.dispatch("annotationeditormodechanged", { + source: this, + mode + }); + }; + if (mode === AnnotationEditorType.NONE || this.#annotationEditorMode === AnnotationEditorType.NONE) { + const isEditing = mode !== AnnotationEditorType.NONE; + if (!isEditing) { + this.pdfDocument.annotationStorage.resetModifiedIds(); + } + for (const pageView of this._pages) { + pageView.toggleEditingMode(isEditing); + } + const idsToRefresh = this.#switchToEditAnnotationMode(); + if (isEditing && idsToRefresh) { + this.#cleanupSwitchAnnotationEditorMode(); + this.#switchAnnotationEditorModeAC = new AbortController(); + const signal = AbortSignal.any([this.#eventAbortController.signal, this.#switchAnnotationEditorModeAC.signal]); + eventBus._on("pagerendered", ({ + pageNumber + }) => { + idsToRefresh.delete(pageNumber); + if (idsToRefresh.size === 0) { + this.#switchAnnotationEditorModeTimeoutId = setTimeout(updater, 0); + } + }, { + signal + }); + return; + } + } + updater(); + } + refresh(noUpdate = false, updateArgs = Object.create(null)) { + if (!this.pdfDocument) { + return; + } + for (const pageView of this._pages) { + pageView.update(updateArgs); + } + this.#cleanupTimeouts(); + if (!noUpdate) { + this.update(); + } + } +} + +;// ./web/pdf_single_page_viewer.js + + +class PDFSinglePageViewer extends PDFViewer { + _resetView() { + super._resetView(); + this._scrollMode = ScrollMode.PAGE; + this._spreadMode = SpreadMode.NONE; + } + set scrollMode(mode) {} + _updateScrollMode() {} + set spreadMode(mode) {} + _updateSpreadMode() {} +} + +;// ./web/pdf_viewer.component.js + + + + + + + + + + + + + + + +globalThis.pdfjsViewer = { + AnnotationLayerBuilder: AnnotationLayerBuilder, + DownloadManager: DownloadManager, + EventBus: EventBus, + FindState: FindState, + GenericL10n: genericl10n_GenericL10n, + LinkTarget: LinkTarget, + parseQueryString: parseQueryString, + PDFFindController: PDFFindController, + PDFHistory: PDFHistory, + PDFLinkService: PDFLinkService, + PDFPageView: PDFPageView, + PDFScriptingManager: PDFScriptingManagerComponents, + PDFSinglePageViewer: PDFSinglePageViewer, + PDFViewer: PDFViewer, + ProgressBar: ProgressBar, + RenderingStates: RenderingStates, + ScrollMode: ScrollMode, + SimpleLinkService: SimpleLinkService, + SpreadMode: SpreadMode, + StructTreeLayerBuilder: StructTreeLayerBuilder, + TextLayerBuilder: TextLayerBuilder, + XfaLayerBuilder: XfaLayerBuilder +}; + +export { AnnotationLayerBuilder, DownloadManager, EventBus, FindState, genericl10n_GenericL10n as GenericL10n, LinkTarget, PDFFindController, PDFHistory, PDFLinkService, PDFPageView, PDFScriptingManagerComponents as PDFScriptingManager, PDFSinglePageViewer, PDFViewer, ProgressBar, RenderingStates, ScrollMode, SimpleLinkService, SpreadMode, StructTreeLayerBuilder, TextLayerBuilder, XfaLayerBuilder, parseQueryString }; + +//# sourceMappingURL=pdf_viewer.mjs.map \ No newline at end of file diff --git a/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.mjs.map b/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.mjs.map new file mode 100644 index 0000000000000000000000000000000000000000..d92db16b63f6d472347d5a623bac72e02a385f3d --- /dev/null +++ b/tools/ui/node_modules/pdfjs-dist/web/pdf_viewer.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"pdf_viewer.mjs","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAM;EACJA,cAAc;EACdC,qBAAqB;EACrBC,0BAA0B;EAC1BC,oBAAoB;EACpBC,yBAAyB;EACzBC,eAAe;EACfC,cAAc;EACdC,cAAc;EACdC,KAAK;EACLC,WAAW;EACXC,sBAAsB;EACtBC,aAAa;EACbC,SAAS;EACTC,WAAW;EACXC,SAAS;EACTC,WAAW;EACXC,kBAAkB;EAClBC,qBAAqB;EACrBC,MAAM;EACNC,OAAO;EACPC,kBAAkB;EAClBC,mBAAmB;EACnBC,SAAS;EACTC,mBAAmB;EACnBC,YAAY;EACZC,SAAS;EACTC,mBAAmB;EACnBC,SAAS;EACTC,aAAa;EACbC,gBAAgB;EAChBC,GAAG;EACHC,WAAW;EACXC,iBAAiB;EACjBC,qBAAqB;EACrBC,aAAa;EACbC,SAAS;EACTC,cAAc;EACdC,aAAa;EACbC,2BAA2B;EAC3BC,iBAAiB;EACjBC,kBAAkB;EAClBC,MAAM;EACNC,kBAAkB;EAClBC,SAAS;EACTC,uBAAuB;EACvBC,SAAS;EACTC,YAAY;EACZC,aAAa;EACbC,IAAI;EACJC,cAAc;EACdC,OAAO;EACPC;AACF,CAAC,GAAGC,UAAU,CAACC,QAAQ;;;ACrDe;AAEtC,MAAMC,mBAAmB,GAAG,MAAM;AAClC,MAAMC,aAAa,GAAG,GAAG;AACzB,MAAMC,mBAAmB,GAAG,GAAG;AAC/B,MAAMC,SAAS,GAAG,GAAG;A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,CAACI,IAAI;IAClC,IAAI,CAAC62D,WAAW,GAAG52D,UAAU,CAACd,IAAI;EACpC;EAGA,IAAI6O,UAAUA,CAAC1C,IAAI,EAAE,CAAC;EAEtBmsD,iBAAiBA,CAAA,EAAG,CAAC;EAGrB,IAAIxpD,UAAUA,CAAC3C,IAAI,EAAE,CAAC;EAEtBwrD,iBAAiBA,CAAA,EAAG,CAAC;AACvB;;;ACnBwE;AAKzC;AAOR;AACgD;AACf;AACZ;AACG;AACD;AACG;AAC0B;AACT;AACtB;AAC4B;AACb;AACF;AAEzDj5D,UAAU,CAAC8/D,WAAW,GAAG;EACvBn6C,sBAAsB;EACtBqF,eAAe;EACfkB,QAAQ;EACR5Z,SAAS;EACTwxB,WAAW;EACXljB,UAAU;EACV9a,gBAAgB;EAChByR,iBAAiB;EACjBuuB,UAAU;EACV7kB,cAAc;EACd4kC,WAAW;EACX4H,mBAAmB;EACnBoS,mBAAmB;EACnBtM,SAAS;EACThlD,WAAW;EACX5N,eAAe;EACfoB,UAAU;EACV2jB,iBAAiB;EACjBtjB,UAAU;EACV46C,sBAAsB;EACtB2F,gBAAgB;EAChB6C,eAAeA,EAAAA,eAAAA;AACjB,CAAC","sources":["webpack://pdf.js/./web/pdfjs.js","webpack://pdf.js/./web/ui_utils.js","webpack://pdf.js/./web/pdf_find_utils.js","webpack://pdf.js/./web/pdf_find_controller.js","webpack://pdf.js/./web/pdf_link_service.js","webpack://pdf.js/./web/annotation_layer_builder.js","webpack://pdf.js/./web/download_manager.js","webpack://pdf.js/./web/event_utils.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/types.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resolver.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/scope.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/builtins.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/memoizer.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/bundle.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/resource.js","webpack://pdf.js/./node_modules/@fluent/bundle/esm/index.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/overlay.js","webpack://pdf.js/./node_modules/cached-iterable/src/cached_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_sync_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/cached_async_iterable.mjs","webpack://pdf.js/./node_modules/cached-iterable/src/index.mjs","webpack://pdf.js/./node_modules/@fluent/dom/esm/localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/dom_localization.js","webpack://pdf.js/./node_modules/@fluent/dom/esm/index.js","webpack://pdf.js/./web/l10n.js","webpack://pdf.js/./web/genericl10n.js","webpack://pdf.js/./web/pdf_history.js","webpack://pdf.js/./web/annotation_editor_layer_builder.js","webpack://pdf.js/./web/app_options.js","webpack://pdf.js/./web/autolinker.js","webpack://pdf.js/./web/base_pdf_page_view.js","webpack://pdf.js/./web/draw_layer_builder.js","webpack://pdf.js/./web/pdf_page_detail_view.js","webpack://pdf.js/./web/struct_tree_layer_builder.js","webpack://pdf.js/./web/text_accessibility.js","webpack://pdf.js/./web/text_highlighter.js","webpack://pdf.js/./web/text_layer_builder.js","webpack://pdf.js/./web/xfa_layer_builder.js","webpack://pdf.js/./web/pdf_page_view.js","webpack://pdf.js/./web/generic_scripting.js","webpack://pdf.js/./web/pdf_scripting_manager.js","webpack://pdf.js/./web/pdf_scripting_manager.component.js","webpack://pdf.js/./web/pdf_rendering_queue.js","webpack://pdf.js/./web/pdf_viewer.js","webpack://pdf.js/./web/pdf_single_page_viewer.js","webpack://pdf.js/./web/pdf_viewer.component.js"],"sourcesContent":["/* Copyright 2016 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst {\n AbortException,\n AnnotationEditorLayer,\n AnnotationEditorParamsType,\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationLayer,\n AnnotationMode,\n AnnotationType,\n build,\n ColorPicker,\n createValidAbsoluteUrl,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getRGB,\n getUuid,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n isValidExplicitDest,\n MathClamp,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n ResponseException,\n setLayerDimensions,\n shadow,\n SignatureExtractor,\n stopEvent,\n SupportedImageMimeTypes,\n TextLayer,\n TouchManager,\n updateUrlHash,\n Util,\n VerbosityLevel,\n version,\n XfaLayer,\n} = globalThis.pdfjsLib;\n\nexport {\n AbortException,\n AnnotationEditorLayer,\n AnnotationEditorParamsType,\n AnnotationEditorType,\n AnnotationEditorUIManager,\n AnnotationLayer,\n AnnotationMode,\n AnnotationType,\n build,\n ColorPicker,\n createValidAbsoluteUrl,\n DOMSVGFactory,\n DrawLayer,\n FeatureTest,\n fetchData,\n getDocument,\n getFilenameFromUrl,\n getPdfFilenameFromUrl,\n getRGB,\n getUuid,\n getXfaPageViewport,\n GlobalWorkerOptions,\n ImageKind,\n InvalidPDFException,\n isDataScheme,\n isPdfFile,\n isValidExplicitDest,\n MathClamp,\n noContextMenu,\n normalizeUnicode,\n OPS,\n OutputScale,\n PasswordResponses,\n PDFDataRangeTransport,\n PDFDateString,\n PDFWorker,\n PermissionFlag,\n PixelsPerInch,\n RenderingCancelledException,\n ResponseException,\n setLayerDimensions,\n shadow,\n SignatureExtractor,\n stopEvent,\n SupportedImageMimeTypes,\n TextLayer,\n TouchManager,\n updateUrlHash,\n Util,\n VerbosityLevel,\n version,\n XfaLayer,\n};\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MathClamp } from \"pdfjs-lib\";\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 * 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, abortSignal = undefined) {\n const debounceScroll = function (evt) {\n if (rAF) {\n return;\n }\n // schedule an invocation of scroll for next animation frame.\n rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {\n rAF = null;\n\n const currentX = viewAreaElement.scrollLeft;\n const lastX = state.lastX;\n if (currentX !== lastX) {\n state.right = currentX > lastX;\n }\n state.lastX = currentX;\n const currentY = viewAreaElement.scrollTop;\n const lastY = state.lastY;\n if (currentY !== lastY) {\n state.down = currentY > lastY;\n }\n state.lastY = currentY;\n callback(state);\n });\n };\n\n const state = {\n right: true,\n down: true,\n lastX: viewAreaElement.scrollLeft,\n lastY: viewAreaElement.scrollTop,\n _eventHandler: debounceScroll,\n };\n\n let rAF = null;\n viewAreaElement.addEventListener(\"scroll\", debounceScroll, {\n useCapture: true,\n signal: abortSignal,\n });\n abortSignal?.addEventListener(\n \"abort\",\n () => window.cancelAnimationFrame(rAF),\n { once: true }\n );\n return state;\n}\n\n/**\n * Helper function to parse query string (e.g. ?param1=value¶m2=...).\n * @param {string} query\n * @returns {Map}\n */\nfunction parseQueryString(query) {\n const params = new Map();\n for (const [key, value] of new URLSearchParams(query)) {\n params.set(key.toLowerCase(), value);\n }\n return params;\n}\n\nconst InvisibleCharsRegExp = /[\\x00-\\x1F]/g;\n\n/**\n * @param {string} str\n * @param {boolean} [replaceInvisible]\n */\nfunction removeNullCharacters(str, replaceInvisible = false) {\n if (!InvisibleCharsRegExp.test(str)) {\n return str;\n }\n if (replaceInvisible) {\n return str.replaceAll(InvisibleCharsRegExp, m => (m === \"\\x00\" ? \"\" : \" \"));\n }\n return str.replaceAll(\"\\x00\", \"\");\n}\n\n/**\n * Use binary search to find the index of the first item in a given array which\n * passes a given condition. The items are expected to be sorted in the sense\n * that if the condition is true for one item in the array, then it is also true\n * for all following items.\n *\n * @returns {number} Index of the first array element to pass the test,\n * or |items.length| if no such element exists.\n */\nfunction binarySearchFirstItem(items, condition, start = 0) {\n let minIndex = start;\n let maxIndex = items.length - 1;\n\n if (maxIndex < 0 || !condition(items[maxIndex])) {\n return items.length;\n }\n if (condition(items[minIndex])) {\n return minIndex;\n }\n\n while (minIndex < maxIndex) {\n const currentIndex = (minIndex + maxIndex) >> 1;\n const currentItem = items[currentIndex];\n if (condition(currentItem)) {\n maxIndex = currentIndex;\n } else {\n minIndex = currentIndex + 1;\n }\n }\n return minIndex; /* === maxIndex */\n}\n\n/**\n * Approximates float number as a fraction using Farey sequence (max order\n * of 8).\n * @param {number} x - Positive float number.\n * @returns {Array} Estimated fraction: the first array item is a numerator,\n * the second one is a denominator.\n * They are both natural numbers.\n */\nfunction approximateFraction(x) {\n // Fast paths for int numbers or their inversions.\n if (Math.floor(x) === x) {\n return [x, 1];\n }\n const xinv = 1 / x;\n const limit = 8;\n if (xinv > limit) {\n return [1, limit];\n } else if (Math.floor(xinv) === xinv) {\n return [1, xinv];\n }\n\n const x_ = x > 1 ? xinv : x;\n // a/b and c/d are neighbours in Farey sequence.\n let a = 0,\n b = 1,\n c = 1,\n d = 1;\n // Limiting search to order 8.\n while (true) {\n // Generating next term in sequence (order of q).\n const p = a + c,\n q = b + d;\n if (q > limit) {\n break;\n }\n if (x_ <= p / q) {\n c = p;\n d = q;\n } else {\n a = p;\n b = q;\n }\n }\n let result;\n // Select closest of the neighbours to x.\n if (x_ - a / b < c / d - x_) {\n result = x_ === x ? [a, b] : [b, a];\n } else {\n result = x_ === x ? [c, d] : [d, c];\n }\n return result;\n}\n\n/**\n * @param {number} x - A positive number to round to a multiple of `div`.\n * @param {number} div - A natural number.\n */\nfunction floorToDivide(x, div) {\n return x - (x % div);\n}\n\n/**\n * @typedef {Object} GetPageSizeInchesParameters\n * @property {number[]} view\n * @property {number} userUnit\n * @property {number} rotate\n */\n\n/**\n * @typedef {Object} PageSize\n * @property {number} width - In inches.\n * @property {number} height - In inches.\n */\n\n/**\n * Gets the size of the specified page, converted from PDF units to inches.\n * @param {GetPageSizeInchesParameters} params\n * @returns {PageSize}\n */\nfunction getPageSizeInches({ view, userUnit, rotate }) {\n const [x1, y1, x2, y2] = view;\n // We need to take the page rotation into account as well.\n const changeOrientation = rotate % 180 !== 0;\n\n const width = ((x2 - x1) / 72) * userUnit;\n const height = ((y2 - y1) / 72) * userUnit;\n\n return {\n width: changeOrientation ? height : width,\n height: changeOrientation ? width : height,\n };\n}\n\n/**\n * Helper function for getVisibleElements.\n *\n * @param {number} index - initial guess at the first visible element\n * @param {Array} views - array of pages, into which `index` is an index\n * @param {number} top - the top of the scroll pane\n * @returns {number} less than or equal to `index` that is definitely at or\n * before the first visible element in `views`, but not by too much. (Usually,\n * this will be the first element in the first partially visible row in\n * `views`, although sometimes it goes back one row further.)\n */\nfunction backtrackBeforeAllVisibleElements(index, views, top) {\n // binarySearchFirstItem's assumption is that the input is ordered, with only\n // one index where the conditions flips from false to true: [false ...,\n // true...]. With vertical scrolling and spreads, it is possible to have\n // [false ..., true, false, true ...]. With wrapped scrolling we can have a\n // similar sequence, with many more mixed true and false in the middle.\n //\n // So there is no guarantee that the binary search yields the index of the\n // first visible element. It could have been any of the other visible elements\n // that were preceded by a hidden element.\n\n // Of course, if either this element or the previous (hidden) element is also\n // the first element, there's nothing to worry about.\n if (index < 2) {\n return index;\n }\n\n // That aside, the possible cases are represented below.\n //\n // **** = fully hidden\n // A*B* = mix of partially visible and/or hidden pages\n // CDEF = fully visible\n //\n // (1) Binary search could have returned A, in which case we can stop.\n // (2) Binary search could also have returned B, in which case we need to\n // check the whole row.\n // (3) Binary search could also have returned C, in which case we need to\n // check the whole previous row.\n //\n // There's one other possibility:\n //\n // **** = fully hidden\n // ABCD = mix of fully and/or partially visible pages\n //\n // (4) Binary search could only have returned A.\n\n // Initially assume that we need to find the beginning of the current row\n // (case 1, 2, or 4), which means finding a page that is above the current\n // page's top. If the found page is partially visible, we're definitely not in\n // case 3, and this assumption is correct.\n let elt = views[index].div;\n let pageTop = elt.offsetTop + elt.clientTop;\n\n if (pageTop >= top) {\n // The found page is fully visible, so we're actually either in case 3 or 4,\n // and unfortunately we can't tell the difference between them without\n // scanning the entire previous row, so we just conservatively assume that\n // we do need to backtrack to that row. In both cases, the previous page is\n // in the previous row, so use its top instead.\n elt = views[index - 1].div;\n pageTop = elt.offsetTop + elt.clientTop;\n }\n\n // Now we backtrack to the first page that still has its bottom below\n // `pageTop`, which is the top of a page in the first visible row (unless\n // we're in case 4, in which case it's the row before that).\n // `index` is found by binary search, so the page at `index - 1` is\n // invisible and we can start looking for potentially visible pages from\n // `index - 2`. (However, if this loop terminates on its first iteration,\n // which is the case when pages are stacked vertically, `index` should remain\n // unchanged, so we use a distinct loop variable.)\n for (let i = index - 2; i >= 0; --i) {\n elt = views[i].div;\n if (elt.offsetTop + elt.clientTop + elt.clientHeight <= pageTop) {\n // We have reached the previous row, so stop now.\n // This loop is expected to terminate relatively quickly because the\n // number of pages per row is expected to be small.\n break;\n }\n index = i;\n }\n return index;\n}\n\n/**\n * @typedef {Object} GetVisibleElementsParameters\n * @property {HTMLElement} scrollEl - A container that can possibly scroll.\n * @property {Array} views - Objects with a `div` property that contains an\n * HTMLElement, which should all be descendants of `scrollEl` satisfying the\n * relevant layout assumptions.\n * @property {boolean} sortByVisibility - If `true`, the returned elements are\n * sorted in descending order of the percent of their padding box that is\n * visible. The default value is `false`.\n * @property {boolean} horizontal - If `true`, the elements are assumed to be\n * laid out horizontally instead of vertically. The default value is `false`.\n * @property {boolean} rtl - If `true`, the `scrollEl` container is assumed to\n * be in right-to-left mode. The default value is `false`.\n */\n\n/**\n * Generic helper to find out what elements are visible within a scroll pane.\n *\n * Well, pretty generic. There are some assumptions placed on the elements\n * referenced by `views`:\n * - If `horizontal`, no left of any earlier element is to the right of the\n * left of any later element.\n * - Otherwise, `views` can be split into contiguous rows where, within a row,\n * no top of any element is below the bottom of any other element, and\n * between rows, no bottom of any element in an earlier row is below the\n * top of any element in a later row.\n *\n * (Here, top, left, etc. all refer to the padding edge of the element in\n * question. For pages, that ends up being equivalent to the bounding box of the\n * rendering canvas. Earlier and later refer to index in `views`, not page\n * layout.)\n *\n * @param {GetVisibleElementsParameters} params\n * @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`\n */\nfunction getVisibleElements({\n scrollEl,\n views,\n sortByVisibility = false,\n horizontal = false,\n rtl = false,\n}) {\n const top = scrollEl.scrollTop,\n bottom = top + scrollEl.clientHeight;\n const left = scrollEl.scrollLeft,\n right = left + scrollEl.clientWidth;\n\n // Throughout this \"generic\" function, comments will assume we're working with\n // PDF document pages, which is the most important and complex case. In this\n // case, the visible elements we're actually interested is the page canvas,\n // which is contained in a wrapper which adds no padding/border/margin, which\n // is itself contained in `view.div` which adds no padding (but does add a\n // border). So, as specified in this function's doc comment, this function\n // does all of its work on the padding edge of the provided views, starting at\n // offsetLeft/Top (which includes margin) and adding clientLeft/Top (which is\n // the border). Adding clientWidth/Height gets us the bottom-right corner of\n // the padding edge.\n function isElementBottomAfterViewTop(view) {\n const element = view.div;\n const elementBottom =\n element.offsetTop + element.clientTop + element.clientHeight;\n return elementBottom > top;\n }\n function isElementNextAfterViewHorizontally(view) {\n const element = view.div;\n const elementLeft = element.offsetLeft + element.clientLeft;\n const elementRight = elementLeft + element.clientWidth;\n return rtl ? elementLeft < right : elementRight > left;\n }\n\n const visible = [],\n ids = new Set(),\n numViews = views.length;\n let firstVisibleElementInd = binarySearchFirstItem(\n views,\n horizontal\n ? isElementNextAfterViewHorizontally\n : isElementBottomAfterViewTop\n );\n\n // Please note the return value of the `binarySearchFirstItem` function when\n // no valid element is found (hence the `firstVisibleElementInd` check below).\n if (\n firstVisibleElementInd > 0 &&\n firstVisibleElementInd < numViews &&\n !horizontal\n ) {\n // In wrapped scrolling (or vertical scrolling with spreads), with some page\n // sizes, isElementBottomAfterViewTop doesn't satisfy the binary search\n // condition: there can be pages with bottoms above the view top between\n // pages with bottoms below. This function detects and corrects that error;\n // see it for more comments.\n firstVisibleElementInd = backtrackBeforeAllVisibleElements(\n firstVisibleElementInd,\n views,\n top\n );\n }\n\n // lastEdge acts as a cutoff for us to stop looping, because we know all\n // subsequent pages will be hidden.\n //\n // When using wrapped scrolling or vertical scrolling with spreads, we can't\n // simply stop the first time we reach a page below the bottom of the view;\n // the tops of subsequent pages on the same row could still be visible. In\n // horizontal scrolling, we don't have that issue, so we can stop as soon as\n // we pass `right`, without needing the code below that handles the -1 case.\n let lastEdge = horizontal ? right : -1;\n\n for (let i = firstVisibleElementInd; i < numViews; i++) {\n const view = views[i],\n element = view.div;\n const currentWidth = element.offsetLeft + element.clientLeft;\n const currentHeight = element.offsetTop + element.clientTop;\n const viewWidth = element.clientWidth,\n viewHeight = element.clientHeight;\n const viewRight = currentWidth + viewWidth;\n const viewBottom = currentHeight + viewHeight;\n\n if (lastEdge === -1) {\n // As commented above, this is only needed in non-horizontal cases.\n // Setting lastEdge to the bottom of the first page that is partially\n // visible ensures that the next page fully below lastEdge is on the\n // next row, which has to be fully hidden along with all subsequent rows.\n if (viewBottom >= bottom) {\n lastEdge = viewBottom;\n }\n } else if ((horizontal ? currentWidth : currentHeight) > lastEdge) {\n break;\n }\n\n if (\n viewBottom <= top ||\n currentHeight >= bottom ||\n viewRight <= left ||\n currentWidth >= right\n ) {\n continue;\n }\n\n const minY = Math.max(0, top - currentHeight);\n const minX = Math.max(0, left - currentWidth);\n\n const hiddenHeight = minY + Math.max(0, viewBottom - bottom);\n const hiddenWidth = minX + Math.max(0, viewRight - right);\n\n const fractionHeight = (viewHeight - hiddenHeight) / viewHeight,\n fractionWidth = (viewWidth - hiddenWidth) / viewWidth;\n const percent = (fractionHeight * fractionWidth * 100) | 0;\n\n visible.push({\n id: view.id,\n x: currentWidth,\n y: currentHeight,\n visibleArea:\n // We only specify which part of the page is visible when it's not\n // the full page, as there is no point in handling a partial page\n // rendering otherwise.\n percent === 100\n ? null\n : {\n minX,\n minY,\n maxX: Math.min(viewRight, right) - currentWidth,\n maxY: Math.min(viewBottom, bottom) - currentHeight,\n },\n view,\n percent,\n widthPercent: (fractionWidth * 100) | 0,\n });\n ids.add(view.id);\n }\n\n const first = visible[0],\n last = visible.at(-1);\n\n if (sortByVisibility) {\n visible.sort(function (a, b) {\n const pc = a.percent - b.percent;\n if (Math.abs(pc) > 0.001) {\n return -pc;\n }\n return a.id - b.id; // ensure stability\n });\n }\n return { first, last, views: visible, ids };\n}\n\nfunction normalizeWheelEventDirection(evt) {\n let delta = Math.hypot(evt.deltaX, evt.deltaY);\n const angle = Math.atan2(evt.deltaY, evt.deltaX);\n if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {\n // All that is left-up oriented has to change the sign.\n delta = -delta;\n }\n return delta;\n}\n\nfunction normalizeWheelEventDelta(evt) {\n const deltaMode = evt.deltaMode; // Avoid being affected by bug 1392460.\n let delta = normalizeWheelEventDirection(evt);\n\n const MOUSE_PIXELS_PER_LINE = 30;\n const MOUSE_LINES_PER_PAGE = 30;\n\n // Converts delta to per-page units\n if (deltaMode === WheelEvent.DOM_DELTA_PIXEL) {\n delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;\n } else if (deltaMode === WheelEvent.DOM_DELTA_LINE) {\n delta /= MOUSE_LINES_PER_PAGE;\n }\n return delta;\n}\n\nfunction isValidRotation(angle) {\n return Number.isInteger(angle) && angle % 90 === 0;\n}\n\nfunction isValidScrollMode(mode) {\n return (\n Number.isInteger(mode) &&\n Object.values(ScrollMode).includes(mode) &&\n mode !== ScrollMode.UNKNOWN\n );\n}\n\nfunction isValidSpreadMode(mode) {\n return (\n Number.isInteger(mode) &&\n Object.values(SpreadMode).includes(mode) &&\n mode !== SpreadMode.UNKNOWN\n );\n}\n\nfunction isPortraitOrientation(size) {\n return size.width <= size.height;\n}\n\n/**\n * Promise that is resolved when DOM window becomes visible.\n */\nconst animationStarted = new Promise(function (resolve) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof window === \"undefined\"\n ) {\n // Prevent \"ReferenceError: window is not defined\" errors when running the\n // unit-tests in Node.js environments.\n setTimeout(resolve, 20);\n return;\n }\n window.requestAnimationFrame(resolve);\n});\n\nconst docStyle =\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof document === \"undefined\"\n ? null\n : document.documentElement.style;\n\nclass ProgressBar {\n #classList = null;\n\n #disableAutoFetchTimeout = null;\n\n #percent = 0;\n\n #style = null;\n\n #visible = true;\n\n constructor(bar) {\n this.#classList = bar.classList;\n this.#style = bar.style;\n }\n\n get percent() {\n return this.#percent;\n }\n\n set percent(val) {\n this.#percent = MathClamp(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 (this.#percent === 100 || isNaN(this.#percent)) {\n return;\n }\n if (this.#disableAutoFetchTimeout) {\n clearTimeout(this.#disableAutoFetchTimeout);\n }\n this.show();\n\n this.#disableAutoFetchTimeout = setTimeout(() => {\n this.#disableAutoFetchTimeout = null;\n this.hide();\n }, delay);\n }\n\n hide() {\n if (!this.#visible) {\n return;\n }\n this.#visible = false;\n this.#classList.add(\"hidden\");\n }\n\n show() {\n if (this.#visible) {\n return;\n }\n this.#visible = true;\n this.#classList.remove(\"hidden\");\n }\n}\n\n/**\n * Get the active or focused element in current DOM.\n *\n * Recursively search for the truly active or focused element in case there are\n * shadow DOMs.\n *\n * @returns {Element} the truly active or focused element.\n */\nfunction getActiveOrFocusedElement() {\n let curRoot = document;\n let curActiveOrFocused =\n curRoot.activeElement || curRoot.querySelector(\":focus\");\n\n while (curActiveOrFocused?.shadowRoot) {\n curRoot = curActiveOrFocused.shadowRoot;\n curActiveOrFocused =\n curRoot.activeElement || curRoot.querySelector(\":focus\");\n }\n\n return curActiveOrFocused;\n}\n\n/**\n * Converts API PageLayout values to the format used by `BaseViewer`.\n * @param {string} layout - The API PageLayout value.\n * @returns {Object}\n */\nfunction apiPageLayoutToViewerModes(layout) {\n let scrollMode = ScrollMode.VERTICAL,\n spreadMode = SpreadMode.NONE;\n\n switch (layout) {\n case \"SinglePage\":\n scrollMode = ScrollMode.PAGE;\n break;\n case \"OneColumn\":\n break;\n case \"TwoPageLeft\":\n scrollMode = ScrollMode.PAGE;\n /* falls through */\n case \"TwoColumnLeft\":\n spreadMode = SpreadMode.ODD;\n break;\n case \"TwoPageRight\":\n scrollMode = ScrollMode.PAGE;\n /* falls through */\n case \"TwoColumnRight\":\n spreadMode = SpreadMode.EVEN;\n break;\n }\n return { scrollMode, spreadMode };\n}\n\n/**\n * Converts API PageMode values to the format used by `PDFSidebar`.\n * NOTE: There's also a \"FullScreen\" parameter which is not possible to support,\n * since the Fullscreen API used in browsers requires that entering\n * fullscreen mode only occurs as a result of a user-initiated event.\n * @param {string} mode - The API PageMode value.\n * @returns {number} A value from {SidebarView}.\n */\nfunction apiPageModeToSidebarView(mode) {\n switch (mode) {\n case \"UseNone\":\n return SidebarView.NONE;\n case \"UseThumbs\":\n return SidebarView.THUMBS;\n case \"UseOutlines\":\n return SidebarView.OUTLINE;\n case \"UseAttachments\":\n return SidebarView.ATTACHMENTS;\n case \"UseOC\":\n return SidebarView.LAYERS;\n }\n return SidebarView.NONE; // Default value.\n}\n\nfunction toggleCheckedBtn(button, toggle, view = null) {\n button.classList.toggle(\"toggled\", toggle);\n button.setAttribute(\"aria-checked\", toggle);\n\n view?.classList.toggle(\"hidden\", !toggle);\n}\n\nfunction toggleExpandedBtn(button, toggle, view = null) {\n button.classList.toggle(\"toggled\", toggle);\n button.setAttribute(\"aria-expanded\", toggle);\n\n view?.classList.toggle(\"hidden\", !toggle);\n}\n\n// In Firefox, the css calc function uses f32 precision but the Chrome or Safari\n// are using f64 one. So in order to have the same rendering in all browsers, we\n// need to use the right precision in order to have correct dimensions.\nconst calcRound =\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? Math.fround\n : (function () {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n typeof document === \"undefined\"\n ) {\n return x => x;\n }\n const e = document.createElement(\"div\");\n e.style.width = \"round(down, calc(1.6666666666666665 * 792px), 1px)\";\n return e.style.width === \"calc(1320px)\" ? Math.fround : x => x;\n })();\n\nexport {\n animationStarted,\n apiPageLayoutToViewerModes,\n apiPageModeToSidebarView,\n approximateFraction,\n AutoPrintRegExp,\n backtrackBeforeAllVisibleElements, // only exported for testing\n binarySearchFirstItem,\n calcRound,\n CursorTool,\n DEFAULT_SCALE,\n DEFAULT_SCALE_DELTA,\n DEFAULT_SCALE_VALUE,\n docStyle,\n floorToDivide,\n getActiveOrFocusedElement,\n getPageSizeInches,\n getVisibleElements,\n isPortraitOrientation,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n MAX_AUTO_SCALE,\n MAX_SCALE,\n MIN_SCALE,\n normalizeWheelEventDelta,\n normalizeWheelEventDirection,\n parseQueryString,\n PresentationModeState,\n ProgressBar,\n removeNullCharacters,\n RenderingStates,\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 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, options = {}) {\n // The diacritics in the text or in the query can be composed or not.\n // So we use a decomposed text using NFD (and the same for the query)\n // in order to be sure that diacritics are in the same order.\n\n // Collect syllables length and positions.\n const syllablePositions = [];\n let m;\n while ((m = SYLLABLES_REG_EXP.exec(text)) !== null) {\n let { index } = m;\n for (const char of m[0]) {\n let len = SYLLABLES_LENGTHS.get(char);\n if (!len) {\n len = char.normalize(\"NFD\").length;\n SYLLABLES_LENGTHS.set(char, len);\n }\n syllablePositions.push([len, index++]);\n }\n }\n\n const hasSyllables = syllablePositions.length > 0;\n const ignoreDashEOL = options.ignoreDashEOL ?? false;\n\n let normalizationRegex;\n if (!hasSyllables && noSyllablesRegExp) {\n normalizationRegex = noSyllablesRegExp;\n } else if (hasSyllables && withSyllablesRegExp) {\n normalizationRegex = withSyllablesRegExp;\n } else {\n // Compile the regular expression for text normalization once.\n const replace = Object.keys(CHARACTERS_TO_NORMALIZE).join(\"\");\n const toNormalizeWithNFKC = getNormalizeWithNFKC();\n\n // 3040-309F: Hiragana\n // 30A0-30FF: Katakana\n const CJK = \"(?:\\\\p{Ideographic}|[\\u3040-\\u30FF])\";\n const HKDiacritics = \"(?:\\u3099|\\u309A)\";\n const BrokenWord = `\\\\p{Ll}-\\\\n(?=\\\\p{Ll})|\\\\p{Lu}-\\\\n(?=\\\\p{L})`;\n\n const regexps = [\n /* p1 */ `[${replace}]`,\n /* p2 */ `[${toNormalizeWithNFKC}]`,\n /* p3 */ `${HKDiacritics}\\\\n`,\n /* p4 */ \"\\\\p{M}+(?:-\\\\n)?\",\n /* p5 */ `${BrokenWord}`,\n /* p6 */ \"\\\\S-\\\\n\",\n /* p7 */ `${CJK}\\\\n`,\n /* p8 */ \"\\\\n\",\n /* p9 */ hasSyllables\n ? FIRST_CHAR_SYLLABLES_REG_EXP\n : // Most of the syllables belong to Hangul so there are no need\n // to search for them in a non-Hangul document.\n // We use the \\0 in order to have the same number of groups.\n \"\\\\u0000\",\n ];\n normalizationRegex = new RegExp(\n regexps.map(r => `(${r})`).join(\"|\"),\n \"gum\"\n );\n\n if (hasSyllables) {\n withSyllablesRegExp = normalizationRegex;\n } else {\n noSyllablesRegExp = normalizationRegex;\n }\n }\n\n // The goal of this function is to normalize the string and\n // be able to get from an index in the new string the\n // corresponding index in the old string.\n // For example if we have: abCd12ef456gh where C is replaced by ccc\n // and numbers replaced by nothing (it's the case for diacritics), then\n // we'll obtain the normalized string: abcccdefgh.\n // So here the reverse map is: [0,1,2,2,2,3,6,7,11,12].\n\n // The goal is to obtain the array: [[0, 0], [3, -1], [4, -2],\n // [6, 0], [8, 3]].\n // which can be used like this:\n // - let say that i is the index in new string and j the index\n // the old string.\n // - if i is in [0; 3[ then j = i + 0\n // - if i is in [3; 4[ then j = i - 1\n // - if i is in [4; 6[ then j = i - 2\n // ...\n // Thanks to a binary search it's easy to know where is i and what's the\n // shift.\n // Let say that the last entry in the array is [x, s] and we have a\n // substitution at index y (old string) which will replace o chars by n chars.\n // Firstly, if o === n, then no need to add a new entry: the shift is\n // the same.\n // Secondly, if o < n, then we push the n - o elements:\n // [y - (s - 1), s - 1], [y - (s - 2), s - 2], ...\n // Thirdly, if o > n, then we push the element: [y - (s - n), o + s - n]\n\n // Collect diacritics length and positions.\n const rawDiacriticsPositions = [];\n while ((m = DIACRITICS_REG_EXP.exec(text)) !== null) {\n rawDiacriticsPositions.push([m[0].length, m.index]);\n }\n\n let normalized = text.normalize(\"NFD\");\n const positions = [0, 0];\n let rawDiacriticsIndex = 0;\n let syllableIndex = 0;\n let shift = 0;\n let shiftOrigin = 0;\n let eol = 0;\n let hasDiacritics = false;\n\n normalized = normalized.replace(\n normalizationRegex,\n (match, p1, p2, p3, p4, p5, p6, p7, p8, p9, i) => {\n i -= shiftOrigin;\n if (p1) {\n // Maybe fractions or quotations mark...\n const replacement = CHARACTERS_TO_NORMALIZE[p1];\n const jj = replacement.length;\n for (let j = 1; j < jj; j++) {\n positions.push(i - shift + j, shift - j);\n }\n shift -= jj - 1;\n return replacement;\n }\n\n if (p2) {\n // Use the NFKC representation to normalize the char.\n let replacement = NFKC_CHARS_TO_NORMALIZE.get(p2);\n if (!replacement) {\n replacement = p2.normalize(\"NFKC\");\n NFKC_CHARS_TO_NORMALIZE.set(p2, replacement);\n }\n const jj = replacement.length;\n for (let j = 1; j < jj; j++) {\n positions.push(i - shift + j, shift - j);\n }\n shift -= jj - 1;\n return replacement;\n }\n\n if (p3) {\n // We've a Katakana-Hiragana diacritic followed by a \\n so don't replace\n // the \\n by a whitespace.\n hasDiacritics = true;\n\n // Diacritic.\n if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n ++rawDiacriticsIndex;\n } else {\n // i is the position of the first diacritic\n // so (i - 1) is the position for the letter before.\n positions.push(i - 1 - shift + 1, shift - 1);\n shift -= 1;\n shiftOrigin += 1;\n }\n\n // End-of-line.\n positions.push(i - shift + 1, shift);\n shiftOrigin += 1;\n eol += 1;\n\n return p3.charAt(0);\n }\n\n if (p4) {\n const hasTrailingDashEOL = p4.endsWith(\"\\n\");\n const len = hasTrailingDashEOL ? p4.length - 2 : p4.length;\n\n // Diacritics.\n hasDiacritics = true;\n let jj = len;\n if (i + eol === rawDiacriticsPositions[rawDiacriticsIndex]?.[1]) {\n jj -= rawDiacriticsPositions[rawDiacriticsIndex][0];\n ++rawDiacriticsIndex;\n }\n\n for (let j = 1; j <= jj; j++) {\n // i is the position of the first diacritic\n // so (i - 1) is the position for the letter before.\n positions.push(i - 1 - shift + j, shift - j);\n }\n shift -= jj;\n shiftOrigin += jj;\n\n if (hasTrailingDashEOL) {\n // Diacritics are followed by a -\\n.\n // See comments in `if (p6)` block.\n i += len - 1;\n positions.push(i - shift + 1, 1 + shift);\n shift += 1;\n shiftOrigin += 1;\n eol += 1;\n return p4.slice(0, len);\n }\n\n return p4;\n }\n\n if (p5) {\n if (ignoreDashEOL) {\n // Keep the - but remove the EOL.\n shiftOrigin += 1;\n eol += 1;\n return p5.slice(0, -1);\n }\n // In \"X-\\ny\", \"-\\n\" is removed because an hyphen at the end of a line\n // between two letters is likely here to mark a break in a word.\n // If X is encoded with UTF-32 then it can have a length greater than 1.\n // The \\n isn't in the original text so here y = i, n = X.len - 2 and\n // o = X.len - 1.\n const len = p5.length - 2;\n positions.push(i - shift + len, 1 + shift);\n shift += 1;\n shiftOrigin += 1;\n eol += 1;\n return p5.slice(0, -2);\n }\n\n if (p6) {\n // A - following a non-space character that is not detected as the\n // hyphen breaking a word in two lines needs to be preserved. It could\n // be, for example, in a compound word or in a date.\n // Only remove the newline.\n shiftOrigin += 1;\n eol += 1;\n return p6.slice(0, -1);\n }\n\n if (p7) {\n // An ideographic at the end of a line doesn't imply adding an extra\n // white space.\n // A CJK can be encoded in UTF-32, hence their length isn't always 1.\n const len = p7.length - 1;\n positions.push(i - shift + len, shift);\n shiftOrigin += 1;\n eol += 1;\n return p7.slice(0, -1);\n }\n\n if (p8) {\n // eol is replaced by space: \"foo\\nbar\" is likely equivalent to\n // \"foo bar\".\n positions.push(i - shift + 1, shift - 1);\n shift -= 1;\n shiftOrigin += 1;\n eol += 1;\n return \" \";\n }\n\n // p9\n if (i + eol === syllablePositions[syllableIndex]?.[1]) {\n // A syllable (1 char) is replaced with several chars (n) so\n // newCharsLen = n - 1.\n const newCharLen = syllablePositions[syllableIndex][0] - 1;\n ++syllableIndex;\n for (let j = 1; j <= newCharLen; j++) {\n positions.push(i - (shift - j), shift - j);\n }\n shift -= newCharLen;\n shiftOrigin += newCharLen;\n }\n return p9;\n }\n );\n\n positions.push(normalized.length, shift);\n const starts = new Uint32Array(positions.length >> 1);\n const shifts = new Int32Array(positions.length >> 1);\n for (let i = 0, ii = positions.length; i < ii; i += 2) {\n starts[i >> 1] = positions[i];\n shifts[i >> 1] = positions[i + 1];\n }\n\n return [normalized, [starts, shifts], hasDiacritics];\n}\n\n// Determine the original, non-normalized, match index such that highlighting of\n// search results is correct in the `textLayer` for strings containing e.g. \"½\"\n// characters; essentially \"inverting\" the result of the `normalize` function.\nfunction getOriginalIndex(diffs, pos, len) {\n if (!diffs) {\n return [pos, len];\n }\n\n const [starts, shifts] = diffs;\n // First char in the new string.\n const start = pos;\n // Last char in the new string.\n const end = pos + len - 1;\n let i = binarySearchFirstItem(starts, x => x >= start);\n if (starts[i] > start) {\n --i;\n }\n\n let j = binarySearchFirstItem(starts, x => x >= end, i);\n if (starts[j] > end) {\n --j;\n }\n\n // First char in the old string.\n const oldStart = start + shifts[i];\n\n // Last char in the old string.\n const oldEnd = end + shifts[j];\n const oldLen = oldEnd + 1 - oldStart;\n\n return [oldStart, oldLen];\n}\n\n/**\n * @typedef {Object} PDFFindControllerOptions\n * @property {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 #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 interfere 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 if (!this.#state) {\n return;\n }\n const query = this.#query;\n if (query.length === 0) {\n return; // Do nothing: the matches should be wiped out already.\n }\n const pageContent = this._pageContents[pageIndex];\n const matcherResult = this.match(query, pageContent, pageIndex);\n\n const matches = (this._pageMatches[pageIndex] = []);\n const matchesLength = (this._pageMatchesLength[pageIndex] = []);\n const diffs = this._pageDiffs[pageIndex];\n\n matcherResult?.forEach(({ index, length }) => {\n const [matchPos, matchLen] = getOriginalIndex(diffs, index, length);\n if (matchLen) {\n matches.push(matchPos);\n matchesLength.push(matchLen);\n }\n });\n\n // When `highlightAll` is set, ensure that the matches on previously\n // rendered (and still active) pages are correctly highlighted.\n if (this.#state.highlightAll) {\n this.#updatePage(pageIndex);\n }\n if (this._resumePageIdx === pageIndex) {\n this._resumePageIdx = null;\n this.#nextPageMatch();\n }\n\n // Update the match count.\n const pageMatchesCount = matches.length;\n this._matchesCountTotal += pageMatchesCount;\n if (this.#updateMatchesCountOnProgress) {\n if (pageMatchesCount > 0) {\n this.#updateUIResultsCount();\n }\n } else if (++this.#visitedPagesCount === this._linkService.pagesCount) {\n // For example, in GeckoView we want to have only the final update because\n // the Java side provides only one object to update the counts.\n this.#updateUIResultsCount();\n }\n }\n\n /**\n * @typedef {Object} FindMatch\n * @property {number} index - The start of the matched text in the page's\n * string contents.\n * @property {number} length - The length of the matched text.\n */\n\n /**\n * @param {string | string[]} query - The search query.\n * @param {string} pageContent - The text content of the page to search in.\n * @param {number} pageIndex - The index of the page that is being processed.\n * @returns {FindMatch[] | undefined} An array of matches in the provided\n * page.\n */\n match(query, pageContent, pageIndex) {\n const hasDiacritics = this._hasDiacritics[pageIndex];\n\n let isUnicode = false;\n if (typeof query === \"string\") {\n [isUnicode, query] = this.#convertToRegExpString(query, hasDiacritics);\n } else {\n // Words are sorted in reverse order to be sure that \"foobar\" is matched\n // before \"foo\" in case the query is \"foobar foo\".\n query = query\n .sort()\n .reverse()\n .map(q => {\n const [isUnicodePart, queryPart] = this.#convertToRegExpString(\n q,\n hasDiacritics\n );\n isUnicode ||= isUnicodePart;\n return `(${queryPart})`;\n })\n .join(\"|\");\n }\n if (!query) {\n // The query can be empty because some chars like diacritics could have\n // been stripped out.\n return undefined;\n }\n\n const { caseSensitive, entireWord } = this.#state;\n const flags = `g${isUnicode ? \"u\" : \"\"}${caseSensitive ? \"\" : \"i\"}`;\n query = new RegExp(query, flags);\n\n const matches = [];\n let match;\n while ((match = query.exec(pageContent)) !== null) {\n if (\n entireWord &&\n !this.#isEntireWord(pageContent, match.index, match[0].length)\n ) {\n continue;\n }\n matches.push({ index: match.index, length: match[0].length });\n }\n return matches;\n }\n\n #extractText() {\n // Perform text extraction once if this method is called multiple times.\n if (this._extractTextPromises.length > 0) {\n return;\n }\n\n let deferred = Promise.resolve();\n const textOptions = { disableNormalization: true };\n const pdfDoc = this._pdfDocument;\n for (let i = 0, ii = this._linkService.pagesCount; i < ii; i++) {\n const { promise, resolve } = Promise.withResolvers();\n this._extractTextPromises[i] = promise;\n\n deferred = deferred.then(async () => {\n if (pdfDoc !== this._pdfDocument) {\n resolve();\n return;\n }\n await pdfDoc\n .getPage(i + 1)\n .then(pdfPage => pdfPage.getTextContent(textOptions))\n .then(\n textContent => {\n const strBuf = [];\n\n for (const textItem of textContent.items) {\n strBuf.push(textItem.str);\n if (textItem.hasEOL) {\n strBuf.push(\"\\n\");\n }\n }\n\n // Store the normalized page content (text items) as one string.\n [\n this._pageContents[i],\n this._pageDiffs[i],\n this._hasDiacritics[i],\n ] = normalize(strBuf.join(\"\"));\n resolve();\n },\n reason => {\n console.error(\n `Unable to get text content for page ${i + 1}`,\n reason\n );\n // Page error -- assuming no text content.\n this._pageContents[i] = \"\";\n this._pageDiffs[i] = null;\n this._hasDiacritics[i] = false;\n resolve();\n }\n );\n });\n }\n }\n\n #updatePage(index) {\n if (this._scrollMatches && this._selected.pageIdx === index) {\n // If the page is selected, scroll the page into view, which triggers\n // rendering the page, which adds the text layer. Once the text layer\n // is built, it will attempt to scroll the selected match into view.\n this._linkService.page = index + 1;\n }\n\n this._eventBus.dispatch(\"updatetextlayermatches\", {\n source: this,\n pageIndex: index,\n });\n }\n\n #updateAllPages() {\n this._eventBus.dispatch(\"updatetextlayermatches\", {\n source: this,\n pageIndex: -1,\n });\n }\n\n #nextMatch() {\n const previous = this.#state.findPrevious;\n const currentPageIndex = this._linkService.page - 1;\n const numPages = this._linkService.pagesCount;\n\n this._highlightMatches = true;\n\n if (this._dirtyMatch) {\n // Need to recalculate the matches, reset everything.\n this._dirtyMatch = false;\n this._selected.pageIdx = this._selected.matchIdx = -1;\n this._offset.pageIdx = currentPageIndex;\n this._offset.matchIdx = null;\n this._offset.wrapped = false;\n this._resumePageIdx = null;\n this._pageMatches.length = 0;\n this._pageMatchesLength.length = 0;\n this.#visitedPagesCount = 0;\n this._matchesCountTotal = 0;\n\n this.#updateAllPages(); // Wipe out any previously highlighted matches.\n\n for (let i = 0; i < numPages; i++) {\n // Start finding the matches as soon as the text is extracted.\n if (this._pendingFindMatches.has(i)) {\n continue;\n }\n this._pendingFindMatches.add(i);\n this._extractTextPromises[i].then(() => {\n this._pendingFindMatches.delete(i);\n this.#calculateMatch(i);\n });\n }\n }\n\n // If there's no query there's no point in searching.\n const query = this.#query;\n if (query.length === 0) {\n this.#updateUIState(FindState.FOUND);\n return;\n }\n // If we're waiting on a page, we return since we can't do anything else.\n if (this._resumePageIdx) {\n return;\n }\n\n const offset = this._offset;\n // Keep track of how many pages we should maximally iterate through.\n this._pagesToSearch = numPages;\n // If there's already a `matchIdx` that means we are iterating through a\n // page's matches.\n if (offset.matchIdx !== null) {\n const numPageMatches = this._pageMatches[offset.pageIdx].length;\n if (\n (!previous && offset.matchIdx + 1 < numPageMatches) ||\n (previous && offset.matchIdx > 0)\n ) {\n // The simple case; we just have advance the matchIdx to select\n // the next match on the page.\n offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;\n this.#updateMatch(/* found = */ true);\n return;\n }\n // We went beyond the current page's matches, so we advance to\n // the next page.\n this.#advanceOffsetPage(previous);\n }\n // Start searching through the page.\n this.#nextPageMatch();\n }\n\n #matchesReady(matches) {\n const offset = this._offset;\n const numMatches = matches.length;\n const previous = this.#state.findPrevious;\n\n if (numMatches) {\n // There were matches for the page, so initialize `matchIdx`.\n offset.matchIdx = previous ? numMatches - 1 : 0;\n this.#updateMatch(/* found = */ true);\n return true;\n }\n // No matches, so attempt to search the next page.\n this.#advanceOffsetPage(previous);\n if (offset.wrapped) {\n offset.matchIdx = null;\n if (this._pagesToSearch < 0) {\n // No point in wrapping again, there were no matches.\n this.#updateMatch(/* found = */ false);\n // While matches were not found, searching for a page\n // with matches should nevertheless halt.\n return true;\n }\n }\n // Matches were not found (and searching is not done).\n return false;\n }\n\n #nextPageMatch() {\n if (this._resumePageIdx !== null) {\n console.error(\"There can only be one pending page.\");\n }\n\n let matches = null;\n do {\n const pageIdx = this._offset.pageIdx;\n matches = this._pageMatches[pageIdx];\n if (!matches) {\n // The matches don't exist yet for processing by `_matchesReady`,\n // so set a resume point for when they do exist.\n this._resumePageIdx = pageIdx;\n break;\n }\n } while (!this.#matchesReady(matches));\n }\n\n #advanceOffsetPage(previous) {\n const offset = this._offset;\n const numPages = this._linkService.pagesCount;\n offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;\n offset.matchIdx = null;\n\n this._pagesToSearch--;\n\n if (offset.pageIdx >= numPages || offset.pageIdx < 0) {\n offset.pageIdx = previous ? numPages - 1 : 0;\n offset.wrapped = true;\n }\n }\n\n #updateMatch(found = false) {\n let state = FindState.NOT_FOUND;\n const wrapped = this._offset.wrapped;\n this._offset.wrapped = false;\n\n if (found) {\n const previousPage = this._selected.pageIdx;\n this._selected.pageIdx = this._offset.pageIdx;\n this._selected.matchIdx = this._offset.matchIdx;\n state = wrapped ? FindState.WRAPPED : FindState.FOUND;\n\n // Update the currently selected page to wipe out any selected matches.\n if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {\n this.#updatePage(previousPage);\n }\n }\n\n this.#updateUIState(state, this.#state.findPrevious);\n if (this._selected.pageIdx !== -1) {\n // Ensure that the match will be scrolled into view.\n this._scrollMatches = true;\n\n this.#updatePage(this._selected.pageIdx);\n }\n }\n\n #onFindBarClose(evt) {\n const pdfDocument = this._pdfDocument;\n // Since searching is asynchronous, ensure that the removal of highlighted\n // matches (from the UI) is async too such that the 'updatetextlayermatches'\n // events will always be dispatched in the expected order.\n this._firstPageCapability.promise.then(() => {\n // Only update the UI if the document is open, and is the current one.\n if (\n !this._pdfDocument ||\n (pdfDocument && this._pdfDocument !== pdfDocument)\n ) {\n return;\n }\n // Ensure that a pending, not yet started, search operation is aborted.\n if (this._findTimeout) {\n clearTimeout(this._findTimeout);\n this._findTimeout = null;\n }\n // Abort any long running searches, to avoid a match being scrolled into\n // view *after* the findbar has been closed. In this case `this._offset`\n // will most likely differ from `this._selected`, hence we also ensure\n // that any new search operation will always start with a clean slate.\n if (this._resumePageIdx) {\n this._resumePageIdx = null;\n this._dirtyMatch = true;\n }\n // Avoid the UI being in a pending state when the findbar is re-opened.\n this.#updateUIState(FindState.FOUND);\n\n this._highlightMatches = false;\n this.#updateAllPages(); // Wipe out any previously highlighted matches.\n });\n }\n\n #requestMatchesCount() {\n const { pageIdx, matchIdx } = this._selected;\n let current = 0,\n total = this._matchesCountTotal;\n if (matchIdx !== -1) {\n for (let i = 0; i < pageIdx; i++) {\n current += this._pageMatches[i]?.length || 0;\n }\n current += matchIdx + 1;\n }\n // When searching starts, this method may be called before the `pageMatches`\n // have been counted (in `#calculateMatch`). Ensure that the UI won't show\n // temporarily broken state when the active find result doesn't make sense.\n if (current < 1 || current > total) {\n current = total = 0;\n }\n return { current, total };\n }\n\n #updateUIResultsCount() {\n this._eventBus.dispatch(\"updatefindmatchescount\", {\n source: this,\n matchesCount: this.#requestMatchesCount(),\n });\n }\n\n #updateUIState(state, previous = false) {\n if (\n !this.#updateMatchesCountOnProgress &&\n (this.#visitedPagesCount !== this._linkService.pagesCount ||\n state === FindState.PENDING)\n ) {\n // When this.#updateMatchesCountOnProgress is false we only send an update\n // when everything is ready.\n return;\n }\n\n this._eventBus.dispatch(\"updatefindcontrolstate\", {\n source: this,\n state,\n previous,\n entireWord: this.#state?.entireWord ?? null,\n matchesCount: this.#requestMatchesCount(),\n rawQuery: this.#state?.query ?? null,\n });\n }\n}\n\nexport { FindState, getOriginalIndex, normalize, PDFFindController };\n","/* Copyright 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 { isValidExplicitDest } from \"pdfjs-lib\";\nimport { parseQueryString } from \"./ui_utils.js\";\n\nconst DEFAULT_LINK_REL = \"noopener noreferrer nofollow\";\n\nconst LinkTarget = {\n NONE: 0, // Default value.\n SELF: 1,\n BLANK: 2,\n PARENT: 3,\n TOP: 4,\n};\n\n/**\n * @typedef {Object} PDFLinkServiceOptions\n * @property {EventBus} eventBus - The application event bus.\n * @property {number} [externalLinkTarget] - Specifies the `target` attribute\n * for external links. Must use one of the values from {LinkTarget}.\n * Defaults to using no target.\n * @property {string} [externalLinkRel] - Specifies the `rel` attribute for\n * external links. Defaults to stripping the referrer.\n * @property {boolean} [ignoreDestinationZoom] - Ignores the zoom argument,\n * thus preserving the current zoom level in the viewer, when navigating\n * to internal destinations. The default value is `false`.\n */\n\n/**\n * Performs navigation functions inside PDF, such as opening specified page,\n * or destination.\n * @implements {IPDFLinkService}\n */\nclass PDFLinkService {\n externalLinkEnabled = true;\n\n /**\n * @param {PDFLinkServiceOptions} options\n */\n constructor({\n eventBus,\n externalLinkTarget = null,\n externalLinkRel = null,\n ignoreDestinationZoom = false,\n } = {}) {\n this.eventBus = eventBus;\n this.externalLinkTarget = externalLinkTarget;\n this.externalLinkRel = externalLinkRel;\n this._ignoreDestinationZoom = ignoreDestinationZoom;\n\n this.baseUrl = null;\n this.pdfDocument = null;\n this.pdfViewer = null;\n this.pdfHistory = null;\n }\n\n setDocument(pdfDocument, baseUrl = null) {\n this.baseUrl = baseUrl;\n this.pdfDocument = pdfDocument;\n }\n\n setViewer(pdfViewer) {\n this.pdfViewer = pdfViewer;\n }\n\n setHistory(pdfHistory) {\n this.pdfHistory = pdfHistory;\n }\n\n /**\n * @type {number}\n */\n get pagesCount() {\n return this.pdfDocument ? this.pdfDocument.numPages : 0;\n }\n\n /**\n * @type {number}\n */\n get page() {\n return this.pdfDocument ? this.pdfViewer.currentPageNumber : 1;\n }\n\n /**\n * @param {number} value\n */\n set page(value) {\n if (this.pdfDocument) {\n this.pdfViewer.currentPageNumber = value;\n }\n }\n\n /**\n * @type {number}\n */\n get rotation() {\n return this.pdfDocument ? this.pdfViewer.pagesRotation : 0;\n }\n\n /**\n * @param {number} value\n */\n set rotation(value) {\n if (this.pdfDocument) {\n this.pdfViewer.pagesRotation = value;\n }\n }\n\n /**\n * @type {boolean}\n */\n get isInPresentationMode() {\n return this.pdfDocument ? this.pdfViewer.isInPresentationMode : false;\n }\n\n /**\n * This method will, when available, also update the browser history.\n *\n * @param {string|Array} dest - The named, or explicit, PDF destination.\n */\n async goToDestination(dest) {\n if (!this.pdfDocument) {\n return;\n }\n let namedDest, explicitDest, pageNumber;\n if (typeof dest === \"string\") {\n namedDest = dest;\n explicitDest = await this.pdfDocument.getDestination(dest);\n } else {\n namedDest = null;\n explicitDest = await dest;\n }\n if (!Array.isArray(explicitDest)) {\n console.error(\n `goToDestination: \"${explicitDest}\" is not a valid destination array, for dest=\"${dest}\".`\n );\n return;\n }\n // Dest array looks like that: \n const [destRef] = explicitDest;\n\n if (destRef && typeof destRef === \"object\") {\n pageNumber = this.pdfDocument.cachedPageNumber(destRef);\n\n if (!pageNumber) {\n // Fetch the page reference if it's not yet available. This could\n // only occur during loading, before all pages have been resolved.\n try {\n pageNumber = (await this.pdfDocument.getPageIndex(destRef)) + 1;\n } catch {\n console.error(\n `goToDestination: \"${destRef}\" is not a valid page reference, for dest=\"${dest}\".`\n );\n return;\n }\n }\n } else if (Number.isInteger(destRef)) {\n pageNumber = destRef + 1;\n }\n if (!pageNumber || pageNumber < 1 || pageNumber > this.pagesCount) {\n console.error(\n `goToDestination: \"${pageNumber}\" is not a valid page number, for dest=\"${dest}\".`\n );\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new destination into\n // view, to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.push({ namedDest, explicitDest, pageNumber });\n }\n\n this.pdfViewer.scrollPageIntoView({\n pageNumber,\n destArray: explicitDest,\n ignoreDestinationZoom: this._ignoreDestinationZoom,\n });\n\n const ac = new AbortController();\n this.eventBus._on(\n \"textlayerrendered\",\n evt => {\n if (evt.pageNumber === pageNumber) {\n evt.source.textLayer.div.focus();\n ac.abort();\n }\n },\n { signal: ac.signal }\n );\n }\n\n /**\n * This method will, when available, also update the browser history.\n *\n * @param {number|string} val - The page number, or page label.\n */\n goToPage(val) {\n if (!this.pdfDocument) {\n return;\n }\n const pageNumber =\n (typeof val === \"string\" && this.pdfViewer.pageLabelToPageNumber(val)) ||\n val | 0;\n if (\n !(\n Number.isInteger(pageNumber) &&\n pageNumber > 0 &&\n pageNumber <= this.pagesCount\n )\n ) {\n console.error(`PDFLinkService.goToPage: \"${val}\" is not a valid page.`);\n return;\n }\n\n if (this.pdfHistory) {\n // Update the browser history before scrolling the new page into view,\n // to be able to accurately capture the current document position.\n this.pdfHistory.pushCurrentPosition();\n this.pdfHistory.pushPage(pageNumber);\n }\n\n this.pdfViewer.scrollPageIntoView({ pageNumber });\n }\n\n /**\n * Adds various attributes (href, title, target, rel) to hyperlinks.\n * @param {HTMLAnchorElement} link\n * @param {string} url\n * @param {boolean} [newWindow]\n */\n addLinkAttributes(link, url, newWindow = false) {\n if (!url || typeof url !== \"string\") {\n throw new Error('A valid \"url\" parameter must provided.');\n }\n const target = newWindow ? LinkTarget.BLANK : this.externalLinkTarget,\n rel = this.externalLinkRel;\n\n if (this.externalLinkEnabled) {\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 * @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 .\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 (typeof dest === \"string\" || isValidExplicitDest(dest)) {\n this.goToDestination(dest);\n return;\n }\n console.error(\n `PDFLinkService.setHash: \"${unescape(hash)}\" is not a valid destination.`\n );\n }\n\n /**\n * @param {string} action\n */\n executeNamedAction(action) {\n if (!this.pdfDocument) {\n return;\n }\n // See PDF reference, table 8.45 - Named action\n switch (action) {\n case \"GoBack\":\n this.pdfHistory?.back();\n break;\n\n case \"GoForward\":\n this.pdfHistory?.forward();\n break;\n\n case \"NextPage\":\n this.pdfViewer.nextPage();\n break;\n\n case \"PrevPage\":\n this.pdfViewer.previousPage();\n break;\n\n case \"LastPage\":\n this.page = this.pagesCount;\n break;\n\n case \"FirstPage\":\n this.page = 1;\n break;\n\n default:\n break; // No action according to spec\n }\n\n this.eventBus.dispatch(\"namedaction\", {\n source: this,\n action,\n });\n }\n\n /**\n * @param {Object} action\n */\n async executeSetOCGState(action) {\n if (!this.pdfDocument) {\n return;\n }\n const pdfDocument = this.pdfDocument,\n optionalContentConfig = await this.pdfViewer.optionalContentConfigPromise;\n\n if (pdfDocument !== this.pdfDocument) {\n return; // The document was closed while the optional content resolved.\n }\n optionalContentConfig.setOCGState(action);\n\n this.pdfViewer.optionalContentConfigPromise = Promise.resolve(\n optionalContentConfig\n );\n }\n}\n\n/**\n * @implements {IPDFLinkService}\n */\nclass SimpleLinkService extends PDFLinkService {\n setDocument(pdfDocument, baseUrl = null) {}\n}\n\nexport { LinkTarget, PDFLinkService, SimpleLinkService };\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(\"./struct_tree_layer_builder.js\").StructTreeLayerBuilder} StructTreeLayerBuilder */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/editor/tools.js\").AnnotationEditorUIManager} AnnotationEditorUIManager */\n\nimport {\n AnnotationLayer,\n AnnotationType,\n setLayerDimensions,\n Util,\n} from \"pdfjs-lib\";\nimport { PresentationModeState } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} AnnotationLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {AnnotationStorage} [annotationStorage]\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {boolean} renderForms\n * @property {IPDFLinkService} linkService\n * @property {IDownloadManager} [downloadManager]\n * @property {boolean} [enableScripting]\n * @property {Promise} [hasJSActionsPromise]\n * @property {Promise> | null>}\n * [fieldObjectsPromise]\n * @property {Map} [annotationCanvasMap]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationEditorUIManager} [annotationEditorUIManager]\n * @property {function} [onAppend]\n */\n\n/**\n * @typedef {Object} AnnotationLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n * @property {StructTreeLayerBuilder} [structTreeLayer]\n */\n\n/**\n * @typedef {Object} InjectLinkAnnotationsOptions\n * @property {Array} inferredLinks\n * @property {PageViewport} viewport\n * @property {StructTreeLayerBuilder} [structTreeLayer]\n */\n\nclass AnnotationLayerBuilder {\n #annotations = null;\n\n #externalHide = false;\n\n #onAppend = null;\n\n #eventAbortController = null;\n\n #linksInjected = false;\n\n /**\n * @param {AnnotationLayerBuilderOptions} options\n */\n constructor({\n pdfPage,\n linkService,\n downloadManager,\n annotationStorage = null,\n imageResourcesPath = \"\",\n renderForms = true,\n enableScripting = false,\n hasJSActionsPromise = null,\n fieldObjectsPromise = null,\n annotationCanvasMap = null,\n accessibilityManager = null,\n annotationEditorUIManager = null,\n onAppend = null,\n }) {\n this.pdfPage = pdfPage;\n this.linkService = linkService;\n this.downloadManager = downloadManager;\n this.imageResourcesPath = imageResourcesPath;\n this.renderForms = renderForms;\n this.annotationStorage = annotationStorage;\n this.enableScripting = enableScripting;\n this._hasJSActionsPromise = hasJSActionsPromise || Promise.resolve(false);\n this._fieldObjectsPromise = fieldObjectsPromise || Promise.resolve(null);\n this._annotationCanvasMap = annotationCanvasMap;\n this._accessibilityManager = accessibilityManager;\n this._annotationEditorUIManager = annotationEditorUIManager;\n this.#onAppend = onAppend;\n\n this.annotationLayer = null;\n this.div = null;\n this._cancelled = false;\n this._eventBus = linkService.eventBus;\n }\n\n /**\n * @param {AnnotationLayerBuilderRenderOptions} options\n * @returns {Promise} A promise that is resolved when rendering of the\n * annotations is complete.\n */\n async render({ viewport, intent = \"display\", structTreeLayer = null }) {\n if (this.div) {\n if (this._cancelled || !this.annotationLayer) {\n return;\n }\n // If an annotationLayer already exists, refresh its children's\n // transformation matrices.\n this.annotationLayer.update({\n viewport: viewport.clone({ dontFlip: true }),\n });\n return;\n }\n\n const [annotations, hasJSActions, fieldObjects] = await Promise.all([\n this.pdfPage.getAnnotations({ intent }),\n this._hasJSActionsPromise,\n this._fieldObjectsPromise,\n ]);\n if (this._cancelled) {\n return;\n }\n\n // Create an annotation layer div and render the annotations\n // if there is at least one annotation.\n const div = (this.div = document.createElement(\"div\"));\n div.className = \"annotationLayer\";\n this.#onAppend?.(div);\n\n if (annotations.length === 0) {\n this.#annotations = annotations;\n\n this.hide(/* internal = */ true);\n return;\n }\n\n this.#initAnnotationLayer(viewport, structTreeLayer);\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 this.#annotations = annotations;\n\n // Ensure that interactive form elements in the annotationLayer are\n // disabled while PresentationMode is active (see issue 12232).\n if (this.linkService.isInPresentationMode) {\n this.#updatePresentationModeState(PresentationModeState.FULLSCREEN);\n }\n if (!this.#eventAbortController) {\n this.#eventAbortController = new AbortController();\n\n this._eventBus?._on(\n \"presentationmodechanged\",\n evt => {\n this.#updatePresentationModeState(evt.state);\n },\n { signal: this.#eventAbortController.signal }\n );\n }\n }\n\n #initAnnotationLayer(viewport, structTreeLayer) {\n this.annotationLayer = new AnnotationLayer({\n div: this.div,\n accessibilityManager: this._accessibilityManager,\n annotationCanvasMap: this._annotationCanvasMap,\n annotationEditorUIManager: this._annotationEditorUIManager,\n page: this.pdfPage,\n viewport: viewport.clone({ dontFlip: true }),\n structTreeLayer,\n });\n }\n\n cancel() {\n this._cancelled = true;\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n }\n\n hide(internal = false) {\n this.#externalHide = !internal;\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n\n hasEditableAnnotations() {\n return !!this.annotationLayer?.hasEditableAnnotations();\n }\n\n /**\n * @param {InjectLinkAnnotationsOptions} options\n * @returns {Promise} A promise that is resolved when the inferred links\n * are added to the annotation layer.\n */\n async injectLinkAnnotations({\n inferredLinks,\n viewport,\n structTreeLayer = null,\n }) {\n if (this.#annotations === null) {\n throw new Error(\n \"`render` method must be called before `injectLinkAnnotations`.\"\n );\n }\n if (this._cancelled || this.#linksInjected) {\n return;\n }\n this.#linksInjected = true;\n\n const newLinks = this.#annotations.length\n ? this.#checkInferredLinks(inferredLinks)\n : inferredLinks;\n\n if (!newLinks.length) {\n return;\n }\n\n if (!this.annotationLayer) {\n this.#initAnnotationLayer(viewport, structTreeLayer);\n setLayerDimensions(this.div, viewport);\n }\n\n await this.annotationLayer.addLinkAnnotations(newLinks, this.linkService);\n // Don't show the annotation layer if it was explicitly hidden previously.\n if (!this.#externalHide) {\n this.div.hidden = false;\n }\n }\n\n #updatePresentationModeState(state) {\n if (!this.div) {\n return;\n }\n let disableFormElements = false;\n\n switch (state) {\n case PresentationModeState.FULLSCREEN:\n disableFormElements = true;\n break;\n case PresentationModeState.NORMAL:\n break;\n default:\n return;\n }\n for (const section of this.div.childNodes) {\n if (section.hasAttribute(\"data-internal-link\")) {\n continue;\n }\n section.inert = disableFormElements;\n }\n }\n\n #checkInferredLinks(inferredLinks) {\n function annotationRects(annot) {\n if (!annot.quadPoints) {\n return [annot.rect];\n }\n const rects = [];\n for (let i = 2, ii = annot.quadPoints.length; i < ii; i += 8) {\n const trX = annot.quadPoints[i];\n const trY = annot.quadPoints[i + 1];\n const blX = annot.quadPoints[i + 2];\n const blY = annot.quadPoints[i + 3];\n rects.push([blX, blY, trX, trY]);\n }\n return rects;\n }\n\n function intersectAnnotations(annot1, annot2) {\n const intersections = [];\n const annot1Rects = annotationRects(annot1);\n const annot2Rects = annotationRects(annot2);\n for (const rect1 of annot1Rects) {\n for (const rect2 of annot2Rects) {\n const intersection = Util.intersect(rect1, rect2);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n }\n return intersections;\n }\n\n function areaRects(rects) {\n let totalArea = 0;\n for (const rect of rects) {\n totalArea += Math.abs((rect[2] - rect[0]) * (rect[3] - rect[1]));\n }\n return totalArea;\n }\n\n return inferredLinks.filter(link => {\n let linkAreaRects;\n\n for (const annotation of this.#annotations) {\n if (\n annotation.annotationType !== AnnotationType.LINK ||\n !annotation.url\n ) {\n continue;\n }\n // TODO: Add a test case to verify that we can find the intersection\n // between two annotations with quadPoints properly.\n const intersections = intersectAnnotations(annotation, link);\n\n if (intersections.length === 0) {\n continue;\n }\n linkAreaRects ??= areaRects(annotationRects(link));\n\n if (\n areaRects(intersections) / linkAreaRects >\n 0.5 /* If the overlap is more than 50%. */\n ) {\n return false;\n }\n }\n return true;\n });\n }\n}\n\nexport { AnnotationLayerBuilder };\n","/* Copyright 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 // 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 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(data, url, filename) {\n let blobUrl;\n if (data) {\n blobUrl = URL.createObjectURL(\n new Blob([data], { type: \"application/pdf\" })\n );\n } else {\n if (!createValidAbsoluteUrl(url, \"http://example.com\")) {\n console.error(`download - not a valid URL: ${url}`);\n return;\n }\n blobUrl = url + \"#pdfjs.action=download\";\n }\n download(blobUrl, filename);\n }\n}\n\nexport { DownloadManager };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst WaitOnType = {\n EVENT: \"event\",\n TIMEOUT: \"timeout\",\n};\n\n/**\n * @typedef {Object} WaitOnEventOrTimeoutParameters\n * @property {Object} target - The event target, can for example be:\n * `window`, `document`, a DOM element, or an {EventBus} instance.\n * @property {string} name - The name of the event.\n * @property {number} delay - The delay, in milliseconds, after which the\n * timeout occurs (if the event wasn't already dispatched).\n */\n\n/**\n * Allows waiting for an event or a timeout, whichever occurs first.\n * Can be used to ensure that an action always occurs, even when an event\n * arrives late or not at all.\n *\n * @param {WaitOnEventOrTimeoutParameters}\n * @returns {Promise} A promise that is resolved with a {WaitOnType} value.\n */\nasync function waitOnEventOrTimeout({ target, name, delay = 0 }) {\n if (\n typeof target !== \"object\" ||\n !(name && typeof name === \"string\") ||\n !(Number.isInteger(delay) && delay >= 0)\n ) {\n throw new Error(\"waitOnEventOrTimeout - invalid parameters.\");\n }\n const { promise, resolve } = Promise.withResolvers();\n const ac = new AbortController();\n\n function handler(type) {\n ac.abort(); // Remove event listener.\n clearTimeout(timeout);\n\n resolve(type);\n }\n\n const evtMethod = target instanceof EventBus ? \"_on\" : \"addEventListener\";\n target[evtMethod](name, handler.bind(null, WaitOnType.EVENT), {\n signal: ac.signal,\n });\n\n const timeout = setTimeout(handler.bind(null, WaitOnType.TIMEOUT), delay);\n\n return promise;\n}\n\n/**\n * Simple event bus for an application. Listeners are attached using the `on`\n * and `off` methods. To raise an event, the `dispatch` method shall be used.\n */\nclass EventBus {\n #listeners = Object.create(null);\n\n /**\n * @param {string} eventName\n * @param {function} listener\n * @param {Object} [options]\n */\n on(eventName, listener, options = null) {\n this._on(eventName, listener, {\n external: true,\n once: options?.once,\n signal: options?.signal,\n });\n }\n\n /**\n * @param {string} eventName\n * @param {function} listener\n * @param {Object} [options]\n */\n off(eventName, listener, options = null) {\n this._off(eventName, listener);\n }\n\n /**\n * @param {string} eventName\n * @param {Object} data\n */\n dispatch(eventName, data) {\n const eventListeners = this.#listeners[eventName];\n if (!eventListeners || eventListeners.length === 0) {\n return;\n }\n let externalListeners;\n // Making copy of the listeners array in case if it will be modified\n // during dispatch.\n for (const { listener, external, once } of eventListeners.slice(0)) {\n if (once) {\n this._off(eventName, listener);\n }\n if (external) {\n (externalListeners ||= []).push(listener);\n continue;\n }\n listener(data);\n }\n // Dispatch any \"external\" listeners *after* the internal ones, to give the\n // viewer components time to handle events and update their state first.\n if (externalListeners) {\n for (const listener of externalListeners) {\n listener(data);\n }\n externalListeners = null;\n }\n }\n\n /**\n * @ignore\n */\n _on(eventName, listener, options = null) {\n let rmAbort = null;\n if (options?.signal instanceof AbortSignal) {\n const { signal } = options;\n if (signal.aborted) {\n console.error(\"Cannot use an `aborted` signal.\");\n return;\n }\n const onAbort = () => this._off(eventName, listener);\n rmAbort = () => signal.removeEventListener(\"abort\", onAbort);\n\n signal.addEventListener(\"abort\", onAbort);\n }\n\n const eventListeners = (this.#listeners[eventName] ||= []);\n eventListeners.push({\n listener,\n external: options?.external === true,\n once: options?.once === true,\n rmAbort,\n });\n }\n\n /**\n * @ignore\n */\n _off(eventName, listener, options = null) {\n const eventListeners = this.#listeners[eventName];\n if (!eventListeners) {\n return;\n }\n for (let i = 0, ii = eventListeners.length; i < ii; i++) {\n const evt = eventListeners[i];\n if (evt.listener === listener) {\n evt.rmAbort?.(); // Ensure that the `AbortSignal` listener is removed.\n eventListeners.splice(i, 1);\n return;\n }\n }\n }\n}\n\n/**\n * NOTE: Only used in the Firefox built-in pdf viewer.\n */\nclass FirefoxEventBus extends EventBus {\n #externalServices;\n\n #globalEventNames;\n\n #isInAutomation;\n\n constructor(globalEventNames, externalServices, isInAutomation) {\n super();\n this.#globalEventNames = globalEventNames;\n this.#externalServices = externalServices;\n this.#isInAutomation = isInAutomation;\n }\n\n dispatch(eventName, data) {\n if (typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\")) {\n throw new Error(\"Not implemented: FirefoxEventBus.dispatch\");\n }\n super.dispatch(eventName, data);\n\n if (this.#isInAutomation) {\n const detail = Object.create(null);\n if (data) {\n for (const key in data) {\n const value = data[key];\n if (key === \"source\") {\n if (value === window || value === document) {\n return; // No need to re-dispatch (already) global events.\n }\n continue; // Ignore the `source` property.\n }\n detail[key] = value;\n }\n }\n const event = new CustomEvent(eventName, {\n bubbles: true,\n cancelable: true,\n detail,\n });\n document.dispatchEvent(event);\n }\n\n if (this.#globalEventNames?.has(eventName)) {\n this.#externalServices.dispatchGlobalEvent({\n eventName,\n detail: data,\n });\n }\n }\n}\n\nexport { EventBus, FirefoxEventBus, waitOnEventOrTimeout, WaitOnType };\n","/**\n * The `FluentType` class is the base of Fluent's type system.\n *\n * Fluent types wrap JavaScript values and store additional configuration for\n * them, which can then be used in the `toString` method together with a proper\n * `Intl` formatter.\n */\nexport class FluentType {\n /**\n * Create a `FluentType` instance.\n *\n * @param value The JavaScript value to wrap.\n */\n constructor(value) {\n this.value = value;\n }\n /**\n * Unwrap the raw value stored by this `FluentType`.\n */\n valueOf() {\n return this.value;\n }\n}\n/**\n * A {@link FluentType} representing no correct value.\n */\nexport class FluentNone extends FluentType {\n /**\n * Create an instance of `FluentNone` with an optional fallback value.\n * @param value The fallback value of this `FluentNone`.\n */\n constructor(value = \"???\") {\n super(value);\n }\n /**\n * Format this `FluentNone` to the fallback string.\n */\n toString(scope) {\n return `{${this.value}}`;\n }\n}\n/**\n * A {@link FluentType} representing a number.\n *\n * A `FluentNumber` instance stores the number value of the number it\n * represents. It may also store an option bag of options which will be passed\n * to `Intl.NumerFormat` when the `FluentNumber` is formatted to a string.\n */\nexport class FluentNumber extends FluentType {\n /**\n * Create an instance of `FluentNumber` with options to the\n * `Intl.NumberFormat` constructor.\n *\n * @param value The number value of this `FluentNumber`.\n * @param opts Options which will be passed to `Intl.NumberFormat`.\n */\n constructor(value, opts = {}) {\n super(value);\n this.opts = opts;\n }\n /**\n * Format this `FluentNumber` to a string.\n */\n toString(scope) {\n if (scope) {\n try {\n const nf = scope.memoizeIntlObject(Intl.NumberFormat, this.opts);\n return nf.format(this.value);\n }\n catch (err) {\n scope.reportError(err);\n }\n }\n return this.value.toString(10);\n }\n}\n/**\n * A {@link FluentType} representing a date and time.\n *\n * A `FluentDateTime` instance stores a Date object, Temporal object, or a number\n * as a numerical timestamp in milliseconds. It may also store an\n * option bag of options which will be passed to `Intl.DateTimeFormat` when the\n * `FluentDateTime` is formatted to a string.\n */\nexport class FluentDateTime extends FluentType {\n static supportsValue(value) {\n if (typeof value === \"number\")\n return true;\n if (value instanceof Date)\n return true;\n if (value instanceof FluentType)\n return FluentDateTime.supportsValue(value.valueOf());\n // Temporary workaround to support environments without Temporal\n if (\"Temporal\" in globalThis) {\n // for TypeScript, which doesn't know about Temporal yet\n const _Temporal = globalThis.Temporal;\n if (value instanceof _Temporal.Instant ||\n value instanceof _Temporal.PlainDateTime ||\n value instanceof _Temporal.PlainDate ||\n value instanceof _Temporal.PlainMonthDay ||\n value instanceof _Temporal.PlainTime ||\n value instanceof _Temporal.PlainYearMonth) {\n return true;\n }\n }\n return false;\n }\n /**\n * Create an instance of `FluentDateTime` with options to the\n * `Intl.DateTimeFormat` constructor.\n *\n * @param value The number value of this `FluentDateTime`, in milliseconds.\n * @param opts Options which will be passed to `Intl.DateTimeFormat`.\n */\n constructor(value, opts = {}) {\n // unwrap any FluentType value, but only retain the opts from FluentDateTime\n if (value instanceof FluentDateTime) {\n opts = { ...value.opts, ...opts };\n value = value.value;\n }\n else if (value instanceof FluentType) {\n value = value.valueOf();\n }\n // Intl.DateTimeFormat defaults to gregorian calendar, but Temporal defaults to iso8601\n if (typeof value === \"object\" &&\n \"calendarId\" in value &&\n opts.calendar === undefined) {\n opts = { ...opts, calendar: value.calendarId };\n }\n super(value);\n this.opts = opts;\n }\n [Symbol.toPrimitive](hint) {\n return hint === \"string\" ? this.toString() : this.toNumber();\n }\n /**\n * Convert this `FluentDateTime` to a number.\n * Note that this isn't always possible due to the nature of Temporal objects.\n * In such cases, a TypeError will be thrown.\n */\n toNumber() {\n const value = this.value;\n if (typeof value === \"number\")\n return value;\n if (value instanceof Date)\n return value.getTime();\n if (\"epochMilliseconds\" in value) {\n return value.epochMilliseconds;\n }\n if (\"toZonedDateTime\" in value) {\n return value.toZonedDateTime(\"UTC\").epochMilliseconds;\n }\n throw new TypeError(\"Unwrapping a non-number value as a number\");\n }\n /**\n * Format this `FluentDateTime` to a string.\n */\n toString(scope) {\n if (scope) {\n try {\n const dtf = scope.memoizeIntlObject(Intl.DateTimeFormat, this.opts);\n return dtf.format(this.value);\n }\n catch (err) {\n scope.reportError(err);\n }\n }\n if (typeof this.value === \"number\" || this.value instanceof Date) {\n return new Date(this.value).toISOString();\n }\n return this.value.toString();\n }\n}\n","/**\n * The role of the Fluent resolver is to format a `Pattern` to an instance of\n * `FluentValue`. For performance reasons, primitive strings are considered\n * such instances, too.\n *\n * Translations can contain references to other messages or variables,\n * conditional logic in form of select expressions, traits which describe their\n * grammatical features, and can use Fluent builtins which make use of the\n * `Intl` formatters to format numbers and dates into the bundle's languages.\n * See the documentation of the Fluent syntax for more information.\n *\n * In case of errors the resolver will try to salvage as much of the\n * translation as possible. In rare situations where the resolver didn't know\n * how to recover from an error it will return an instance of `FluentNone`.\n *\n * All expressions resolve to an instance of `FluentValue`. The caller should\n * use the `toString` method to convert the instance to a native value.\n *\n * Functions in this file pass around an instance of the `Scope` class, which\n * stores the data required for successful resolution and error recovery.\n */\nimport { FluentType, FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\n/**\n * The maximum number of placeables which can be expanded in a single call to\n * `formatPattern`. The limit protects against the Billion Laughs and Quadratic\n * Blowup attacks. See https://msdn.microsoft.com/en-us/magazine/ee335713.aspx.\n */\nconst MAX_PLACEABLES = 100;\n/** Unicode bidi isolation characters. */\nconst FSI = \"\\u2068\";\nconst PDI = \"\\u2069\";\n/** Helper: match a variant key to the given selector. */\nfunction match(scope, selector, key) {\n if (key === selector) {\n // Both are strings.\n return true;\n }\n // XXX Consider comparing options too, e.g. minimumFractionDigits.\n if (key instanceof FluentNumber &&\n selector instanceof FluentNumber &&\n key.value === selector.value) {\n return true;\n }\n if (selector instanceof FluentNumber && typeof key === \"string\") {\n let category = scope\n .memoizeIntlObject(Intl.PluralRules, selector.opts)\n .select(selector.value);\n if (key === category) {\n return true;\n }\n }\n return false;\n}\n/** Helper: resolve the default variant from a list of variants. */\nfunction getDefault(scope, variants, star) {\n if (variants[star]) {\n return resolvePattern(scope, variants[star].value);\n }\n scope.reportError(new RangeError(\"No default\"));\n return new FluentNone();\n}\n/** Helper: resolve arguments to a call expression. */\nfunction getArguments(scope, args) {\n const positional = [];\n const named = Object.create(null);\n for (const arg of args) {\n if (arg.type === \"narg\") {\n named[arg.name] = resolveExpression(scope, arg.value);\n }\n else {\n positional.push(resolveExpression(scope, arg));\n }\n }\n return { positional, named };\n}\n/** Resolve an expression to a Fluent type. */\nfunction resolveExpression(scope, expr) {\n switch (expr.type) {\n case \"str\":\n return expr.value;\n case \"num\":\n return new FluentNumber(expr.value, {\n minimumFractionDigits: expr.precision,\n });\n case \"var\":\n return resolveVariableReference(scope, expr);\n case \"mesg\":\n return resolveMessageReference(scope, expr);\n case \"term\":\n return resolveTermReference(scope, expr);\n case \"func\":\n return resolveFunctionReference(scope, expr);\n case \"select\":\n return resolveSelectExpression(scope, expr);\n default:\n return new FluentNone();\n }\n}\n/** Resolve a reference to a variable. */\nfunction resolveVariableReference(scope, { name }) {\n let arg;\n if (scope.params) {\n // We're inside a TermReference. It's OK to reference undefined parameters.\n if (Object.prototype.hasOwnProperty.call(scope.params, name)) {\n arg = scope.params[name];\n }\n else {\n return new FluentNone(`$${name}`);\n }\n }\n else if (scope.args &&\n Object.prototype.hasOwnProperty.call(scope.args, name)) {\n // We're in the top-level Pattern or inside a MessageReference. Missing\n // variables references produce ReferenceErrors.\n arg = scope.args[name];\n }\n else {\n scope.reportError(new ReferenceError(`Unknown variable: $${name}`));\n return new FluentNone(`$${name}`);\n }\n // Return early if the argument already is an instance of FluentType.\n if (arg instanceof FluentType) {\n return arg;\n }\n // Convert the argument to a Fluent type.\n switch (typeof arg) {\n case \"string\":\n return arg;\n case \"number\":\n return new FluentNumber(arg);\n case \"object\":\n if (FluentDateTime.supportsValue(arg)) {\n return new FluentDateTime(arg);\n }\n // eslint-disable-next-line no-fallthrough\n default:\n scope.reportError(new TypeError(`Variable type not supported: $${name}, ${typeof arg}`));\n return new FluentNone(`$${name}`);\n }\n}\n/** Resolve a reference to another message. */\nfunction resolveMessageReference(scope, { name, attr }) {\n const message = scope.bundle._messages.get(name);\n if (!message) {\n scope.reportError(new ReferenceError(`Unknown message: ${name}`));\n return new FluentNone(name);\n }\n if (attr) {\n const attribute = message.attributes[attr];\n if (attribute) {\n return resolvePattern(scope, attribute);\n }\n scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));\n return new FluentNone(`${name}.${attr}`);\n }\n if (message.value) {\n return resolvePattern(scope, message.value);\n }\n scope.reportError(new ReferenceError(`No value: ${name}`));\n return new FluentNone(name);\n}\n/** Resolve a call to a Term with key-value arguments. */\nfunction resolveTermReference(scope, { name, attr, args }) {\n const id = `-${name}`;\n const term = scope.bundle._terms.get(id);\n if (!term) {\n scope.reportError(new ReferenceError(`Unknown term: ${id}`));\n return new FluentNone(id);\n }\n if (attr) {\n const attribute = term.attributes[attr];\n if (attribute) {\n // Every TermReference has its own variables.\n scope.params = getArguments(scope, args).named;\n const resolved = resolvePattern(scope, attribute);\n scope.params = null;\n return resolved;\n }\n scope.reportError(new ReferenceError(`Unknown attribute: ${attr}`));\n return new FluentNone(`${id}.${attr}`);\n }\n scope.params = getArguments(scope, args).named;\n const resolved = resolvePattern(scope, term.value);\n scope.params = null;\n return resolved;\n}\n/** Resolve a call to a Function with positional and key-value arguments. */\nfunction resolveFunctionReference(scope, { name, args }) {\n // Some functions are built-in. Others may be provided by the runtime via\n // the `FluentBundle` constructor.\n let func = scope.bundle._functions[name];\n if (!func) {\n scope.reportError(new ReferenceError(`Unknown function: ${name}()`));\n return new FluentNone(`${name}()`);\n }\n if (typeof func !== \"function\") {\n scope.reportError(new TypeError(`Function ${name}() is not callable`));\n return new FluentNone(`${name}()`);\n }\n try {\n let resolved = getArguments(scope, args);\n return func(resolved.positional, resolved.named);\n }\n catch (err) {\n scope.reportError(err);\n return new FluentNone(`${name}()`);\n }\n}\n/** Resolve a select expression to the member object. */\nfunction resolveSelectExpression(scope, { selector, variants, star }) {\n let sel = resolveExpression(scope, selector);\n if (sel instanceof FluentNone) {\n return getDefault(scope, variants, star);\n }\n // Match the selector against keys of each variant, in order.\n for (const variant of variants) {\n const key = resolveExpression(scope, variant.key);\n if (match(scope, sel, key)) {\n return resolvePattern(scope, variant.value);\n }\n }\n return getDefault(scope, variants, star);\n}\n/** Resolve a pattern (a complex string with placeables). */\nexport function resolveComplexPattern(scope, ptn) {\n if (scope.dirty.has(ptn)) {\n scope.reportError(new RangeError(\"Cyclic reference\"));\n return new FluentNone();\n }\n // Tag the pattern as dirty for the purpose of the current resolution.\n scope.dirty.add(ptn);\n const result = [];\n // Wrap interpolations with Directional Isolate Formatting characters\n // only when the pattern has more than one element.\n const useIsolating = scope.bundle._useIsolating && ptn.length > 1;\n for (const elem of ptn) {\n if (typeof elem === \"string\") {\n result.push(scope.bundle._transform(elem));\n continue;\n }\n scope.placeables++;\n if (scope.placeables > MAX_PLACEABLES) {\n scope.dirty.delete(ptn);\n // This is a fatal error which causes the resolver to instantly bail out\n // on this pattern. The length check protects against excessive memory\n // usage, and throwing protects against eating up the CPU when long\n // placeables are deeply nested.\n throw new RangeError(`Too many placeables expanded: ${scope.placeables}, ` +\n `max allowed is ${MAX_PLACEABLES}`);\n }\n if (useIsolating) {\n result.push(FSI);\n }\n result.push(resolveExpression(scope, elem).toString(scope));\n if (useIsolating) {\n result.push(PDI);\n }\n }\n scope.dirty.delete(ptn);\n return result.join(\"\");\n}\n/**\n * Resolve a simple or a complex Pattern to a FluentString\n * (which is really the string primitive).\n */\nfunction resolvePattern(scope, value) {\n // Resolve a simple pattern.\n if (typeof value === \"string\") {\n return scope.bundle._transform(value);\n }\n return resolveComplexPattern(scope, value);\n}\n","export class Scope {\n constructor(bundle, errors, args) {\n /**\n * The Set of patterns already encountered during this resolution.\n * Used to detect and prevent cyclic resolutions.\n * @ignore\n */\n this.dirty = new WeakSet();\n /** A dict of parameters passed to a TermReference. */\n this.params = null;\n /**\n * The running count of placeables resolved so far.\n * Used to detect the Billion Laughs and Quadratic Blowup attacks.\n * @ignore\n */\n this.placeables = 0;\n this.bundle = bundle;\n this.errors = errors;\n this.args = args;\n }\n reportError(error) {\n if (!this.errors || !(error instanceof Error)) {\n throw error;\n }\n this.errors.push(error);\n }\n memoizeIntlObject(ctor, opts) {\n let cache = this.bundle._intls.get(ctor);\n if (!cache) {\n cache = {};\n this.bundle._intls.set(ctor, cache);\n }\n let id = JSON.stringify(opts);\n if (!cache[id]) {\n // @ts-expect-error This is fine.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n cache[id] = new ctor(this.bundle.locales, opts);\n }\n return cache[id];\n }\n}\n","/**\n * @overview\n *\n * The FTL resolver ships with a number of functions built-in.\n *\n * Each function take two arguments:\n * - args - an array of positional args\n * - opts - an object of key-value args\n *\n * Arguments to functions are guaranteed to already be instances of\n * `FluentValue`. Functions must return `FluentValues` as well.\n */\nimport { FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\nfunction values(opts, allowed) {\n const unwrapped = Object.create(null);\n for (const [name, opt] of Object.entries(opts)) {\n if (allowed.includes(name)) {\n unwrapped[name] = opt.valueOf();\n }\n }\n return unwrapped;\n}\nconst NUMBER_ALLOWED = [\n \"unitDisplay\",\n \"currencyDisplay\",\n \"useGrouping\",\n \"minimumIntegerDigits\",\n \"minimumFractionDigits\",\n \"maximumFractionDigits\",\n \"minimumSignificantDigits\",\n \"maximumSignificantDigits\",\n];\n/**\n * The implementation of the `NUMBER()` builtin available to translations.\n *\n * Translations may call the `NUMBER()` builtin in order to specify formatting\n * options of a number. For example:\n *\n * pi = The value of π is {NUMBER($pi, maximumFractionDigits: 2)}.\n *\n * The implementation expects an array of {@link FluentValue | FluentValues} representing the\n * positional arguments, and an object of named {@link FluentValue | FluentValues} representing the\n * named parameters.\n *\n * The following options are recognized:\n *\n * unitDisplay\n * currencyDisplay\n * useGrouping\n * minimumIntegerDigits\n * minimumFractionDigits\n * maximumFractionDigits\n * minimumSignificantDigits\n * maximumSignificantDigits\n *\n * Other options are ignored.\n *\n * @param args The positional arguments passed to this `NUMBER()`.\n * @param opts The named argments passed to this `NUMBER()`.\n */\nexport function NUMBER(args, opts) {\n let arg = args[0];\n if (arg instanceof FluentNone) {\n return new FluentNone(`NUMBER(${arg.valueOf()})`);\n }\n if (arg instanceof FluentNumber) {\n return new FluentNumber(arg.valueOf(), {\n ...arg.opts,\n ...values(opts, NUMBER_ALLOWED),\n });\n }\n if (arg instanceof FluentDateTime) {\n return new FluentNumber(arg.toNumber(), {\n ...values(opts, NUMBER_ALLOWED),\n });\n }\n throw new TypeError(\"Invalid argument to NUMBER\");\n}\nconst DATETIME_ALLOWED = [\n \"dateStyle\",\n \"timeStyle\",\n \"fractionalSecondDigits\",\n \"dayPeriod\",\n \"hour12\",\n \"weekday\",\n \"era\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"timeZoneName\",\n];\n/**\n * The implementation of the `DATETIME()` builtin available to translations.\n *\n * Translations may call the `DATETIME()` builtin in order to specify\n * formatting options of a number. For example:\n *\n * now = It's {DATETIME($today, month: \"long\")}.\n *\n * The implementation expects an array of {@link FluentValue | FluentValues} representing the\n * positional arguments, and an object of named {@link FluentValue | FluentValues} representing the\n * named parameters.\n *\n * The following options are recognized:\n *\n * dateStyle\n * timeStyle\n * fractionalSecondDigits\n * dayPeriod\n * hour12\n * weekday\n * era\n * year\n * month\n * day\n * hour\n * minute\n * second\n * timeZoneName\n *\n * Other options are ignored.\n *\n * @param args The positional arguments passed to this `DATETIME()`.\n * @param opts The named argments passed to this `DATETIME()`.\n */\nexport function DATETIME(args, opts) {\n let arg = args[0];\n if (arg instanceof FluentNone) {\n return new FluentNone(`DATETIME(${arg.valueOf()})`);\n }\n if (arg instanceof FluentDateTime || arg instanceof FluentNumber) {\n return new FluentDateTime(arg, values(opts, DATETIME_ALLOWED));\n }\n throw new TypeError(\"Invalid argument to DATETIME\");\n}\n","const cache = new Map();\nexport function getMemoizerForLocale(locales) {\n const stringLocale = Array.isArray(locales) ? locales.join(\" \") : locales;\n let memoizer = cache.get(stringLocale);\n if (memoizer === undefined) {\n memoizer = new Map();\n cache.set(stringLocale, memoizer);\n }\n return memoizer;\n}\n","import { resolveComplexPattern } from \"./resolver.js\";\nimport { Scope } from \"./scope.js\";\nimport { FluentNone } from \"./types.js\";\nimport { NUMBER, DATETIME } from \"./builtins.js\";\nimport { getMemoizerForLocale } from \"./memoizer.js\";\n/**\n * Message bundles are single-language stores of translation resources. They are\n * responsible for formatting message values and attributes to strings.\n */\nexport class FluentBundle {\n /**\n * Create an instance of `FluentBundle`.\n *\n * @example\n * ```js\n * let bundle = new FluentBundle([\"en-US\", \"en\"]);\n *\n * let bundle = new FluentBundle(locales, {useIsolating: false});\n *\n * let bundle = new FluentBundle(locales, {\n * useIsolating: true,\n * functions: {\n * NODE_ENV: () => process.env.NODE_ENV\n * }\n * });\n * ```\n *\n * @param locales - Used to instantiate `Intl` formatters used by translations.\n * @param options - Optional configuration for the bundle.\n */\n constructor(locales, { functions, useIsolating = true, transform = (v) => v, } = {}) {\n /** @ignore */\n this._terms = new Map();\n /** @ignore */\n this._messages = new Map();\n this.locales = Array.isArray(locales) ? locales : [locales];\n this._functions = {\n NUMBER,\n DATETIME,\n ...functions,\n };\n this._useIsolating = useIsolating;\n this._transform = transform;\n this._intls = getMemoizerForLocale(locales);\n }\n /**\n * Check if a message is present in the bundle.\n *\n * @param id - The identifier of the message to check.\n */\n hasMessage(id) {\n return this._messages.has(id);\n }\n /**\n * Return a raw unformatted message object from the bundle.\n *\n * Raw messages are `{value, attributes}` shapes containing translation units\n * called `Patterns`. `Patterns` are implementation-specific; they should be\n * treated as black boxes and formatted with `FluentBundle.formatPattern`.\n *\n * @param id - The identifier of the message to check.\n */\n getMessage(id) {\n return this._messages.get(id);\n }\n /**\n * Add a translation resource to the bundle.\n *\n * @example\n * ```js\n * let res = new FluentResource(\"foo = Foo\");\n * bundle.addResource(res);\n * bundle.getMessage(\"foo\");\n * // → {value: .., attributes: {..}}\n * ```\n *\n * @param res\n * @param options\n */\n addResource(res, { allowOverrides = false, } = {}) {\n const errors = [];\n for (let i = 0; i < res.body.length; i++) {\n let entry = res.body[i];\n if (entry.id.startsWith(\"-\")) {\n // Identifiers starting with a dash (-) define terms. Terms are private\n // and cannot be retrieved from FluentBundle.\n if (allowOverrides === false && this._terms.has(entry.id)) {\n errors.push(new Error(`Attempt to override an existing term: \"${entry.id}\"`));\n continue;\n }\n this._terms.set(entry.id, entry);\n }\n else {\n if (allowOverrides === false && this._messages.has(entry.id)) {\n errors.push(new Error(`Attempt to override an existing message: \"${entry.id}\"`));\n continue;\n }\n this._messages.set(entry.id, entry);\n }\n }\n return errors;\n }\n /**\n * Format a `Pattern` to a string.\n *\n * Format a raw `Pattern` into a string. `args` will be used to resolve\n * references to variables passed as arguments to the translation.\n *\n * In case of errors `formatPattern` will try to salvage as much of the\n * translation as possible and will still return a string. For performance\n * reasons, the encountered errors are not returned but instead are appended\n * to the `errors` array passed as the third argument.\n *\n * If `errors` is omitted, the first encountered error will be thrown.\n *\n * @example\n * ```js\n * let errors = [];\n * bundle.addResource(\n * new FluentResource(\"hello = Hello, {$name}!\"));\n *\n * let hello = bundle.getMessage(\"hello\");\n * if (hello.value) {\n * bundle.formatPattern(hello.value, {name: \"Jane\"}, errors);\n * // Returns \"Hello, Jane!\" and `errors` is empty.\n *\n * bundle.formatPattern(hello.value, undefined, errors);\n * // Returns \"Hello, {$name}!\" and `errors` is now:\n * // []\n * }\n * ```\n */\n formatPattern(pattern, args = null, errors = null) {\n // Resolve a simple pattern without creating a scope. No error handling is\n // required; by definition simple patterns don't have placeables.\n if (typeof pattern === \"string\") {\n return this._transform(pattern);\n }\n // Resolve a complex pattern.\n let scope = new Scope(this, errors, args);\n try {\n let value = resolveComplexPattern(scope, pattern);\n return value.toString(scope);\n }\n catch (err) {\n if (scope.errors && err instanceof Error) {\n scope.errors.push(err);\n return new FluentNone().toString(scope);\n }\n throw err;\n }\n }\n}\n","// This regex is used to iterate through the beginnings of messages and terms.\n// With the /m flag, the ^ matches at the beginning of every line.\nconst RE_MESSAGE_START = /^(-?[a-zA-Z][\\w-]*) *= */gm;\n// Both Attributes and Variants are parsed in while loops. These regexes are\n// used to break out of them.\nconst RE_ATTRIBUTE_START = /\\.([a-zA-Z][\\w-]*) *= */y;\nconst RE_VARIANT_START = /\\*?\\[/y;\nconst RE_NUMBER_LITERAL = /(-?[0-9]+(?:\\.([0-9]+))?)/y;\nconst RE_IDENTIFIER = /([a-zA-Z][\\w-]*)/y;\nconst RE_REFERENCE = /([$-])?([a-zA-Z][\\w-]*)(?:\\.([a-zA-Z][\\w-]*))?/y;\nconst RE_FUNCTION_NAME = /^[A-Z][A-Z0-9_-]*$/;\n// A \"run\" is a sequence of text or string literal characters which don't\n// require any special handling. For TextElements such special characters are: {\n// (starts a placeable), and line breaks which require additional logic to check\n// if the next line is indented. For StringLiterals they are: \\ (starts an\n// escape sequence), \" (ends the literal), and line breaks which are not allowed\n// in StringLiterals. Note that string runs may be empty; text runs may not.\nconst RE_TEXT_RUN = /([^{}\\n\\r]+)/y;\nconst RE_STRING_RUN = /([^\\\\\"\\n\\r]*)/y;\n// Escape sequences.\nconst RE_STRING_ESCAPE = /\\\\([\\\\\"])/y;\nconst RE_UNICODE_ESCAPE = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{6})/y;\n// Used for trimming TextElements and indents.\nconst RE_LEADING_NEWLINES = /^\\n+/;\nconst RE_TRAILING_SPACES = / +$/;\n// Used in makeIndent to strip spaces from blank lines and normalize CRLF to LF.\nconst RE_BLANK_LINES = / *\\r?\\n/g;\n// Used in makeIndent to measure the indentation.\nconst RE_INDENT = /( *)$/;\n// Common tokens.\nconst TOKEN_BRACE_OPEN = /{\\s*/y;\nconst TOKEN_BRACE_CLOSE = /\\s*}/y;\nconst TOKEN_BRACKET_OPEN = /\\[\\s*/y;\nconst TOKEN_BRACKET_CLOSE = /\\s*] */y;\nconst TOKEN_PAREN_OPEN = /\\s*\\(\\s*/y;\nconst TOKEN_ARROW = /\\s*->\\s*/y;\nconst TOKEN_COLON = /\\s*:\\s*/y;\n// Note the optional comma. As a deviation from the Fluent EBNF, the parser\n// doesn't enforce commas between call arguments.\nconst TOKEN_COMMA = /\\s*,?\\s*/y;\nconst TOKEN_BLANK = /\\s+/y;\n/**\n * Fluent Resource is a structure storing parsed localization entries.\n */\nexport class FluentResource {\n constructor(source) {\n this.body = [];\n RE_MESSAGE_START.lastIndex = 0;\n let cursor = 0;\n // Iterate over the beginnings of messages and terms to efficiently skip\n // comments and recover from errors.\n while (true) {\n let next = RE_MESSAGE_START.exec(source);\n if (next === null) {\n break;\n }\n cursor = RE_MESSAGE_START.lastIndex;\n try {\n this.body.push(parseMessage(next[1]));\n }\n catch (err) {\n if (err instanceof SyntaxError) {\n // Don't report any Fluent syntax errors. Skip directly to the\n // beginning of the next message or term.\n continue;\n }\n throw err;\n }\n }\n // The parser implementation is inlined below for performance reasons,\n // as well as for convenience of accessing `source` and `cursor`.\n // The parser focuses on minimizing the number of false negatives at the\n // expense of increasing the risk of false positives. In other words, it\n // aims at parsing valid Fluent messages with a success rate of 100%, but it\n // may also parse a few invalid messages which the reference parser would\n // reject. The parser doesn't perform any validation and may produce entries\n // which wouldn't make sense in the real world. For best results users are\n // advised to validate translations with the fluent-syntax parser\n // pre-runtime.\n // The parser makes an extensive use of sticky regexes which can be anchored\n // to any offset of the source string without slicing it. Errors are thrown\n // to bail out of parsing of ill-formed messages.\n function test(re) {\n re.lastIndex = cursor;\n return re.test(source);\n }\n // Advance the cursor by the char if it matches. May be used as a predicate\n // (was the match found?) or, if errorClass is passed, as an assertion.\n function consumeChar(char, errorClass) {\n if (source[cursor] === char) {\n cursor++;\n return true;\n }\n if (errorClass) {\n throw new errorClass(`Expected ${char}`);\n }\n return false;\n }\n // Advance the cursor by the token if it matches. May be used as a predicate\n // (was the match found?) or, if errorClass is passed, as an assertion.\n function consumeToken(re, errorClass) {\n if (test(re)) {\n cursor = re.lastIndex;\n return true;\n }\n if (errorClass) {\n throw new errorClass(`Expected ${re.toString()}`);\n }\n return false;\n }\n // Execute a regex, advance the cursor, and return all capture groups.\n function match(re) {\n re.lastIndex = cursor;\n let result = re.exec(source);\n if (result === null) {\n throw new SyntaxError(`Expected ${re.toString()}`);\n }\n cursor = re.lastIndex;\n return result;\n }\n // Execute a regex, advance the cursor, and return the capture group.\n function match1(re) {\n return match(re)[1];\n }\n function parseMessage(id) {\n let value = parsePattern();\n let attributes = parseAttributes();\n if (value === null && Object.keys(attributes).length === 0) {\n throw new SyntaxError(\"Expected message value or attributes\");\n }\n return { id, value, attributes };\n }\n function parseAttributes() {\n let attrs = Object.create(null);\n while (test(RE_ATTRIBUTE_START)) {\n let name = match1(RE_ATTRIBUTE_START);\n let value = parsePattern();\n if (value === null) {\n throw new SyntaxError(\"Expected attribute value\");\n }\n attrs[name] = value;\n }\n return attrs;\n }\n function parsePattern() {\n let first;\n // First try to parse any simple text on the same line as the id.\n if (test(RE_TEXT_RUN)) {\n first = match1(RE_TEXT_RUN);\n }\n // If there's a placeable on the first line, parse a complex pattern.\n if (source[cursor] === \"{\" || source[cursor] === \"}\") {\n // Re-use the text parsed above, if possible.\n return parsePatternElements(first ? [first] : [], Infinity);\n }\n // RE_TEXT_VALUE stops at newlines. Only continue parsing the pattern if\n // what comes after the newline is indented.\n let indent = parseIndent();\n if (indent) {\n if (first) {\n // If there's text on the first line, the blank block is part of the\n // translation content in its entirety.\n return parsePatternElements([first, indent], indent.length);\n }\n // Otherwise, we're dealing with a block pattern, i.e. a pattern which\n // starts on a new line. Discrad the leading newlines but keep the\n // inline indent; it will be used by the dedentation logic.\n indent.value = trim(indent.value, RE_LEADING_NEWLINES);\n return parsePatternElements([indent], indent.length);\n }\n if (first) {\n // It was just a simple inline text after all.\n return trim(first, RE_TRAILING_SPACES);\n }\n return null;\n }\n // Parse a complex pattern as an array of elements.\n function parsePatternElements(elements = [], commonIndent) {\n while (true) {\n if (test(RE_TEXT_RUN)) {\n elements.push(match1(RE_TEXT_RUN));\n continue;\n }\n if (source[cursor] === \"{\") {\n elements.push(parsePlaceable());\n continue;\n }\n if (source[cursor] === \"}\") {\n throw new SyntaxError(\"Unbalanced closing brace\");\n }\n let indent = parseIndent();\n if (indent) {\n elements.push(indent);\n commonIndent = Math.min(commonIndent, indent.length);\n continue;\n }\n break;\n }\n let lastIndex = elements.length - 1;\n let lastElement = elements[lastIndex];\n // Trim the trailing spaces in the last element if it's a TextElement.\n if (typeof lastElement === \"string\") {\n elements[lastIndex] = trim(lastElement, RE_TRAILING_SPACES);\n }\n let baked = [];\n for (let element of elements) {\n if (element instanceof Indent) {\n // Dedent indented lines by the maximum common indent.\n element = element.value.slice(0, element.value.length - commonIndent);\n }\n if (element) {\n baked.push(element);\n }\n }\n return baked;\n }\n function parsePlaceable() {\n consumeToken(TOKEN_BRACE_OPEN, SyntaxError);\n let selector = parseInlineExpression();\n if (consumeToken(TOKEN_BRACE_CLOSE)) {\n return selector;\n }\n if (consumeToken(TOKEN_ARROW)) {\n let variants = parseVariants();\n consumeToken(TOKEN_BRACE_CLOSE, SyntaxError);\n return {\n type: \"select\",\n selector,\n ...variants,\n };\n }\n throw new SyntaxError(\"Unclosed placeable\");\n }\n function parseInlineExpression() {\n if (source[cursor] === \"{\") {\n // It's a nested placeable.\n return parsePlaceable();\n }\n if (test(RE_REFERENCE)) {\n let [, sigil, name, attr = null] = match(RE_REFERENCE);\n if (sigil === \"$\") {\n return { type: \"var\", name };\n }\n if (consumeToken(TOKEN_PAREN_OPEN)) {\n let args = parseArguments();\n if (sigil === \"-\") {\n // A parameterized term: -term(...).\n return { type: \"term\", name, attr, args };\n }\n if (RE_FUNCTION_NAME.test(name)) {\n return { type: \"func\", name, args };\n }\n throw new SyntaxError(\"Function names must be all upper-case\");\n }\n if (sigil === \"-\") {\n // A non-parameterized term: -term.\n return {\n type: \"term\",\n name,\n attr,\n args: [],\n };\n }\n return { type: \"mesg\", name, attr };\n }\n return parseLiteral();\n }\n function parseArguments() {\n let args = [];\n while (true) {\n switch (source[cursor]) {\n case \")\": // End of the argument list.\n cursor++;\n return args;\n case undefined: // EOF\n throw new SyntaxError(\"Unclosed argument list\");\n }\n args.push(parseArgument());\n // Commas between arguments are treated as whitespace.\n consumeToken(TOKEN_COMMA);\n }\n }\n function parseArgument() {\n let expr = parseInlineExpression();\n if (expr.type !== \"mesg\") {\n return expr;\n }\n if (consumeToken(TOKEN_COLON)) {\n // The reference is the beginning of a named argument.\n return {\n type: \"narg\",\n name: expr.name,\n value: parseLiteral(),\n };\n }\n // It's a regular message reference.\n return expr;\n }\n function parseVariants() {\n let variants = [];\n let count = 0;\n let star;\n while (test(RE_VARIANT_START)) {\n if (consumeChar(\"*\")) {\n star = count;\n }\n let key = parseVariantKey();\n let value = parsePattern();\n if (value === null) {\n throw new SyntaxError(\"Expected variant value\");\n }\n variants[count++] = { key, value };\n }\n if (count === 0) {\n return null;\n }\n if (star === undefined) {\n throw new SyntaxError(\"Expected default variant\");\n }\n return { variants, star };\n }\n function parseVariantKey() {\n consumeToken(TOKEN_BRACKET_OPEN, SyntaxError);\n let key;\n if (test(RE_NUMBER_LITERAL)) {\n key = parseNumberLiteral();\n }\n else {\n key = {\n type: \"str\",\n value: match1(RE_IDENTIFIER),\n };\n }\n consumeToken(TOKEN_BRACKET_CLOSE, SyntaxError);\n return key;\n }\n function parseLiteral() {\n if (test(RE_NUMBER_LITERAL)) {\n return parseNumberLiteral();\n }\n if (source[cursor] === '\"') {\n return parseStringLiteral();\n }\n throw new SyntaxError(\"Invalid expression\");\n }\n function parseNumberLiteral() {\n let [, value, fraction = \"\"] = match(RE_NUMBER_LITERAL);\n let precision = fraction.length;\n return {\n type: \"num\",\n value: parseFloat(value),\n precision,\n };\n }\n function parseStringLiteral() {\n consumeChar('\"', SyntaxError);\n let value = \"\";\n while (true) {\n value += match1(RE_STRING_RUN);\n if (source[cursor] === \"\\\\\") {\n value += parseEscapeSequence();\n continue;\n }\n if (consumeChar('\"')) {\n return { type: \"str\", value };\n }\n // We've reached an EOL of EOF.\n throw new SyntaxError(\"Unclosed string literal\");\n }\n }\n // Unescape known escape sequences.\n function parseEscapeSequence() {\n if (test(RE_STRING_ESCAPE)) {\n return match1(RE_STRING_ESCAPE);\n }\n if (test(RE_UNICODE_ESCAPE)) {\n let [, codepoint4, codepoint6] = match(RE_UNICODE_ESCAPE);\n let codepoint = parseInt(codepoint4 || codepoint6, 16);\n return codepoint <= 0xd7ff || 0xe000 <= codepoint\n ? // It's a Unicode scalar value.\n String.fromCodePoint(codepoint)\n : // Lonely surrogates can cause trouble when the parsing result is\n // saved using UTF-8. Use U+FFFD REPLACEMENT CHARACTER instead.\n \"�\";\n }\n throw new SyntaxError(\"Unknown escape sequence\");\n }\n // Parse blank space. Return it if it looks like indent before a pattern\n // line. Skip it othwerwise.\n function parseIndent() {\n let start = cursor;\n consumeToken(TOKEN_BLANK);\n // Check the first non-blank character after the indent.\n switch (source[cursor]) {\n case \".\":\n case \"[\":\n case \"*\":\n case \"}\":\n case undefined: // EOF\n // A special character. End the Pattern.\n return false;\n case \"{\":\n // Placeables don't require indentation (in EBNF: block-placeable).\n // Continue the Pattern.\n return makeIndent(source.slice(start, cursor));\n }\n // If the first character on the line is not one of the special characters\n // listed above, it's a regular text character. Check if there's at least\n // one space of indent before it.\n if (source[cursor - 1] === \" \") {\n // It's an indented text character (in EBNF: indented-char). Continue\n // the Pattern.\n return makeIndent(source.slice(start, cursor));\n }\n // A not-indented text character is likely the identifier of the next\n // message. End the Pattern.\n return false;\n }\n // Trim blanks in text according to the given regex.\n function trim(text, re) {\n return text.replace(re, \"\");\n }\n // Normalize a blank block and extract the indent details.\n function makeIndent(blank) {\n let value = blank.replace(RE_BLANK_LINES, \"\\n\");\n let length = RE_INDENT.exec(blank)[1].length;\n return new Indent(value, length);\n }\n }\n}\nclass Indent {\n constructor(value, length) {\n this.value = value;\n this.length = length;\n }\n}\n","/**\n * A JavaScript implementation of Project Fluent, a localization\n * framework designed to unleash the expressive power of the natural language.\n *\n * @module\n */\nexport { FluentBundle } from \"./bundle.js\";\nexport { FluentResource } from \"./resource.js\";\nexport { FluentType, FluentNone, FluentNumber, FluentDateTime, } from \"./types.js\";\n","/* eslint no-console: [\"error\", {allow: [\"warn\"]}] */\n/* global console */\n// Match the opening angle bracket (<) in HTML tags, and HTML entities like\n// &, &, &.\nconst reOverlay = /<|&#?\\w+;/;\n/**\n * Elements allowed in translations even if they are not present in the source\n * HTML. They are text-level elements as defined by the HTML5 spec:\n * https://www.w3.org/TR/html5/text-level-semantics.html with the exception of:\n *\n * - a - because we don't allow href on it anyways,\n * - ruby, rt, rp - because we don't allow nested elements to be inserted.\n */\nconst TEXT_LEVEL_ELEMENTS = {\n \"http://www.w3.org/1999/xhtml\": [\n \"em\",\n \"strong\",\n \"small\",\n \"s\",\n \"cite\",\n \"q\",\n \"dfn\",\n \"abbr\",\n \"data\",\n \"time\",\n \"code\",\n \"var\",\n \"samp\",\n \"kbd\",\n \"sub\",\n \"sup\",\n \"i\",\n \"b\",\n \"u\",\n \"mark\",\n \"bdi\",\n \"bdo\",\n \"span\",\n \"br\",\n \"wbr\",\n ],\n};\nconst LOCALIZABLE_ATTRIBUTES = {\n \"http://www.w3.org/1999/xhtml\": {\n global: [\"title\", \"aria-description\", \"aria-label\", \"aria-valuetext\"],\n a: [\"download\"],\n area: [\"download\", \"alt\"],\n // value is special-cased in isAttrNameLocalizable\n input: [\"alt\", \"placeholder\"],\n menuitem: [\"label\"],\n menu: [\"label\"],\n optgroup: [\"label\"],\n option: [\"label\"],\n track: [\"label\"],\n img: [\"alt\"],\n textarea: [\"placeholder\"],\n th: [\"abbr\"],\n },\n \"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\": {\n global: [\n \"accesskey\",\n \"aria-label\",\n \"aria-valuetext\",\n \"label\",\n \"title\",\n \"tooltiptext\",\n ],\n description: [\"value\"],\n key: [\"key\", \"keycode\"],\n label: [\"value\"],\n textbox: [\"placeholder\", \"value\"],\n },\n};\n/**\n * Translate an element.\n *\n * Translate the element's text content and attributes. Some HTML markup is\n * allowed in the translation. The element's children with the data-l10n-name\n * attribute will be treated as arguments to the translation. If the\n * translation defines the same children, their attributes and text contents\n * will be used for translating the matching source child.\n *\n * @param {Element} element\n * @param {Object} translation\n * @private\n */\nexport default function translateElement(element, translation) {\n const { value } = translation;\n if (typeof value === \"string\") {\n if (element.localName === \"title\" &&\n element.namespaceURI === \"http://www.w3.org/1999/xhtml\") {\n // A special case for the HTML title element whose content must be text.\n element.textContent = value;\n }\n else if (!reOverlay.test(value)) {\n // If the translation doesn't contain any markup skip the overlay logic.\n element.textContent = value;\n }\n else {\n // Else parse the translation's HTML using an inert template element,\n // sanitize it and replace the element's content.\n const templateElement = element.ownerDocument.createElementNS(\"http://www.w3.org/1999/xhtml\", \"template\");\n templateElement.innerHTML = value;\n overlayChildNodes(templateElement.content, element);\n }\n }\n // Even if the translation doesn't define any localizable attributes, run\n // overlayAttributes to remove any localizable attributes set by previous\n // translations.\n overlayAttributes(translation, element);\n}\n/**\n * Replace child nodes of an element with child nodes of another element.\n *\n * The contents of the target element will be cleared and fully replaced with\n * sanitized contents of the source element.\n *\n * @param {DocumentFragment} fromFragment - The source of children to overlay.\n * @param {Element} toElement - The target of the overlay.\n * @private\n */\nfunction overlayChildNodes(fromFragment, toElement) {\n for (const childNode of fromFragment.childNodes) {\n if (childNode.nodeType === childNode.TEXT_NODE) {\n // Keep the translated text node.\n continue;\n }\n if (childNode.hasAttribute(\"data-l10n-name\")) {\n const sanitized = getNodeForNamedElement(toElement, childNode);\n fromFragment.replaceChild(sanitized, childNode);\n continue;\n }\n if (isElementAllowed(childNode)) {\n const sanitized = createSanitizedElement(childNode);\n fromFragment.replaceChild(sanitized, childNode);\n continue;\n }\n console.warn(`An element of forbidden type \"${childNode.localName}\" was found in ` +\n \"the translation. Only safe text-level elements and elements with \" +\n \"data-l10n-name are allowed.\");\n // If all else fails, replace the element with its text content.\n fromFragment.replaceChild(createTextNodeFromTextContent(childNode), childNode);\n }\n toElement.textContent = \"\";\n toElement.appendChild(fromFragment);\n}\nfunction hasAttribute(attributes, name) {\n if (!attributes) {\n return false;\n }\n for (let attr of attributes) {\n if (attr.name === name) {\n return true;\n }\n }\n return false;\n}\n/**\n * Transplant localizable attributes of an element to another element.\n *\n * Any localizable attributes already set on the target element will be\n * cleared.\n *\n * @param {Element|Object} fromElement - The source of child nodes to overlay.\n * @param {Element} toElement - The target of the overlay.\n * @private\n */\nfunction overlayAttributes(fromElement, toElement) {\n const explicitlyAllowed = toElement.hasAttribute(\"data-l10n-attrs\")\n ? toElement\n .getAttribute(\"data-l10n-attrs\")\n .split(\",\")\n .map(i => i.trim())\n : null;\n // Remove existing localizable attributes if they\n // will not be used in the new translation.\n for (const attr of Array.from(toElement.attributes)) {\n if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) &&\n !hasAttribute(fromElement.attributes, attr.name)) {\n toElement.removeAttribute(attr.name);\n }\n }\n // fromElement might be a {value, attributes} object as returned by\n // Localization.messageFromBundle. In which case attributes may be null to\n // save GC cycles.\n if (!fromElement.attributes) {\n return;\n }\n // Set localizable attributes.\n for (const attr of Array.from(fromElement.attributes)) {\n if (isAttrNameLocalizable(attr.name, toElement, explicitlyAllowed) &&\n toElement.getAttribute(attr.name) !== attr.value) {\n toElement.setAttribute(attr.name, attr.value);\n }\n }\n}\n/**\n * Sanitize a child element created by the translation.\n *\n * Try to find a corresponding child in sourceElement and use it as the base\n * for the sanitization. This will preserve functional attribtues defined on\n * the child element in the source HTML.\n *\n * @param {Element} sourceElement - The source for data-l10n-name lookups.\n * @param {Element} translatedChild - The translated child to be sanitized.\n * @returns {Element}\n * @private\n */\nfunction getNodeForNamedElement(sourceElement, translatedChild) {\n const childName = translatedChild.getAttribute(\"data-l10n-name\");\n const sourceChild = sourceElement.querySelector(`[data-l10n-name=\"${childName}\"]`);\n if (!sourceChild) {\n console.warn(`An element named \"${childName}\" wasn't found in the source.`);\n return createTextNodeFromTextContent(translatedChild);\n }\n if (sourceChild.localName !== translatedChild.localName) {\n console.warn(`An element named \"${childName}\" was found in the translation ` +\n `but its type ${translatedChild.localName} didn't match the ` +\n `element found in the source (${sourceChild.localName}).`);\n return createTextNodeFromTextContent(translatedChild);\n }\n // Remove it from sourceElement so that the translation cannot use\n // the same reference name again.\n sourceElement.removeChild(sourceChild);\n // We can't currently guarantee that a translation won't remove\n // sourceChild from the element completely, which could break the app if\n // it relies on an event handler attached to the sourceChild. Let's make\n // this limitation explicit for now by breaking the identitiy of the\n // sourceChild by cloning it. This will destroy all event handlers\n // attached to sourceChild via addEventListener and via on\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} 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} keys - Translation keys to format.\n * @param {Function} method - Formatting function.\n * @returns {Promise>}\n * @private\n */\n async formatWithFallback(keys, method) {\n const translations = [];\n let hasAtLeastOneBundle = false;\n for await (const bundle of this.bundles) {\n hasAtLeastOneBundle = true;\n const missingIds = keysFromBundle(method, bundle, keys, translations);\n if (missingIds.size === 0) {\n break;\n }\n if (typeof console !== \"undefined\") {\n const locale = bundle.locales[0];\n const ids = Array.from(missingIds).join(\", \");\n console.warn(`[fluent] Missing translations in ${locale}: ${ids}`);\n }\n }\n if (!hasAtLeastOneBundle && typeof console !== \"undefined\") {\n console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n keys: ${JSON.stringify(keys)}.\n resourceIds: ${JSON.stringify(this.resourceIds)}.`);\n }\n return translations;\n }\n /**\n * Format translations into `{value, attributes}` objects.\n *\n * The fallback logic is the same as in `formatValues`\n * but it returns `{value, attributes}` objects\n * which are suitable for the translation of DOM elements.\n *\n * Returns a Promise resolving to an array of the translation strings.\n *\n * @example\n * ```js\n * docL10n.formatMessages([\n * {id: 'hello', args: { who: 'Mary' }},\n * {id: 'welcome'}\n * ]).then(console.log);\n *\n * // [\n * // { value: 'Hello, Mary!', attributes: null },\n * // {\n * // value: 'Welcome!',\n * // attributes: [ { name: \"title\", value: 'Hello' } ]\n * // }\n * // ]\n * ```\n *\n * @param {Array} keys\n * @returns {Promise>}\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} keys\n * @returns {Promise>}\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}\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} 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} 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} keys\n * @param {{Array<{value: string, attributes: Object}>}} translations\n *\n * @returns {Set}\n * @private\n */\nfunction keysFromBundle(method, bundle, keys, translations) {\n const messageErrors = [];\n const missingIds = new Set();\n keys.forEach(({ id, args }, i) => {\n if (translations[i] !== undefined) {\n return;\n }\n let message = bundle.getMessage(id);\n if (message) {\n messageErrors.length = 0;\n translations[i] = method(bundle, messageErrors, message, args);\n if (messageErrors.length > 0 && typeof console !== \"undefined\") {\n const locale = bundle.locales[0];\n const errors = messageErrors.join(\", \");\n console.warn(`[fluent][resolver] errors in ${locale}/${id}: ${errors}.`);\n }\n }\n else {\n missingIds.add(id);\n }\n });\n return missingIds;\n}\n","import translateElement from \"./overlay.js\";\nimport Localization from \"./localization.js\";\nconst L10NID_ATTR_NAME = \"data-l10n-id\";\nconst L10NARGS_ATTR_NAME = \"data-l10n-args\";\nconst L10N_ELEMENT_QUERY = `[${L10NID_ATTR_NAME}]`;\n/**\n * The `DOMLocalization` class is responsible for fetching resources and\n * formatting translations.\n *\n * It implements the fallback strategy in case of errors encountered during the\n * formatting of translations and methods for observing DOM\n * trees with a `MutationObserver`.\n */\nexport default class DOMLocalization extends Localization {\n /**\n * @param {Array} 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 *

\n *

\n * ```\n *\n * @param {Element} element - Element to set attributes on\n * @param {string} id - l10n-id string\n * @param {Object} args - KVP list of l10n arguments\n * @returns {Element}\n */\n setAttributes(element, id, args) {\n element.setAttribute(L10NID_ATTR_NAME, id);\n if (args) {\n element.setAttribute(L10NARGS_ATTR_NAME, JSON.stringify(args));\n }\n else {\n element.removeAttribute(L10NARGS_ATTR_NAME);\n }\n return element;\n }\n /**\n * Get the `data-l10n-*` attributes from DOM elements.\n *\n * ```javascript\n * localization.getAttributes(\n * document.querySelector('#welcome')\n * );\n * // -> { id: 'hello', args: { who: 'world' } }\n * ```\n *\n * @param {Element} element - HTML element\n * @returns {{id: string, args: Object}}\n */\n getAttributes(element) {\n return {\n id: element.getAttribute(L10NID_ATTR_NAME),\n args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null),\n };\n }\n /**\n * Add `newRoot` to the list of roots managed by this `DOMLocalization`.\n *\n * Additionally, if this `DOMLocalization` has an observer, start observing\n * `newRoot` in order to translate mutations in it.\n *\n * @param {Element | DocumentFragment} newRoot - Root to observe.\n */\n connectRoot(newRoot) {\n for (const root of this.roots) {\n if (root === newRoot ||\n root.contains(newRoot) ||\n newRoot.contains(root)) {\n throw new Error(\"Cannot add a root that overlaps with existing root.\");\n }\n }\n if (this.windowElement) {\n if (this.windowElement !== newRoot.ownerDocument.defaultView) {\n throw new Error(`Cannot connect a root:\n DOMLocalization already has a root from a different window.`);\n }\n }\n else {\n this.windowElement = newRoot.ownerDocument.defaultView;\n this.mutationObserver = new this.windowElement.MutationObserver(mutations => this.translateMutations(mutations));\n }\n this.roots.add(newRoot);\n this.mutationObserver.observe(newRoot, this.observerConfig);\n }\n /**\n * Remove `root` from the list of roots managed by this `DOMLocalization`.\n *\n * Additionally, if this `DOMLocalization` has an observer, stop observing\n * `root`.\n *\n * Returns `true` if the root was the last one managed by this\n * `DOMLocalization`.\n *\n * @param {Element | DocumentFragment} root - Root to disconnect.\n * @returns {boolean}\n */\n disconnectRoot(root) {\n this.roots.delete(root);\n // Pause the mutation observer to stop observing `root`.\n this.pauseObserving();\n if (this.roots.size === 0) {\n this.mutationObserver = null;\n if (this.windowElement && this.pendingrAF) {\n this.windowElement.cancelAnimationFrame(this.pendingrAF);\n }\n this.windowElement = null;\n this.pendingrAF = null;\n this.pendingElements.clear();\n return true;\n }\n // Resume observing all other roots.\n this.resumeObserving();\n return false;\n }\n /**\n * Translate all roots associated with this `DOMLocalization`.\n *\n * @returns {Promise}\n */\n translateRoots() {\n const roots = Array.from(this.roots);\n return Promise.all(roots.map(root => this.translateFragment(root)));\n }\n /**\n * Pauses the `MutationObserver`.\n */\n pauseObserving() {\n if (!this.mutationObserver) {\n return;\n }\n this.translateMutations(this.mutationObserver.takeRecords());\n this.mutationObserver.disconnect();\n }\n /**\n * Resumes the `MutationObserver`.\n */\n resumeObserving() {\n if (!this.mutationObserver) {\n return;\n }\n for (const root of this.roots) {\n this.mutationObserver.observe(root, this.observerConfig);\n }\n }\n /**\n * Translate mutations detected by the `MutationObserver`.\n *\n * @private\n */\n translateMutations(mutations) {\n for (const mutation of mutations) {\n switch (mutation.type) {\n case \"attributes\":\n if (mutation.target.hasAttribute(\"data-l10n-id\")) {\n this.pendingElements.add(mutation.target);\n }\n break;\n case \"childList\":\n for (const addedNode of mutation.addedNodes) {\n if (addedNode.nodeType === addedNode.ELEMENT_NODE) {\n if (addedNode.childElementCount) {\n for (const element of this.getTranslatables(addedNode)) {\n this.pendingElements.add(element);\n }\n }\n else if (addedNode.hasAttribute(L10NID_ATTR_NAME)) {\n this.pendingElements.add(addedNode);\n }\n }\n }\n break;\n }\n }\n // This fragment allows us to coalesce all pending translations\n // into a single requestAnimationFrame.\n if (this.pendingElements.size > 0) {\n if (this.pendingrAF === null) {\n this.pendingrAF = this.windowElement.requestAnimationFrame(() => {\n this.translateElements(Array.from(this.pendingElements));\n this.pendingElements.clear();\n this.pendingrAF = null;\n });\n }\n }\n }\n /**\n * Translate a DOM element or fragment asynchronously using this\n * `DOMLocalization` object.\n *\n * Manually trigger the translation (or re-translation) of a DOM fragment.\n * Use the `data-l10n-id` and `data-l10n-args` attributes to mark up the DOM\n * with information about which translations to use.\n *\n * Returns a `Promise` that gets resolved once the translation is complete.\n *\n * @param {Element | DocumentFragment} frag - Element or DocumentFragment to be translated\n * @returns {Promise}\n */\n translateFragment(frag) {\n return this.translateElements(this.getTranslatables(frag));\n }\n /**\n * Translate a list of DOM elements asynchronously using this\n * `DOMLocalization` object.\n *\n * Manually trigger the translation (or re-translation) of a list of elements.\n * Use the `data-l10n-id` and `data-l10n-args` attributes to mark up the DOM\n * with information about which translations to use.\n *\n * Returns a `Promise` that gets resolved once the translation is complete.\n *\n * @param {Array} 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} elements\n * @param {Array} translations\n * @private\n */\n applyTranslations(elements, translations) {\n this.pauseObserving();\n for (let i = 0; i < elements.length; i++) {\n if (translations[i] !== undefined) {\n translateElement(elements[i], translations[i]);\n }\n }\n this.resumeObserving();\n }\n /**\n * Collects all translatable child elements of the element.\n *\n * @param {Element | DocumentFragment} element\n * @returns {Array}\n * @private\n */\n getTranslatables(element) {\n const nodes = Array.from(element.querySelectorAll(L10N_ELEMENT_QUERY));\n if (typeof element.hasAttribute === \"function\" &&\n element.hasAttribute(L10NID_ATTR_NAME)) {\n nodes.push(element);\n }\n return nodes;\n }\n /**\n * Get the `data-l10n-*` attributes from DOM elements as a two-element\n * array.\n *\n * @param {Element} element\n * @returns {Object}\n * @private\n */\n getKeysForElement(element) {\n return {\n id: element.getAttribute(L10NID_ATTR_NAME),\n args: JSON.parse(element.getAttribute(L10NARGS_ATTR_NAME) || null),\n };\n }\n}\n","export { default as DOMLocalization } from \"./dom_localization.js\";\nexport { default as Localization } from \"./localization.js\";\n","/* Copyright 2023 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @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 #elements;\n\n #lang;\n\n #l10n;\n\n constructor({ lang, isRTL }, l10n = null) {\n this.#lang = L10n.#fixupLangCode(lang);\n this.#l10n = l10n;\n this.#dir = (isRTL ?? L10n.#isRTL(this.#lang)) ? \"rtl\" : \"ltr\";\n }\n\n _setL10n(l10n) {\n this.#l10n = l10n;\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n document.l10n = l10n;\n }\n }\n\n /** @inheritdoc */\n getLanguage() {\n return this.#lang;\n }\n\n /** @inheritdoc */\n getDirection() {\n return this.#dir;\n }\n\n /** @inheritdoc */\n async get(ids, args = null, fallback) {\n if (Array.isArray(ids)) {\n ids = ids.map(id => ({ id }));\n const messages = await this.#l10n.formatMessages(ids);\n return messages.map(message => message.value);\n }\n\n const messages = await this.#l10n.formatMessages([\n {\n id: ids,\n args,\n },\n ]);\n return messages[0]?.value || fallback;\n }\n\n /** @inheritdoc */\n async translate(element) {\n (this.#elements ||= new Set()).add(element);\n try {\n this.#l10n.connectRoot(element);\n await this.#l10n.translateRoots();\n } catch {\n // Element is under an existing root, so there is no need to add it again.\n }\n }\n\n /** @inheritdoc */\n async translateOnce(element) {\n try {\n await this.#l10n.translateElements([element]);\n } catch (ex) {\n console.error(\"translateOnce:\", ex);\n }\n }\n\n /** @inheritdoc */\n async destroy() {\n if (this.#elements) {\n for (const element of this.#elements) {\n this.#l10n.disconnectRoot(element);\n }\n this.#elements.clear();\n this.#elements = null;\n }\n this.#l10n.pauseObserving();\n }\n\n /** @inheritdoc */\n pause() {\n this.#l10n.pauseObserving();\n }\n\n /** @inheritdoc */\n resume() {\n this.#l10n.resumeObserving();\n }\n\n static #fixupLangCode(langCode) {\n // Use only lowercase language-codes internally, and fallback to English.\n langCode = langCode?.toLowerCase() || \"en-us\";\n\n // Try to support \"incompletely\" specified language codes (see issue 13689).\n const PARTIAL_LANG_CODES = {\n en: \"en-us\",\n es: \"es-es\",\n fy: \"fy-nl\",\n ga: \"ga-ie\",\n gu: \"gu-in\",\n hi: \"hi-in\",\n hy: \"hy-am\",\n nb: \"nb-no\",\n ne: \"ne-np\",\n nn: \"nn-no\",\n pa: \"pa-in\",\n pt: \"pt-pt\",\n sv: \"sv-se\",\n zh: \"zh-cn\",\n };\n return PARTIAL_LANG_CODES[langCode] || langCode;\n }\n\n static #isRTL(lang) {\n const shortCode = lang.split(\"-\", 1)[0];\n return [\"ar\", \"he\", \"fa\", \"ps\", \"ur\"].includes(shortCode);\n }\n}\n\nconst GenericL10n = null;\n\nexport { GenericL10n, L10n };\n","/* Copyright 2017 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"./interfaces\").IL10n} IL10n */\n\nimport { FeatureTest, fetchData } from \"pdfjs-lib\";\nimport { FluentBundle, FluentResource } from \"fluent-bundle\";\nimport { DOMLocalization } from \"fluent-dom\";\nimport { L10n } from \"./l10n.js\";\n\nfunction PLATFORM() {\n const { isAndroid, isLinux, isMac, isWindows } = FeatureTest.platform;\n if (isLinux) {\n return \"linux\";\n }\n if (isWindows) {\n return \"windows\";\n }\n if (isMac) {\n return \"macos\";\n }\n if (isAndroid) {\n return \"android\";\n }\n return \"other\";\n}\n\nfunction createBundle(lang, text) {\n const resource = new FluentResource(text);\n const bundle = new FluentBundle(lang, {\n functions: { PLATFORM },\n });\n const errors = bundle.addResource(resource);\n if (errors.length) {\n console.error(\"L10n errors\", errors);\n }\n return bundle;\n}\n\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 // Trigger fetching of bundles in parallel, to reduce overall load time.\n const bundles = langs.map(lang => [\n lang,\n this.#createBundle(lang, baseURL, paths),\n ]);\n\n for (const [lang, bundlePromise] of bundles) {\n const bundle = await bundlePromise;\n if (bundle) {\n yield bundle;\n } else if (lang === \"en-us\") {\n yield this.#createBundleFallback(lang);\n }\n }\n }\n\n static async #createBundle(lang, baseURL, paths) {\n const path = paths[lang];\n if (!path) {\n return null;\n }\n const url = new URL(path, baseURL);\n const text = await fetchData(url, /* type = */ \"text\");\n\n return createBundle(lang, text);\n }\n\n static async #getPaths() {\n try {\n const { href } = document.querySelector(`link[type=\"application/l10n\"]`);\n const paths = await fetchData(href, /* type = */ \"json\");\n\n return {\n baseURL: href.substring(0, href.lastIndexOf(\"/\") + 1) || \"./\",\n paths,\n };\n } catch {}\n return { baseURL: \"./\", paths: Object.create(null) };\n }\n\n static async *#generateBundlesFallback(lang) {\n yield this.#createBundleFallback(lang);\n }\n\n static async #createBundleFallback(lang) {\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n throw new Error(\"Not implemented: #createBundleFallback\");\n }\n const text =\n typeof PDFJSDev === \"undefined\"\n ? await fetchData(\n new URL(\"../l10n/en-US/viewer.ftl\", window.location.href),\n /* type = */ \"text\"\n )\n : PDFJSDev.eval(\"DEFAULT_FTL\");\n\n return createBundle(lang, text);\n }\n}\n\nexport { GenericL10n };\n","/* Copyright 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 { updateUrlHash } from \"pdfjs-lib\";\nimport { waitOnEventOrTimeout } from \"./event_utils.js\";\n\n// Heuristic value used when force-resetting `this._blockHashChange`.\nconst HASH_CHANGE_TIMEOUT = 1000; // milliseconds\n// Heuristic value used when adding the current position to the browser history.\nconst POSITION_UPDATED_THRESHOLD = 50;\n// Heuristic value used when adding a temporary position to the browser history.\nconst UPDATE_VIEWAREA_TIMEOUT = 1000; // milliseconds\n\n/**\n * @typedef {Object} PDFHistoryOptions\n * @property {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 #eventAbortController = null;\n\n /**\n * @param {PDFHistoryOptions} options\n */\n constructor({ linkService, eventBus }) {\n this.linkService = linkService;\n this.eventBus = eventBus;\n\n this._initialized = false;\n this._fingerprint = \"\";\n this.reset();\n\n // Ensure that we don't miss a \"pagesinit\" event,\n // by registering the listener immediately.\n this.eventBus._on(\"pagesinit\", () => {\n this._isPagesLoaded = false;\n\n this.eventBus._on(\n \"pagesloaded\",\n evt => {\n this._isPagesLoaded = !!evt.pagesCount;\n },\n { once: true }\n );\n });\n }\n\n /**\n * Initialize the history for the PDF document, using either the current\n * browser history entry or the document hash, whichever is present.\n * @param {InitializeParameters} params\n */\n initialize({ fingerprint, resetHistory = false, updateUrl = false }) {\n if (!fingerprint || typeof fingerprint !== \"string\") {\n console.error(\n 'PDFHistory.initialize: The \"fingerprint\" must be a non-empty string.'\n );\n return;\n }\n // Ensure that any old state is always reset upon initialization.\n if (this._initialized) {\n this.reset();\n }\n const reInitialized =\n this._fingerprint !== \"\" && this._fingerprint !== fingerprint;\n this._fingerprint = fingerprint;\n this._updateUrl = updateUrl === true;\n\n this._initialized = true;\n this.#bindEvents();\n const state = window.history.state;\n\n this._popStateInProgress = false;\n this._blockHashChange = 0;\n this._currentHash = getCurrentHash();\n this._numPositionUpdates = 0;\n\n this._uid = this._maxUid = 0;\n this._destination = null;\n this._position = null;\n\n if (!this.#isValidState(state, /* checkReload = */ true) || resetHistory) {\n const { hash, page, rotation } = this.#parseCurrentHash(\n /* checkNameddest = */ true\n );\n\n if (!hash || reInitialized || resetHistory) {\n // Ensure that the browser history is reset on PDF document load.\n this.#pushOrReplaceState(null, /* forceReplace = */ true);\n return;\n }\n // Ensure that the browser history is initialized correctly when\n // the document hash is present on PDF document load.\n this.#pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n\n // The browser history contains a valid entry, ensure that the history is\n // initialized correctly on PDF document load.\n const destination = state.destination;\n this.#updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (destination.rotation !== undefined) {\n this._initialRotation = destination.rotation;\n }\n if (destination.dest) {\n this._initialBookmark = JSON.stringify(destination.dest);\n\n // If the history is updated, e.g. through the user changing the hash,\n // before the initial destination has become visible, then we do *not*\n // want to potentially add `this._position` to the browser history.\n this._destination.page = null;\n } else if (destination.hash) {\n this._initialBookmark = destination.hash;\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this._initialBookmark = `page=${destination.page}`;\n }\n }\n\n /**\n * Reset the current `PDFHistory` instance, and consequently prevent any\n * further updates and/or navigation of the browser history.\n */\n reset() {\n if (this._initialized) {\n this.#pageHide(); // Simulate a 'pagehide' event when resetting.\n\n this._initialized = false;\n this.#unbindEvents();\n }\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n this._initialBookmark = null;\n this._initialRotation = null;\n }\n\n /**\n * Push an internal destination to the browser history.\n * @param {PushParameters}\n */\n push({ namedDest = null, explicitDest, pageNumber }) {\n if (!this._initialized) {\n return;\n }\n if (namedDest && typeof namedDest !== \"string\") {\n console.error(\n \"PDFHistory.push: \" +\n `\"${namedDest}\" is not a valid namedDest parameter.`\n );\n return;\n } else if (!Array.isArray(explicitDest)) {\n console.error(\n \"PDFHistory.push: \" +\n `\"${explicitDest}\" is not a valid explicitDest parameter.`\n );\n return;\n } else if (!this.#isValidPage(pageNumber)) {\n // Allow an unset `pageNumber` if and only if the history is still empty;\n // please refer to the `this._destination.page = null;` comment above.\n if (pageNumber !== null || this._destination) {\n console.error(\n \"PDFHistory.push: \" +\n `\"${pageNumber}\" is not a valid pageNumber parameter.`\n );\n return;\n }\n }\n\n const hash = namedDest || JSON.stringify(explicitDest);\n if (!hash) {\n // The hash *should* never be undefined, but if that were to occur,\n // avoid any possible issues by not updating the browser history.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination &&\n (isDestHashesEqual(this._destination.hash, hash) ||\n isDestArraysEqual(this._destination.dest, explicitDest))\n ) {\n // When the new destination is identical to `this._destination`, and\n // its `page` is undefined, replace the current browser history entry.\n // NOTE: This can only occur if `this._destination` was set either:\n // - through the document hash being specified on load.\n // - through the user changing the hash of the document.\n if (this._destination.page) {\n return;\n }\n forceReplace = true;\n }\n if (this._popStateInProgress && !forceReplace) {\n return;\n }\n\n this.#pushOrReplaceState(\n {\n dest: explicitDest,\n hash,\n page: pageNumber,\n rotation: this.linkService.rotation,\n },\n forceReplace\n );\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new destination is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occurring when the new destination is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push a page to the browser history; generally the `push` method should be\n * used instead.\n * @param {number} pageNumber\n */\n pushPage(pageNumber) {\n if (!this._initialized) {\n return;\n }\n if (!this.#isValidPage(pageNumber)) {\n console.error(\n `PDFHistory.pushPage: \"${pageNumber}\" is not a valid page number.`\n );\n return;\n }\n\n if (this._destination?.page === pageNumber) {\n // When the new page is identical to the one in `this._destination`, we\n // don't want to add a potential duplicate entry in the browser history.\n return;\n }\n if (this._popStateInProgress) {\n return;\n }\n\n this.#pushOrReplaceState({\n // Simulate an internal destination, for `this.#tryPushCurrentPosition`:\n dest: null,\n hash: `page=${pageNumber}`,\n page: pageNumber,\n rotation: this.linkService.rotation,\n });\n\n if (!this._popStateInProgress) {\n // Prevent the browser history from updating while the new page is\n // being scrolled into view, to avoid potentially inconsistent state.\n this._popStateInProgress = true;\n // We defer the resetting of `this._popStateInProgress`, to account for\n // e.g. zooming occurring when the new page is being navigated to.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n }\n\n /**\n * Push the current position to the browser history.\n */\n pushCurrentPosition() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n this.#tryPushCurrentPosition();\n }\n\n /**\n * Go back one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n back() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n const state = window.history.state;\n if (this.#isValidState(state) && state.uid > 0) {\n window.history.back();\n }\n }\n\n /**\n * Go forward one step in the browser history.\n * NOTE: Avoids navigating away from the document, useful for \"named actions\".\n */\n forward() {\n if (!this._initialized || this._popStateInProgress) {\n return;\n }\n const state = window.history.state;\n if (this.#isValidState(state) && state.uid < this._maxUid) {\n window.history.forward();\n }\n }\n\n /**\n * @type {boolean} Indicating if the user is currently moving through the\n * browser history, useful e.g. for skipping the next 'hashchange' event.\n */\n get popStateInProgress() {\n return (\n this._initialized &&\n (this._popStateInProgress || this._blockHashChange > 0)\n );\n }\n\n get initialBookmark() {\n return this._initialized ? this._initialBookmark : null;\n }\n\n get initialRotation() {\n return this._initialized ? this._initialRotation : null;\n }\n\n #pushOrReplaceState(destination, forceReplace = false) {\n const shouldReplace = forceReplace || !this._destination;\n const newState = {\n fingerprint: this._fingerprint,\n uid: shouldReplace ? this._uid : this._uid + 1,\n destination,\n };\n\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n window.history.state?.chromecomState\n ) {\n // history.state.chromecomState is managed by chromecom.js.\n newState.chromecomState = window.history.state.chromecomState;\n }\n this.#updateInternalState(destination, newState.uid);\n\n let newUrl;\n if (this._updateUrl && destination?.hash) {\n const { href, protocol } = document.location;\n if (protocol !== \"file:\") {\n newUrl = updateUrlHash(href, destination.hash);\n }\n }\n if (shouldReplace) {\n window.history.replaceState(newState, \"\", newUrl);\n } else {\n window.history.pushState(newState, \"\", newUrl);\n }\n }\n\n #tryPushCurrentPosition(temporary = false) {\n if (!this._position) {\n return;\n }\n let position = this._position;\n if (temporary) {\n position = Object.assign(Object.create(null), this._position);\n position.temporary = true;\n }\n\n if (!this._destination) {\n this.#pushOrReplaceState(position);\n return;\n }\n if (this._destination.temporary) {\n // Always replace a previous *temporary* position.\n this.#pushOrReplaceState(position, /* forceReplace = */ true);\n return;\n }\n if (this._destination.hash === position.hash) {\n return; // The current document position has not changed.\n }\n if (\n !this._destination.page &&\n (POSITION_UPDATED_THRESHOLD <= 0 ||\n this._numPositionUpdates <= POSITION_UPDATED_THRESHOLD)\n ) {\n // `this._destination` was set through the user changing the hash of\n // the document. Do not add `this._position` to the browser history,\n // to avoid \"flooding\" it with lots of (nearly) identical entries,\n // since we cannot ensure that the document position has changed.\n return;\n }\n\n let forceReplace = false;\n if (\n this._destination.page >= position.first &&\n this._destination.page <= position.page\n ) {\n // When the `page` of `this._destination` is still visible, do not\n // update the browsing history when `this._destination` either:\n // - contains an internal destination, since in this case we\n // cannot ensure that the document position has actually changed.\n // - was set through the user changing the hash of the document.\n if (this._destination.dest !== undefined || !this._destination.first) {\n return;\n }\n // To avoid \"flooding\" the browser history, replace the current entry.\n forceReplace = true;\n }\n this.#pushOrReplaceState(position, forceReplace);\n }\n\n #isValidPage(val) {\n return (\n Number.isInteger(val) && val > 0 && val <= this.linkService.pagesCount\n );\n }\n\n #isValidState(state, checkReload = false) {\n if (!state) {\n return false;\n }\n if (state.fingerprint !== this._fingerprint) {\n if (checkReload) {\n // Potentially accept the history entry, even if the fingerprints don't\n // match, when the viewer was reloaded (see issue 6847).\n if (\n typeof state.fingerprint !== \"string\" ||\n state.fingerprint.length !== this._fingerprint.length\n ) {\n return false;\n }\n const [perfEntry] = performance.getEntriesByType(\"navigation\");\n if (perfEntry?.type !== \"reload\") {\n return false;\n }\n } else {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return false;\n }\n }\n if (!Number.isInteger(state.uid) || state.uid < 0) {\n return false;\n }\n if (state.destination === null || typeof state.destination !== \"object\") {\n return false;\n }\n return true;\n }\n\n #updateInternalState(destination, uid, removeTemporary = false) {\n if (this._updateViewareaTimeout) {\n // When updating `this._destination`, make sure that we always wait for\n // the next 'updateviewarea' event before (potentially) attempting to\n // push the current position to the browser history.\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n if (removeTemporary && destination?.temporary) {\n // When the `destination` comes from the browser history,\n // we no longer treat it as a *temporary* position.\n delete destination.temporary;\n }\n this._destination = destination;\n this._uid = uid;\n this._maxUid = Math.max(this._maxUid, uid);\n // This should always be reset when `this._destination` is updated.\n this._numPositionUpdates = 0;\n }\n\n #parseCurrentHash(checkNameddest = false) {\n const hash = unescape(getCurrentHash()).substring(1);\n const params = parseQueryString(hash);\n\n const nameddest = params.get(\"nameddest\") || \"\";\n let page = params.get(\"page\") | 0;\n\n if (!this.#isValidPage(page) || (checkNameddest && nameddest.length > 0)) {\n page = null;\n }\n return { hash, page, rotation: this.linkService.rotation };\n }\n\n #updateViewarea({ location }) {\n if (this._updateViewareaTimeout) {\n clearTimeout(this._updateViewareaTimeout);\n this._updateViewareaTimeout = null;\n }\n\n this._position = {\n hash: location.pdfOpenParams.substring(1),\n page: this.linkService.page,\n first: location.pageNumber,\n rotation: location.rotation,\n };\n\n if (this._popStateInProgress) {\n return;\n }\n\n if (\n POSITION_UPDATED_THRESHOLD > 0 &&\n this._isPagesLoaded &&\n this._destination &&\n !this._destination.page\n ) {\n // If the current destination was set through the user changing the hash\n // of the document, we will usually not try to push the current position\n // to the browser history; see `this.#tryPushCurrentPosition()`.\n //\n // To prevent `this.#tryPushCurrentPosition()` from effectively being\n // reduced to a no-op in this case, we will assume that the position\n // *did* in fact change if the 'updateviewarea' event was dispatched\n // more than `POSITION_UPDATED_THRESHOLD` times.\n this._numPositionUpdates++;\n }\n\n if (UPDATE_VIEWAREA_TIMEOUT > 0) {\n // When closing the browser, a 'pagehide' event will be dispatched which\n // *should* allow us to push the current position to the browser history.\n // In practice, it seems that the event is arriving too late in order for\n // the session history to be successfully updated.\n // (For additional details, please refer to the discussion in\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1153393.)\n //\n // To workaround this we attempt to *temporarily* add the current position\n // to the browser history only when the viewer is *idle*,\n // i.e. when scrolling and/or zooming does not occur.\n //\n // PLEASE NOTE: It's absolutely imperative that the browser history is\n // *not* updated too often, since that would render the viewer more or\n // less unusable. Hence the use of a timeout to delay the update until\n // the viewer has been idle for `UPDATE_VIEWAREA_TIMEOUT` milliseconds.\n this._updateViewareaTimeout = setTimeout(() => {\n if (!this._popStateInProgress) {\n this.#tryPushCurrentPosition(/* temporary = */ true);\n }\n this._updateViewareaTimeout = null;\n }, UPDATE_VIEWAREA_TIMEOUT);\n }\n }\n\n #popState({ state }) {\n const newHash = getCurrentHash(),\n hashChanged = this._currentHash !== newHash;\n this._currentHash = newHash;\n\n if (\n (typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"CHROME\") &&\n state?.chromecomState &&\n !this.#isValidState(state)) ||\n !state\n ) {\n // This case corresponds to the user changing the hash of the document.\n this._uid++;\n\n const { hash, page, rotation } = this.#parseCurrentHash();\n this.#pushOrReplaceState(\n { hash, page, rotation },\n /* forceReplace = */ true\n );\n return;\n }\n if (!this.#isValidState(state)) {\n // This should only occur in viewers with support for opening more than\n // one PDF document, e.g. the GENERIC viewer.\n return;\n }\n\n // Prevent the browser history from updating until the new destination,\n // as stored in the browser history, has been scrolled into view.\n this._popStateInProgress = true;\n\n if (hashChanged) {\n // When the hash changed, implying that the 'popstate' event will be\n // followed by a 'hashchange' event, then we do *not* want to update the\n // browser history when handling the 'hashchange' event (in web/app.js)\n // since that would *overwrite* the new destination navigated to below.\n //\n // To avoid accidentally disabling all future user-initiated hash changes,\n // if there's e.g. another 'hashchange' listener that stops the event\n // propagation, we make sure to always force-reset `this._blockHashChange`\n // after `HASH_CHANGE_TIMEOUT` milliseconds have passed.\n this._blockHashChange++;\n waitOnEventOrTimeout({\n target: window,\n name: \"hashchange\",\n delay: HASH_CHANGE_TIMEOUT,\n }).then(() => {\n this._blockHashChange--;\n });\n }\n\n // Navigate to the new destination.\n const destination = state.destination;\n this.#updateInternalState(\n destination,\n state.uid,\n /* removeTemporary = */ true\n );\n\n if (isValidRotation(destination.rotation)) {\n this.linkService.rotation = destination.rotation;\n }\n if (destination.dest) {\n this.linkService.goToDestination(destination.dest);\n } else if (destination.hash) {\n this.linkService.setHash(destination.hash);\n } else if (destination.page) {\n // Fallback case; shouldn't be necessary, but better safe than sorry.\n this.linkService.page = destination.page;\n }\n\n // Since `PDFLinkService.goToDestination` is asynchronous, we thus defer the\n // resetting of `this._popStateInProgress` slightly.\n Promise.resolve().then(() => {\n this._popStateInProgress = false;\n });\n }\n\n #pageHide() {\n // Attempt to push the `this._position` into the browser history when\n // navigating away from the document. This is *only* done if the history\n // is empty/temporary, since otherwise an existing browser history entry\n // will end up being overwritten (given that new entries cannot be pushed\n // into the browser history when the 'unload' event has already fired).\n if (!this._destination || this._destination.temporary) {\n this.#tryPushCurrentPosition();\n }\n }\n\n #bindEvents() {\n if (this.#eventAbortController) {\n return; // The event listeners were already added.\n }\n this.#eventAbortController = new AbortController();\n const { signal } = this.#eventAbortController;\n\n this.eventBus._on(\"updateviewarea\", this.#updateViewarea.bind(this), {\n signal,\n });\n window.addEventListener(\"popstate\", this.#popState.bind(this), { signal });\n window.addEventListener(\"pagehide\", this.#pageHide.bind(this), { signal });\n }\n\n #unbindEvents() {\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n }\n}\n\nfunction isDestHashesEqual(destHash, pushHash) {\n if (typeof destHash !== \"string\" || typeof pushHash !== \"string\") {\n return false;\n }\n if (destHash === pushHash) {\n return true;\n }\n const nameddest = parseQueryString(destHash).get(\"nameddest\");\n if (nameddest === pushHash) {\n return true;\n }\n return false;\n}\n\nfunction isDestArraysEqual(firstDest, secondDest) {\n function isEntryEqual(first, second) {\n if (typeof first !== typeof second) {\n return false;\n }\n if (Array.isArray(first) || Array.isArray(second)) {\n return false;\n }\n if (first !== null && typeof first === \"object\" && second !== null) {\n if (Object.keys(first).length !== Object.keys(second).length) {\n return false;\n }\n for (const key in first) {\n if (!isEntryEqual(first[key], second[key])) {\n return false;\n }\n }\n return true;\n }\n return first === second || (Number.isNaN(first) && Number.isNaN(second));\n }\n\n if (!(Array.isArray(firstDest) && Array.isArray(secondDest))) {\n return false;\n }\n if (firstDest.length !== secondDest.length) {\n return false;\n }\n for (let i = 0, ii = firstDest.length; i < ii; i++) {\n if (!isEntryEqual(firstDest[i], secondDest[i])) {\n return false;\n }\n }\n return true;\n}\n\nexport { isDestArraysEqual, isDestHashesEqual, PDFHistory };\n","/* Copyright 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// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/struct_tree_layer_builder.js\").StructTreeLayerBuilder} StructTreeLayerBuilder */\n\nimport { AnnotationEditorLayer } from \"pdfjs-lib\";\nimport { GenericL10n } from \"web-null_l10n\";\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderOptions\n * @property {AnnotationEditorUIManager} [uiManager]\n * @property {PDFPageProxy} pdfPage\n * @property {IL10n} [l10n]\n * @property {StructTreeLayerBuilder} [structTreeLayer]\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {AnnotationLayer} [annotationLayer]\n * @property {TextLayer} [textLayer]\n * @property {DrawLayer} [drawLayer]\n * @property {function} [onAppend]\n */\n\n/**\n * @typedef {Object} AnnotationEditorLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass AnnotationEditorLayerBuilder {\n #annotationLayer = null;\n\n #drawLayer = null;\n\n #onAppend = null;\n\n #structTreeLayer = null;\n\n #textLayer = null;\n\n #uiManager;\n\n /**\n * @param {AnnotationEditorLayerBuilderOptions} options\n */\n constructor(options) {\n this.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 this.#structTreeLayer = options.structTreeLayer || null;\n }\n\n /**\n * @param {AnnotationEditorLayerBuilderRenderOptions} options\n * @returns {Promise}\n */\n async render({ viewport, intent = \"display\" }) {\n if (intent !== \"display\") {\n return;\n }\n\n if (this._cancelled) {\n return;\n }\n\n const clonedViewport = viewport.clone({ dontFlip: true });\n if (this.div) {\n this.annotationEditorLayer.update({ viewport: clonedViewport });\n this.show();\n return;\n }\n\n // Create an AnnotationEditor layer div\n const div = (this.div = document.createElement(\"div\"));\n div.className = \"annotationEditorLayer\";\n div.hidden = true;\n div.dir = this.#uiManager.direction;\n this.#onAppend?.(div);\n\n this.annotationEditorLayer = new AnnotationEditorLayer({\n uiManager: this.#uiManager,\n div,\n structTreeLayer: this.#structTreeLayer,\n accessibilityManager: this.accessibilityManager,\n pageIndex: this.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.annotationEditorLayer.pause(/* on */ true);\n this.div.hidden = true;\n }\n\n show() {\n if (!this.div || this.annotationEditorLayer.isInvisible) {\n return;\n }\n this.div.hidden = false;\n this.annotationEditorLayer.pause(/* on */ false);\n }\n}\n\nexport { AnnotationEditorLayerBuilder };\n","/* Copyright 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 compatParams = new Map();\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"LIB\") &&\n !globalThis.navigator?.language\n ) {\n globalThis.navigator = {\n language: \"en-US\",\n maxTouchPoints: 1,\n platform: \"\",\n userAgent: \"\",\n };\n }\n const { maxTouchPoints, platform, userAgent } = navigator;\n\n const isAndroid = /Android/.test(userAgent);\n const isIOS =\n /\\b(iPad|iPhone|iPod)(?=;)/.test(userAgent) ||\n (platform === \"MacIntel\" && maxTouchPoints > 1);\n\n // Limit canvas size to 5 mega-pixels on mobile.\n // Support: Android, iOS\n (function () {\n if (isIOS || isAndroid) {\n compatParams.set(\"maxCanvasPixels\", 5242880);\n }\n })();\n\n // Don't use system fonts on Android (issue 18210).\n // Support: Android\n (function () {\n if (isAndroid) {\n compatParams.set(\"useSystemFonts\", false);\n }\n })();\n}\n\nconst OptionKind = {\n BROWSER: 0x01,\n VIEWER: 0x02,\n API: 0x04,\n WORKER: 0x08,\n EVENT_DISPATCH: 0x10,\n PREFERENCE: 0x80,\n};\n\n// Should only be used with options that allow multiple types.\nconst Type = {\n BOOLEAN: 0x01,\n NUMBER: 0x02,\n OBJECT: 0x04,\n STRING: 0x08,\n UNDEFINED: 0x10,\n};\n\n/**\n * NOTE: These options are used to generate the `default_preferences.json` file,\n * see `OptionKind.PREFERENCE`, hence the values below must use only\n * primitive types and cannot rely on any imported types.\n */\nconst defaultOptions = {\n allowedGlobalEvents: {\n /** @type {Object} */\n value: null,\n kind: OptionKind.BROWSER,\n },\n canvasMaxAreaInBytes: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.BROWSER + OptionKind.API,\n },\n isInAutomation: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.BROWSER,\n },\n localeProperties: {\n /** @type {Object} */\n value:\n typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")\n ? { lang: navigator.language || \"en-US\" }\n : null,\n kind: OptionKind.BROWSER,\n },\n maxCanvasDim: {\n /** @type {number} */\n value: 32767,\n kind: OptionKind.BROWSER + OptionKind.VIEWER,\n },\n nimbusDataStr: {\n /** @type {string} */\n value: \"\",\n kind: OptionKind.BROWSER,\n },\n supportsCaretBrowsingMode: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.BROWSER,\n },\n supportsDocumentFonts: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n supportsIntegratedFind: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.BROWSER,\n },\n supportsMouseWheelZoomCtrlKey: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n supportsMouseWheelZoomMetaKey: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n supportsPinchToZoom: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n supportsPrinting: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.BROWSER,\n },\n toolbarDensity: {\n /** @type {number} */\n value: 0, // 0 = \"normal\", 1 = \"compact\", 2 = \"touch\"\n kind: OptionKind.BROWSER + OptionKind.EVENT_DISPATCH,\n },\n\n altTextLearnMoreUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? \"https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/pdf-alt-text\"\n : \"\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n annotationEditorMode: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n annotationMode: {\n /** @type {number} */\n value: 2,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n capCanvasAreaFactor: {\n /** @type {number} */\n value: 200,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n cursorToolOnLoad: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n debuggerSrc: {\n /** @type {string} */\n value: \"./debugger.mjs\",\n kind: OptionKind.VIEWER,\n },\n defaultZoomDelay: {\n /** @type {number} */\n value: 400,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n defaultZoomValue: {\n /** @type {string} */\n value: \"\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n disableHistory: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER,\n },\n disablePageLabels: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableAltText: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableAltTextModelDownload: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH,\n },\n enableAutoLinking: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableComment: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableDetailCanvas: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER,\n },\n enableGuessAltText: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE + OptionKind.EVENT_DISPATCH,\n },\n enableHighlightFloatingButton: {\n // We'll probably want to make some experiments before enabling this\n // in Firefox release, but it has to be temporary.\n // TODO: remove it when unnecessary.\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableNewAltTextWhenAddingImage: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enablePermissions: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enablePrintAutoRotate: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableScripting: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableSignatureEditor: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableUpdatedAddImage: {\n // We'll probably want to make some experiments before enabling this\n // in Firefox release, but it has to be temporary.\n // TODO: remove it when unnecessary.\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n externalLinkRel: {\n /** @type {string} */\n value: \"noopener noreferrer nofollow\",\n kind: OptionKind.VIEWER,\n },\n externalLinkTarget: {\n /** @type {number} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n highlightEditorColors: {\n /** @type {string} */\n value:\n \"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,\" +\n \"yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n historyUpdateUrl: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n ignoreDestinationZoom: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n imageResourcesPath: {\n /** @type {string} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/images/\"\n : \"./images/\",\n kind: OptionKind.VIEWER,\n },\n maxCanvasPixels: {\n /** @type {number} */\n value: 2 ** 25,\n kind: OptionKind.VIEWER,\n },\n minDurationToUpdateCanvas: {\n /** @type {number} */\n value: 500, // ms\n kind: OptionKind.VIEWER,\n },\n forcePageColors: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n pageColorsBackground: {\n /** @type {string} */\n value: \"Canvas\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n pageColorsForeground: {\n /** @type {string} */\n value: \"CanvasText\",\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n pdfBugEnabled: {\n /** @type {boolean} */\n value: typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n printResolution: {\n /** @type {number} */\n value: 150,\n kind: OptionKind.VIEWER,\n },\n sidebarViewOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n scrollModeOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n spreadModeOnLoad: {\n /** @type {number} */\n value: -1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n textLayerMode: {\n /** @type {number} */\n value: 1,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n viewerCssTheme: {\n /** @type {number} */\n value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\") ? 2 : 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n viewOnLoad: {\n /** @type {boolean} */\n value: 0,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n\n cMapPacked: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API,\n },\n cMapUrl: {\n /** @type {string} */\n value:\n // eslint-disable-next-line no-nested-ternary\n typeof PDFJSDev === \"undefined\"\n ? \"../external/bcmaps/\"\n : PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/cmaps/\"\n : \"../web/cmaps/\",\n kind: OptionKind.API,\n },\n disableAutoFetch: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableFontFace: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableRange: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n disableStream: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n docBaseUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\"\n ? // NOTE: We cannot use the `updateUrlHash` function here, because of\n // the default preferences generation (see `gulpfile.mjs`).\n // However, the following line is *only* used in development mode.\n document.URL.split(\"#\", 1)[0]\n : \"\",\n kind: OptionKind.API,\n },\n enableHWA: {\n /** @type {boolean} */\n value: typeof PDFJSDev !== \"undefined\" && !PDFJSDev.test(\"MOZCENTRAL\"),\n kind: OptionKind.API + OptionKind.VIEWER + OptionKind.PREFERENCE,\n },\n enableXfa: {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.API + OptionKind.PREFERENCE,\n },\n fontExtraProperties: {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.API,\n },\n iccUrl: {\n /** @type {string} */\n value:\n // eslint-disable-next-line no-nested-ternary\n typeof PDFJSDev === \"undefined\"\n ? \"../external/iccs/\"\n : PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/iccs/\"\n : \"../web/iccs/\",\n kind: OptionKind.API,\n },\n 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 useSystemFonts: {\n // On Android, there is almost no chance to have the font we want so we\n // don't use the system fonts in this case (bug 1882613).\n /** @type {boolean|undefined} */\n value: (\n typeof PDFJSDev === \"undefined\"\n ? window.isGECKOVIEW\n : PDFJSDev.test(\"GECKOVIEW\")\n )\n ? false\n : undefined,\n kind: OptionKind.API,\n type: Type.BOOLEAN + Type.UNDEFINED,\n },\n verbosity: {\n /** @type {number} */\n value: 1,\n kind: OptionKind.API,\n },\n wasmUrl: {\n /** @type {string} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/web/wasm/\"\n : \"../web/wasm/\",\n kind: OptionKind.API,\n },\n\n workerPort: {\n /** @type {Object} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")\n ? globalThis.pdfjsPreloadedWorker || null\n : null,\n kind: OptionKind.WORKER,\n },\n workerSrc: {\n /** @type {string} */\n value:\n // eslint-disable-next-line no-nested-ternary\n typeof PDFJSDev === \"undefined\"\n ? \"../src/pdf.worker.js\"\n : PDFJSDev.test(\"MOZCENTRAL\")\n ? \"resource://pdf.js/build/pdf.worker.mjs\"\n : \"../build/pdf.worker.mjs\",\n kind: OptionKind.WORKER,\n },\n};\nif (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n defaultOptions.defaultUrl = {\n /** @type {string} */\n value:\n typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"CHROME\")\n ? \"\"\n : \"compressed.tracemonkey-pldi-09.pdf\",\n kind: OptionKind.VIEWER,\n };\n defaultOptions.sandboxBundleSrc = {\n /** @type {string} */\n value:\n typeof PDFJSDev === \"undefined\"\n ? \"../build/dev-sandbox/pdf.sandbox.mjs\"\n : \"../build/pdf.sandbox.mjs\",\n kind: OptionKind.VIEWER,\n };\n defaultOptions.enableFakeMLManager = {\n /** @type {boolean} */\n value: true,\n kind: OptionKind.VIEWER,\n };\n}\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n defaultOptions.disablePreferences = {\n /** @type {boolean} */\n value: typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\"),\n kind: OptionKind.VIEWER,\n };\n} else if (PDFJSDev.test(\"CHROME\")) {\n defaultOptions.disableTelemetry = {\n /** @type {boolean} */\n value: false,\n kind: OptionKind.VIEWER + OptionKind.PREFERENCE,\n };\n}\n\nif (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING || LIB\")) {\n // Ensure that the `defaultOptions` are correctly specified.\n for (const name in defaultOptions) {\n const { value, kind, type } = defaultOptions[name];\n\n if (kind & OptionKind.PREFERENCE) {\n if (kind === OptionKind.PREFERENCE) {\n throw new Error(`Cannot use only \"PREFERENCE\" kind: ${name}`);\n }\n if (kind & OptionKind.BROWSER) {\n throw new Error(`Cannot mix \"PREFERENCE\" and \"BROWSER\" kind: ${name}`);\n }\n if (type !== undefined) {\n throw new Error(\n `Cannot have \\`type\\`-field for \"PREFERENCE\" kind: ${name}`\n );\n }\n if (typeof compatParams === \"object\" && compatParams.has(name)) {\n throw new Error(\n `Should not have compatibility-value for \"PREFERENCE\" kind: ${name}`\n );\n }\n // Only \"simple\" preference-values are allowed.\n if (\n typeof value !== \"boolean\" &&\n typeof value !== \"string\" &&\n !Number.isInteger(value)\n ) {\n throw new Error(`Invalid value for \"PREFERENCE\" kind: ${name}`);\n }\n } else if (kind & OptionKind.BROWSER) {\n if (type !== undefined) {\n throw new Error(\n `Cannot have \\`type\\`-field for \"BROWSER\" kind: ${name}`\n );\n }\n if (typeof compatParams === \"object\" && compatParams.has(name)) {\n throw new Error(\n `Should not have compatibility-value for \"BROWSER\" kind: ${name}`\n );\n }\n if (value === undefined) {\n throw new Error(`Invalid value for \"BROWSER\" kind: ${name}`);\n }\n }\n }\n}\n\nclass AppOptions {\n static eventBus;\n\n static #opts = new Map();\n\n static {\n // Initialize all the user-options.\n for (const name in defaultOptions) {\n this.#opts.set(name, defaultOptions[name].value);\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n // Apply any compatibility-values to the user-options.\n for (const [name, value] of compatParams) {\n this.#opts.set(name, value);\n }\n this._hasInvokedSet = false;\n\n this._checkDisablePreferences = () => {\n if (this.get(\"disablePreferences\")) {\n // Give custom implementations of the default viewer a simpler way to\n // opt-out of having the `Preferences` override existing `AppOptions`.\n return true;\n }\n if (this._hasInvokedSet) {\n console.warn(\n \"The Preferences may override manually set AppOptions; \" +\n 'please use the \"disablePreferences\"-option to prevent that.'\n );\n }\n return false;\n };\n }\n }\n\n constructor() {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n throw new Error(\"Cannot initialize AppOptions.\");\n }\n }\n\n static get(name) {\n return this.#opts.get(name);\n }\n\n static getAll(kind = null, defaultOnly = false) {\n const options = Object.create(null);\n for (const name in defaultOptions) {\n const defaultOpt = defaultOptions[name];\n\n if (kind && !(kind & defaultOpt.kind)) {\n continue;\n }\n options[name] = !defaultOnly ? this.#opts.get(name) : defaultOpt.value;\n }\n return options;\n }\n\n static set(name, value) {\n this.setAll({ [name]: value });\n }\n\n static setAll(options, prefs = false) {\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this._hasInvokedSet ||= true;\n }\n let events;\n\n for (const name in options) {\n const defaultOpt = defaultOptions[name],\n userOpt = options[name];\n\n if (\n !defaultOpt ||\n !(\n typeof userOpt === typeof defaultOpt.value ||\n Type[(typeof userOpt).toUpperCase()] & defaultOpt.type\n )\n ) {\n continue;\n }\n const { kind } = defaultOpt;\n\n if (\n prefs &&\n !(kind & OptionKind.BROWSER || kind & OptionKind.PREFERENCE)\n ) {\n continue;\n }\n if (this.eventBus && kind & OptionKind.EVENT_DISPATCH) {\n (events ||= new Map()).set(name, userOpt);\n }\n this.#opts.set(name, userOpt);\n }\n\n if (events) {\n for (const [name, value] of events) {\n this.eventBus.dispatch(name.toLowerCase(), { source: this, value });\n }\n }\n }\n}\n\nexport { AppOptions, OptionKind };\n","/* Copyright 2025 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AnnotationType, createValidAbsoluteUrl, Util } from \"pdfjs-lib\";\nimport { getOriginalIndex, normalize } from \"./pdf_find_controller.js\";\n\nfunction DOMRectToPDF({ width, height, left, top }, pdfPageView) {\n if (width === 0 || height === 0) {\n return null;\n }\n\n const pageBox = pdfPageView.textLayer.div.getBoundingClientRect();\n const bottomLeft = pdfPageView.getPagePoint(\n left - pageBox.left,\n top - pageBox.top\n );\n const topRight = pdfPageView.getPagePoint(\n left - pageBox.left + width,\n top - pageBox.top + height\n );\n\n return Util.normalizeRect([\n bottomLeft[0],\n bottomLeft[1],\n topRight[0],\n topRight[1],\n ]);\n}\n\nfunction calculateLinkPosition(range, pdfPageView) {\n const rangeRects = range.getClientRects();\n if (rangeRects.length === 1) {\n return { rect: DOMRectToPDF(rangeRects[0], pdfPageView) };\n }\n\n const rect = [Infinity, Infinity, -Infinity, -Infinity];\n const quadPoints = [];\n let i = 0;\n for (const domRect of rangeRects) {\n const normalized = DOMRectToPDF(domRect, pdfPageView);\n if (normalized === null) {\n continue;\n }\n\n quadPoints[i] = quadPoints[i + 4] = normalized[0];\n quadPoints[i + 1] = quadPoints[i + 3] = normalized[3];\n quadPoints[i + 2] = quadPoints[i + 6] = normalized[2];\n quadPoints[i + 5] = quadPoints[i + 7] = normalized[1];\n\n Util.rectBoundingBox(...normalized, rect);\n i += 8;\n }\n return { quadPoints, rect };\n}\n\n/**\n * Given a DOM node `container` and an index into its text contents `offset`,\n * returns a pair consisting of text node that the `offset` actually points\n * to, together with the offset relative to that text node.\n * When the offset points at the boundary between two node, the result will\n * point to the first text node in depth-first traversal order.\n *\n * For example, given this DOM:\n *

abcdefghi

\n *\n * textPosition(p, 0) -> [#text \"abc\", 0] (before `a`)\n * textPosition(p, 2) -> [#text \"abc\", 2] (between `b` and `c`)\n * textPosition(p, 3) -> [#text \"abc\", 3] (after `c`)\n * textPosition(p, 5) -> [#text \"def\", 2] (between `e` and `f`)\n * textPosition(p, 6) -> [#text \"def\", 3] (after `f`)\n */\nfunction textPosition(container, offset) {\n let currentContainer = container;\n do {\n if (currentContainer.nodeType === Node.TEXT_NODE) {\n const currentLength = currentContainer.textContent.length;\n if (offset <= currentLength) {\n return [currentContainer, offset];\n }\n offset -= currentLength;\n } else if (currentContainer.firstChild) {\n currentContainer = currentContainer.firstChild;\n continue;\n }\n\n while (!currentContainer.nextSibling && currentContainer !== container) {\n currentContainer = currentContainer.parentNode;\n }\n if (currentContainer !== container) {\n currentContainer = currentContainer.nextSibling;\n }\n } while (currentContainer !== container);\n throw new Error(\"Offset is bigger than container's contents length.\");\n}\n\nfunction createLinkAnnotation({ url, index, length }, pdfPageView, id) {\n const highlighter = pdfPageView._textHighlighter;\n const [{ begin, end }] = highlighter._convertMatches([index], [length]);\n\n const range = new Range();\n range.setStart(\n ...textPosition(highlighter.textDivs[begin.divIdx], begin.offset)\n );\n range.setEnd(...textPosition(highlighter.textDivs[end.divIdx], end.offset));\n\n return {\n id: `inferred_link_${id}`,\n unsafeUrl: url,\n url,\n annotationType: AnnotationType.LINK,\n rotation: 0,\n ...calculateLinkPosition(range, pdfPageView),\n // Populated in the annotationLayer to avoid unnecessary object creation,\n // since most inferred links overlap existing LinkAnnotations:\n borderStyle: null,\n };\n}\n\nclass Autolinker {\n static #index = 0;\n\n static #regex;\n\n static findLinks(text) {\n // Regex can be tested and verified at https://regex101.com/r/rXoLiT/2.\n this.#regex ??=\n /\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\S--[\\p{P}<>]]|\\/|[\\S--[\\[\\]]]+[\\S--[\\p{P}<>]])+|\\b[\\S--[@\\p{Ps}\\p{Pe}<>]]+@([\\S--[\\p{P}<>]]+(?:\\.[\\S--[\\p{P}<>]]+)+)/gmv;\n\n const [normalizedText, diffs] = normalize(text, { ignoreDashEOL: true });\n const matches = normalizedText.matchAll(this.#regex);\n const links = [];\n for (const match of matches) {\n const [url, emailDomain] = match;\n let raw;\n if (\n url.startsWith(\"www.\") ||\n url.startsWith(\"http://\") ||\n url.startsWith(\"https://\")\n ) {\n raw = url;\n } else if (URL.canParse(`http://${emailDomain}`)) {\n raw = url.startsWith(\"mailto:\") ? url : `mailto:${url}`;\n } else {\n continue;\n }\n const absoluteURL = createValidAbsoluteUrl(raw, null, {\n addDefaultProtocol: true,\n });\n if (absoluteURL) {\n const [index, length] = getOriginalIndex(\n diffs,\n match.index,\n url.length\n );\n links.push({ url: absoluteURL.href, index, length });\n }\n }\n return links;\n }\n\n static processLinks(pdfPageView) {\n return this.findLinks(\n pdfPageView._textHighlighter.textContentItemsStr.join(\"\\n\")\n ).map(link => createLinkAnnotation(link, pdfPageView, this.#index++));\n }\n}\n\nexport { Autolinker };\n","/* Copyright 2012 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { RenderingCancelledException } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\nclass BasePDFPageView {\n #loadingId = null;\n\n #minDurationToUpdateCanvas = 0;\n\n #renderError = null;\n\n #renderingState = RenderingStates.INITIAL;\n\n #showCanvas = null;\n\n #startTime = 0;\n\n #tempCanvas = null;\n\n canvas = null;\n\n /** @type {null | HTMLDivElement} */\n div = null;\n\n eventBus = null;\n\n id = null;\n\n pageColors = null;\n\n renderingQueue = null;\n\n renderTask = null;\n\n resume = null;\n\n constructor(options) {\n this.eventBus = options.eventBus;\n this.id = options.id;\n this.pageColors = options.pageColors || null;\n this.renderingQueue = options.renderingQueue;\n this.#minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500;\n }\n\n get renderingState() {\n return this.#renderingState;\n }\n\n set renderingState(state) {\n if (state === this.#renderingState) {\n return;\n }\n this.#renderingState = state;\n\n if (this.#loadingId) {\n clearTimeout(this.#loadingId);\n this.#loadingId = null;\n }\n\n switch (state) {\n case RenderingStates.PAUSED:\n this.div.classList.remove(\"loading\");\n // Display the canvas as it has been drawn.\n this.#startTime = 0;\n this.#showCanvas?.(false);\n break;\n case RenderingStates.RUNNING:\n this.div.classList.add(\"loadingIcon\");\n this.#loadingId = setTimeout(() => {\n // Adding the loading class is slightly postponed in order to not have\n // it with loadingIcon.\n // If we don't do that the visibility of the background is changed but\n // the transition isn't triggered.\n this.div.classList.add(\"loading\");\n this.#loadingId = null;\n }, 0);\n this.#startTime = Date.now();\n break;\n case RenderingStates.INITIAL:\n case RenderingStates.FINISHED:\n this.div.classList.remove(\"loadingIcon\", \"loading\");\n this.#startTime = 0;\n break;\n }\n }\n\n _createCanvas(onShow, hideUntilComplete = false) {\n const { pageColors } = this;\n const hasHCM = !!(pageColors?.background && pageColors?.foreground);\n const prevCanvas = this.canvas;\n\n // In HCM, a final filter is applied on the canvas which means that\n // before it's applied we've normal colors. Consequently, to avoid to\n // have a final flash we just display it once all the drawing is done.\n const updateOnFirstShow = !prevCanvas && !hasHCM && !hideUntilComplete;\n\n let canvas = (this.canvas = document.createElement(\"canvas\"));\n\n this.#showCanvas = isLastShow => {\n if (updateOnFirstShow) {\n let tempCanvas = this.#tempCanvas;\n if (!isLastShow && this.#minDurationToUpdateCanvas > 0) {\n // We draw on the canvas at 60fps (in using `requestAnimationFrame`),\n // so if the canvas is large, updating it at 60fps can be a way too\n // much and can cause some serious performance issues.\n // To avoid that we only update the canvas every\n // `this.#minDurationToUpdateCanvas` ms.\n\n if (Date.now() - this.#startTime < this.#minDurationToUpdateCanvas) {\n return;\n }\n if (!tempCanvas) {\n tempCanvas = this.#tempCanvas = canvas;\n canvas = this.canvas = canvas.cloneNode(false);\n onShow(canvas);\n }\n }\n\n if (tempCanvas) {\n const ctx = canvas.getContext(\"2d\", {\n alpha: false,\n });\n ctx.drawImage(tempCanvas, 0, 0);\n if (isLastShow) {\n this.#resetTempCanvas();\n } else {\n this.#startTime = Date.now();\n }\n return;\n }\n\n // Don't add the canvas until the first draw callback, or until\n // drawing is complete when `!this.renderingQueue`, to prevent black\n // flickering.\n onShow(canvas);\n this.#showCanvas = null;\n return;\n }\n if (!isLastShow) {\n return;\n }\n\n if (prevCanvas) {\n prevCanvas.replaceWith(canvas);\n prevCanvas.width = prevCanvas.height = 0;\n } else {\n onShow(canvas);\n }\n };\n\n return { canvas, prevCanvas };\n }\n\n #renderContinueCallback = cont => {\n this.#showCanvas?.(false);\n if (this.renderingQueue && !this.renderingQueue.isHighestPriority(this)) {\n this.renderingState = RenderingStates.PAUSED;\n this.resume = () => {\n this.renderingState = RenderingStates.RUNNING;\n cont();\n };\n return;\n }\n cont();\n };\n\n _resetCanvas() {\n const { canvas } = this;\n if (!canvas) {\n return;\n }\n canvas.remove();\n canvas.width = canvas.height = 0;\n this.canvas = null;\n this.#resetTempCanvas();\n }\n\n #resetTempCanvas() {\n if (this.#tempCanvas) {\n this.#tempCanvas.width = this.#tempCanvas.height = 0;\n this.#tempCanvas = null;\n }\n }\n\n async _drawCanvas(options, onCancel, onFinish) {\n const renderTask = (this.renderTask = this.pdfPage.render(options));\n renderTask.onContinue = this.#renderContinueCallback;\n renderTask.onError = error => {\n if (error instanceof RenderingCancelledException) {\n onCancel();\n this.#renderError = null;\n }\n };\n\n let error = null;\n try {\n await renderTask.promise;\n this.#showCanvas?.(true);\n } catch (e) {\n // When zooming with a `drawingDelay` set, avoid temporarily showing\n // a black canvas if rendering was cancelled before the `onContinue`-\n // callback had been invoked at least once.\n if (e instanceof RenderingCancelledException) {\n return;\n }\n error = e;\n\n this.#showCanvas?.(true);\n } finally {\n this.#renderError = error;\n\n // The renderTask may have been replaced by a new one, so only remove\n // the reference to the renderTask if it matches the one that is\n // triggering this callback.\n if (renderTask === this.renderTask) {\n this.renderTask = null;\n }\n }\n this.renderingState = RenderingStates.FINISHED;\n\n onFinish(renderTask);\n\n if (error) {\n throw error;\n }\n }\n\n cancelRendering({ cancelExtraDelay = 0 } = {}) {\n if (this.renderTask) {\n this.renderTask.cancel(cancelExtraDelay);\n this.renderTask = null;\n }\n this.resume = null;\n }\n\n dispatchPageRender() {\n this.eventBus.dispatch(\"pagerender\", {\n source: this,\n pageNumber: this.id,\n });\n }\n\n dispatchPageRendered(cssTransform, isDetailView) {\n this.eventBus.dispatch(\"pagerendered\", {\n source: this,\n pageNumber: this.id,\n cssTransform,\n isDetailView,\n timestamp: performance.now(),\n error: this.#renderError,\n });\n }\n}\n\nexport { BasePDFPageView };\n","/* Copyright 2022 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DrawLayer } from \"pdfjs-lib\";\n\n/**\n * @typedef {Object} DrawLayerBuilderOptions\n * @property {number} pageIndex\n */\n\n/**\n * @typedef {Object} DrawLayerBuilderRenderOptions\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass DrawLayerBuilder {\n #drawLayer = null;\n\n /**\n * @param {DrawLayerBuilderOptions} options\n */\n constructor(options) {\n this.pageIndex = options.pageIndex;\n }\n\n /**\n * @param {DrawLayerBuilderRenderOptions} options\n * @returns {Promise}\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\nimport { BasePDFPageView } from \"./base_pdf_page_view.js\";\nimport { OutputScale } from \"pdfjs-lib\";\nimport { RenderingStates } from \"./ui_utils.js\";\n\n/** @typedef {import(\"./interfaces\").IRenderableView} IRenderableView */\n\n/**\n * @implements {IRenderableView}\n */\nclass PDFPageDetailView extends BasePDFPageView {\n #detailArea = null;\n\n /**\n * @type {boolean} True when the last rendering attempt of the view was\n * cancelled due to a `.reset()` call. This will happen when\n * the visible area changes so much during the rendering that\n * we need to cancel the rendering and start over.\n */\n renderingCancelled = false;\n\n constructor({ pageView }) {\n super(pageView);\n\n this.pageView = pageView;\n this.renderingId = \"detail\" + this.id;\n\n this.div = pageView.div;\n }\n\n setPdfPage(pdfPage) {\n this.pageView.setPdfPage(pdfPage);\n }\n\n get pdfPage() {\n return this.pageView.pdfPage;\n }\n\n get renderingState() {\n return super.renderingState;\n }\n\n set renderingState(value) {\n this.renderingCancelled = false;\n super.renderingState = value;\n }\n\n reset({ keepCanvas = false } = {}) {\n const renderingCancelled =\n this.renderingCancelled ||\n this.renderingState === RenderingStates.RUNNING ||\n this.renderingState === RenderingStates.PAUSED;\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n this.renderingCancelled = renderingCancelled;\n\n if (!keepCanvas) {\n this._resetCanvas();\n }\n }\n\n #shouldRenderDifferentArea(visibleArea) {\n if (!this.#detailArea) {\n return true;\n }\n\n const minDetailX = this.#detailArea.minX;\n const minDetailY = this.#detailArea.minY;\n const maxDetailX = this.#detailArea.width + minDetailX;\n const maxDetailY = this.#detailArea.height + minDetailY;\n\n if (\n visibleArea.minX < minDetailX ||\n visibleArea.minY < minDetailY ||\n visibleArea.maxX > maxDetailX ||\n visibleArea.maxY > maxDetailY\n ) {\n return true;\n }\n\n const {\n width: maxWidth,\n height: maxHeight,\n scale,\n } = this.pageView.viewport;\n\n if (this.#detailArea.scale !== scale) {\n return true;\n }\n\n const paddingLeftSize = visibleArea.minX - minDetailX;\n const paddingRightSize = maxDetailX - visibleArea.maxX;\n const paddingTopSize = visibleArea.minY - minDetailY;\n const paddingBottomSize = maxDetailY - visibleArea.maxY;\n\n // If the user is moving in any direction such that the remaining area\n // rendered outside of the screen is less than MOVEMENT_THRESHOLD of the\n // padding we render on each side, trigger a re-render. This is so that if\n // the user then keeps scrolling in that direction, we have a chance of\n // finishing rendering the new detail before they get past the rendered\n // area.\n\n const MOVEMENT_THRESHOLD = 0.5;\n const ratio = (1 + MOVEMENT_THRESHOLD) / MOVEMENT_THRESHOLD;\n\n if (\n (minDetailX > 0 && paddingRightSize / paddingLeftSize > ratio) ||\n (maxDetailX < maxWidth && paddingLeftSize / paddingRightSize > ratio) ||\n (minDetailY > 0 && paddingBottomSize / paddingTopSize > ratio) ||\n (maxDetailY < maxHeight && paddingTopSize / paddingBottomSize > ratio)\n ) {\n return true;\n }\n\n return false;\n }\n\n update({ visibleArea = null, underlyingViewUpdated = false } = {}) {\n if (underlyingViewUpdated) {\n this.cancelRendering();\n this.renderingState = RenderingStates.INITIAL;\n return;\n }\n\n if (!this.#shouldRenderDifferentArea(visibleArea)) {\n return;\n }\n\n const { viewport, maxCanvasPixels, capCanvasAreaFactor } = this.pageView;\n\n const visibleWidth = visibleArea.maxX - visibleArea.minX;\n const visibleHeight = visibleArea.maxY - visibleArea.minY;\n\n // \"overflowScale\" represents which percentage of the width and of the\n // height the detail area extends outside of the visible area. We want to\n // draw a larger area so that we don't have to constantly re-draw while\n // scrolling. The detail area's dimensions thus become\n // visibleLength * (2 * overflowScale + 1).\n // We default to adding a whole height/length of detail area on each side,\n // but we can reduce it to make sure that we stay within the maxCanvasPixels\n // limit.\n const visiblePixels =\n visibleWidth * visibleHeight * OutputScale.pixelRatio ** 2;\n const maxDetailToVisibleLinearRatio = Math.sqrt(\n OutputScale.capPixels(maxCanvasPixels, capCanvasAreaFactor) /\n visiblePixels\n );\n const maxOverflowScale = (maxDetailToVisibleLinearRatio - 1) / 2;\n let overflowScale = Math.min(1, maxOverflowScale);\n if (overflowScale < 0) {\n overflowScale = 0;\n // In this case, we render a detail view that is exactly as big as the\n // visible area, but we ignore the .maxCanvasPixels limit.\n // TODO: We should probably instead give up and not render the detail view\n // in this case. It's quite rare to hit it though, because usually\n // .maxCanvasPixels will at least have enough pixels to cover the visible\n // screen.\n }\n\n const overflowWidth = visibleWidth * overflowScale;\n const overflowHeight = visibleHeight * overflowScale;\n\n const minX = Math.max(0, visibleArea.minX - overflowWidth);\n const maxX = Math.min(viewport.width, visibleArea.maxX + overflowWidth);\n const minY = Math.max(0, visibleArea.minY - overflowHeight);\n const maxY = Math.min(viewport.height, visibleArea.maxY + overflowHeight);\n const width = maxX - minX;\n const height = maxY - minY;\n\n this.#detailArea = { minX, minY, width, height, scale: viewport.scale };\n\n this.reset({ keepCanvas: true });\n }\n\n async draw() {\n // The PDFPageView might have already dropped this PDFPageDetailView. In\n // that case, simply do nothing.\n if (this.pageView.detailView !== this) {\n return undefined;\n }\n\n // If there is already the lower resolution canvas behind,\n // we don't show the new one until when it's fully ready.\n const hideUntilComplete =\n this.pageView.renderingState === RenderingStates.FINISHED ||\n this.renderingState === RenderingStates.FINISHED;\n\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error(\"Must be in new state before drawing\");\n this.reset(); // Ensure that we reset all state to prevent issues.\n }\n const { div, pdfPage, viewport } = this.pageView;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error(\"pdfPage is not loaded\");\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n const canvasWrapper = this.pageView._ensureCanvasWrapper();\n\n const { canvas, prevCanvas } = this._createCanvas(newCanvas => {\n // If there is already the background canvas, inject this new canvas\n // after it. We cannot simply use .append because all canvases must\n // be before the SVG elements used for drawings.\n if (canvasWrapper.firstElementChild?.tagName === \"CANVAS\") {\n canvasWrapper.firstElementChild.after(newCanvas);\n } else {\n canvasWrapper.prepend(newCanvas);\n }\n }, hideUntilComplete);\n canvas.setAttribute(\"aria-hidden\", \"true\");\n\n const { width, height } = viewport;\n\n const area = this.#detailArea;\n\n const { pixelRatio } = OutputScale;\n const transform = [\n pixelRatio,\n 0,\n 0,\n pixelRatio,\n -area.minX * pixelRatio,\n -area.minY * pixelRatio,\n ];\n\n canvas.width = area.width * pixelRatio;\n canvas.height = area.height * pixelRatio;\n const { style } = canvas;\n style.width = `${(area.width * 100) / width}%`;\n style.height = `${(area.height * 100) / height}%`;\n style.top = `${(area.minY * 100) / height}%`;\n style.left = `${(area.minX * 100) / width}%`;\n\n const renderingPromise = this._drawCanvas(\n this.pageView._getRenderingContext(canvas, transform),\n () => {\n // If the rendering is cancelled, keep the old canvas visible.\n this.canvas?.remove();\n this.canvas = prevCanvas;\n },\n () => {\n this.dispatchPageRendered(\n /* cssTransform */ false,\n /* isDetailView */ true\n );\n }\n );\n\n div.setAttribute(\"data-loaded\", true);\n\n this.dispatchPageRender();\n\n return renderingPromise;\n }\n}\n\nexport { PDFPageDetailView };\n","/* Copyright 2021 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n\nimport { 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 H: \"heading\",\n Title: null,\n FENote: \"note\",\n // Sub-block level structure type\n Sub: \"group\",\n // General inline level structure types\n Lbl: null,\n Span: null,\n Em: null,\n Strong: null,\n Link: \"link\",\n Annot: \"note\",\n Form: \"form\",\n // Ruby and Warichu structure types\n Ruby: null,\n RB: null,\n RT: null,\n RP: null,\n Warichu: null,\n WT: null,\n WP: null,\n // List standard structure types\n L: \"list\",\n LI: \"listitem\",\n LBody: null,\n // Table standard structure types\n Table: \"table\",\n TR: \"row\",\n TH: \"columnheader\",\n TD: \"cell\",\n THead: \"columnheader\",\n TBody: null,\n TFoot: null,\n // Standard structure type Caption\n Caption: null,\n // Standard structure type Figure\n Figure: \"figure\",\n // Standard structure type Formula\n Formula: null,\n // standard structure type Artifact\n Artifact: null,\n};\n\nconst HEADING_PATTERN = /^H(\\d+)$/;\n\n/**\n * @typedef {Object} StructTreeLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {Object} rawDims\n */\n\nclass StructTreeLayerBuilder {\n #promise;\n\n #treeDom = null;\n\n #treePromise;\n\n #elementAttributes = new Map();\n\n #rawDims;\n\n #elementsToAddToTextLayer = null;\n\n /**\n * @param {StructTreeLayerBuilderOptions} options\n */\n constructor(pdfPage, rawDims) {\n this.#promise = pdfPage.getStructTree();\n this.#rawDims = rawDims;\n }\n\n /**\n * @returns {Promise}\n */\n async render() {\n if (this.#treePromise) {\n return this.#treePromise;\n }\n const { promise, resolve, reject } = Promise.withResolvers();\n this.#treePromise = promise;\n\n try {\n this.#treeDom = this.#walk(await this.#promise);\n } catch (ex) {\n reject(ex);\n }\n this.#promise = null;\n\n this.#treeDom?.classList.add(\"structTree\");\n resolve(this.#treeDom);\n\n return promise;\n }\n\n async getAriaAttributes(annotationId) {\n try {\n await this.render();\n return this.#elementAttributes.get(annotationId);\n } catch {\n // If the structTree cannot be fetched, parsed, and/or rendered,\n // ensure that e.g. the AnnotationLayer won't break completely.\n }\n return null;\n }\n\n hide() {\n if (this.#treeDom && !this.#treeDom.hidden) {\n this.#treeDom.hidden = true;\n }\n }\n\n show() {\n if (this.#treeDom?.hidden) {\n this.#treeDom.hidden = false;\n }\n }\n\n #setAttributes(structElement, htmlElement) {\n const { alt, id, lang } = structElement;\n if (alt !== undefined) {\n // Don't add the label in the struct tree layer but on the annotation\n // in the annotation layer.\n let added = false;\n const label = removeNullCharacters(alt);\n for (const child of structElement.children) {\n if (child.type === \"annotation\") {\n let attrs = this.#elementAttributes.get(child.id);\n if (!attrs) {\n attrs = new Map();\n this.#elementAttributes.set(child.id, attrs);\n }\n attrs.set(\"aria-label\", label);\n added = true;\n }\n }\n if (!added) {\n htmlElement.setAttribute(\"aria-label\", label);\n }\n }\n if (id !== undefined) {\n htmlElement.setAttribute(\"aria-owns\", id);\n }\n if (lang !== undefined) {\n htmlElement.setAttribute(\n \"lang\",\n removeNullCharacters(lang, /* replaceInvisible = */ true)\n );\n }\n }\n\n #addImageInTextLayer(node, element) {\n const { alt, bbox, children } = node;\n const child = children?.[0];\n if (!this.#rawDims || !alt || !bbox || child?.type !== \"content\") {\n return false;\n }\n\n const { id } = child;\n if (!id) {\n return false;\n }\n\n // We cannot add the created element to the text layer immediately, as the\n // text layer might not be ready yet. Instead, we store the element and add\n // it later in `addElementsToTextLayer`.\n\n element.setAttribute(\"aria-owns\", id);\n const img = document.createElement(\"span\");\n (this.#elementsToAddToTextLayer ||= new Map()).set(id, img);\n img.setAttribute(\"role\", \"img\");\n img.setAttribute(\"aria-label\", removeNullCharacters(alt));\n\n const { pageHeight, pageX, pageY } = this.#rawDims;\n const calc = \"calc(var(--total-scale-factor) *\";\n const { style } = img;\n style.width = `${calc}${bbox[2] - bbox[0]}px)`;\n style.height = `${calc}${bbox[3] - bbox[1]}px)`;\n style.left = `${calc}${bbox[0] - pageX}px)`;\n style.top = `${calc}${pageHeight - bbox[3] + pageY}px)`;\n\n return true;\n }\n\n addElementsToTextLayer() {\n if (!this.#elementsToAddToTextLayer) {\n return;\n }\n for (const [id, img] of this.#elementsToAddToTextLayer) {\n document.getElementById(id)?.append(img);\n }\n this.#elementsToAddToTextLayer.clear();\n this.#elementsToAddToTextLayer = null;\n }\n\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 if (role === \"Figure\" && this.#addImageInTextLayer(node, element)) {\n return element;\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 #eventAbortController = null;\n\n /**\n * @param {TextHighlighterOptions} options\n */\n constructor({ findController, eventBus, pageIndex }) {\n this.findController = findController;\n this.matches = [];\n this.eventBus = eventBus;\n this.pageIdx = pageIndex;\n this.textDivs = null;\n this.textContentItemsStr = null;\n this.enabled = false;\n }\n\n /**\n * Store two arrays that will map DOM nodes to text they should contain.\n * The arrays should be of equal length and the array element at each index\n * should correspond to the other. e.g.\n * `items[0] = \"Item 0\" and texts[0] = \"Item 0\";\n *\n * @param {Array} divs\n * @param {Array} texts\n */\n setTextMapping(divs, texts) {\n this.textDivs = divs;\n this.textContentItemsStr = texts;\n }\n\n /**\n * Start listening for events to update the highlighter and check if there are\n * any current matches that need be highlighted.\n */\n enable() {\n if (!this.textDivs || !this.textContentItemsStr) {\n throw new Error(\"Text divs and strings have not been set.\");\n }\n if (this.enabled) {\n throw new Error(\"TextHighlighter is already enabled.\");\n }\n this.enabled = true;\n\n if (!this.#eventAbortController) {\n this.#eventAbortController = new AbortController();\n\n this.eventBus._on(\n \"updatetextlayermatches\",\n evt => {\n if (evt.pageIndex === this.pageIdx || evt.pageIndex === -1) {\n this._updateMatches();\n }\n },\n { signal: this.#eventAbortController.signal }\n );\n }\n this._updateMatches();\n }\n\n disable() {\n if (!this.enabled) {\n return;\n }\n this.enabled = false;\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n\n this._updateMatches(/* reset = */ true);\n }\n\n _convertMatches(matches, matchesLength) {\n // Early exit if there is nothing to convert.\n if (!matches) {\n return [];\n }\n const { textContentItemsStr } = this;\n\n let i = 0,\n iIndex = 0;\n const end = textContentItemsStr.length - 1;\n const result = [];\n\n for (let m = 0, mm = matches.length; m < mm; m++) {\n // Calculate the start position.\n let matchIdx = matches[m];\n\n // Loop over the divIdxs.\n while (i !== end && matchIdx >= iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n if (i === textContentItemsStr.length) {\n console.error(\"Could not find a matching mapping\");\n }\n\n const match = {\n begin: {\n divIdx: i,\n offset: matchIdx - iIndex,\n },\n };\n\n // Calculate the end position.\n matchIdx += matchesLength[m];\n\n // Somewhat the same array as above, but use > instead of >= to get\n // the end position right.\n while (i !== end && matchIdx > iIndex + textContentItemsStr[i].length) {\n iIndex += textContentItemsStr[i].length;\n i++;\n }\n\n match.end = {\n divIdx: i,\n offset: matchIdx - iIndex,\n };\n result.push(match);\n }\n return result;\n }\n\n _renderMatches(matches) {\n // Early exit if there is nothing to render.\n if (matches.length === 0) {\n return;\n }\n const { findController, pageIdx } = this;\n const { textContentItemsStr, textDivs } = this;\n\n const isSelectedPage = pageIdx === findController.selected.pageIdx;\n const selectedMatchIdx = findController.selected.matchIdx;\n const highlightAll = findController.state.highlightAll;\n let prevEnd = null;\n const infinity = {\n divIdx: -1,\n offset: undefined,\n };\n\n function beginText(begin, className) {\n const divIdx = begin.divIdx;\n textDivs[divIdx].textContent = \"\";\n return appendTextToDiv(divIdx, 0, begin.offset, className);\n }\n\n function appendTextToDiv(divIdx, fromOffset, toOffset, className) {\n let div = textDivs[divIdx];\n if (div.nodeType === Node.TEXT_NODE) {\n const span = document.createElement(\"span\");\n div.before(span);\n span.append(div);\n textDivs[divIdx] = span;\n div = span;\n }\n const content = textContentItemsStr[divIdx].substring(\n fromOffset,\n toOffset\n );\n const node = document.createTextNode(content);\n if (className) {\n const span = document.createElement(\"span\");\n span.className = `${className} appended`;\n span.append(node);\n div.append(span);\n\n if (className.includes(\"selected\")) {\n const { left } = span.getClientRects()[0];\n const parentLeft = div.getBoundingClientRect().left;\n return left - parentLeft;\n }\n return 0;\n }\n\n div.append(node);\n return 0;\n }\n\n let i0 = selectedMatchIdx,\n i1 = i0 + 1;\n if (highlightAll) {\n i0 = 0;\n i1 = matches.length;\n } else if (!isSelectedPage) {\n // Not highlighting all and this isn't the selected page, so do nothing.\n return;\n }\n\n let lastDivIdx = -1;\n let lastOffset = -1;\n for (let i = i0; i < i1; i++) {\n const match = matches[i];\n const begin = match.begin;\n if (begin.divIdx === lastDivIdx && begin.offset === lastOffset) {\n // It's possible to be in this situation if we searched for a 'f' and we\n // have a ligature 'ff' in the text. The 'ff' has to be highlighted two\n // times.\n continue;\n }\n lastDivIdx = begin.divIdx;\n lastOffset = begin.offset;\n\n const end = match.end;\n const isSelected = isSelectedPage && i === selectedMatchIdx;\n const highlightSuffix = isSelected ? \" selected\" : \"\";\n let 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/** @typedef {import(\"../src/display/api\").PDFPageProxy} PDFPageProxy */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"../src/display/display_utils\").PageViewport} PageViewport */\n/** @typedef {import(\"./text_highlighter\").TextHighlighter} TextHighlighter */\n// eslint-disable-next-line max-len\n/** @typedef {import(\"./text_accessibility.js\").TextAccessibilityManager} TextAccessibilityManager */\n\nimport { normalizeUnicode, stopEvent, TextLayer } from \"pdfjs-lib\";\nimport { removeNullCharacters } from \"./ui_utils.js\";\n\n/**\n * @typedef {Object} TextLayerBuilderOptions\n * @property {PDFPageProxy} pdfPage\n * @property {TextHighlighter} [highlighter] - Optional object that will handle\n * highlighting text from the find controller.\n * @property {TextAccessibilityManager} [accessibilityManager]\n * @property {boolean} [enablePermissions]\n * @property {function} [onAppend]\n */\n\n/**\n * @typedef {Object} TextLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {Object} [textContentParams]\n */\n\n/**\n * The text layer builder provides text selection functionality for the PDF.\n * It does this by creating overlay divs over the PDF's text. These divs\n * contain text that matches the PDF text they are overlaying.\n */\nclass TextLayerBuilder {\n #enablePermissions = false;\n\n #onAppend = null;\n\n #renderingDone = false;\n\n #textLayer = null;\n\n static #textLayers = new Map();\n\n static #selectionChangeAbortController = null;\n\n /**\n * @param {TextLayerBuilderOptions} options\n */\n constructor({\n pdfPage,\n highlighter = null,\n accessibilityManager = null,\n enablePermissions = false,\n onAppend = null,\n }) {\n this.pdfPage = pdfPage;\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 /**\n * Renders the text layer.\n * @param {TextLayerBuilderRenderOptions} options\n * @returns {Promise}\n */\n async render({ viewport, textContentParams = null }) {\n if (this.#renderingDone && this.#textLayer) {\n this.#textLayer.update({\n viewport,\n onBefore: this.hide.bind(this),\n });\n this.show();\n return;\n }\n\n this.cancel();\n this.#textLayer = new TextLayer({\n textContentSource: this.pdfPage.streamTextContent(\n textContentParams || {\n includeMarkedContent: true,\n disableNormalization: true,\n }\n ),\n container: this.div,\n viewport,\n });\n\n const { textDivs, textContentItemsStr } = this.#textLayer;\n this.highlighter?.setTextMapping(textDivs, textContentItemsStr);\n this.accessibilityManager?.setTextMapping(textDivs);\n\n await this.#textLayer.render();\n this.#renderingDone = true;\n\n const endOfContent = document.createElement(\"div\");\n endOfContent.className = \"endOfContent\";\n this.div.append(endOfContent);\n\n this.#bindMouse(endOfContent);\n // Ensure that the textLayer is appended to the DOM *before* handling\n // e.g. a pending search operation.\n this.#onAppend?.(this.div);\n this.highlighter?.enable();\n this.accessibilityManager?.enable();\n }\n\n hide() {\n if (!this.div.hidden && this.#renderingDone) {\n // We turn off the highlighter in order to avoid to scroll into view an\n // element of the text layer which could be hidden.\n this.highlighter?.disable();\n this.div.hidden = true;\n }\n }\n\n show() {\n if (this.div.hidden && this.#renderingDone) {\n this.div.hidden = false;\n this.highlighter?.enable();\n }\n }\n\n /**\n * Cancel rendering of the text layer.\n */\n cancel() {\n this.#textLayer?.cancel();\n this.#textLayer = null;\n\n this.highlighter?.disable();\n this.accessibilityManager?.disable();\n TextLayerBuilder.#removeGlobalSelectionListener(this.div);\n }\n\n /**\n * Improves text selection by adding an additional div where the mouse was\n * clicked. This reduces flickering of the content if the mouse is slowly\n * dragged up or down.\n */\n #bindMouse(end) {\n const { div } = this;\n\n div.addEventListener(\"mousedown\", () => {\n div.classList.add(\"selecting\");\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 stopEvent(event);\n });\n\n TextLayerBuilder.#textLayers.set(div, end);\n TextLayerBuilder.#enableGlobalSelectionListener();\n }\n\n static #removeGlobalSelectionListener(textLayerDiv) {\n this.#textLayers.delete(textLayerDiv);\n\n if (this.#textLayers.size === 0) {\n this.#selectionChangeAbortController?.abort();\n this.#selectionChangeAbortController = null;\n }\n }\n\n static #enableGlobalSelectionListener() {\n if (this.#selectionChangeAbortController) {\n // document-level event listeners already installed\n return;\n }\n this.#selectionChangeAbortController = new AbortController();\n const { signal } = this.#selectionChangeAbortController;\n\n const reset = (end, textLayer) => {\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n textLayer.append(end);\n end.style.width = \"\";\n end.style.height = \"\";\n }\n textLayer.classList.remove(\"selecting\");\n };\n\n let isPointerDown = false;\n document.addEventListener(\n \"pointerdown\",\n () => {\n isPointerDown = true;\n },\n { signal }\n );\n document.addEventListener(\n \"pointerup\",\n () => {\n isPointerDown = false;\n this.#textLayers.forEach(reset);\n },\n { signal }\n );\n window.addEventListener(\n \"blur\",\n () => {\n isPointerDown = false;\n this.#textLayers.forEach(reset);\n },\n { signal }\n );\n document.addEventListener(\n \"keyup\",\n () => {\n if (!isPointerDown) {\n this.#textLayers.forEach(reset);\n }\n },\n { signal }\n );\n\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"MOZCENTRAL\")) {\n // eslint-disable-next-line no-var\n var isFirefox, prevRange;\n }\n\n document.addEventListener(\n \"selectionchange\",\n () => {\n const selection = document.getSelection();\n if (selection.rangeCount === 0) {\n this.#textLayers.forEach(reset);\n return;\n }\n\n // Even though the spec says that .rangeCount should be 0 or 1, Firefox\n // creates multiple ranges when selecting across multiple pages.\n // Make sure to collect all the .textLayer elements where the selection\n // is happening.\n const activeTextLayers = new Set();\n for (let i = 0; i < selection.rangeCount; i++) {\n const range = selection.getRangeAt(i);\n for (const textLayerDiv of this.#textLayers.keys()) {\n if (\n !activeTextLayers.has(textLayerDiv) &&\n range.intersectsNode(textLayerDiv)\n ) {\n activeTextLayers.add(textLayerDiv);\n }\n }\n }\n\n for (const [textLayerDiv, endDiv] of this.#textLayers) {\n if (activeTextLayers.has(textLayerDiv)) {\n textLayerDiv.classList.add(\"selecting\");\n } else {\n reset(endDiv, textLayerDiv);\n }\n }\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"MOZCENTRAL\")) {\n return;\n }\n if (typeof PDFJSDev === \"undefined\" || !PDFJSDev.test(\"CHROME\")) {\n isFirefox ??=\n getComputedStyle(\n this.#textLayers.values().next().value\n ).getPropertyValue(\"-moz-user-select\") === \"none\";\n\n if (isFirefox) {\n return;\n }\n }\n // In non-Firefox browsers, when hovering over an empty space (thus,\n // on .endOfContent), the selection will expand to cover all the\n // text between the current selection and .endOfContent. By moving\n // .endOfContent to right after (or before, depending on which side\n // of the selection the user is moving), we limit the selection jump\n // to at most cover the enteirety of the where the selection\n // is being modified.\n const range = selection.getRangeAt(0);\n const modifyStart =\n prevRange &&\n (range.compareBoundaryPoints(Range.END_TO_END, prevRange) === 0 ||\n range.compareBoundaryPoints(Range.START_TO_END, prevRange) === 0);\n let anchor = modifyStart ? range.startContainer : range.endContainer;\n if (anchor.nodeType === Node.TEXT_NODE) {\n anchor = anchor.parentNode;\n }\n if (!modifyStart && range.endOffset === 0) {\n do {\n while (!anchor.previousSibling) {\n anchor = anchor.parentNode;\n }\n anchor = anchor.previousSibling;\n } while (!anchor.childNodes.length);\n }\n\n const parentTextLayer = anchor.parentElement?.closest(\".textLayer\");\n const endDiv = this.#textLayers.get(parentTextLayer);\n if (endDiv) {\n endDiv.style.width = parentTextLayer.style.width;\n endDiv.style.height = parentTextLayer.style.height;\n anchor.parentElement.insertBefore(\n endDiv,\n modifyStart ? anchor : anchor.nextSibling\n );\n }\n\n prevRange = range.cloneRange();\n },\n { signal }\n );\n }\n}\n\nexport { TextLayerBuilder };\n","/* Copyright 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\n/**\n * @typedef {Object} XfaLayerBuilderRenderOptions\n * @property {PageViewport} viewport\n * @property {string} [intent] - The default value is \"display\".\n */\n\nclass XfaLayerBuilder {\n /**\n * @param {XfaLayerBuilderOptions} options\n */\n constructor({\n pdfPage,\n annotationStorage = null,\n linkService,\n xfaHtml = null,\n }) {\n this.pdfPage = pdfPage;\n this.annotationStorage = annotationStorage;\n this.linkService = linkService;\n this.xfaHtml = xfaHtml;\n\n this.div = null;\n this._cancelled = false;\n }\n\n /**\n * @param {XfaLayerBuilderRenderOptions} viewport\n * @returns {Promise} A promise that is resolved when rendering\n * of the XFA layer is complete. The first rendering will return an object\n * with a `textDivs` property that can be used with the TextHighlighter.\n */\n async render({ viewport, intent = \"display\" }) {\n if (intent === \"print\") {\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n xfaHtml: this.xfaHtml,\n annotationStorage: this.annotationStorage,\n linkService: this.linkService,\n intent,\n };\n\n // Create an xfa layer div and render the form\n this.div = document.createElement(\"div\");\n parameters.div = this.div;\n\n return XfaLayer.render(parameters);\n }\n\n // intent === \"display\"\n const xfaHtml = await this.pdfPage.getXfa();\n if (this._cancelled || !xfaHtml) {\n return { textDivs: [] };\n }\n\n const parameters = {\n viewport: viewport.clone({ dontFlip: true }),\n div: this.div,\n xfaHtml,\n annotationStorage: this.annotationStorage,\n linkService: this.linkService,\n intent,\n };\n\n if (this.div) {\n return XfaLayer.update(parameters);\n }\n // Create an xfa layer div and render the form\n this.div = document.createElement(\"div\");\n parameters.div = this.div;\n\n return XfaLayer.render(parameters);\n }\n\n cancel() {\n this._cancelled = true;\n }\n\n hide() {\n if (!this.div) {\n return;\n }\n this.div.hidden = true;\n }\n}\n\nexport { XfaLayerBuilder };\n","/* Copyright 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 OutputScale,\n PixelsPerInch,\n setLayerDimensions,\n shadow,\n} from \"pdfjs-lib\";\nimport {\n approximateFraction,\n calcRound,\n DEFAULT_SCALE,\n floorToDivide,\n RenderingStates,\n TextLayerMode,\n} from \"./ui_utils.js\";\nimport { AnnotationEditorLayerBuilder } from \"./annotation_editor_layer_builder.js\";\nimport { AnnotationLayerBuilder } from \"./annotation_layer_builder.js\";\nimport { AppOptions } from \"./app_options.js\";\nimport { Autolinker } from \"./autolinker.js\";\nimport { BasePDFPageView } from \"./base_pdf_page_view.js\";\nimport { DrawLayerBuilder } from \"./draw_layer_builder.js\";\nimport { GenericL10n } from \"web-null_l10n\";\nimport { PDFPageDetailView } from \"./pdf_page_detail_view.js\";\nimport { 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} [optionalContentConfigPromise] -\n * A promise that is resolved with an {@link OptionalContentConfig} instance.\n * The default value is `null`.\n * @property {PDFRenderingQueue} [renderingQueue] - The rendering queue object.\n * @property {number} [textLayerMode] - Controls if the text layer used for\n * selection and searching is created. The constants from {TextLayerMode}\n * should be used. The default value is `TextLayerMode.ENABLE`.\n * @property {number} [annotationMode] - Controls if the annotation layer is\n * created, and if interactive form elements or `AnnotationStorage`-data are\n * being rendered. The constants from {@link AnnotationMode} should be used;\n * see also {@link RenderParameters} and {@link GetOperatorListParameters}.\n * The default value is `AnnotationMode.ENABLE_FORMS`.\n * @property {string} [imageResourcesPath] - Path for image resources, mainly\n * for annotation icons. Include trailing slash.\n * @property {number} [maxCanvasPixels] - The maximum supported canvas size in\n * total pixels, i.e. width * height. Use `-1` for no limit, or `0` for\n * CSS-only zooming. The default value is 4096 * 8192 (32 mega-pixels).\n * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,\n * in either width or height. Use `-1` for no limit.\n * The default value is 32767.\n * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the\n * viewport increased by the value in percent. Use `-1` for no limit.\n * The default value is 200%.\n * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered\n * pages would need a canvas that is larger than `maxCanvasPixels` or\n * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,\n * that only renders the part of the page that is close to the viewport.\n * The default value is `true`.\n * @property {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 * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from\n * text that look like URLs. The default value is `true`.\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 extends BasePDFPageView {\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #canvasWrapper = null;\n\n #enableAutoLinking = true;\n\n #hasRestrictedScaling = false;\n\n #isEditing = false;\n\n #layerProperties = null;\n\n #needsRestrictedScaling = false;\n\n #originalViewport = null;\n\n #previousRotation = null;\n\n #scaleRoundX = 1;\n\n #scaleRoundY = 1;\n\n #textLayerMode = TextLayerMode.ENABLE;\n\n #userUnit = 1;\n\n #useThumbnailCanvas = {\n directDrawing: true,\n initialOptionalContent: true,\n regularAnnotations: true,\n };\n\n #layers = [null, null, null, null];\n\n /**\n * @param {PDFPageViewOptions} options\n */\n constructor(options) {\n super(options);\n\n const container = options.container;\n const defaultViewport = options.defaultViewport;\n\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.enableDetailCanvas = options.enableDetailCanvas ?? true;\n this.maxCanvasPixels =\n options.maxCanvasPixels ?? AppOptions.get(\"maxCanvasPixels\");\n this.maxCanvasDim = options.maxCanvasDim || AppOptions.get(\"maxCanvasDim\");\n this.capCanvasAreaFactor =\n options.capCanvasAreaFactor ?? AppOptions.get(\"capCanvasAreaFactor\");\n this.#enableAutoLinking = options.enableAutoLinking !== false;\n\n this.l10n = options.l10n;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.l10n ||= new GenericL10n();\n }\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this._isStandalone = !this.renderingQueue?.hasViewer();\n this._container = container;\n }\n\n this._annotationCanvasMap = null;\n\n this.annotationLayer = null;\n this.annotationEditorLayer = null;\n this.textLayer = null;\n this.xfaLayer = null;\n this.structTreeLayer = null;\n this.drawLayer = null;\n\n this.detailView = null;\n\n const div = document.createElement(\"div\");\n div.className = \"page\";\n div.setAttribute(\"data-page-number\", this.id);\n div.setAttribute(\"role\", \"region\");\n div.setAttribute(\"data-l10n-id\", \"pdfjs-page-landmark\");\n div.setAttribute(\"data-l10n-args\", JSON.stringify({ page: this.id }));\n this.div = div;\n\n this.#setDimensions();\n container?.append(div);\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this._isStandalone\n ) {\n // Ensure that the various layers always get the correct initial size,\n // see issue 15795.\n container?.style.setProperty(\n \"--scale-factor\",\n this.scale * PixelsPerInch.PDF_TO_CSS_UNITS\n );\n\n if (this.pageColors?.background) {\n container?.style.setProperty(\n \"--page-bg-color\",\n this.pageColors.background\n );\n }\n\n const { optionalContentConfigPromise } = options;\n if (optionalContentConfigPromise) {\n // Ensure that the thumbnails always display the *initial* document\n // state, for documents with optional content.\n optionalContentConfigPromise.then(optionalContentConfig => {\n if (\n optionalContentConfigPromise !== this._optionalContentConfigPromise\n ) {\n return;\n }\n this.#useThumbnailCanvas.initialOptionalContent =\n optionalContentConfig.hasInitialVisibility;\n });\n }\n\n // Ensure that Fluent is connected in e.g. the COMPONENTS build.\n if (!options.l10n) {\n this.l10n.translate(this.div);\n }\n }\n }\n\n #addLayer(div, name) {\n const pos = LAYERS_ORDER.get(name);\n const oldDiv = this.#layers[pos];\n this.#layers[pos] = div;\n if (oldDiv) {\n oldDiv.replaceWith(div);\n return;\n }\n for (let i = pos - 1; i >= 0; i--) {\n const layer = this.#layers[i];\n if (layer) {\n layer.after(div);\n return;\n }\n }\n this.div.prepend(div);\n }\n\n #setDimensions() {\n const { div, viewport } = this;\n\n if (viewport.userUnit !== this.#userUnit) {\n if (viewport.userUnit !== 1) {\n div.style.setProperty(\"--user-unit\", viewport.userUnit);\n } else {\n div.style.removeProperty(\"--user-unit\");\n }\n this.#userUnit = viewport.userUnit;\n }\n if (this.pdfPage) {\n if (this.#previousRotation === viewport.rotation) {\n return;\n }\n this.#previousRotation = viewport.rotation;\n }\n\n setLayerDimensions(\n div,\n viewport,\n /* mustFlip = */ true,\n /* mustRotate = */ false\n );\n }\n\n 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 hasEditableAnnotations() {\n return !!this.annotationLayer?.hasEditableAnnotations();\n }\n\n get _textHighlighter() {\n return shadow(\n this,\n \"_textHighlighter\",\n new TextHighlighter({\n pageIndex: this.id - 1,\n eventBus: this.eventBus,\n findController: this.#layerProperties.findController,\n })\n );\n }\n\n #dispatchLayerRendered(name, error) {\n this.eventBus.dispatch(name, {\n source: this,\n pageNumber: this.id,\n error,\n });\n }\n\n async #renderAnnotationLayer() {\n let error = null;\n try {\n await this.annotationLayer.render({\n viewport: this.viewport,\n intent: \"display\",\n structTreeLayer: this.structTreeLayer,\n });\n } catch (ex) {\n console.error(\"#renderAnnotationLayer:\", ex);\n error = ex;\n } finally {\n this.#dispatchLayerRendered(\"annotationlayerrendered\", error);\n }\n }\n\n async #renderAnnotationEditorLayer() {\n let error = null;\n try {\n await this.annotationEditorLayer.render({\n viewport: this.viewport,\n intent: \"display\",\n });\n } catch (ex) {\n console.error(\"#renderAnnotationEditorLayer:\", ex);\n error = ex;\n } finally {\n this.#dispatchLayerRendered(\"annotationeditorlayerrendered\", error);\n }\n }\n\n async #renderDrawLayer() {\n try {\n await this.drawLayer.render({\n intent: \"display\",\n });\n } catch (ex) {\n console.error(\"#renderDrawLayer:\", ex);\n }\n }\n\n async #renderXfaLayer() {\n let error = null;\n try {\n const result = await this.xfaLayer.render({\n viewport: this.viewport,\n intent: \"display\",\n });\n if (result?.textDivs && this._textHighlighter) {\n // Given that the following method fetches the text asynchronously we\n // can invoke it *before* appending the xfaLayer to the DOM (below),\n // since a pending search-highlight/scroll operation thus won't run\n // until after the xfaLayer is available in the viewer.\n this.#buildXfaTextContentItems(result.textDivs);\n }\n } catch (ex) {\n console.error(\"#renderXfaLayer:\", ex);\n error = ex;\n } finally {\n if (this.xfaLayer?.div) {\n // Pause translation when inserting the xfaLayer in the DOM.\n this.l10n.pause();\n this.#addLayer(this.xfaLayer.div, \"xfaLayer\");\n this.l10n.resume();\n }\n this.#dispatchLayerRendered(\"xfalayerrendered\", error);\n }\n }\n\n async #renderTextLayer() {\n if (!this.textLayer) {\n return;\n }\n let error = null;\n try {\n await this.textLayer.render({\n viewport: this.viewport,\n });\n } catch (ex) {\n if (ex instanceof AbortException) {\n return;\n }\n console.error(\"#renderTextLayer:\", ex);\n error = ex;\n }\n this.#dispatchLayerRendered(\"textlayerrendered\", error);\n\n this.#renderStructTreeLayer();\n }\n\n /**\n * The structure tree is currently only supported when the text layer is\n * enabled and a canvas is used for rendering.\n *\n * The structure tree must be generated after the text layer for the\n * aria-owns to work.\n */\n async #renderStructTreeLayer() {\n if (!this.textLayer) {\n return;\n }\n\n const treeDom = await this.structTreeLayer?.render();\n if (treeDom) {\n this.l10n.pause();\n this.structTreeLayer?.addElementsToTextLayer();\n if (this.canvas && treeDom.parentNode !== this.canvas) {\n // Pause translation when inserting the structTree in the DOM.\n this.canvas.append(treeDom);\n }\n this.l10n.resume();\n }\n this.structTreeLayer?.show();\n }\n\n async #buildXfaTextContentItems(textDivs) {\n const text = await this.pdfPage.getTextContent();\n const items = [];\n for (const item of text.items) {\n items.push(item.str);\n }\n this._textHighlighter.setTextMapping(textDivs, items);\n this._textHighlighter.enable();\n }\n\n async #injectLinkAnnotations(textLayerPromise) {\n let error = null;\n try {\n await textLayerPromise;\n\n if (!this.annotationLayer) {\n return; // Rendering was cancelled while the textLayerPromise resolved.\n }\n await this.annotationLayer.injectLinkAnnotations({\n inferredLinks: Autolinker.processLinks(this),\n viewport: this.viewport,\n structTreeLayer: this.structTreeLayer,\n });\n } catch (ex) {\n console.error(\"#injectLinkAnnotations:\", ex);\n error = ex;\n }\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"TESTING\")) {\n this.#dispatchLayerRendered(\"linkannotationsadded\", error);\n }\n }\n\n _resetCanvas() {\n super._resetCanvas();\n this.#originalViewport = null;\n }\n\n reset({\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n keepCanvasWrapper = false,\n preserveDetailViewState = false,\n } = {}) {\n this.cancelRendering({\n keepAnnotationLayer,\n keepAnnotationEditorLayer,\n keepXfaLayer,\n keepTextLayer,\n });\n this.renderingState = RenderingStates.INITIAL;\n\n const div = this.div;\n\n const childNodes = div.childNodes,\n annotationLayerNode =\n (keepAnnotationLayer && this.annotationLayer?.div) || null,\n annotationEditorLayerNode =\n (keepAnnotationEditorLayer && this.annotationEditorLayer?.div) || null,\n xfaLayerNode = (keepXfaLayer && this.xfaLayer?.div) || null,\n textLayerNode = (keepTextLayer && this.textLayer?.div) || null,\n canvasWrapperNode = (keepCanvasWrapper && this.#canvasWrapper) || null;\n for (let i = childNodes.length - 1; i >= 0; i--) {\n const node = childNodes[i];\n switch (node) {\n case annotationLayerNode:\n case annotationEditorLayerNode:\n case xfaLayerNode:\n case textLayerNode:\n case canvasWrapperNode:\n continue;\n }\n node.remove();\n const layerIndex = this.#layers.indexOf(node);\n if (layerIndex >= 0) {\n this.#layers[layerIndex] = null;\n }\n }\n div.removeAttribute(\"data-loaded\");\n\n if (annotationLayerNode) {\n // Hide the annotation layer until all elements are resized\n // so they are not displayed on the already resized page.\n this.annotationLayer.hide();\n }\n if (annotationEditorLayerNode) {\n this.annotationEditorLayer.hide();\n }\n if (xfaLayerNode) {\n // Hide the XFA layer until all elements are resized\n // so they are not displayed on the already resized page.\n this.xfaLayer.hide();\n }\n if (textLayerNode) {\n this.textLayer.hide();\n }\n this.structTreeLayer?.hide();\n\n if (!keepCanvasWrapper && this.#canvasWrapper) {\n this.#canvasWrapper = null;\n this._resetCanvas();\n }\n\n if (!preserveDetailViewState) {\n this.detailView?.reset({ keepCanvas: keepCanvasWrapper });\n\n // If we are keeping the canvas around we must also keep the `detailView`\n // object, so that next time we need a detail view we'll update the\n // existing canvas rather than creating a new one.\n if (!keepCanvasWrapper) {\n this.detailView = null;\n }\n }\n }\n\n toggleEditingMode(isEditing) {\n // The page can be invisible, consequently there's no annotation layer and\n // we can't know if there are editable annotations.\n // So to avoid any issue when the page is rendered the #isEditing flag must\n // be set.\n this.#isEditing = isEditing;\n if (!this.hasEditableAnnotations()) {\n return;\n }\n this.reset({\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n keepCanvasWrapper: true,\n });\n }\n\n updateVisibleArea(visibleArea) {\n if (this.enableDetailCanvas) {\n if (\n this.#needsRestrictedScaling &&\n this.maxCanvasPixels > 0 &&\n visibleArea\n ) {\n this.detailView ??= new PDFPageDetailView({ pageView: this });\n this.detailView.update({ visibleArea });\n } else if (this.detailView) {\n this.detailView.reset();\n this.detailView = null;\n }\n }\n }\n\n /**\n * @typedef {Object} PDFPageViewUpdateParameters\n * @property {number} [scale] The new scale, if specified.\n * @property {number} [rotation] The new rotation, if specified.\n * @property {Promise} [optionalContentConfigPromise]\n * A promise that is resolved with an {@link OptionalContentConfig}\n * instance. The default value is `null`.\n * @property {number} [drawingDelay]\n */\n\n /**\n * Update e.g. the scale and/or rotation of the page.\n * @param {PDFPageViewUpdateParameters} params\n */\n update({\n scale = 0,\n rotation = null,\n optionalContentConfigPromise = null,\n drawingDelay = -1,\n }) {\n this.scale = scale || this.scale;\n if (typeof rotation === \"number\") {\n this.rotation = rotation; // The rotation may be zero.\n }\n if (optionalContentConfigPromise instanceof Promise) {\n this._optionalContentConfigPromise = optionalContentConfigPromise;\n\n // Ensure that the thumbnails always display the *initial* document state,\n // for documents with optional content.\n optionalContentConfigPromise.then(optionalContentConfig => {\n if (\n optionalContentConfigPromise !== this._optionalContentConfigPromise\n ) {\n return;\n }\n this.#useThumbnailCanvas.initialOptionalContent =\n optionalContentConfig.hasInitialVisibility;\n });\n }\n this.#useThumbnailCanvas.directDrawing = true;\n\n const totalRotation = (this.rotation + this.pdfPageRotate) % 360;\n this.viewport = this.viewport.clone({\n scale: this.scale * PixelsPerInch.PDF_TO_CSS_UNITS,\n rotation: totalRotation,\n });\n this.#setDimensions();\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this._isStandalone\n ) {\n this._container?.style.setProperty(\"--scale-factor\", this.viewport.scale);\n }\n\n this.#computeScale();\n\n if (this.canvas) {\n const onlyCssZoom =\n this.#hasRestrictedScaling && this.#needsRestrictedScaling;\n const postponeDrawing = drawingDelay >= 0 && drawingDelay < 1000;\n\n if (postponeDrawing || onlyCssZoom) {\n if (\n postponeDrawing &&\n !onlyCssZoom &&\n this.renderingState !== RenderingStates.FINISHED\n ) {\n this.cancelRendering({\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n cancelExtraDelay: drawingDelay,\n });\n // It isn't really finished, but once we have finished\n // to postpone, we'll call this.reset(...) which will set\n // the rendering state to INITIAL, hence the next call to\n // PDFViewer.update() will trigger a redraw (if it's mandatory).\n this.renderingState = RenderingStates.FINISHED;\n // Ensure that the thumbnails won't become partially (or fully) blank,\n // if the sidebar is opened before the actual rendering is done.\n this.#useThumbnailCanvas.directDrawing = false;\n }\n\n this.cssTransform({\n redrawAnnotationLayer: true,\n redrawAnnotationEditorLayer: true,\n redrawXfaLayer: true,\n redrawTextLayer: !postponeDrawing,\n hideTextLayer: postponeDrawing,\n });\n\n // The \"pagerendered\"-event will be dispatched once the actual\n // rendering is done, hence don't dispatch it here as well.\n if (!postponeDrawing) {\n this.detailView?.update({ underlyingViewUpdated: true });\n\n this.dispatchPageRendered(\n /* cssTransform */ true,\n /* isDetailView */ false\n );\n }\n return;\n }\n }\n this.cssTransform({});\n this.reset({\n keepAnnotationLayer: true,\n keepAnnotationEditorLayer: true,\n keepXfaLayer: true,\n keepTextLayer: true,\n keepCanvasWrapper: true,\n // It will be reset by the .update call below\n preserveDetailViewState: true,\n });\n\n this.detailView?.update({ underlyingViewUpdated: true });\n }\n\n #computeScale() {\n const { width, height } = this.viewport;\n const outputScale = (this.outputScale = new OutputScale());\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.maxCanvasPixels === 0\n ) {\n const invScale = 1 / this.scale;\n // Use a scale that makes the canvas have the originally intended size\n // of the page.\n outputScale.sx *= invScale;\n outputScale.sy *= invScale;\n this.#needsRestrictedScaling = true;\n } else {\n this.#needsRestrictedScaling = outputScale.limitCanvas(\n width,\n height,\n this.maxCanvasPixels,\n this.maxCanvasDim,\n this.capCanvasAreaFactor\n );\n }\n }\n\n /**\n * PLEASE NOTE: Most likely you want to use the `this.reset()` method,\n * rather than calling this one directly.\n */\n cancelRendering({\n keepAnnotationLayer = false,\n keepAnnotationEditorLayer = false,\n keepXfaLayer = false,\n keepTextLayer = false,\n cancelExtraDelay = 0,\n } = {}) {\n super.cancelRendering({ cancelExtraDelay });\n\n if (this.textLayer && (!keepTextLayer || !this.textLayer.div)) {\n this.textLayer.cancel();\n this.textLayer = null;\n }\n if (\n this.annotationLayer &&\n (!keepAnnotationLayer || !this.annotationLayer.div)\n ) {\n this.annotationLayer.cancel();\n this.annotationLayer = null;\n this._annotationCanvasMap = null;\n }\n if (this.structTreeLayer && !this.textLayer) {\n this.structTreeLayer = null;\n }\n if (\n this.annotationEditorLayer &&\n (!keepAnnotationEditorLayer || !this.annotationEditorLayer.div)\n ) {\n if (this.drawLayer) {\n this.drawLayer.cancel();\n this.drawLayer = null;\n }\n this.annotationEditorLayer.cancel();\n this.annotationEditorLayer = null;\n }\n if (this.xfaLayer && (!keepXfaLayer || !this.xfaLayer.div)) {\n this.xfaLayer.cancel();\n this.xfaLayer = null;\n this._textHighlighter?.disable();\n }\n }\n\n cssTransform({\n redrawAnnotationLayer = false,\n redrawAnnotationEditorLayer = false,\n redrawXfaLayer = false,\n redrawTextLayer = false,\n hideTextLayer = false,\n }) {\n const { canvas } = this;\n if (!canvas) {\n return;\n }\n\n const originalViewport = this.#originalViewport;\n if (this.viewport !== originalViewport) {\n // The canvas may have been originally rotated; rotate relative to that.\n const relativeRotation =\n (360 + this.viewport.rotation - originalViewport.rotation) % 360;\n if (relativeRotation === 90 || relativeRotation === 270) {\n const { width, height } = this.viewport;\n // Scale x and y because of the rotation.\n const scaleX = height / width;\n const scaleY = width / height;\n canvas.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX},${scaleY})`;\n } else {\n canvas.style.transform =\n relativeRotation === 0 ? \"\" : `rotate(${relativeRotation}deg)`;\n }\n }\n\n if (redrawAnnotationLayer && this.annotationLayer) {\n this.#renderAnnotationLayer();\n }\n if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {\n if (this.drawLayer) {\n this.#renderDrawLayer();\n }\n this.#renderAnnotationEditorLayer();\n }\n if (redrawXfaLayer && this.xfaLayer) {\n this.#renderXfaLayer();\n }\n\n if (this.textLayer) {\n if (hideTextLayer) {\n this.textLayer.hide();\n this.structTreeLayer?.hide();\n } else if (redrawTextLayer) {\n this.#renderTextLayer();\n }\n }\n }\n\n get width() {\n return this.viewport.width;\n }\n\n get height() {\n return this.viewport.height;\n }\n\n getPagePoint(x, y) {\n return this.viewport.convertToPdfPoint(x, y);\n }\n\n // Wrap the canvas so that if it has a CSS transform for high DPI the\n // overflow will be hidden in Firefox.\n _ensureCanvasWrapper() {\n let canvasWrapper = this.#canvasWrapper;\n if (!canvasWrapper) {\n canvasWrapper = this.#canvasWrapper = document.createElement(\"div\");\n canvasWrapper.classList.add(\"canvasWrapper\");\n this.#addLayer(canvasWrapper, \"canvasWrapper\");\n }\n return canvasWrapper;\n }\n\n _getRenderingContext(canvas, transform) {\n return {\n canvas,\n transform,\n viewport: this.viewport,\n annotationMode: this.#annotationMode,\n optionalContentConfigPromise: this._optionalContentConfigPromise,\n annotationCanvasMap: this._annotationCanvasMap,\n pageColors: this.pageColors,\n isEditing: this.#isEditing,\n };\n }\n\n async draw() {\n if (this.renderingState !== RenderingStates.INITIAL) {\n console.error(\"Must be in new state before drawing\");\n this.reset(); // Ensure that we reset all state to prevent issues.\n }\n const { div, l10n, pdfPage, viewport } = this;\n\n if (!pdfPage) {\n this.renderingState = RenderingStates.FINISHED;\n throw new Error(\"pdfPage is not loaded\");\n }\n\n this.renderingState = RenderingStates.RUNNING;\n\n const canvasWrapper = this._ensureCanvasWrapper();\n\n if (\n !this.textLayer &&\n this.#textLayerMode !== TextLayerMode.DISABLE &&\n !pdfPage.isPureXfa\n ) {\n this._accessibilityManager ||= new TextAccessibilityManager();\n\n this.textLayer = new TextLayerBuilder({\n pdfPage,\n highlighter: this._textHighlighter,\n accessibilityManager: this._accessibilityManager,\n enablePermissions:\n this.#textLayerMode === TextLayerMode.ENABLE_PERMISSIONS,\n onAppend: textLayerDiv => {\n // Pause translation when inserting the textLayer in the DOM.\n this.l10n.pause();\n this.#addLayer(textLayerDiv, \"textLayer\");\n this.l10n.resume();\n },\n });\n }\n\n if (\n !this.annotationLayer &&\n this.#annotationMode !== AnnotationMode.DISABLE\n ) {\n const {\n annotationStorage,\n annotationEditorUIManager,\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 annotationEditorUIManager,\n onAppend: annotationLayerDiv => {\n this.#addLayer(annotationLayerDiv, \"annotationLayer\");\n },\n });\n }\n\n const { width, height } = viewport;\n this.#originalViewport = viewport;\n\n const { canvas, prevCanvas } = this._createCanvas(newCanvas => {\n // Always inject the canvas as the first element in the wrapper.\n canvasWrapper.prepend(newCanvas);\n });\n canvas.setAttribute(\"role\", \"presentation\");\n\n if (!this.outputScale) {\n this.#computeScale();\n }\n const { outputScale } = this;\n this.#hasRestrictedScaling = this.#needsRestrictedScaling;\n\n const sfx = approximateFraction(outputScale.sx);\n const sfy = approximateFraction(outputScale.sy);\n\n const canvasWidth = (canvas.width = floorToDivide(\n calcRound(width * outputScale.sx),\n sfx[0]\n ));\n const canvasHeight = (canvas.height = floorToDivide(\n calcRound(height * outputScale.sy),\n sfy[0]\n ));\n const pageWidth = floorToDivide(calcRound(width), sfx[1]);\n const pageHeight = floorToDivide(calcRound(height), sfy[1]);\n outputScale.sx = canvasWidth / pageWidth;\n outputScale.sy = canvasHeight / pageHeight;\n\n if (this.#scaleRoundX !== sfx[1]) {\n div.style.setProperty(\"--scale-round-x\", `${sfx[1]}px`);\n this.#scaleRoundX = sfx[1];\n }\n if (this.#scaleRoundY !== sfy[1]) {\n div.style.setProperty(\"--scale-round-y\", `${sfy[1]}px`);\n this.#scaleRoundY = sfy[1];\n }\n\n // Rendering area\n const transform = outputScale.scaled\n ? [outputScale.sx, 0, 0, outputScale.sy, 0, 0]\n : null;\n const resultPromise = this._drawCanvas(\n this._getRenderingContext(canvas, transform),\n () => {\n prevCanvas?.remove();\n this._resetCanvas();\n },\n renderTask => {\n // Ensure that the thumbnails won't become partially (or fully) blank,\n // for documents that contain interactive form elements.\n this.#useThumbnailCanvas.regularAnnotations =\n !renderTask.separateAnnots;\n\n this.dispatchPageRendered(\n /* cssTransform */ false,\n /* isDetailView */ false\n );\n }\n ).then(async () => {\n this.structTreeLayer ||= new StructTreeLayerBuilder(\n pdfPage,\n viewport.rawDims\n );\n\n const textLayerPromise = this.#renderTextLayer();\n\n if (this.annotationLayer) {\n await this.#renderAnnotationLayer();\n\n if (this.#enableAutoLinking && this.annotationLayer && this.textLayer) {\n await this.#injectLinkAnnotations(textLayerPromise);\n }\n }\n\n const { annotationEditorUIManager } = this.#layerProperties;\n\n if (!annotationEditorUIManager) {\n return;\n }\n this.drawLayer ||= new DrawLayerBuilder({\n pageIndex: this.id,\n });\n await this.#renderDrawLayer();\n this.drawLayer.setParent(canvasWrapper);\n\n this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({\n uiManager: annotationEditorUIManager,\n pdfPage,\n l10n,\n structTreeLayer: this.structTreeLayer,\n accessibilityManager: this._accessibilityManager,\n annotationLayer: this.annotationLayer?.annotationLayer,\n textLayer: this.textLayer,\n drawLayer: this.drawLayer.getDrawLayer(),\n onAppend: annotationEditorLayerDiv => {\n this.#addLayer(annotationEditorLayerDiv, \"annotationEditorLayer\");\n },\n });\n this.#renderAnnotationEditorLayer();\n });\n\n if (pdfPage.isPureXfa) {\n if (!this.xfaLayer) {\n const { annotationStorage, linkService } = this.#layerProperties;\n\n this.xfaLayer = new XfaLayerBuilder({\n pdfPage,\n annotationStorage,\n linkService,\n });\n }\n this.#renderXfaLayer();\n }\n\n div.setAttribute(\"data-loaded\", true);\n\n this.dispatchPageRender();\n\n return resultPromise;\n }\n\n /**\n * @param {string|null} label\n */\n setPageLabel(label) {\n this.pageLabel = typeof label === \"string\" ? label : null;\n\n this.div.setAttribute(\n \"data-l10n-args\",\n JSON.stringify({ page: this.pageLabel ?? this.id })\n );\n\n if (this.pageLabel !== null) {\n this.div.setAttribute(\"data-page-label\", this.pageLabel);\n } else {\n this.div.removeAttribute(\"data-page-label\");\n }\n }\n\n /**\n * For use by the `PDFThumbnailView.setImage`-method.\n * @ignore\n */\n get thumbnailCanvas() {\n const { directDrawing, initialOptionalContent, regularAnnotations } =\n this.#useThumbnailCanvas;\n return directDrawing && initialOptionalContent && regularAnnotations\n ? this.canvas\n : null;\n }\n}\n\nexport { PDFPageView };\n","/* Copyright 2020 Mozilla Foundation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getPdfFilenameFromUrl } from \"pdfjs-lib\";\n\nasync function docProperties(pdfDocument) {\n const url = \"\",\n baseUrl = \"\";\n const { info, metadata, contentDispositionFilename, contentLength } =\n await pdfDocument.getMetadata();\n\n return {\n ...info,\n baseURL: baseUrl,\n filesize: contentLength || (await pdfDocument.getDownloadInfo()).length,\n filename: contentDispositionFilename || getPdfFilenameFromUrl(url),\n metadata: metadata?.getRaw(),\n authors: metadata?.get(\"dc:creator\"),\n numPages: pdfDocument.numPages,\n URL: url,\n };\n}\n\nclass GenericScripting {\n constructor(sandboxBundleSrc) {\n this._ready = new Promise((resolve, reject) => {\n const sandbox =\n typeof PDFJSDev === \"undefined\"\n ? import(sandboxBundleSrc) // eslint-disable-line no-unsanitized/method\n : __raw_import__(sandboxBundleSrc);\n sandbox\n .then(pdfjsSandbox => {\n resolve(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 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 #eventAbortController = null;\n\n #eventBus = null;\n\n #externalServices = null;\n\n #pdfDocument = null;\n\n #pdfViewer = null;\n\n #ready = false;\n\n #scripting = null;\n\n #willPrintCapability = null;\n\n /**\n * @param {PDFScriptingManagerOptions} options\n */\n constructor({ eventBus, externalServices = null, docProperties = null }) {\n this.#eventBus = eventBus;\n this.#externalServices = externalServices;\n this.#docProperties = docProperties;\n\n if (typeof PDFJSDev !== \"undefined\" && PDFJSDev.test(\"TESTING\")) {\n Object.defineProperty(this, \"sandboxTrip\", {\n value: () =>\n setTimeout(\n () =>\n this.#scripting?.dispatchEventInSandbox({\n name: \"sandboxtripbegin\",\n }),\n 0\n ),\n });\n }\n }\n\n setViewer(pdfViewer) {\n this.#pdfViewer = pdfViewer;\n }\n\n async setDocument(pdfDocument) {\n if (this.#pdfDocument) {\n await this.#destroyScripting();\n }\n this.#pdfDocument = pdfDocument;\n\n if (!pdfDocument) {\n return;\n }\n const [objects, calculationOrder, docActions] = await Promise.all([\n pdfDocument.getFieldObjects(),\n pdfDocument.getCalculationOrderIds(),\n pdfDocument.getJSActions(),\n ]);\n\n if (!objects && !docActions) {\n // No FieldObjects or JavaScript actions were found in the document.\n await this.#destroyScripting();\n return;\n }\n if (pdfDocument !== this.#pdfDocument) {\n return; // The document was closed while the data resolved.\n }\n try {\n this.#scripting = this.#initScripting();\n } catch (error) {\n console.error(\"setDocument:\", error);\n\n await this.#destroyScripting();\n return;\n }\n const eventBus = this.#eventBus;\n\n this.#eventAbortController = new AbortController();\n const { signal } = this.#eventAbortController;\n\n eventBus._on(\n \"updatefromsandbox\",\n event => {\n if (event?.source === window) {\n this.#updateFromSandbox(event.detail);\n }\n },\n { signal }\n );\n eventBus._on(\n \"dispatcheventinsandbox\",\n event => {\n this.#scripting?.dispatchEventInSandbox(event.detail);\n },\n { signal }\n );\n\n eventBus._on(\n \"pagechanging\",\n ({ pageNumber, previous }) => {\n if (pageNumber === previous) {\n return; // The current page didn't change.\n }\n this.#dispatchPageClose(previous);\n this.#dispatchPageOpen(pageNumber);\n },\n { signal }\n );\n eventBus._on(\n \"pagerendered\",\n ({ pageNumber }) => {\n if (!this._pageOpenPending.has(pageNumber)) {\n return; // No pending \"PageOpen\" event for the newly rendered page.\n }\n if (pageNumber !== this.#pdfViewer.currentPageNumber) {\n return; // The newly rendered page is no longer the current one.\n }\n this.#dispatchPageOpen(pageNumber);\n },\n { signal }\n );\n eventBus._on(\n \"pagesdestroy\",\n async () => {\n await this.#dispatchPageClose(this.#pdfViewer.currentPageNumber);\n\n await this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillClose\",\n });\n\n this.#closeCapability?.resolve();\n },\n { signal }\n );\n\n try {\n const docProperties = await this.#docProperties(pdfDocument);\n if (pdfDocument !== this.#pdfDocument) {\n return; // The document was closed while the properties resolved.\n }\n\n await this.#scripting.createSandbox({\n objects,\n calculationOrder,\n appInfo: {\n platform: navigator.platform,\n language: navigator.language,\n },\n docInfo: {\n ...docProperties,\n actions: docActions,\n },\n });\n\n eventBus.dispatch(\"sandboxcreated\", { source: this });\n } catch (error) {\n console.error(\"setDocument:\", error);\n\n await this.#destroyScripting();\n return;\n }\n\n await this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"Open\",\n });\n await this.#dispatchPageOpen(\n this.#pdfViewer.currentPageNumber,\n /* initialize = */ true\n );\n\n // Defer this slightly, to ensure that scripting is *fully* initialized.\n Promise.resolve().then(() => {\n if (pdfDocument === this.#pdfDocument) {\n this.#ready = true;\n }\n });\n }\n\n async dispatchWillSave() {\n return this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillSave\",\n });\n }\n\n async dispatchDidSave() {\n return this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"DidSave\",\n });\n }\n\n async dispatchWillPrint() {\n if (!this.#scripting) {\n return;\n }\n await this.#willPrintCapability?.promise;\n this.#willPrintCapability = Promise.withResolvers();\n try {\n await this.#scripting.dispatchEventInSandbox({\n id: \"doc\",\n name: \"WillPrint\",\n });\n } catch (ex) {\n this.#willPrintCapability.resolve();\n this.#willPrintCapability = null;\n throw ex;\n }\n\n await this.#willPrintCapability.promise;\n }\n\n async dispatchDidPrint() {\n return this.#scripting?.dispatchEventInSandbox({\n id: \"doc\",\n name: \"DidPrint\",\n });\n }\n\n get destroyPromise() {\n return this.#destroyCapability?.promise || null;\n }\n\n get ready() {\n return this.#ready;\n }\n\n /**\n * @private\n */\n get _pageOpenPending() {\n return shadow(this, \"_pageOpenPending\", new Set());\n }\n\n /**\n * @private\n */\n get _visitedPages() {\n return shadow(this, \"_visitedPages\", new Map());\n }\n\n async #updateFromSandbox(detail) {\n const pdfViewer = this.#pdfViewer;\n // Ignore some events, see below, that don't make sense in PresentationMode.\n const isInPresentationMode =\n pdfViewer.isInPresentationMode || pdfViewer.isChangingPresentationMode;\n\n const { id, siblings, command, value } = detail;\n if (!id) {\n if (\n typeof PDFJSDev !== \"undefined\" &&\n PDFJSDev.test(\"TESTING\") &&\n command === \"sandboxTripEnd\"\n ) {\n window.setTimeout(() => {\n window.dispatchEvent(new CustomEvent(\"sandboxtripend\"));\n }, 0);\n return;\n }\n\n switch (command) {\n case \"clear\":\n console.clear();\n break;\n case \"error\":\n console.error(value);\n break;\n case \"layout\":\n if (!isInPresentationMode) {\n const modes = apiPageLayoutToViewerModes(value);\n pdfViewer.spreadMode = modes.spreadMode;\n }\n break;\n case \"page-num\":\n pdfViewer.currentPageNumber = value + 1;\n break;\n case \"print\":\n await pdfViewer.pagesPromise;\n this.#eventBus.dispatch(\"print\", { source: this });\n break;\n case \"println\":\n console.log(value);\n break;\n case \"zoom\":\n if (!isInPresentationMode) {\n pdfViewer.currentScaleValue = value;\n }\n break;\n case \"SaveAs\":\n this.#eventBus.dispatch(\"download\", { source: this });\n break;\n case \"FirstPage\":\n pdfViewer.currentPageNumber = 1;\n break;\n case \"LastPage\":\n pdfViewer.currentPageNumber = pdfViewer.pagesCount;\n break;\n case \"NextPage\":\n pdfViewer.nextPage();\n break;\n case \"PrevPage\":\n pdfViewer.previousPage();\n break;\n case \"ZoomViewIn\":\n if (!isInPresentationMode) {\n pdfViewer.increaseScale();\n }\n break;\n case \"ZoomViewOut\":\n if (!isInPresentationMode) {\n pdfViewer.decreaseScale();\n }\n break;\n case \"WillPrintFinished\":\n this.#willPrintCapability?.resolve();\n this.#willPrintCapability = null;\n break;\n }\n return;\n }\n\n if (isInPresentationMode && detail.focus) {\n return;\n }\n delete detail.id;\n delete detail.siblings;\n\n const ids = siblings ? [id, ...siblings] : [id];\n for (const elementId of ids) {\n const element = document.querySelector(\n `[data-element-id=\"${elementId}\"]`\n );\n if (element) {\n element.dispatchEvent(new CustomEvent(\"updatefromsandbox\", { detail }));\n } else {\n // The element hasn't been rendered yet, use the AnnotationStorage.\n this.#pdfDocument?.annotationStorage.setValue(elementId, detail);\n }\n }\n }\n\n async #dispatchPageOpen(pageNumber, initialize = false) {\n const pdfDocument = this.#pdfDocument,\n visitedPages = this._visitedPages;\n\n if (initialize) {\n this.#closeCapability = Promise.withResolvers();\n }\n if (!this.#closeCapability) {\n return; // Scripting isn't fully initialized yet.\n }\n const pageView = this.#pdfViewer.getPageView(/* index = */ pageNumber - 1);\n\n if (pageView?.renderingState !== RenderingStates.FINISHED) {\n this._pageOpenPending.add(pageNumber);\n return; // Wait for the page to finish rendering.\n }\n this._pageOpenPending.delete(pageNumber);\n\n const actionsPromise = (async () => {\n // Avoid sending, and thus serializing, the `actions` data more than once.\n const actions = await (!visitedPages.has(pageNumber)\n ? pageView.pdfPage?.getJSActions()\n : null);\n if (pdfDocument !== this.#pdfDocument) {\n return; // The document was closed while the actions resolved.\n }\n\n await this.#scripting?.dispatchEventInSandbox({\n id: \"page\",\n name: \"PageOpen\",\n pageNumber,\n actions,\n });\n })();\n visitedPages.set(pageNumber, actionsPromise);\n }\n\n async #dispatchPageClose(pageNumber) {\n const pdfDocument = this.#pdfDocument,\n visitedPages = this._visitedPages;\n\n if (!this.#closeCapability) {\n return; // Scripting isn't fully initialized yet.\n }\n if (this._pageOpenPending.has(pageNumber)) {\n return; // The page is still rendering; no \"PageOpen\" event dispatched.\n }\n const actionsPromise = visitedPages.get(pageNumber);\n if (!actionsPromise) {\n return; // The \"PageClose\" event must be preceded by a \"PageOpen\" event.\n }\n visitedPages.set(pageNumber, null);\n\n // Ensure that the \"PageOpen\" event is dispatched first.\n await actionsPromise;\n if (pdfDocument !== this.#pdfDocument) {\n return; // The document was closed while the actions resolved.\n }\n\n await this.#scripting?.dispatchEventInSandbox({\n id: \"page\",\n name: \"PageClose\",\n pageNumber,\n });\n }\n\n #initScripting() {\n this.#destroyCapability = Promise.withResolvers();\n\n if (this.#scripting) {\n throw new Error(\"#initScripting: Scripting already exists.\");\n }\n return this.#externalServices.createScripting();\n }\n\n async #destroyScripting() {\n if (!this.#scripting) {\n this.#pdfDocument = null;\n\n this.#destroyCapability?.resolve();\n return;\n }\n if (this.#closeCapability) {\n await Promise.race([\n this.#closeCapability.promise,\n new Promise(resolve => {\n // Avoid the scripting/sandbox-destruction hanging indefinitely.\n setTimeout(resolve, 1000);\n }),\n ]).catch(() => {\n // Ignore any errors, to ensure that the sandbox is always destroyed.\n });\n this.#closeCapability = null;\n }\n this.#pdfDocument = null;\n\n try {\n await this.#scripting.destroySandbox();\n } catch {}\n\n this.#willPrintCapability?.reject(new Error(\"Scripting destroyed.\"));\n this.#willPrintCapability = null;\n\n this.#eventAbortController?.abort();\n this.#eventAbortController = null;\n\n this._pageOpenPending.clear();\n this._visitedPages.clear();\n\n this.#scripting = null;\n this.#ready = false;\n\n this.#destroyCapability?.resolve();\n }\n}\n\nexport { PDFScriptingManager };\n","/* Copyright 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 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 * @param {boolean} [ignoreDetailViews]\n */\n getHighestPriority(\n visible,\n views,\n scrolledDown,\n preRenderExtra = false,\n ignoreDetailViews = false\n ) {\n /**\n * The state has changed. Figure out which page has the highest priority to\n * render next (if any).\n *\n * Priority:\n * 1. visible pages\n * 2. zoomed-in partial views of visible pages, unless `ignoreDetailViews`\n * 3. if last scrolled down, the page after the visible pages, or\n * if last scrolled up, the page before the visible pages\n */\n const visibleViews = visible.views,\n numVisible = visibleViews.length;\n\n if (numVisible === 0) {\n return null;\n }\n for (let i = 0; i < numVisible; i++) {\n const view = visibleViews[i].view;\n if (!this.isViewFinished(view)) {\n return view;\n }\n }\n\n if (!ignoreDetailViews) {\n for (let i = 0; i < numVisible; i++) {\n const { detailView } = visibleViews[i].view;\n if (detailView && !this.isViewFinished(detailView)) {\n return detailView;\n }\n }\n }\n\n const firstId = visible.first.id,\n lastId = visible.last.id;\n\n // All the visible views have rendered; try to handle any \"holes\" in the\n // page layout (can happen e.g. with spreadModes at higher zoom levels).\n if (lastId - firstId + 1 > numVisible) {\n const visibleIds = visible.ids;\n for (let i = 1, ii = lastId - firstId; i < ii; i++) {\n const holeId = scrolledDown ? firstId + i : lastId - i;\n if (visibleIds.has(holeId)) {\n continue;\n }\n const holeView = views[holeId - 1];\n if (!this.isViewFinished(holeView)) {\n return holeView;\n }\n }\n }\n\n // All the visible views have rendered; try to render next/previous page.\n // (IDs start at 1, so no need to add 1 when `scrolledDown === true`.)\n let preRenderIndex = scrolledDown ? lastId : firstId - 2;\n let preRenderView = views[preRenderIndex];\n\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n if (preRenderExtra) {\n preRenderIndex += scrolledDown ? 1 : -1;\n preRenderView = views[preRenderIndex];\n\n if (preRenderView && !this.isViewFinished(preRenderView)) {\n return preRenderView;\n }\n }\n // Everything that needs to be rendered has been.\n return null;\n }\n\n /**\n * @param {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 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 MathClamp,\n PermissionFlag,\n PixelsPerInch,\n shadow,\n stopEvent,\n version,\n} from \"pdfjs-lib\";\nimport {\n DEFAULT_SCALE,\n DEFAULT_SCALE_DELTA,\n DEFAULT_SCALE_VALUE,\n docStyle,\n getVisibleElements,\n isPortraitOrientation,\n isValidRotation,\n isValidScrollMode,\n isValidSpreadMode,\n MAX_AUTO_SCALE,\n MAX_SCALE,\n MIN_SCALE,\n PresentationModeState,\n removeNullCharacters,\n 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: 10000,\n FORCE_LAZY_PAGE_INIT: 5000,\n PAUSE_EAGER_PAGE_INIT: 250,\n};\n\nfunction isValidAnnotationEditorMode(mode) {\n return (\n Object.values(AnnotationEditorType).includes(mode) &&\n mode !== AnnotationEditorType.DISABLE\n );\n}\n\n/**\n * @typedef {Object} PDFViewerOptions\n * @property {HTMLDivElement} container - The container for the viewer element.\n * @property {HTMLDivElement} [viewer] - The viewer element.\n * @property {EventBus} eventBus - The application event bus.\n * @property {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 {number} [maxCanvasDim] - The maximum supported canvas dimension,\n * in either width or height. Use `-1` for no limit.\n * The default value is 32767.\n * @property {number} [capCanvasAreaFactor] - Cap the canvas area to the\n * viewport increased by the value in percent. Use `-1` for no limit.\n * The default value is 200%.\n * @property {boolean} [enableDetailCanvas] - When enabled, if the rendered\n * pages would need a canvas that is larger than `maxCanvasPixels` or\n * `maxCanvasDim`, it will draw a second canvas on top of the CSS-zoomed one,\n * that only renders the part of the page that is close to the viewport.\n * The default value is `true`.\n * @property {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 * @property {boolean} [enableHWA] - Enables hardware acceleration for\n * rendering. The default value is `false`.\n * @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.\n * The default value is `true`.\n * @property {boolean} [enableAutoLinking] - Enable creation of hyperlinks from\n * text that look like URLs. The default value is `true`.\n * @property {number} [minDurationToUpdateCanvas] - Minimum duration to wait\n * before updating the canvas. The default value is `500`.\n */\n\nclass PDFPageViewBuffer {\n // Here we rely on the fact that `Set`s preserve the insertion order.\n #buf = new Set();\n\n #size = 0;\n\n constructor(size) {\n this.#size = size;\n }\n\n push(view) {\n const buf = this.#buf;\n if (buf.has(view)) {\n buf.delete(view); // Move the view to the \"end\" of the buffer.\n }\n buf.add(view);\n\n if (buf.size > this.#size) {\n this.#destroyFirstView();\n }\n }\n\n /**\n * After calling resize, the size of the buffer will be `newSize`.\n * The optional parameter `idsToKeep` is, if present, a Set of page-ids to\n * push to the back of the buffer, delaying their destruction. The size of\n * `idsToKeep` has no impact on the final size of the buffer; if `idsToKeep`\n * is larger than `newSize`, some of those pages will be destroyed anyway.\n */\n resize(newSize, idsToKeep = null) {\n this.#size = newSize;\n\n const buf = this.#buf;\n if (idsToKeep) {\n const ii = buf.size;\n let i = 1;\n for (const view of buf) {\n if (idsToKeep.has(view.id)) {\n buf.delete(view); // Move the view to the \"end\" of the buffer.\n buf.add(view);\n }\n if (++i > ii) {\n break;\n }\n }\n }\n\n while (buf.size > this.#size) {\n this.#destroyFirstView();\n }\n }\n\n has(view) {\n return this.#buf.has(view);\n }\n\n [Symbol.iterator]() {\n return this.#buf.keys();\n }\n\n #destroyFirstView() {\n const firstView = this.#buf.keys().next().value;\n\n firstView?.destroy();\n this.#buf.delete(firstView);\n }\n}\n\n/**\n * Simple viewer control to display PDF content/pages.\n */\nclass PDFViewer {\n #buffer = null;\n\n #altTextManager = null;\n\n #annotationEditorHighlightColors = null;\n\n #annotationEditorMode = AnnotationEditorType.NONE;\n\n #annotationEditorUIManager = null;\n\n #annotationMode = AnnotationMode.ENABLE_FORMS;\n\n #commentManager = null;\n\n #containerTopLeft = null;\n\n #editorUndoBar = null;\n\n #enableHWA = false;\n\n #enableHighlightFloatingButton = false;\n\n #enablePermissions = false;\n\n #enableUpdatedAddImage = false;\n\n #enableNewAltTextWhenAddingImage = false;\n\n #enableAutoLinking = true;\n\n #eventAbortController = null;\n\n #minDurationToUpdateCanvas = 0;\n\n #mlManager = null;\n\n #scrollTimeoutId = null;\n\n #switchAnnotationEditorModeAC = null;\n\n #switchAnnotationEditorModeTimeoutId = 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 #scaleTimeoutId = null;\n\n #signatureManager = null;\n\n #supportsPinchToZoom = true;\n\n #textLayerMode = TextLayerMode.ENABLE;\n\n #viewerAlert = null;\n\n /**\n * @param {PDFViewerOptions} options\n */\n constructor(options) {\n const viewerVersion =\n typeof PDFJSDev !== \"undefined\" ? PDFJSDev.eval(\"BUNDLE_VERSION\") : null;\n if (version !== viewerVersion) {\n throw new Error(\n `The API version \"${version}\" does not match the Viewer version \"${viewerVersion}\".`\n );\n }\n this.container = options.container;\n this.viewer = options.viewer || options.container.firstElementChild;\n this.#viewerAlert = options.viewerAlert || null;\n\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n if (this.container?.tagName !== \"DIV\" || this.viewer?.tagName !== \"DIV\") {\n throw new Error(\"Invalid `container` and/or `viewer` option.\");\n }\n\n if (\n this.container.offsetParent &&\n getComputedStyle(this.container).position !== \"absolute\"\n ) {\n throw new Error(\"The `container` must be absolutely positioned.\");\n }\n }\n this.#resizeObserver.observe(this.container);\n\n this.eventBus = options.eventBus;\n this.linkService = options.linkService || new SimpleLinkService();\n this.downloadManager = options.downloadManager || null;\n this.findController = options.findController || null;\n this.#altTextManager = options.altTextManager || null;\n this.#commentManager = options.commentManager || null;\n this.#signatureManager = options.signatureManager || null;\n this.#editorUndoBar = options.editorUndoBar || null;\n\n if (this.findController) {\n this.findController.onIsPageVisible = pageNumber =>\n this._getVisiblePages().ids.has(pageNumber);\n }\n this._scriptingManager = options.scriptingManager || null;\n this.#textLayerMode = options.textLayerMode ?? TextLayerMode.ENABLE;\n this.#annotationMode =\n options.annotationMode ?? AnnotationMode.ENABLE_FORMS;\n this.#annotationEditorMode =\n options.annotationEditorMode ?? AnnotationEditorType.NONE;\n this.#annotationEditorHighlightColors =\n options.annotationEditorHighlightColors || null;\n this.#enableHighlightFloatingButton =\n options.enableHighlightFloatingButton === true;\n this.#enableUpdatedAddImage = options.enableUpdatedAddImage === true;\n this.#enableNewAltTextWhenAddingImage =\n options.enableNewAltTextWhenAddingImage === true;\n this.imageResourcesPath = options.imageResourcesPath || \"\";\n this.enablePrintAutoRotate = options.enablePrintAutoRotate || false;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.removePageBorders = options.removePageBorders || false;\n }\n this.maxCanvasPixels = options.maxCanvasPixels;\n this.maxCanvasDim = options.maxCanvasDim;\n this.capCanvasAreaFactor = options.capCanvasAreaFactor;\n this.enableDetailCanvas = options.enableDetailCanvas ?? true;\n this.l10n = options.l10n;\n if (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) {\n this.l10n ||= new GenericL10n();\n }\n this.#enablePermissions = options.enablePermissions || false;\n this.pageColors = options.pageColors || null;\n this.#mlManager = options.mlManager || null;\n this.#enableHWA = options.enableHWA || false;\n this.#supportsPinchToZoom = options.supportsPinchToZoom !== false;\n this.#enableAutoLinking = options.enableAutoLinking !== false;\n this.#minDurationToUpdateCanvas = options.minDurationToUpdateCanvas ?? 500;\n\n this.defaultRenderingQueue = !options.renderingQueue;\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.defaultRenderingQueue\n ) {\n // Custom rendering queue is not specified, using default one\n this.renderingQueue = new PDFRenderingQueue();\n this.renderingQueue.setViewer(this);\n } else {\n this.renderingQueue = options.renderingQueue;\n }\n\n const { abortSignal } = options;\n abortSignal?.addEventListener(\n \"abort\",\n () => {\n this.#resizeObserver.disconnect();\n this.#resizeObserver = null;\n },\n { once: true }\n );\n\n this.scroll = watchScroll(\n this.container,\n this._scrollUpdate.bind(this),\n abortSignal\n );\n this.presentationModeState = PresentationModeState.UNKNOWN;\n this._resetView();\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n this.removePageBorders\n ) {\n this.viewer.classList.add(\"removePageBorders\");\n }\n\n this.#updateContainerHeightCss();\n\n // Trigger API-cleanup, once thumbnail rendering has finished,\n // if the relevant pageView is *not* cached in the buffer.\n this.eventBus._on(\"thumbnailrendered\", ({ pageNumber, pdfPage }) => {\n const pageView = this._pages[pageNumber - 1];\n if (!this.#buffer.has(pageView)) {\n pdfPage?.cleanup();\n }\n });\n\n if (\n (typeof PDFJSDev === \"undefined\" || PDFJSDev.test(\"GENERIC\")) &&\n !options.l10n\n ) {\n // Ensure that Fluent is connected in e.g. the COMPONENTS build.\n this.l10n.translate(this.container);\n }\n }\n\n get 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(signal) {\n // Unless the viewer *and* its pages are visible, rendering won't start and\n // `this._onePageRenderedCapability` thus won't be resolved.\n // To ensure that automatic printing, on document load, still works even in\n // those cases we force-allow fetching of all pages when:\n // - The current window/tab is inactive, which will prevent rendering since\n // `requestAnimationFrame` is being used; fixes bug 1746213.\n // - The viewer is hidden in the DOM, e.g. in a `display: none`