@pdftools/four-heights-pdf-web-viewer 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +446 -0
- package/README.md +145 -0
- package/css/pdf-web-viewer.css +2407 -0
- package/doc/PdfWebViewer.pdf +0 -0
- package/es6/common/Checkbox.d.ts +9 -0
- package/es6/common/Checkbox.js +8 -0
- package/es6/common/Color.d.ts +23 -0
- package/es6/common/Color.js +118 -0
- package/es6/common/ColorPicker.d.ts +15 -0
- package/es6/common/ColorPicker.js +46 -0
- package/es6/common/Contextbar.d.ts +6 -0
- package/es6/common/Contextbar.js +19 -0
- package/es6/common/DragMoveHandler.d.ts +51 -0
- package/es6/common/DragMoveHandler.js +175 -0
- package/es6/common/Dropdown.d.ts +36 -0
- package/es6/common/Dropdown.js +76 -0
- package/es6/common/DropdownMenu.d.ts +9 -0
- package/es6/common/DropdownMenu.js +10 -0
- package/es6/common/DropdownSeparator.d.ts +3 -0
- package/es6/common/DropdownSeparator.js +6 -0
- package/es6/common/Icon.d.ts +13 -0
- package/es6/common/Icon.js +8 -0
- package/es6/common/Loader.d.ts +3 -0
- package/es6/common/Loader.js +6 -0
- package/es6/common/RangeSlider.d.ts +17 -0
- package/es6/common/RangeSlider.js +42 -0
- package/es6/common/StrokeStylePicker.d.ts +11 -0
- package/es6/common/StrokeStylePicker.js +20 -0
- package/es6/common/StrokeWidthPicker.d.ts +11 -0
- package/es6/common/StrokeWidthPicker.js +20 -0
- package/es6/common/Toolbar.d.ts +10 -0
- package/es6/common/Toolbar.js +6 -0
- package/es6/common/ToolbarButton.d.ts +14 -0
- package/es6/common/ToolbarButton.js +21 -0
- package/es6/common/ToolbarFileButton.d.ts +15 -0
- package/es6/common/ToolbarFileButton.js +27 -0
- package/es6/common/ToolbarItemGroup.d.ts +8 -0
- package/es6/common/ToolbarItemGroup.js +12 -0
- package/es6/common/ToolbarSeparator.d.ts +3 -0
- package/es6/common/ToolbarSeparator.js +6 -0
- package/es6/common/Tools.d.ts +10 -0
- package/es6/common/Tools.js +89 -0
- package/es6/common/TooltipManager.d.ts +12 -0
- package/es6/common/TooltipManager.js +54 -0
- package/es6/common/TranslationManager.d.ts +11 -0
- package/es6/common/TranslationManager.js +61 -0
- package/es6/common/classNames.d.ts +2 -0
- package/es6/common/classNames.js +18 -0
- package/es6/common/formatDate.d.ts +1 -0
- package/es6/common/formatDate.js +1 -0
- package/es6/common/icons.d.ts +13 -0
- package/es6/common/icons.js +412 -0
- package/es6/common/utils.d.ts +2 -0
- package/es6/common/utils.js +19 -0
- package/es6/custom/history.d.ts +2 -0
- package/es6/custom/history.js +59 -0
- package/es6/index.d.ts +5 -0
- package/es6/index.js +5 -0
- package/es6/lib/hyperapp/index.d.ts +108 -0
- package/es6/lib/hyperapp/index.js +327 -0
- package/es6/modules/CanvasLayer.d.ts +32 -0
- package/es6/modules/CanvasLayer.js +83 -0
- package/es6/modules/CanvasModule.d.ts +59 -0
- package/es6/modules/CanvasModule.js +98 -0
- package/es6/modules/eraser/EraserLayer.d.ts +13 -0
- package/es6/modules/eraser/EraserLayer.js +141 -0
- package/es6/modules/eraser/EraserModule.d.ts +19 -0
- package/es6/modules/eraser/EraserModule.js +34 -0
- package/es6/modules/eraser/EraserToolbar.d.ts +10 -0
- package/es6/modules/eraser/EraserToolbar.js +30 -0
- package/es6/modules/form-fields/CheckBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/CheckBoxWidget.js +45 -0
- package/es6/modules/form-fields/ComboBoxWidget.d.ts +22 -0
- package/es6/modules/form-fields/ComboBoxWidget.js +152 -0
- package/es6/modules/form-fields/EditFormFieldLayer.d.ts +17 -0
- package/es6/modules/form-fields/EditFormFieldLayer.js +238 -0
- package/es6/modules/form-fields/FormFieldModule.d.ts +15 -0
- package/es6/modules/form-fields/FormFieldModule.js +27 -0
- package/es6/modules/form-fields/ListBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/ListBoxWidget.js +73 -0
- package/es6/modules/form-fields/RadioButtonWidget.d.ts +9 -0
- package/es6/modules/form-fields/RadioButtonWidget.js +45 -0
- package/es6/modules/form-fields/SelectListWidget.d.ts +9 -0
- package/es6/modules/form-fields/SelectListWidget.js +45 -0
- package/es6/modules/form-fields/TextBoxWidget.d.ts +9 -0
- package/es6/modules/form-fields/TextBoxWidget.js +53 -0
- package/es6/modules/form-fields/WidgetBase.d.ts +23 -0
- package/es6/modules/form-fields/WidgetBase.js +29 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.d.ts +19 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationLayer.js +181 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.d.ts +21 -0
- package/es6/modules/freetext-annotation/AddFreetextAnnotationToolbar.js +37 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.d.ts +20 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationLayer.js +211 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.d.ts +50 -0
- package/es6/modules/freetext-annotation/EditFreetextAnnotationToolbar.js +118 -0
- package/es6/modules/freetext-annotation/FreetextAnnotationModule.d.ts +28 -0
- package/es6/modules/freetext-annotation/FreetextAnnotationModule.js +58 -0
- package/es6/modules/freetext-annotation/RichTextEditor.d.ts +31 -0
- package/es6/modules/freetext-annotation/RichTextEditor.js +223 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.d.ts +31 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationLayer.js +289 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.d.ts +20 -0
- package/es6/modules/highlight-annotation/AddHighlightAnnotationToolbar.js +52 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.d.ts +15 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationLayer.js +104 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.d.ts +15 -0
- package/es6/modules/highlight-annotation/EditHighlightAnnotationToolbar.js +28 -0
- package/es6/modules/highlight-annotation/HighlightAnnotationModule.d.ts +27 -0
- package/es6/modules/highlight-annotation/HighlightAnnotationModule.js +54 -0
- package/es6/modules/image-annotations/ImageAnnotationModule.d.ts +23 -0
- package/es6/modules/image-annotations/ImageAnnotationModule.js +169 -0
- package/es6/modules/index.d.ts +13 -0
- package/es6/modules/index.js +13 -0
- package/es6/modules/ink-annotation/AddInkAnnotationLayer.d.ts +40 -0
- package/es6/modules/ink-annotation/AddInkAnnotationLayer.js +503 -0
- package/es6/modules/ink-annotation/AddInkAnnotationToolbar.d.ts +30 -0
- package/es6/modules/ink-annotation/AddInkAnnotationToolbar.js +53 -0
- package/es6/modules/ink-annotation/EditInkAnnotationLayer.d.ts +20 -0
- package/es6/modules/ink-annotation/EditInkAnnotationLayer.js +137 -0
- package/es6/modules/ink-annotation/EditInkAnnotationToolbar.d.ts +25 -0
- package/es6/modules/ink-annotation/EditInkAnnotationToolbar.js +47 -0
- package/es6/modules/ink-annotation/InkAnnotationModule.d.ts +27 -0
- package/es6/modules/ink-annotation/InkAnnotationModule.js +50 -0
- package/es6/modules/popup/Popup.d.ts +64 -0
- package/es6/modules/popup/Popup.js +360 -0
- package/es6/modules/popup/PopupLayer.d.ts +31 -0
- package/es6/modules/popup/PopupLayer.js +509 -0
- package/es6/modules/popup/PopupModule.d.ts +16 -0
- package/es6/modules/popup/PopupModule.js +25 -0
- package/es6/modules/print-service/PrintServiceDialog.d.ts +30 -0
- package/es6/modules/print-service/PrintServiceDialog.js +134 -0
- package/es6/modules/print-service/PrintServiceLayer.d.ts +24 -0
- package/es6/modules/print-service/PrintServiceLayer.js +310 -0
- package/es6/modules/print-service/PrintServiceModule.d.ts +18 -0
- package/es6/modules/print-service/PrintServiceModule.js +30 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationLayer.d.ts +24 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationLayer.js +210 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.d.ts +26 -0
- package/es6/modules/shape-annotations/AddShapeAnnotationToolbar.js +69 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationLayer.d.ts +19 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationLayer.js +148 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.d.ts +24 -0
- package/es6/modules/shape-annotations/EditShapeAnnotationToolbar.js +57 -0
- package/es6/modules/shape-annotations/ShapeAnnotationModule.d.ts +28 -0
- package/es6/modules/shape-annotations/ShapeAnnotationModule.js +50 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationLayer.d.ts +19 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationLayer.js +257 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.d.ts +17 -0
- package/es6/modules/stamp-annotation/AddStampAnnotationToolbar.js +68 -0
- package/es6/modules/stamp-annotation/StampAnnotationModule.d.ts +20 -0
- package/es6/modules/stamp-annotation/StampAnnotationModule.js +35 -0
- package/es6/modules/text-annotation/AddTextAnnotationLayer.d.ts +14 -0
- package/es6/modules/text-annotation/AddTextAnnotationLayer.js +132 -0
- package/es6/modules/text-annotation/AddTextAnnotationToolbar.d.ts +15 -0
- package/es6/modules/text-annotation/AddTextAnnotationToolbar.js +27 -0
- package/es6/modules/text-annotation/TextAnnotationModule.d.ts +19 -0
- package/es6/modules/text-annotation/TextAnnotationModule.js +34 -0
- package/es6/pdf-viewer-api/ImageContainer.d.ts +10 -0
- package/es6/pdf-viewer-api/ImageContainer.js +43 -0
- package/es6/pdf-viewer-api/PdfViewerApi.d.ts +463 -0
- package/es6/pdf-viewer-api/PdfViewerApi.js +732 -0
- package/es6/pdf-viewer-api/PdfViewingWrapper.d.ts +178 -0
- package/es6/pdf-viewer-api/PdfViewingWrapper.js +2037 -0
- package/es6/pdf-viewer-api/annotationDefaultBehaviors.d.ts +3 -0
- package/es6/pdf-viewer-api/annotationDefaultBehaviors.js +30 -0
- package/es6/pdf-viewer-api/enums.d.ts +100 -0
- package/es6/pdf-viewer-api/enums.js +113 -0
- package/es6/pdf-viewer-api/index.d.ts +3 -0
- package/es6/pdf-viewer-api/index.js +3 -0
- package/es6/pdf-viewer-api/types.d.ts +284 -0
- package/es6/pdf-viewer-api/types.js +6 -0
- package/es6/pdf-viewer-canvas/CanvasEvents.d.ts +76 -0
- package/es6/pdf-viewer-canvas/CanvasEvents.js +345 -0
- package/es6/pdf-viewer-canvas/PdfViewerCanvas.d.ts +175 -0
- package/es6/pdf-viewer-canvas/PdfViewerCanvas.js +1226 -0
- package/es6/pdf-viewer-canvas/state/annotations.d.ts +36 -0
- package/es6/pdf-viewer-canvas/state/annotations.js +157 -0
- package/es6/pdf-viewer-canvas/state/appState.d.ts +10 -0
- package/es6/pdf-viewer-canvas/state/appState.js +60 -0
- package/es6/pdf-viewer-canvas/state/canvas.d.ts +31 -0
- package/es6/pdf-viewer-canvas/state/canvas.js +41 -0
- package/es6/pdf-viewer-canvas/state/document.d.ts +50 -0
- package/es6/pdf-viewer-canvas/state/document.js +99 -0
- package/es6/pdf-viewer-canvas/state/pointer.d.ts +31 -0
- package/es6/pdf-viewer-canvas/state/pointer.js +31 -0
- package/es6/pdf-viewer-canvas/state/scroll.d.ts +22 -0
- package/es6/pdf-viewer-canvas/state/scroll.js +25 -0
- package/es6/pdf-viewer-canvas/state/search.d.ts +36 -0
- package/es6/pdf-viewer-canvas/state/search.js +27 -0
- package/es6/pdf-viewer-canvas/state/store.d.ts +39 -0
- package/es6/pdf-viewer-canvas/state/store.js +52 -0
- package/es6/pdf-viewer-canvas/state/viewer.d.ts +91 -0
- package/es6/pdf-viewer-canvas/state/viewer.js +175 -0
- package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.d.ts +28 -0
- package/es6/pdf-viewer-canvas/view-layers/AnnotationSelectionLayer.js +452 -0
- package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.d.ts +9 -0
- package/es6/pdf-viewer-canvas/view-layers/BusyStateLayer.js +25 -0
- package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.d.ts +10 -0
- package/es6/pdf-viewer-canvas/view-layers/PdfDocumentLayer.js +149 -0
- package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.d.ts +48 -0
- package/es6/pdf-viewer-canvas/view-layers/ScrollLayer.js +308 -0
- package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.d.ts +19 -0
- package/es6/pdf-viewer-canvas/view-layers/TextSelectionLayer.js +289 -0
- package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.d.ts +31 -0
- package/es6/pdf-viewer-canvas/view-layers/ViewLayerBase.js +106 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasShapes.d.ts +11 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasShapes.js +149 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.d.ts +3 -0
- package/es6/pdf-viewer-canvas/view-layers/canvasUtlis.js +10 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.d.ts +52 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationBorder.js +377 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.d.ts +47 -0
- package/es6/pdf-viewer-canvas/view-layers/views/AnnotationContextBar.js +102 -0
- package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.d.ts +14 -0
- package/es6/pdf-viewer-canvas/view-layers/views/TextSelectionContextBar.js +36 -0
- package/es6/pdf-viewing/PdfViewing.d.ts +4865 -0
- package/es6/pdf-viewing/PdfViewing.js +9611 -0
- package/es6/pdf-web-viewer/PdfWebViewer.d.ts +372 -0
- package/es6/pdf-web-viewer/PdfWebViewer.js +1386 -0
- package/es6/pdf-web-viewer/UserSettings.d.ts +8 -0
- package/es6/pdf-web-viewer/UserSettings.js +40 -0
- package/es6/pdf-web-viewer/WebViewerOptions.d.ts +387 -0
- package/es6/pdf-web-viewer/WebViewerOptions.js +582 -0
- package/es6/pdf-web-viewer/state/index.d.ts +80 -0
- package/es6/pdf-web-viewer/state/index.js +98 -0
- package/es6/pdf-web-viewer/state/layout.d.ts +24 -0
- package/es6/pdf-web-viewer/state/layout.js +21 -0
- package/es6/pdf-web-viewer/state/mobile.d.ts +16 -0
- package/es6/pdf-web-viewer/state/mobile.js +11 -0
- package/es6/pdf-web-viewer/state/navigationPanel.d.ts +61 -0
- package/es6/pdf-web-viewer/state/navigationPanel.js +84 -0
- package/es6/pdf-web-viewer/state/passwordForm.d.ts +18 -0
- package/es6/pdf-web-viewer/state/passwordForm.js +21 -0
- package/es6/pdf-web-viewer/state/pdfDocument.d.ts +31 -0
- package/es6/pdf-web-viewer/state/pdfDocument.js +41 -0
- package/es6/pdf-web-viewer/state/search.d.ts +29 -0
- package/es6/pdf-web-viewer/state/search.js +23 -0
- package/es6/pdf-web-viewer/views/App.d.ts +4 -0
- package/es6/pdf-web-viewer/views/App.js +19 -0
- package/es6/pdf-web-viewer/views/CustomButtons.d.ts +9 -0
- package/es6/pdf-web-viewer/views/CustomButtons.js +18 -0
- package/es6/pdf-web-viewer/views/DropZone.d.ts +9 -0
- package/es6/pdf-web-viewer/views/DropZone.js +53 -0
- package/es6/pdf-web-viewer/views/Layout.d.ts +4 -0
- package/es6/pdf-web-viewer/views/Layout.js +22 -0
- package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/annotationbar/Annotationbar.js +21 -0
- package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AddonsToolbar.js +35 -0
- package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AnnotationsMenu.js +22 -0
- package/es6/pdf-web-viewer/views/appbar/AppBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/AppBar.js +26 -0
- package/es6/pdf-web-viewer/views/appbar/DocumentBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/DocumentBar.js +36 -0
- package/es6/pdf-web-viewer/views/appbar/Menu.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/Menu.js +80 -0
- package/es6/pdf-web-viewer/views/appbar/NavigationBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/NavigationBar.js +74 -0
- package/es6/pdf-web-viewer/views/appbar/SearchBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/SearchBar.js +83 -0
- package/es6/pdf-web-viewer/views/appbar/SearchOptions.d.ts +10 -0
- package/es6/pdf-web-viewer/views/appbar/SearchOptions.js +55 -0
- package/es6/pdf-web-viewer/views/appbar/ViewBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/ViewBar.js +52 -0
- package/es6/pdf-web-viewer/views/appbar/ZoomBar.d.ts +4 -0
- package/es6/pdf-web-viewer/views/appbar/ZoomBar.js +18 -0
- package/es6/pdf-web-viewer/views/modal/ApplicationError.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/ApplicationError.js +25 -0
- package/es6/pdf-web-viewer/views/modal/LoadApplication.d.ts +3 -0
- package/es6/pdf-web-viewer/views/modal/LoadApplication.js +6 -0
- package/es6/pdf-web-viewer/views/modal/LoadFile.d.ts +3 -0
- package/es6/pdf-web-viewer/views/modal/LoadFile.js +10 -0
- package/es6/pdf-web-viewer/views/modal/Modal.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/Modal.js +39 -0
- package/es6/pdf-web-viewer/views/modal/OpenFile.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/OpenFile.js +30 -0
- package/es6/pdf-web-viewer/views/modal/OpenFileError.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/OpenFileError.js +13 -0
- package/es6/pdf-web-viewer/views/modal/PasswordForm.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/PasswordForm.js +54 -0
- package/es6/pdf-web-viewer/views/modal/SaveFile.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/SaveFile.js +10 -0
- package/es6/pdf-web-viewer/views/modal/UnsavedChanges.d.ts +4 -0
- package/es6/pdf-web-viewer/views/modal/UnsavedChanges.js +32 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationList.d.ts +8 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationList.js +26 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.d.ts +8 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationListItem.js +158 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/AnnotationNavigation.js +11 -0
- package/es6/pdf-web-viewer/views/navigation/NavigationPanel.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/NavigationPanel.js +50 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineList.d.ts +12 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineList.js +19 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.d.ts +4 -0
- package/es6/pdf-web-viewer/views/navigation/OutlineNavigation.js +10 -0
- package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.d.ts +16 -0
- package/es6/pdf-web-viewer/views/navigation/ThumbnailNavigation.js +32 -0
- package/package.json +24 -0
- package/pdfwebviewer/PdfViewing.data +0 -0
- package/pdfwebviewer/PdfViewing_Main.js +1 -0
- package/pdfwebviewer/PdfViewing_Main.wasm +0 -0
- package/pdfwebviewer/PdfViewing_Worker.js +1 -0
- package/pdfwebviewer/PdfViewing_Worker.wasm +0 -0
- package/pdfwebviewer/pdf-web-viewer.css +2407 -0
- package/pdfwebviewer/pdf-web-viewer.development.js +25955 -0
- package/pdfwebviewer/pdf-web-viewer.min.js +1 -0
- package/pdfwebviewer/translations.de.json +151 -0
- package/pdfwebviewer/translations.en.json +151 -0
- package/pdfwebviewer/translations.fr.json +151 -0
- package/pdfwebviewer/translations.it.json +151 -0
- package/scss/common/_breakpoints.scss +44 -0
- package/scss/common/_buttons.scss +42 -0
- package/scss/common/_colorpicker.scss +89 -0
- package/scss/common/_common.scss +21 -0
- package/scss/common/_contextbar.scss +44 -0
- package/scss/common/_dropdown.scss +176 -0
- package/scss/common/_icon.scss +9 -0
- package/scss/common/_index.scss +19 -0
- package/scss/common/_loader.scss +30 -0
- package/scss/common/_rangeslider.scss +24 -0
- package/scss/common/_scrollbars.scss +64 -0
- package/scss/common/_stroke-style-picker.scss +64 -0
- package/scss/common/_stroke-width-picker.scss +23 -0
- package/scss/common/_toolbar.scss +117 -0
- package/scss/common/_tooltip.scss +39 -0
- package/scss/modules/_eraser.scss +28 -0
- package/scss/modules/_forms.scss +56 -0
- package/scss/modules/_highlightannotation.scss +12 -0
- package/scss/modules/_index.scss +5 -0
- package/scss/modules/_inkannotation.scss +41 -0
- package/scss/modules/_stampannotation.scss +19 -0
- package/scss/pdf-viewer-canvas/_annotationborder.scss +107 -0
- package/scss/pdf-viewer-canvas/_busy-loader.scss +53 -0
- package/scss/pdf-viewer-canvas/_freetexteditor.scss +28 -0
- package/scss/pdf-viewer-canvas/_index.scss +7 -0
- package/scss/pdf-viewer-canvas/_layout.scss +52 -0
- package/scss/pdf-viewer-canvas/_popup.scss +217 -0
- package/scss/pdf-viewer-canvas/_printservice.scss +171 -0
- package/scss/pdf-viewer-canvas/_textselection.scss +17 -0
- package/scss/pdf-web-viewer/_annotationbar.scss +47 -0
- package/scss/pdf-web-viewer/_index.scss +8 -0
- package/scss/pdf-web-viewer/_layout.scss +63 -0
- package/scss/pdf-web-viewer/_modal.scss +186 -0
- package/scss/pdf-web-viewer/_navigationpanel.scss +398 -0
- package/scss/pdf-web-viewer/_searchbar.scss +47 -0
- package/scss/pdf-web-viewer/_toolbar.scss +134 -0
- package/scss/pdf-web-viewer/_viewer.scss +54 -0
- package/scss/pdf-web-viewer.scss +1 -0
- package/scss/themes/default/_light.scss +32 -0
- package/scss/themes/default/_mixins.scss +129 -0
- package/scss/themes/default/_theme.scss +161 -0
- package/scss/themes/pdf-web-viewer.scss +1 -0
- package/umd/pdf-web-viewer.development.js +25955 -0
- package/umd/pdf-web-viewer.development.js.map +1 -0
- package/umd/pdf-web-viewer.min.js +1 -0
- package/wasm/PdfViewing.data +0 -0
- package/wasm/PdfViewing_Main.js +1 -0
- package/wasm/PdfViewing_Main.wasm +0 -0
- package/wasm/PdfViewing_Worker.js +1 -0
- package/wasm/PdfViewing_Worker.wasm +0 -0
- package/wasm/translations.de.json +151 -0
- package/wasm/translations.en.json +151 -0
- package/wasm/translations.fr.json +151 -0
- package/wasm/translations.it.json +151 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PdfTools=t():e.PdfTools=t()}(self,(()=>(()=>{"use strict";var e,t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};function i(e,t){for(var n=[],i=[],o=arguments.length;o-- >2;)n.push(arguments[o]);for(;n.length;){var s=n.pop();if(s&&s.pop)for(o=s.length;o--;)n.push(s[o]);else null!=s&&!0!==s&&!1!==s&&i.push(s)}return"function"==typeof e?e(t||{},i):{nodeName:e,attributes:t||{},children:i,key:t&&t.key}}function o(e,t,n,i){var o,s=[].map,a=i&&i.children[0]||null,r=a&&function e(t){return{nodeName:t.nodeName.toLowerCase(),attributes:{},children:s.call(t.childNodes,(function(t){return 3===t.nodeType?t.nodeValue:e(t)}))}}(a),l=[],d=!0,h=m(e),c=function e(t,n,i){for(var o in i)"function"==typeof i[o]?function(e,o){i[e]=function(e){var s=o(e);return"function"==typeof s&&(s=s(v(t,h),i)),s&&s!==(n=v(t,h))&&!s.then&&g(h=f(t,m(n,s),h)),s}}(o,i[o]):e(t.concat(o),n[o]=m(n[o]),i[o]=m(i[o]));return i}([],h,m(t));return g(),c;function u(e){return"function"==typeof e?u(e(h,c)):null!=e?e:""}function p(){o=!o;var e=u(n);for(i&&!o&&(a=E(i,a,r,r=e)),d=!1;l.length;)l.pop()()}function g(){o||(o=!0,setTimeout(p))}function m(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n}function f(e,t,n){var i={};return e.length?(i[e[0]]=e.length>1?f(e.slice(1),t,n[e[0]]):t,m(n,i)):t}function v(e,t){for(var n=0;n<e.length;)t=t[e[n++]];return t}function w(e){return e?e.key:null}function b(e){return e.currentTarget.events[e.type](e)}function P(e,t,n,i,o){if("key"===t);else if("style"===t)if("string"==typeof n)e.style.cssText=n;else for(var s in"string"==typeof i&&(i=e.style.cssText=""),m(i,n)){var a=null==n||null==n[s]?"":n[s];"-"===s[0]?e.style.setProperty(s,a):e.style[s]=a}else"o"===t[0]&&"n"===t[1]?(t=t.slice(2),e.events?i||(i=e.events[t]):e.events={},e.events[t]=n,n?i||e.addEventListener(t,b):e.removeEventListener(t,b)):t in e&&"list"!==t&&"type"!==t&&"draggable"!==t&&"spellcheck"!==t&&"translate"!==t&&!o?e[t]=null==n?"":n:null!=n&&!1!==n&&e.setAttribute(t,n),null!=n&&!1!==n||e.removeAttribute(t)}function y(e,t){var n="string"==typeof e||"number"==typeof e?document.createTextNode(e):(t=t||"svg"===e.nodeName)?document.createElementNS("http://www.w3.org/2000/svg",e.nodeName):document.createElement(e.nodeName),i=e.attributes;if(i){i.oncreate&&l.push((function(){i.oncreate(n)}));for(var o=0;o<e.children.length;o++)n.appendChild(y(e.children[o]=u(e.children[o]),t));for(var s in i)P(n,s,i[s],null,t)}return n}function C(e,t){var n=t.attributes;if(n){for(var i=0;i<t.children.length;i++)C(e.childNodes[i],t.children[i]);n.ondestroy&&n.ondestroy(e)}return e}function A(e,t,n){function i(){e.removeChild(C(t,n))}var o=n.attributes&&n.attributes.onremove;o?o(t,i):i()}function E(e,t,n,i,o){if(i===n);else if(null==n||n.nodeName!==i.nodeName){var s=y(i,o);e.insertBefore(s,t),null!=n&&A(e,t,n),t=s}else if(null==n.nodeName)t.nodeValue=i;else{!function(e,t,n,i){for(var o in m(t,n))n[o]!==("value"===o||"checked"===o?e[o]:t[o])&&P(e,o,n[o],t[o],i);var s=d?n.oncreate:n.onupdate;s&&l.push((function(){s(e,t)}))}(t,n.attributes,i.attributes,o=o||"svg"===i.nodeName);for(var a={},r={},h=[],c=n.children,p=i.children,g=0;g<c.length;g++)h[g]=t.childNodes[g],null!=(v=w(c[g]))&&(a[v]=[h[g],c[g]]);g=0;for(var f=0;f<p.length;){var v=w(c[g]),b=w(p[f]=u(p[f]));if(r[v])g++;else if(null==b||b!==w(c[g+1]))if(null==b||d)null==v&&(E(t,h[g],c[g],p[f],o),f++),g++;else{var C=a[b]||[];v===b?(E(t,C[0],C[1],p[f],o),g++):C[0]?E(t,t.insertBefore(C[0],h[g]),C[1],p[f],o):E(t,h[g],null,p[f],o),r[b]=p[f],f++}else null==v&&A(t,h[g],c[g]),g++}for(;g<c.length;)null==w(c[g])&&A(t,h[g],c[g]),g++;for(var g in a)r[g]||A(t,a[g][0],a[g][1])}return t}}t.r(n),t.d(n,{AnnotationBorderStyle:()=>F,AnnotationColorOptions:()=>li,AnnotationFontOptions:()=>di,AnnotationOptions:()=>hi,CanvasLayer:()=>ut,CanvasModule:()=>ht,CanvasModuleType:()=>dt,ColorPaletteMap:()=>ni,DocumentChange:()=>Y,EraserModule:()=>Pn,FileType:()=>k,FormFieldModule:()=>kn,FormsOptions:()=>ai,FreetextAnnotationModule:()=>Ht,GeneralOptions:()=>oi,HighlightAnnotationModule:()=>Yt,ImageAnnotationModule:()=>dn,InkAnnotationModule:()=>en,OptionsToVerify:()=>ti,PdfActionType:()=>_,PdfDestinationType:()=>H,PdfFitMode:()=>G,PdfItemCategory:()=>I,PdfItemType:()=>z,PdfPageLayoutMode:()=>W,PdfViewerApi:()=>ie,PdfViewerCanvas:()=>In,PdfWebViewer:()=>gi,PopupModule:()=>sn,PrintServiceModule:()=>En,RotationDirection:()=>K,SearchResultType:()=>X,ShapeAnnotationModule:()=>vn,SidebarOptions:()=>si,StampAnnotationColor:()=>B,StampAnnotationModule:()=>mt,StampType:()=>U,TextAnnotationModule:()=>ln,ViewerOptions:()=>ri,WebViewerOptions:()=>ci,WidgetType:()=>j,defaultAnnotationColorOptions:()=>Wn,defaultAnnotationFontOptions:()=>_n,defaultAnnotationOptions:()=>Xn,defaultAnnotationStamps:()=>Un,defaultFormsOptions:()=>qn,defaultGeneralOptions:()=>Yn,defaultKeyboardShortcuts:()=>Kn,defaultPermissions:()=>$n,defaultSidebarOptions:()=>Zn,defaultViewerModules:()=>Jn,defaultViewerOptions:()=>Qn,defaultWebViewerOptions:()=>ei}),void 0===window.PdfToolsPromise&&(window.Module={},Module.locateFile=(e,t)=>{const n=window.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL;return n?n+(n.endsWith("/")?"":"/")+e:e},window.PdfToolsPromise=new Promise(((e,t)=>{window.Module.onRuntimeInitialized=()=>{if("function"!=typeof Module.ViewingInitialize){const e="**************************************\nCould not find method Module.ViewingInitialize\n\n%cYou may be using a mismatched version of the 4-Heights® PDF Viewing SDK. Please make sure you have updated all files to the same version.\n%c**************************************";console.error(e,"color: orange","color: gray","color: red"),t(e)}Module.ViewingInitialize(),e()};const n=document.createElement("script"),i=window.Module.locateFile("PdfViewing_Main.js");n.onerror=function(e){console.error(`**************************************\nFailed to load PdfViewing_Main.js \n\n%cThe 4-Heights® PDF Viewing SDK failed to load a required script resource. Either the "Base URL" (PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL) is not configured correctly or the static assets have not been copied to the configured location. For more information please consult the documentation.\n\n%cwindow.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL=>${window.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL}\n%c**************************************`,"color: orange","color: gray","color: red"),t("failed to load PdfViewing_Main.js")},n.src=i,document.head.appendChild(n)}))),function(e){var t;let n,i,o,s,a;!function(t){class n{static throwLastError(e=!0){let t=this.createLastError(this.lastErrorCode,this.lastErrorMessage,e);if(null!==t)throw t}static createLastError(t,n,i=!0){switch(t){case 0:return i?null:new e.PdfViewingError("An unexpected error occurred");case 10:return new e.GenericError(n);case 11:return new e.FatalError(n);case 12:return new e.LicenseError(n);case 15:return new e.UnknownFormatError(n);case 16:return new e.CorruptError(n);case 17:return new e.PasswordError(n);case 18:return new e.ConformanceError(n);case 19:return new e.UnsupportedFeatureError(n);case 20:return new e.InfrastructureError(n);case 21:return new e.ProcessingError(n);case 22:return new e.ExistsError(n);case 23:return new e.UpdateFailedError(n);case 1:return new e.NotSupportedError(n);case 2:return new e.InvalidOperationError(n);case 3:return new e.ArgumentError(n);case 5:return new e.NotFoundError(n);case 4:return new e.IOError(n);default:return null}}static get lastErrorMessage(){return Module.ViewingGetLastErrorMessage()}static get lastErrorCode(){return Module.ViewingGetLastError()}}t.NativeBase=n;class i extends n{constructor(e){super(),this._handle=e}get handle(){if(0===this._handle)throw new Error("NULL Pointer");return this._handle}set handle(e){this._handle=e}equals(e){return e instanceof i&&0!==this._handle&&0!==e._handle&&Module.ViewingEquals(this._handle,e._handle)}getHashCode(){return 0===this._handle?0:Module.ViewingGetHashCode(this._handle)}static checkReturnHandleErrorCode(e){return 0===e&&n.throwLastError(!1),e}}t.NativeObject=i}(n=e.Internal||(e.Internal={}));class r extends Error{constructor(e){super(e);const t=new.target.prototype;Object.setPrototypeOf(this,t),Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t}}e.PdfViewingError=r,function(e){e[e.Annotate=1]="Annotate",e[e.FillFormFields=2]="FillFormFields",e[e.PageRotation=4]="PageRotation"}(i=e.LicenseFeature||(e.LicenseFeature={}));class l extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingNewViewerController())),this.eventListeners=new Map}addEventListener(t,i){if("function"!=typeof i)throw new e.ArgumentError("Argument 'listener' must be a function.");var o;if(this.eventListeners.has(t)){if(!this.eventListeners.get(t).has(i)&&"busyChanged"===t){o=new h(i);let e=Module.ViewingViewerControllerAddBusyChangedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e,this.eventListeners.get(t).set(i,o)}if(!this.eventListeners.get(t).has(i)&&"errorOccured"===t){o=new c(i);let e=Module.ViewingViewerControllerAddErrorOccuredHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e,this.eventListeners.get(t).set(i,o)}}else{if("busyChanged"===t){o=new h(i);let e=Module.ViewingViewerControllerAddBusyChangedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e;let s=new Map;s.set(i,o),this.eventListeners.set(t,s)}if("errorOccured"===t){o=new c(i);let e=Module.ViewingViewerControllerAddErrorOccuredHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e;let s=new Map;s.set(i,o),this.eventListeners.set(t,s)}}}removeEventListener(e,t){if(this.eventListeners.has(e)){if("busyChanged"===e){let i=this.eventListeners.get(e);if(i.has(t)){let e=i.get(t);try{Module.ViewingViewerControllerRemoveBusyChangedHandler(this.handle,null==e?void 0:e.context)||n.NativeBase.throwLastError()}catch(e){if(e instanceof A)throw e}i.delete(t),0===i.size&&this.eventListeners.delete("busyChanged")}}if("errorOccured"===e){let i=this.eventListeners.get(e);if(i.has(t)){let e=i.get(t);try{Module.ViewingViewerControllerRemoveErrorOccuredHandler(this.handle,null==e?void 0:e.context)||n.NativeBase.throwLastError()}catch(e){if(e instanceof A)throw e}i.delete(t),0===i.size&&this.eventListeners.delete("errorOccured")}}}}static createDynamicObject(e){return new l({__handle:e})}close(){Module.ViewingViewerControllerClose(this.handle)||n.NativeBase.throwLastError()}open(t,n=null,i=null){if(!(t instanceof e.IO.InputDocument))throw new e.ArgumentError("Argument 'pdfFile' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.");if(null!=n&&!(n instanceof e.IO.InputDocumentList))throw new e.ArgumentError("Argument 'fdfFiles' must be of type PdfViewing.IO.InputDocumentList or can be null or undefined.");if(null!=i&&"string"!=typeof i)throw new e.ArgumentError("Argument 'password' must be of type string or can be null or undefined.");var o=this;return new Promise((function(e,s){Module.ViewingViewerControllerOpen(o.handle,{thisHandle:o,resolved:e,rejected:s},t.handle,null!=n?n.handle:0,i)||s(Module.ViewingGetLastErrorMessage())}))}openCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Document.createDynamicObject(i)):t.rejected(a)}openMem(t,n,i){if(!(t instanceof Uint8Array))throw new e.ArgumentError("Argument 'pdf' must be of type Uint8Array and must not be null or undefined.");if(null!=n&&!(n instanceof Uint8Array))throw new e.ArgumentError("Argument 'fdf' must be of type Uint8Array or can be null or undefined.");if(null!=i&&"string"!=typeof i)throw new e.ArgumentError("Argument 'password' must be of type string or can be null or undefined.");var o=this;return new Promise((function(e,s){Module.ViewingViewerControllerOpenMem(o.handle,{thisHandle:o,resolved:e,rejected:s},t,n,i)||s(Module.ViewingGetLastErrorMessage())}))}openMemCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Document.createDynamicObject(i)):t.rejected(a)}openUri(t,n,i,o,s){if("string"!=typeof t)throw new e.ArgumentError("Argument 'pdfUri' must be of type string and must not be null or undefined.");if(null!=n&&"string"!=typeof n)throw new e.ArgumentError("Argument 'fdfUri' must be of type string or can be null or undefined.");if(null!=i&&"string"!=typeof i)throw new e.ArgumentError("Argument 'password' must be of type string or can be null or undefined.");if(null!=o&&"string"!=typeof o)throw new e.ArgumentError("Argument 'pdfAuthorization' must be of type string or can be null or undefined.");if(null!=s&&"string"!=typeof s)throw new e.ArgumentError("Argument 'fdfAuthorization' must be of type string or can be null or undefined.");var a=this;return new Promise((function(e,r){Module.ViewingViewerControllerOpenUri(a.handle,{thisHandle:a,resolved:e,rejected:r},t,n,i,o,s)||r(Module.ViewingGetLastErrorMessage())}))}openUriCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Document.createDynamicObject(i)):t.rejected(a)}merge(t,n,i=null,o=null,s=null){if(!(t instanceof e.IO.InputDocument))throw new e.ArgumentError("Argument 'first' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.");if(!(n instanceof e.IO.InputDocument))throw new e.ArgumentError("Argument 'second' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.");if(null!=i&&"string"!=typeof i)throw new e.ArgumentError("Argument 'firstDocumentPassword' must be of type string or can be null or undefined.");if(null!=o&&"string"!=typeof o)throw new e.ArgumentError("Argument 'secondDocumentPassword' must be of type string or can be null or undefined.");if(null!=s&&!(s instanceof e.IO.MergeOptions))throw new e.ArgumentError("Argument 'mergeOptions' must be of type PdfViewing.IO.MergeOptions or can be null or undefined.");var a=this;return new Promise((function(e,r){Module.ViewingViewerControllerMerge(a.handle,{thisHandle:a,resolved:e,rejected:r},t.handle,n.handle,i,o,null!=s?s.handle:0)||r(Module.ViewingGetLastErrorMessage())}))}mergeCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Content.BinaryBuffer.createDynamicObject(i)):t.rejected(a)}get isBusy(){let e=Module.ViewingViewerControllerGetIsBusy(this.handle);return e||n.NativeBase.throwLastError(),e}set formsHighlightColor(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'formsHighlightColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingViewerControllerSetFormsHighlightColor(this.handle,t)||n.NativeBase.throwLastError(!1)}set formsHighlightRequiredColor(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'formsHighlightRequiredColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingViewerControllerSetFormsHighlightRequiredColor(this.handle,t)||n.NativeBase.throwLastError(!1)}}e.ViewerController=l;class d{constructor(e){this.listener=e}}class h extends d{constructor(e){super(e)}dispatchEventBusyChanged(e){this.listener(e)}}class c extends d{constructor(e){super(e)}dispatchEventErrorOccured(){this.listener(void 0)}}class u extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new u(e)}static initialize(t,i){if("string"!=typeof t)throw new e.ArgumentError("Argument 'license' must be of type string and must not be null or undefined.");if(null!=i&&"string"!=typeof i)throw new e.ArgumentError("Argument 'producerSuffix' must be of type string or can be null or undefined.");Module.ViewingSdkInitialize(t,i)||n.NativeBase.throwLastError(!1)}static get version(){let e=Module.ViewingSdkGetVersion();return null===e&&n.NativeBase.throwLastError(!1),e}static get producerFullName(){let e=Module.ViewingSdkGetProducerFullName();return null===e&&n.NativeBase.throwLastError(!1),e}static get supportedFeatures(){let e=Module.ViewingSdkGetSupportedFeatures();return 0===e&&n.NativeBase.throwLastError(),e}}e.Sdk=u;class p extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new p(e)}nativeGet(e){let t=Module.ViewingIntegerSetGet(this.handle,e);return-1===t&&5!==Module.ViewingGetLastError()&&n.NativeBase.throwLastError(!1),t}[Symbol.iterator](){return new f(this)}clear(){Module.ViewingIntegerSetClear(this.handle)||n.NativeBase.throwLastError(!1)}delete(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'value' must be of type number and must not be null or undefined.");if(-1==this.nativeGet(t))return!1;var i=Module.ViewingIntegerSetRemove(this.handle,this.nativeGet(t));return i||n.NativeBase.throwLastError(!1),i}forEach(e,t){for(const t of this.entries())e(t[1],t[0],this)}has(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'value' must be of type number and must not be null or undefined.");return-1!==this.nativeGet(t)}add(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'value' must be of type number and must not be null or undefined.");return Module.ViewingIntegerSetAdd(this.handle,t)||n.NativeBase.throwLastError(!1),this}get size(){let e=Module.ViewingIntegerSetGetSize(this.handle);return e<0&&n.NativeBase.throwLastError(!1),e}entries(){return new m(this)}keys(){return new f(this)}values(){return new f(this)}}Symbol.toStringTag,e.IntegerSet=p;class g{constructor(e){this.set=e,this.index=Module.ViewingIntegerSetGetBegin(e.handle),-1===this.index&&n.NativeBase.throwLastError(!1),this.end=Module.ViewingIntegerSetGetEnd(e.handle),-1===this.end&&n.NativeBase.throwLastError(!1)}getNextIndex(){let e=Module.ViewingIntegerSetGetNext(this.set.handle,this.index);return-1===e&&n.NativeBase.throwLastError(!1),e}getValueFromIndex(e){let t=Module.ViewingIntegerSetGetValue(this.set.handle,e);return 0===t&&n.NativeBase.throwLastError(),t}}class m extends g{constructor(e){super(e)}next(){if(this.index===this.end)return{done:!0,value:null};let e=this.getValueFromIndex(this.index);return this.index=this.getNextIndex(),{done:!1,value:[e,e]}}[Symbol.iterator](){return new m(this.set)}}class f extends g{constructor(e){super(e)}next(){if(this.index===this.end)return{done:!0,value:null};let e=this.getValueFromIndex(this.index);return this.index=this.getNextIndex(),{done:!1,value:e}}[Symbol.iterator](){return new f(this.set)}}class v extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new v(e)}remove(e){throw new Error("Method not implemented.")}add(e){throw new Error("Method not implemented.")}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(e){let t=Module.ViewingStringListGet(this.handle,e);return null===t&&n.NativeBase.throwLastError(!1),t}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingStringListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}e.StringList=v;class w extends n.NativeObject{constructor(e){super(e),this[t]="StringMap"}static createDynamicObject(e){return new w(e)}nativeGet(e){let t=Module.ViewingStringMapGet(this.handle,e);return-1===t&&5!==Module.ViewingGetLastError()&&n.NativeBase.throwLastError(),t}[Symbol.iterator](){return new P(this)}clear(){Module.ViewingStringMapClear(this.handle)||n.NativeBase.throwLastError(!1)}delete(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'key' must be of type string and must not be null or undefined.");let i=this.nativeGet(t);return-1!=i&&(Module.ViewingStringMapRemove(this.handle,i)||n.NativeBase.throwLastError(!1),!0)}forEach(e,t){for(const t of this.entries())e(t[1],t[0],this)}get(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'key' must be of type string and must not be null or undefined.");let i=Module.ViewingStringMapGet(this.handle,t);-1===i&&n.NativeBase.throwLastError(!1);let o=Module.ViewingStringMapGetValue(this.handle,i);return null===o&&n.NativeBase.throwLastError(!1),o}has(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'key' must be of type string and must not be null or undefined.");return-1!==this.nativeGet(t)}set(t,i){if("string"!=typeof t)throw new e.ArgumentError("Argument 'key' must be of type string and must not be null or undefined.");if("string"!=typeof i)throw new e.ArgumentError("Argument 'value' must be of type string and must not be null or undefined.");return Module.ViewingStringMapSet(this.handle,t,i)||n.NativeBase.throwLastError(!1),this}get size(){let e=Module.ViewingStringMapGetSize(this.handle);return e<0&&n.NativeBase.throwLastError(!1),e}entries(){return new P(this)}keys(){return new y(this)}values(){return new C(this)}}t=Symbol.toStringTag,e.StringMap=w;class b extends n.NativeBase{constructor(e){super(),this.map=e,this.index=Module.ViewingStringMapGetBegin(e.handle),-1===this.index&&n.NativeBase.throwLastError(!1),this.end=Module.ViewingStringMapGetEnd(e.handle),-1===this.end&&n.NativeBase.throwLastError(!1)}getNextIndex(){let e=Module.ViewingStringMapGetNext(this.map.handle,this.index);return-1===e&&n.NativeBase.throwLastError(!1),e}getKeyFromIndex(e){let t=Module.ViewingStringMapGetKey(this.map.handle,e);return null===t&&n.NativeBase.throwLastError(!1),t}getValueFromIndex(e){let t=Module.ViewingStringMapGetValue(this.map.handle,e);return null===t&&n.NativeBase.throwLastError(!1),t}}class P extends b{constructor(e){super(e)}next(){if(this.index===this.end)return{done:!0,value:null};let e=this.getKeyFromIndex(this.index),t=this.getValueFromIndex(this.index);return this.index=this.getNextIndex(),{done:!1,value:[e,t]}}[Symbol.iterator](){return new P(this.map)}}class y extends b{constructor(e){super(e)}next(){if(this.index===this.end)return{done:!0,value:null};let e=this.getKeyFromIndex(this.index);return this.index=this.getNextIndex(),{done:!1,value:e}}[Symbol.iterator](){return new y(this.map)}}class C extends b{constructor(e){super(e)}next(){if(this.index===this.end)return{done:!0,value:null};let e=this.getValueFromIndex(this.index);return this.index=this.getNextIndex(),{done:!1,value:e}}[Symbol.iterator](){return new C(this.map)}}!function(t){let i;!function(e){e[e.Pdf=0]="Pdf",e[e.Fdf=1]="Fdf"}(i=t.FileType||(t.FileType={}));class o extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingIOInputDocumentGetType(t)){case 0:default:return new o(t);case 1:return e.IO.InputUri.createDynamicObject(t);case 2:return e.IO.InputFile.createDynamicObject(t)}}get sourceTag(){let e=Module.ViewingIOInputDocumentGetSourceTag(this.handle);return null===e&&n.NativeBase.throwLastError(),e}}t.InputDocument=o;class s extends e.IO.InputDocument{constructor(t,i=null,o=null){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if("string"!=typeof t)throw new e.ArgumentError("Argument 'uri' must be of type string and must not be null or undefined.");if(null!=i&&!(i instanceof e.IO.HttpOptions))throw new e.ArgumentError("Argument 'httpOptions' must be of type PdfViewing.IO.HttpOptions or can be null or undefined.");if(null!=o&&"string"!=typeof o)throw new e.ArgumentError("Argument 'sourceTag' must be of type string or can be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewInputUri(t,null!=i?i.handle:0,o)))}}static createDynamicObject(e){return new s({__handle:e})}get uri(){let e=Module.ViewingIOInputUriGetUri(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}}t.InputUri=s;class a extends e.IO.InputDocument{constructor(t,i=null){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if(!(t instanceof Uint8Array))throw new e.ArgumentError("Argument 'data' must be of type Uint8Array and must not be null or undefined.");if(null!=i&&"string"!=typeof i)throw new e.ArgumentError("Argument 'sourceTag' must be of type string or can be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewInputFile(t,i)))}}static createDynamicObject(e){return new a({__handle:e})}get data(){let e=Module.ViewingIOInputFileGetData(this.handle);return null===e&&n.NativeBase.throwLastError(!1),new Uint8Array(e)}}t.InputFile=a;class r extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewInputDocumentList()))}static createDynamicObject(e){return new r({__handle:e})}indexOf(e){for(var t=0;t<this.size;t++)if(e.equals(this.get(t)))return t;return-1}remove(t){if(!(t instanceof e.IO.InputDocument))throw new e.ArgumentError("Argument 'element' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.");let i=this.indexOf(t);return-1!=i&&(Module.ViewingIOInputDocumentListRemove(this.handle,i)||n.NativeBase.throwLastError(!1),!0)}add(t){if(!(t instanceof e.IO.InputDocument))throw new e.ArgumentError("Argument 'element' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.");return Module.ViewingIOInputDocumentListAdd(this.handle,t.handle)||n.NativeBase.throwLastError(!1),!0}addRange(e){throw new Error("Method not implemented.")}set(t,i){if(!(i instanceof e.IO.InputDocument))throw new e.ArgumentError("Argument 'element' must be of type PdfViewing.IO.InputDocument and must not be null or undefined.");Module.ViewingIOInputDocumentListSet(this.handle,t,i.handle)||n.NativeBase.throwLastError(!1)}clear(){Module.ViewingIOInputDocumentListClear(this.handle)||n.NativeBase.throwLastError(!1)}get(t){let i=Module.ViewingIOInputDocumentListGet(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.IO.InputDocument.createDynamicObject(i)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingIOInputDocumentListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.InputDocumentList=r;class l extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewHttpOptions()))}static createDynamicObject(e){return new l({__handle:e})}get mode(){let e=Module.ViewingIOHttpOptionsGetMode(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set mode(t){if(null!=t&&"string"!=typeof t)throw new e.ArgumentError("Argument 'mode' must be of type string or can be null or undefined.");Module.ViewingIOHttpOptionsSetMode(this.handle,t)||n.NativeBase.throwLastError(!1)}get cache(){let e=Module.ViewingIOHttpOptionsGetCache(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set cache(t){if(null!=t&&"string"!=typeof t)throw new e.ArgumentError("Argument 'cache' must be of type string or can be null or undefined.");Module.ViewingIOHttpOptionsSetCache(this.handle,t)||n.NativeBase.throwLastError(!1)}get credentials(){let e=Module.ViewingIOHttpOptionsGetCredentials(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set credentials(t){if(null!=t&&"string"!=typeof t)throw new e.ArgumentError("Argument 'credentials' must be of type string or can be null or undefined.");Module.ViewingIOHttpOptionsSetCredentials(this.handle,t)||n.NativeBase.throwLastError(!1)}get redirect(){let e=Module.ViewingIOHttpOptionsGetRedirect(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set redirect(t){if(null!=t&&"string"!=typeof t)throw new e.ArgumentError("Argument 'redirect' must be of type string or can be null or undefined.");Module.ViewingIOHttpOptionsSetRedirect(this.handle,t)||n.NativeBase.throwLastError(!1)}get referrerPolicy(){let e=Module.ViewingIOHttpOptionsGetReferrerPolicy(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set referrerPolicy(t){if(null!=t&&"string"!=typeof t)throw new e.ArgumentError("Argument 'referrerPolicy' must be of type string or can be null or undefined.");Module.ViewingIOHttpOptionsSetReferrerPolicy(this.handle,t)||n.NativeBase.throwLastError(!1)}get headers(){let t=Module.ViewingIOHttpOptionsGetHeaders(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.StringMap.createDynamicObject(t)}}t.HttpOptions=l;class d extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingIONewMergeOptions()))}static createDynamicObject(e){return new d({__handle:e})}get copyLinks(){let e=Module.ViewingIOMergeOptionsGetCopyLinks(this.handle);return e||n.NativeBase.throwLastError(),e}set copyLinks(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'copyLinks' must be of type boolean and must not be null or undefined.");Module.ViewingIOMergeOptionsSetCopyLinks(this.handle,t)||n.NativeBase.throwLastError(!1)}get copyAnnotations(){let e=Module.ViewingIOMergeOptionsGetCopyAnnotations(this.handle);return e||n.NativeBase.throwLastError(),e}set copyAnnotations(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'copyAnnotations' must be of type boolean and must not be null or undefined.");Module.ViewingIOMergeOptionsSetCopyAnnotations(this.handle,t)||n.NativeBase.throwLastError(!1)}get copyFormFields(){let e=Module.ViewingIOMergeOptionsGetCopyFormFields(this.handle);return e||n.NativeBase.throwLastError(),e}set copyFormFields(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'copyFormFields' must be of type boolean and must not be null or undefined.");Module.ViewingIOMergeOptionsSetCopyFormFields(this.handle,t)||n.NativeBase.throwLastError(!1)}get copyOutlines(){let e=Module.ViewingIOMergeOptionsGetCopyOutlines(this.handle);return e||n.NativeBase.throwLastError(),e}set copyOutlines(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'copyOutlines' must be of type boolean and must not be null or undefined.");Module.ViewingIOMergeOptionsSetCopyOutlines(this.handle,t)||n.NativeBase.throwLastError(!1)}get copyLogicalStructure(){let e=Module.ViewingIOMergeOptionsGetCopyLogicalStructure(this.handle);return e||n.NativeBase.throwLastError(),e}set copyLogicalStructure(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'copyLogicalStructure' must be of type boolean and must not be null or undefined.");Module.ViewingIOMergeOptionsSetCopyLogicalStructure(this.handle,t)||n.NativeBase.throwLastError(!1)}get copyNamedDestinations(){let e=Module.ViewingIOMergeOptionsGetCopyNamedDestinations(this.handle);return e||n.NativeBase.throwLastError(),e}set copyNamedDestinations(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'copyNamedDestinations' must be of type boolean and must not be null or undefined.");Module.ViewingIOMergeOptionsSetCopyNamedDestinations(this.handle,t)||n.NativeBase.throwLastError(!1)}get copyUnsignedSignatures(){let e=Module.ViewingIOMergeOptionsGetCopyUnsignedSignatures(this.handle);return e||n.NativeBase.throwLastError(),e}set copyUnsignedSignatures(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'copyUnsignedSignatures' must be of type boolean and must not be null or undefined.");Module.ViewingIOMergeOptionsSetCopyUnsignedSignatures(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.MergeOptions=d}(o=e.IO||(e.IO={})),function(t){let i,o,s,a,r,l,d,h;!function(e){e[e.NoChange=0]="NoChange",e[e.Annotation=1]="Annotation",e[e.Content=2]="Content"}(i=t.DocumentChange||(t.DocumentChange={})),function(e){e[e.Unknown=0]="Unknown",e[e.Pdf10=1]="Pdf10",e[e.Pdf11=2]="Pdf11",e[e.Pdf12=3]="Pdf12",e[e.Pdf13=4]="Pdf13",e[e.Pdf14=5]="Pdf14",e[e.Pdf15=6]="Pdf15",e[e.Pdf16=7]="Pdf16",e[e.Pdf17=8]="Pdf17",e[e.Pdf20=9]="Pdf20",e[e.PdfA1b=10]="PdfA1b",e[e.PdfA1a=11]="PdfA1a",e[e.PdfA2b=12]="PdfA2b",e[e.PdfA2u=13]="PdfA2u",e[e.PdfA2a=14]="PdfA2a",e[e.PdfA3b=15]="PdfA3b",e[e.PdfA3u=16]="PdfA3u",e[e.PdfA3a=17]="PdfA3a"}(o=t.Compliance||(t.Compliance={})),function(e){e[e.Display=0]="Display",e[e.Print=1]="Print"}(s=t.OutputMedium||(t.OutputMedium={}));class c extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNewRenderOptions()))}static createDynamicObject(e){return new c({__handle:e})}get formFieldHighlightColor(){let t=Module.ViewingPdfRenderOptionsGetFormFieldHighlightColor(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}set formFieldHighlightColor(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'formFieldHighlightColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingPdfRenderOptionsSetFormFieldHighlightColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get formFieldRequiredHighlightColor(){let t=Module.ViewingPdfRenderOptionsGetFormFieldRequiredHighlightColor(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}set formFieldRequiredHighlightColor(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'formFieldRequiredHighlightColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingPdfRenderOptionsSetFormFieldRequiredHighlightColor(this.handle,t)||n.NativeBase.throwLastError(!1)}set annotationFilter(t){if(null!=t&&"function"!=typeof t)throw new e.ArgumentError("Argument 'annotationFilter' must be of type PdfViewing.Pdf.Annotations.AnnotationFilter or can be null or undefined.");Module.ViewingPdfRenderOptionsSetAnnotationFilter(this.handle,null!=t?new S(t):null)||n.NativeBase.throwLastError(!1)}get outputMedium(){let e=Module.ViewingPdfRenderOptionsGetOutputMedium(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set outputMedium(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'outputMedium' must be of type PdfViewing.Pdf.OutputMedium and must not be null or undefined.");Module.ViewingPdfRenderOptionsSetOutputMedium(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.RenderOptions=c;class u extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNewViewOptions()))}static createDynamicObject(e){return new u({__handle:e})}get initialDestination(){let t=Module.ViewingPdfViewOptionsGetInitialDestination(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Navigation.Destination.createDynamicObject(t):null}set initialDestination(t){if(null!=t&&!(t instanceof e.Pdf.Navigation.Destination))throw new e.ArgumentError("Argument 'initialDestination' must be of type PdfViewing.Pdf.Navigation.Destination or can be null or undefined.");Module.ViewingPdfViewOptionsSetInitialDestination(this.handle,null!=t?t.handle:0)||n.NativeBase.throwLastError(!1)}get initialFitMode(){let e=Module.ViewingPdfViewOptionsGetInitialFitMode(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set initialFitMode(t){if(null!=t&&"number"!=typeof t)throw new e.ArgumentError("Argument 'initialFitMode' must be of type PdfViewing.Pdf.Navigation.FitMode or can be null or undefined.");Module.ViewingPdfViewOptionsSetInitialFitMode(this.handle,t)||n.NativeBase.throwLastError(!1)}get initialPageLayoutMode(){let e=Module.ViewingPdfViewOptionsGetInitialPageLayoutMode(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set initialPageLayoutMode(t){if(null!=t&&"number"!=typeof t)throw new e.ArgumentError("Argument 'initialPageLayoutMode' must be of type PdfViewing.Pdf.Navigation.PageLayoutMode or can be null or undefined.");Module.ViewingPdfViewOptionsSetInitialPageLayoutMode(this.handle,t)||n.NativeBase.throwLastError(!1)}get viewportSize(){let t=Module.ViewingPdfViewOptionsGetViewportSize(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.Size(t.width,t.height)}set viewportSize(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'viewportSize' must be of type PdfViewing.Pdf.Geometry.Integer.Size and must not be null or undefined.");Module.ViewingPdfViewOptionsSetViewportSize(this.handle,t)||n.NativeBase.throwLastError(!1)}get viewDPI(){let e=Module.ViewingPdfViewOptionsGetViewDPI(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set viewDPI(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'viewDPI' must be of type number and must not be null or undefined.");Module.ViewingPdfViewOptionsSetViewDPI(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.ViewOptions=u;class p extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNewSaveOptions()))}static createDynamicObject(e){return new p({__handle:e})}get fileType(){let e=Module.ViewingPdfSaveOptionsGetFileType(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set fileType(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'fileType' must be of type PdfViewing.IO.FileType and must not be null or undefined.");Module.ViewingPdfSaveOptionsSetFileType(this.handle,t)||n.NativeBase.throwLastError(!1)}set annotationFilter(t){if(null!=t&&"function"!=typeof t)throw new e.ArgumentError("Argument 'annotationFilter' must be of type PdfViewing.Pdf.Annotations.AnnotationFilter or can be null or undefined.");Module.ViewingPdfSaveOptionsSetAnnotationFilter(this.handle,null!=t?new S(t):null)||n.NativeBase.throwLastError(!1)}set password(t){if(null!=t&&"string"!=typeof t)throw new e.ArgumentError("Argument 'password' must be of type string or can be null or undefined.");Module.ViewingPdfSaveOptionsSetPassword(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.SaveOptions=p;class g extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new g(e)}close(){Module.ViewingPdfPageClose(this.handle)||n.NativeBase.throwLastError()}rotatePage(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'rotateBy' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");Module.ViewingPdfPageRotatePage(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.Page=g;class m extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new m(e)}close(){Module.ViewingPdfPageListClose(this.handle)||n.NativeBase.throwLastError()}remove(e){throw new Error("Method not implemented.")}add(e){throw new Error("Method not implemented.")}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(t){let i=Module.ViewingPdfPageListGet(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.Pdf.Page.createDynamicObject(i)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingPdfPageListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.PageList=m;class f extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new f(e)}close(){Module.ViewingPdfDocumentClose(this.handle)||n.NativeBase.throwLastError()}saveFile(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'asFdf' must be of type boolean and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentSaveFile(n.handle,{thisHandle:n,resolved:e,rejected:i},t)||i(Module.ViewingGetLastErrorMessage())}))}saveFileCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Content.BinaryBuffer.createDynamicObject(i)):t.rejected(a)}save(t=null){if(null!=t&&!(t instanceof e.Pdf.SaveOptions))throw new e.ArgumentError("Argument 'saveOptions' must be of type PdfViewing.Pdf.SaveOptions or can be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentSave(n.handle,{thisHandle:n,resolved:e,rejected:i},null!=t?t.handle:0)||i(Module.ViewingGetLastErrorMessage())}))}saveCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Content.BinaryBuffer.createDynamicObject(i)):t.rejected(a)}searchText(t,i,o,s,a){if("string"!=typeof t)throw new e.ArgumentError("Argument 'text' must be of type string and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'startPage' must be of type number and must not be null or undefined.");if("boolean"!=typeof o)throw new e.ArgumentError("Argument 'isCaseSensitive' must be of type boolean and must not be null or undefined.");if("boolean"!=typeof s)throw new e.ArgumentError("Argument 'isWrappingEnabled' must be of type boolean and must not be null or undefined.");if("boolean"!=typeof a)throw new e.ArgumentError("Argument 'isRegex' must be of type boolean and must not be null or undefined.");let r=Module.ViewingPdfDocumentSearchText(this.handle,t,i,o,s,a);return 0===r&&n.NativeBase.throwLastError(!1),e.Pdf.Content.TextSearchIterator.createDynamicObject(r)}createAnnotation(t){if(!(t instanceof e.Pdf.Annotations.Annotation))throw new e.ArgumentError("Argument 'annotation' must be of type PdfViewing.Pdf.Annotations.Annotation and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentCreateAnnotation(n.handle,{thisHandle:n,resolved:e,rejected:i},t.handle)||i(Module.ViewingGetLastErrorMessage())}))}createAnnotationCallback(e,t,i,o){let s=null;t||(s=n.NativeBase.createLastError(i,o,!1)),null===s?e.resolved():e.rejected(s)}deleteAnnotation(t){if(!(t instanceof e.Pdf.Annotations.Annotation))throw new e.ArgumentError("Argument 'annotation' must be of type PdfViewing.Pdf.Annotations.Annotation and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentDeleteAnnotation(n.handle,{thisHandle:n,resolved:e,rejected:i},t.handle)||i(Module.ViewingGetLastErrorMessage())}))}deleteAnnotationCallback(e,t,i,o){let s=null;t||(s=n.NativeBase.createLastError(i,o,!1)),null===s?e.resolved():e.rejected(s)}editAnnotation(t){if(!(t instanceof e.Pdf.Annotations.Annotation))throw new e.ArgumentError("Argument 'annotation' must be of type PdfViewing.Pdf.Annotations.Annotation and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentEditAnnotation(n.handle,{thisHandle:n,resolved:e,rejected:i},t.handle)||i(Module.ViewingGetLastErrorMessage())}))}editAnnotationCallback(e,t,i,o){let s=null;t||(s=n.NativeBase.createLastError(i,o,!1)),null===s?e.resolved():e.rejected(s)}getAnnotations(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentGetAnnotations(n.handle,{thisHandle:n,resolved:e,rejected:i},t)||i(Module.ViewingGetLastErrorMessage())}))}getAnnotationsCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Annotations.AnnotationList.createDynamicObject(i)):t.rejected(a)}getTextFragments(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentGetTextFragments(n.handle,{thisHandle:n,resolved:e,rejected:i},t)||i(Module.ViewingGetLastErrorMessage())}))}getTextFragmentsCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Content.TextFragmentList.createDynamicObject(i)):t.rejected(a)}registerPdfPage(t,n){if(!(t instanceof e.Pdf.Document))throw new e.ArgumentError("Argument 'otherDocument' must be of type PdfViewing.Pdf.Document and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");var i=this;return new Promise((function(e,o){Module.ViewingPdfDocumentRegisterPdfPage(i.handle,{thisHandle:i,resolved:e,rejected:o},t.handle,n)||o(Module.ViewingGetLastErrorMessage())}))}registerPdfPageCallback(e,t,i,o){let s=null;0===t&&(s=n.NativeBase.createLastError(i,o)),null===s?e.resolved(t):e.rejected(s)}getOutlines(t){if(null!=t&&!(t instanceof e.Pdf.Navigation.OutlineItem))throw new e.ArgumentError("Argument 'parentOutline' must be of type PdfViewing.Pdf.Navigation.OutlineItem or can be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentGetOutlines(n.handle,{thisHandle:n,resolved:e,rejected:i},null!=t?t.handle:0)||i(Module.ViewingGetLastErrorMessage())}))}getOutlinesCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Navigation.OutlineItemList.createDynamicObject(i)):t.rejected(a)}renderPage(t,n,i,o,s=null){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'width' must be of type number and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'height' must be of type number and must not be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'rotate' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");if(null!=s&&!(s instanceof e.Pdf.RenderOptions))throw new e.ArgumentError("Argument 'renderOptions' must be of type PdfViewing.Pdf.RenderOptions or can be null or undefined.");var a=this;return new Promise((function(e,r){Module.ViewingPdfDocumentRenderPage(a.handle,{thisHandle:a,resolved:e,rejected:r},t,n,i,o,null!=s?s.handle:0)||r(Module.ViewingGetLastErrorMessage())}))}renderPageCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Content.Image.createDynamicObject(i)):t.rejected(a)}getPageSize(t,i){if("number"!=typeof t)throw new e.ArgumentError("Argument 'page' must be of type number and must not be null or undefined.");if("boolean"!=typeof i)throw new e.ArgumentError("Argument 'guess' must be of type boolean and must not be null or undefined.");let o=Module.ViewingPdfDocumentGetPageSize(this.handle,t,i);return null===o&&n.NativeBase.throwLastError(),null!==o?new e.Pdf.Geometry.Real.Size(o.width,o.height):null}getPagePdfSize(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentGetPagePdfSize(n.handle,{thisHandle:n,resolved:e,rejected:i},t)||i(Module.ViewingGetLastErrorMessage())}))}getPagePdfSizeCallback(t,i,o,s){let a=null;null===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(new e.Pdf.Geometry.Real.Size(i.width,i.height)):t.rejected(a)}getTextStampAspectRatio(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'stampText' must be of type string and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentGetTextStampAspectRatio(n.handle,{thisHandle:n,resolved:e,rejected:i},t)||i(Module.ViewingGetLastErrorMessage())}))}getTextStampAspectRatioCallback(e,t,i,o){let s=null;0===t&&(s=n.NativeBase.createLastError(i,o)),null===s?e.resolved(t):e.rejected(s)}registerImage(t){if(!(t instanceof Uint8Array))throw new e.ArgumentError("Argument 'image' must be of type Uint8Array and must not be null or undefined.");var n=this;return new Promise((function(e,i){Module.ViewingPdfDocumentRegisterImage(n.handle,{thisHandle:n,resolved:e,rejected:i},t)||i(Module.ViewingGetLastErrorMessage())}))}registerImageCallback(e,t,i,o){let s=null;0===t&&(s=n.NativeBase.createLastError(i,o)),null===s?e.resolved(t):e.rejected(s)}registerImageUri(t,n){if("string"!=typeof t)throw new e.ArgumentError("Argument 'imageUri' must be of type string and must not be null or undefined.");if(null!=n&&"string"!=typeof n)throw new e.ArgumentError("Argument 'authorization' must be of type string or can be null or undefined.");var i=this;return new Promise((function(e,o){Module.ViewingPdfDocumentRegisterImageUri(i.handle,{thisHandle:i,resolved:e,rejected:o},t,n)||o(Module.ViewingGetLastErrorMessage())}))}registerImageUriCallback(e,t,i,o){let s=null;0===t&&(s=n.NativeBase.createLastError(i,o)),null===s?e.resolved(t):e.rejected(s)}mergeWith(t,n=null){if(!(t instanceof e.Pdf.Document))throw new e.ArgumentError("Argument 'other' must be of type PdfViewing.Pdf.Document and must not be null or undefined.");if(null!=n&&!(n instanceof e.IO.MergeOptions))throw new e.ArgumentError("Argument 'mergeOptions' must be of type PdfViewing.IO.MergeOptions or can be null or undefined.");var i=this;return new Promise((function(e,o){Module.ViewingPdfDocumentMergeWith(i.handle,{thisHandle:i,resolved:e,rejected:o},t.handle,null!=n?n.handle:0)||o(Module.ViewingGetLastErrorMessage())}))}mergeWithCallback(t,i,o,s){let a=null;0===i&&(a=n.NativeBase.createLastError(o,s,!1)),null===a?t.resolved(e.Pdf.Content.BinaryBuffer.createDynamicObject(i)):t.rejected(a)}get initialDestination(){let t=Module.ViewingPdfDocumentGetInitialDestination(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Navigation.Destination.createDynamicObject(t):null}get hasChanges(){let e=Module.ViewingPdfDocumentGetHasChanges(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get pageCount(){let e=Module.ViewingPdfDocumentGetPageCount(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get initialPageLayoutMode(){let e=Module.ViewingPdfDocumentGetInitialPageLayoutMode(this.handle);return null===e&&n.NativeBase.throwLastError(),e}get compliance(){let e=Module.ViewingPdfDocumentGetCompliance(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get pages(){let t=Module.ViewingPdfDocumentGetPages(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.PageList.createDynamicObject(t)}}t.Document=f;class v extends n.NativeObject{constructor(t,i){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if(!(t instanceof e.Pdf.Document))throw new e.ArgumentError("Argument 'document' must be of type PdfViewing.Pdf.Document and must not be null or undefined.");if("boolean"!=typeof i)throw new e.ArgumentError("Argument 'ignoreEmbeddedPreferences' must be of type boolean and must not be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNewView(t.handle,i)))}this.eventListeners=new Map}addEventListener(t,i){if("function"!=typeof i)throw new e.ArgumentError("Argument 'listener' must be a function.");var o;if(this.eventListeners.has(t)){if(!this.eventListeners.get(t).has(i)&&"viewUpdated"===t){o=new b(i);let e=Module.ViewingPdfViewAddViewUpdatedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e,this.eventListeners.get(t).set(i,o)}if(!this.eventListeners.get(t).has(i)&&"imageCreated"===t){o=new P(i);let e=Module.ViewingPdfViewAddImageCreatedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e,this.eventListeners.get(t).set(i,o)}if(!this.eventListeners.get(t).has(i)&&"imageRemovedFromCache"===t){o=new y(i);let e=Module.ViewingPdfViewAddImageRemovedFromCacheHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e,this.eventListeners.get(t).set(i,o)}}else{if("viewUpdated"===t){o=new b(i);let e=Module.ViewingPdfViewAddViewUpdatedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e;let s=new Map;s.set(i,o),this.eventListeners.set(t,s)}if("imageCreated"===t){o=new P(i);let e=Module.ViewingPdfViewAddImageCreatedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e;let s=new Map;s.set(i,o),this.eventListeners.set(t,s)}if("imageRemovedFromCache"===t){o=new y(i);let e=Module.ViewingPdfViewAddImageRemovedFromCacheHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e;let s=new Map;s.set(i,o),this.eventListeners.set(t,s)}}}removeEventListener(e,t){if(this.eventListeners.has(e)){if("viewUpdated"===e){let i=this.eventListeners.get(e);if(i.has(t)){let e=i.get(t);try{Module.ViewingPdfViewRemoveViewUpdatedHandler(this.handle,null==e?void 0:e.context)||n.NativeBase.throwLastError()}catch(e){if(e instanceof A)throw e}i.delete(t),0===i.size&&this.eventListeners.delete("viewUpdated")}}if("imageCreated"===e){let i=this.eventListeners.get(e);if(i.has(t)){let e=i.get(t);try{Module.ViewingPdfViewRemoveImageCreatedHandler(this.handle,null==e?void 0:e.context)||n.NativeBase.throwLastError()}catch(e){if(e instanceof A)throw e}i.delete(t),0===i.size&&this.eventListeners.delete("imageCreated")}}if("imageRemovedFromCache"===e){let i=this.eventListeners.get(e);if(i.has(t)){let e=i.get(t);try{Module.ViewingPdfViewRemoveImageRemovedFromCacheHandler(this.handle,null==e?void 0:e.context)||n.NativeBase.throwLastError()}catch(e){if(e instanceof A)throw e}i.delete(t),0===i.size&&this.eventListeners.delete("imageRemovedFromCache")}}}}static createDynamicObject(e){return new v({__handle:e})}close(){Module.ViewingPdfViewClose(this.handle)||n.NativeBase.throwLastError()}static create(t,i,o){if(!(t instanceof e.Pdf.Document))throw new e.ArgumentError("Argument 'document' must be of type PdfViewing.Pdf.Document and must not be null or undefined.");if(null!=i&&!(i instanceof e.Pdf.RenderOptions))throw new e.ArgumentError("Argument 'renderOptions' must be of type PdfViewing.Pdf.RenderOptions or can be null or undefined.");if(null!=o&&!(o instanceof e.Pdf.ViewOptions))throw new e.ArgumentError("Argument 'viewOptions' must be of type PdfViewing.Pdf.ViewOptions or can be null or undefined.");let s=Module.ViewingPdfViewCreate(t.handle,null!=i?i.handle:0,null!=o?o.handle:0);return 0===s&&n.NativeBase.throwLastError(!1),e.Pdf.View.createDynamicObject(s)}suspendDrawing(){Module.ViewingPdfViewSuspendDrawing(this.handle)||n.NativeBase.throwLastError(!1)}resumeDrawing(){Module.ViewingPdfViewResumeDrawing(this.handle)||n.NativeBase.throwLastError(!1)}goToDestination(t){if(!(t instanceof e.Pdf.Navigation.Destination))throw new e.ArgumentError("Argument 'destination' must be of type PdfViewing.Pdf.Navigation.Destination and must not be null or undefined.");Module.ViewingPdfViewGoToDestination(this.handle,t.handle)||n.NativeBase.throwLastError(!1)}goToRectangle(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'rectangle' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");Module.ViewingPdfViewGoToRectangle(this.handle,t)||n.NativeBase.throwLastError(!1)}getTextFragmentsOnPoint(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'point' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.");let i=Module.ViewingPdfViewGetTextFragmentsOnPoint(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.Pdf.Content.TextFragmentList.createDynamicObject(i)}getTextFragments(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");let i=Module.ViewingPdfViewGetTextFragments(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.Pdf.Content.TextFragmentList.createDynamicObject(i)}getRectangularTextSelection(t,i){if("object"!=typeof t)throw new e.ArgumentError("Argument 'startPoint' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'endPoint' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");let o=Module.ViewingPdfViewGetRectangularTextSelection(this.handle,t,i);return 0===o&&n.NativeBase.throwLastError(!1),e.Pdf.Content.TextSelection.createDynamicObject(o)}getTextSelection(t,i){if("object"!=typeof t)throw new e.ArgumentError("Argument 'startPoint' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'endPoint' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");let o=Module.ViewingPdfViewGetTextSelection(this.handle,t,i);return 0===o&&n.NativeBase.throwLastError(),0!==o?e.Pdf.Content.TextSelection.createDynamicObject(o):null}getWordOnPoint(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'point' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");let i=Module.ViewingPdfViewGetWordOnPoint(this.handle,t);return 0===i&&n.NativeBase.throwLastError(),0!==i?e.Pdf.Content.TextSelection.createDynamicObject(i):null}getAnnotationsOnPoint(t,i){if("object"!=typeof t)throw new e.ArgumentError("Argument 'point' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.");if("boolean"!=typeof i)throw new e.ArgumentError("Argument 'onlySelectable' must be of type boolean and must not be null or undefined.");let o=Module.ViewingPdfViewGetAnnotationsOnPoint(this.handle,t,i);return 0===o&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.AnnotationList.createDynamicObject(o)}getRenderedResults(){let t=Module.ViewingPdfViewGetRenderedResults(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Content.RenderResults.createDynamicObject(t)}transformPointFromViewportToPage(t,i){if("object"!=typeof t)throw new e.ArgumentError("Argument 'pointOnViewport' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.");if("boolean"!=typeof i)throw new e.ArgumentError("Argument 'snapToPage' must be of type boolean and must not be null or undefined.");let o=Module.ViewingPdfViewTransformPointFromViewportToPage(this.handle,t,i);return null===o&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.PointOnPage(o.pageNumber,o.x,o.y)}transformPointFromViewportToSpecificPage(t,i,o){if("object"!=typeof t)throw new e.ArgumentError("Argument 'pointOnViewport' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if("boolean"!=typeof o)throw new e.ArgumentError("Argument 'snapToPage' must be of type boolean and must not be null or undefined.");let s=Module.ViewingPdfViewTransformPointFromViewportToSpecificPage(this.handle,t,i,o);return null===s&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.PointOnPage(s.pageNumber,s.x,s.y)}transformRectangleFromViewportToSpecificPage(t,i){if("object"!=typeof t)throw new e.ArgumentError("Argument 'rectangleOnViewport' must be of type PdfViewing.Pdf.Geometry.Integer.Rectangle and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");let o=Module.ViewingPdfViewTransformRectangleFromViewportToSpecificPage(this.handle,t,i);return null===o&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.RectangleOnPage(o.pageNumber,o.x,o.y,o.width,o.height)}transformPointFromPageToViewport(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'pointOnPage' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");let i=Module.ViewingPdfViewTransformPointFromPageToViewport(this.handle,t);return null===i&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.Point(i.x,i.y)}transformRectangleFromPageToViewport(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'rectangleOnPage' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");let i=Module.ViewingPdfViewTransformRectangleFromPageToViewport(this.handle,t);return null===i&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.Rectangle(i.x,i.y,i.width,i.height)}getPageRectangleOnViewport(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");let i=Module.ViewingPdfViewGetPageRectangleOnViewport(this.handle,t);return null===i&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.Rectangle(i.x,i.y,i.width,i.height)}transformPdfLengthToViewportLength(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pdfLength' must be of type number and must not be null or undefined.");let i=Module.ViewingPdfViewTransformPdfLengthToViewportLength(this.handle,t);return 0===i&&n.NativeBase.throwLastError(),i}transformViewportLengthToPdfLength(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'screenLength' must be of type number and must not be null or undefined.");let i=Module.ViewingPdfViewTransformViewportLengthToPdfLength(this.handle,t);return 0===i&&n.NativeBase.throwLastError(),i}zoomOnLocation(t,i){if("number"!=typeof t)throw new e.ArgumentError("Argument 'zoom' must be of type number and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'location' must be of type PdfViewing.Pdf.Geometry.Integer.Point and must not be null or undefined.");Module.ViewingPdfViewZoomOnLocation(this.handle,t,i)||n.NativeBase.throwLastError(!1)}get pageNumber(){let e=Module.ViewingPdfViewGetPageNumber(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set pageNumber(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");Module.ViewingPdfViewSetPageNumber(this.handle,t)||n.NativeBase.throwLastError(!1)}get firstVisiblePage(){let e=Module.ViewingPdfViewGetFirstVisiblePage(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get lastVisiblePage(){let e=Module.ViewingPdfViewGetLastVisiblePage(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get zoom(){let e=Module.ViewingPdfViewGetZoom(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set zoom(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'zoom' must be of type number and must not be null or undefined.");Module.ViewingPdfViewSetZoom(this.handle,t)||n.NativeBase.throwLastError(!1)}get scrollPosition(){let t=Module.ViewingPdfViewGetScrollPosition(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.ScrollPosition(t.x,t.y)}set scrollPosition(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'scrollPosition' must be of type PdfViewing.Pdf.Geometry.Integer.ScrollPosition and must not be null or undefined.");Module.ViewingPdfViewSetScrollPosition(this.handle,t)||n.NativeBase.throwLastError(!1)}get scrollMaxPosition(){let t=Module.ViewingPdfViewGetScrollMaxPosition(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.ScrollPosition(t.x,t.y)}get viewRotation(){let e=Module.ViewingPdfViewGetViewRotation(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set viewRotation(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'viewRotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");Module.ViewingPdfViewSetViewRotation(this.handle,t)||n.NativeBase.throwLastError(!1)}get fitMode(){let e=Module.ViewingPdfViewGetFitMode(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set fitMode(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'fitMode' must be of type PdfViewing.Pdf.Navigation.FitMode and must not be null or undefined.");Module.ViewingPdfViewSetFitMode(this.handle,t)||n.NativeBase.throwLastError(!1)}get pageLayoutMode(){let e=Module.ViewingPdfViewGetPageLayoutMode(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set pageLayoutMode(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageLayoutMode' must be of type PdfViewing.Pdf.Navigation.PageLayoutMode and must not be null or undefined.");Module.ViewingPdfViewSetPageLayoutMode(this.handle,t)||n.NativeBase.throwLastError(!1)}get borderSize(){let e=Module.ViewingPdfViewGetBorderSize(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set borderSize(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'borderSize' must be of type number and must not be null or undefined.");Module.ViewingPdfViewSetBorderSize(this.handle,t)||n.NativeBase.throwLastError(!1)}get canvasMargin(){let t=Module.ViewingPdfViewGetCanvasMargin(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.Padding(t.left,t.right,t.top,t.bottom)}set canvasMargin(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'canvasMargin' must be of type PdfViewing.Pdf.Geometry.Integer.Padding and must not be null or undefined.");Module.ViewingPdfViewSetCanvasMargin(this.handle,t)||n.NativeBase.throwLastError(!1)}get screenDPI(){let e=Module.ViewingPdfViewGetScreenDPI(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set screenDPI(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'screenDPI' must be of type number and must not be null or undefined.");Module.ViewingPdfViewSetScreenDPI(this.handle,t)||n.NativeBase.throwLastError(!1)}get byteorder(){let e=Module.ViewingPdfViewGetByteorder(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set byteorder(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'byteorder' must be of type PdfViewing.Pdf.Content.Byteorder and must not be null or undefined.");Module.ViewingPdfViewSetByteorder(this.handle,t)||n.NativeBase.throwLastError(!1)}get viewportSize(){let t=Module.ViewingPdfViewGetViewportSize(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.Size(t.width,t.height)}set viewportSize(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'viewportSize' must be of type PdfViewing.Pdf.Geometry.Integer.Size and must not be null or undefined.");Module.ViewingPdfViewSetViewportSize(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.View=v;class w{constructor(e){this.listener=e}}class b extends w{constructor(e){super(e)}dispatchEventViewUpdated(e,t,n,i,o,s,a,r,l){this.listener({visisblePageRangeChanged:e,pageNumberChanged:t,zoomChanged:n,fitmodeChanged:i,pageLayoutModeChanged:o,viewRotationChanged:s,scrollMaxPositionChanged:a,pageSizeUpdated:r,bitmapsUpdated:l})}}class P extends w{constructor(e){super(e)}dispatchEventImageCreated(t){this.listener(e.Pdf.Content.Image.createDynamicObject(t))}}class y extends w{constructor(e){super(e)}dispatchEventImageRemovedFromCache(e){this.listener(e)}}!function(t){class i extends n.NativeBase{constructor(t,n,i,o){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'red' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'green' must be of type number and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'blue' must be of type number and must not be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'alpha' must be of type number and must not be null or undefined.");this.red=t,this.green=n,this.blue=i,this.alpha=o}equals(e){return null!==e&&this.red===e.red&&this.green===e.green&&this.blue===e.blue&&this.alpha===e.alpha}}let o,s,a,r,l;t.Color=i,function(e){e[e.Approved=0]="Approved",e[e.Experimental=1]="Experimental",e[e.NotApproved=2]="NotApproved",e[e.AsIs=3]="AsIs",e[e.Expired=4]="Expired",e[e.NotForPublicRelease=5]="NotForPublicRelease",e[e.Confidential=6]="Confidential",e[e.Final=7]="Final",e[e.Sold=8]="Sold",e[e.Departmental=9]="Departmental",e[e.ForComment=10]="ForComment",e[e.TopSecret=11]="TopSecret",e[e.Draft=12]="Draft",e[e.ForPublicRelease=13]="ForPublicRelease"}(o=t.TextStampType||(t.TextStampType={})),function(e){e[e.Green=0]="Green",e[e.Red=1]="Red",e[e.Blue=2]="Blue"}(s=t.StampColor||(t.StampColor={})),function(e){e[e.Graph=0]="Graph",e[e.PushPin=1]="PushPin",e[e.Paperclip=2]="Paperclip",e[e.Tag=3]="Tag",e[e.CustomIcon=127]="CustomIcon"}(a=t.FileAttachmentIcon||(t.FileAttachmentIcon={})),function(e){e[e.Lined=0]="Lined",e[e.Beveled=1]="Beveled",e[e.Inset=2]="Inset",e[e.Underline=3]="Underline"}(r=t.BorderStyleType||(t.BorderStyleType={})),function(e){e[e.None=0]="None",e[e.OpenArrow=1]="OpenArrow",e[e.ClosedArrow=2]="ClosedArrow",e[e.rectangle=3]="rectangle",e[e.Circle=4]="Circle",e[e.Diamond=5]="Diamond",e[e.Butt=6]="Butt",e[e.ReversedOpenArrow=7]="ReversedOpenArrow",e[e.ReversedClosedArrow=8]="ReversedClosedArrow",e[e.Slash=9]="Slash"}(l=t.LineEnding||(t.LineEnding={}));class d extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfAnnotsAnnotationGetType(t)){case 0:default:return new d(t);case 1:return e.Pdf.Annotations.MarkupAnnotation.createDynamicObject(t);case 2:return e.Pdf.Annotations.StickyNote.createDynamicObject(t);case 3:return e.Pdf.Annotations.FileAttachment.createDynamicObject(t);case 4:return e.Pdf.Annotations.Stamp.createDynamicObject(t);case 5:return e.Pdf.Annotations.TextStamp.createDynamicObject(t);case 6:return e.Pdf.Annotations.CustomTextStamp.createDynamicObject(t);case 7:return e.Pdf.Annotations.CustomImageStamp.createDynamicObject(t);case 8:return e.Pdf.Annotations.FreeText.createDynamicObject(t);case 9:return e.Pdf.Annotations.DrawingAnnotation.createDynamicObject(t);case 10:return e.Pdf.Annotations.LineAnnotation.createDynamicObject(t);case 11:return e.Pdf.Annotations.InkAnnotation.createDynamicObject(t);case 12:return e.Pdf.Annotations.PolyLineAnnotation.createDynamicObject(t);case 13:return e.Pdf.Annotations.PolygonAnnotation.createDynamicObject(t);case 14:return e.Pdf.Annotations.RectangleAnnotation.createDynamicObject(t);case 15:return e.Pdf.Annotations.EllipseAnnotation.createDynamicObject(t);case 16:return e.Pdf.Annotations.TextMarkup.createDynamicObject(t);case 17:return e.Pdf.Annotations.Highlight.createDynamicObject(t);case 18:return e.Pdf.Annotations.Underline.createDynamicObject(t);case 19:return e.Pdf.Annotations.StrikeThrough.createDynamicObject(t);case 20:return e.Pdf.Annotations.Squiggly.createDynamicObject(t);case 21:return e.Pdf.Annotations.TextInsert.createDynamicObject(t);case 22:return e.Pdf.Annotations.Link.createDynamicObject(t);case 23:return e.Pdf.Annotations.InternalLink.createDynamicObject(t);case 24:return e.Pdf.Annotations.WebLink.createDynamicObject(t);case 25:return e.Pdf.Annotations.EmbeddedPdfLink.createDynamicObject(t);case 26:return e.Pdf.Forms.Widget.createDynamicObject(t);case 27:return e.Pdf.Forms.CheckBox.createDynamicObject(t);case 28:return e.Pdf.Forms.RadioButton.createDynamicObject(t);case 29:return e.Pdf.Forms.TextBox.createDynamicObject(t);case 30:return e.Pdf.Forms.ListBox.createDynamicObject(t);case 31:return e.Pdf.Forms.ComboBox.createDynamicObject(t)}}close(){Module.ViewingPdfAnnotsAnnotationClose(this.handle)||n.NativeBase.throwLastError()}get boundingBox(){let t=Module.ViewingPdfAnnotsAnnotationGetBoundingBox(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.RectangleOnPage(t.pageNumber,t.x,t.y,t.width,t.height)}set boundingBox(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");Module.ViewingPdfAnnotsAnnotationSetBoundingBox(this.handle,t)||n.NativeBase.throwLastError(!1)}get hidden(){let e=Module.ViewingPdfAnnotsAnnotationGetHidden(this.handle);return e||n.NativeBase.throwLastError(),e}set hidden(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'hidden' must be of type boolean and must not be null or undefined.");Module.ViewingPdfAnnotsAnnotationSetHidden(this.handle,t)||n.NativeBase.throwLastError(!1)}get noPrint(){let e=Module.ViewingPdfAnnotsAnnotationGetNoPrint(this.handle);return e||n.NativeBase.throwLastError(),e}set noPrint(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'noPrint' must be of type boolean and must not be null or undefined.");Module.ViewingPdfAnnotsAnnotationSetNoPrint(this.handle,t)||n.NativeBase.throwLastError(!1)}get noZoom(){let e=Module.ViewingPdfAnnotsAnnotationGetNoZoom(this.handle);return e||n.NativeBase.throwLastError(),e}get noRotate(){let e=Module.ViewingPdfAnnotsAnnotationGetNoRotate(this.handle);return e||n.NativeBase.throwLastError(),e}set noRotate(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'noRotate' must be of type boolean and must not be null or undefined.");Module.ViewingPdfAnnotsAnnotationSetNoRotate(this.handle,t)||n.NativeBase.throwLastError(!1)}get name(){let e=Module.ViewingPdfAnnotsAnnotationGetName(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}get privateData(){let e=Module.ViewingPdfAnnotsAnnotationGetPrivateData(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}set privateData(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'privateData' must be of type string and must not be null or undefined.");Module.ViewingPdfAnnotsAnnotationSetPrivateData(this.handle,t)||n.NativeBase.throwLastError(!1)}get sourceTag(){let e=Module.ViewingPdfAnnotsAnnotationGetSourceTag(this.handle);return null===e&&n.NativeBase.throwLastError(),e}}t.Annotation=d;class h extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new h(e)}close(){Module.ViewingPdfAnnotsMarkupInfoClose(this.handle)||n.NativeBase.throwLastError()}get creationDate(){let e=Module.ViewingPdfAnnotsMarkupInfoGetCreationDate(this.handle);return null===e&&n.NativeBase.throwLastError(),e}get modificationDate(){let e=Module.ViewingPdfAnnotsMarkupInfoGetModificationDate(this.handle);return null===e&&n.NativeBase.throwLastError(),e}get locked(){let e=Module.ViewingPdfAnnotsMarkupInfoGetLocked(this.handle);return e||n.NativeBase.throwLastError(),e}set locked(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'locked' must be of type boolean and must not be null or undefined.");Module.ViewingPdfAnnotsMarkupInfoSetLocked(this.handle,t)||n.NativeBase.throwLastError(!1)}get author(){let e=Module.ViewingPdfAnnotsMarkupInfoGetAuthor(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}set author(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'author' must be of type string and must not be null or undefined.");Module.ViewingPdfAnnotsMarkupInfoSetAuthor(this.handle,t)||n.NativeBase.throwLastError(!1)}get subject(){let e=Module.ViewingPdfAnnotsMarkupInfoGetSubject(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}set subject(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'subject' must be of type string and must not be null or undefined.");Module.ViewingPdfAnnotsMarkupInfoSetSubject(this.handle,t)||n.NativeBase.throwLastError(!1)}get content(){let e=Module.ViewingPdfAnnotsMarkupInfoGetContent(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}set content(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'content' must be of type string and must not be null or undefined.");Module.ViewingPdfAnnotsMarkupInfoSetContent(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.MarkupInfo=h;class c extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new c(e)}close(){Module.ViewingPdfAnnotsMarkupInfoListClose(this.handle)||n.NativeBase.throwLastError()}remove(e){throw new Error("Method not implemented.")}add(e){throw new Error("Method not implemented.")}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(t){let i=Module.ViewingPdfAnnotsMarkupInfoListGet(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.MarkupInfo.createDynamicObject(i)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingPdfAnnotsMarkupInfoListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.MarkupInfoList=c;class u extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new u(e)}close(){Module.ViewingPdfAnnotsPopupClose(this.handle)||n.NativeBase.throwLastError()}get isOpen(){let e=Module.ViewingPdfAnnotsPopupGetIsOpen(this.handle);return e||n.NativeBase.throwLastError(),e}set isOpen(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'isOpen' must be of type boolean and must not be null or undefined.");Module.ViewingPdfAnnotsPopupSetIsOpen(this.handle,t)||n.NativeBase.throwLastError(!1)}get boundingBox(){let t=Module.ViewingPdfAnnotsPopupGetBoundingBox(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.RectangleOnPage(t.pageNumber,t.x,t.y,t.width,t.height)}set boundingBox(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");Module.ViewingPdfAnnotsPopupSetBoundingBox(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.Popup=u;class p extends e.Pdf.Annotations.Annotation{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfAnnotsMarkupAnnotationGetType(t)){case 0:default:return new p(t);case 1:return e.Pdf.Annotations.StickyNote.createDynamicObject(t);case 2:return e.Pdf.Annotations.FileAttachment.createDynamicObject(t);case 3:return e.Pdf.Annotations.Stamp.createDynamicObject(t);case 4:return e.Pdf.Annotations.TextStamp.createDynamicObject(t);case 5:return e.Pdf.Annotations.CustomTextStamp.createDynamicObject(t);case 6:return e.Pdf.Annotations.CustomImageStamp.createDynamicObject(t);case 7:return e.Pdf.Annotations.FreeText.createDynamicObject(t);case 8:return e.Pdf.Annotations.DrawingAnnotation.createDynamicObject(t);case 9:return e.Pdf.Annotations.LineAnnotation.createDynamicObject(t);case 10:return e.Pdf.Annotations.InkAnnotation.createDynamicObject(t);case 11:return e.Pdf.Annotations.PolyLineAnnotation.createDynamicObject(t);case 12:return e.Pdf.Annotations.PolygonAnnotation.createDynamicObject(t);case 13:return e.Pdf.Annotations.RectangleAnnotation.createDynamicObject(t);case 14:return e.Pdf.Annotations.EllipseAnnotation.createDynamicObject(t);case 15:return e.Pdf.Annotations.TextMarkup.createDynamicObject(t);case 16:return e.Pdf.Annotations.Highlight.createDynamicObject(t);case 17:return e.Pdf.Annotations.Underline.createDynamicObject(t);case 18:return e.Pdf.Annotations.StrikeThrough.createDynamicObject(t);case 19:return e.Pdf.Annotations.Squiggly.createDynamicObject(t);case 20:return e.Pdf.Annotations.TextInsert.createDynamicObject(t)}}get locked(){let e=Module.ViewingPdfAnnotsMarkupAnnotationGetLocked(this.handle);return e||n.NativeBase.throwLastError(),e}get info(){let t=Module.ViewingPdfAnnotsMarkupAnnotationGetInfo(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.MarkupInfo.createDynamicObject(t)}get replies(){let t=Module.ViewingPdfAnnotsMarkupAnnotationGetReplies(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.MarkupInfoList.createDynamicObject(t)}}t.MarkupAnnotation=p;class g extends e.Pdf.Annotations.MarkupAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new g(e)}static create(t,i,o){if("object"!=typeof t)throw new e.ArgumentError("Argument 'topLeft' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");if("string"!=typeof i)throw new e.ArgumentError("Argument 'content' must be of type string and must not be null or undefined.");if("object"!=typeof o)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");let s=Module.ViewingPdfAnnotsStickyNoteCreate(t,i,o);return 0===s&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.StickyNote.createDynamicObject(s)}get color(){let t=Module.ViewingPdfAnnotsStickyNoteGetColor(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}set color(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingPdfAnnotsStickyNoteSetColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get popup(){let t=Module.ViewingPdfAnnotsStickyNoteGetPopup(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Annotations.Popup.createDynamicObject(t):null}}t.StickyNote=g;class m extends e.Pdf.Annotations.MarkupAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new m(e)}get icon(){let e=Module.ViewingPdfAnnotsFileAttachmentGetIcon(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get color(){let t=Module.ViewingPdfAnnotsFileAttachmentGetColor(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}set color(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingPdfAnnotsFileAttachmentSetColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get popup(){let t=Module.ViewingPdfAnnotsFileAttachmentGetPopup(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Annotations.Popup.createDynamicObject(t):null}}t.FileAttachment=m;class f extends e.Pdf.Annotations.MarkupAnnotation{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfAnnotsStampGetType(t)){case 0:default:return new f(t);case 1:return e.Pdf.Annotations.TextStamp.createDynamicObject(t);case 2:return e.Pdf.Annotations.CustomTextStamp.createDynamicObject(t);case 3:return e.Pdf.Annotations.CustomImageStamp.createDynamicObject(t)}}get popup(){let t=Module.ViewingPdfAnnotsStampGetPopup(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Annotations.Popup.createDynamicObject(t):null}get color(){let t=Module.ViewingPdfAnnotsStampGetColor(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}set color(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingPdfAnnotsStampSetColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get rotation(){let e=Module.ViewingPdfAnnotsStampGetRotation(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set rotation(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");Module.ViewingPdfAnnotsStampSetRotation(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.Stamp=f;class v extends e.Pdf.Annotations.Stamp{constructor(e){super(e)}static createDynamicObject(e){return new v(e)}static createRaw(t,i,o,s,a){if("object"!=typeof t)throw new e.ArgumentError("Argument 'topLeft' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");if(null!=i&&"number"!=typeof i)throw new e.ArgumentError("Argument 'height' must be of type number or can be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'textType' must be of type PdfViewing.Pdf.Annotations.TextStampType and must not be null or undefined.");if("string"!=typeof s)throw new e.ArgumentError("Argument 'text' must be of type string and must not be null or undefined.");if("number"!=typeof a)throw new e.ArgumentError("Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");let r=Module.ViewingPdfAnnotsTextStampCreateRaw(t,i,o,s,a);return 0===r&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.TextStamp.createDynamicObject(r)}get textType(){let e=Module.ViewingPdfAnnotsTextStampGetTextType(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}}t.TextStamp=v;class w extends e.Pdf.Annotations.Stamp{constructor(e){super(e)}static createDynamicObject(e){return new w(e)}static create(t,i,o,s){if("object"!=typeof t)throw new e.ArgumentError("Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");if("string"!=typeof i)throw new e.ArgumentError("Argument 'stampText' must be of type string and must not be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'stampColor' must be of type PdfViewing.Pdf.Annotations.StampColor and must not be null or undefined.");if("number"!=typeof s)throw new e.ArgumentError("Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");let a=Module.ViewingPdfAnnotsCustomTextStampCreate(t,i,o,s);return 0===a&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.CustomTextStamp.createDynamicObject(a)}}t.CustomTextStamp=w;class b extends e.Pdf.Annotations.Stamp{constructor(e){super(e)}static createDynamicObject(e){return new b(e)}static create(t,i,o){if("object"!=typeof t)throw new e.ArgumentError("Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'imageId' must be of type number and must not be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");let s=Module.ViewingPdfAnnotsCustomImageStampCreate(t,i,o);return 0===s&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.CustomImageStamp.createDynamicObject(s)}}t.CustomImageStamp=b;class P extends e.Pdf.Annotations.MarkupAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new P(e)}static create(t,i,o,s,a){if("object"!=typeof t)throw new e.ArgumentError("Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");if("string"!=typeof i)throw new e.ArgumentError("Argument 'richText' must be of type string and must not be null or undefined.");if(null!=o&&"object"!=typeof o)throw new e.ArgumentError("Argument 'backgroundColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");if(!(s instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");if("number"!=typeof a)throw new e.ArgumentError("Argument 'viewRotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");let r=Module.ViewingPdfAnnotsFreeTextCreate(t,i,o,s.handle,a);return 0===r&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.FreeText.createDynamicObject(r)}get annotationStroke(){let t=Module.ViewingPdfAnnotsFreeTextGetAnnotationStroke(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.AnnotationStroke.createDynamicObject(t)}set annotationStroke(t){if(!(t instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");Module.ViewingPdfAnnotsFreeTextSetAnnotationStroke(this.handle,t.handle)||n.NativeBase.throwLastError(!1)}get richText(){let e=Module.ViewingPdfAnnotsFreeTextGetRichText(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}set richText(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'richText' must be of type string and must not be null or undefined.");Module.ViewingPdfAnnotsFreeTextSetRichText(this.handle,t)||n.NativeBase.throwLastError(!1)}get backgroundColor(){let t=Module.ViewingPdfAnnotsFreeTextGetBackgroundColor(this.handle);return null===t&&n.NativeBase.throwLastError(),null!==t?new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha):null}set backgroundColor(t){if(null!=t&&"object"!=typeof t)throw new e.ArgumentError("Argument 'backgroundColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");Module.ViewingPdfAnnotsFreeTextSetBackgroundColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get rotation(){let e=Module.ViewingPdfAnnotsFreeTextGetRotation(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set rotation(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'rotation' must be of type PdfViewing.Pdf.Geometry.Rotation and must not be null or undefined.");Module.ViewingPdfAnnotsFreeTextSetRotation(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.FreeText=P;class y extends e.Pdf.Annotations.MarkupAnnotation{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfAnnotsDrawingAnnotationGetType(t)){case 0:default:return new y(t);case 1:return e.Pdf.Annotations.LineAnnotation.createDynamicObject(t);case 2:return e.Pdf.Annotations.InkAnnotation.createDynamicObject(t);case 3:return e.Pdf.Annotations.PolyLineAnnotation.createDynamicObject(t);case 4:return e.Pdf.Annotations.PolygonAnnotation.createDynamicObject(t);case 5:return e.Pdf.Annotations.RectangleAnnotation.createDynamicObject(t);case 6:return e.Pdf.Annotations.EllipseAnnotation.createDynamicObject(t)}}get strokeColor(){let t=Module.ViewingPdfAnnotsDrawingAnnotationGetStrokeColor(this.handle);return null===t&&n.NativeBase.throwLastError(),null!==t?new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha):null}set strokeColor(t){if(null!=t&&"object"!=typeof t)throw new e.ArgumentError("Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");Module.ViewingPdfAnnotsDrawingAnnotationSetStrokeColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get annotationStroke(){let t=Module.ViewingPdfAnnotsDrawingAnnotationGetAnnotationStroke(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Annotations.AnnotationStroke.createDynamicObject(t):null}set annotationStroke(t){if(null!=t&&!(t instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke or can be null or undefined.");Module.ViewingPdfAnnotsDrawingAnnotationSetAnnotationStroke(this.handle,null!=t?t.handle:0)||n.NativeBase.throwLastError(!1)}get popup(){let t=Module.ViewingPdfAnnotsDrawingAnnotationGetPopup(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Annotations.Popup.createDynamicObject(t):null}get path(){let t=Module.ViewingPdfAnnotsDrawingAnnotationGetPath(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Geometry.Real.Path.createDynamicObject(t)}}t.DrawingAnnotation=y;class C extends e.Pdf.Annotations.DrawingAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new C(e)}static create(t,i,o,s){if("object"!=typeof t)throw new e.ArgumentError("Argument 'start' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'end' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");if(null!=o&&"object"!=typeof o)throw new e.ArgumentError("Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");if(!(s instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");let a=Module.ViewingPdfAnnotsLineAnnotationCreate(t,i,o,s.handle);return 0===a&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.LineAnnotation.createDynamicObject(a)}get start(){let t=Module.ViewingPdfAnnotsLineAnnotationGetStart(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.PointOnPage(t.pageNumber,t.x,t.y)}get end(){let t=Module.ViewingPdfAnnotsLineAnnotationGetEnd(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.PointOnPage(t.pageNumber,t.x,t.y)}get startStyle(){let e=Module.ViewingPdfAnnotsLineAnnotationGetStartStyle(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get endStyle(){let e=Module.ViewingPdfAnnotsLineAnnotationGetEndStyle(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get lineEndingFill(){let t=Module.ViewingPdfAnnotsLineAnnotationGetLineEndingFill(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}}t.LineAnnotation=C;class A extends e.Pdf.Annotations.DrawingAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new A(e)}static create(t,i,o,s){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if(!(i instanceof e.Pdf.Geometry.Real.Path))throw new e.ArgumentError("Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.");if("object"!=typeof o)throw new e.ArgumentError("Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");if(!(s instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");let a=Module.ViewingPdfAnnotsInkAnnotationCreate(t,i.handle,o,s.handle);return 0===a&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.InkAnnotation.createDynamicObject(a)}setPath(t){if(!(t instanceof e.Pdf.Geometry.Real.Path))throw new e.ArgumentError("Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.");Module.ViewingPdfAnnotsInkAnnotationSetPath(this.handle,t.handle)||n.NativeBase.throwLastError(!1)}}t.InkAnnotation=A;class E extends e.Pdf.Annotations.DrawingAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new E(e)}static create(t,i,o,s){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if(!(i instanceof e.Pdf.Geometry.Real.Path))throw new e.ArgumentError("Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.");if("object"!=typeof o)throw new e.ArgumentError("Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");if(!(s instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");let a=Module.ViewingPdfAnnotsPolyLineAnnotationCreate(t,i.handle,o,s.handle);return 0===a&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.PolyLineAnnotation.createDynamicObject(a)}get startStyle(){let e=Module.ViewingPdfAnnotsPolyLineAnnotationGetStartStyle(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get endStyle(){let e=Module.ViewingPdfAnnotsPolyLineAnnotationGetEndStyle(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get lineEndingFill(){let t=Module.ViewingPdfAnnotsPolyLineAnnotationGetLineEndingFill(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}}t.PolyLineAnnotation=E;class S extends e.Pdf.Annotations.DrawingAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new S(e)}static create(t,i,o,s,a,r){if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if(!(i instanceof e.Pdf.Geometry.Real.Path))throw new e.ArgumentError("Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.");if(null!=o&&"object"!=typeof o)throw new e.ArgumentError("Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");if(!(s instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");if("number"!=typeof a)throw new e.ArgumentError("Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.");if(null!=r&&"object"!=typeof r)throw new e.ArgumentError("Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");let l=Module.ViewingPdfAnnotsPolygonAnnotationCreate(t,i.handle,o,s.handle,a,r);return 0===l&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.PolygonAnnotation.createDynamicObject(l)}get borderStyleType(){let e=Module.ViewingPdfAnnotsPolygonAnnotationGetBorderStyleType(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set borderStyleType(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.");Module.ViewingPdfAnnotsPolygonAnnotationSetBorderStyleType(this.handle,t)||n.NativeBase.throwLastError(!1)}get fillColor(){let t=Module.ViewingPdfAnnotsPolygonAnnotationGetFillColor(this.handle);return null===t&&n.NativeBase.throwLastError(),null!==t?new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha):null}set fillColor(t){if(null!=t&&"object"!=typeof t)throw new e.ArgumentError("Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");Module.ViewingPdfAnnotsPolygonAnnotationSetFillColor(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.PolygonAnnotation=S;class x extends e.Pdf.Annotations.DrawingAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new x(e)}static create(t,i,o,s,a){if("object"!=typeof t)throw new e.ArgumentError("Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");if(null!=i&&"object"!=typeof i)throw new e.ArgumentError("Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");if(!(o instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");if("number"!=typeof s)throw new e.ArgumentError("Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.");if(null!=a&&"object"!=typeof a)throw new e.ArgumentError("Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");let r=Module.ViewingPdfAnnotsRectangleAnnotationCreate(t,i,o.handle,s,a);return 0===r&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.RectangleAnnotation.createDynamicObject(r)}get borderStyleType(){let e=Module.ViewingPdfAnnotsRectangleAnnotationGetBorderStyleType(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set borderStyleType(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.");Module.ViewingPdfAnnotsRectangleAnnotationSetBorderStyleType(this.handle,t)||n.NativeBase.throwLastError(!1)}get fillColor(){let t=Module.ViewingPdfAnnotsRectangleAnnotationGetFillColor(this.handle);return null===t&&n.NativeBase.throwLastError(),null!==t?new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha):null}set fillColor(t){if(null!=t&&"object"!=typeof t)throw new e.ArgumentError("Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");Module.ViewingPdfAnnotsRectangleAnnotationSetFillColor(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.RectangleAnnotation=x;class T extends e.Pdf.Annotations.DrawingAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new T(e)}static create(t,i,o,s,a){if("object"!=typeof t)throw new e.ArgumentError("Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");if(null!=i&&"object"!=typeof i)throw new e.ArgumentError("Argument 'strokeColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");if(!(o instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");if("number"!=typeof s)throw new e.ArgumentError("Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.");if(null!=a&&"object"!=typeof a)throw new e.ArgumentError("Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");let r=Module.ViewingPdfAnnotsEllipseAnnotationCreate(t,i,o.handle,s,a);return 0===r&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.EllipseAnnotation.createDynamicObject(r)}get borderStyleType(){let e=Module.ViewingPdfAnnotsEllipseAnnotationGetBorderStyleType(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set borderStyleType(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'borderStyleType' must be of type PdfViewing.Pdf.Annotations.BorderStyleType and must not be null or undefined.");Module.ViewingPdfAnnotsEllipseAnnotationSetBorderStyleType(this.handle,t)||n.NativeBase.throwLastError(!1)}get fillColor(){let t=Module.ViewingPdfAnnotsEllipseAnnotationGetFillColor(this.handle);return null===t&&n.NativeBase.throwLastError(),null!==t?new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha):null}set fillColor(t){if(null!=t&&"object"!=typeof t)throw new e.ArgumentError("Argument 'fillColor' must be of type PdfViewing.Pdf.Annotations.Color or can be null or undefined.");Module.ViewingPdfAnnotsEllipseAnnotationSetFillColor(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.EllipseAnnotation=T;class O extends e.Pdf.Annotations.MarkupAnnotation{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfAnnotsTextMarkupGetType(t)){case 0:default:return new O(t);case 1:return e.Pdf.Annotations.Highlight.createDynamicObject(t);case 2:return e.Pdf.Annotations.Underline.createDynamicObject(t);case 3:return e.Pdf.Annotations.StrikeThrough.createDynamicObject(t);case 4:return e.Pdf.Annotations.Squiggly.createDynamicObject(t)}}get color(){let t=Module.ViewingPdfAnnotsTextMarkupGetColor(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}set color(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingPdfAnnotsTextMarkupSetColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get popup(){let t=Module.ViewingPdfAnnotsTextMarkupGetPopup(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Annotations.Popup.createDynamicObject(t):null}get markupArea(){let t=Module.ViewingPdfAnnotsTextMarkupGetMarkupArea(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Geometry.Real.QuadrilateralList.createDynamicObject(t)}set markupArea(t){if(!(t instanceof e.Pdf.Geometry.Real.QuadrilateralList))throw new e.ArgumentError("Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.");Module.ViewingPdfAnnotsTextMarkupSetMarkupArea(this.handle,t.handle)||n.NativeBase.throwLastError(!1)}get markedText(){let e=Module.ViewingPdfAnnotsTextMarkupGetMarkedText(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}}t.TextMarkup=O;class M extends e.Pdf.Annotations.TextMarkup{constructor(e){super(e)}static createDynamicObject(e){return new M(e)}static create(t,i){if(!(t instanceof e.Pdf.Geometry.Real.QuadrilateralList))throw new e.ArgumentError("Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");let o=Module.ViewingPdfAnnotsHighlightCreate(t.handle,i);return 0===o&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.Highlight.createDynamicObject(o)}}t.Highlight=M;class R extends e.Pdf.Annotations.TextMarkup{constructor(e){super(e)}static createDynamicObject(e){return new R(e)}static create(t,i){if(!(t instanceof e.Pdf.Geometry.Real.QuadrilateralList))throw new e.ArgumentError("Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");let o=Module.ViewingPdfAnnotsUnderlineCreate(t.handle,i);return 0===o&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.Underline.createDynamicObject(o)}}t.Underline=R;class N extends e.Pdf.Annotations.TextMarkup{constructor(e){super(e)}static createDynamicObject(e){return new N(e)}static create(t,i){if(!(t instanceof e.Pdf.Geometry.Real.QuadrilateralList))throw new e.ArgumentError("Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");let o=Module.ViewingPdfAnnotsStrikeThroughCreate(t.handle,i);return 0===o&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.StrikeThrough.createDynamicObject(o)}}t.StrikeThrough=N;class V extends e.Pdf.Annotations.TextMarkup{constructor(e){super(e)}static createDynamicObject(e){return new V(e)}static create(t,i){if(!(t instanceof e.Pdf.Geometry.Real.QuadrilateralList))throw new e.ArgumentError("Argument 'markupArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");let o=Module.ViewingPdfAnnotsSquigglyCreate(t.handle,i);return 0===o&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.Squiggly.createDynamicObject(o)}}t.Squiggly=V;class D extends e.Pdf.Annotations.MarkupAnnotation{constructor(e){super(e)}static createDynamicObject(e){return new D(e)}get color(){let t=Module.ViewingPdfAnnotsTextInsertGetColor(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}set color(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingPdfAnnotsTextInsertSetColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get popup(){let t=Module.ViewingPdfAnnotsTextInsertGetPopup(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Annotations.Popup.createDynamicObject(t):null}}t.TextInsert=D;class k extends e.Pdf.Annotations.Annotation{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfAnnotsLinkGetType(t)){case 0:default:return new k(t);case 1:return e.Pdf.Annotations.InternalLink.createDynamicObject(t);case 2:return e.Pdf.Annotations.WebLink.createDynamicObject(t);case 3:return e.Pdf.Annotations.EmbeddedPdfLink.createDynamicObject(t)}}set annotationStroke(t){if(!(t instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");Module.ViewingPdfAnnotsLinkSetAnnotationStroke(this.handle,t.handle)||n.NativeBase.throwLastError(!1)}get color(){let t=Module.ViewingPdfAnnotsLinkGetColor(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Annotations.Color(t.red,t.green,t.blue,t.alpha)}set color(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'color' must be of type PdfViewing.Pdf.Annotations.Color and must not be null or undefined.");Module.ViewingPdfAnnotsLinkSetColor(this.handle,t)||n.NativeBase.throwLastError(!1)}get activeArea(){let t=Module.ViewingPdfAnnotsLinkGetActiveArea(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Geometry.Real.QuadrilateralList.createDynamicObject(t)}set activeArea(t){if(!(t instanceof e.Pdf.Geometry.Real.QuadrilateralList))throw new e.ArgumentError("Argument 'activeArea' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralList and must not be null or undefined.");Module.ViewingPdfAnnotsLinkSetActiveArea(this.handle,t.handle)||n.NativeBase.throwLastError(!1)}}t.Link=k;class I extends e.Pdf.Annotations.Link{constructor(e){super(e)}static createDynamicObject(e){return new I(e)}get destination(){let t=Module.ViewingPdfAnnotsInternalLinkGetDestination(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Navigation.Destination.createDynamicObject(t):null}}t.InternalLink=I;class F extends e.Pdf.Annotations.Link{constructor(e){super(e)}static createDynamicObject(e){return new F(e)}static create(t,i,o){if("object"!=typeof t)throw new e.ArgumentError("Argument 'boundingBox' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");if(!(i instanceof e.Pdf.Annotations.AnnotationStroke))throw new e.ArgumentError("Argument 'annotationStroke' must be of type PdfViewing.Pdf.Annotations.AnnotationStroke and must not be null or undefined.");if("string"!=typeof o)throw new e.ArgumentError("Argument 'uri' must be of type string and must not be null or undefined.");let s=Module.ViewingPdfAnnotsWebLinkCreate(t,i.handle,o);return 0===s&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.WebLink.createDynamicObject(s)}get uri(){let e=Module.ViewingPdfAnnotsWebLinkGetUri(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}set uri(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'uri' must be of type string and must not be null or undefined.");Module.ViewingPdfAnnotsWebLinkSetUri(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.WebLink=F;class B extends e.Pdf.Annotations.Link{constructor(e){super(e)}static createDynamicObject(e){return new B(e)}get newWindow(){let e=Module.ViewingPdfAnnotsEmbeddedPdfLinkGetNewWindow(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set newWindow(t){if(null!=t&&"boolean"!=typeof t)throw new e.ArgumentError("Argument 'newWindow' must be of type boolean or can be null or undefined.");Module.ViewingPdfAnnotsEmbeddedPdfLinkSetNewWindow(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.EmbeddedPdfLink=B;class j extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfAnnotsNewAnnotationStroke()))}static createDynamicObject(e){return new j({__handle:e})}close(){Module.ViewingPdfAnnotsAnnotationStrokeClose(this.handle)||n.NativeBase.throwLastError()}get lineWidth(){let e=Module.ViewingPdfAnnotsAnnotationStrokeGetLineWidth(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}set lineWidth(t){if("number"!=typeof t)throw new e.ArgumentError("Argument 'lineWidth' must be of type number and must not be null or undefined.");Module.ViewingPdfAnnotsAnnotationStrokeSetLineWidth(this.handle,t)||n.NativeBase.throwLastError(!1)}get dashArray(){let e=Module.ViewingPdfAnnotsAnnotationStrokeGetDashArray(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}set dashArray(t){if(!Array.isArray(t))throw new e.ArgumentError("Argument 'dashArray' must be of type number and must not be null or undefined.");Module.ViewingPdfAnnotsAnnotationStrokeSetDashArray(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.AnnotationStroke=j;class z extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new z(e)}close(){Module.ViewingPdfAnnotsAnnotationListClose(this.handle)||n.NativeBase.throwLastError()}remove(e){throw new Error("Method not implemented.")}add(e){throw new Error("Method not implemented.")}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(t){let i=Module.ViewingPdfAnnotsAnnotationListGet(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.Pdf.Annotations.Annotation.createDynamicObject(i)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingPdfAnnotsAnnotationListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.AnnotationList=z}(a=t.Annotations||(t.Annotations={})),function(t){class i extends e.Pdf.Annotations.Annotation{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfFormsWidgetGetType(t)){case 0:default:return new i(t);case 1:return e.Pdf.Forms.CheckBox.createDynamicObject(t);case 2:return e.Pdf.Forms.RadioButton.createDynamicObject(t);case 3:return e.Pdf.Forms.TextBox.createDynamicObject(t);case 4:return e.Pdf.Forms.ListBox.createDynamicObject(t);case 5:return e.Pdf.Forms.ComboBox.createDynamicObject(t)}}get readOnly(){let e=Module.ViewingPdfFormsWidgetGetReadOnly(this.handle);return e||n.NativeBase.throwLastError(),e}get required(){let e=Module.ViewingPdfFormsWidgetGetRequired(this.handle);return e||n.NativeBase.throwLastError(),e}}t.Widget=i;class o extends e.Pdf.Forms.Widget{constructor(e){super(e)}static createDynamicObject(e){return new o(e)}push(){Module.ViewingPdfFormsCheckBoxpush(this.handle)||n.NativeBase.throwLastError(!1)}get isChecked(){let e=Module.ViewingPdfFormsCheckBoxGetIsChecked(this.handle);return e||n.NativeBase.throwLastError(),e}}t.CheckBox=o;class s extends e.Pdf.Forms.Widget{constructor(e){super(e)}static createDynamicObject(e){return new s(e)}push(){Module.ViewingPdfFormsRadioButtonpush(this.handle)||n.NativeBase.throwLastError(!1)}get noSelectionAllowed(){let e=Module.ViewingPdfFormsRadioButtonGetNoSelectionAllowed(this.handle);return e||n.NativeBase.throwLastError(),e}get selected(){let e=Module.ViewingPdfFormsRadioButtonGetSelected(this.handle);return e||n.NativeBase.throwLastError(),e}}t.RadioButton=s;class a extends e.Pdf.Forms.Widget{constructor(e){super(e)}static createDynamicObject(e){return new a(e)}get scrollAllowed(){let e=Module.ViewingPdfFormsTextBoxGetScrollAllowed(this.handle);return e||n.NativeBase.throwLastError(),e}get multilineAllowed(){let e=Module.ViewingPdfFormsTextBoxGetMultilineAllowed(this.handle);return e||n.NativeBase.throwLastError(),e}get textIsRichText(){let e=Module.ViewingPdfFormsTextBoxGetTextIsRichText(this.handle);return e||n.NativeBase.throwLastError(),e}get comb(){let e=Module.ViewingPdfFormsTextBoxGetComb(this.handle);return e||n.NativeBase.throwLastError(),e}get maxLength(){let e=Module.ViewingPdfFormsTextBoxGetMaxLength(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get text(){let e=Module.ViewingPdfFormsTextBoxGetText(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}set text(t){if("string"!=typeof t)throw new e.ArgumentError("Argument 'text' must be of type string and must not be null or undefined.");Module.ViewingPdfFormsTextBoxSetText(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.TextBox=a;class r extends e.Pdf.Forms.Widget{constructor(e){super(e)}static createDynamicObject(e){return new r(e)}get multiSelectAllowed(){let e=Module.ViewingPdfFormsListBoxGetMultiSelectAllowed(this.handle);return e||n.NativeBase.throwLastError(),e}get options(){let t=Module.ViewingPdfFormsListBoxGetOptions(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.StringList.createDynamicObject(t)}get chosen(){let t=Module.ViewingPdfFormsListBoxGetChosen(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.IntegerSet.createDynamicObject(t)}set chosen(t){if(!(t instanceof e.IntegerSet))throw new e.ArgumentError("Argument 'chosen' must be of type PdfViewing.IntegerSet and must not be null or undefined.");Module.ViewingPdfFormsListBoxSetChosen(this.handle,t.handle)||n.NativeBase.throwLastError(!1)}}t.ListBox=r;class l extends e.Pdf.Forms.Widget{constructor(e){super(e)}static createDynamicObject(e){return new l(e)}get customEntryAllowed(){let e=Module.ViewingPdfFormsComboBoxGetCustomEntryAllowed(this.handle);return e||n.NativeBase.throwLastError(),e}get customEntry(){let e=Module.ViewingPdfFormsComboBoxGetCustomEntry(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set customEntry(t){if(null!=t&&"string"!=typeof t)throw new e.ArgumentError("Argument 'customEntry' must be of type string or can be null or undefined.");Module.ViewingPdfFormsComboBoxSetCustomEntry(this.handle,t)||n.NativeBase.throwLastError(!1)}get options(){let t=Module.ViewingPdfFormsComboBoxGetOptions(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.StringList.createDynamicObject(t)}get chosen(){let e=Module.ViewingPdfFormsComboBoxGetChosen(this.handle);return null===e&&n.NativeBase.throwLastError(),e}set chosen(t){if(null!=t&&"number"!=typeof t)throw new e.ArgumentError("Argument 'chosen' must be of type number or can be null or undefined.");Module.ViewingPdfFormsComboBoxSetChosen(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.ComboBox=l}(r=t.Forms||(t.Forms={})),function(t){let i,o,s;!function(e){e[e.NoRotation=0]="NoRotation",e[e.Clockwise=90]="Clockwise",e[e.UpsideDown=180]="UpsideDown",e[e.CounterClockwise=270]="CounterClockwise"}(i=t.Rotation||(t.Rotation={})),function(t){class i extends n.NativeBase{constructor(t,n){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'width' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'height' must be of type number and must not be null or undefined.");this.width=t,this.height=n}equals(e){return null!==e&&this.width===e.width&&this.height===e.height}}t.Size=i;class o extends n.NativeBase{constructor(t,n){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'x' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'y' must be of type number and must not be null or undefined.");this.x=t,this.y=n}equals(e){return null!==e&&this.x===e.x&&this.y===e.y}}t.Point=o;class s extends n.NativeBase{constructor(t,n,i){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'x' must be of type number and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'y' must be of type number and must not be null or undefined.");this.pageNumber=t,this.x=n,this.y=i}equals(e){return null!==e&&this.pageNumber===e.pageNumber&&this.x===e.x&&this.y===e.y}}t.PointOnPage=s;class a extends n.NativeBase{constructor(t,n,i,o,s){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if("object"!=typeof n)throw new e.ArgumentError("Argument 'bottomLeft' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'bottomRight' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");if("object"!=typeof o)throw new e.ArgumentError("Argument 'topRight' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");if("object"!=typeof s)throw new e.ArgumentError("Argument 'topLeft' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");this.pageNumber=t,this.bottomLeft=n,this.bottomRight=i,this.topRight=o,this.topLeft=s}equals(e){return!!(null!==e&&this.pageNumber===e.pageNumber&&this.bottomLeft.equals(e.bottomLeft)&&this.bottomRight.equals(e.bottomRight)&&this.topRight.equals(e.topRight)&&this.topLeft.equals(e.topLeft))}}t.QuadrilateralOnPage=a;class r extends n.NativeBase{constructor(t,n,i,o,s){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'x' must be of type number and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'y' must be of type number and must not be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'width' must be of type number and must not be null or undefined.");if("number"!=typeof s)throw new e.ArgumentError("Argument 'height' must be of type number and must not be null or undefined.");this.pageNumber=t,this.x=n,this.y=i,this.width=o,this.height=s}equals(e){return null!==e&&this.pageNumber===e.pageNumber&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height}}t.RectangleOnPage=r;class l extends n.NativeBase{constructor(t,n,i,o){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'x' must be of type number and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'y' must be of type number and must not be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'operator' must be of type PdfViewing.Pdf.Geometry.Real.PathOperation and must not be null or undefined.");this.pageNumber=t,this.x=n,this.y=i,this.operator=o}equals(e){return null!==e&&this.pageNumber===e.pageNumber&&this.x===e.x&&this.y===e.y&&this.operator===e.operator}}let d;t.Vertex=l,function(e){e[e.MoveTo=0]="MoveTo",e[e.LineTo=1]="LineTo"}(d=t.PathOperation||(t.PathOperation={}));class h extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new h(e)}close(){Module.ViewingPdfGeomRealRectangleOnPageListClose(this.handle)||n.NativeBase.throwLastError()}remove(e){throw new Error("Method not implemented.")}add(e){throw new Error("Method not implemented.")}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(t){let i=Module.ViewingPdfGeomRealRectangleOnPageListGet(this.handle,t);return null===i&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.RectangleOnPage(i.pageNumber,i.x,i.y,i.width,i.height)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingPdfGeomRealRectangleOnPageListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.RectangleOnPageList=h;class c extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfGeomRealNewPath()))}static createDynamicObject(e){return new c({__handle:e})}get vertices(){let t=Module.ViewingPdfGeomRealPathGetVertices(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Geometry.Real.VertexList.createDynamicObject(t)}set vertices(t){if(!(t instanceof e.Pdf.Geometry.Real.VertexList))throw new e.ArgumentError("Argument 'vertices' must be of type PdfViewing.Pdf.Geometry.Real.VertexList and must not be null or undefined.");Module.ViewingPdfGeomRealPathSetVertices(this.handle,t.handle)||n.NativeBase.throwLastError(!1)}}t.Path=c;class u extends n.NativeObject{constructor(t){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if(!(t instanceof e.Pdf.Geometry.Real.Path))throw new e.ArgumentError("Argument 'path' must be of type PdfViewing.Pdf.Geometry.Real.Path and must not be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfGeomRealNewPathGenerator(t.handle)))}}static createDynamicObject(e){return new u({__handle:e})}close(){Module.ViewingPdfGeomRealPathGeneratorClose(this.handle)||n.NativeBase.throwLastError()}moveTo(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'target' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");Module.ViewingPdfGeomRealPathGeneratorMoveTo(this.handle,t)||n.NativeBase.throwLastError(!1)}lineTo(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'target' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");Module.ViewingPdfGeomRealPathGeneratorLineTo(this.handle,t)||n.NativeBase.throwLastError(!1)}bezierTo(t,i,o){if("object"!=typeof t)throw new e.ArgumentError("Argument 'ctrl1' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");if("object"!=typeof i)throw new e.ArgumentError("Argument 'ctrl2' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");if("object"!=typeof o)throw new e.ArgumentError("Argument 'target' must be of type PdfViewing.Pdf.Geometry.Real.Point and must not be null or undefined.");Module.ViewingPdfGeomRealPathGeneratorBezierTo(this.handle,t,i,o)||n.NativeBase.throwLastError(!1)}closeSubpath(){Module.ViewingPdfGeomRealPathGeneratorCloseSubpath(this.handle)||n.NativeBase.throwLastError(!1)}addRectangle(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'rect' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");Module.ViewingPdfGeomRealPathGeneratorAddRectangle(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.PathGenerator=u;class p extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfGeomRealNewQuadrilateralList()))}static createDynamicObject(e){return new p({__handle:e})}close(){Module.ViewingPdfGeomRealQuadrilateralListClose(this.handle)||n.NativeBase.throwLastError()}contains(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'pointOnPage' must be of type PdfViewing.Pdf.Geometry.Real.PointOnPage and must not be null or undefined.");let i=Module.ViewingPdfGeomRealQuadrilateralListContains(this.handle,t);return i||n.NativeBase.throwLastError(),i}get boundingBox(){let t=Module.ViewingPdfGeomRealQuadrilateralListGetBoundingBox(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.RectangleOnPage(t.pageNumber,t.x,t.y,t.width,t.height)}remove(e){throw new Error("Method not implemented.")}add(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'element' must be of type PdfViewing.Pdf.Geometry.Real.QuadrilateralOnPage and must not be null or undefined.");return Module.ViewingPdfGeomRealQuadrilateralListAdd(this.handle,t)||n.NativeBase.throwLastError(!1),!0}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(t){let i=Module.ViewingPdfGeomRealQuadrilateralListGet(this.handle,t);return null===i&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.QuadrilateralOnPage(i.pageNumber,i.bottomLeft,i.bottomRight,i.topRight,i.topLeft)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingPdfGeomRealQuadrilateralListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.QuadrilateralList=p;class g extends n.NativeObject{constructor(){arguments[0]&&"number"==typeof arguments[0].__handle?super(arguments[0].__handle):super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfGeomRealNewVertexList()))}static createDynamicObject(e){return new g({__handle:e})}indexOf(e){for(var t=0;t<this.size;t++)if(e.equals(this.get(t)))return t;return-1}remove(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'element' must be of type PdfViewing.Pdf.Geometry.Real.Vertex and must not be null or undefined.");let i=this.indexOf(t);return-1!=i&&(Module.ViewingPdfGeomRealVertexListRemove(this.handle,i)||n.NativeBase.throwLastError(!1),!0)}add(t){if("object"!=typeof t)throw new e.ArgumentError("Argument 'element' must be of type PdfViewing.Pdf.Geometry.Real.Vertex and must not be null or undefined.");return Module.ViewingPdfGeomRealVertexListAdd(this.handle,t)||n.NativeBase.throwLastError(!1),!0}addRange(t){if(!(t instanceof e.Pdf.Geometry.Real.VertexList))throw new e.ArgumentError("Argument 'inputList' must be of type PdfViewing.Pdf.Geometry.Real.VertexList and must not be null or undefined.");return 0!=t.size&&(Module.ViewingPdfGeomRealVertexListAddRange(this.handle,t)||n.NativeBase.throwLastError(!1),!0)}set(t,i){if("object"!=typeof i)throw new e.ArgumentError("Argument 'element' must be of type PdfViewing.Pdf.Geometry.Real.Vertex and must not be null or undefined.");Module.ViewingPdfGeomRealVertexListSet(this.handle,t,i)||n.NativeBase.throwLastError(!1)}clear(){Module.ViewingPdfGeomRealVertexListClear(this.handle)||n.NativeBase.throwLastError(!1)}get(t){let i=Module.ViewingPdfGeomRealVertexListGet(this.handle,t);return null===i&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.Vertex(i.pageNumber,i.x,i.y,i.operator)}getRange(e,t){let i=Module.ViewingPdfGeomRealVertexListGetRange(this.handle,e,t);return 0==i&&n.NativeBase.throwLastError(!1),g.createDynamicObject(i)}get size(){let e=Module.ViewingPdfGeomRealVertexListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.VertexList=g}(o=t.Real||(t.Real={})),function(t){class i extends n.NativeBase{constructor(t,n){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'width' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'height' must be of type number and must not be null or undefined.");this.width=t,this.height=n}equals(e){return null!==e&&this.width===e.width&&this.height===e.height}}t.Size=i;class o extends n.NativeBase{constructor(t,n){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'x' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'y' must be of type number and must not be null or undefined.");this.x=t,this.y=n}equals(e){return null!==e&&this.x===e.x&&this.y===e.y}}t.ScrollPosition=o;class s extends n.NativeBase{constructor(t,n){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'x' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'y' must be of type number and must not be null or undefined.");this.x=t,this.y=n}equals(e){return null!==e&&this.x===e.x&&this.y===e.y}}t.Point=s;class a extends n.NativeBase{constructor(t,n,i,o){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'x' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'y' must be of type number and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'width' must be of type number and must not be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'height' must be of type number and must not be null or undefined.");this.x=t,this.y=n,this.width=i,this.height=o}equals(e){return null!==e&&this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height}}t.Rectangle=a;class r extends n.NativeBase{constructor(t,n,i,o){if(super(),"number"!=typeof t)throw new e.ArgumentError("Argument 'left' must be of type number and must not be null or undefined.");if("number"!=typeof n)throw new e.ArgumentError("Argument 'right' must be of type number and must not be null or undefined.");if("number"!=typeof i)throw new e.ArgumentError("Argument 'top' must be of type number and must not be null or undefined.");if("number"!=typeof o)throw new e.ArgumentError("Argument 'bottom' must be of type number and must not be null or undefined.");this.left=t,this.right=n,this.top=i,this.bottom=o}equals(e){return null!==e&&this.left===e.left&&this.right===e.right&&this.top===e.top&&this.bottom===e.bottom}}t.Padding=r}(s=t.Integer||(t.Integer={}))}(l=t.Geometry||(t.Geometry={})),function(t){let i;!function(e){e[e.Invalid=0]="Invalid"}(i=t.Byteorder||(t.Byteorder={}));class o extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new o(e)}close(){Module.ViewingPdfContentTextFragmentListClose(this.handle)||n.NativeBase.throwLastError()}remove(e){throw new Error("Method not implemented.")}add(e){throw new Error("Method not implemented.")}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(t){let i=Module.ViewingPdfContentTextFragmentListGet(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.Pdf.Content.TextFragment.createDynamicObject(i)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingPdfContentTextFragmentListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.TextFragmentList=o;class s extends n.NativeObject{constructor(e){super(e),this.eventListeners=new Map}addEventListener(t,i){if("function"!=typeof i)throw new e.ArgumentError("Argument 'listener' must be a function.");var o;if(this.eventListeners.has(t)){if(!this.eventListeners.get(t).has(i)&&"matchChanged"===t){o=new r(i);let e=Module.ViewingPdfContentTextSearchIteratorAddMatchChangedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e,this.eventListeners.get(t).set(i,o)}if(!this.eventListeners.get(t).has(i)&&"totalMatchesChanged"===t){o=new l(i);let e=Module.ViewingPdfContentTextSearchIteratorAddTotalMatchesChangedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e,this.eventListeners.get(t).set(i,o)}}else{if("matchChanged"===t){o=new r(i);let e=Module.ViewingPdfContentTextSearchIteratorAddMatchChangedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e;let s=new Map;s.set(i,o),this.eventListeners.set(t,s)}if("totalMatchesChanged"===t){o=new l(i);let e=Module.ViewingPdfContentTextSearchIteratorAddTotalMatchesChangedHandler(this.handle,o);0==e?n.NativeBase.throwLastError():o.context=e;let s=new Map;s.set(i,o),this.eventListeners.set(t,s)}}}removeEventListener(e,t){if(this.eventListeners.has(e)){if("matchChanged"===e){let i=this.eventListeners.get(e);if(i.has(t)){let e=i.get(t);try{Module.ViewingPdfContentTextSearchIteratorRemoveMatchChangedHandler(this.handle,null==e?void 0:e.context)||n.NativeBase.throwLastError()}catch(e){if(e instanceof A)throw e}i.delete(t),0===i.size&&this.eventListeners.delete("matchChanged")}}if("totalMatchesChanged"===e){let i=this.eventListeners.get(e);if(i.has(t)){let e=i.get(t);try{Module.ViewingPdfContentTextSearchIteratorRemoveTotalMatchesChangedHandler(this.handle,null==e?void 0:e.context)||n.NativeBase.throwLastError()}catch(e){if(e instanceof A)throw e}i.delete(t),0===i.size&&this.eventListeners.delete("totalMatchesChanged")}}}}static createDynamicObject(e){return new s(e)}close(){Module.ViewingPdfContentTextSearchIteratorClose(this.handle)||n.NativeBase.throwLastError()}getNext(){var e=this;return new Promise((function(t,n){Module.ViewingPdfContentTextSearchIteratorGetNext(e.handle,{thisHandle:e,resolved:t,rejected:n})||n(Module.ViewingGetLastErrorMessage())}))}getNextCallback(e,t,i,o){let s=null;t||(s=n.NativeBase.createLastError(i,o)),null===s?e.resolved(t):e.rejected(s)}getPrevious(){var e=this;return new Promise((function(t,n){Module.ViewingPdfContentTextSearchIteratorGetPrevious(e.handle,{thisHandle:e,resolved:t,rejected:n})||n(Module.ViewingGetLastErrorMessage())}))}getPreviousCallback(e,t,i,o){let s=null;t||(s=n.NativeBase.createLastError(i,o)),null===s?e.resolved(t):e.rejected(s)}loadAllMatches(){var e=this;return new Promise((function(t,n){Module.ViewingPdfContentTextSearchIteratorLoadAllMatches(e.handle,{thisHandle:e,resolved:t,rejected:n})||n(Module.ViewingGetLastErrorMessage())}))}loadAllMatchesCallback(e,t,i,o){let s=null;t||(s=n.NativeBase.createLastError(i,o,!1)),null===s?e.resolved():e.rejected(s)}get match(){let t=Module.ViewingPdfContentTextSearchIteratorGetMatch(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Content.Selection.createDynamicObject(t)}get matchIndex(){let e=Module.ViewingPdfContentTextSearchIteratorGetMatchIndex(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get totalMatches(){let e=Module.ViewingPdfContentTextSearchIteratorGetTotalMatches(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get wrapping(){let e=Module.ViewingPdfContentTextSearchIteratorGetWrapping(this.handle);return e||n.NativeBase.throwLastError(),e}set wrapping(t){if("boolean"!=typeof t)throw new e.ArgumentError("Argument 'wrapping' must be of type boolean and must not be null or undefined.");Module.ViewingPdfContentTextSearchIteratorSetWrapping(this.handle,t)||n.NativeBase.throwLastError(!1)}}t.TextSearchIterator=s;class a{constructor(e){this.listener=e}}class r extends a{constructor(e){super(e)}dispatchEventMatchChanged(t){this.listener(e.Pdf.Content.TextSelection.createDynamicObject(t))}}class l extends a{constructor(e){super(e)}dispatchEventTotalMatchesChanged(){this.listener(void 0)}}class d extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfContentImageGetType(t)){case 0:default:return new d(t);case 1:return e.Pdf.Content.PlacedImage.createDynamicObject(t)}}close(){Module.ViewingPdfContentImageClose(this.handle)||n.NativeBase.throwLastError()}removeImageData(){Module.ViewingPdfContentImageRemoveImageData(this.handle)||n.NativeBase.throwLastError(!1)}get hasImageData(){let e=Module.ViewingPdfContentImageGetHasImageData(this.handle);return e||n.NativeBase.throwLastError(),e}get id(){let e=Module.ViewingPdfContentImageGetId(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get width(){let e=Module.ViewingPdfContentImageGetWidth(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get height(){let e=Module.ViewingPdfContentImageGetHeight(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get bytePerPixel(){let e=Module.ViewingPdfContentImageGetBytePerPixel(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}get samples(){let e=Module.ViewingPdfContentImageGetSamples(this.handle);return null===e&&n.NativeBase.throwLastError(!1),new Uint8Array(e)}get bufferView(){let e=Module.ViewingPdfContentImageGetBufferView(this.handle);return null===e&&n.NativeBase.throwLastError(),e}}t.Image=d;class h extends e.Pdf.Content.Image{constructor(e){super(e)}static createDynamicObject(e){return new h(e)}get imageRectangle(){let t=Module.ViewingPdfContentPlacedImageGetImageRectangle(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.Rectangle(t.x,t.y,t.width,t.height)}}t.PlacedImage=h;class c extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new c(e)}close(){Module.ViewingPdfContentTextFragmentClose(this.handle)||n.NativeBase.throwLastError()}get rectangleOnPage(){let t=Module.ViewingPdfContentTextFragmentGetRectangleOnPage(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.RectangleOnPage(t.pageNumber,t.x,t.y,t.width,t.height)}get textArea(){let t=Module.ViewingPdfContentTextFragmentGetTextArea(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.QuadrilateralOnPage(t.pageNumber,t.bottomLeft,t.bottomRight,t.topRight,t.topLeft)}get text(){let e=Module.ViewingPdfContentTextFragmentGetText(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}get glyphOffsets(){let e=Module.ViewingPdfContentTextFragmentGetGlyphOffsets(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}}t.TextFragment=c;class u extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfContentSelectionGetType(t)){case 0:default:return new u(t);case 1:return e.Pdf.Content.TextSelection.createDynamicObject(t)}}close(){Module.ViewingPdfContentSelectionClose(this.handle)||n.NativeBase.throwLastError()}get text(){let e=Module.ViewingPdfContentSelectionGetText(this.handle);return null===e&&n.NativeBase.throwLastError(),e}}t.Selection=u;class p extends e.Pdf.Content.Selection{constructor(e){super(e)}static createDynamicObject(e){return new p(e)}get textArea(){let t=Module.ViewingPdfContentTextSelectionGetTextArea(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Geometry.Real.QuadrilateralList.createDynamicObject(t)}}t.TextSelection=p;class g extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new g(e)}close(){Module.ViewingPdfContentBinaryBufferClose(this.handle)||n.NativeBase.throwLastError()}get bufferData(){let e=Module.ViewingPdfContentBinaryBufferGetBufferData(this.handle);return null===e&&n.NativeBase.throwLastError(!1),new Uint8Array(e)}get bufferView(){let e=Module.ViewingPdfContentBinaryBufferGetBufferView(this.handle);return null===e&&n.NativeBase.throwLastError(),e}}t.BinaryBuffer=g;class m extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new m(e)}close(){Module.ViewingPdfContentRenderedPageClose(this.handle)||n.NativeBase.throwLastError()}get pageRect(){let t=Module.ViewingPdfContentRenderedPageGetPageRect(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Integer.Rectangle(t.x,t.y,t.width,t.height)}get image(){let t=Module.ViewingPdfContentRenderedPageGetImage(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Content.PlacedImage.createDynamicObject(t):null}get pageNumber(){let e=Module.ViewingPdfContentRenderedPageGetPageNumber(this.handle);return 0===e&&n.NativeBase.throwLastError(),e}}t.RenderedPage=m;class f extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new f(e)}close(){Module.ViewingPdfContentRenderedPageListClose(this.handle)||n.NativeBase.throwLastError()}remove(e){throw new Error("Method not implemented.")}add(e){throw new Error("Method not implemented.")}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(t){let i=Module.ViewingPdfContentRenderedPageListGet(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.Pdf.Content.RenderedPage.createDynamicObject(i)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingPdfContentRenderedPageListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.RenderedPageList=f;class v extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new v(e)}close(){Module.ViewingPdfContentRenderResultsClose(this.handle)||n.NativeBase.throwLastError()}get visiblePages(){let t=Module.ViewingPdfContentRenderResultsGetVisiblePages(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Content.RenderedPageList.createDynamicObject(t)}}t.RenderResults=v}(d=t.Content||(t.Content={})),function(t){let i,o;!function(e){e[e.None=0]="None",e[e.FitWidth=1]="FitWidth",e[e.FitPage=2]="FitPage"}(i=t.FitMode||(t.FitMode={})),function(e){e[e.SinglePage=0]="SinglePage",e[e.OneColumn=1]="OneColumn",e[e.TwoColumnLeft=2]="TwoColumnLeft",e[e.TwoColumnRight=3]="TwoColumnRight",e[e.TwoPageLeft=4]="TwoPageLeft",e[e.TwoPageRight=5]="TwoPageRight"}(o=t.PageLayoutMode||(t.PageLayoutMode={}));class s extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new s(e)}close(){Module.ViewingPdfNavOutlineItemListClose(this.handle)||n.NativeBase.throwLastError()}remove(e){throw new Error("Method not implemented.")}add(e){throw new Error("Method not implemented.")}addRange(e){throw new Error("Method not implemented.")}set(e,t){throw new Error("Method not implemented.")}clear(){throw new Error("Method not implemented.")}get(t){let i=Module.ViewingPdfNavOutlineItemListGet(this.handle,t);return 0===i&&n.NativeBase.throwLastError(!1),e.Pdf.Navigation.OutlineItem.createDynamicObject(i)}getRange(e,t){throw new Error("Method not implemented.")}get size(){let e=Module.ViewingPdfNavOutlineItemListGetCount(this.handle);return-1===e&&n.NativeBase.throwLastError(!1),e}[Symbol.iterator](){return new L(this)}}t.OutlineItemList=s;class a extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfNavDestinationGetType(t)){case 0:default:return new a(t);case 1:return e.Pdf.Navigation.NamedDestination.createDynamicObject(t);case 2:return e.Pdf.Navigation.DirectDestination.createDynamicObject(t);case 3:return e.Pdf.Navigation.LocationZoomDestination.createDynamicObject(t);case 4:return e.Pdf.Navigation.FitPageDestination.createDynamicObject(t);case 5:return e.Pdf.Navigation.FitWidthDestination.createDynamicObject(t);case 6:return e.Pdf.Navigation.FitHeightDestination.createDynamicObject(t);case 7:return e.Pdf.Navigation.FitRectangleDestination.createDynamicObject(t)}}close(){Module.ViewingPdfNavDestinationClose(this.handle)||n.NativeBase.throwLastError()}get target(){let t=Module.ViewingPdfNavDestinationGetTarget(this.handle);return 0===t&&n.NativeBase.throwLastError(!1),e.Pdf.Navigation.DirectDestination.createDynamicObject(t)}}t.Destination=a;class r extends e.Pdf.Navigation.Destination{constructor(e){super(e)}static createDynamicObject(e){return new r(e)}get name(){let e=Module.ViewingPdfNavNamedDestinationGetName(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}}t.NamedDestination=r;class l extends e.Pdf.Navigation.Destination{constructor(e){super(e)}static createDynamicObject(t){switch(Module.ViewingPdfNavDirectDestinationGetType(t)){case 0:default:return new l(t);case 1:return e.Pdf.Navigation.LocationZoomDestination.createDynamicObject(t);case 2:return e.Pdf.Navigation.FitPageDestination.createDynamicObject(t);case 3:return e.Pdf.Navigation.FitWidthDestination.createDynamicObject(t);case 4:return e.Pdf.Navigation.FitHeightDestination.createDynamicObject(t);case 5:return e.Pdf.Navigation.FitRectangleDestination.createDynamicObject(t)}}get pageNumber(){let e=Module.ViewingPdfNavDirectDestinationGetPageNumber(this.handle);return-1===e&&n.NativeBase.throwLastError(),e}}t.DirectDestination=l;class d extends e.Pdf.Navigation.DirectDestination{constructor(t,i,o,s){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if(null!=i&&"number"!=typeof i)throw new e.ArgumentError("Argument 'left' must be of type number or can be null or undefined.");if(null!=o&&"number"!=typeof o)throw new e.ArgumentError("Argument 'top' must be of type number or can be null or undefined.");if(null!=s&&"number"!=typeof s)throw new e.ArgumentError("Argument 'zoom' must be of type number or can be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewLocationZoomDestination(t,i,o,s)))}}static createDynamicObject(e){return new d({__handle:e})}get left(){let e=Module.ViewingPdfNavLocationZoomDestinationGetLeft(this.handle);return null===e&&n.NativeBase.throwLastError(),e}get top(){let e=Module.ViewingPdfNavLocationZoomDestinationGetTop(this.handle);return null===e&&n.NativeBase.throwLastError(),e}get zoom(){let e=Module.ViewingPdfNavLocationZoomDestinationGetZoom(this.handle);return null===e&&n.NativeBase.throwLastError(),e}}t.LocationZoomDestination=d;class h extends e.Pdf.Navigation.DirectDestination{constructor(t,i){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if("boolean"!=typeof i)throw new e.ArgumentError("Argument 'fitActualContent' must be of type boolean and must not be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewFitPageDestination(t,i)))}}static createDynamicObject(e){return new h({__handle:e})}get fitActualContent(){let e=Module.ViewingPdfNavFitPageDestinationGetFitActualContent(this.handle);return e||n.NativeBase.throwLastError(),e}}t.FitPageDestination=h;class c extends e.Pdf.Navigation.DirectDestination{constructor(t,i,o){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if(null!=i&&"number"!=typeof i)throw new e.ArgumentError("Argument 'top' must be of type number or can be null or undefined.");if("boolean"!=typeof o)throw new e.ArgumentError("Argument 'fitActualContent' must be of type boolean and must not be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewFitWidthDestination(t,i,o)))}}static createDynamicObject(e){return new c({__handle:e})}get fitActualContent(){let e=Module.ViewingPdfNavFitWidthDestinationGetFitActualContent(this.handle);return e||n.NativeBase.throwLastError(),e}get top(){let e=Module.ViewingPdfNavFitWidthDestinationGetTop(this.handle);return null===e&&n.NativeBase.throwLastError(),e}}t.FitWidthDestination=c;class u extends e.Pdf.Navigation.DirectDestination{constructor(t,i,o){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if("number"!=typeof t)throw new e.ArgumentError("Argument 'pageNumber' must be of type number and must not be null or undefined.");if(null!=i&&"number"!=typeof i)throw new e.ArgumentError("Argument 'left' must be of type number or can be null or undefined.");if("boolean"!=typeof o)throw new e.ArgumentError("Argument 'fitActualContent' must be of type boolean and must not be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewFitHeightDestination(t,i,o)))}}static createDynamicObject(e){return new u({__handle:e})}get fitActualContent(){let e=Module.ViewingPdfNavFitHeightDestinationGetFitActualContent(this.handle);return e||n.NativeBase.throwLastError(),e}get left(){let e=Module.ViewingPdfNavFitHeightDestinationGetLeft(this.handle);return null===e&&n.NativeBase.throwLastError(),e}}t.FitHeightDestination=u;class p extends e.Pdf.Navigation.DirectDestination{constructor(t){if(arguments[0]&&"number"==typeof arguments[0].__handle)super(arguments[0].__handle);else{if("object"!=typeof t)throw new e.ArgumentError("Argument 'rectangleOnPage' must be of type PdfViewing.Pdf.Geometry.Real.RectangleOnPage and must not be null or undefined.");super(n.NativeObject.checkReturnHandleErrorCode(Module.ViewingPdfNavNewFitRectangleDestination(t)))}}static createDynamicObject(e){return new p({__handle:e})}get rectangle(){let t=Module.ViewingPdfNavFitRectangleDestinationGetRectangle(this.handle);return null===t&&n.NativeBase.throwLastError(!1),new e.Pdf.Geometry.Real.RectangleOnPage(t.pageNumber,t.x,t.y,t.width,t.height)}}t.FitRectangleDestination=p;class g extends n.NativeObject{constructor(e){super(e)}static createDynamicObject(e){return new g(e)}close(){Module.ViewingPdfNavOutlineItemClose(this.handle)||n.NativeBase.throwLastError()}get title(){let e=Module.ViewingPdfNavOutlineItemGetTitle(this.handle);return null===e&&n.NativeBase.throwLastError(!1),e}get bold(){let e=Module.ViewingPdfNavOutlineItemGetBold(this.handle);return e||n.NativeBase.throwLastError(),e}get italic(){let e=Module.ViewingPdfNavOutlineItemGetItalic(this.handle);return e||n.NativeBase.throwLastError(),e}get destination(){let t=Module.ViewingPdfNavOutlineItemGetDestination(this.handle);return 0===t&&n.NativeBase.throwLastError(),0!==t?e.Pdf.Navigation.Destination.createDynamicObject(t):null}get isOpen(){let e=Module.ViewingPdfNavOutlineItemGetIsOpen(this.handle);return e||n.NativeBase.throwLastError(),e}get hasChildren(){let e=Module.ViewingPdfNavOutlineItemGetHasChildren(this.handle);return e||n.NativeBase.throwLastError(),e}}t.OutlineItem=g}(h=t.Navigation||(t.Navigation={}))}(s=e.Pdf||(e.Pdf={})),e.GenericError=class extends r{constructor(e){super(e)}},e.FatalError=class extends r{constructor(e){super(e)}},e.LicenseError=class extends r{constructor(e){super(e)}},e.UnknownFormatError=class extends r{constructor(e){super(e)}},e.CorruptError=class extends r{constructor(e){super(e)}},e.PasswordError=class extends r{constructor(e){super(e)}},e.ConformanceError=class extends r{constructor(e){super(e)}},e.UnsupportedFeatureError=class extends r{constructor(e){super(e)}},e.InfrastructureError=class extends r{constructor(e){super(e)}},e.ProcessingError=class extends r{constructor(e){super(e)}},e.ExistsError=class extends r{constructor(e){super(e)}},e.UpdateFailedError=class extends r{constructor(e){super(e)}},e.NotSupportedError=class extends r{constructor(e){super(e)}},e.InvalidOperationError=class extends r{constructor(e){super(e)}},e.ArgumentError=class extends r{constructor(e){super(e)}};class A extends r{constructor(e){super(e)}}e.NotFoundError=A;class E extends r{constructor(e){super(e)}}e.IOError=E,function(e){e.StreamObject=class{constructor(){this._parameter=new Uint8Array(0),this.currPos=0}get parameter(){return this._parameter}set parameter(e){if(e instanceof Blob)this._parameter=new Uint8Array((new FileReaderSync).readAsArrayBuffer(e));else{if(!(e instanceof Uint8Array))throw new TypeError("Not allowed type for parameter in StreamObject. Allowed types are Uint8Array and Blob.");this._parameter=e}}getLength(){return this._parameter.byteLength}seek(e){return!(e>this.getLength()||(this.currPos=-1===e?this.getLength():e,0))}tell(){return this.currPos}read(e,t){if(0!==(t=Math.min(t,this._parameter.byteLength-this.currPos))){let n=new Uint8Array(Module.HEAP8.buffer,e,t);return n.set(this._parameter.subarray(this.currPos,this.currPos+t)),this.currPos=this.currPos+t,n.length}return 0}write(e,t){let n=this.currPos+t;if(n>this._parameter.byteLength){if(n>this._parameter.buffer.byteLength-this._parameter.byteOffset){if(n>Number.MAX_SAFE_INTEGER)throw new E("Reached maximum array size.");let e=8096;for(;e<n;)e*=2;e=Math.min(e,Number.MAX_SAFE_INTEGER);let t=new Uint8Array(new ArrayBuffer(e));t.set(this._parameter),this._parameter=t}this._parameter=new Uint8Array(this._parameter.buffer,this._parameter.byteOffset,n)}let i=new Uint8Array(Module.HEAP8.buffer,e,t);return this._parameter.subarray(this.currPos,this.currPos+t).set(i),this.currPos=this.currPos+t,t}}}(a=e.Sys||(e.Sys={}));class L{constructor(e){this.index=0,this.list=e}next(){if(this.index===this.list.size)return{done:!0,value:null};let e=this.list.get(this.index);return this.index++,{done:null===e,value:e}}}class S{constructor(e){this.callback=e}annotationFilter(t){try{let n=this.callback(e.Pdf.Annotations.Annotation.createDynamicObject(t));return Module.ViewingSetLastError(0,null),n}catch(t){return t instanceof Error&&function(t){t instanceof e.GenericError?Module.ViewingSetLastError(10,t.message):t instanceof e.FatalError?Module.ViewingSetLastError(11,t.message):t instanceof e.LicenseError?Module.ViewingSetLastError(12,t.message):t instanceof e.UnknownFormatError?Module.ViewingSetLastError(15,t.message):t instanceof e.CorruptError?Module.ViewingSetLastError(16,t.message):t instanceof e.PasswordError?Module.ViewingSetLastError(17,t.message):t instanceof e.ConformanceError?Module.ViewingSetLastError(18,t.message):t instanceof e.UnsupportedFeatureError?Module.ViewingSetLastError(19,t.message):t instanceof e.InfrastructureError?Module.ViewingSetLastError(20,t.message):t instanceof e.ProcessingError?Module.ViewingSetLastError(21,t.message):t instanceof e.ExistsError?Module.ViewingSetLastError(22,t.message):t instanceof e.UpdateFailedError?Module.ViewingSetLastError(23,t.message):t instanceof e.NotSupportedError?Module.ViewingSetLastError(1,t.message):t instanceof e.InvalidOperationError?Module.ViewingSetLastError(2,t.message):t instanceof e.ArgumentError?Module.ViewingSetLastError(3,t.message):t instanceof e.NotFoundError?Module.ViewingSetLastError(5,t.message):t instanceof e.IOError?Module.ViewingSetLastError(4,t.message):Module.ViewingSetLastError(6,t.message)}(t),!1}}}}(e||(e={}));const s=(...e)=>{const t=[];return e.forEach((e=>{"string"==typeof e?t.push(e):"object"==typeof e&&Object.keys(e).forEach((n=>{e[n]&&t.push(n)}))})),t.join(" ")};var a,r;!function(e){e[e.Mobile=0]="Mobile",e[e.Desktop=1]="Desktop"}(a||(a={})),function(e){e[e.Small=600]="Small",e[e.Medium=900]="Medium",e[e.Large=1200]="Large"}(r||(r={}));const l={screenSize:r.Medium,deviceType:a.Desktop},d={setScreenSize:e=>t=>Object.assign(Object.assign({},t),{screenSize:e}),setDeviceType:e=>t=>Object.assign(Object.assign({},t),{deviceType:e})},h=({className:e,dense:t,allowWrap:n,alignCenter:o},a)=>i("div",{class:s("pwv-Toolbar",{"pwv-Toolbar--center":o},{"pwv-Toolbar--dense":t},{"pwv-Toolbar--wrap":n},e)},a),c=({})=>i("div",{class:"pwv-ToolbarSeparator"},i("span",null));let u={},p=!1;const g={language:"",addTranslations:e=>{u=Object.assign(Object.assign({},u),e)},getText:e=>{const t=u[e];if(!t){switch(e){case"applicationError.title":return"Error";case"applicationError.defaultMessage":return"Configuration Error";case"applicationError.reload":return""}return console.warn(`key not found ${e}`),e}return t},loadTranslations:e=>{return t=void 0,n=void 0,o=function*(){if(e!==g.language||!p&&0===Object.keys(u).length){g.language=e,p=!0;const t=window.Module.locateFile(`translations.${e}.json`);try{const e=yield fetch(t);if(!e.ok)throw new Error(`failed to load translation file '${t}`);u=yield e.json()}catch(t){console.error(`**************************************\nFailed to load translations.${e}.js\n\n%cThe PDF Web Viewer failed to load a required script resource. Either the "Base URL" (PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL) is not configured correctly or the static assets have not been copied to the configured location. For more information please consult the documentation.\n\n%cwindow.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL=${window.PDFTOOLS_FOURHEIGHTS_PDFVIEWING_BASEURL}\n%c**************************************`,"color: orange","color: gray","color: red")}}},new((i=void 0)||(i=Promise))((function(e,s){function a(e){try{l(o.next(e))}catch(e){s(e)}}function r(e){try{l(o.throw(e))}catch(e){s(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,r)}l((o=o.apply(t,n||[])).next())}));var t,n,i,o}},m=({className:e,pushRight:t},n)=>i("div",{class:s("pwv-ToolbarItemGroup",e,{"pwv-ToolbarItemGroup--pushRight":t}),oncreate:e=>{t&&e.parentNode.classList.add("pwv-Toolbar--paddingRight")}},n),f={openFile:{width:576,height:512,path:"M527.95 224H480v-48c0-26.51-21.49-48-48-48H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h385.057c28.068 0 54.135-14.733 68.599-38.84l67.453-112.464C588.24 264.812 565.285 224 527.95 224zM48 96h146.745l64 64H432c8.837 0 16 7.163 16 16v48H171.177c-28.068 0-54.135 14.733-68.599 38.84L32 380.47V112c0-8.837 7.163-16 16-16zm493.695 184.232l-67.479 112.464A47.997 47.997 0 0 1 433.057 416H44.823l82.017-136.696A48 48 0 0 1 168 256h359.975c12.437 0 20.119 13.568 13.72 24.232z"},saveFile:{width:448,height:512,path:"M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM288 64v96H96V64h192zm128 368c0 8.822-7.178 16-16 16H48c-8.822 0-16-7.178-16-16V80c0-8.822 7.178-16 16-16h16v104c0 13.255 10.745 24 24 24h208c13.255 0 24-10.745 24-24V64.491a15.888 15.888 0 0 1 7.432 4.195l83.882 83.882A15.895 15.895 0 0 1 416 163.882V432zM224 232c-48.523 0-88 39.477-88 88s39.477 88 88 88 88-39.477 88-88-39.477-88-88-88zm0 144c-30.879 0-56-25.121-56-56s25.121-56 56-56 56 25.121 56 56-25.121 56-56 56z"},print:{width:512,height:512,path:"M432 192h-16v-82.75c0-8.49-3.37-16.62-9.37-22.63L329.37 9.37c-6-6-14.14-9.37-22.63-9.37H126.48C109.64 0 96 14.33 96 32v160H80c-44.18 0-80 35.82-80 80v96c0 8.84 7.16 16 16 16h80v112c0 8.84 7.16 16 16 16h288c8.84 0 16-7.16 16-16V384h80c8.84 0 16-7.16 16-16v-96c0-44.18-35.82-80-80-80zM320 45.25L370.75 96H320V45.25zM128.12 32H288v64c0 17.67 14.33 32 32 32h64v64H128.02l.1-160zM384 480H128v-96h256v96zm96-128H32v-80c0-26.47 21.53-48 48-48h352c26.47 0 48 21.53 48 48v80zm-80-88c-13.25 0-24 10.74-24 24 0 13.25 10.75 24 24 24s24-10.75 24-24c0-13.26-10.75-24-24-24z"},docNavigation:{width:512,height:512,path:"M464 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h416c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm16 400c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V192h448v240zM32 160V80c0-8.8 7.2-16 16-16h416c8.8 0 16 7.2 16 16v80H32z"},nextPage:{width:448,height:512,path:"M216.464 36.465l-7.071 7.07c-4.686 4.686-4.686 12.284 0 16.971L387.887 239H12c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h375.887L209.393 451.494c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l211.051-211.05c4.686-4.686 4.686-12.284 0-16.971L233.434 36.465c-4.686-4.687-12.284-4.687-16.97 0z"},previousPage:{width:448,height:512,path:"M231.536 475.535l7.071-7.07c4.686-4.686 4.686-12.284 0-16.971L60.113 273H436c6.627 0 12-5.373 12-12v-10c0-6.627-5.373-12-12-12H60.113L238.607 60.506c4.686-4.686 4.686-12.284 0-16.971l-7.071-7.07c-4.686-4.686-12.284-4.686-16.97 0L3.515 247.515c-4.686 4.686-4.686 12.284 0 16.971l211.051 211.05c4.686 4.686 12.284 4.686 16.97-.001z"},zoomIn:{width:512,height:512,path:"M384 250v12c0 6.6-5.4 12-12 12h-98v98c0 6.6-5.4 12-12 12h-12c-6.6 0-12-5.4-12-12v-98h-98c-6.6 0-12-5.4-12-12v-12c0-6.6 5.4-12 12-12h98v-98c0-6.6 5.4-12 12-12h12c6.6 0 12 5.4 12 12v98h98c6.6 0 12 5.4 12 12zm120 6c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-32 0c0-119.9-97.3-216-216-216-119.9 0-216 97.3-216 216 0 119.9 97.3 216 216 216 119.9 0 216-97.3 216-216z"},zoomOut:{width:512,height:512,path:"M140 274c-6.6 0-12-5.4-12-12v-12c0-6.6 5.4-12 12-12h232c6.6 0 12 5.4 12 12v12c0 6.6-5.4 12-12 12H140zm364-18c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-32 0c0-119.9-97.3-216-216-216-119.9 0-216 97.3-216 216 0 119.9 97.3 216 216 216 119.9 0 216-97.3 216-216z"},search:{width:512,height:512,path:"M508.5 481.6l-129-129c-2.3-2.3-5.3-3.5-8.5-3.5h-10.3C395 312 416 262.5 416 208 416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c54.5 0 104-21 141.1-55.2V371c0 3.2 1.3 6.2 3.5 8.5l129 129c4.7 4.7 12.3 4.7 17 0l9.9-9.9c4.7-4.7 4.7-12.3 0-17zM208 384c-97.3 0-176-78.7-176-176S110.7 32 208 32s176 78.7 176 176-78.7 176-176 176z"},fitActualSize:{width:448,height:512,path:"M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v8c0 6.6-5.4 12-12 12H32v116c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12zM300 32h124c13.3 0 24 10.7 24 24v124c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12V64H300c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12zm148 300v124c0 13.3-10.7 24-24 24H300c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h116V332c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12zM148 480H24c-13.3 0-24-10.7-24-24V332c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v116h116c6.6 0 12 5.4 12 12v8c0 6.6-5.4 12-12 12z"},fitWidth:{width:512,height:512,path:"M399.959 170.585c-4.686 4.686-4.686 12.284 0 16.971L451.887 239H60.113l51.928-51.444c4.686-4.686 4.686-12.284 0-16.971l-7.071-7.07c-4.686-4.686-12.284-4.686-16.97 0l-84.485 84c-4.686 4.686-4.686 12.284 0 16.971l84.485 84c4.686 4.686 12.284 4.686 16.97 0l7.071-7.07c4.686-4.686 4.686-12.284 0-16.971L60.113 273h391.773l-51.928 51.444c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l84.485-84c4.687-4.686 4.687-12.284 0-16.971l-84.485-84c-4.686-4.686-12.284-4.686-16.97 0l-7.07 7.071z"},fitPage:{width:512,height:512,path:"M337.782 434.704l-73.297 73.782c-4.686 4.686-12.284 4.686-16.971 0l-73.296-73.782c-4.686-4.686-4.686-12.284 0-16.97l7.07-7.07c4.686-4.686 12.284-4.686 16.971 0L239 451.887h1V272H60.113v1l41.224 40.741c4.686 4.686 4.686 12.284 0 16.971l-7.071 7.07c-4.686 4.686-12.284 4.686-16.97 0L3.515 264.485c-4.686-4.686-4.686-12.284 0-16.971l73.782-73.297c4.686-4.686 12.284-4.686 16.971 0l7.071 7.071c4.686 4.686 4.686 12.284 0 16.971L60.113 239v1H240V60.113h-1l-40.741 41.224c-4.686 4.686-12.284 4.686-16.971 0l-7.07-7.071c-4.686-4.686-4.687-12.284 0-16.97l73.297-73.782c4.686-4.686 12.284-4.686 16.971 0l73.297 73.782c4.686 4.686 4.686 12.284 0 16.971l-7.071 7.071c-4.686 4.686-12.284 4.686-16.971 0L273 60.113h-1V240h179.887v-1l-41.224-40.741c-4.686-4.686-4.686-12.284 0-16.971l7.071-7.07c4.686-4.686 12.284-4.686 16.97 0l73.782 73.297c4.687 4.686 4.686 12.284 0 16.971l-73.782 73.297c-4.686 4.686-12.284 4.686-16.97 0l-7.071-7.07c-4.686-4.686-4.686-12.284 0-16.971L451.887 273v-1H272v179.887h1l40.741-41.224c4.686-4.686 12.284-4.686 16.971 0l7.07 7.071c4.686 4.685 4.686 12.283 0 16.97z"},edit:{width:576,height:512,path:"M417.8 315.5l20-20c3.8-3.8 10.2-1.1 10.2 4.2V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h292.3c5.3 0 8 6.5 4.2 10.2l-20 20c-1.1 1.1-2.7 1.8-4.2 1.8H48c-8.8 0-16 7.2-16 16v352c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16V319.7c0-1.6.6-3.1 1.8-4.2zm145.9-191.2L251.2 436.8l-99.9 11.1c-13.4 1.5-24.7-9.8-23.2-23.2l11.1-99.9L451.7 12.3c16.4-16.4 43-16.4 59.4 0l52.6 52.6c16.4 16.4 16.4 43 0 59.4zm-93.6 48.4L403.4 106 169.8 339.5l-8.3 75.1 75.1-8.3 233.5-233.6zm71-85.2l-52.6-52.6c-3.8-3.8-10.2-4-14.1 0L426 83.3l66.7 66.7 48.4-48.4c3.9-3.8 3.9-10.2 0-14.1z"},stickyNote:{width:512,height:512,path:"M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm32 352c0 17.6-14.4 32-32 32H293.3l-8.5 6.4L192 460v-76H64c-17.6 0-32-14.4-32-32V64c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v288zM280 240H136c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h144c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8zm96-96H136c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h240c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8z",bg:"M 448,0 H 64 C 28.7,0 0,28.7 0,64 v 288 c 0,35.3 28.7,64 64,64 h 96 v 84 c 0,7.1 5.8,12 12,12 2.4,0 4.9,-0.7 7.1,-2.4 L 304,416 h 144 c 35.3,0 64,-28.7 64,-64 V 64 C 512,28.7 483.3,0 448,0 Z"},stickyNoteAdd:{width:512,height:512,path:"M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm32 352c0 17.6-14.4 32-32 32H293.3l-8.5 6.4L192 460v-76H64c-17.6 0-32-14.4-32-32V64c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v288zM344 192h-72v-72c0-4.4-3.6-8-8-8h-16c-4.4 0-8 3.6-8 8v72h-72c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h72v72c0 4.4 3.6 8 8 8h16c4.4 0 8-3.6 8-8v-72h72c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8z"},stickyNoteEdit:{width:512,height:512,path:"M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm32 352c0 17.6-14.4 32-32 32H293.3l-8.5 6.4L192 460v-76H64c-17.6 0-32-14.4-32-32V64c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v288zM336 105.4c-12.5-12.5-32.8-12.5-45.2 0l-126.1 126c-2 2-3.4 4.5-4.2 7.3l-16 61.2c-1.4 5.5.1 11.3 4.2 15.4 3 3 7.1 4.7 11.3 4.7 1.3 0 2.7-.2 4-.5l61.2-16c2.8-.7 5.3-2.2 7.3-4.2l126.1-126.1c12.5-12.5 12.5-32.8 0-45.2L336 105.4zM213 273.6l-30.6 8 8-30.6 75-75 22.6 22.6-75 75zm97.6-97.6L288 153.4l25.4-25.4 22.6 22.6-25.4 25.4z"},stickyNoteRemove:{width:640,height:512,path:"M637 485.2l-96.7-76.1-22.5-17.7-443.2-349-5.2-4.1L23 1.8C19.6-1 14.5-.4 11.8 3l-10 12.5C-1 19-.4 24 3 26.8l61 48L96 100l360.7 284 15.9 12.5L617 510.2c3.4 2.8 8.5 2.2 11.2-1.2l10-12.5c2.8-3.5 2.2-8.5-1.2-11.3zM368 384h-10.7l-8.5 6.4L256 460v-76H128c-17.6 0-32-14.4-32-32V161.1l-32-25.2V352c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L368 416h51.7l-40.6-32H368zM512 32c17.6 0 32 14.4 32 32v286.9l28.2 22.2c2.3-6.6 3.8-13.7 3.8-21.1V64c0-35.3-28.7-64-64-64H128c-8.4 0-16.4 1.7-23.7 4.7L139 32h373z"},nextMatch:{width:448,height:512,path:"M311.03 131.515l-7.071 7.07c-4.686 4.686-4.686 12.284 0 16.971L387.887 239H12c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h375.887l-83.928 83.444c-4.686 4.686-4.686 12.284 0 16.971l7.071 7.07c4.686 4.686 12.284 4.686 16.97 0l116.485-116c4.686-4.686 4.686-12.284 0-16.971L328 131.515c-4.686-4.687-12.284-4.687-16.97 0z"},previousMatch:{width:448,height:512,path:"M136.97 380.485l7.071-7.07c4.686-4.686 4.686-12.284 0-16.971L60.113 273H436c6.627 0 12-5.373 12-12v-10c0-6.627-5.373-12-12-12H60.113l83.928-83.444c4.686-4.686 4.686-12.284 0-16.971l-7.071-7.07c-4.686-4.686-12.284-4.686-16.97 0l-116.485 116c-4.686 4.686-4.686 12.284 0 16.971l116.485 116c4.686 4.686 12.284 4.686 16.97-.001z"},outlineOpen:{width:320,height:512,path:"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"},outlineClosed:{width:192,height:512,path:"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"},dropdownCaret:{width:448,height:512,path:"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"},addLayer:{width:512,height:512,path:"M504 96h-88V8c0-4.42-3.58-8-8-8h-16c-4.42 0-8 3.58-8 8v88h-88c-4.42 0-8 3.58-8 8v16c0 4.42 3.58 8 8 8h88v88c0 4.42 3.58 8 8 8h16c4.42 0 8-3.58 8-8v-88h88c4.42 0 8-3.58 8-8v-16c0-4.42-3.58-8-8-8zm-6.77 270.71l-99.72-42.87 99.72-42.87c8.35-3.6 12.19-13.23 8.58-21.52-3.65-8.29-13.32-12.13-21.74-8.48l-225.32 96.86c-1.81.77-3.74.77-5.48 0L45.23 258.4l193.45-83.16c8.35-3.59 12.19-13.23 8.58-21.52-3.65-8.28-13.26-12.13-21.74-8.48L14.81 235.81C5.81 239.66 0 248.52 0 258.4c0 9.87 5.81 18.74 14.77 22.58l99.73 42.87-99.7 42.85C5.81 370.55 0 379.42 0 389.31c0 9.87 5.81 18.74 14.77 22.58l225.32 96.84c5.06 2.17 10.48 3.28 15.9 3.28s10.84-1.09 15.9-3.28l225.29-96.83c9-3.85 14.81-12.72 14.81-22.59.01-9.89-5.8-18.76-14.76-22.6zM258.74 478.72c-1.81.77-3.74.77-5.48 0L45.23 389.29 156 341.68l84.1 36.15c5.06 2.17 10.48 3.28 15.9 3.28s10.84-1.09 15.9-3.28l84.12-36.16 110.78 47.62-208.06 89.43z"},eraser:{width:512,height:512,path:"M497.942 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.744-18.744-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48 48 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12H323.883l174.059-174.059zM292.686 68.687c6.243-6.243 16.374-6.254 22.628-.001l160 160c6.243 6.243 6.253 16.374 0 22.627L358.627 368.001 176 185.373 292.686 68.687zM144 448a15.895 15.895 0 0 1-11.314-4.686l-96-96c-6.243-6.243-6.253-16.374 0-22.627L153.373 208 336 390.628l-52.686 52.686A15.895 15.895 0 0 1 272 448H144z"},ok:{width:448,height:512,path:"M413.505 91.951L133.49 371.966l-98.995-98.995c-4.686-4.686-12.284-4.686-16.971 0L6.211 284.284c-4.686 4.686-4.686 12.284 0 16.971l118.794 118.794c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-11.314-11.314c-4.686-4.686-12.284-4.686-16.97 0z"},alignCenter:{width:448,height:512,path:"M352 52v24a6 6 0 0 1-6 6H102a6 6 0 0 1-6-6V52a6 6 0 0 1 6-6h244a6 6 0 0 1 6 6zM6 210h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0 256h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm340-164H102a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6h244a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6z"},alignJustify:{width:448,height:512,path:"M0 76V52a6 6 0 0 1 6-6h436a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6H6a6 6 0 0 1-6-6zm6 134h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0 256h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0-128h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6z"},alignLeft:{width:448,height:512,path:"M288 52v24a6 6 0 0 1-6 6H6a6 6 0 0 1-6-6V52a6 6 0 0 1 6-6h276a6 6 0 0 1 6 6zM6 210h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0 256h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm276-164H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6h276a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6z"},alignRight:{width:448,height:512,path:"M160 76V52a6 6 0 0 1 6-6h276a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6H166a6 6 0 0 1-6-6zM6 210h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm0 256h436a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H6a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6zm160-128h276a6 6 0 0 0 6-6v-24a6 6 0 0 0-6-6H166a6 6 0 0 0-6 6v24a6 6 0 0 0 6 6z"},bold:{width:320,height:512,path:"M249.139 242.128c33.922-18.988 53.22-53.503 53.22-95.748 0-42.421-19.499-80.713-49.665-97.55C232.561 37.505 207.478 32 176.01 32H12C5.373 32 0 37.373 0 44v8c0 6.627 5.373 12 12 12h19.95v384H12c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h169.68c19.934 0 45.622-1.177 67.493-10.348C292.198 451.781 320 406.247 320 353.65c0-52.496-28.196-96.372-70.861-111.522zM66.041 64.201H176.01c24.929 0 43.694 4.153 57.357 12.692 21.38 13.439 33.642 38.537 33.642 68.858 0 49.531-32.265 82.81-80.289 82.81H66.041V64.201zm167.194 375.685c-12.585 5.325-29.449 7.914-51.555 7.914H66.041V260.76h124.458c56.314 0 94.151 37.837 94.151 94.151 0 40.208-19.2 71.966-51.415 84.975z"},italic:{width:256,height:512,path:"M102.791 64h45.215L73.143 448H23.762a12 12 0 0 0-11.764 9.632l-1.61 8C8.892 473.062 14.573 480 22.151 480h128.817a12 12 0 0 0 11.764-9.632l1.61-8c1.495-7.43-4.186-14.368-11.764-14.368h-45.215l74.864-384h50.011a12 12 0 0 0 11.764-9.632l1.61-8C247.108 38.938 241.427 32 233.849 32H104.401a12 12 0 0 0-11.764 9.632l-1.61 8C89.532 57.062 95.213 64 102.791 64z"},underline:{width:448,height:512,path:"M0 500v-8c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12H12c-6.627 0-12-5.373-12-12zM291.142 12v8c0 6.627 5.373 12 12 12h42.72v226.509c0 85.451-46.451 128.726-122.145 128.726-74.322 0-121.569-40.289-121.569-127.572V32h42.721c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12H26.659c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12H69.38v228.818c0 106.811 63.591 158.094 154.913 158.094 89.287 0 154.337-52.813 154.337-158.094V32h42.721c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12H303.142c-6.628 0-12 5.373-12 12z"},squiggly:{width:448,height:512,path:"M 111.80004,416.25781 -0.09375,473.46875 v 38.51563 l 111.89379,-57.21094 112.14242,57.33789 112.14243,-57.33985 112.14244,57.33985 V 473.59375 L 336.08881,416.25781 223.94246,473.5957 Z M 291.142,12 v 8 c 0,6.627 5.373,12 12,12 h 42.72 v 226.509 c 0,85.451 -46.451,128.726 -122.145,128.726 -74.322,0 -121.569,-40.289 -121.569,-127.572 V 32 h 42.721 c 6.627,0 12,-5.373 12,-12 v -8 c 0,-6.627 -5.373,-12 -12,-12 H 26.659 c -6.627,0 -12,5.373 -12,12 v 8 c 0,6.627 5.373,12 12,12 H 69.38 v 228.818 c 0,106.811 63.591,158.094 154.913,158.094 89.287,0 154.337,-52.813 154.337,-158.094 V 32 h 42.721 c 6.627,0 12,-5.373 12,-12 v -8 c 0,-6.627 -5.373,-12 -12,-12 H 303.142 c -6.628,0 -12,5.373 -12,12 z"},strikethrough:{width:512,height:512,path:"M500 272H12c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12h488c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12zm-199.246 16c34.104 17.688 58.216 40.984 58.216 83.01 0 57.657-45.969 87.221-104.86 87.221-43.044 0-101.711-17.734-101.711-60.762V388c0-6.627-5.373-12-12-12h-10.72c-6.627 0-12 5.373-12 12v15.77c0 60.082 76.565 87.291 136.431 87.291 78.593 0 140.211-46.632 140.211-123.832 0-35.712-11.87-60.522-30.603-79.229h-62.964zm-137.387-64h74.348c-43.357-17.896-75.865-37.601-75.865-84.203 0-52.844 43.64-79.03 96.041-79.03 32.008 0 90.37 12.598 90.37 44.38V116c0 6.627 5.373 12 12 12h10.721c6.627 0 12-5.373 12-12V96.327c0-44.421-64.45-68.391-125.091-68.391-72.526 0-131.392 41.225-131.392 115.011 0 38.214 14.813 63.053 36.868 81.053z"},fontColor:{width:448,height:512,path:"M232.594 32h-17.187a11.998 11.998 0 0 0-11.239 7.796L51.473 448H28c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h88c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12H87.913l44.651-120.46h182.253L360.063 448H332c-6.627 0-12 5.373-12 12v8c0 6.627 5.373 12 12 12h88c6.627 0 12-5.373 12-12v-8c0-6.627-5.373-12-12-12h-23.473L243.833 39.796A12 12 0 0 0 232.594 32zm-87.958 263.34l75.696-201.241c1.5-3.857 2.714-7.827 3.668-11.427.95 3.589 2.159 7.544 3.651 11.382l75.098 201.286H144.636z"},fillColor:{width:576,height:512,path:"M512 320s-64 92.65-64 128c0 35.35 28.66 64 64 64s64-28.65 64-64-64-128-64-128zm0 160c-17.64 0-32-14.36-32-31.96.26-9.78 13.57-37.67 32.01-68.73 18.43 31.04 31.73 58.91 31.99 68.69 0 17.64-14.36 32-32 32zm-9.37-262.94L294.94 9.37C288.69 3.12 280.5 0 272.31 0s-16.38 3.12-22.62 9.37l-92.85 92.85L56.97 2.35c-3.12-3.12-8.19-3.12-11.31 0L34.34 13.66c-3.12 3.12-3.12 8.19 0 11.31l99.88 99.88-106.1 106.1c-37.49 37.49-37.49 98.26 0 135.75l117.19 117.19c18.75 18.74 43.31 28.12 67.87 28.12 24.57 0 49.13-9.37 67.87-28.12l221.57-221.57c12.5-12.5 12.5-32.76.01-45.26zm-244.2 244.2C246.34 473.34 230.27 480 213.18 480s-33.16-6.66-45.24-18.74l-117.2-117.2c-6.88-6.88-11.77-15.14-14.91-24.06h363.85L258.43 461.26zM431.68 288H33.06c2.2-12.96 8.2-24.94 17.69-34.43l106.09-106.11 87.85 87.85c6.25 6.25 16.38 6.25 22.62 0 6.25-6.25 6.25-16.38 0-22.62l-87.85-87.85L272.29 32h.02L480 239.68 431.68 288z"},drop:{width:352,height:512,path:"M205.22 22.09C201.21 7.53 188.61 0 175.97 0c-12.35 0-24.74 7.2-29.19 22.09C100.01 179.85 0 222.72 0 333.91 0 432.35 78.72 512 176 512s176-79.65 176-178.09c0-111.75-99.79-153.34-146.78-311.82zM176 480c-79.4 0-144-65.54-144-146.09 0-48.36 23-81.32 54.84-126.94 29.18-41.81 65.34-93.63 89.18-170.91 23.83 77.52 60.06 129.31 89.3 171.08C297.06 252.52 320 285.3 320 333.91 320 414.46 255.4 480 176 480zm0-64c-44.12 0-80-35.89-80-80 0-8.84-7.16-16-16-16s-16 7.16-16 16c0 61.75 50.25 112 112 112 8.84 0 16-7.16 16-16s-7.16-16-16-16z"},checkbox:{width:448,height:512,path:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm16 400c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V80c0-8.8 7.2-16 16-16h352c8.8 0 16 7.2 16 16v352z"},checkboxChecked:{width:448,height:512,path:"M400 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zm0 32c8.823 0 16 7.178 16 16v352c0 8.822-7.177 16-16 16H48c-8.822 0-16-7.178-16-16V80c0-8.822 7.178-16 16-16h352m-34.301 98.293l-8.451-8.52c-4.667-4.705-12.265-4.736-16.97-.068l-163.441 162.13-68.976-69.533c-4.667-4.705-12.265-4.736-16.97-.068l-8.52 8.451c-4.705 4.667-4.736 12.265-.068 16.97l85.878 86.572c4.667 4.705 12.265 4.736 16.97.068l180.48-179.032c4.704-4.667 4.735-12.265.068-16.97z"},pageLayoutModeNone:{width:512,height:512,path:"M 404.00446,340.39588 H 307.417 c -8.8907,0 -16.09791,-7.20735 -16.09791,-16.0979 V 226.90563 H 129.53513 c -9.33519,0 -16.90281,7.56764 -16.90281,16.90282 V 508.86602 H 82.046291 V 243.80845 c 0,-26.22737 21.261469,-47.48883 47.488839,-47.48883 h 185.16393 c 13.26225,0 25.94064,5.4538 35.06108,15.08212 l 76.00853,80.24116 c 5.66469,5.9802 8.82181,13.90391 8.82181,22.14106 v 195.63997 h -30.58602 z m -1.01739,-27.15345 -79.47231,-86.3368 h -1.60979 v 86.3368 z M 82.851029,3.1447104 H 113.43705 V 99.732162 c 0,9.335168 7.56762,16.902808 16.90282,16.902808 h 257.56652 c 9.33518,0 16.9028,-7.56764 16.9028,-16.902808 V 3.1447104 h 30.58603 V 99.732162 c 0,26.227348 -21.26147,47.488828 -47.48883,47.488828 H 130.33987 c -26.22737,0 -47.488841,-21.26148 -47.488841,-47.488828 z"},pageLayoutModeSinglePage:{width:384,height:512,path:"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zm-22.6 22.7c2.1 2.1 3.5 4.6 4.2 7.4H256V32.5c2.8.7 5.3 2.1 7.4 4.2l83.9 83.9zM336 480H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h176v104c0 13.3 10.7 24 24 24h104v304c0 8.8-7.2 16-16 16z"},warning:{width:576,height:512,path:"M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.054-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.952 83.154 0l239.94 416.028zm-27.658 15.991l-240-416c-6.16-10.678-21.583-10.634-27.718 0l-240 416C27.983 466.678 35.731 480 48 480h480c12.323 0 19.99-13.369 13.859-23.996zM288 372c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28zm-11.49-212h22.979c6.823 0 12.274 5.682 11.99 12.5l-7 168c-.268 6.428-5.556 11.5-11.99 11.5h-8.979c-6.433 0-11.722-5.073-11.99-11.5l-7-168c-.283-6.818 5.167-12.5 11.99-12.5zM288 372c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28z"},lock:{width:448,height:512,path:"M224 420c-11 0-20-9-20-20v-64c0-11 9-20 20-20s20 9 20 20v64c0 11-9 20-20 20zm224-148v192c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V272c0-26.5 21.5-48 48-48h16v-64C64 71.6 136-.3 224.5 0 312.9.3 384 73.1 384 161.5V224h16c26.5 0 48 21.5 48 48zM96 224h256v-64c0-70.6-57.4-128-128-128S96 89.4 96 160v64zm320 240V272c0-8.8-7.2-16-16-16H48c-8.8 0-16 7.2-16 16v192c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16z"},unlock:{width:640,height:512,path:"M227 417c-11 0-20-9-20-20v-64c0-11 9-20 20-20s20 9 20 20v64c0 11-9 20-20 20zM480.5 0C392-.3 320 71.6 320 160v64H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48h-48v-62.6c0-70.7 56.7-129 127.3-129.4C550.2 31.6 608 89.2 608 160v84c0 6.6 5.4 12 12 12h8c6.6 0 12-5.4 12-12v-82.5C640 73.1 568.9.3 480.5 0zM400 256c8.8 0 16 7.2 16 16v192c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V272c0-8.8 7.2-16 16-16h352z"},history:{width:512,height:512,path:"M20 24h10c6.627 0 12 5.373 12 12v94.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H164c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V36c0-6.627 5.373-12 12-12zm321.647 315.235l4.706-6.47c3.898-5.36 2.713-12.865-2.647-16.763L272 263.853V116c0-6.627-5.373-12-12-12h-8c-6.627 0-12 5.373-12 12v164.147l84.884 61.734c5.36 3.899 12.865 2.714 16.763-2.646z"},error:{width:512,height:512,path:"M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"},pdfFile:{width:384,height:512,path:"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zm-22.6 22.7c2.1 2.1 3.5 4.6 4.2 7.4H256V32.5c2.8.7 5.3 2.1 7.4 4.2l83.9 83.9zM336 480H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h176v104c0 13.3 10.7 24 24 24h104v304c0 8.8-7.2 16-16 16zm-48-244v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm0 64v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm0 64v8c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12z"},fileError:{width:384,height:512,path:"M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zm-22.6 22.7c2.1 2.1 3.5 4.6 4.2 7.4H256V32.5c2.8.7 5.3 2.1 7.4 4.2l83.9 83.9zM336 480H48c-8.8 0-16-7.2-16-16V48c0-8.8 7.2-16 16-16h176v104c0 13.3 10.7 24 24 24h104v304c0 8.8-7.2 16-16 16zm-73.3-127.9c4.7 4.7 4.7 12.3 0 17l-5.7 5.7c-4.7 4.7-12.3 4.7-17 0l-48-48.2-48.1 48.1c-4.7 4.7-12.3 4.7-17 0l-5.7-5.7c-4.7-4.7-4.7-12.3 0-17l48.1-48.1-48.1-48.1c-4.7-4.7-4.7-12.3 0-17l5.7-5.7c4.7-4.7 12.3-4.7 17 0l48.1 48.1 48.1-48.1c4.7-4.7 12.3-4.7 17 0l5.7 5.7c4.7 4.7 4.7 12.3 0 17L214.6 304l48.1 48.1z"},sidePaneThumbnails:{width:512,height:512,path:"M 111.73 0.28125 C 85.231 0.28125 63.73 21.781 63.73 48.281 L 63.73 63.73 L 48.359 63.73 C 21.859 63.73 0.35938 85.231 0.35938 111.73 L 0.35938 463.73 C 0.35938 490.23 21.859 511.73 48.359 511.73 L 400.36 511.73 C 426.86 511.73 448.36 490.23 448.36 463.73 L 448.36 448.28 L 463.73 448.28 C 490.23 448.28 511.73 426.78 511.73 400.28 L 511.73 48.281 C 511.73 21.781 490.23 0.28125 463.73 0.28125 L 111.73 0.28125 z M 111.73 32.281 L 463.73 32.281 C 472.55 32.281 479.73 39.461 479.73 48.281 L 479.73 400.28 C 479.73 409.1 472.55 416.28 463.73 416.28 L 448.36 416.28 L 448.36 111.73 C 448.36 85.231 426.86 63.73 400.36 63.73 L 95.73 63.73 L 95.73 48.281 C 95.73 39.461 102.91 32.281 111.73 32.281 z M 48.359 95.73 L 400.36 95.73 C 409.18 95.73 416.36 102.91 416.36 111.73 L 416.36 463.73 C 416.36 472.55 409.18 479.73 400.36 479.73 L 48.359 479.73 C 39.539 479.73 32.359 472.55 32.359 463.73 L 32.359 111.73 C 32.359 102.91 39.539 95.73 48.359 95.73 z M 104.36 175.73 C 99.938 175.73 96.359 179.31 96.359 183.73 L 96.359 199.73 C 96.359 204.15 99.938 207.73 104.36 207.73 L 248.36 207.73 C 252.78 207.73 256.36 204.15 256.36 199.73 L 256.36 183.73 C 256.36 179.31 252.78 175.73 248.36 175.73 L 104.36 175.73 z M 104.36 271.73 C 99.938 271.73 96.359 275.31 96.359 279.73 L 96.359 295.73 C 96.359 300.15 99.938 303.73 104.36 303.73 L 344.36 303.73 C 348.78 303.73 352.36 300.15 352.36 295.73 L 352.36 279.73 C 352.36 275.31 348.78 271.73 344.36 271.73 L 104.36 271.73 z M 104.36 367.73 C 99.938 367.73 96.359 371.31 96.359 375.73 L 96.359 391.73 C 96.359 396.15 99.938 399.73 104.36 399.73 L 184.36 399.73 C 188.78 399.73 192.36 396.15 192.36 391.73 L 192.36 375.73 C 192.36 371.31 188.78 367.73 184.36 367.73 L 104.36 367.73 z"},sidePaneAnnotation:{width:512,height:512,path:"M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm32 352c0 17.6-14.4 32-32 32H293.3l-8.5 6.4L192 460v-76H64c-17.6 0-32-14.4-32-32V64c0-17.6 14.4-32 32-32h384c17.6 0 32 14.4 32 32v288zM280 240H136c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h144c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8zm96-96H136c-4.4 0-8 3.6-8 8v16c0 4.4 3.6 8 8 8h240c4.4 0 8-3.6 8-8v-16c0-4.4-3.6-8-8-8z"},sidePaneOutline:{width:512,height:512,path:"M88 56H40a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h48a16 16 0 0 0 16-16V72a16 16 0 0 0-16-16zm0 160H40a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h48a16 16 0 0 0 16-16v-48a16 16 0 0 0-16-16zm0 160H40a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h48a16 16 0 0 0 16-16v-48a16 16 0 0 0-16-16zm416 24H168a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h336a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8zm0-320H168a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h336a8 8 0 0 0 8-8V88a8 8 0 0 0-8-8zm0 160H168a8 8 0 0 0-8 8v16a8 8 0 0 0 8 8h336a8 8 0 0 0 8-8v-16a8 8 0 0 0-8-8z"},annotation:{width:512,height:512,path:"M256 64c123.5 0 224 79 224 176S379.5 416 256 416c-28.3 0-56.3-4.3-83.2-12.8l-15.2-4.8-13 9.2c-23 16.3-58.5 35.3-102.6 39.6 12-15.1 29.8-40.4 40.8-69.6l7.1-18.7-13.7-14.6C47.3 313.7 32 277.6 32 240c0-97 100.5-176 224-176m0-32C114.6 32 0 125.1 0 240c0 47.6 19.9 91.2 52.9 126.3C38 405.7 7 439.1 6.5 439.5c-6.6 7-8.4 17.2-4.6 26 3.8 8.8 12.4 14.5 22 14.5 61.5 0 110-25.7 139.1-46.3 29 9.1 60.2 14.3 93 14.3 141.4 0 256-93.1 256-208S397.4 32 256 32z",bg:"M 256,32 C 114.6,32 0,125.1 0,240 0,287.6 19.9,331.2 52.9,366.3 38,405.7 7,439.1 6.5,439.5 c -6.6,7 -8.4,17.2 -4.6,26 3.8,8.8 12.4,14.5 22,14.5 61.5,0 110,-25.7 139.1,-46.3 29,9.1 60.2,14.3 93,14.3 141.4,0 256,-93.1 256,-208 C 512,125.1 397.4,32 256,32 Z"},highlighter:{width:544,height:512,path:"M528.61 75.91l-60.49-60.52C457.91 5.16 444.45 0 430.98 0a52.38 52.38 0 0 0-34.75 13.15L110.59 261.8c-10.29 9.08-14.33 23.35-10.33 36.49l12.49 41.02-36.54 36.56c-6.74 6.75-6.74 17.68 0 24.43l.25.26L0 479.98 99.88 512l43.99-44.01.02.02c6.75 6.75 17.69 6.75 24.44 0l36.46-36.47 40.91 12.53c18.01 5.51 31.41-4.54 36.51-10.32l248.65-285.9c18.35-20.82 17.37-52.32-2.25-71.94zM91.05 475.55l-32.21-10.33 40.26-42.03 22.14 22.15-30.19 30.21zm167.16-62.99c-.63.72-1.4.94-2.32.94-.26 0-.54-.02-.83-.05l-40.91-12.53-18.39-5.63-39.65 39.67-46.85-46.88 39.71-39.72-5.6-18.38-12.49-41.02c-.34-1.13.01-2.36.73-3l44.97-39.15 120.74 120.8-39.11 44.95zm248.51-285.73L318.36 343.4l-117.6-117.66L417.4 37.15c4.5-3.97 17.55-9.68 28.1.88l60.48 60.52c7.65 7.65 8.04 20 .74 28.28z",bg:"M 528.61,75.91 468.12,15.39 C 457.91,5.16 444.45,0 430.98,0 418.17896,-0.01016736 405.81733,4.6676871 396.23,13.15 L 110.59,261.8 c -10.29,9.08 -14.33,23.35 -10.33,36.49 l 12.49,41.02 -36.54,36.56 c -6.74,6.75 -6.74,17.68 0,24.43 l 0.25,0.26 L 0,479.98 99.88,512 l 43.99,-44.01 0.02,0.02 c 6.75,6.75 17.69,6.75 24.44,0 l 36.46,-36.47 40.91,12.53 c 18.01,5.51 31.41,-4.54 36.51,-10.32 l 248.65,-285.9 c 18.35,-20.82 17.37,-52.32 -2.25,-71.94 z"},rectangularHighlighter:{width:512,height:512,path:"M486.4 128c14.14 0 25.6-11.46 25.6-25.6V25.6C512 11.46 500.54 0 486.4 0h-76.8C395.46 0 384 11.46 384 25.6V48H128V25.6C128 11.46 116.54 0 102.4 0H25.6C11.46 0 0 11.46 0 25.6v76.8C0 116.54 11.46 128 25.6 128H48v256H25.6C11.46 384 0 395.46 0 409.6v76.8C0 500.54 11.46 512 25.6 512h76.8c14.14 0 25.6-11.46 25.6-25.6V464h256v22.4c0 14.14 11.46 25.6 25.6 25.6h76.8c14.14 0 25.6-11.46 25.6-25.6v-76.8c0-14.14-11.46-25.6-25.6-25.6H464V128h22.4zM416 32h64v64h-64V32zM32 96V32h64v64H32zm64 384H32v-64h64v64zm384-64v64h-64v-64h64zm-48-32h-22.4c-14.14 0-25.6 11.46-25.6 25.6V432H128v-22.4c0-14.14-11.46-25.6-25.6-25.6H80V128h22.4c14.14 0 25.6-11.46 25.6-25.6V80h256v22.4c0 14.14 11.46 25.6 25.6 25.6H432v256z"},pencil:{width:512,height:512,path:"M493.255 56.236l-37.49-37.49c-24.993-24.993-65.515-24.994-90.51 0L12.838 371.162.151 485.346c-1.698 15.286 11.22 28.203 26.504 26.504l114.184-12.687 352.417-352.417c24.992-24.994 24.992-65.517-.001-90.51zm-95.196 140.45L174 420.745V386h-48v-48H91.255l224.059-224.059 82.745 82.745zM126.147 468.598l-58.995 6.555-30.305-30.305 6.555-58.995L63.255 366H98v48h48v34.745l-19.853 19.853zm344.48-344.48l-49.941 49.941-82.745-82.745 49.941-49.941c12.505-12.505 32.748-12.507 45.255 0l37.49 37.49c12.506 12.506 12.507 32.747 0 45.255z",bg:"m 493.255,56.236 -37.49,-37.49 c -24.993,-24.993 -65.515,-24.994 -90.51,0 L 12.838,371.162 0.151,485.346 c -1.698,15.286 11.22,28.203 26.504,26.504 L 140.839,499.163 493.256,146.746 c 24.992,-24.994 24.992,-65.517 -10e-4,-90.51 z"},freeText:{width:512,height:512,path:"m 460,81 v 72 c 0,4.42 -3.58,8 -8,8 h -16 c -4.42,0 -8,-3.58 -8,-8 V 97 H 272 v 338 h 72 c 4.42,0 8,3.58 8,8 v 16 c 0,4.42 -3.58,8 -8,8 H 168 c -4.42,0 -8,-3.58 -8,-8 v -16 c 0,-4.42 3.58,-8 8,-8 h 72 V 97 H 84 v 56 c 0,4.42 -3.582,8 -8,8 H 60 c -4.418,0 -8,-3.58 -8,-8 V 81 c 0,-8.837 7.163,-16 16,-16 h 376 c 8.84,0 16,7.163 16,16 z",bg:"M512 512H0V0h512v512z"},stamp:{width:508,height:512,path:"m 333.71644,332.74589 h 121.26625 l 52.08896,87.08726 H 508.009 V 512.0005 H 0 V 419.83315 H 0.80598227 L 54.686486,332.74589 H 178.89175 V 241.68498 C 139.83419,229.2037 120.83357,188.0785 120.83357,122.28502 120.83357,50.03435 163.8049,8.54414 246.15327,0.3862 V 0 h 4.2226 14.81043 v 0.26345 c 83.1756,7.85642 126.58831,49.40078 126.58831,122.02157 0,65.79348 -19.00062,106.91868 -58.05817,119.39996 z m 0,26.85191 v 11.42093 l -0.57524,1.90136 c -7.77664,25.70458 -26.80014,40.76443 -54.91507,44.75071 -3.13022,0.44382 -6.37313,0.75038 -9.72577,0.91907 2e-5,0.0515 5e-5,0.10303 8e-5,0.15469 h -18.12457 -4.2226 c 0,-0.0231 0,-0.0462 0,-0.0693 -34.59286,-1.15044 -57.8689,-16.6105 -66.68629,-45.75514 l -0.57523,-1.90136 V 359.5978 H 70.109423 L 33.186454,419.83315 H 474.69705 l -35.1373,-60.23535 z m -72.20597,-332.75872 -5.41897,-0.0189 -4.95803,0.0158 C 180.53972,32.90225 147.68548,63.8059 147.68548,122.285 c 0,60.26373 16.08094,90.41551 46.87034,95.62098 l 11.18782,1.8915 v 147.12358 c 5.83066,16.85951 19.64352,24.97158 44.63223,24.97158 h 5.92822 5.92822 c 24.9887,0 38.80158,-8.11207 44.63222,-24.97158 V 219.79748 l 11.18782,-1.8915 c 30.7894,-5.20547 46.87035,-35.35725 46.87035,-95.62098 0,-58.46923 -32.84314,-89.37232 -103.41223,-95.44594 z M 26.96748,485.1486 H 481.04152 V 446.68506 H 26.96748 Z",bg:"m 333.71644,332.74589 h 121.26625 l 52.08896,87.08726 H 508.009 V 512.0005 H 0 V 419.83315 H 0.80598227 L 54.686486,332.74589 H 178.89175 V 241.68498 C 139.83419,229.2037 120.83357,188.0785 120.83357,122.28502 120.83357,50.03435 163.8049,8.54414 246.15327,0.3862 V 0 h 4.2226 14.81043 v 0.26345 c 83.1756,7.85642 126.58831,49.40078 126.58831,122.02157 0,65.79348 -19.00062,106.91868 -58.05817,119.39996 z"},redaction:{width:512,height:512,path:"M 256 341.332031 L 256 426.667969 L 64 426.667969 L 64 341.332031 Z M 448 384 L 448 405.332031 L 298.667969 405.332031 L 298.667969 384 Z M 448 213.332031 L 448 298.667969 L 64 298.667969 L 64 213.332031 Z M 448 85.332031 L 448 170.667969 L 256 170.667969 L 256 85.332031 Z M 213.332031 128 L 213.332031 149.332031 L 64 149.332031 L 64 128 Z M 213.332031 128"},rotate:{width:512,height:512,path:"M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z"},rotateLeft:{width:512,height:512,path:"M20 8h10c6.627 0 12 5.373 12 12v110.625C85.196 57.047 165.239 7.715 256.793 8.001 393.18 8.428 504.213 120.009 504 256.396 503.786 393.181 392.834 504 256 504c-63.926 0-122.202-24.187-166.178-63.908-5.113-4.618-5.354-12.561-.482-17.433l7.069-7.069c4.503-4.503 11.749-4.714 16.482-.454C150.782 449.238 200.935 470 256 470c117.744 0 214-95.331 214-214 0-117.744-95.331-214-214-214-82.862 0-154.737 47.077-190.289 116H180c6.627 0 12 5.373 12 12v10c0 6.627-5.373 12-12 12H20c-6.627 0-12-5.373-12-12V20c0-6.627 5.373-12 12-12z"},rotateRight:{width:512,height:512,path:"M492 8h-10c-6.627 0-12 5.373-12 12v110.625C426.804 57.047 346.761 7.715 255.207 8.001 118.82 8.428 7.787 120.009 8 256.396 8.214 393.181 119.166 504 256 504c63.926 0 122.202-24.187 166.178-63.908 5.113-4.618 5.354-12.561.482-17.433l-7.069-7.069c-4.503-4.503-11.749-4.714-16.482-.454C361.218 449.238 311.065 470 256 470c-117.744 0-214-95.331-214-214 0-117.744 95.331-214 214-214 82.862 0 154.737 47.077 190.289 116H332c-6.627 0-12 5.373-12 12v10c0 6.627 5.373 12 12 12h160c6.627 0 12-5.373 12-12V20c0-6.627-5.373-12-12-12z"},close:{width:320,height:512,path:"M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"},options:{width:512,height:512,path:"M482.696 299.276l-32.61-18.827a195.168 195.168 0 0 0 0-48.899l32.61-18.827c9.576-5.528 14.195-16.902 11.046-27.501-11.214-37.749-31.175-71.728-57.535-99.595-7.634-8.07-19.817-9.836-29.437-4.282l-32.562 18.798a194.125 194.125 0 0 0-42.339-24.48V38.049c0-11.13-7.652-20.804-18.484-23.367-37.644-8.909-77.118-8.91-114.77 0-10.831 2.563-18.484 12.236-18.484 23.367v37.614a194.101 194.101 0 0 0-42.339 24.48L105.23 81.345c-9.621-5.554-21.804-3.788-29.437 4.282-26.36 27.867-46.321 61.847-57.535 99.595-3.149 10.599 1.47 21.972 11.046 27.501l32.61 18.827a195.168 195.168 0 0 0 0 48.899l-32.61 18.827c-9.576 5.528-14.195 16.902-11.046 27.501 11.214 37.748 31.175 71.728 57.535 99.595 7.634 8.07 19.817 9.836 29.437 4.283l32.562-18.798a194.08 194.08 0 0 0 42.339 24.479v37.614c0 11.13 7.652 20.804 18.484 23.367 37.645 8.909 77.118 8.91 114.77 0 10.831-2.563 18.484-12.236 18.484-23.367v-37.614a194.138 194.138 0 0 0 42.339-24.479l32.562 18.798c9.62 5.554 21.803 3.788 29.437-4.283 26.36-27.867 46.321-61.847 57.535-99.595 3.149-10.599-1.47-21.972-11.046-27.501zm-65.479 100.461l-46.309-26.74c-26.988 23.071-36.559 28.876-71.039 41.059v53.479a217.145 217.145 0 0 1-87.738 0v-53.479c-33.621-11.879-43.355-17.395-71.039-41.059l-46.309 26.74c-19.71-22.09-34.689-47.989-43.929-75.958l46.329-26.74c-6.535-35.417-6.538-46.644 0-82.079l-46.329-26.74c9.24-27.969 24.22-53.869 43.929-75.969l46.309 26.76c27.377-23.434 37.063-29.065 71.039-41.069V44.464a216.79 216.79 0 0 1 87.738 0v53.479c33.978 12.005 43.665 17.637 71.039 41.069l46.309-26.76c19.709 22.099 34.689 47.999 43.929 75.969l-46.329 26.74c6.536 35.426 6.538 46.644 0 82.079l46.329 26.74c-9.24 27.968-24.219 53.868-43.929 75.957zM256 160c-52.935 0-96 43.065-96 96s43.065 96 96 96 96-43.065 96-96-43.065-96-96-96zm0 160c-35.29 0-64-28.71-64-64s28.71-64 64-64 64 28.71 64 64-28.71 64-64 64z"},delete:{width:512,height:512,path:"M368 64l-33.6-44.8C325.3 7.1 311.1 0 296 0h-80c-15.1 0-29.3 7.1-38.4 19.2L144 64H40c-13.3 0-24 10.7-24 24v2c0 3.3 2.7 6 6 6h20.9l33.2 372.3C78.3 493 99 512 123.9 512h264.2c24.9 0 45.6-19 47.8-43.7L469.1 96H490c3.3 0 6-2.7 6-6v-2c0-13.3-10.7-24-24-24H368zM216 32h80c5 0 9.8 2.4 12.8 6.4L328 64H184l19.2-25.6c3-4 7.8-6.4 12.8-6.4zm188 433.4c-.7 8.3-7.6 14.6-15.9 14.6H123.9c-8.3 0-15.2-6.3-15.9-14.6L75 96h362l-33 369.4z"},copy:{width:448,height:512,path:"M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM352 32.491a15.88 15.88 0 0 1 7.431 4.195l51.882 51.883A15.885 15.885 0 0 1 415.508 96H352V32.491zM288 464c0 8.822-7.178 16-16 16H48c-8.822 0-16-7.178-16-16V144c0-8.822 7.178-16 16-16h80v240c0 26.51 21.49 48 48 48h112v48zm128-96c0 8.822-7.178 16-16 16H176c-8.822 0-16-7.178-16-16V48c0-8.822 7.178-16 16-16h144v72c0 13.2 10.8 24 24 24h72v240z"},created:{width:448,height:512,path:"M400 64c8.8 0 16 7.2 16 16v352c0 8.8-7.2 16-16 16H48c-8.8 0-16-7.2-16-16V80c0-8.8 7.2-16 16-16h352m0-32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-60 206h-98v-98c0-6.6-5.4-12-12-12h-12c-6.6 0-12 5.4-12 12v98h-98c-6.6 0-12 5.4-12 12v12c0 6.6 5.4 12 12 12h98v98c0 6.6 5.4 12 12 12h12c6.6 0 12-5.4 12-12v-98h98c6.6 0 12-5.4 12-12v-12c0-6.6-5.4-12-12-12z"},pen:{width:512,height:512,path:"M493.25 56.26l-37.51-37.51C443.25 6.25 426.87 0 410.49 0s-32.76 6.25-45.26 18.74L12.85 371.12.15 485.34C-1.45 499.72 9.88 512 23.95 512c.89 0 1.78-.05 2.69-.15l114.14-12.61 352.48-352.48c24.99-24.99 24.99-65.51-.01-90.5zM126.09 468.68l-93.03 10.31 10.36-93.17 263.89-263.89 82.77 82.77-263.99 263.98zm344.54-344.54l-57.93 57.93-82.77-82.77 57.93-57.93c6.04-6.04 14.08-9.37 22.63-9.37 8.55 0 16.58 3.33 22.63 9.37l37.51 37.51c12.47 12.48 12.47 32.78 0 45.26z"},rectangle:{width:512,height:512,path:"M480 32v448H32V32h448m32-32H0v512h512V0z",bg:"M 512,0 H 0 v 512 h 512 z"},circle:{width:512,height:512,path:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216z",bg:"M 256,8 C 119,8 8,119 8,256 8,393 119,504 256,504 393,504 504,393 504,256 504,119 393,8 256,8 Z"},circleDashed:{width:512,height:512,path:"M 217.9 10.91 C 177.84 17.083 140.95 32.842 109.64 55.766 L 132.58 78.705 C 157.62 61.229 186.56 48.91 217.9 43.344 L 217.9 10.91 z M 294.09 10.91 L 294.09 43.355 C 325.33 48.924 354.3 61.224 379.41 78.725 L 402.36 55.773 C 371.05 32.849 334.16 17.082 294.09 10.91 z M 55.77 109.64 C 32.851 140.96 17.095 177.84 10.922 217.9 L 43.365 217.9 C 48.935 186.67 61.234 157.71 78.729 132.6 L 55.77 109.64 z M 456.24 109.65 L 433.3 132.58 C 450.77 157.62 463.09 186.56 468.66 217.9 L 501.08 217.9 C 494.91 177.84 479.16 140.95 456.24 109.65 z M 10.92 294.09 C 17.096 334.15 32.846 371.05 55.771 402.36 L 78.707 379.43 C 61.228 354.38 48.91 325.43 43.342 294.09 L 10.92 294.09 z M 468.64 294.09 C 463.07 325.33 450.77 354.29 433.27 379.4 L 456.23 402.36 C 479.15 371.04 494.91 334.15 501.08 294.09 L 468.64 294.09 z M 132.6 433.28 L 109.65 456.23 C 140.96 479.15 177.84 494.92 217.9 501.09 L 217.9 468.64 C 186.67 463.07 157.71 450.77 132.6 433.28 z M 379.42 433.29 C 354.38 450.77 325.44 463.09 294.09 468.66 L 294.09 501.09 C 334.15 494.92 371.05 479.16 402.36 456.23 L 379.42 433.29 z"},shapes:{width:512,height:512,path:"M480 288H320c-17.67 0-32 14.33-32 32v160c0 17.67 14.33 32 32 32h160c17.67 0 32-14.33 32-32V320c0-17.67-14.33-32-32-32zm0 192H320V320h160v160zM128 256C57.31 256 0 313.31 0 384s57.31 128 128 128 128-57.31 128-128-57.31-128-128-128zm0 224c-52.93 0-96-43.07-96-96 0-52.94 43.07-96 96-96 52.94 0 96 43.06 96 96 0 52.93-43.06 96-96 96zm378.98-278.86L400.07 18.29C392.95 6.1 380.47 0 368 0s-24.95 6.1-32.07 18.29L229.02 201.14c-14.26 24.38 3.56 54.86 32.07 54.86h213.82c28.51 0 46.33-30.48 32.07-54.86zm-27.6 20.39c-.94 1.64-2.45 2.47-4.47 2.47H261.09c-2.02 0-3.53-.83-4.47-2.47-1.21-2.12-.35-3.6.02-4.23L363.55 34.44c.95-1.62 2.44-2.44 4.45-2.44s3.5.82 4.45 2.44L479.36 217.3c.37.63 1.24 2.11.02 4.23z"},image:{width:512,height:512,path:"M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm16 336c0 8.822-7.178 16-16 16H48c-8.822 0-16-7.178-16-16V112c0-8.822 7.178-16 16-16h416c8.822 0 16 7.178 16 16v288zM112 232c30.928 0 56-25.072 56-56s-25.072-56-56-56-56 25.072-56 56 25.072 56 56 56zm0-80c13.234 0 24 10.766 24 24s-10.766 24-24 24-24-10.766-24-24 10.766-24 24-24zm207.029 23.029L224 270.059l-31.029-31.029c-9.373-9.373-24.569-9.373-33.941 0l-88 88A23.998 23.998 0 0 0 64 344v28c0 6.627 5.373 12 12 12h360c6.627 0 12-5.373 12-12v-92c0-6.365-2.529-12.47-7.029-16.971l-88-88c-9.373-9.372-24.569-9.372-33.942 0zM416 352H96v-4.686l80-80 48 48 112-112 80 80V352z"},pageLayoutMode0:{width:800,height:512,path:"M 287.48 56 C 266.77 56.079 249.97 72.872 249.97 93.57 L 249.97 418.51 C 249.97 439.21 266.77 456 287.48 456 L 512.52 456 C 533.23 456 550.03 439.21 550.03 418.51 L 550.03 159.1 C 550.03 149.18 546.04 139.58 539.01 132.55 L 473.45 67.016 C 466.42 59.984 456.88 56 446.96 56 L 287.48 56 z M 287.48 81.072 L 425 81.072 L 425 162.31 C 425 172.7 433.36 181.05 443.76 181.05 L 525.03 181.05 L 525.03 418.51 L 525.02 418.51 C 525.02 425.38 519.39 431.01 512.52 431.01 L 287.48 431.01 C 280.6 431.01 274.97 425.38 274.97 418.51 L 274.97 93.57 C 274.97 86.697 280.6 81.072 287.48 81.072 z M 450.01 81.465 C 452.2 82.012 454.15 83.104 455.79 84.744 L 521.35 150.28 C 522.99 151.92 524.09 153.87 524.63 156.06 L 450.01 156.06 L 450.01 81.465 z"},pageLayoutMode1:{width:800,height:512,path:"M 249.97 -7.6191 L 249.97 162.51 C 249.97 183.21 266.77 200 287.48 200 L 512.52 200 C 533.23 200 550.03 183.21 550.03 162.51 L 550.03 -7.6191 L 525.03 -7.6191 L 525.03 162.51 L 525.02 162.51 C 525.02 169.38 519.4 175.01 512.52 175.01 L 287.48 175.01 C 280.6 175.01 274.98 169.38 274.98 162.51 L 274.98 -7.6191 L 249.97 -7.6191 z M 287.48 312 C 266.77 312.08 249.97 328.87 249.97 349.57 L 249.97 523.16 L 274.98 523.16 L 274.98 349.57 C 274.98 342.7 280.6 337.07 287.48 337.07 L 425.01 337.07 L 425.01 418.31 C 425.01 428.7 433.36 437.05 443.76 437.05 L 525.03 437.05 L 525.03 523.16 L 550.03 523.16 L 550.03 415.1 C 550.03 405.18 546.04 395.58 539.01 388.55 L 473.45 323.01 C 466.42 315.98 456.88 312 446.96 312 L 287.48 312 z M 450.01 337.46 C 452.2 338.01 454.15 339.1 455.79 340.74 L 521.35 406.28 C 522.99 407.92 524.09 409.87 524.63 412.06 L 450.01 412.06 L 450.01 337.46 z"},pageLayoutMode2:{width:800,height:512,path:"M 49.971 0.5293 L 49.971 162.51 C 49.971 183.21 66.771 200 87.479 200 L 312.52 200 C 333.23 200 350.03 183.21 350.03 162.51 L 350.03 0.5293 L 325.02 0.5293 L 325.02 162.51 C 325.02 169.38 319.39 175.01 312.52 175.01 L 87.479 175.01 C 80.602 175.01 74.975 169.38 74.975 162.51 L 74.975 0.5293 L 49.971 0.5293 z M 449.97 0.53906 L 449.97 162.51 C 449.97 183.21 466.77 200 487.48 200 L 712.52 200 C 733.23 200 750.03 183.21 750.03 162.51 L 750.03 0.53906 L 725.03 0.53906 L 725.03 162.51 L 725.02 162.51 C 725.02 169.38 719.39 175.01 712.52 175.01 L 487.48 175.01 C 480.6 175.01 474.97 169.38 474.97 162.51 L 474.97 0.53906 L 449.97 0.53906 z M 87.479 312 C 66.772 312.08 49.971 328.87 49.971 349.57 L 49.971 511.69 L 74.975 511.69 L 74.975 349.57 C 74.975 342.7 80.602 337.07 87.479 337.07 L 225 337.07 L 225 418.31 C 225 428.7 233.36 437.05 243.76 437.05 L 325.02 437.05 L 325.02 511.69 L 350.03 511.69 L 350.03 415.1 C 350.03 405.18 346.04 395.58 339.01 388.55 L 273.45 323.01 C 266.42 315.98 256.88 312 246.96 312 L 87.479 312 z M 487.48 312 C 466.77 312.08 449.97 328.87 449.97 349.57 L 449.97 511.67 L 474.97 511.67 L 474.97 349.57 C 474.97 342.7 480.6 337.07 487.48 337.07 L 625 337.07 L 625 418.31 C 625 428.7 633.36 437.05 643.76 437.05 L 725.03 437.05 L 725.03 511.67 L 750.03 511.67 L 750.03 415.1 C 750.03 405.18 746.04 395.58 739.01 388.55 L 673.45 323.01 C 666.42 315.98 656.88 312 646.96 312 L 487.48 312 z M 250.01 337.46 C 252.2 338.01 254.15 339.1 255.79 340.74 L 321.35 406.28 C 322.99 407.92 324.09 409.87 324.63 412.06 L 250.01 412.06 L 250.01 337.46 z M 650.01 337.46 C 652.2 338.01 654.15 339.1 655.79 340.74 L 721.35 406.28 C 722.99 407.92 724.09 409.87 724.63 412.06 L 650.01 412.06 L 650.01 337.46 z"},pageLayoutMode3:{width:800,height:512,path:"M 449.97 0.48047 L 449.97 162.51 C 449.97 183.21 466.77 200 487.48 200 L 712.52 200 C 733.23 200 750.03 183.21 750.03 162.51 L 750.03 0.48047 L 725.03 0.48047 L 725.03 162.51 L 725.02 162.51 C 725.02 169.38 719.39 175.01 712.52 175.01 L 487.48 175.01 C 480.6 175.01 474.97 169.38 474.97 162.51 L 474.97 0.48047 L 449.97 0.48047 z M 87.479 312 C 66.772 312.08 49.971 328.87 49.971 349.57 L 49.971 511.89 L 74.975 511.89 L 74.975 349.57 C 74.975 342.7 80.602 337.07 87.479 337.07 L 225 337.07 L 225 418.31 C 225 428.7 233.36 437.05 243.76 437.05 L 325.02 437.05 L 325.02 511.89 L 350.03 511.89 L 350.03 415.1 C 350.03 405.18 346.04 395.58 339.01 388.55 L 273.45 323.01 C 266.42 315.98 256.88 312 246.96 312 L 87.479 312 z M 487.48 312 C 466.77 312.08 449.97 328.87 449.97 349.57 L 449.97 511.93 L 474.97 511.93 L 474.97 349.57 C 474.97 342.7 480.6 337.07 487.48 337.07 L 625 337.07 L 625 418.31 C 625 428.7 633.36 437.05 643.76 437.05 L 725.03 437.05 L 725.03 511.93 L 750.03 511.93 L 750.03 415.1 C 750.03 405.18 746.04 395.58 739.01 388.55 L 673.45 323.01 C 666.42 315.98 656.88 312 646.96 312 L 487.48 312 z M 250.01 337.46 C 252.2 338.01 254.15 339.1 255.79 340.74 L 321.35 406.28 C 322.99 407.92 324.09 409.87 324.63 412.06 L 250.01 412.06 L 250.01 337.46 z M 650.01 337.46 C 652.2 338.01 654.15 339.1 655.79 340.74 L 721.35 406.28 C 722.99 407.92 724.09 409.87 724.63 412.06 L 650.01 412.06 L 650.01 337.46 z"},pageLayoutMode4:{width:800,height:512,path:"M 87.479 55.998 C 66.772 56.077 49.971 72.871 49.971 93.57 L 49.971 418.51 C 49.971 439.2 66.771 456 87.479 456 L 312.52 456 C 333.23 456 350.03 439.2 350.03 418.51 L 350.03 159.1 C 350.03 149.18 346.04 139.58 339.01 132.55 L 273.45 67.014 C 266.42 59.983 256.88 55.998 246.96 55.998 L 87.479 55.998 z M 487.48 55.998 C 466.77 56.077 449.97 72.87 449.97 93.568 L 449.97 418.51 C 449.97 439.2 466.77 456 487.48 456 L 712.52 456 C 733.23 456 750.03 439.2 750.03 418.51 L 750.03 159.1 C 750.03 149.18 746.04 139.58 739.01 132.55 L 673.45 67.014 C 666.42 59.983 656.88 55.998 646.96 55.998 L 487.48 55.998 z M 87.479 81.072 L 225 81.072 L 225 162.31 C 225 172.7 233.36 181.05 243.76 181.05 L 325.02 181.05 L 325.02 418.5 C 325.02 425.38 319.39 431.01 312.52 431.01 L 87.479 431.01 C 80.602 431.01 74.975 425.38 74.975 418.51 L 74.975 93.57 C 74.975 86.697 80.602 81.072 87.479 81.072 z M 487.48 81.072 L 625 81.072 L 625 162.31 C 625 172.7 633.36 181.05 643.76 181.05 L 725.03 181.05 L 725.03 418.5 L 725.02 418.5 C 725.02 425.38 719.39 431.01 712.52 431.01 L 487.48 431.01 C 480.6 431.01 474.97 425.38 474.97 418.51 L 474.97 93.57 C 474.97 86.697 480.6 81.072 487.48 81.072 z M 250.01 81.463 C 252.2 82.01 254.15 83.104 255.79 84.744 L 321.35 150.28 C 322.99 151.92 324.09 153.87 324.63 156.06 L 250.01 156.06 L 250.01 81.463 z M 650.01 81.463 C 652.2 82.01 654.15 83.104 655.79 84.744 L 721.35 150.28 C 722.99 151.92 724.09 153.87 724.63 156.06 L 650.01 156.06 L 650.01 81.463 z"},pageLayoutMode5:{width:800,height:512,path:"M739.01,132.548l-65.561-65.533C666.416,59.983,656.885,56,646.961,56H487.479c-20.707,0.079-37.508,16.872-37.508,37.57 v324.937c0,20.698,16.799,37.494,37.508,37.494h225.043c20.707,0,37.508-16.796,37.508-37.494V159.104 C750.029,149.184,746.041,139.578,739.01,132.548z M650.008,81.464c2.188,0.547,4.143,1.641,5.781,3.281l65.563,65.533 c1.643,1.641,2.734,3.593,3.279,5.779h-74.623V81.464z M725.025,418.505c-0.002,6.878-5.631,12.501-12.506,12.501H487.479 c-6.877,0-12.504-5.623-12.504-12.499V93.57c0-6.873,5.627-12.497,12.504-12.497h137.525v81.233 c0,10.389,8.361,18.745,18.756,18.745h81.266V418.505z"},closeFile:{width:384,height:512,path:"M369.9,97.9,286,14A48,48,0,0,0,252.1-.1H48A48.16,48.16,0,0,0,0,48V464a48,48,0,0,0,48,48H336a48,48,0,0,0,48-48V131.9A48.23,48.23,0,0,0,369.9,97.9Zm-22.6,22.7a15.73,15.73,0,0,1,4.2,7.4H256V32.5a15.73,15.73,0,0,1,7.4,4.2ZM336,480H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32H224V136a23.94,23.94,0,0,0,24,24H352V464A16,16,0,0,1,336,480ZM262.71,369.05l-5.66,5.66a12,12,0,0,1-17,0L192,326.63l-48.08,48.08a12,12,0,0,1-17,0l-5.66-5.66a12,12,0,0,1,0-17L169.37,304l-48.08-48.08a12,12,0,0,1,0-17l5.66-5.66a12,12,0,0,1,17,0L192,281.37l48.08-48.08a12,12,0,0,1,17,0l5.66,5.66a12,12,0,0,1,0,17L214.63,304l48.08,48.08A12,12,0,0,1,262.71,369.05Z"},bars:{width:448,height:512,path:"M442 114H6a6 6 0 0 1-6-6V84a6 6 0 0 1 6-6h436a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6zm0 160H6a6 6 0 0 1-6-6v-24a6 6 0 0 1 6-6h436a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6zm0 160H6a6 6 0 0 1-6-6v-24a6 6 0 0 1 6-6h436a6 6 0 0 1 6 6v24a6 6 0 0 1-6 6z"}},v=({icon:e,className:t,fill:n,bg:o,title:a})=>i("span",{class:s("pwv-icon",t),title:a},i("svg",{viewBox:`0 0 ${e.width} ${e.height}`},e.bg&&o&&i("path",{d:e.bg,fill:o}),i("path",{d:e.path,fill:n,"shape-rendering":"geometricPrecision","stroke-width":"1px"})));let w;const b={setType:e=>{w=e},bindCssTooltip:(e,t)=>{"css"===w&&(e.onmouseover=t=>{const n=t.currentTarget;let i=n.closest(".pwv-ViewerCanvas");if(i||(i=n.closest(".pwv-WebViewer")),i){n.classList.remove("pwv-tooltip-top","pwv-tooltip-left","pwv-tooltip-right","pwv-tooltip-bottom");const t=n.getBoundingClientRect(),o=i.getBoundingClientRect(),s=t.top-o.top,a=t.left-o.left,r=o.right-t.right;o.bottom,t.bottom,s<45?e.classList.add("pwv-tooltip-bottom"):e.classList.add("pwv-tooltip-top"),a<45?e.classList.add("pwv-tooltip-right"):r<45&&e.classList.add("pwv-tooltip-left")}})},createTooltip:e=>{if(e)switch(w){case"title":return{title:e};case"css":return{"data-pwv-tooltip":e};default:return}}},P=({disabled:e,text:t,icon:n,name:o,value:a,tooltip:r,width:l,className:d,items:h,align:c,hideCaret:u,renderButton:p,onChange:g})=>{const m=h.find((e=>e.value===a));!t&&m&&(t=m.text);const w=l?{width:l+"px"}:{};return i("div",{class:s("pwv-Dropdown",{"pwv-disabled":e},{"pwv-Dropdown--alignLeft":!c||"left"===c},{"pwv-Dropdown--alignRight":"right"===c},{"pwv-Dropdown--alignCenter":"center"===c},d),style:w},i("button",Object.assign({name:o},b.createTooltip(r),{oncreate:y.create,onremove:y.remove,disabled:e}),p?p(a,t):i("span",{class:"pwv-Dropdown-text"},n&&i(v,{icon:n}),t),!u&&i("span",{class:"pwv-Dropdown-caret"},i(v,{icon:f.dropdownCaret}))),!e&&i("div",{class:"pwv-DropdownPanel"},i("ul",null,h.map((e=>i("li",{class:"pwv-DropdownItem",onclick:()=>g&&g(e.value)},e.renderItem?e.renderItem(e):i("span",{class:"pwv-Dropdown-item-text"},e.text)))))))};class y{constructor(e){this.button=e,this.element=e.parentElement,this.handleOnClick=this.handleOnClick.bind(this),this.setMaxPanelHeight=this.setMaxPanelHeight.bind(this),this.button.addEventListener("click",this.handleOnClick,!1),b.bindCssTooltip(this.button),window.addEventListener("resize",this.setMaxPanelHeight)}static create(e){e.parentElement.dropdown=new y(e)}static remove(e){e.parentElement.dropdown.unmount()}unmount(){this.button.removeEventListener("click",this.handleOnClick),this.button.removeEventListener("resize",this.setMaxPanelHeight)}setMaxPanelHeight(){const e=this.element.querySelector(".pwv-DropdownPanel");if(e){const t=window.innerHeight-e.getBoundingClientRect().top;e.scrollHeight>t?(e.style.maxHeight=t-10+"px",e.classList.add("pwv-DropdownPanel--scroll")):(e.style.maxHeight="",e.classList.remove("pwv-DropdownPanel--scroll"))}}handleOnClick(e){if(!this.element.classList.contains("pwv-Dropdown--open")){this.element.classList.add("pwv-Dropdown--open"),this.setMaxPanelHeight();const t=(new Date).getTime();e.openDropdown=t;const n=e=>{e.openDropdown!==t&&(window.removeEventListener("click",n),this.element.classList.remove("pwv-Dropdown--open"))};window.addEventListener("click",n,!1)}}}const C=({icon:e,className:t,tooltip:n},o)=>i("div",{class:s("pwv-Dropdown",t)},i("button",Object.assign({class:"pwv-ToolbarButton"},b.createTooltip(n),{oncreate:y.create,onremove:y.remove}),e&&i(v,{icon:e})),i("div",{class:"pwv-DropdownPanel"},o)),A=({})=>i("div",{class:"pwv-DropdownSeparator"},i("span",null)),E=({location:e,style:t})=>(n,o)=>{const{customButtons:s}=n.options.viewer;if(!s||!s.hasOwnProperty(e)||!s[e].length)return null;const a=s[e];return"button"===t?i("div",{class:"pwv-CustomButtons"},a.map((e=>i("button",Object.assign({oncreate:b.bindCssTooltip},b.createTooltip(e.text),{class:"pwv-ToolbarButton",onclick:e.onClick}),i("span",{class:"pwv-icon"},i("img",{src:e.icon})))))):i("div",null,a.map((e=>i("button",{class:"pwv-DropdownItem",onclick:e.onClick},i("span",{class:"pwv-icon"},i("img",{src:e.icon})),e.text))))},L=({})=>(e,t)=>{const{permissions:n,callbacks:o}=e.options.viewer,{outlineNavigation:s,annotationNavigation:a}=e.options.viewer.sidebar,{screenSize:l}=e.layout;return i(m,{className:"pwv-DocumentBar"},i(C,{className:"pwv-LgHidden",icon:f.bars},i("div",null,n.allowOpenFile&&!o.onOpenFileButtonClicked&&i("label",{class:"pwv-DropdownItem"},i(v,{icon:f.openFile})," ",g.getText("toolbar.openDocument"),i("input",{accept:".pdf",type:"file",onchange:e=>{if(e.currentTarget.files&&e.currentTarget.files.length){const n=e.currentTarget.files[0];t.api.open({pdfFile:{data:n}})}},style:{display:"none"}})),n.allowOpenFile&&o.onOpenFileButtonClicked&&i("button",{class:"pwv-DropdownItem",onclick:o.onOpenFileButtonClicked},i(v,{icon:f.openFile})," ",g.getText("toolbar.openDocument")),n.allowSaveFile&&i("button",{class:"pwv-DropdownItem",onclick:()=>{o.onSaveFileButtonClicked?o.onSaveFileButtonClicked():t.api.downloadFile()}},i(v,{icon:f.saveFile})," ",g.getText("toolbar.saveDocument")),n.allowCloseFile&&i("button",{class:"pwv-DropdownItem",onclick:()=>{o.onCloseFileButtonClicked?o.onCloseFileButtonClicked():t.api.close()}},i(v,{icon:f.closeFile})," ",g.getText("toolbar.closeDocument")),n.allowPrinting&&i("button",{class:"pwv-DropdownItem",onclick:t.api.print},i(v,{icon:f.print})," ",g.getText("toolbar.print")),i(E,{location:"documentbar",style:"listItem"}),n.allowRotateView&&i(A,null),n.allowRotateView&&i("button",{class:"pwv-DropdownItem",onclick:t.api.rotate},i(v,{icon:f.rotate})," ",g.getText("toolbar.rotateView")),l===r.Small&&(s||a)&&i(A,null),l===r.Small&&s&&i("button",{class:"pwv-DropdownItem",onclick:()=>{t.api.loadNavigationItems(),t.navigationPanel.selectNavigation("outline")}},i(v,{icon:f.sidePaneOutline})," ",g.getText("sideNavigation.outline")),l===r.Small&&a&&i("button",{class:"pwv-DropdownItem",onclick:()=>{t.api.loadNavigationItems(),t.navigationPanel.selectNavigation("annotation")}},i(v,{icon:f.sidePaneAnnotation})," ",g.getText("sideNavigation.annotation")))))},S=({icon:e,disabled:t,active:n,name:o,onClick:a,tooltip:r,className:l},d)=>i("button",t?Object.assign({name:o,disabled:t,oncreate:b.bindCssTooltip},b.createTooltip(r),{class:s("pwv-ToolbarButton","pwv-ToolbarButton--disabled",l)}):Object.assign({name:o,oncreate:b.bindCssTooltip},b.createTooltip(r),{class:s("pwv-ToolbarButton",l,{"pwv-ToolbarButton--selected":n}),onclick:e=>{a&&a(e)}}),e&&i(v,{icon:e}),d.length>0&&i("span",{class:"pwv-ToolbarButton__Text"},d)),x=({icon:e,accept:t,className:n,tooltip:o,disabled:a,name:r,onFileSelected:l})=>a?i("div",Object.assign({oncreate:b.bindCssTooltip},b.createTooltip(o),{class:s("pwv-ToolbarButton","pwv-ToolbarButton--disabled",n)}),i(v,{icon:e})):i("label",Object.assign({name:r,tabindex:"auto",oncreate:b.bindCssTooltip},b.createTooltip(o),{class:s("pwv-ToolbarButton",n)}),i(v,{icon:e}),i("input",{style:{display:"none"},type:"file",accept:t,onchange:e=>{if(l&&e.currentTarget.files&&e.currentTarget.files.length){const t=e.currentTarget.files[0];l(t),e.currentTarget.value=""}},oncreate:e=>{const t="fi_"+performance.now();e.id=t,e.parentElement.setAttribute("for",t)}})),T=({})=>(e,t)=>{const{permissions:n,callbacks:o}=e.options.viewer;return i(m,{className:"pwv-DocumentBar"},n.allowOpenFile&&!o.onOpenFileButtonClicked&&i(x,{name:"openDocument",className:"pwv-MdHidden pwv-SmHidden",icon:f.openFile,accept:".pdf",tooltip:g.getText("toolbar.openDocument"),onFileSelected:e=>t.api.open({pdfFile:{data:e}})}),n.allowOpenFile&&o.onOpenFileButtonClicked&&i(S,{name:"openDocument",className:"pwv-MdHidden pwv-SmHidden",icon:f.openFile,tooltip:g.getText("toolbar.openDocument"),onClick:o.onOpenFileButtonClicked}),n.allowSaveFile&&i(S,{name:"saveDocument",className:"pwv-MdHidden pwv-SmHidden",icon:f.saveFile,tooltip:g.getText("toolbar.saveDocument"),onClick:()=>{var n;if(o.onSaveFileButtonClicked)o.onSaveFileButtonClicked();else{const i=null===(n=e.passwordForm)||void 0===n?void 0:n.password;t.api.downloadFile(i?{password:i}:void 0)}}}),n.allowCloseFile&&i(S,{name:"closeDocument",className:"pwv-MdHidden pwv-SmHidden",icon:f.closeFile,tooltip:g.getText("toolbar.closeDocument"),onClick:()=>{o.onCloseFileButtonClicked?o.onCloseFileButtonClicked():t.api.close()}}),n.allowPrinting&&i(S,{name:"print",className:"pwv-MdHidden pwv-SmHidden",icon:f.print,tooltip:g.getText("toolbar.print"),onClick:t.api.print}),i(E,{location:"documentbar",style:"button"}))},O=new ResizeObserver((e=>{e.length&&e.forEach((e=>{if(e.target&&e.target.parentElement){const t=e.target.parentElement.querySelector("input");t&&(t.style.minWidth=`${e.contentRect.width+4}px`)}}))})),M=({})=>(e,t)=>{const{pdfDocument:n}=e;return i(m,{className:"pwv-NavigationBar"},i(S,{name:"previewsPage",tooltip:g.getText("toolbar.previewsPage"),icon:f.previousPage,onClick:()=>t.api.previousPage(),disabled:n.pageNumber<=1}),i("div",{class:"pwv-ToolbarItem pwv-navigation-toolbar-pageinput"},i("input",{name:"pageNumber",value:n.pageNumber,onkeydown:e=>{if("ArrowDown"===e.key)t.api.nextPage();else if("ArrowUp"===e.key)t.api.previousPage();else if("Enter"===e.key){const n=e.currentTarget;n&&n.value&&t.api.setPageNumber(parseInt(n.value,void 0))}else e.key.charCodeAt(0)>=48&&e.key.charCodeAt(0)<=57||"Delete"===e.key||"Backspace"===e.key||"ArrowLeft"===e.key||"ArrowRight"===e.key||"Tab"===e.key||e.preventDefault();e.stopPropagation()},onblur:e=>{let n=parseInt(e.target.value,void 0);if(Number.isNaN(n))n=t.api.getPageNumber();else if(n<1)n=1;else{const e=t.api.getPageCount();n>e&&(n=e)}e.target.value=n.toString(),t.api.setPageNumber(n)},disabled:n.pageCount<1}),i("span",null,g.getText("toolbar.pageOf")),i("label",{oncreate:e=>{O.observe(e)},onremove:e=>{O.unobserve(e)}},n.pageCount)),i(S,{name:"nextPage",tooltip:g.getText("toolbar.nextPage"),icon:f.nextPage,onClick:()=>t.api.nextPage(),disabled:n.pageNumber===n.pageCount}))},R=({})=>(e,t)=>{const{defaultZoomLevels:n}=e.options.viewer.general,{zoom:o}=e.pdfDocument;return i(m,{className:"pwv-ZoomBar"},i(S,{name:"zoomIn",tooltip:g.getText("toolbar.zoomIn"),className:"pwv-MdHidden pwv-SmHidden",icon:f.zoomIn,disabled:o>=100*n[n.length-1],onClick:()=>t.api.zoomIn()}),i(S,{name:"zoomOut",tooltip:g.getText("toolbar.zoomOut"),className:"pwv-MdHidden pwv-SmHidden",icon:f.zoomOut,disabled:o<=100*n[0],onClick:()=>t.api.zoomOut()}),i(P,{name:"zoom",tooltip:g.getText("toolbar.zoom"),className:"pwv-Dropdown-zoom",items:n.map((e=>({value:100*e,text:Math.floor(100*e)+"%"}))),value:o,text:Math.floor(o)+"%",align:"right",onChange:e=>t.api.setZoom(e)}))},N=(e,t,n=["INPUT","SELECT","TEXTAREA"])=>{if(!t||n.includes(e.target.nodeName))return[];let i=[];return Object.keys(t).forEach((n=>{const o=t[n];o&&(e.key.length>1?e.key:e.key.toLowerCase())===o.key&&e.altKey===Boolean(o.altKey)&&e.ctrlKey===Boolean(o.ctrlKey)&&e.shiftKey===Boolean(o.shiftKey)&&i.push([n,t[n].superKey])})),i},V=e=>(t,n)=>e.disabled?i("div",{title:g.getText("search.options"),class:"pwv-Dropdown pwv-searchoptions pwv-disabled pwv-Dropdown--alignRight"},i("span",{class:"pwv-Dropdown-text"},i(v,{icon:f.options})),i("span",{class:"pwv-Dropdown-caret"},i(v,{icon:f.dropdownCaret}))):i("div",{class:"pwv-Dropdown pwv-searchoptions pwv-Dropdown--alignRight"},i("button",Object.assign({},b.createTooltip(g.getText("search.options")),{oncreate:y.create,onremove:y.remove}),i("span",{class:"pwv-Dropdown-text"},i(v,{icon:f.options})),i("span",{class:"pwv-Dropdown-caret"},i(v,{icon:f.dropdownCaret}))),i("div",{class:"pwv-DropdownPanel"},i("ul",null,i("li",{class:"pwv-checkbox-btn",onclick:e=>{const t=n.search.toggleCaseSensitive();e.preventDefault(),e.cancelBubble=!0,""!==t.searchString&&n.api.startSearch()}},t.search.caseSensitive?i(v,{icon:f.checkboxChecked}):i(v,{icon:f.checkbox}),g.getText("search.optionCaseSensitive")),i("li",{class:"pwv-checkbox-btn",onclick:e=>{const t=n.search.toggleWrappingSearch();e.preventDefault(),e.cancelBubble=!0,""!==t.searchString&&n.api.startSearch()}},t.search.wrapSearch?i(v,{icon:f.checkboxChecked}):i(v,{icon:f.checkbox}),g.getText("search.optionWrap")),i("li",{class:"pwv-checkbox-btn",onclick:e=>{const t=n.search.toggleRegex();e.preventDefault(),e.cancelBubble=!0,""!==t.searchString&&n.api.startSearch()}},t.search.useRegex?i(v,{icon:f.checkboxChecked}):i(v,{icon:f.checkbox}),g.getText("search.optionRegularExpression"))))),D=({})=>(e,t)=>i(h,{className:"pwv-SearchBar"},i(m,null,i("div",{class:"pwv-ToolbarItem pwv-searchbar-input"},i("input",{value:e.search.searchString,class:"pwv-SearchInputField",oncreate:n=>{n.focus(),n.addEventListener("keydown",(t=>{t.cancelBubble=!0;const{shortcuts:n}=e.options,i=N(t,n,[]);(null==i?void 0:i.length)&&(i.some((e=>"searchNext"===e[0]))||i.some((e=>"searchPrevious"===e[0]))||i.some((e=>"closeSearch"===e[0])))&&t.preventDefault()}),!1),n.addEventListener("input",(e=>{const n=e.currentTarget.value;t.search.updateToSearch(n),""!==n?t.api.startSearch():t.api.endSearch()})),n.addEventListener("keyup",(n=>{n.cancelBubble=!0;const i=n.currentTarget.value,{shortcuts:o}=e.options,s=N(n,o,[]);(null==s?void 0:s.some((e=>"searchNext"===e[0])))?(n.preventDefault(),t.api.nextSearchMatch()):(null==s?void 0:s.some((e=>"searchPrevious"===e[0])))?(n.preventDefault(),t.api.previousSearchMatch()):(null==s?void 0:s.some((e=>"closeSearch"===e[0])))?(n.preventDefault(),t.api.endSearch(),t.search.closeSearch()):"Enter"===n.key||"ArrowDown"===n.key?""!==i&&t.api.nextSearchMatch():"ArrowUp"===n.key?""!==i&&t.api.previousSearchMatch():"Escape"===n.key&&(t.api.endSearch(),t.search.closeSearch())}),!1)}})),i(S,{tooltip:g.getText("search.previousMatch"),icon:f.previousPage,disabled:""===e.search.searchString,onClick:t.api.previousSearchMatch}),i(S,{tooltip:g.getText("search.nextMatch"),icon:f.nextPage,disabled:""===e.search.searchString,onClick:t.api.nextSearchMatch}),i(V,null),i(c,null)),i(m,{pushRight:!0},i(S,{icon:f.close,onClick:()=>{t.api.endSearch(),t.search.closeSearch()}})));var k,I,F,B,j,z,H,G,W,_,U,X,Y,K;!function(e){e[e.Pdf=0]="Pdf",e[e.Fdf=1]="Fdf"}(k||(k={})),function(e){e[e.ANNOTATION=1]="ANNOTATION",e[e.TEXT_FRAGMENT=2]="TEXT_FRAGMENT",e[e.OUTLINE=3]="OUTLINE",e[e.DESTINATION=4]="DESTINATION",e[e.CONTENT_ELEMENT=5]="CONTENT_ELEMENT"}(I||(I={})),function(e){e[e.SOLID=0]="SOLID",e[e.DASHED=1]="DASHED",e[e.BEVELED=2]="BEVELED",e[e.INSET=3]="INSET",e[e.UNDERLINE=4]="UNDERLINE"}(F||(F={})),function(e){e[e.GREEN=0]="GREEN",e[e.RED=1]="RED",e[e.BLUE=2]="BLUE"}(B||(B={})),function(e){e[e.CHECK_BOX=1]="CHECK_BOX",e[e.RADIO_BUTTON=2]="RADIO_BUTTON",e[e.TEXT_BOX=3]="TEXT_BOX",e[e.LIST_BOX=4]="LIST_BOX",e[e.COMBO_BOX=5]="COMBO_BOX"}(j||(j={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.TEXT=1]="TEXT",e[e.LINK=2]="LINK",e[e.FREE_TEXT=3]="FREE_TEXT",e[e.LINE=4]="LINE",e[e.SQUARE=5]="SQUARE",e[e.CIRCLE=6]="CIRCLE",e[e.POLYGON=7]="POLYGON",e[e.POLY_LINE=8]="POLY_LINE",e[e.HIGHLIGHT=9]="HIGHLIGHT",e[e.UNDERLINE=10]="UNDERLINE",e[e.SQUIGGLY=11]="SQUIGGLY",e[e.STRIKE_OUT=12]="STRIKE_OUT",e[e.STAMP=13]="STAMP",e[e.CARET=14]="CARET",e[e.INK=15]="INK",e[e.POPUP=16]="POPUP",e[e.FILE_ATTACHMENT=17]="FILE_ATTACHMENT",e[e.SOUND=18]="SOUND",e[e.MOVIE=19]="MOVIE",e[e.WIDGET=20]="WIDGET",e[e.SCREEN=21]="SCREEN",e[e.PRINTER_MARK=22]="PRINTER_MARK",e[e.TRAP_NET=23]="TRAP_NET",e[e.WATERMARK=24]="WATERMARK",e[e.THREED=25]="THREED"}(z||(z={})),function(e){e[e.FIT=1]="FIT",e[e.FITH=2]="FITH",e[e.FITV=3]="FITV",e[e.FITR=4]="FITR",e[e.FITB=5]="FITB",e[e.FITBH=6]="FITBH",e[e.FITBV=7]="FITBV",e[e.XYZ=8]="XYZ"}(H||(H={})),function(e){e[e.NONE=0]="NONE",e[e.FIT_WIDTH=1]="FIT_WIDTH",e[e.FIT_PAGE=2]="FIT_PAGE"}(G||(G={})),function(e){e[e.SINGLE_PAGE=0]="SINGLE_PAGE",e[e.ONE_COLUMN=1]="ONE_COLUMN",e[e.TWO_COLUMN_LEFT=2]="TWO_COLUMN_LEFT",e[e.TWO_COLUMN_RIGHT=3]="TWO_COLUMN_RIGHT",e[e.TWO_PAGE_LEFT=4]="TWO_PAGE_LEFT",e[e.TWO_PAGE_RIGHT=5]="TWO_PAGE_RIGHT"}(W||(W={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.GO_TO=1]="GO_TO",e[e.URI=2]="URI"}(_||(_={})),function(e){e[e.TEXT=0]="TEXT",e[e.IMAGE=1]="IMAGE"}(U||(U={})),function(e){e[e.OK=0]="OK",e[e.NO_RESULT=1]="NO_RESULT",e[e.END=2]="END"}(X||(X={})),function(e){e[e.NONE=0]="NONE",e[e.ANNOTATION=1]="ANNOTATION",e[e.CONTENT=2]="CONTENT"}(Y||(Y={})),function(e){e[e.CLOCKWISE=90]="CLOCKWISE",e[e.COUNTERCLOCKWISE=270]="COUNTERCLOCKWISE"}(K||(K={}));const Z={[z.TEXT]:[!0,!1,!0,!0,!1,!1,!1,!0,!1,!1],[z.LINK]:[!1,!1,!1,!0,!1,!1,!1,!1,!0,!1],[z.FREE_TEXT]:[!0,!1,!0,!0,!0,!0,!0,!1,!1,!1],[z.LINE]:[!0,!1,!0,!0,!1,!0,!0,!0,!1,!1],[z.SQUARE]:[!0,!1,!0,!0,!1,!0,!0,!0,!1,!1],[z.CIRCLE]:[!0,!1,!0,!0,!1,!0,!0,!0,!1,!1],[z.POLYGON]:[!0,!1,!0,!0,!1,!0,!0,!0,!1,!1],[z.POLY_LINE]:[!0,!1,!0,!0,!1,!0,!0,!0,!1,!1],[z.HIGHLIGHT]:[!0,!1,!0,!1,!1,!1,!1,!0,!1,!0],[z.UNDERLINE]:[!0,!1,!0,!1,!1,!1,!1,!0,!1,!0],[z.SQUIGGLY]:[!0,!1,!0,!1,!1,!1,!1,!0,!1,!0],[z.STRIKE_OUT]:[!0,!1,!0,!1,!1,!1,!1,!0,!1,!0],[z.STAMP]:[!0,!1,!0,!0,!0,!0,!1,!0,!1,!1],[z.CARET]:[!0,!1,!0,!1,!1,!1,!1,!0,!1,!1],[z.INK]:[!0,!1,!0,!0,!1,!0,!0,!0,!1,!1],[z.POPUP]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.FILE_ATTACHMENT]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.SOUND]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.MOVIE]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.WIDGET]:[!0,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.SCREEN]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.PRINTER_MARK]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.TRAP_NET]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.WATERMARK]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1],[z.THREED]:[!1,!1,!1,!1,!1,!1,!1,!1,!1,!1]},q=/Firefox/i.test(navigator.userAgent);class ${constructor(e){if(this._imageBitmap=null,this._imageData=null,this._htmlCanvas=null,e.bufferView){if(!e.hasImageData)throw new Error("Cannot create an image container of image without imageData");if(this._imageData=new ImageData(new Uint8ClampedArray(e.bufferView),e.width,e.height),e.removeImageData(),q||"function"!=typeof window.createImageBitmap){this._htmlCanvas=document.createElement("canvas"),this._htmlCanvas.width=e.width,this._htmlCanvas.height=e.height;const t=this._htmlCanvas.getContext("2d");t&&t.putImageData(this._imageData,0,0)}else createImageBitmap(this._imageData).then((e=>{this._imageBitmap=e}))}}get scaledImage(){return this._imageBitmap?this._imageBitmap:this._htmlCanvas}get imageData(){return this._imageData}destroy(){this._imageBitmap=null,this._imageData=null,this._htmlCanvas=null}}var Q=function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function r(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}l((i=i.apply(e,t||[])).next())}))},J=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,o){!function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)}(i,o,(t=e[n](t)).done,t.value)}))}}};class ee{constructor(t,n){this.pdfDocument=null,this.objectUrls=[],this.view=null,this.textFragmentCache=new Map,this.nativeAnnotationCache=new Map,this.handleAnnotationCache=new Map,this.pageAnnotationCache=new Map,this.imageBitmapCache=new Map,this.ignoreDocumentPreferences=!1,this.nativeOutlines=new Map,this.devicePixelRatio=window.devicePixelRatio,this.xDPI=0,this.yDPI=0,e.Sdk.initialize(t,e.Sdk.version),this.validateViewingSdkVersion(),this.pdfViewerApiOptions=n,this.licenseFeatures=e.Sdk.supportedFeatures,this.pdfController=new e.ViewerController,this.eventListeners=new Map,this.viewportSize=new e.Pdf.Geometry.Real.Size(0,0),this.pdfStampDocuments=new Map,this.registeredPdfStamps=new Map,this.attachEventListeners=this.attachEventListeners.bind(this),this.onDocumentOpened=this.onDocumentOpened.bind(this),this.onViewUpdated=this.onViewUpdated.bind(this),this.onImageCreated=this.onImageCreated.bind(this),this.onImageRemovedFromCache=this.onImageRemovedFromCache.bind(this),this.getAnnotationsFromPage=this.getAnnotationsFromPage.bind(this)}getIgnoringPreferences(){return this.ignoreDocumentPreferences}setIgnoringPreferences(e){this.ignoreDocumentPreferences=e}open(t,n,i,o,s,a){return new Promise(((r,l)=>{const d=(n,i)=>{try{let o="application/pdf";i===k.Fdf&&(o="application/vnd.fdf");const{data:s}=n;let a="",r=new e.IO.HttpOptions;if(s)a=URL.createObjectURL(new File([s],t.sourceTag||"",{type:o}));else{const e=n;if(a=e.uri,e.httpOptions){const{headers:t,mode:n,cache:i,credentials:o,redirect:s,referrerPolicy:a}=e.httpOptions;void 0===n&&void 0===i&&void 0===o&&void 0===s&&void 0===a||console.warn("\n You are using a property that has been deprecated for stability reasons on iOS. \n Affected properties are: mode, cache, credentials, redirect, referrerPolicy.\n If you want to continue using one of these properties, please switch to the separate build that is now available at: https://pdftools-public-downloads-production.s3.eu-west-1.amazonaws.com/productkits/VIEWWEB/4.3.6/extended/pdf-tools-four-heights-pdf-web-viewer-__WebViewerVersion__.tar.gz\n You can read more about this in our docs: https://www.pdf-tools.com/public/downloads/manuals/PdfWebViewer.pdf\n "),t&&Object.keys(t).forEach((e=>{var n;null===(n=r.headers)||void 0===n||n.set(e,t[e])})),r.credentials=null,r.cache=null,r.mode=null,r.redirect=null,r.referrerPolicy=null}}return new e.IO.InputUri(a,r,t.sourceTag)}catch(e){throw new Error("failed to create InputDocument")}},h=d(t,k.Pdf),c=new e.IO.InputDocumentList;n&&n.length&&n.forEach((e=>{const t=d(e,k.Fdf);t&&c.add(t)}));const u=(t=>{try{if(!t)return null;const n=new e.Pdf.ViewOptions;if(n.initialDestination=null,"number"==typeof t.initialFitMode&&(n.initialFitMode=this.WwFitModeToViewingFitMode(t.initialFitMode)),"number"==typeof t.initialPageLayoutMode&&(n.initialPageLayoutMode=this.WwPageLayoutToViewingPageLayout(t.initialPageLayoutMode)),"number"==typeof t.initialPageNumber||"number"==typeof t.initialZoom){const i="number"==typeof t.initialPageNumber?t.initialPageNumber:1,o="number"==typeof t.initialZoom?t.initialZoom:null;n.initialDestination=new e.Pdf.Navigation.LocationZoomDestination(i,null,null,o)}return"object"==typeof a&&(this.viewportSize=new e.Pdf.Geometry.Integer.Size(a.width,a.height),n.viewportSize=this.viewportSize),n}catch(e){throw console.error(e),new Error("failed to create View Options")}})(o),p=(t=>{try{if(!t)return null;const n=new e.Pdf.RenderOptions;return t.formFieldHighlightColor&&(n.formFieldHighlightColor=this.createNativeColor(t.formFieldHighlightColor)),t.formFieldRequiredHighlightColor&&(n.formFieldRequiredHighlightColor=this.createNativeColor(t.formFieldRequiredHighlightColor)),n}catch(e){throw new Error("failed to create Render Options")}})(s);this.pdfController.open(h,c,i).then((e=>{this.pdfDocument=e,this.onDocumentOpened(e,p,u),r()})).catch((e=>{console.warn(e),l(e)}))}))}save(t){const{fileType:n,annotationFilter:i,password:o}=t||{},s=new e.Pdf.SaveOptions;return n===k.Fdf?s.fileType=e.IO.FileType.Fdf:s.fileType=e.IO.FileType.Pdf,s.annotationFilter=i?this.createAnnotationFilter(i):null,o&&(s.password=o),new Promise(((e,t)=>{this.pdfDocument?this.pdfDocument.save(s).then((n=>{if(n.bufferData){const t=new Blob([n.bufferData]);n.close(),e(t)}else t("Returned save buffer is null")})).catch((e=>{console.warn(e),t(e)})):t("No document opened")}))}close(){var t,n;this.nativeAnnotationCache.forEach((t=>{var n;t instanceof e.Pdf.Annotations.MarkupAnnotation&&(null===(n=t.info)||void 0===n||n.close()),t.close()})),this.nativeAnnotationCache.clear(),this.handleAnnotationCache.clear(),this.pageAnnotationCache.clear(),this.textFragmentCache.clear(),this.objectUrls.forEach((e=>{URL.revokeObjectURL(e)})),this.objectUrls=[],this.nativeOutlines.forEach((e=>{e.close()})),this.nativeOutlines.clear(),null===(t=this.view)||void 0===t||t.close(),null===(n=this.pdfDocument)||void 0===n||n.close(),this.pdfDocument=null}destroy(){this.view&&(this.view.removeEventListener("viewUpdated",this.onViewUpdated),this.view.removeEventListener("imageCreated",this.onImageCreated),this.view.removeEventListener("imageRemovedFromCache",this.onImageRemovedFromCache)),this.close(),this.pdfStampDocuments.forEach((e=>{e.close()})),this.pdfController.close(),this.imageBitmapCache.forEach((e=>{e.destroy()})),this.nativeOutlines.clear(),this.imageBitmapCache.clear(),this.textFragmentCache.clear(),this.nativeAnnotationCache.clear(),this.handleAnnotationCache.clear(),this.pageAnnotationCache.clear(),this.pdfStampDocuments.clear(),this.registeredPdfStamps.clear()}registerPdfStampFile(e,t,n){const i=URL.createObjectURL(new File([t],e,{type:"application/pdf"}));this.objectUrls.push(i),this.pdfController.openUri(i,null,null,null,null).then((t=>{this.pdfStampDocuments.set(e,t),(()=>{Q(this,void 0,void 0,(function*(){var i,o,s,a;const r=Array.from({length:t.pageCount},((e,t)=>t+1));let l=0,d=0;const h={};try{for(var c,u=J(r);!(c=yield u.next()).done;){let e=c.value;const n=yield t.getPagePdfSize(e);h[e]=n,l=Math.max(n.height,l),d=Math.max(n.width,d)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=u.return)&&(yield o.call(u))}finally{if(i)throw i.error}}const p=Math.max(l/100,d/200);try{for(var g,m=J(r);!(g=yield m.next()).done;){let i=g.value;const o=h[i],s=o.width/o.height,a=yield t.renderPage(i,o.width/p,o.height/p,0),r=document.createElement("canvas");r.width=a.width,r.height=a.height;const l=r.getContext("2d"),d=new ImageData(new Uint8ClampedArray(a.bufferView),a.width,a.height);l.putImageData(d,0,0);const c=r.toDataURL("png");n({pdfStampFileName:e,name:`${e} - ${i}`,pageNumber:i,thumbnail:c,aspectRatio:s})}}catch(e){s={error:e}}finally{try{g&&!g.done&&(a=m.return)&&(yield a.call(m))}finally{if(s)throw s.error}}}))})()})).catch((e=>{console.warn(e)}))}getPageCount(){return this.pdfDocument?this.pdfDocument.pageCount:null}registerImage(e){return new Promise(((t,n)=>{if(this.pdfDocument){const n=URL.createObjectURL(new Blob([e]));this.pdfDocument.registerImageUri(n,null).then((e=>{t(e)}))}}))}registerPdfPage(e,t){return new Promise(((n,i)=>Q(this,void 0,void 0,(function*(){if(this.pdfDocument){const i=this.pdfStampDocuments.get(e);if(i){const o=`${e}__${t}`,s=this.registeredPdfStamps.get(o);if(s)n(s);else{const e=yield this.pdfDocument.registerPdfPage(i,t);this.registeredPdfStamps.set(o,e),n(e)}}else n(0)}}))))}getPageNumber(){return this.view?this.view.pageNumber:0}getFitMode(){var e,t=null===(e=this.view)||void 0===e?void 0:e.fitMode;if(void 0===t)throw new Error("Invalid fit mode");return t}setFitMode(e){this.view&&(this.view.fitMode=e)}setPageNumber(e){this.view&&(this.view.pageNumber=e)}getZoom(){return this.view?this.view.zoom:0}setZoom(t,n){if(this.view)if(n){const i=new e.Pdf.Geometry.Integer.Point(n.x,n.y);this.view.zoomOnLocation(t,i)}else this.view.zoom=t}getRotation(){return this.view?this.view.viewRotation:0}setRotation(e){this.view&&(this.view.viewRotation=e)}setBorderSize(e){this.view&&(this.view.borderSize=e)}getBorderSize(){return this.view?this.view.borderSize:0}suspendDrawing(){var e;null===(e=this.view)||void 0===e||e.suspendDrawing()}resumeDrawing(){var e;null===(e=this.view)||void 0===e||e.resumeDrawing()}renderCanvas(t,n){var i;if(this.view){this.viewportSize.width==t.canvas.width&&this.viewportSize.height==t.canvas.height||(this.viewportSize.width=t.canvas.width,this.viewportSize.height=t.canvas.height,this.view.viewportSize=new e.Pdf.Geometry.Integer.Size(t.canvas.width,t.canvas.height));const o=null===(i=this.view)||void 0===i?void 0:i.getRenderedResults();o&&(this.drawImages(t,o,n),o.close())}}renderPage(t,n,i,o){let s=null;return o&&(s=new e.Pdf.RenderOptions,s.annotationFilter=this.createAnnotationFilter(o)),new Promise(((e,o)=>{var a;null===(a=this.pdfDocument)||void 0===a||a.renderPage(t,n,i,0,s).then((n=>{const i=n.bufferView;i||o();let s={};s.page=t,s.imageData=new ImageData(new Uint8ClampedArray(i),n.width,n.height),n.close(),e(s)})).catch((e=>{"Document was closed before operation could finish"!==e.message&&o(`failed to render page ${t}`)}))}))}rotatePage(e,t){var n;const i=null===(n=this.pdfDocument)||void 0===n?void 0:n.pages.get(e-1);i&&(i.rotatePage(t===K.CLOCKWISE?90:-90),this.dispatchEvent("pageChanged",e))}getPagePdfSize(e){return new Promise(((t,n)=>{var i;null===(i=this.pdfDocument)||void 0===i||i.getPagePdfSize(e).then((e=>{t(e)}))}))}setLicenseKey(t){try{return e.Sdk.initialize(t,e.Sdk.version),!0}catch(e){return!1}}getSupportedFeatures(){return e.Sdk.supportedFeatures}hasChanges(){if(this.pdfDocument){const t=this.pdfDocument.hasChanges;let n=Y.NONE;return t&e.Pdf.DocumentChange.Annotation&&(n|=Y.ANNOTATION),t&e.Pdf.DocumentChange.Content&&(n|=Y.CONTENT),n}return null}getSearchIterator(e,t,n,i,o){var s;try{return null===(s=this.pdfDocument)||void 0===s?void 0:s.searchText(e,t,n,i,o)}catch(e){if("Invalid search text"!==e.message)throw e;console.warn(e.message)}}getTextFragmentOnPoint(t){var n;const i=new e.Pdf.Geometry.Integer.Point(t.x,t.y);if(null===this.pdfDocument)return null;try{const e=null===(n=this.view)||void 0===n?void 0:n.getTextFragmentsOnPoint(i);let t=null;if(e&&e.size>0){const n=e.get(0);t=this.createWebViewerFragment(n),n.close(),null==e||e.close()}return t}catch(e){return null}}getWordOnPoint(t){var n;const i=new e.Pdf.Geometry.Real.PointOnPage(t.page,t.pdfX,t.pdfY);try{const e=null===(n=this.view)||void 0===n?void 0:n.getWordOnPoint(i);if(e){const{textArea:t}=e;if(t){const n=[];for(let e=0;e<t.size;e++)n.push(t.get(e));t.close(),e.close();const i=n[0];if(i){const{bottomLeft:e,bottomRight:t,topRight:o,topLeft:s,pageNumber:a}=i;return{quadrilaterals:n,startPoint:{pdfX:Math.min(e.x,t.x,o.x,s.x),pdfY:Math.max(e.y,t.y,o.y,s.y),page:a},endPoint:{pdfX:Math.max(e.x,t.x,o.x,s.x),pdfY:Math.min(e.y,t.y,o.y,s.y),page:a}}}}}}catch(e){}return null}getTextSelection(t,n){var i;const o=new e.Pdf.Geometry.Real.PointOnPage(t.page,t.pdfX,t.pdfY),s=new e.Pdf.Geometry.Real.PointOnPage(n.page,n.pdfX,n.pdfY);try{const e=null===(i=this.view)||void 0===i?void 0:i.getTextSelection(o,s);if(e){const{textArea:i}=e;if(i){const o=[];for(let e=0;e<i.size;e++)o.push(i.get(e));return i.close(),e.close(),{quadrilaterals:o,startPoint:t,endPoint:n}}}}catch(e){}return null}getRectangularTextSelection(t,n){var i;const o=new e.Pdf.Geometry.Real.PointOnPage(t.page,t.pdfX,t.pdfY),s=new e.Pdf.Geometry.Real.PointOnPage(n.page,n.pdfX,n.pdfY);try{const e=null===(i=this.view)||void 0===i?void 0:i.getRectangularTextSelection(o,s);if(e){const{textArea:i}=e;if(i){const o=[];for(let e=0;e<i.size;e++)o.push(i.get(e));return i.close(),e.close(),{quadrilaterals:o,startPoint:t,endPoint:n}}}}catch(e){}return null}getText(t,n){var i;const o=new e.Pdf.Geometry.Real.PointOnPage(t.page,t.pdfX,t.pdfY),s=new e.Pdf.Geometry.Real.PointOnPage(n.page,n.pdfX,n.pdfY);try{const e=null===(i=this.view)||void 0===i?void 0:i.getTextSelection(o,s);if(e){const{text:t}=e;return e.close(),t}}catch(e){}return null}getTextForRectangularSelection(t,n){var i;const o=new e.Pdf.Geometry.Real.PointOnPage(t.page,t.pdfX,t.pdfY),s=new e.Pdf.Geometry.Real.PointOnPage(n.page,n.pdfX,n.pdfY);try{const e=null===(i=this.view)||void 0===i?void 0:i.getRectangularTextSelection(o,s);if(e){const{text:t}=e;return e.close(),t}}catch(e){}return null}createWebViewerFragment(e){const t={};t.glyphOffsets=e.glyphOffsets?e.glyphOffsets:[],t.text=e.text||"";const n=e.rectangleOnPage;return n&&(t.pdfRect=this.ViewingPdfRect2WwPdfRect(n)),t}getIsOpen(){return null!==this.pdfDocument}getOutlines(e){return new Promise(((t,n)=>{this.pdfDocument?(null!==e&&(e=this.nativeOutlines.get(e.id)),this.pdfDocument.getOutlines(e).then((e=>{const n=[];for(let t=0;t<e.size;t++){const i=e.get(t),o={};o.id=i.getHashCode(),o.title=i.title||"",o.hasDescendants=i.hasChildren,o.destination=i.destination,this.nativeOutlines.set(i.getHashCode(),i),n.push(o)}e.close(),t(n)})).catch((e=>{"Document was closed before operation could finish"!==e.message&&n("failed to get outlines")}))):n()}))}goTo(e){null!=e&&this.goToPage(e.pageNumber,e.left,e.top,e.zoom)}goToPage(t,n=null,i=null,o=null){if(this.view){const s=new e.Pdf.Navigation.LocationZoomDestination(t,n,i,o);this.view.goToDestination(s)}}goToRectangle(t){if(this.view){const n=new e.Pdf.Geometry.Real.RectangleOnPage(t.page,t.pdfX,t.pdfY,t.pdfW,t.pdfH);this.view.goToRectangle(n)}}getAnnotationsFromPage(e){return new Promise(((t,n)=>{var i;null===(i=this.pdfDocument)||void 0===i||i.getAnnotations(e).then((n=>{var i;const o={};o.page=e,o.itemCategory=1,o.items=[];for(let t=0;t<n.size;t++){const s=n.get(t),a=this.createWebViewerAnnotation(s,e);a&&(o.items.push(a),this.nativeAnnotationCache.set(a.id,s),this.handleAnnotationCache.set(a.id,a),this.pageAnnotationCache.has(e)||this.pageAnnotationCache.set(e,[]),null===(i=this.pageAnnotationCache.get(e))||void 0===i||i.push(a))}t(o)})).catch((t=>{"Document was closed before operation could finish"!==t.message&&n(`Failed to get annotations for page ${e}, ${t}`)}))}))}deleteItem(e){return this.deleteAnnotation(e)}validateViewingSdkVersion(){const t=e=>{const t=e.match(/(\d+)\.(\d+)\.(\d+)[\-]{0,1}(\w*)[\.]{0,1}(\d*)/);if(t)return{major:parseInt(t[1]),minor:parseInt(t[2]),patch:parseInt(t[3]),type:t[4],buildId:parseInt(t[5])}},n=t("4.3.6-rc.17600"),i=t(e.Sdk.version);n&&i?n.major===i.major&&n.minor===i.minor&&n.patch===i.patch&&(!n.type||n.buildId===i.buildId)||console.warn(`**************************************\nVersion mismatch between PDF Viewing SDK and PDF Web Viewer\n\nMost likely, the static assets of the PDF Viewing SDK have not been copied to the configured location. For more information please consult the documentation ("static assets").\n\nCurrent version: ${i.major}.${i.minor}.${i.patch}\nRequired version: ${n.major}.${n.minor}.${n.patch}${n.type?` (${n.type.toUpperCase()} version)`:""}\n\n**************************************`):console.warn("The PDF Viewing SDK version number has an incorrect format")}deleteAnnotation(e){return new Promise(((t,n)=>{var i;const o=e.id,s=this.nativeAnnotationCache.get(o),a=e.page;s&&(null===(i=this.pdfDocument)||void 0===i||i.deleteAnnotation(s).then((()=>{s.close(),this.nativeAnnotationCache.delete(o),this.handleAnnotationCache.delete(o),this.dispatchEvent("itemDeleted",{page:a,id:o,categoryType:1}),this.dispatchEvent("pageChanged",a),t()})))}))}getItem(e){return this.handleAnnotationCache.has(e)?this.handleAnnotationCache.get(e):null}createItem(e){return this.createAnnotation(e)}createAnnotationFilter(e){return t=>{const{pageNumber:n}=t.boundingBox,i=this.createWebViewerAnnotation(t,n);return t.close(),e(i)}}createMarkupAnnotation(t){const n=this.createNativeColor(t.color),i=this.createNativeColor(t.fillColor);let o=e.Pdf.Annotations.BorderStyleType.Lined;const s=new e.Pdf.Annotations.AnnotationStroke;t.border&&(s.lineWidth=t.border.width,o=this.convertToNativeBorderStyle(t.border.style),1===t.border.style&&(s.dashArray=[t.border.width]));const a=new e.Pdf.Geometry.Real.RectangleOnPage(t.pdfRect.page,t.pdfRect.pdfX,t.pdfRect.pdfY,t.pdfRect.pdfW,t.pdfRect.pdfH);switch(t.itemType){case 1:const r=new e.Pdf.Geometry.Real.PointOnPage(t.pdfRect.page,t.pdfRect.pdfX,t.pdfRect.pdfY);return e.Pdf.Annotations.StickyNote.create(r,"",n);case 3:return e.Pdf.Annotations.FreeText.create(a,t.richtext,n,s,this.view?this.view.viewRotation:e.Pdf.Geometry.Rotation.NoRotation);case 5:return e.Pdf.Annotations.RectangleAnnotation.create(a,s.lineWidth?n:null,s,o,i);case 6:return e.Pdf.Annotations.EllipseAnnotation.create(a,s.lineWidth?n:null,s,o,i);case 9:return e.Pdf.Annotations.Highlight.create(this.createQuadrilateralList(t.quadrilaterals),n);case 10:return e.Pdf.Annotations.Underline.create(this.createQuadrilateralList(t.quadrilaterals),n);case 11:return e.Pdf.Annotations.Squiggly.create(this.createQuadrilateralList(t.quadrilaterals),n);case 12:return e.Pdf.Annotations.StrikeThrough.create(this.createQuadrilateralList(t.quadrilaterals),n);case 13:if(t.stampText)return e.Pdf.Annotations.CustomTextStamp.create(a,t.stampText,t.stampColor,this.view?this.view.viewRotation:e.Pdf.Geometry.Rotation.NoRotation);if(t.imageId)return e.Pdf.Annotations.CustomImageStamp.create(a,t.imageId,this.view?this.view.viewRotation:e.Pdf.Geometry.Rotation.NoRotation);throw new Error("createAnnotation: Unknown custom stamp annotation");case 15:const l=t.inkList,d=new e.Pdf.Geometry.Real.Path;if(l){const t=new e.Pdf.Geometry.Real.PathGenerator(d);for(let n=0;n<l.length;n++){t.moveTo(new e.Pdf.Geometry.Real.Point(l[n][0],l[n][1]));for(let i=2;i<l[n].length;i+=2)t.lineTo(new e.Pdf.Geometry.Real.Point(l[n][i],l[n][i+1]))}t.close()}return e.Pdf.Annotations.InkAnnotation.create(t.page,d,n,s);default:throw new Error(`createAnnotation: Type not implemented: ${t.itemType}`)}}createAnnotation(e){let t=this.createMarkupAnnotation(e);const n=e.page;return t.info.author=e.author||"",new Promise(((i,o)=>{var s;null===(s=this.pdfDocument)||void 0===s||s.createAnnotation(t).then((()=>{const s=this.createWebViewerAnnotation(t,e.page);s&&(this.nativeAnnotationCache.set(s.id,t),this.handleAnnotationCache.set(s.id,s),this.dispatchEvent("itemCreated",s),this.dispatchEvent("pageChanged",n),i(s)),o("Failed to create Web Viewer annotation")})).catch((e=>{o(e)}))}))}createQuadrilateralList(t){const n=new e.Pdf.Geometry.Real.QuadrilateralList;for(let i=0;i<t.length;i++){const o=t[i];n.add(new e.Pdf.Geometry.Real.QuadrilateralOnPage(o.pageNumber,new e.Pdf.Geometry.Real.Point(o.bottomLeft.x,o.bottomLeft.y),new e.Pdf.Geometry.Real.Point(o.bottomRight.x,o.bottomRight.y),new e.Pdf.Geometry.Real.Point(o.topRight.x,o.topRight.y),new e.Pdf.Geometry.Real.Point(o.topLeft.x,o.topLeft.y)))}return n}convertToNativeBorderStyle(t){switch(t){case 0:default:return e.Pdf.Annotations.BorderStyleType.Lined;case 2:return e.Pdf.Annotations.BorderStyleType.Beveled;case 3:return e.Pdf.Annotations.BorderStyleType.Inset;case 4:return e.Pdf.Annotations.BorderStyleType.Underline}}convertToWebViewerBorderStyle(t){switch(t){case e.Pdf.Annotations.BorderStyleType.Lined:return 0;case e.Pdf.Annotations.BorderStyleType.Beveled:return 2;case e.Pdf.Annotations.BorderStyleType.Inset:return 3;case e.Pdf.Annotations.BorderStyleType.Underline:return 4;default:return 0}}updateItem(t){return new Promise(((n,i)=>{var o,s;if(t.itemType===z.WIDGET)null===(o=this.pdfDocument)||void 0===o||o.editAnnotation(t.widget).then((()=>{this.dispatchEvent("pageChanged",t.widget.boundingBox.pageNumber),n(t)})).catch((e=>{i(e)}));else{const o=this.nativeAnnotationCache.get(t.id);if(o){const a=t.hasOwnProperty("rotation")&&t.rotation%360!=o.rotation%360;if(!a){const n=new e.Pdf.Geometry.Real.RectangleOnPage(t.pdfRect.page,t.pdfRect.pdfX,t.pdfRect.pdfY,t.pdfRect.pdfW,t.pdfRect.pdfH);o.boundingBox=n}let r=null;r=this.createNativeColor(t.color);const l=o;if(l&&t.privateData&&(l.privateData=t.privateData),o.popup){const n=t.popup.pdfRect;o.popup.boundingBox=new e.Pdf.Geometry.Real.RectangleOnPage(n.page,n.pdfX,n.pdfY,n.pdfW,n.pdfH),o.popup.isOpen=t.popup.isOpen}if(l&&l.info&&(l.info.content=t.content||"",l.info.subject=t.subject||""),t.itemType===z.TEXT&&(o.color=r),t.itemType===z.FREE_TEXT){const e=o;e.richText=t.richText,e.backgroundColor=this.createNativeColor(t.color);const n=e.annotationStroke;n&&(n.lineWidth=t.border.width,e.annotationStroke=n,n.close()),a&&(e.rotation=t.rotation,t.pdfRect={page:e.boundingBox.pageNumber,pdfX:e.boundingBox.x,pdfY:e.boundingBox.y,pdfW:e.boundingBox.width,pdfH:e.boundingBox.height})}if(t.itemType===z.INK){const n=o,i=t;n.strokeColor=r;const{annotationStroke:s}=n;s&&(s.lineWidth=t.border.width,n.annotationStroke=s);const{path:a}=n,{vertices:l}=a;l.clear();for(let t of i.inkList){let n=!0;for(let o of t)n?(l.add(new e.Pdf.Geometry.Real.Vertex(i.page,o.x,o.y,e.Pdf.Geometry.Real.PathOperation.MoveTo)),n=!1):l.add(new e.Pdf.Geometry.Real.Vertex(i.page,o.x,o.y,e.Pdf.Geometry.Real.PathOperation.LineTo))}a.vertices=l,n.setPath(a)}if(t.itemType===z.SQUARE||t.itemType===z.CIRCLE){const e=o,{annotationStroke:n}=e;n&&(n.lineWidth=t.border.width,1===t.border.style?n.dashArray=[t.border.width]:n.dashArray=[0],e.annotationStroke=n),e.borderStyleType=this.convertToNativeBorderStyle(t.border.style),e.strokeColor=r,e.fillColor=this.createNativeColor(t.fillColor)}if(t.itemType!==z.HIGHLIGHT&&t.itemType!==z.SQUIGGLY&&t.itemType!==z.STRIKE_OUT&&t.itemType!==z.UNDERLINE||(o.color=r),t.itemType===z.STAMP){const e=o;a&&(e.rotation=t.rotation,t.pdfRect={page:e.boundingBox.pageNumber,pdfX:e.boundingBox.x,pdfY:e.boundingBox.y,pdfW:e.boundingBox.width,pdfH:e.boundingBox.height})}null===(s=this.pdfDocument)||void 0===s||s.editAnnotation(o).then((()=>{const{pageNumber:e}=o.boundingBox,i=this.createWebViewerAnnotation(o,e);if(!i)throw new Error("failed to update item");this.handleAnnotationCache.set(t.id,i),this.dispatchEvent("itemUpdated",i),this.dispatchEvent("pageChanged",e),n(i)})).catch((e=>{i(e)}))}}}))}getTextStampAspectRatio(e){return new Promise(((t,n)=>{var i;this.pdfDocument&&this.view?null===(i=this.pdfDocument)||void 0===i||i.getTextStampAspectRatio(e).then((e=>{t(e)})):n("No document opened")}))}createNativeColor(t){let n=0,i=0,o=0,s=0;if(!t)return new e.Pdf.Annotations.Color(n,i,o,s);if(0===(t=t.replace(/\s+/gi,"")).indexOf("#"))if(4===t.length)n=parseInt(t.substring(1,2),16),i=parseInt(t.substring(2,3),16),o=parseInt(t.substring(3,4),16),s=255;else if(5===t.length)n=parseInt(t.substring(1,2),16),i=parseInt(t.substring(2,3),16),o=parseInt(t.substring(3,4),16),s=parseInt(t.substring(4,5),16);else if(7===t.length)n=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),o=parseInt(t.substring(5,7),16),s=255;else{if(9!==t.length)throw new Error("invalid color string: "+t);n=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),o=parseInt(t.substring(5,7),16),s=parseInt(t.substring(7,9),16)}else{if(0!==t.indexOf("rgb"))throw new Error("invalid color string: "+t);{const e=t.substring(t.indexOf("(")+1,t.indexOf(")")).split(",");if(e.length<3||e.length>4)throw new Error("invalid color string: "+t);n=parseInt(e[0],10),i=parseInt(e[1],10),o=parseInt(e[2],10),s=4===e.length?Math.floor(255*parseFloat(e[3])):255}}return new e.Pdf.Annotations.Color(n,i,o,s)}createWebViewerAnnotation(t,n){var i,o;let s={};if(s.itemCategory=I.ANNOTATION,s.sourceTag=t.sourceTag,t instanceof e.Pdf.Annotations.MarkupAnnotation){const o=t.boundingBox;o&&(s.pdfRect=this.ViewingPdfRect2WwPdfRect(o)),s.page=n,s.privateData=t.privateData?t.privateData:null;const a=t.info;if(a&&(s.content=null==a?void 0:a.content,s.author=(null==a?void 0:a.author)||"",s.id=null==a?void 0:a.getHashCode(),s.modificationDate=(null==a?void 0:a.modificationDate)||null,s.creationDate=(null==a?void 0:a.creationDate)||null,s.subject=null==a?void 0:a.subject),s.isLocked=()=>{const t=this.nativeAnnotationCache.get(s.id);if(t instanceof e.Pdf.Annotations.MarkupAnnotation){const e=t;if(e.info)return e.info.locked}return console.warn("annotation not found"),!1},s.setLock=t=>{const n=this.nativeAnnotationCache.get(s.id);if(n instanceof e.Pdf.Annotations.MarkupAnnotation){const e=n;e.info&&(e.info.locked=t)}},t instanceof e.Pdf.Annotations.TextMarkup&&(s.color=this.convertColorToRgbaString(t.color)),s.isHidden=()=>{const e=this.nativeAnnotationCache.get(s.id);return e?e.hidden:(console.warn("annotation not found"),!1)},s.setHidden=e=>{const t=this.nativeAnnotationCache.get(s.id);return t?t.hidden=e:(console.warn("annotation not found"),!1)},s.border={},this.addPopup(s,t),t instanceof e.Pdf.Annotations.StickyNote)s.color=this.convertColorToRgbaString(t.color),s.itemType=z.TEXT;else if(t instanceof e.Pdf.Annotations.FreeText){s.itemType=z.FREE_TEXT;const e=t,n=s;n.richText=e.richText||`<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:21.11.0" xfa:spec="2.0.2" style="color:#000000;font-family:Helvetica;font-size:12pt;"><p>${t.info.content}</p></body>`,n.rotation=e.rotation,n.color=this.convertColorToRgbaString(e.backgroundColor);const i=e.annotationStroke;i&&(n.border.width=null==i?void 0:i.lineWidth,n.border.style=0,i.close())}else if(t instanceof e.Pdf.Annotations.RectangleAnnotation){const e=s;e.itemType=z.SQUARE,e.color=this.convertColorToRgbaString(t.strokeColor);const n=t.annotationStroke;if(n){e.border.width=null==n?void 0:n.lineWidth;const i=n.dashArray.length&&n.dashArray[0]>0;e.border.style=i?1:this.convertToWebViewerBorderStyle(t.borderStyleType),n.close()}t.fillColor&&(e.fillColor=this.convertColorToRgbaString(t.fillColor))}else if(t instanceof e.Pdf.Annotations.EllipseAnnotation){const e=s;e.itemType=z.CIRCLE,e.color=this.convertColorToRgbaString(t.strokeColor);const n=t.annotationStroke;if(n){e.border.width=null==n?void 0:n.lineWidth;const i=n.dashArray.length&&n.dashArray[0]>0;e.border.style=i?1:this.convertToWebViewerBorderStyle(t.borderStyleType),n.close()}t.fillColor&&(e.fillColor=this.convertColorToRgbaString(t.fillColor))}else if(t instanceof e.Pdf.Annotations.PolygonAnnotation){s.itemType=z.POLYGON;const e=t.annotationStroke;if(e){s.border.width=null==e?void 0:e.lineWidth;const n=e.dashArray.length&&e.dashArray[0]>0;s.border.style=n?1:this.convertToWebViewerBorderStyle(t.borderStyleType)}}else if(t instanceof e.Pdf.Annotations.PolyLineAnnotation){s.itemType=z.POLY_LINE;const e=t.annotationStroke;e&&(s.border.width=null==e?void 0:e.lineWidth,s.border.style=0,e.close())}else if(t instanceof e.Pdf.Annotations.TextMarkup){const n=s;if(n.markedText=t.markedText,null!==t.markupArea){n.quadrilaterals=[];for(let e=0;e<t.markupArea.size;e++)n.quadrilaterals.push(t.markupArea.get(e))}t instanceof e.Pdf.Annotations.Highlight?n.itemType=z.HIGHLIGHT:t instanceof e.Pdf.Annotations.Underline?n.itemType=z.UNDERLINE:t instanceof e.Pdf.Annotations.Squiggly?n.itemType=z.SQUIGGLY:t instanceof e.Pdf.Annotations.StrikeThrough&&(n.itemType=z.STRIKE_OUT)}else if(t instanceof e.Pdf.Annotations.Stamp){const e=s;e.itemType=z.STAMP,e.rotation=t.rotation}else{if(t instanceof e.Pdf.Annotations.TextInsert)return null;if(!(t instanceof e.Pdf.Annotations.InkAnnotation))return e.Pdf.Annotations.Popup,null;{const n=t,o=s;o.itemType=z.INK,o.color=this.convertColorToRgbaString(n.strokeColor),o.border={width:(null===(i=n.annotationStroke)||void 0===i?void 0:i.lineWidth)||1,style:F.SOLID},o.inkList=[];const{vertices:a}=n.path;let r=null;for(let t=0;t<a.size;t++){const n=a.get(t);n.operator===e.Pdf.Geometry.Real.PathOperation.MoveTo?(r&&o.inkList.push(r),r=[{x:n.x,y:n.y}]):n.operator===e.Pdf.Geometry.Real.PathOperation.LineTo&&(null==r||r.push({x:n.x,y:n.y}))}r&&o.inkList.push(r)}}}else if(t instanceof e.Pdf.Annotations.Link){s.itemType=z.LINK;const n=s;if(s.id=t.getHashCode(),s.pdfRect=this.ViewingPdfRect2WwPdfRect(t.boundingBox),t instanceof e.Pdf.Annotations.WebLink)n.uri=t.uri,n.actionType=_.URI;else if(t instanceof e.Pdf.Annotations.InternalLink){const e=null===(o=t.destination)||void 0===o?void 0:o.target;n.actionType=_.GO_TO,e&&(n.destination={destinationType:8,pageNumber:e.pageNumber,left:null,top:null,zoom:null})}}else{if(!(t instanceof e.Pdf.Forms.Widget))return null;{const i=s;i.id=t.getHashCode(),i.itemType=z.WIDGET,i.page=n;const o=t.boundingBox;i.pdfRect=this.ViewingPdfRect2WwPdfRect(o),i.widget=t,i.isLocked=()=>!1,i.isHidden=()=>t.hidden,i.setHidden=e=>{t.hidden=e},i.pdfDocument=this.pdfDocument,t instanceof e.Pdf.Forms.CheckBox?i.widgetType=j.CHECK_BOX:t instanceof e.Pdf.Forms.RadioButton?i.widgetType=j.RADIO_BUTTON:t instanceof e.Pdf.Forms.TextBox?i.widgetType=j.TEXT_BOX:t instanceof e.Pdf.Forms.ListBox?i.widgetType=j.LIST_BOX:t instanceof e.Pdf.Forms.ComboBox&&(i.widgetType=j.COMBO_BOX)}}return s.isReadOnly=(()=>{const{annotationPermissionCallback:t,onlyAuthorCanEdit:n,user:i}=this.pdfViewerApiOptions;let o=null,a=!1;const r=this.pdfViewerApiOptions.viewOnly||!(e.Sdk.supportedFeatures&e.LicenseFeature.Annotate);return()=>(o||(a=!1,!r&&e.Sdk.supportedFeatures&e.LicenseFeature.Annotate?t?a=!t(s,i):n&&(a=!s.author||i!==s.author):a=!0,o=window.setTimeout((()=>{o=null}),50)),a)})(),s.behaviors=this.getAnnotationBehaviors(s),s}getAnnotationBehaviors(t){const n=Z[t.itemType];if(!n)return{isReadOnly:!0,selectable:!1,editable:!1,deletable:!1,movable:!1,rotatable:!1,resizable:!1,aspectRatioChangeable:!1,canHavePopup:!1,link:!1,text:!1};let i=!1;return!this.pdfViewerApiOptions.viewOnly&&this.licenseFeatures&e.LicenseFeature.Annotate||(i=!0),{isReadOnly:i,selectable:n[0],editable:n[1],deletable:n[2],movable:n[3],rotatable:n[4],resizable:n[5],aspectRatioChangeable:n[6],canHavePopup:this.pdfViewerApiOptions.allowPopups&&n[7],link:n[8],text:n[9]}}addPopup(e,t){const n=t.popup;n&&(e.popup={},e.popup.pdfRect=this.ViewingPdfRect2WwPdfRect(n.boundingBox),e.popup.isOpen=n.isOpen,e.popup.pdfRect.page=e.page,n.close())}getOpenPopups(e,t){var n;const i=[];for(let o=e;o<=t;o++)null===(n=this.pageAnnotationCache.get(o))||void 0===n||n.forEach((e=>{e.popup&&e.popup.isOpen&&i.push(e)}));return i}convertColorToRgbaString(e){let t="#";return e?(t+=e.red.toString(16).padStart(2,"0"),t+=e.green.toString(16).padStart(2,"0"),t+=e.blue.toString(16).padStart(2,"0"),t+=e.alpha.toString(16).padStart(2,"0"),t):(t+="00000000",t)}getPageLayoutMode(){return this.view?this.view.pageLayoutMode:e.Pdf.Navigation.PageLayoutMode.SinglePage}setPageLayoutMode(e){this.view&&(this.view.pageLayoutMode=e)}getScrollMaxPosition(){var e;const t=null===(e=this.view)||void 0===e?void 0:e.scrollMaxPosition;return t&&(t.x=Math.max(t.x-this.viewportSize.width,0),t.y=Math.max(t.y-this.viewportSize.height,0)),t}getScrollPosition(){var e;return null===(e=this.view)||void 0===e?void 0:e.scrollPosition}setScrollPosition(t){new e.Pdf.Geometry.Integer.ScrollPosition(t.x,t.y),this.view&&(this.view.scrollPosition=t)}getPageScreenRect(e){var t;const n=null===(t=this.view)||void 0===t?void 0:t.getPageRectangleOnViewport(e);return n?this.ViewingVPRect2WwVpRect(n):null}getClosestPointOnPdfByScreenPoint(t,n=0,i){if(this.view&&this.pdfDocument){const o=new e.Pdf.Geometry.Integer.Point(t.x,t.y),s=i?this.view.transformPointFromViewportToSpecificPage(o,i,!0):this.view.transformPointFromViewportToPage(o,!0),a=this.pdfDocument.getPageSize(s.pageNumber,!0),r={pdfX:s.x,pdfY:s.y,page:s.pageNumber};return r.pdfX<n?r.pdfX=n:r.pdfX>a.width-n&&(r.pdfX=a.width-n),r.pdfY<n?r.pdfY=n:r.pdfY>a.height-n&&(r.pdfY=a.height-n),r}throw new Error("PDF Document must not be null")}transformPdfLengthToScreenLength(e){var t;if(this.view)return null===(t=this.view)||void 0===t?void 0:t.transformPdfLengthToViewportLength(e);throw new Error("View must not be null")}transformScreenLengthToPdfLength(e){var t;if(this.view)return null===(t=this.view)||void 0===t?void 0:t.transformViewportLengthToPdfLength(e);throw new Error("View must not be null")}transformScreenPointToPdfPoint(t,n){if(this.view&&this.pdfDocument){const i=new e.Pdf.Geometry.Integer.Point(t.x,t.y);try{const e=n?this.view.transformPointFromViewportToSpecificPage(i,n,!1):this.view.transformPointFromViewportToPage(i,!1),t=this.pdfDocument.getPageSize(e.pageNumber,!0);return{pdfPoint:{pdfX:e.x,pdfY:e.y,page:e.pageNumber},isOnPage:e.x>=0&&e.x<=t.width&&e.y>=0&&e.y<=t.height}}catch(t){if(t instanceof e.ArgumentError)return{pdfPoint:null,isOnPage:!1}}}return null}transformPdfPointToScreenPoint(t){var n;const i=null===(n=this.view)||void 0===n?void 0:n.transformPointFromPageToViewport(new e.Pdf.Geometry.Real.PointOnPage(t.page,t.pdfX,t.pdfY));return{x:null==i?void 0:i.x,y:null==i?void 0:i.y}}transformPdfPageRectToScreenRect(t){var n;const i=null===(n=this.view)||void 0===n?void 0:n.transformRectangleFromPageToViewport(new e.Pdf.Geometry.Real.RectangleOnPage(t.page,t.pdfX,t.pdfY,t.pdfW,t.pdfH));return{x:null==i?void 0:i.x,y:null==i?void 0:i.y,w:null==i?void 0:i.width,h:null==i?void 0:i.height}}transformScreenRectToPdfRect(t,n){var i;const o=new e.Pdf.Geometry.Integer.Rectangle(t.x,t.y,t.w,t.h);try{const e=null===(i=this.view)||void 0===i?void 0:i.transformRectangleFromViewportToSpecificPage(o,n);return{pdfX:null==e?void 0:e.x,pdfY:null==e?void 0:e.y,pdfW:null==e?void 0:e.width,pdfH:null==e?void 0:e.height,page:n}}catch(e){return null}}transformQuadrilateralToViewport(t){const n=[];return this.view&&(n.push(this.view.transformPointFromPageToViewport(new e.Pdf.Geometry.Real.PointOnPage(t.pageNumber,t.topLeft.x,t.topLeft.y))),n.push(this.view.transformPointFromPageToViewport(new e.Pdf.Geometry.Real.PointOnPage(t.pageNumber,t.topRight.x,t.topRight.y))),n.push(this.view.transformPointFromPageToViewport(new e.Pdf.Geometry.Real.PointOnPage(t.pageNumber,t.bottomRight.x,t.bottomRight.y))),n.push(this.view.transformPointFromPageToViewport(new e.Pdf.Geometry.Real.PointOnPage(t.pageNumber,t.bottomLeft.x,t.bottomLeft.y)))),n}getAnnotationsOnPoint(e,t){var n;const i=null===(n=this.view)||void 0===n?void 0:n.getAnnotationsOnPoint(e,t);if(i&&i.size>0){const e=[];for(let t=0;t<i.size;t++){const n=i.get(t),o=n.getHashCode();this.handleAnnotationCache.has(o)?e.push(this.handleAnnotationCache.get(o)):console.warn("annotation handle is not cached"),n.close()}return i.close(),e}return null}getItemsFromPage(e,t){if(1===t)return this.getAnnotationsFromPage(e)}onDocumentOpened(t,n,i){const o=i||new e.Pdf.ViewOptions;o.viewDPI=this.getXDPI();const{initialDestination:s,initialPageLayoutMode:a}=t;null!==a&&null===o.initialPageLayoutMode&&(o.initialPageLayoutMode=a),null!==s&&null===o.initialDestination&&(o.initialDestination=s),this.view=e.Pdf.View.create(t,n,i),this.attachEventListeners(),this.view&&(this.dispatchEvent("firstVisiblePage",this.view.firstVisiblePage),this.dispatchEvent("lastVisiblePage",this.view.lastVisiblePage),this.dispatchEvent("pageNumber",this.view.pageNumber),this.dispatchEvent("fitMode",this.view.fitMode),this.dispatchEvent("pageLayoutMode",this.ViewingPageLayoutToWwPageLayout(this.view.pageLayoutMode)))}ViewingPageLayoutToWwPageLayout(t){switch(t){case e.Pdf.Navigation.PageLayoutMode.OneColumn:return W.ONE_COLUMN;case e.Pdf.Navigation.PageLayoutMode.SinglePage:return W.SINGLE_PAGE;case e.Pdf.Navigation.PageLayoutMode.TwoColumnLeft:return W.TWO_COLUMN_LEFT;case e.Pdf.Navigation.PageLayoutMode.TwoColumnRight:return W.TWO_COLUMN_RIGHT;case e.Pdf.Navigation.PageLayoutMode.TwoPageLeft:return W.TWO_PAGE_LEFT;case e.Pdf.Navigation.PageLayoutMode.TwoPageRight:return W.TWO_PAGE_RIGHT;default:return W.ONE_COLUMN}}WwPageLayoutToViewingPageLayout(t){switch(t){case W.ONE_COLUMN:return e.Pdf.Navigation.PageLayoutMode.OneColumn;case W.SINGLE_PAGE:return e.Pdf.Navigation.PageLayoutMode.SinglePage;case W.TWO_COLUMN_LEFT:return e.Pdf.Navigation.PageLayoutMode.TwoColumnLeft;case W.TWO_COLUMN_RIGHT:return e.Pdf.Navigation.PageLayoutMode.TwoColumnRight;case W.TWO_PAGE_LEFT:return e.Pdf.Navigation.PageLayoutMode.TwoPageLeft;case W.TWO_PAGE_RIGHT:return e.Pdf.Navigation.PageLayoutMode.TwoPageRight;case W.ONE_COLUMN:default:return e.Pdf.Navigation.PageLayoutMode.OneColumn}}WwFitModeToViewingFitMode(t){switch(t){case G.NONE:return e.Pdf.Navigation.FitMode.None;case G.FIT_PAGE:return e.Pdf.Navigation.FitMode.FitPage;case G.FIT_WIDTH:return e.Pdf.Navigation.FitMode.FitWidth;default:return e.Pdf.Navigation.FitMode.None}}getLastVisiblePage(){return this.view?this.view.lastVisiblePage:0}getFirstVisiblePage(){return this.view?this.view.firstVisiblePage:0}drawImages(e,t,n){if(t.visiblePages){e.clearRect(0,0,e.canvas.width,e.canvas.height);const i=this.getPageNumber();for(let o=0;o<t.visiblePages.size;o++){const{image:s,pageRect:a,pageNumber:r}=t.visiblePages.get(o);if(e.save(),i===r&&n.currentPageShadow?(e.shadowColor=n.currentPageShadow.shadowColor,e.shadowBlur=n.currentPageShadow.shadowBlur,e.shadowOffsetX=n.currentPageShadow.shadowOffsetX,e.shadowOffsetY=n.currentPageShadow.shadowOffsetY):n.pageShadow&&(e.shadowColor=n.pageShadow.shadowColor,e.shadowBlur=n.pageShadow.shadowBlur,e.shadowOffsetX=n.pageShadow.shadowOffsetX,e.shadowOffsetY=n.pageShadow.shadowOffsetY),e.fillStyle="#ffffffff",e.fillRect(a.x,a.y,a.width,a.height),e.restore(),s){const t=this.imageBitmapCache.get(s.id);if(t){const{scaledImage:n,imageData:i}=t,{imageRectangle:o}=s;i&&n&&(o.width!==s.width||o.height!==s.height?e.drawImage(n,a.x+o.x,a.y+o.y,o.width,o.height):e.putImageData(i,a.x+o.x,a.y+o.y))}s.close()}}}}addEventListener(e,t){"busyState"!==e?this.eventListeners.has(e)?this.eventListeners.get(e).push(t):this.eventListeners.set(e,[t]):this.pdfController.addEventListener("busyChanged",t)}removeEventListener(e,t){if(this.eventListeners.has(e)){let n=this.eventListeners.get(e);n=n.filter((e=>e!==t)),0!==n.length?this.eventListeners.set(e,n):this.eventListeners.delete(e)}}dispatchEvent(e,t){this.eventListeners.has(e)&&this.eventListeners.get(e).forEach((e=>e(t)))}attachEventListeners(){this.view&&(this.view.addEventListener("viewUpdated",this.onViewUpdated),this.view.addEventListener("imageCreated",this.onImageCreated),this.view.addEventListener("imageRemovedFromCache",this.onImageRemovedFromCache))}onViewUpdated(t){var n,i,o,s,a,r,l,d;t.bitmapsUpdated,t.fitmodeChanged&&(null===(n=this.eventListeners.get("fitMode"))||void 0===n||n.forEach((t=>{t(this.view?this.view.fitMode:e.Pdf.Navigation.FitMode.None)}))),t.pageLayoutModeChanged&&(null===(i=this.eventListeners.get("pageLayoutMode"))||void 0===i||i.forEach((e=>{e(this.view?this.view.pageLayoutMode:0)}))),t.pageSizeUpdated,t.scrollMaxPositionChanged,t.viewRotationChanged&&(null===(o=this.eventListeners.get("rotation"))||void 0===o||o.forEach((e=>{e(this.view?this.view.viewRotation:0)}))),t.visisblePageRangeChanged&&(null===(s=this.eventListeners.get("firstVisiblePage"))||void 0===s||s.forEach((e=>{e(this.view?this.view.firstVisiblePage:0)})),null===(a=this.eventListeners.get("lastVisiblePage"))||void 0===a||a.forEach((e=>{e(this.view?this.view.lastVisiblePage:0)}))),t.pageNumberChanged&&(null===(r=this.eventListeners.get("pageNumber"))||void 0===r||r.forEach((e=>{e(this.view?this.view.pageNumber:0)}))),t.zoomChanged&&(null===(l=this.eventListeners.get("zoom"))||void 0===l||l.forEach((e=>{e(this.view?this.view.zoom:0)}))),null===(d=this.eventListeners.get("canvasInvalidated"))||void 0===d||d.forEach((e=>{e(!0)}))}onImageRemovedFromCache(e){const t=this.imageBitmapCache.get(e);null==t||t.destroy(),this.imageBitmapCache.delete(e)}onImageCreated(e){this.imageBitmapCache.set(e.id,new $(e)),e.removeImageData(),e.close()}getProductVersion(){return e.Sdk.version}getXDPI(){var e;if(this.devicePixelRatio!==window.devicePixelRatio||0===this.xDPI){const t=document.createElement("div");t.style.height="1in",t.style.width="1in",t.style.visibility="hidden",document.body.appendChild(t),this.xDPI=window.devicePixelRatio*t.offsetWidth,null===(e=t.parentNode)||void 0===e||e.removeChild(t)}return this.xDPI}getYDPI(){var e;if(this.devicePixelRatio!==window.devicePixelRatio||0===this.yDPI){const t=document.createElement("div");t.style.height="1in",t.style.width="1in",t.style.visibility="hidden",document.body.appendChild(t),this.yDPI=window.devicePixelRatio*t.offsetHeight,null===(e=t.parentNode)||void 0===e||e.removeChild(t)}return this.yDPI}ViewingPdfRect2WwPdfRect(e){return{pdfX:e.x,pdfY:e.y,pdfW:e.width,pdfH:e.height,page:e.pageNumber}}ViewingQuadrilateral2WwPdfRect(e){if(e.bottomLeft&&e.bottomRight&&e.topLeft){const t=e.bottomRight.x-e.bottomLeft.x,n=e.topLeft.y-e.bottomLeft.y;return{pdfX:e.bottomLeft.x,pdfY:e.bottomLeft.y,pdfW:t,pdfH:n,page:e.pageNumber}}return{page:-1,pdfX:-1,pdfY:-1,pdfW:-1,pdfH:-1}}ViewingVPRect2WwVpRect(e){return{x:e.x,y:e.y,w:e.width,h:e.height}}}const te=(e,t,n,i=!1)=>{if(!i&&(null===e||typeof e!==t))throw new TypeError(`Method ${n} requires argument of type '${t}' but is '${typeof e}'`)},ne=e=>{if(!e)throw new Error("License is not set.")};class ie{constructor(e){this.eventListeners=new Map,this.open=this.open.bind(this),this.save=this.save.bind(this),this.pdfViewerApiOptions=e}open(e,t,n,i,o,s){return ne(this.instance),this.instance.open(e,t,n,i,o,s)}save(e){return ne(this.instance),this.instance.save(e)}close(){return ne(this.instance),this.instance.close()}destroy(){ne(this.instance),this.instance.destroy()}registerPdfStampFile(e,t,n){ne(this.instance),this.instance.registerPdfStampFile(e,t,n)}forceFlushCache(){ne(this.instance),this.instance.forceFlushCache()}getMaxCacheSize(){return ne(this.instance),this.instance.getMaxCacheSize()}setMaxCacheSize(e){ne(this.instance),this.instance.setMaxCacheSize(e)}getPageCount(){return ne(this.instance),this.instance.getPageCount()}getPageNumber(){return ne(this.instance),this.instance.getPageNumber()}getLastVisiblePage(){return ne(this.instance),this.instance.getLastVisiblePage()}getFirstVisiblePage(){return ne(this.instance),this.instance.getFirstVisiblePage()}setPageNumber(e){te(e,"number","setPageNumber"),ne(this.instance),this.instance.setPageNumber(e)}getRotation(){return ne(this.instance),this.instance.getRotation()}setRotation(e){te(e,"number","setRotation"),ne(this.instance),this.instance.setRotation(e)}getZoom(){return ne(this.instance),this.instance.getZoom()}setZoom(e,t){te(e,"number","setZoom"),ne(this.instance),this.instance.setZoom(e,t)}getScrollMaxPosition(){return ne(this.instance),this.instance.getScrollMaxPosition()}getScrollPosition(){return ne(this.instance),this.instance.getScrollPosition()}setScrollPosition(e){ne(this.instance),this.instance.setScrollPosition(e)}goTo(e){ne(this.instance),this.instance.goTo(e)}goToViewerDestination(e){ne(this.instance),this.instance.goTo(e)}goToRectangle(e){ne(this.instance),this.instance.goToRectangle(e)}isOpen(){return ne(this.instance),this.instance.getIsOpen()}setPageLayoutMode(e){ne(this.instance),this.instance.setPageLayoutMode(e)}getPageLayoutMode(){return ne(this.instance),this.instance.getPageLayoutMode()}setFitMode(e){ne(this.instance),this.instance.setFitMode(e)}getFitMode(){return ne(this.instance),this.instance.getFitMode()}getBorderSize(){return ne(this.instance),this.instance.getBorderSize()}setBorderSize(e){ne(this.instance);const t=this.instance.setBorderSize(e);if(!t.ok)throw new Error(t.message)}getSlidingWindowSize(){return ne(this.instance),this.instance.getSlidingWindowSize()}setSlidingWindowSize(e){te(e,"number","setSlidingWindowSize"),ne(this.instance);const t=this.instance.setSlidingWindowSize(e);if(!t.ok)throw new Error(t.message)}suspendDrawing(){ne(this.instance),this.instance.suspendDrawing()}resumeDrawing(){ne(this.instance),this.instance.resumeDrawing()}renderCanvas(e,t){ne(this.instance),this.instance.renderCanvas(e,t)}renderPage(e,t,n,i){return ne(this.instance),this.instance.renderPage(e,t,n,i)}rotatePage(e,t){return ne(this.instance),this.instance.rotatePage(e,t)}getPagePdfSize(e){return ne(this.instance),this.instance.getPagePdfSize(e)}setIgnoringPreferences(e){ne(this.instance),this.instance.setIgnoringPreferences(e)}getIgnoringPreferences(){return ne(this.instance),this.instance.getIgnoringPreferences()}getProductVersion(){return e.Sdk.version}getOutlines(e){return ne(this.instance),this.instance.getOutlines(e)}getTextFragmentOnPoint(e){return te(e,"object","getTextFragmentOnPoint"),ne(this.instance),this.instance.getTextFragmentOnPoint(e)}getWordOnPoint(e){return te(e,"object","getWordOnPoint"),ne(this.instance),this.instance.getWordOnPoint(e)}getTextSelection(e,t){return ne(this.instance),this.instance.getTextSelection(e,t)}getRectangularTextSelection(e,t){return ne(this.instance),this.instance.getRectangularTextSelection(e,t)}getText(e,t){return ne(this.instance),this.instance.getText(e,t)}getTextForRectangularSelection(e,t){return ne(this.instance),this.instance.getTextForRectangularSelection(e,t)}getAnnotationsOnPoint(e,t=!1){return ne(this.instance),this.instance.getAnnotationsOnPoint(e,t)}getOpenPopups(e,t){return ne(this.instance),this.instance.getOpenPopups(e,t)}getItemsFromPage(e,t){return te(e,"number","getItemsFromPage"),te(t,"number","getItemsFromPage"),ne(this.instance),t===I.ANNOTATION?this.instance.getItemsFromPage(e,t):new Promise(((e,t)=>{e({})}))}createItem(e){return te(e,"object","createItem"),ne(this.instance),this.instance.createItem(e)}getItem(e){return ne(this.instance),this.instance.getItem(e)}getItems(e){return ne(this.instance),this.instance.getItems(e)}updateItem(e){return te(e,"object","updateItem"),ne(this.instance),this.instance.updateItem(e)}deleteItem(e){return te(e,"object","deleteItem"),ne(this.instance),this.instance.deleteItem(e)}getStampInfo(e){return ne(this.instance),this.instance.getStampInfo(e)}getTextStampAspectRatio(e){return ne(this.instance),this.instance.getTextStampAspectRatio(e)}registerStampImage(e){return te(e,"object","registerStampImage"),ne(this.instance),this.instance.registerImage(e)}registerPdfPage(e,t){return te(e,"string","registerPdfStamp"),te(t,"number","registerPdfStamp"),ne(this.instance),this.instance.registerPdfPage(e,t)}hasChanges(){return ne(this.instance),this.instance.hasChanges()}getSearchIterator(e,t,n,i,o){return this.instance.getSearchIterator(e,t,n,i,o)}setLicenseKey(e){try{return this.instance=new ee(e,this.pdfViewerApiOptions),!0}catch(e){return!1}}getSupportedFeatures(){return this.instance.getSupportedFeatures()}transformScreenPointToPdfPoint(e,t,n){return te(e.x,"number","x"),te(e.y,"number","y"),ne(this.instance),void 0!==t&&te(t,"number","page"),void 0!==n&&te(n,"boolean","transformScreenPointToPdf"),this.instance.transformScreenPointToPdfPoint(e,t,n)}getClosestPointOnPdfByScreenPoint(e,t=0,n){return ne(this.instance),this.instance.getClosestPointOnPdfByScreenPoint(e,n,t)}transformPdfPointToScreenPoint(e){return te(e.pdfX,"number","pdfX"),te(e.pdfY,"number","pdfY"),te(e.page,"number","page"),ne(this.instance),this.instance.transformPdfPointToScreenPoint(e)}transformScreenRectToPdfRect(e,t){return te(e.x,"number","x"),te(e.y,"number","y"),te(e.w,"number","w"),te(e.h,"number","h"),ne(this.instance),this.instance.transformScreenRectToPdfRect(e,t)}transformPdfPageRectToScreenRect(e){return te(e.pdfX,"number","pdfX"),te(e.pdfY,"number","pdfY"),te(e.pdfW,"number","pdfW"),te(e.pdfH,"number","pdfH"),te(e.page,"number","page"),ne(this.instance),this.instance.transformPdfPageRectToScreenRect(e)}transformPdfLengthToScreenLength(e){return te(e,"number","transformPdfLengthToScreenLength"),ne(this.instance),this.instance.transformPdfLengthToScreenLength(e)}transformScreenLengthToPdfLength(e){return te(e,"number","transformScreenLengthToPdfLength"),ne(this.instance),this.instance.transformScreenLengthToPdfLength(e)}transformQuadrilateralToViewport(e){return ne(this.instance),this.instance.transformQuadrilateralToViewport(e)}getPageScreenRect(e){return ne(this.instance),this.instance.getPageScreenRect(e)}addEventListener(e,t){ne(this.instance),this.instance.addEventListener(e,t)}removeEventListener(e,t){ne(this.instance),this.instance.removeEventListener(e,t)}}function oe(e){switch(e){case W.ONE_COLUMN:return g.getText("pageLayoutMode.oneColumn");case W.SINGLE_PAGE:return g.getText("pageLayoutMode.singlePage");case W.TWO_COLUMN_LEFT:return g.getText("pageLayoutMode.twoColumnLeft");case W.TWO_COLUMN_RIGHT:return g.getText("pageLayoutMode.twoColumnRight");case W.TWO_PAGE_LEFT:return g.getText("pageLayoutMode.twoPageLeft");case W.TWO_PAGE_RIGHT:return g.getText("pageLayoutMode.twoPageRight")}}const se=({})=>(e,t)=>{const{pdfDocument:n}=e,{screenSize:o}=e.layout,s=e.options.viewer.general.pageLayoutModes.map((e=>({text:oe(e),value:e,renderItem:e=>i("span",{className:"pwv-page-layout-mode-item"},i(v,{icon:f[`pageLayoutMode${e.value}`],className:"pwv-page-layout-mode-icon"}),e.text)})));return i(m,{className:"pwv-ViewBar"},n.fitMode===G.NONE&&i(S,{name:"fitMode",tooltip:g.getText("fitMode.none"),icon:f.fitActualSize,onClick:()=>{t.api.setFitMode(G.FIT_PAGE)}}),n.fitMode===G.FIT_PAGE&&i(S,{name:"fitMode",tooltip:g.getText("fitMode.page"),icon:f.fitPage,onClick:()=>{t.api.setFitMode(G.FIT_WIDTH)}}),n.fitMode===G.FIT_WIDTH&&i(S,{name:"fitMode",tooltip:g.getText("fitMode.width"),icon:f.fitWidth,onClick:()=>{t.api.setFitMode(G.NONE),t.api.setZoom(100)}}),e.options.viewer.permissions.enablePageLayoutMode&&i(P,{name:"pageLayoutMode",tooltip:oe(n.pageLayoutMode),items:s,value:n.pageLayoutMode,className:"pwv-page-layout-mode",renderButton:(e,t)=>i(v,{icon:f[`pageLayoutMode${e}`],className:"pwv-page-layout-mode-icon"}),onChange:e=>{t.api.setPageLayoutMode(e)}}),e.options.viewer.permissions.allowRotateView&&o===r.Large&&i(S,{name:"rotateView",tooltip:g.getText("toolbar.rotateView"),icon:f.rotate,onClick:t.api.rotate}))},ae=({})=>(e,t)=>e.licenseFeatures.annotate?i(C,{className:"pwv-LgHidden pwv-AnnotationMenu",tooltip:g.getText("toolbar.annotationsMenuButton"),icon:f.edit},i("div",null,e.options.modules.filter((e=>e.moduleInfo.requiredFeatures.annotate)).map((e=>i("button",{class:"pwv-DropdownItem",onclick:()=>{t.api.activateModule(e.moduleInfo.name,void 0)}},i(v,{icon:f[e.moduleInfo.icon]})," ",g.getText(e.moduleInfo.translationKey)))),i(E,{location:"annotationbar",style:"listItem"}))):null,re=({})=>(e,t)=>{const n=e.layout.screenSize===r.Small,{sidebar:o}=(e.layout.screenSize,r.Medium,e.options.viewer),{disableAnnotationToolbar:s}=e.options.viewer.general;return i(m,{className:"pwv-AddonsBar"},!s&&n&&i(ae,null),e.options.viewer.permissions.enableSearch&&i(S,{name:"toggleSearch",tooltip:g.getText("toolbar.search"),icon:f.search,onClick:()=>{e.search.showSearch?(t.api.endSearch(),t.search.closeSearch()):(t.api.resetViewerMode(),t.search.openSearch())},active:e.search.showSearch}),!n&&(o.thumbnailNavigation||o.outlineNavigation||o.annotationNavigation)&&i(S,{name:"toggleSidePane",tooltip:g.getText("toolbar.toggleSidePane"),icon:f.docNavigation,onClick:()=>{t.api.loadNavigationItems(),t.navigationPanel.toggleNavigationPanel()},active:e.navigationPanel.showNavigation}),i(E,{location:"informationbar",style:"button"}))},le=({})=>(e,t)=>{const n=e.layout.screenSize<=r.Medium,{disableMainToolbar:o}=e.options.viewer.general;return i("div",{class:"pwv-AppBar"},!e.options.viewer.general.disableMainToolbar&&i(h,{allowWrap:!0},i(n?L:T,null),i(M,null),i(c,null),i(R,null),i(c,null),i(se,null),i(re,null)),e.search.showSearch&&e.options.viewer.permissions.enableSearch&&i(D,null))},de=({})=>(e,t)=>e.layout.screenSize!==r.Small&&e.licenseFeatures.annotate?i("div",{class:s("pwv-annotationbar",`pwv-annotationbar-${e.options.viewer.general.annotationBarPosition}`)},e.options.modules.filter((({moduleInfo:e})=>e.requiredFeatures.annotate)).map((e=>i(S,{icon:f[e.moduleInfo.icon],tooltip:g.getText(e.moduleInfo.translationKey),onClick:()=>{t.api.activateModule(e.moduleInfo.name,void 0)}}))),i(E,{location:"annotationbar",style:"button"})):null,he=({pages:e,currentPage:t,allowRotatePages:n,onPageSelected:o,onRotatePage:a},r)=>i("div",{class:"pwv-thumbnail-navigation"},i("ul",null,e.map((e=>i("li",{id:`pwv-thumbnail-navigation-page_${e.pageNumber}`,key:e.pageNumber,class:s("pwv-thumbnail-navigation-page",{"pwv-selected":e.pageNumber===t})},i("div",{class:"pwv-thumbnail-navigation-img-container"},null!==e.thumbnail?i("img",{src:e.thumbnail,onclick:()=>{o(e.pageNumber)}}):i("div",{class:"pwv-page-placeholder",onclick:()=>{o(e.pageNumber)}},!0===e.loading&&i("div",{class:"pwv-ItemLoader"}))),i("div",{class:"pwv-page-nr"},n&&e.pageNumber===t&&i("div",{class:"pwv-page-rotation pwv-ToolbarItemGroup"},i(S,{icon:f.rotateLeft,tooltip:g.getText("rotatePage.counterclockwise"),onClick:()=>{a({page:e.pageNumber,direction:K.COUNTERCLOCKWISE})}}),i(S,{icon:f.rotateRight,tooltip:g.getText("rotatePage.clockwise"),onClick:()=>{a({page:e.pageNumber,direction:K.CLOCKWISE})}})),i("span",null,e.pageNumber))))))),ce=({items:e,path:t,onToggleItem:n,onOutlineItemSelected:o})=>i("ul",null,e.map((e=>i(ue,{item:e,path:t,onToggleItem:n,onOutlineItemSelected:o})))),ue=({item:e,path:t,onToggleItem:n,onOutlineItemSelected:o})=>{const a=t.filter((e=>!0));return a.push(e.id.toString()),i("li",null,i("div",null,e.hasDescendants?i("span",{class:s({"pwv-outline-tree-btn-expand":!e.open},{"pwv-outline-tree-btn-collapse":e.open}),onclick:()=>{n(a)}},i(v,{icon:e.open?f.outlineOpen:f.outlineClosed})):i("span",{class:"pwv-outline-tree-indent"}),i("span",{onclick:()=>{o(e.destination)},class:"pwv-outline-tree-lnk"},e.title)),e.open&&e.descendants&&i(ce,{items:e.descendants,path:a,onToggleItem:n,onOutlineItemSelected:o}))},pe=({})=>(e,t)=>{const{outlines:n,outlineItemsLoaded:o}=e.navigationPanel;return i("div",{class:"pwv-outline-navigation"},n.length>0?i(ce,{items:n,path:[],onToggleItem:t.navigationPanel.toggleOutlineItem,onOutlineItemSelected:t.api.goTo}):o?i("div",{class:"pwv-NavigationPanel__NoItems"},g.getText("sideNavigation.noOutline")):"",!o&&i("div",{class:"pwv-ItemLoader"}))};function ge(e){const t=/(\d*\.?\d+)/.exec(e);return me((t&&t.length>1?parseFloat(t[1]):12)/72*96)+"px"}function me(e){return Math.round(100*e)/100}function fe(){const e=new Date,t=e.getFullYear();let n=`${e.getMonth()+1}`;n=we(n,2,"0");let i=`${e.getDate()}`;i=we(i,2,"0");let o=`${e.getHours()}`;o=we(o,2,"0");let s=`${e.getMinutes()}`;s=we(s,2,"0");let a=`${e.getSeconds()}`;a=we(a,2,"0");let r=e.getTimezoneOffset()<0?"+":"";return r+=we((-1*Math.floor(e.getTimezoneOffset()/60)).toString(),2,"0")+"'",r+=we((-1*Math.floor(e.getTimezoneOffset()%60)).toString(),2,"0")+"'",`(D:${t}${n}${i}${o}${s}${a}${r})`}const ve=e=>0===e.indexOf("(D:")?`${e.substring(9,11)}.${e.substring(7,11)}.${e.substring(3,7)} ${e.substring(11,13)}:${e.substring(13,15)}`:`${e.substring(8,10)}.${e.substring(6,8)}.${e.substring(2,6)} ${e.substring(10,12)}:${e.substring(12,14)}`;function we(e,t,n){return e.length<t&&(e=`${n.repeat(t-e.length)}${e}`),e}function be(e){const t=e.replace(/^data:[a-z]+\/[a-z]+;base64,/i,""),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=new Uint8Array(256);for(let e=0;e<n.length;e++)i[n.charCodeAt(e)]=e;let o=.75*t.length;"="===t[t.length-1]&&(o--,"="===t[t.length-2]&&o--);const s=new ArrayBuffer(o),a=new Uint8Array(s);let r=0,l=0,d=0,h=0,c=0;for(let e=0;e<t.length;e+=4)l=i[t.charCodeAt(e)],d=i[t.charCodeAt(e+1)],h=i[t.charCodeAt(e+2)],c=i[t.charCodeAt(e+3)],a[r++]=l<<2|d>>4,a[r++]=(15&d)<<4|h>>2,a[r++]=(3&h)<<6|63&c;return a}const Pe=({annotaion:e})=>(t,n)=>{const{itemType:o,color:s}=e,a=s||void 0;switch(o){case z.HIGHLIGHT:case z.SQUIGGLY:case z.UNDERLINE:case z.STRIKE_OUT:return i(v,{icon:f.highlighter,bg:a});case z.STAMP:return i(v,{icon:f.stamp,bg:a});case z.FREE_TEXT:return i(v,{icon:f.freeText,bg:a});case z.POPUP:case z.TEXT:return i(v,{icon:f.stickyNote,bg:a});case z.INK:return i(v,{icon:f.pencil,bg:a});case z.SQUARE:{const t=e.fillColor;return i(v,{icon:f.rectangle,bg:t})}case z.CIRCLE:{const t=e.fillColor;return i(v,{icon:f.circle,bg:t})}default:return i(v,{icon:f.annotation,bg:a})}},ye=({item:e})=>(t,n)=>{switch(e.Type){case"/Create":return i("li",null,i("div",null,i(v,{icon:f.addLayer}),e.T&&i("span",{class:"pwv-author"},e.T),i("time",null,ve(e.D))));case"/Edit":const t={};if(e.Parms)for(let n=0;n<e.Parms.length;n+=2){const i=e.Parms[n];let o=e.Parms[n+1];o=Le(o),t[i]=o||""}return i("li",null,i("div",null,i(v,{icon:f.pen}),e.T&&i("span",{class:"pwv-author"},e.T),i("time",null,ve(e.D))),i("div",{class:"pwv-ms-custom-history-content"},t["/Subj"]&&i("h5",null,t["/Subj"]),t["/Contents"]&&i("p",null,t["/Contents"])));case"/Lock":return i("li",null,i("div",null,i(v,{icon:f.lock}),e.T&&i("span",{class:"pwv-author"},e.T),i("time",null,ve(e.D))));case"/Unlock":return i("li",null,i("div",null,i(v,{icon:f.unlock}),e.T&&i("span",{class:"pwv-author"},e.T),i("time",null,ve(e.D))));case"/Delete":return i("li",null,i("div",null,i(v,{icon:f.delete}),e.T&&i("span",{class:"pwv-author"},e.T),i("time",null,ve(e.D))));default:return i("li",null,"...")}},Ce=({annotaion:e})=>(t,n)=>{const{markedText:o,itemType:s,color:a}=e;switch(s){case z.HIGHLIGHT:return i("span",{style:{backgroundColor:a}},o);case z.SQUIGGLY:return i("span",{style:{textDecoration:"underline",textDecorationStyle:"wavy",textDecorationColor:a}},o);case z.UNDERLINE:return i("span",{style:{textDecoration:"underline",textDecorationColor:a}},o);case z.STRIKE_OUT:return i("span",{style:{textDecoration:"line-through",textDecorationColor:a}},o);default:return null}};let Ae;const Ee=({annotation:e,selected:t})=>(n,o)=>{var a,r,l,d,h;const c=e.itemType===z.HIGHLIGHT||e.itemType===z.SQUIGGLY||e.itemType===z.UNDERLINE||e.itemType===z.STRIKE_OUT,{annotationNavigation:u}=n.options.viewer.sidebar,p="object"==typeof u&&(null===(a=u.textMarkup)||void 0===a?void 0:a.preview)?u.textMarkup.preview:"none";return i("li",{class:s("pwv-annotation-navigation-item",{"pwv-selected":t,"pwv-deleted":e.isHidden()}),id:`pwv-annotation-navigation-item-${e.id}`,onclick:()=>{Ae?(window.clearTimeout(Ae),Ae=void 0):Ae=window.setTimeout((()=>{o.api.goToAnnotation({annotation:e,action:"select"}),Ae=void 0}),250)},ondblclick:()=>{o.api.goToAnnotation({annotation:e,action:"edit"}),Ae=void 0}},i("div",null,i(Pe,{annotaion:e}),e.author&&i("span",{class:"pwv-author"},e.author),i("time",null,null===(r=e.modificationDate)||void 0===r?void 0:r.toLocaleString())),c&&"short"===p&&i("div",{class:"pwv-overflow-ellipsis"},i(Ce,{annotaion:e})),i("div",null,!n.options.annotation.hideAnnotationSubject&&i("h5",null,e.subject),e.content&&i("p",null,e.content),!!e.isLocked()&&i(v,{icon:f.lock,className:"pwv-locked-icon"})),t&&e.privateData&&e.privateData.length>0&&i("div",{class:"pwv-ms-custom-history-list"},i("h5",null,g.getText("sideNavigation.annotation.history")),i("ul",null,null===(h=null===(d=null===(l=JSON.parse(e.privateData)["PDF Tools AG"])||void 0===l?void 0:l.Private)||void 0===d?void 0:d.History)||void 0===h?void 0:h.map((e=>i(ye,{item:e}))))))};function Le(e){return null===e?e:e.slice(1,e.length-1)}const Se=e=>(t,n)=>{const{pageNumber:o}=e,s=t.navigationPanel.annotations[o],a=t.navigationPanel.selectedAnnotation,r=Object.keys(s).map((e=>s[e])),l=t.options.annotation.hideOnDelete&&t.options.annotation.trackHistory,d=r.filter((e=>e.itemType!==z.WIDGET&&(l||!1===e.isHidden()))).sort(((e,t)=>t.pdfRect.pdfY-e.pdfRect.pdfY));return d.length<1?null:i("div",null,i("h4",null,g.getText("sideNavigation.annotation.page")," ",o),i("ul",null,d.map((e=>i(Ee,{annotation:e,selected:void 0!==a&&a.page===e.pdfRect.page&&a.annotationId===e.id})))))},xe=({})=>(e,t)=>{const{annotations:n,annotationsLoaded:o}=e.navigationPanel,s=Object.keys(n).filter((e=>Object.keys(n[e]).length>0));return i("div",{class:"pwv-annotation-navigation"},s.length>0?s.map((e=>i(Se,{pageNumber:e}))):o?i("div",{class:"pwv-NavigationPanel__NoItems"},g.getText("sideNavigation.noAnnotations")):"",!o&&i("div",{class:"pwv-ItemLoader"}))};let Te=null;const Oe=({})=>(e,t)=>{const{thumbnailNavigation:n,outlineNavigation:o,annotationNavigation:a}=e.options.viewer.sidebar,l=(n?1:0)+(o?1:0)+(a?1:0),d=e.options.viewer.permissions.allowRotatePages&&e.licenseFeatures.pageRotation,{selectedNavigation:c,showNavigation:u}=e.navigationPanel,p=e.layout.screenSize===r.Small;return i("div",{class:s("pwv-NavigationPanel",{"pwv-NavigationPanel--open":u})},i("div",{class:"pwv-NavigationPanel__Box"},l>1&&i(h,null,!p&&i(m,null,n&&i(S,{icon:f.sidePaneThumbnails,tooltip:g.getText("sideNavigation.thumbnails"),active:"thumbnail"===c,disabled:!u,onClick:()=>t.navigationPanel.selectNavigation("thumbnail")}),o&&i(S,{icon:f.sidePaneOutline,tooltip:g.getText("sideNavigation.outline"),active:"outline"===c,disabled:!u,onClick:()=>t.navigationPanel.selectNavigation("outline")}),a&&i(S,{icon:f.sidePaneAnnotation,tooltip:g.getText("sideNavigation.annotation"),active:"annotation"===c,disabled:!u,onClick:()=>t.navigationPanel.selectNavigation("annotation")})),i(m,{pushRight:!0},i(S,{icon:f.close,disabled:!u,onClick:t.navigationPanel.toggleNavigationPanel}))),i("div",{class:"pwv-NavigationPanel__Content",oncreate:e=>{e.addEventListener("scroll",(()=>{Te&&window.clearTimeout(Te),Te=window.setTimeout((()=>{const n=Math.floor(e.scrollTop/225)-4,i=n+Math.floor(e.clientHeight/225)+8;t.api.addPageRangeToThumbnailsQueue({from:n,to:i})}),100)}))}},"thumbnail"===c&&n&&i("div",null,i(he,{pages:e.navigationPanel.pages,selectedPage:e.pdfDocument.pageNumber,currentPage:e.pdfDocument.pageNumber,allowRotatePages:d,onPageSelected:t.api.setPageNumber,onRotatePage:t.api.rotatePage})),o&&"outline"===c&&i("div",null,i(pe,null)),a&&"annotation"===c&&i("div",null,i(xe,null)))))},Me=({})=>(e,t)=>{const{disableAnnotationToolbar:n,annotationBarPosition:o}=e.options.viewer.general;return i("div",{class:s("pwv-Viewer",{"pwv-Viewer--loadFile":e.showLoadingIndicator,"pwv-Viewer--saveFile":e.showSaveIndicator})},i(le,null),i("div",{class:"pwv-ViewerContent"},i("div",{class:s("pwv-document-view",`pwv-annotationbar-${o}`)},i("div",{oncreate:e=>{t.createCanvasView(e)}}),!n&&i(de,null)),i(Oe,null)))};let Re=0;const Ne=({className:e,enabled:t,onFileSelected:n},o)=>i("div",{class:s(e,"pwv-dropzone"),ondragover:e=>{if(e.preventDefault(),t&&e.dataTransfer){const t=e.currentTarget,n=e.dataTransfer.items;n&&1===n.length&&"application/pdf"===n[0].type&&(t.classList.add("pwv-dropzone-dragover"),clearTimeout(Re),Re=window.setTimeout((()=>{t.classList.remove("pwv-dropzone-dragover")}),150))}},ondrop:e=>{if(e.preventDefault(),e.dataTransfer){let i=null;if(e.dataTransfer.items)for(let t=0;t<e.dataTransfer.items.length;t++){const n=e.dataTransfer.items[t];if("file"===n.kind&&"application/pdf"===n.type){i=n.getAsFile();break}}else for(let t=0;t<e.dataTransfer.files.length;t++){const n=e.dataTransfer.files[t];if("application/pdf"===n.type){i=n;break}}t&&null!==i&&n(i)}}},o),Ve=({})=>(e,t)=>{const{permissions:n,callbacks:o}=e.options.viewer,{deviceType:s}=e.layout;return i("div",{class:"pwv-modal pwv-openfile pwv-modal--openFile"},i("div",{class:"pwv-modal-dialog"},i("div",{class:"pwv-modal-header"},i(v,{icon:f.pdfFile})),i("div",{class:"pwv-modal-body"},i("div",{class:"pwv-modal-message"},s===a.Desktop&&n.allowFileDrop&&n.allowOpenFile?i("h2",null,g.getText("openFile.dropFileHere")):n.allowOpenFile?i("h2",null,g.getText("openFile.openDocument")):i("h2",null,g.getText("openFile.openFileDisabled"))),i("div",{class:"pwv-btn-row"},n.allowOpenFile?o.onOpenFileButtonClicked?i("button",{class:"pwv-btn",onclick:o.onOpenFileButtonClicked},g.getText("openFile.selectFile")):i("label",{class:"pwv-btn"},g.getText("openFile.selectFile"),i("input",{type:"file",onchange:e=>{if(e.currentTarget.files&&e.currentTarget.files.length&&e.currentTarget.files.length>0){const n=e.currentTarget.files[0];"application/pdf"===n.type&&t.api.open({pdfFile:{data:n,sourceTag:n.name}})}},style:{display:"none"}})):i("div",null)))))},De=({})=>(e,t)=>i("div",{class:"pwv-modal pwv-modal--openFileError"},i("div",{class:"pwv-modal-dialog"},i("div",{class:"pwv-modal-header"},i(v,{icon:f.fileError})),i("div",{class:"pwv-modal-body"},i("div",{class:"pwv-modal-message"},i("p",null,g.getText("openFileError.description"))),i("div",{class:"pwv-btn-row"},i("button",{class:"pwv-btn",onclick:t.loadDocumentConfirmRejected},g.getText("openFileError.ok")))))),ke=({})=>(e,t)=>i("div",{class:"pwv-modal pwv-modal--unsavedChanges"},i("div",{class:"pwv-modal-dialog"},i("div",{class:"pwv-modal-header"},i(v,{icon:f.warning})),i("div",{class:"pwv-modal-body"},i("div",{class:"pwv-modal-message"},i("p",null,g.getText("unsavedChanges.description"))),i("div",{class:"pwv-btn-row"},i("button",{class:"pwv-btn",onclick:()=>{t.api.downloadFile().then((()=>{e.closeCallback?e.closeCallback():t.unsavedChangesDialogFileSaved(),e.fileOpenArgs&&t.api.open(e.fileOpenArgs)}))}},g.getText("unsavedChanges.save")),i("button",{class:"pwv-btn",onclick:()=>{t.unsavedChangesDialogDontSave(),e.fileOpenArgs&&t.api.open(e.fileOpenArgs)}},g.getText("unsavedChanges.dontSave")),i("button",{class:"pwv-btn",onclick:t.unsavedChangesDialogCancel},g.getText("unsavedChanges.cancel")))))),Ie=({})=>(e,t)=>{const n=!e.passwordForm.passwordRequiredError&&!e.passwordForm.invalidPasswordError&&""!==e.passwordForm.password,o=!e.options.viewer.general.hidePasswordFormCancelButton;return i("div",{class:"pwv-modal pwv-modal--passwordForm"},i("div",{class:"pwv-modal-dialog"},i("div",{class:"pwv-modal-header"},i(v,{icon:f.unlock})),i("div",{class:"pwv-modal-body"},i("form",{onsubmit:n=>{n.preventDefault();const i=new FormData(n.currentTarget).get("password");if(i){if(!e.fileOpenArgs)return void t.loadDocumentRejected("error");e.fileOpenArgs&&t.api.open(Object.assign(Object.assign({},e.fileOpenArgs),{password:i}))}}},i("div",{class:"pwv-modal-message"},i("p",null,g.getText("passwordForm.description"))),i("div",{class:"pwv-form-row"},i("div",{class:"pwv-form-field pwv-form-has-error-x"},i("input",{type:"password",class:"pwv-input",name:"password",onkeyup:n=>{const i=n.currentTarget.value;i!==e.passwordForm.password&&(t.passwordForm.updatePassword(i),t.passwordForm.validateForm())},oncreate:e=>{e.focus()}}),e.passwordForm.invalidPasswordError&&i("div",{class:"pwv-form-error"},i(v,{icon:f.warning}),i("span",null,g.getText("passwordForm.invalidPasswordError"))),e.passwordForm.passwordRequiredError&&i("div",{class:"pwv-form-error"},i(v,{icon:f.warning}),i("span",null,g.getText("passwordForm.passwordRequiredError"))))),i("div",{class:"pwv-btn-row"},i("button",{class:s("pwv-btn",{"pwv-disabled":!n}),type:"submit",disabled:!n},g.getText("passwordForm.ok")),o&&i("button",{class:"pwv-btn",type:"button",onclick:t.loadDocumentCancel},g.getText("passwordForm.cancel")))))))},Fe=({})=>i("div",{class:"pwv-Loader"},i("div",null)),Be=({})=>i("div",{class:"pwv-modal pwv-modal--loadApplication"},i("div",{class:"pwv-modal-body-noborder"},i(Fe,null))),je=({})=>(e,t)=>{let n=g.getText("applicationError.defaultMessage");"Invalid License"===e.errorMessage&&(n=g.getText("applicationError.invalidLicense"));const o=g.getText("applicationError.reload");return i("div",{class:"pwv-modal pwv-modal--applicationError"},i("div",{class:"pwv-modal-dialog"},i("div",{class:"pwv-modal-header"},i(v,{icon:f.error}),i("h2",null,g.getText("applicationError.title"))),i("div",{class:"pwv-modal-body"},i("div",{class:"pwv-modal-message"},i("p",null,n)),o&&i("div",{class:"pwv-btn-row"},i("button",{class:"pwv-btn",onclick:()=>{document.location&&document.location.reload()}},o)))))},ze=({})=>i("div",{class:"pwv-modal pwv-modal--loadFile"},i("div",{class:"pwv-modal-dialog"},i("div",{class:"pwv-modal-body"},i("div",{class:"pwv-modal-message"},i("h2",null,g.getText("loadFile.title")),i(Fe,null))))),He=({})=>(e,t)=>i("div",{class:"pwv-modal pwv-modal--saveFile"},i("div",{class:"pwv-modal-dialog"},i("div",{class:"pwv-modal-body"},i("div",{class:"pwv-modal-message"},i("h2",null,g.getText("saveFile.title")),i(Fe,null))))),Ge=({})=>(e,t)=>e.hasError?i(je,null):e.scriptsLoaded||e.appInitialized?e.showOpenFileErrorDialog?i(De,null):e.showPasswordForm?i(Ie,null):e.showUnsavedChangesDialog?i(ke,null):e.showLoadingIndicator?i(ze,null):e.showSaveIndicator?i(He,null):e.hasDocument?null:i(Ve,null):i(Be,null),We=()=>(e,t)=>{const n=e.layout.screenSize===r.Small?"sm":e.layout.screenSize===r.Medium?"md":"lg";return i(Ne,{className:s("pwv-WebViewer",`pwv-WebViewer--${n}`),enabled:e.options.viewer.permissions.allowFileDrop&&e.fileDropEnabled&&e.options.viewer.permissions.allowOpenFile,onFileSelected:e=>t.api.open({pdfFile:{data:e,sourceTag:e.name}})},e.scriptsLoaded&&i(Me,null),i(Ge,null))},_e={busyStateChanged:!0,heightChanged:!0,widthChanged:!0,zoomChanged:!0,rotationChanged:!0,firstVisiblePageChanged:!0,lastVisiblePageChanged:!0,busyState:!1,firstVisiblePage:0,lastVisiblePage:0,pageRects:[],zoom:1,fitMode:G.NONE,pageLayoutMode:W.SINGLE_PAGE,rotation:0,width:{devicePixels:0,cssPixels:0},height:{devicePixels:0,cssPixels:0}},Ue={fistVisiblePageChanged:e=>t=>Object.assign(Object.assign({},t),{firstVisiblePage:e,firstVisiblePageChanged:!0}),lastVisiblePageChanged:e=>t=>Object.assign(Object.assign({},t),{lastVisiblePage:e,lastVisiblePageChanged:!0}),resize:e=>t=>{const n=Object.assign({},t),i=window.devicePixelRatio;return n.width.devicePixels!==e.devicePixelsWidth&&(n.width.cssPixels=e.devicePixelsWidth/i,n.width.devicePixels=e.devicePixelsWidth,n.widthChanged=!0),n.height.devicePixels!==e.devicePixelsHeight&&(n.height.cssPixels=e.devicePixelsHeight/i,n.height.devicePixels=e.devicePixelsHeight,n.heightChanged=!0),n.zoom!==e.zoom&&(n.zoom=e.zoom,n.zoomChanged=!0),n},rotationChanged:e=>t=>Object.assign(Object.assign({},t),{rotation:e,rotationChanged:!0}),updatePageRects:e=>t=>Object.assign(Object.assign({},t),{pageRects:e}),busyStateChanged:e=>t=>Object.assign(Object.assign({},t),{busyState:e,busyStateChanged:!0}),fitModeChanged:e=>t=>Object.assign(Object.assign({},t),{fitMode:e}),pageLayoutModeChanged:e=>t=>Object.assign(Object.assign({},t),{pageLayoutMode:e})},Xe=(e,t,n,i,o=1)=>{let s=null;const a=e.pageRects[i],r=a.x+o,l=a.x+(a.w-2*o),d=a.y+o,h=a.y+(a.h-2*o);return t.x>=r&&t.x<=l&&t.y>=d&&t.y<=h?(n.x=n.x<r?r:n.x>l?l:n.x,n.y=n.y<d?d:n.y>h?h:n.y,s={x:0,y:0,w:0,h:0},t.x<n.x?(s.x=t.x,s.w=n.x-t.x):(s.x=n.x,s.w=t.x-n.x),t.y<n.y?(s.y=t.y,s.h=n.y-t.y):(s.y=n.y,s.h=t.y-n.y),s):s},Ye=(e,t,n,i,o=1)=>{if(i)return Xe(e,t,n,i);for(const i in e.pageRects)if(e.pageRects){const s=Xe(e,t,n,parseInt(i,10),o);if(s)return s}return null},Ke=e=>e.itemType===z.TEXT||e.itemType!==z.FREE_TEXT&&!!e.behaviors&&e.behaviors.canHavePopup&&(!0===e.popup.isOpen||"string"==typeof e.content&&""!==e.content||"string"==typeof e.subject&&""!==e.subject),Ze={setPageAnnotations:e=>t=>{const n=Object.assign({},t),i=e.page;return n.byPage[i]=[],e.items.forEach((e=>{const t=e;n.all[t.id]=t,n.byPage[i].push(t.id),Ke(t)&&(n.popupsByPage[i]||(n.popupsByPage[i]=[]),n.popupsByPage[i].push(t.id),t.popup.isOpen&&(n.openPopupsByPage[i]||(n.openPopupsByPage[i]=[]),n.openPopupsByPage[i].find((e=>e===t.id))||(n.openPopupsByPage[i].push(t.id),n.openPopupChanged=!0)))})),n.annotationsChanged=!0,n},deleteAnnotation:e=>t=>{const n=Object.assign({},t),i=t.all[e].pdfRect.page;return delete n.all[e],n.byPage[i]=n.byPage[i].filter((t=>t!==e)),n.popupsByPage[i]&&(n.popupsByPage[i]=n.popupsByPage[i].filter((t=>t!==e))),n.openPopupsByPage[i]&&(n.openPopupChanged=n.openPopupsByPage[i].indexOf(e)>-1,n.openPopupsByPage[i]=n.openPopupsByPage[i].filter((t=>t!==e))),n.annotationsChanged=!0,n},updateAnnotation:e=>t=>{const n=Object.assign({},t),{behaviors:i}=e,o=e.id,s=e.pdfRect.page;return i.canHavePopup&&(Ke(e)?(n.popupsByPage[s]||(n.popupsByPage[s]=[]),n.popupsByPage[s].indexOf(o)<0&&n.popupsByPage[s].push(e.id)):n.popupsByPage[s]&&(n.popupsByPage[s]=n.popupsByPage[s].filter((e=>e!==o))),e.popup.isOpen?(n.openPopupsByPage[s]||(n.openPopupsByPage[s]=[]),n.openPopupsByPage[s].indexOf(o)<0&&n.openPopupsByPage[s].push(o),n.openPopupChanged=!0):n.openPopupsByPage[s]&&(n.openPopupsByPage[s]=n.openPopupsByPage[s].filter((e=>e!==o)),n.openPopupChanged=!0)),n.all[e.id]=e,n.annotationsChanged=!0,n},addAnnotation:e=>t=>{const n=Object.assign({},t),i=e.pdfRect.page,o=e.id;return n.all[o]=e,n.byPage[i]||(n.byPage[i]=[]),n.byPage[i].push(o),Ke(e)&&(n.popupsByPage[i]||(n.popupsByPage[i]=[]),n.popupsByPage[i].push(o),e.popup.isOpen&&(n.openPopupsByPage[i]||(n.openPopupsByPage[i]=[]),n.openPopupsByPage[i].push(o),n.openPopupChanged=!0)),n.annotationsChanged=!0,n}},qe={resize:e=>t=>{const n=window.devicePixelRatio,i=Object.assign({},t);return t.pixelRatio!==n&&(i.pixelRatio=n,i.pixelRatioChanged=!0),t.width.cssPixels!==e.cssWidth&&(i.width.cssPixels=e.cssWidth,i.width.devicePixels=e.cssWidth*n,i.widthChanged=!0),t.height.cssPixels!==e.cssHeight&&(i.height.cssPixels=e.cssHeight,i.height.devicePixels=e.cssHeight*n,i.heightChanged=!0),i},setPixelRatio:e=>t=>{const n=Object.assign({},t);return t.pixelRatio!==e&&(n.pixelRatio=e,n.pixelRatioChanged=!0),n},setCanvasInvalidated:e=>t=>Object.assign(Object.assign({},t),{canvasInvalidated:e})},$e={scrollChanged:e=>t=>{const n=Object.assign({},t),i=window.devicePixelRatio;return t.top.devicePixels!==e.cssTop&&(n.top.cssPixels=e.cssTop/i,n.top.devicePixels=e.cssTop,n.topPositionChanged=!0),t.left.devicePixels!==e.cssLeft&&(n.left.cssPixels=e.cssLeft/i,n.left.devicePixels=e.cssLeft,n.leftPositionChanged=!0),n}},Qe={positionChanged:!0,stateChanged:!0,isDown:!1,type:"ontouchstart"in window?"touch":"mouse",action:null,x:{devicePixels:0,cssPixels:0},y:{devicePixels:0,cssPixels:0}},Je={setAction:e=>t=>Object.assign(Object.assign({},t),{action:e}),update:e=>t=>{const n=window.devicePixelRatio,i=Object.assign({},t);return i.type=e.type,t.x.cssPixels===e.cssY&&t.x.cssPixels===e.cssX||(i.x.cssPixels=e.cssX,i.x.devicePixels=e.cssX*n,i.y.cssPixels=e.cssY,i.y.devicePixels=e.cssY*n,i.positionChanged=!0),t.isDown!==e.isDown&&(i.isDown=e.isDown,i.stateChanged=!0),i}},et={start:e=>t=>Object.assign(Object.assign(Object.assign({},t),e),{match:null,page:1}),updateMatch:e=>t=>Object.assign(Object.assign(Object.assign({},t),e),{painted:!1}),matchPainted:()=>e=>Object.assign(Object.assign({},e),{painted:!0}),clear:()=>e=>({searchString:"",caseSensitive:!1,wrapSearch:!1,useRegex:!1,page:1,match:null,painted:!1})};var tt,nt;!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.ANNOTATION_SELECTED=1]="ANNOTATION_SELECTED",e[e.TEXT_SELECTED=2]="TEXT_SELECTED",e[e.POPUP_SELECTED=3]="POPUP_SELECTED",e[e.MODULE_SELECTED=4]="MODULE_SELECTED"}(tt||(tt={})),function(e){e.DEFAULT="default",e.TEXT="text",e.NONE="none",e.POINTER="pointer",e.CROSSHAIR="crosshair",e.NOT_ALLOWED="not-allowed",e.WAIT="wait",e.MOVE="move",e.GRAB="grab",e.GRABBING="grabbing",e.COL_RESIZE="col-resize",e.ROW_RESIZE="row-resize",e.NS_RESIZE="ns-resize",e.EW_RESIZE="ew-resize",e.NESW_RESIZE="nesw-resize",e.NWSE_RESIZE="nwse-resize",e.ERASE="url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADwQAAA8EB0Z6ZfgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAM+SURBVEiJtZRbSBRRGMe/WTd3dmfmzOyZdcaVQlCsl3yK8lIqRAgFIbrubGa6D1IURQ8RhWgPQZC0RRQ99agPQXSDNCPEy67FCqZb6boma7Vq1w0zytvO7PTS0qZ7M+wPw8D3/+b/O+fMzEcEg0HV5/NBtPx+/2273W6D9ZDL5VIBIAwAi1HXkXUJBwDt7/sbAMhdr9BoaVJtbK6sPLwrP9/4XwBX7XbH6YqKG+erqjxHy8uFtQC0c3NzPQBwK17DzWPHzlsKCk5u0Gq1hXl5GwmCGJyX5aLW7u6ZVABEItNRV9dkLys7R5Hkhuj64OTkh3tOZ/G1rq5AMkBaPON6Q8OJ2pKSCzRJpq/0soxGRsC4xsRx9/vHxmbXDGiprT1uKy6+zOr1q8IjElmWZvX6GoamHw6Mj39NGXClvv7QwdLS60aK0iVaGQBAJsdRPEXZkF7f4Z6YCCYFNErSPntJSSumaTJZeBTEICJky+D5jn6v98tK/6/PVKeqwW/z80qq4RHlmM28YtrcZ7UeyV/p/bWDXq93RkSoLwOhap5hkh4RAMCyLMPVVx8VcaeN4hB7QKBRz+jY0PuYgN+QKTPLuniEqk1JIEuhEDhezISFAksaEAToWIE0Yl7KNtIuz8jQVExABCJynDMDIYuJYWK+j5CiQMvzd4pQZE0jNH9OOp0x6QwsL2VnsG7Py8G3cf8Dp9c7bca4Q0RIwgxjiPZkRYFLQ+8UoUhK02hWTxsdY0o3MNiSbebdcQEAAL2jo59Zmn6CaVoSWVYfCXcMTyl8YXXM8GgICcT+hAAAgKc+3ycBoUeYpiWeYQyXhwNhXJA4HABAXvyhwrSnPSkAAMDl832mSbL92XeN1bSzhtZoEj8mLy2oCyOPO5odjdUpAQAA3BMTQQpvahcwL5HGTCpenyovq6Hx7r6mljN7ARIMu1jy+0eCyIAeYA7ZSFZcBVEVWZ0dfDBw7tLZskgt4biOp117LDm7d1ucOHebOVILhxX4+aJzuPniqe0EQaiR+pp2EFFgcmxWWVq+I/LYasBZSFVV+OnpfLll0r1jqySFo3v/CQAAEAi8ngsvh+6KHFMZmvJMi7Pj2+1tbfLKvl/ycBilf3EZ0gAAAABJRU5ErkJggg=='), auto"}(nt||(nt={}));const it={modeChanged:!0,mode:tt.DEFAULT,selectedAnnotationId:null,selectedAnnotationBehaviors:null,selectedAnnotationChanged:!0,textSelectionChanged:!0,textSelection:null,textSelectionType:null,textSelectionState:null,textSelectionRects:null,selectedPopupId:null,selectedPopupChanged:!0,popupFocus:null,selectedModuleName:null,cursorStyle:nt.DEFAULT,cursorStyleChanged:!0,contextBarItems:[]},ot=e=>{return t=void 0,n=void 0,o=function*(){try{yield navigator.clipboard.writeText(e)}catch(n){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select(),document.execCommand("copy"),document.body.removeChild(t)}},new((i=void 0)||(i=Promise))((function(e,s){function a(e){try{l(o.next(e))}catch(e){s(e)}}function r(e){try{l(o.throw(e))}catch(e){s(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,r)}l((o=o.apply(t,n||[])).next())}));var t,n,i,o},st={document:_e,annotations:{annotationsChanged:!1,openPopupChanged:!1,all:[],byPage:[],popupsByPage:[],openPopupsByPage:[]},canvas:{widthChanged:!0,heightChanged:!0,pixelRatioChanged:!0,canvasInvalidated:!0,width:{devicePixels:0,cssPixels:0},height:{devicePixels:0,cssPixels:0},pixelRatio:1},scroll:{topPositionChanged:!1,leftPositionChanged:!1,top:{devicePixels:0,cssPixels:0},left:{devicePixels:0,cssPixels:0}},pointer:Qe,startPointer:Qe,search:{searchString:"",caseSensitive:!1,wrapSearch:!1,useRegex:!1,page:1,match:null,painted:!1},viewer:it},at=e=>JSON.parse(JSON.stringify(e)),rt={document:Ue,annotations:Ze,canvas:qe,scroll:$e,search:et,pointer:Je,startPointer:Je,viewer:{setDefaultMode:()=>e=>({modeChanged:!0,mode:tt.DEFAULT,selectedAnnotationId:null,selectedAnnotationBehaviors:null,selectedAnnotationChanged:!0,textSelectionChanged:!0,textSelection:null,selectedPopupId:null,selectedPopupChanged:!0,selectedModuleName:null,cursorStyle:nt.DEFAULT,cursorStyleChanged:!0}),addContextBarItem:e=>t=>{const n=t.contextBarItems;return e.itemTypes.forEach((t=>{n[t]||(n[t]=[]),n[t].push(e)})),Object.assign(Object.assign({},t),{contextBarItems:n})},clearContextBarItems:()=>e=>Object.assign(Object.assign({},e),{contextBarItems:[]}),setCursorStyle:e=>t=>Object.assign(Object.assign({},t),{cursorStyle:e,cursorStyleChanged:t.cursorStyle!==e}),selectAnnotation:e=>t=>Object.assign(Object.assign({},t),{selectedAnnotationId:e.id,selectedAnnotationBehaviors:e.behaviors,selectedAnnotationChanged:!0,selectedModuleName:null,selectedPopupId:null,modeChanged:!0,mode:tt.ANNOTATION_SELECTED}),deselectAnnotation:()=>e=>{const t=e.mode===tt.ANNOTATION_SELECTED;return Object.assign(Object.assign({},e),{selectedAnnotationId:null,selectedAnnotationBehaviors:null,selectedModuleName:null,selectedAnnotationChanged:!0,modeChanged:t,mode:t?tt.DEFAULT:e.mode})},beginModule:e=>t=>Object.assign(Object.assign({},t),{modeChanged:!0,mode:tt.MODULE_SELECTED,selectedAnnotationId:null,selectedAnnotationBehaviors:null,selectedAnnotationChanged:!0,textSelectionChanged:!0,textSelection:null,selectedModuleName:e,selectedPopupId:null,selectedPopupChanged:!0}),endModule:e=>t=>{const n=t.selectedModuleName===e?null:t.selectedModuleName,i=null!==n?tt.MODULE_SELECTED:tt.DEFAULT;return Object.assign(Object.assign({},t),{modeChanged:!0,selectedModuleName:n,mode:i})},setTextSelectionState:e=>t=>Object.assign(Object.assign({},t),{textSelectionState:e}),setTextSelection:e=>t=>{const{selection:n,type:i}=e,o=n?tt.TEXT_SELECTED:tt.DEFAULT,s=t.mode!==o,a=n?{}:null;if(n&&a){const e={};n.quadrilaterals.forEach((t=>{const{bottomLeft:n,bottomRight:i,topRight:o,topLeft:s,pageNumber:a}=t;e[a]||(e[a]={x1:Number.MAX_SAFE_INTEGER,y1:Number.MAX_SAFE_INTEGER,x2:Number.MIN_SAFE_INTEGER,y2:Number.MIN_SAFE_INTEGER}),e[a]={x1:Math.min(e[a].x1,n.x,i.x,o.x,s.x),y1:Math.min(e[a].y1,n.y,i.y,o.y,s.y),x2:Math.max(e[a].x2,n.x,i.x,o.x,s.x),y2:Math.max(e[a].y2,n.y,i.y,o.y,s.y)}})),Object.keys(e).forEach((t=>{a[t]={pdfX:e[t].x1,pdfY:e[t].y1,pdfW:e[t].x2-e[t].x1,pdfH:e[t].y2-e[t].y1,page:parseInt(t)}}))}return Object.assign(Object.assign({},t),{mode:o,modeChanged:s,textSelectionChanged:!0,textSelection:n,textSelectionType:i,textSelectionRects:a})},selectPopup:e=>t=>{const n=null!==e.id?tt.POPUP_SELECTED:tt.DEFAULT,i=t.mode!==n;return Object.assign(Object.assign({},t),{mode:n,modeChanged:i,selectedPopupChanged:e.id!==t.selectedPopupId,selectedPopupId:e.id,popupFocus:e.focus?e.id:null})},clearPopupFocus:()=>e=>Object.assign(Object.assign({},e),{popupFocus:null}),deselectPopup:()=>e=>{const t=tt.DEFAULT,n=t!==e.mode;return Object.assign(Object.assign({},e),{mode:t,modeChanged:n})}},getState:()=>e=>e,loadDefaultState:()=>e=>{const t=at(st);var n;return t.viewer.contextBarItems=e.viewer.contextBarItems,t.search=((n=e.search).page=1,n.match=null,n),t},resetChangedState:()=>e=>Object.assign(Object.assign({},e),{changed:!1,viewer:Object.assign(Object.assign({},e.viewer),{modeChanged:!1,cursorStyleChanged:!1,selectedAnnotationChanged:!1,textSelectionChanged:!1,selectedPopupChanged:!1,command:null}),annotations:Object.assign(Object.assign({},e.annotations),{annotationsChanged:!1,openPopupChanged:!1}),document:Object.assign(Object.assign({},e.document),{busyStateChanged:!1,heightChanged:!1,widthChanged:!1,firstVisiblePageChanged:!1,lastVisiblePageChanged:!1,rotationChanged:!1,zoomChanged:!1}),canvas:Object.assign(Object.assign({},e.canvas),{canvasInvalidated:!1,heightChanged:!1,widthChanged:!1}),scroll:Object.assign(Object.assign({},e.scroll),{leftPositionChanged:!1,topPositionChanged:!1}),pointer:Object.assign(Object.assign({},e.pointer),{positionChanged:!1,stateChanged:!1,action:null})})};class lt{constructor(e){this.eventListeners=new Map,this.trackEvents=!0,this.startPosX=0,this.startPosY=0,this.multiTouch=!1,this.pinch=!1,this.dragging=!1,this.lastTouchPosX=0,this.lastTouchPosY=0,this.lastPinchDiv=0,this.lastPinchPosX=0,this.lastPinchPosY=0,this.lastTouchX1=0,this.lastTouchY1=0,this.lastTouchX2=0,this.lastTouchY2=0,this.clickTimer=null,this.clickDuration=250,this.dblClickTimer=null,this.dblClickDuration=250,this.longPressTimer=null,this.longPressDuration=750,this.onMouseDown=this.onMouseDown.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onStart=this.onStart.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onMove=this.onMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnd=this.onEnd.bind(this),this.suspend=this.suspend.bind(this),this.resume=this.resume.bind(this),this.element=e,this.element.addEventListener("mousedown",this.onMouseDown,{passive:!0}),this.element.addEventListener("mousemove",this.onMouseMove,{passive:!0}),this.element.addEventListener("touchstart",this.onTouchStart,{passive:!1}),window.addEventListener("pdfwebviewer.DragMoveHandlerStart",(()=>{this.suspend()}),{passive:!0}),window.addEventListener("pdfwebviewer.DragMoveHandlerEnd",(()=>{this.resume()}),{passive:!0})}addEventListener(e,t){this.eventListeners.has(e)?this.eventListeners.get(e).push(t):this.eventListeners.set(e,[t])}removeEventListener(e,t){if(this.eventListeners.has(e)){let n=this.eventListeners.get(e);n=n.filter((e=>e!==t)),0!==n.length?this.eventListeners.set(e,n):this.eventListeners.delete(e)}}suspend(){this.trackEvents=!1,this.element.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("touchmove",this.onTouchMove)}resume(){this.trackEvents||(this.trackEvents=!0,this.element.addEventListener("mousemove",this.onMouseMove,{passive:!0}))}dispatchEvent(e,t){this.eventListeners.has(e)&&this.eventListeners.get(e).forEach((e=>e(t)))}clearClickTimer(){null!==this.clickTimer&&(window.clearTimeout(this.clickTimer),this.clickTimer=null)}clearLongPressTimer(){null!==this.longPressTimer&&(window.clearTimeout(this.longPressTimer),this.longPressTimer=null)}clearDblClickTimer(){null!==this.dblClickTimer&&(window.clearTimeout(this.dblClickTimer),this.dblClickTimer=null)}mouseToCanvasPointerEvent(e){return{clientX:e.clientX,clientY:e.clientY,movementX:e.movementX,movementY:e.movementY,buttons:e.buttons,type:"mouse"}}touchToCanvasPointerEvent(e){const t={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY,movementX:e.touches[0].clientX-this.lastTouchPosX,movementY:e.touches[0].clientY-this.lastTouchPosY,buttons:1===e.touches.length?1:4,type:"touch"};return this.lastTouchPosX=e.touches[0].clientX,this.lastTouchPosY=e.touches[0].clientY,t}getPinchPos(e){const t=e.touches[0].clientX,n=e.touches[0].clientY,i=e.touches[1].clientX,o=e.touches[1].clientY,s=Math.abs(t-i),a=Math.abs(n-o),r=Math.sqrt(s*s+a*a);return{clientX:Math.min(t,i)+s,clientY:Math.min(n,o)+a,distance:r}}touchToCanvasPointerPinchEvent(e){const{clientX:t,clientY:n,distance:i}=this.getPinchPos(e),o={clientX:t,clientY:n,movementX:t-this.lastPinchPosX,movementY:n-this.lastPinchPosY,distance:i,movementDistance:i-this.lastPinchDiv,buttons:1,type:"touch"};return this.lastPinchPosX=o.clientX,this.lastPinchPosY=o.clientY,this.lastPinchDiv=i,o}onMouseDown(e){if(this.trackEvents){const t=this.mouseToCanvasPointerEvent(e);this.onStart(t),window.addEventListener("mouseup",this.onMouseUp,{passive:!0})}}onTouchStart(e){if(e.preventDefault(),this.pinch=!1,this.trackEvents){if(0===e.touches.length)return;if(1===e.touches.length){this.lastTouchPosX=e.touches[0].clientX,this.lastTouchPosY=e.touches[0].clientY;const t=this.touchToCanvasPointerEvent(e);this.onStart(t),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})}else if(2===e.touches.length){this.clearClickTimer(),this.clearDblClickTimer(),this.clearLongPressTimer(),this.multiTouch=!0;const{clientX:t,clientY:n,distance:i}=this.getPinchPos(e);this.lastPinchDiv=i,this.lastPinchPosX=t,this.lastPinchPosY=n,this.lastTouchX1=e.touches[0].clientX,this.lastTouchY1=e.touches[0].clientY,this.lastTouchX2=e.touches[1].clientX,this.lastTouchY2=e.touches[1].clientY,window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1})}}}onStart(e){this.startPosX=e.clientX,this.startPosY=e.clientY,this.dragging=!1,this.dblClickTimer||(this.clickTimer=window.setTimeout((()=>{this.clickTimer=null}),this.clickDuration)),this.longPressTimer=window.setTimeout((()=>{this.longPressTimer=null,this.dispatchEvent("pointerlongpress",e)}),this.longPressDuration),this.dispatchEvent("pointerdown",e)}onMouseMove(e){const t=this.mouseToCanvasPointerEvent(e);this.onMove(t)}onTouchMove(e){if(e.preventDefault(),e.stopPropagation(),e.touches)if(1!==e.touches.length||this.multiTouch){if(2===e.touches.length){const t=this.touchToCanvasPointerPinchEvent(e),n=e.touches[0].clientX,i=e.touches[0].clientY,o=e.touches[1].clientX,s=e.touches[1].clientY,a=n-this.lastTouchX1,r=i-this.lastTouchY1,l=o-this.lastTouchX2,d=s-this.lastTouchY2,h=Math.sign(a),c=Math.sign(r),u=Math.sign(l),p=Math.sign(d);h===u&&c===p||(h===u||0===a||0===l)&&(c===p||0===r||0===d)||Math.max(Math.abs(t.movementX),Math.abs(t.movementY))>Math.abs(t.movementDistance)?(t.buttons=4,this.onMove(t),this.pinch=!1):(this.dispatchEvent("pinch",t),this.pinch=!0),this.lastTouchX1=e.touches[0].clientX,this.lastTouchY1=e.touches[0].clientY,this.lastTouchX2=e.touches[1].clientX,this.lastTouchY2=e.touches[1].clientY}}else{const t=this.touchToCanvasPointerEvent(e);this.onMove(t)}}onMove(e){this.dispatchEvent("pointermove",e),this.clickTimer||this.longPressTimer?(Math.abs(this.startPosX-e.clientX)>5||Math.abs(this.startPosY-e.clientY)>5)&&(this.clearLongPressTimer(),this.clearClickTimer(),this.dispatchEvent("pointerstartdrag",e),this.dragging=!0):e.buttons>0&&!this.dragging&&(this.dispatchEvent("pointerstartdrag",e),this.dragging=!0)}onMouseUp(e){const t=this.mouseToCanvasPointerEvent(e);this.onEnd(t),window.removeEventListener("mouseup",this.onMouseUp)}onTouchEnd(e){if(0===e.touches.length){this.multiTouch=!1;const e={clientX:this.lastTouchPosX,clientY:this.lastTouchPosY,movementX:0,movementY:0,buttons:0,type:"touch"};this.onEnd(e),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd)}}onEnd(e){this.dispatchEvent("pointerup",e),null!==this.dblClickTimer?(this.clearDblClickTimer(),this.dispatchEvent("pointerdblclick",e)):null!==this.clickTimer&&(this.dispatchEvent("pointerclick",{clientX:this.startPosX,clientY:this.startPosY,movementX:e.movementX,movementY:e.movementY,buttons:e.buttons,type:e.type}),this.dblClickTimer=window.setTimeout((()=>{this.dblClickTimer=null}),this.dblClickDuration)),this.dragging&&this.dispatchEvent("pointerenddrag",e),this.lastTouchX1=0,this.lastTouchY1=0,this.lastTouchX2=0,this.lastTouchY2=0,this.lastTouchPosX=0,this.lastTouchPosY=0,this.lastPinchPosX=0,this.lastPinchPosY=0,this.clearClickTimer(),this.clearLongPressTimer()}}var dt;!function(e){e[e.Tool=0]="Tool",e[e.Layer=1]="Layer"}(dt||(dt={}));class ht{constructor(){this.canvasLayers={},this.store=null,this.pdfApi=null,this.pdfViewerCanvas=null,this.options=null,this.name=null,this.containerElement=null,this.createCanvasLayer=this.createCanvasLayer.bind(this),this.removeCanvasLayer=this.removeCanvasLayer.bind(this)}register(e,t,n,i,o){return this.containerElement=e,this.store=t,this.pdfApi=n,this.pdfViewerCanvas=i,this.options=o,this.onRegister()}render(e,t){const n=Object.keys(this.canvasLayers);for(let i=0;i<n.length;i++)this.canvasLayers[n[i]].render(e,t)}deactivate(){const e=Object.keys(this.canvasLayers);for(let t=0;t<e.length;t++){const n=e[t];this.canvasLayers[n].onRemove(),delete this.canvasLayers[n]}}resize(e,t){const n=Object.keys(this.canvasLayers);for(let i=0;i<n.length;i++)this.canvasLayers[n[i]].resize(e,t)}getCanvasSize(){const e={width:0,height:0};if(null!==this.containerElement){const t=this.containerElement.getBoundingClientRect();e.width=t.width,e.height=t.height}return e}onSave(){return new Promise(((e,t)=>{const n=Object.keys(this.canvasLayers),i=[];for(let e=0;e<n.length;e++)i.push(this.canvasLayers[n[e]].onSave());Promise.all(i).then((()=>{e()})).catch((e=>{t("OnSave failed on a canvas layer: "+e)}))}))}createCanvasLayer(e,t,n){if(!(this.containerElement&&this.store&&this.pdfApi&&this.pdfViewerCanvas&&this.options))throw new Error("canvas layer is not registered");{if(this.canvasLayers[e])throw new Error("duplicate canvas layer name");const i=new t(this,e,this.containerElement,this.store,this.pdfApi,this.pdfViewerCanvas,this.options);this.canvasLayers[e]=i,i.onCreate(n)}}removeCanvasLayer(e){this.canvasLayers[e]&&(this.canvasLayers[e].onRemove(),delete this.canvasLayers[e])}}function ct(e,t,n,i,o){let s={};s=e.privateData?JSON.parse(e.privateData):{"PDF Tools AG":{}},s.hasOwnProperty("PDF Tools AG")||(s["PDF Tools AG"]={}),s["PDF Tools AG"].hasOwnProperty("Private")||(s["PDF Tools AG"].Private={}),s["PDF Tools AG"].Private.hasOwnProperty("History")||(s["PDF Tools AG"].Private.History=[]),s["PDF Tools AG"].Private.LastModified=fe();const a={D:fe(),T:`(${n})`};if("create"===t)a.Type="/Create";else if("edit"===t){if(a.Type="/Edit",a.params=[],null!==i&&e.content!==i&&(a.params.push("/Contents"),a.params.push(`(${i})`)),null!==o&&e.subject!==o&&(a.params.push("/Subj"),a.params.push(`(${o})`)),0===a.params.length)return}else"lock"===t?a.Type="/Lock":"unlock"===t?a.Type="/Unlock":"delete"===t&&(a.Type="/Delete",e.popup.isOpen=!1);a&&s["PDF Tools AG"].Private.History.push(a),e.privateData=JSON.stringify(s)}class ut{constructor(e,t,n,i,o,s,a){this.canvasContexts=[],this.htmlLayers=[],this.containerElement=n,this.store=i,this.pdfApi=o,this.pdfViewerCanvas=s,this.options=a,this.module=e,this.name=t,this.remove=this.remove.bind(this),this.onAnnotationCreated=this.onAnnotationCreated.bind(this)}resize(e,t){const n=document.createElement("canvas");n.width=e*devicePixelRatio,n.height=t*devicePixelRatio;const i=n.getContext("2d");this.canvasContexts.forEach((n=>{i.drawImage(n.canvas,0,0),n.canvas.style.width=e+"px",n.canvas.style.height=t+"px",n.canvas.width=e*devicePixelRatio,n.canvas.height=t*devicePixelRatio,n.drawImage(i.canvas,0,0)}))}remove(){this.module.removeCanvasLayer(this.name)}createHtmlLayer(){const e=document.createElement("div");return this.htmlLayers.push(e),this.containerElement&&this.containerElement.appendChild(e),e}createCanvas(){const e=document.createElement("canvas");e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.right="0",e.style.bottom="0";const t=e.getContext("2d");if(this.canvasContexts.push(t),this.containerElement){this.containerElement.appendChild(e);const n=this.containerElement.getBoundingClientRect();t.canvas.width=n.width*devicePixelRatio,t.canvas.height=n.height*devicePixelRatio,t.canvas.style.width=n.width+"px",t.canvas.style.height=n.height+"px"}return t}removeHtmlElements(){if(this.containerElement){for(let e=0;e<this.htmlLayers.length;e++)this.containerElement.removeChild(this.htmlLayers[e]);this.htmlLayers=[]}}removeCanvasElements(){if(this.containerElement){for(let e=0;e<this.canvasContexts.length;e++)this.containerElement.removeChild(this.canvasContexts[e].canvas);this.canvasContexts=[]}}onAnnotationCreated(e){return this.options.annotation.trackHistory?(ct(e,"create",this.options.viewer.general.user),this.pdfApi.updateItem(e)):new Promise((t=>t(e)))}}const pt="AddStampAnnotation";class gt extends ut{constructor(){super(...arguments),this.context=null,this.pointerDown=!1,this.startPoint=null,this.stampRect=null,this.page=0,this.screenPageRect=null,this.aspectRatio=null,this.stamps=[]}onCreate(){this.setStamp=this.setStamp.bind(this),this.close=this.close.bind(this),this.context=this.createCanvas(),this.stamps=this.options.annotation.stamps;const e=this.module.toolbarElement;this.setStamp(this.options.annotation.selectedStamp),((e,t)=>{const n={stamps:e.stamps,stampDropdownItems:[],selectedStamp:e.selectedStamp},s=e=>{const t=n.stamps[e.value];return t.thumbnail?i("div",{title:t.title||""},i("img",{src:t.thumbnail})):t.name?i("div",{title:t.title||""},t.name):i("div",{title:t.title||""},t.image?t.name:t.text?t.text:g.getText(t.translation_key))},a=e=>{if(-1===e)return i("div",{class:"pwv-Dropdown-text"},g.getText("annotStamp.chooseStamp"));const t=n.stamps[e];return t.thumbnail?i("div",{class:"pwv-Dropdown-text"},i("img",{src:t.thumbnail})):t.pdfStampFileName?i("div",{class:"pwv-Dropdown-text"},t.name):i("div",{class:"pwv-Dropdown-text"},t.image?t.name:t.text?t.text:g.getText(t.translation_key))},r=({})=>(t,n)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(P,{className:"pwv-stampannotation-dropdown",value:t.selectedStamp,items:t.stamps.map(((e,t)=>({value:t,renderItem:s}))),onChange:n.setStamp,renderButton:a})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onClose})));o(n,{setStamp:t=>n=>(e.onStampChanged(t),Object.assign(Object.assign({},n),{selectedStamp:t}))},(()=>i(r,null)),t)})({selectedStamp:this.options.annotation.selectedStamp,stamps:this.stamps,onStampChanged:this.setStamp,onClose:this.close},e),this.store.viewer.beginModule(pt)}onSave(){return new Promise(((e,t)=>{e()}))}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.setCursorStyle(nt.DEFAULT),this.store.viewer.endModule(pt)}render(e,t){if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==pt)this.remove();else if(this.aspectRatio&&this.context&&(t.viewer.modeChanged||t.pointer.positionChanged||t.pointer.action||t.document.zoomChanged)){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const n={x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels},i=this.pdfApi.transformScreenPointToPdfPoint(n);if(i.isOnPage?this.store.viewer.setCursorStyle(nt.CROSSHAIR):this.store.viewer.setCursorStyle(nt.NOT_ALLOWED),t.pointer.isDown){if(!this.pointerDown){if(!i.isOnPage)return;this.startPoint=n,this.page=i.pdfPoint.page,this.pointerDown=!0,this.screenPageRect=this.pdfApi.getPageScreenRect(this.page)}if(this.startPoint&&this.screenPageRect&&(this.stampRect=Ye(t.document,{x:this.startPoint.x,y:this.startPoint.y},{x:n.x,y:n.y}),this.stampRect)){this.stampRect.h=this.stampRect.w/this.aspectRatio;const t=2*devicePixelRatio;e.save(),e.strokeStyle=this.options.viewer.general.textSelectionColor,e.fillStyle=this.options.viewer.general.textSelectionColor,e.lineWidth=t,e.setLineDash([t,t]),this.startPoint.y>n.y?(this.stampRect.y=this.startPoint.y-this.stampRect.h,this.stampRect.y<this.screenPageRect.y&&(this.stampRect.y=this.screenPageRect.y,this.stampRect.w=this.stampRect.h*this.aspectRatio)):this.startPoint.y+this.stampRect.h>this.screenPageRect.y+this.screenPageRect.h&&(this.stampRect.h=this.screenPageRect.y+this.screenPageRect.h-this.startPoint.y,this.stampRect.w=this.stampRect.h*this.aspectRatio),e.strokeRect(this.stampRect.x,this.stampRect.y,this.stampRect.w,this.stampRect.h),e.globalAlpha=.33,e.fillRect(this.stampRect.x,this.stampRect.y,this.stampRect.w,this.stampRect.h),e.restore()}}else if(this.pointerDown&&this.startPoint&&this.stampRect)return this.createStampAnnotation(this.stampRect),this.pointerDown=!1,this.startPoint=null,this.stampRect=null,this.page=0,this.aspectRatio=null,this.screenPageRect=null,void this.remove()}}close(){this.remove()}setStamp(e){if(0==this.stamps.length)return;e>=this.stamps.length&&(e=0),this.options.annotation.selectedStamp=e;const t=this.stamps[e];if(t.aspectRatio)this.aspectRatio=t.aspectRatio;else{if(t.image){const e=new Image;return e.onload=()=>{this.aspectRatio=e.width/e.height},void(e.src=t.image)}this.pdfApi.getTextStampAspectRatio(t.text?t.text:g.getText(t.translation_key)).then((e=>{this.aspectRatio=e}))}}createStampAnnotation(e){const t=this.pdfApi.transformScreenRectToPdfRect(e,this.page);if(this.aspectRatio&&(t.pdfW<2||t.pdfH<2))switch(this.pdfApi.getRotation()){case 0:t.pdfW=this.options.annotation.defaultStampWidth,t.pdfH=t.pdfW/this.aspectRatio,t.pdfY-=t.pdfH;break;case 90:t.pdfH=this.options.annotation.defaultStampWidth,t.pdfW=t.pdfH/this.aspectRatio;break;case 180:t.pdfW=this.options.annotation.defaultStampWidth,t.pdfH=t.pdfW/this.aspectRatio,t.pdfX-=t.pdfW;break;case 270:t.pdfH=this.options.annotation.defaultStampWidth,t.pdfW=t.pdfH/this.aspectRatio,t.pdfX-=t.pdfW,t.pdfY-=t.pdfH}const n=this.stamps[this.options.annotation.selectedStamp];if(n.pdfStampFileName)this.pdfApi.registerPdfPage(n.pdfStampFileName,n.pageNumber).then((e=>{const n={itemType:z.STAMP,imageId:e,page:t.page,color:this.options.annotation.colors.defaultHighlightColor,pdfRect:t,author:this.options.viewer.general.user};this.pdfApi.createItem(n).then((e=>{this.onAnnotationCreated(e)}))}));else if(n.image){const e=be(n.image);this.pdfApi.registerStampImage(e).then((e=>{const n={itemType:z.STAMP,imageId:e,page:t.page,color:this.options.annotation.colors.defaultHighlightColor,pdfRect:t,author:this.options.viewer.general.user};this.pdfApi.createItem(n).then((e=>{this.onAnnotationCreated(e)}))}))}else{let e=null,i=null;n&&(e=n.color,i=void 0!==n.pdfStampName?n.pdfStampName:null);const o={itemType:z.STAMP,color:this.options.annotation.colors.defaultHighlightColor,author:this.options.viewer.general.user,page:t.page,pdfRect:t,stampName:i,stampText:n.text?n.text:g.getText(n.translation_key),stampColor:null!=e?e:B.GREEN};this.pdfApi.createItem(o).then((e=>{this.onAnnotationCreated(e)}))}}}class mt extends ht{constructor(){super(),this.annotationbarElement=null,this.toolbarElement=null,this.name=mt.moduleInfo.name,this.activate=this.activate.bind(this)}onRegister(){return this.toolbarElement=document.createElement("div"),{toolbar:this.toolbarElement}}activate(){this.canvasLayers.add?this.removeCanvasLayer("add"):this.createCanvasLayer("add",gt)}}mt.moduleInfo={name:"StampAnnotationModule",moduleType:dt.Tool,requiredFeatures:{annotate:!0,fillFormFields:!1},translationKey:"annotStamp.add",icon:"stamp"};class ft{constructor(){this.canvasContexts=[],this.htmlLayers=[]}get pdfViewerApi(){if(!this.pPdfViewerApi&&(this.pPdfViewerApi=this.viewerCanvas.pdfViewerApi,!this.pPdfViewerApi))throw new Error("pdfViewerApi in undefined");return this.pPdfViewerApi}get store(){if(!this.pStore&&(this.pStore=this.viewerCanvas.store,!this.pStore))throw new Error("pStore in undefined");return this.pStore}get options(){if(!this.pOptions&&(this.pOptions=this.viewerCanvas.options,!this.pOptions))throw new Error("options in undefined");return this.pOptions}resize(e,t,n){try{const i=document.createElement("canvas");i.width=e*n,i.height=t*n;const o=i.getContext("2d");this.canvasContexts.forEach((i=>{o.drawImage(i.canvas,0,0),i.canvas.style.width=e+"px",i.canvas.style.height=t+"px",i.canvas.width=e*n,i.canvas.height=t*n,i.drawImage(o.canvas,0,0)}))}catch(e){console.warn(e)}}register(e,t){this.viewerCanvas=e,this.dispatchEvent=t,this.containerElement=this.viewerCanvas.viewLayersElement,this.create()}createHtmlLayer(){const e=document.createElement("div");return this.htmlLayers.push(e),this.containerElement&&this.containerElement.appendChild(e),e}createCanvas(e){const t=document.createElement("canvas");t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.right="0",t.style.bottom="0",e&&t.classList.add(e);const n=t.getContext("2d");if(this.canvasContexts.push(n),this.containerElement){this.containerElement.appendChild(t);const e=this.containerElement.getBoundingClientRect();n.canvas.width=e.width*devicePixelRatio,n.canvas.height=e.height*devicePixelRatio}return n}removeHtmlElements(){if(this.containerElement){for(let e=0;e<this.htmlLayers.length;e++)this.containerElement.removeChild(this.htmlLayers[e]);this.htmlLayers=[]}}removeCanvasElements(){if(this.containerElement){for(let e=0;e<this.canvasContexts.length;e++)this.containerElement.removeChild(this.canvasContexts[e].canvas);this.canvasContexts=[]}}addDeleteHistory(e){ct(e,"delete",this.options.viewer.general.user)}}const vt=(e,t,n,i)=>{if(e.save(),e.globalCompositeOperation="multiply",e.globalAlpha=.3,e.fillStyle=n,i.length){e.beginPath();for(let t=0;t<i.length;t++){const n=i[t];for(let t=0;t<n.length;t++){const i=n[t];0===t?e.moveTo(i.x,i.y):e.lineTo(i.x,i.y)}}e.closePath(),e.fill()}e.restore()},wt=(e,t,n,i)=>{const o=i.x,s=i.y;e.beginPath(),e.moveTo(o-5*t,s-5*t),e.lineTo(o+6*t,s-5*t),e.lineTo(o+6*t,s+3*t),e.lineTo(o+3*t,s+3*t),e.lineTo(o,s+6*t),e.lineTo(o-3*t,s+3*t),e.lineTo(o-5*t,s+3*t),e.closePath(),e.stroke(),e.globalAlpha=.5,e.fillStyle=n,e.fill(),e.globalAlpha=1};class bt extends ft{constructor(){super()}create(){this.context=this.createCanvas(),this.canvas=this.context.canvas}render(e,t){if(this.pdfViewerApi){const e=t.canvas.canvasInvalidated||t.canvas.widthChanged||t.canvas.heightChanged||t.viewer.modeChanged||t.viewer.textSelectionChanged||t.pointer.stateChanged||!t.search.painted;if(t.viewer.mode===tt.DEFAULT&&(t.pointer.positionChanged||t.pointer.stateChanged)){const e={x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels},n=this.pdfViewerApi.transformScreenPointToPdfPoint(e);if(this.store.viewer.setCursorStyle(nt.DEFAULT),n.isOnPage){const n=this.pdfViewerApi.getAnnotationsOnPoint(e),i=n?n[n.length-1]:null;if(i){const n=i.itemType;if(n!==z.HIGHLIGHT&&n!==z.SQUIGGLY&&n!==z.STRIKE_OUT||null===this.pdfViewerApi.getTextFragmentOnPoint(e)){if(n===z.LINK){const e=i;(e.destination&&e.actionType===_.GO_TO||e.uri&&e.actionType===_.URI&&this.options.viewer.permissions.allowExternalLinks)&&this.store.viewer.setCursorStyle(nt.POINTER),"click"===t.pointer.action&&(e.destination&&e.actionType===_.GO_TO?this.pdfViewerApi.goTo(e.destination):e.uri&&e.actionType===_.URI&&this.options.viewer.permissions.allowExternalLinks&&window.open(e.uri,void 0,"noreferrer"))}}else this.store.viewer.setCursorStyle(nt.TEXT)}else this.pdfViewerApi.getTextFragmentOnPoint(e)&&this.store.viewer.setCursorStyle(nt.TEXT)}}if(e){const e=this.context;e.save();const{pageShadow:n,currentPageShadow:i}=this.options.viewer.general;if(t.viewer.mode===tt.MODULE_SELECTED){e.globalAlpha=.75,this.pdfViewerApi.renderCanvas(e,{pageShadow:n,currentPageShadow:i}),e.globalAlpha=1,e.fillStyle="rgb(255,255,255)",e.globalCompositeOperation="destination-over";for(const n in t.document.pageRects)if(t.document.pageRects[n]){const i=t.document.pageRects[n];e.fillRect(i.x,i.y,i.w,i.h)}}else this.pdfViewerApi.renderCanvas(e,{pageShadow:n,currentPageShadow:i});if(e.restore(),t.search.match&&(e.save(),e.globalCompositeOperation="multiply",e.fillStyle=this.options.viewer.general.searchMatchColor,e.globalAlpha=.9,e.beginPath(),t.search.match.forEach((n=>{if(n.pageNumber>=t.document.firstVisiblePage&&n.pageNumber<=t.document.lastVisiblePage){const t=this.pdfViewerApi.transformQuadrilateralToViewport(n);for(let n=0;n<t.length;n++){const i=t[n];0===n?e.moveTo(i.x,i.y):e.lineTo(i.x,i.y)}}})),e.closePath(),e.fill(),e.restore()),this.store.search.matchPainted(),t.viewer.textSelection){e.save();const n=t.viewer.textSelection,i=[];for(let e=0;e<n.quadrilaterals.length;e++){const t=this.pdfViewerApi.transformQuadrilateralToViewport(n.quadrilaterals[e]);i.push(t)}if(vt(e,(devicePixelRatio,t.document.zoom),this.options.viewer.general.textSelectionColor,i),e.restore(),t.pointer.isDown&&"selecting"===t.viewer.textSelectionState&&"rectangular"===t.viewer.textSelectionType){const{textSelection:n}=t.viewer,i=this.pdfViewerApi.transformPdfPointToScreenPoint(n.startPoint),o=this.pdfViewerApi.transformPdfPointToScreenPoint(n.endPoint);e.save();const s=2*devicePixelRatio;e.lineWidth=s,e.setLineDash([s,s]),e.strokeStyle=this.options.viewer.general.textSelectionColor,e.strokeRect(i.x,i.y,o.x-i.x,o.y-i.y),e.restore()}}}}}}class Pt{constructor(e,t,n,i,o,s){this.lastPosX=0,this.lastPosY=0,this.startPosX=0,this.startPosY=0,this.isSuspended=!1,this.dragging=!1,this.clickTimer=null,this.dragStartTimer=null,this.clickDuration=250,this.dragStartDuration=300,this.dblClickTimer=null,this.dblClickDuration=250,this.suspend=this.suspend.bind(this),this.resume=this.resume.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.start=this.start.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.move=this.move.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.end=this.end.bind(this),this.element=e,this.onDragStart=t,this.onDragMove=n,this.onDragEnd=i,this.onClick=o,this.onDblClick=s,this.disableCanvasEvents=!0,this.element.addEventListener("mousedown",this.onMouseDown,{passive:!0}),this.element.addEventListener("touchstart",this.onTouchStart,{passive:!1})}suspend(){window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),this.element.removeEventListener("mousedown",this.onMouseDown),this.element.removeEventListener("touchstart",this.onTouchStart),this.isSuspended=!0}resume(){this.isSuspended&&(this.element.addEventListener("mousedown",this.onMouseDown,{passive:!0}),this.element.addEventListener("touchstart",this.onTouchStart,{passive:!1}))}clearClickTimer(){null!==this.clickTimer&&(window.clearTimeout(this.clickTimer),this.clickTimer=null)}clearDblClickTimer(){null!==this.dblClickTimer&&(window.clearTimeout(this.dblClickTimer),this.dblClickTimer=null)}clearDragStartTimer(){null!==this.dragStartTimer&&(window.clearTimeout(this.dragStartTimer),this.dragStartTimer=null)}onMouseDown(e){1===e.buttons&&(this.start(e.clientX,e.clientY),window.addEventListener("mousemove",this.onMouseMove,{passive:!0}),window.addEventListener("mouseup",this.onMouseUp,{passive:!0}))}onTouchStart(e){1===e.touches.length&&(this.start(e.touches[0].clientX,e.touches[0].clientY),window.addEventListener("touchmove",this.onTouchMove,{passive:!1}),window.addEventListener("touchend",this.onTouchEnd,{passive:!1}))}start(e,t){this.disableCanvasEvents&&window.dispatchEvent(new Event("pdfwebviewer.DragMoveHandlerStart")),this.startPosX=this.lastPosX=e,this.startPosY=this.lastPosY=t,this.dragging=!1,this.dblClickTimer||(this.clickTimer=window.setTimeout((()=>{this.clickTimer=null}),this.clickDuration),this.dragStartTimer=window.setTimeout((()=>{this.dragging=!0,this.onDragStart({clientX:this.startPosX,clientY:this.startPosY,movementX:0,movementY:0,element:this.element})}),this.dragStartDuration))}onMouseMove(e){this.move(e.clientX,e.clientY)}onTouchMove(e){this.move(e.touches[0].clientX,e.touches[0].clientY)}move(e,t){let n=e-this.lastPosX,i=t-this.lastPosY;this.lastPosX=e,this.lastPosY=t,(this.clickTimer||this.dragStartTimer)&&(Math.abs(n)>5||Math.abs(i)>5)&&(this.clearClickTimer(),this.clearDragStartTimer(),this.dragging=!0,this.onDragStart({clientX:this.startPosX,clientY:this.startPosY,movementX:0,movementY:0,element:this.element}),n=e-this.startPosX,i=t-this.startPosY),this.dragging&&this.onDragMove({clientX:e,clientY:t,movementX:n,movementY:i,element:this.element})}onMouseUp(e){window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),this.end()}onTouchEnd(e){window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),this.end()}end(){const e=this.startPosX!==this.lastPosX||this.startPosY!==this.lastPosY,t=this.lastPosX,n=this.lastPosY;this.disableCanvasEvents&&window.dispatchEvent(new Event("pdfwebviewer.DragMoveHandlerEnd")),null!==this.dblClickTimer?(this.clearDblClickTimer(),this.onDblClick&&this.onDblClick({clientX:t,clientY:n,movementX:0,movementY:0,element:this.element})):null!==this.clickTimer&&(this.onClick&&this.onClick({clientX:t,clientY:n,movementX:0,movementY:0,element:this.element}),this.dblClickTimer=window.setTimeout((()=>{this.dblClickTimer=null}),this.dblClickDuration)),this.dragging&&this.onDragEnd({clientX:t,clientY:n,movementX:0,movementY:0,moved:e,element:this.element}),this.clearClickTimer(),this.clearDragStartTimer()}}class yt extends ft{constructor(){super(),this.horizontalScrollEnabled=!1,this.horizontalScrollBarVisible=!1,this.horizontalScrollRatio=0,this.horizontalScrollBarSize=0,this.horizontalScrollHandleSize=0,this.horizontalScrollHandlePos=0,this.horizontalScrollTimer=0,this.horizontalScrollExpanded=!1,this.verticalScrollEnabled=!1,this.verticalScrollBarVisible=!1,this.verticalScrollRatio=0,this.verticalScrollBarSize=0,this.verticalScrollHandleSize=0,this.verticalScrollHandlePos=0,this.verticalScrollTimer=0,this.verticalScrollExpanded=!1,this.canScrollDown=!1,this.canScrollUp=!1,this.canScrollRight=!1,this.canScrollLeft=!1,this.isTouchScrolling=!1,this.recentTouchPos=[],this.touchScrollAxis=null,this.autoscrollLastTimestamp=0,this.autoscrollDist=0,this.autoscrollDistTime=0,this.autoscrollDx=0,this.startVerticalScroll=this.startVerticalScroll.bind(this),this.verticalScroll=this.verticalScroll.bind(this),this.endVerticalScroll=this.endVerticalScroll.bind(this),this.startHorizontalScroll=this.startHorizontalScroll.bind(this),this.horizontalScroll=this.horizontalScroll.bind(this),this.endHorizontalScroll=this.endHorizontalScroll.bind(this),this.horizontalScrollBar=document.createElement("div"),this.horizontalScrollBar.style.display="none",this.horizontalScrollBar.classList.add("pwv-horizontal-scrollbar"),this.horizontalScrollHandle=document.createElement("div"),this.horizontalScrollHandle.classList.add("pwv-scrollbar-handle"),this.horizontalScrollBar.appendChild(this.horizontalScrollHandle),this.verticalScrollBar=document.createElement("div"),this.verticalScrollBar.style.display="none",this.verticalScrollBar.classList.add("pwv-vertical-scrollbar"),this.verticalScrollHandle=document.createElement("div"),this.verticalScrollHandle.classList.add("pwv-scrollbar-handle"),this.verticalScrollBar.appendChild(this.verticalScrollHandle),new Pt(this.verticalScrollHandle,this.startVerticalScroll,this.verticalScroll,this.endVerticalScroll),new Pt(this.horizontalScrollHandle,this.startHorizontalScroll,this.horizontalScroll,this.endHorizontalScroll)}create(){this.htmlLayerElement=this.createHtmlLayer(),this.htmlLayerElement.appendChild(this.horizontalScrollBar),this.htmlLayerElement.appendChild(this.verticalScrollBar)}render(e,t){const n=t.canvas.height.cssPixels,i=t.document.height.cssPixels;(t.document.heightChanged||t.canvas.heightChanged)&&(this.verticalScrollEnabled=i>n,this.verticalScrollEnabled!==this.verticalScrollBarVisible&&(this.verticalScrollBar.style.display=this.verticalScrollEnabled?"block":"none",this.verticalScrollBarVisible=this.verticalScrollEnabled),this.verticalScrollEnabled&&(this.verticalScrollBarSize=this.verticalScrollBar.clientHeight,this.verticalScrollHandleSize=this.verticalScrollBarSize*n/i,this.verticalScrollHandleSize<50&&(this.verticalScrollHandleSize=50),this.verticalScrollHandle.style.height=this.verticalScrollHandleSize+"px",this.verticalScrollRatio=(this.verticalScrollBarSize-this.verticalScrollHandleSize)/(i-n)),this.updateCanScrollVertical(t)),t.scroll.topPositionChanged&&(this.verticalScrollHandlePos=t.scroll.top.cssPixels*this.verticalScrollRatio,this.verticalScrollHandle.style.top=this.verticalScrollHandlePos+"px",this.verticalScrollTimer?clearTimeout(this.verticalScrollTimer):this.verticalScrollBar.classList.add("pwv-scrollbar-scrolling"),this.verticalScrollTimer=window.setTimeout((()=>{this.verticalScrollTimer=0,this.verticalScrollBar.classList.remove("pwv-scrollbar-scrolling")}),500),this.updateCanScrollVertical(t));const o=t.canvas.width.cssPixels,s=t.document.width.cssPixels;if((t.document.widthChanged||t.canvas.widthChanged)&&(this.horizontalScrollEnabled=s>o,this.horizontalScrollEnabled!==this.horizontalScrollBarVisible&&(this.horizontalScrollBar.style.display=this.horizontalScrollEnabled?"block":"none",this.horizontalScrollBarVisible=this.horizontalScrollEnabled),this.horizontalScrollEnabled&&(this.horizontalScrollBarSize=this.horizontalScrollBar.clientWidth,this.horizontalScrollHandleSize=this.horizontalScrollBarSize*o/s,this.horizontalScrollHandleSize<50&&(this.horizontalScrollHandleSize=50),this.horizontalScrollHandle.style.width=this.horizontalScrollHandleSize+"px",this.horizontalScrollRatio=(this.horizontalScrollBarSize-this.horizontalScrollHandleSize)/(s-o)),this.updateCanScrollHorizontal(t)),t.scroll.leftPositionChanged&&(this.horizontalScrollHandlePos=t.scroll.left.cssPixels*this.horizontalScrollRatio,this.horizontalScrollHandle.style.left=this.horizontalScrollHandlePos+"px",this.horizontalScrollTimer?clearTimeout(this.horizontalScrollTimer):this.horizontalScrollBar.classList.add("pwv-scrollbar-scrolling"),this.horizontalScrollTimer=window.setTimeout((()=>{this.horizontalScrollTimer=0,this.horizontalScrollBar.classList.remove("pwv-scrollbar-scrolling")}),500),this.updateCanScrollHorizontal(t)),t.pointer.positionChanged){const e=t.pointer.x.cssPixels,i=t.pointer.y.cssPixels,s=o-40,a=n-40;!this.verticalScrollExpanded&&e>s&&i<a?(this.verticalScrollBar.classList.add("pwv-scrollbar-hover"),this.verticalScrollExpanded=!0):this.verticalScrollExpanded&&(e<s||i>a)&&(this.verticalScrollBar.classList.remove("pwv-scrollbar-hover"),this.verticalScrollExpanded=!1),!this.horizontalScrollExpanded&&i>a&&e<s?(this.horizontalScrollBar.classList.add("pwv-scrollbar-hover"),this.horizontalScrollExpanded=!0):this.horizontalScrollExpanded&&(i<a||e>s)&&(this.horizontalScrollBar.classList.remove("pwv-scrollbar-hover"),this.horizontalScrollExpanded=!1)}const a=t.pointer;if("touch"===a.type&&(t.viewer.mode===tt.DEFAULT||t.viewer.mode===tt.ANNOTATION_SELECTED)&&this.viewerCanvas)if(t.pointer.isDown)if(this.isTouchScrolling){if(a.positionChanged){this.recentTouchPos.unshift({x:a.x.cssPixels,y:a.y.cssPixels,time:e}),this.recentTouchPos.length>3&&this.recentTouchPos.pop();const t=this.recentTouchPos[1].x-this.recentTouchPos[0].x,n=this.recentTouchPos[1].y-this.recentTouchPos[0].y,i=Math.abs(t),o=Math.abs(n),s=null!==this.touchScrollAxis?this.touchScrollAxis:o>i?"y":i>o?"x":null;this.verticalScrollEnabled&&"y"===s?(n>0&&this.canScrollDown||n<0&&this.canScrollUp)&&this.viewerCanvas.scrollDown(n):this.horizontalScrollEnabled&&"x"===this.touchScrollAxis&&(t>0&&this.canScrollRight||t<0&&this.canScrollLeft)&&this.viewerCanvas.scrollRight(t),null===this.touchScrollAxis&&this.recentTouchPos.length>=3&&(this.touchScrollAxis=o>i?"y":i>o?"x":null)}}else this.isTouchScrolling=!0,this.autoscrollDx=0,this.touchScrollAxis=null,this.recentTouchPos=[],this.recentTouchPos.unshift({x:a.x.cssPixels,y:a.y.cssPixels,time:e});else this.isTouchScrolling&&(this.isTouchScrolling=!1,"x"===this.touchScrollAxis?(this.autoscrollDist=this.recentTouchPos[2].x-this.recentTouchPos[0].x,this.autoscrollDistTime=this.recentTouchPos[0].time-this.recentTouchPos[2].time,this.autoscrollDx=Math.abs(this.autoscrollDist/this.autoscrollDistTime),this.autoscrollLastTimestamp=e):"y"===this.touchScrollAxis&&(this.autoscrollDist=this.recentTouchPos[2].y-this.recentTouchPos[0].y,this.autoscrollDistTime=this.recentTouchPos[0].time-this.recentTouchPos[2].time,this.autoscrollDx=Math.abs(this.autoscrollDist/this.autoscrollDistTime),this.autoscrollLastTimestamp=e));if(this.viewerCanvas&&0!==this.autoscrollDx){const t=e-this.autoscrollLastTimestamp;if(t>1e3/70)if(this.autoscrollDx>3&&(this.autoscrollDx=3),"y"===this.touchScrollAxis&&(this.autoscrollDist>0&&!this.canScrollDown||this.autoscrollDist<0&&!this.canScrollUp))this.autoscrollDx=0;else if("x"===this.touchScrollAxis&&(this.autoscrollDist>0&&!this.canScrollRight||this.autoscrollDist<0&&!this.canScrollLeft))this.autoscrollDx=0;else{const n=Math.sign(this.autoscrollDist),i=Math.abs(this.autoscrollDist),o=t/this.autoscrollDistTime,s=Math.min(100,i*this.autoscrollDx)*o*n;Math.abs(s)<1?this.autoscrollDx=0:"y"===this.touchScrollAxis?this.viewerCanvas.scrollDown(s):this.viewerCanvas.scrollRight(s);const a=.08*this.autoscrollDx*o;this.autoscrollDx=this.autoscrollDx-a,this.autoscrollLastTimestamp=e}}}updateCanScrollVertical(e){this.canScrollUp=e.scroll.top.cssPixels>0,this.canScrollDown=e.scroll.top.cssPixels+e.canvas.height.cssPixels<e.document.height.cssPixels-1}updateCanScrollHorizontal(e){this.canScrollLeft=e.scroll.left.cssPixels>0,this.canScrollRight=e.scroll.left.cssPixels+e.canvas.width.cssPixels<e.document.width.cssPixels-1}startVerticalScroll(e){this.verticalScrollBar.classList.add("pwv-scrollbar-dragging")}verticalScroll(e){if(this.viewerCanvas){const t=e.movementY/this.verticalScrollRatio;this.viewerCanvas.scrollDown(t)}}endVerticalScroll(e){this.verticalScrollBar.classList.remove("pwv-scrollbar-dragging")}startHorizontalScroll(e){this.horizontalScrollBar.classList.add("pwv-scrollbar-dragging")}horizontalScroll(e){if(this.viewerCanvas){const t=e.movementX/this.horizontalScrollRatio;this.viewerCanvas.scrollRight(t)}}endHorizontalScroll(e){this.horizontalScrollBar.classList.remove("pwv-scrollbar-dragging")}}class Ct extends ft{constructor(){super()}create(){this.busyStateView=this.createHtmlLayer(),this.busyStateView.classList.add("pwv-BusyLoader"),this.busyStateView.style.display="none";const e=document.createElement("div");this.busyStateView.appendChild(e),["rect-1","rect-2","rect-3","rect-4","rect-5"].forEach((t=>{const n=document.createElement("div");n.classList.add(t),e.appendChild(n)}))}render(e,t){this.busyStateView&&t.document.busyStateChanged&&(this.busyStateView.style.display=t.document.busyState?"block":"none")}}const At=e=>{e.stopPropagation()},Et=({},e)=>i("div",{class:"pwv-contextbar",oncreate:e=>{e.addEventListener("click",(e=>{e.preventDefault()}),{passive:!1}),e.addEventListener("mousedown",At,!1),e.addEventListener("mousemove",At,!1),e.addEventListener("mouseup",At,!1),e.addEventListener("touchstart",At,{passive:!1}),e.addEventListener("touchmove",At,{passive:!0}),e.addEventListener("touchend",At,{passive:!0})}},i("div",{class:"pwv-contextbar-content"},e));var Lt;!function(e){e[e.NW=1]="NW",e[e.NE=2]="NE",e[e.SW=3]="SW",e[e.SE=4]="SE"}(Lt||(Lt={}));const St=10;class xt{constructor(e,t,n,i,o,s,a){this.annotationId=null,this.movable=!1,this.resizable=!1,this.aspectRatio=null,this.pageRect=null,this.dragOffsetX=0,this.dragOffsetY=0,this.containerOffsetX=0,this.containerOffsetY=0,this.resizeDir=null,this.minSize=St,this.startMove=this.startMove.bind(this),this.moving=this.moving.bind(this),this.endMove=this.endMove.bind(this),this.click=this.click.bind(this),this.dblClick=this.dblClick.bind(this),this.setAnnotation=this.setAnnotation.bind(this),this.deselectAnnotation=this.deselectAnnotation.bind(this),this.startResize=this.startResize.bind(this),this.resizing=this.resizing.bind(this),this.resizeNoAspectRatio=this.resizeNoAspectRatio.bind(this),this.resizeWithAspectRatio=this.resizeWithAspectRatio.bind(this),this.endResize=this.endResize.bind(this),this.dragElement=document.createElement("div"),this.border=document.createElement("div"),this.resizeElementNw=document.createElement("div"),this.resizeElementNe=document.createElement("div"),this.resizeElementSw=document.createElement("div"),this.resizeElementSe=document.createElement("div"),this.isViewOnly=a,this.onMoved=t,this.onResized=n,this.onDblClick=i,this.element=e,this.options=o,this.store=s,this.element.appendChild(this.dragElement),this.dragElement.classList.add("pwv-annotation-border-draghandle"),this.dragElement.style.display="none",this.dragHandler=new Pt(this.dragElement,this.startMove,this.moving,this.endMove,this.click,this.dblClick),this.dragHandler.suspend(),this.element.appendChild(this.border),this.border.classList.add("pwv-annotation-border"),this.element.appendChild(this.resizeElementNw),this.resizeElementNw.classList.add("pwv-annotation-border-resizehandle-nw"),this.resizeElementNw.style.display="none",this.resizeHandlerNw=new Pt(this.resizeElementNw,this.startResize,this.resizing,this.endResize),this.resizeHandlerNw.suspend(),this.element.appendChild(this.resizeElementNe),this.resizeElementNe.classList.add("pwv-annotation-border-resizehandle-ne"),this.resizeElementNe.style.display="none",this.resizeHandlerNe=new Pt(this.resizeElementNe,this.startResize,this.resizing,this.endResize),this.resizeHandlerNe.suspend(),this.element.appendChild(this.resizeElementSw),this.resizeElementSw.classList.add("pwv-annotation-border-resizehandle-sw"),this.resizeElementSw.style.display="none",this.resizeHandlerSw=new Pt(this.resizeElementSw,this.startResize,this.resizing,this.endResize),this.resizeHandlerSw.suspend(),this.element.appendChild(this.resizeElementSe),this.resizeElementSe.classList.add("pwv-annotation-border-resizehandle-se"),this.resizeElementSe.style.display="none",this.resizeHandlerSe=new Pt(this.resizeElementSe,this.startResize,this.resizing,this.endResize),this.resizeHandlerSe.suspend()}setAnnotation(e,t){const{behaviors:n}=e,i=e.isReadOnly(),o=e.isLocked()&&!this.options.viewer.permissions.allowEditLockedAnnotations;this.annotationId=e.id,this.movable=n.movable&&!o&&!i,this.resizable=n.resizable&&!o&&!i,this.aspectRatio=n.aspectRatioChangeable?null:e.pdfRect.pdfW/e.pdfRect.pdfH,this.pageRect=t,this.movable&&(this.dragElement.style.display="block"),this.resizable&&(this.resizeElementNw.style.display="block",this.resizeElementNe.style.display="block",this.resizeElementSw.style.display="block",this.resizeElementSe.style.display="block"),window.setTimeout((()=>{this.movable&&this.dragHandler.resume(),this.resizable&&(this.resizeHandlerNw.resume(),this.resizeHandlerNe.resume(),this.resizeHandlerSw.resume(),this.resizeHandlerSe.resume())}),100)}deselectAnnotation(){this.annotationId=null,this.movable=!1,this.resizable=!1,this.aspectRatio=0,this.pageRect=null,this.dragHandler.suspend(),this.resizeHandlerNw.suspend(),this.resizeHandlerNe.suspend(),this.resizeHandlerSw.suspend(),this.resizeHandlerSe.suspend(),this.dragElement.style.display="none",this.resizeElementNw.style.display="none",this.resizeElementNe.style.display="none",this.resizeElementSw.style.display="none",this.resizeElementSe.style.display="none"}updatePageRect(e){this.pageRect=e}click(){}dblClick(){this.annotationId&&this.onDblClick(this.annotationId)}startResize(e){e.element.classList.contains("pwv-annotation-border-resizehandle-nw")?this.resizeDir=Lt.NW:e.element.classList.contains("pwv-annotation-border-resizehandle-ne")?this.resizeDir=Lt.NE:e.element.classList.contains("pwv-annotation-border-resizehandle-sw")?this.resizeDir=Lt.SW:e.element.classList.contains("pwv-annotation-border-resizehandle-se")&&(this.resizeDir=Lt.SE),this.element.classList.add("pwv-annotation-resizing")}resizing(e){null!==this.aspectRatio?this.resizeWithAspectRatio(e.clientX,e.clientY):this.resizeNoAspectRatio(e.clientX,e.clientY)}updateMinSize(){const{document:e}=this.store.getState();this.minSize=St}resizeNoAspectRatio(e,t){if(this.element&&this.element.offsetParent&&this.pageRect){this.updateMinSize();const n=this.element.offsetParent.getBoundingClientRect(),i=this.element.getBoundingClientRect(),o=this.pageRect.x/window.devicePixelRatio,s=o+this.pageRect.w/window.devicePixelRatio,a=this.pageRect.y/window.devicePixelRatio,r=a+this.pageRect.h/window.devicePixelRatio;let l=e-n.left;l<o?l=o:l>s&&(l=s);let d=t-n.top;d<a?d=a:d>r&&(d=r);let h=i.top-n.top,c=i.left-n.left,u=i.width,p=i.height;this.resizeDir!==Lt.NE&&this.resizeDir!==Lt.SE||(u=l-c,u<this.minSize&&(u=this.minSize)),this.resizeDir!==Lt.NW&&this.resizeDir!==Lt.SW||(u=c+u-l,u<this.minSize?(u=this.minSize,c=i.left-n.left+i.width-u):c=l),this.resizeDir!==Lt.SE&&this.resizeDir!==Lt.SW||(p=d-h,p<this.minSize&&(p=this.minSize)),this.resizeDir!==Lt.NE&&this.resizeDir!==Lt.NW||(p=h+p-d,p<this.minSize?(p=this.minSize,h=i.top-n.top+i.height-p):h=d),this.element.style.top=h+"px",this.element.style.left=c+"px",this.element.style.width=u+"px",this.element.style.height=p+"px"}}resizeWithAspectRatio(e,t){if(this.pageRect&&null!==this.aspectRatio&&this.element&&this.element.offsetParent){this.updateMinSize();const n=this.element.offsetParent.getBoundingClientRect(),i=this.element.getBoundingClientRect(),o=this.pageRect.x/window.devicePixelRatio,s=o+this.pageRect.w/window.devicePixelRatio,a=this.pageRect.y/window.devicePixelRatio,r=a+this.pageRect.h/window.devicePixelRatio;let l=e-n.left;l<o?l=o:l>s&&(l=s);let d=t-n.top;d<a?d=a:d>r&&(d=r);let h=i.top-n.top,c=i.left-n.left,u=i.width,p=i.height;const g=(e,t,n)=>{this.store.getState().document.rotation%180!=0&&(n=1/n);const i={w:e,h:t};return e/t<n?(i.w=Math.max(e,this.minSize),i.h=i.w/n,i.h<this.minSize&&(i.h=this.minSize,i.w=i.h*n)):(i.h=Math.max(t,this.minSize),i.w=i.h*n,i.w<this.minSize&&(i.w=this.minSize,i.h=i.w*n)),i};if(this.resizeDir===Lt.NW){const e=g(c+u-l,h+p-d,this.aspectRatio);c=c+u-e.w,h=h+p-e.h,u=e.w,p=e.h}if(this.resizeDir===Lt.NE){const e=g(l-c,h+p-d,this.aspectRatio);h=h+p-e.h,u=e.w,p=e.h}if(this.resizeDir===Lt.SW){const e=g(c+u-l,d-h,this.aspectRatio);c=c+u-e.w,u=e.w,p=e.h}if(this.resizeDir===Lt.SE){const e=g(l-c,d-h,this.aspectRatio);u=e.w,p=e.h}this.element.style.top=h+"px",this.element.style.left=c+"px",this.element.style.width=u+"px",this.element.style.height=p+"px"}}endResize(e){e.moved&&this.annotationId&&this.onResized(this.annotationId,{x:this.element.offsetLeft,y:this.element.offsetTop,w:this.element.offsetWidth,h:this.element.offsetHeight}),this.element.classList.remove("pwv-annotation-resizing")}startMove(e){const t=this.element.getBoundingClientRect(),n=this.element.offsetParent.getBoundingClientRect();this.dragOffsetX=e.clientX-t.left,this.dragOffsetY=e.clientY-t.top,this.containerOffsetX=n.left,this.containerOffsetY=n.top,this.element.classList.add("pwv-annotation-moving")}moving(e){if(this.pageRect){const t=this.pageRect.x/devicePixelRatio,n=t+this.pageRect.w/devicePixelRatio-this.element.offsetWidth,i=this.pageRect.y/devicePixelRatio,o=i+this.pageRect.h/devicePixelRatio-this.element.offsetHeight;let s=e.clientY-this.containerOffsetY-this.dragOffsetY,a=e.clientX-this.containerOffsetX-this.dragOffsetX;s<i?s=i:s>o&&(s=o),a<t?a=t:a>n&&(a=n),this.element.style.top=s+"px",this.element.style.left=a+"px"}}endMove(e){e.moved&&this.annotationId&&this.onMoved(this.annotationId,{x:this.element.offsetLeft,y:this.element.offsetTop+this.element.offsetHeight}),this.element.classList.remove("pwv-annotation-moving")}}class Tt extends ft{constructor(){super(),this.context=null,this.selectedAnnotation=null,this.selectionElement=null,this.barAtTop=!0,this.contextBar=null,this.annotationBorder=null,this.deleteAnnotation=this.deleteAnnotation.bind(this),this.rotateAnnotation=this.rotateAnnotation.bind(this),this.copyAnnotationText=this.copyAnnotationText.bind(this),this.createPopup=this.createPopup.bind(this),this.openPopup=this.openPopup.bind(this),this.deletePopup=this.deletePopup.bind(this),this.moveAnnotation=this.moveAnnotation.bind(this),this.toggleLock=this.toggleLock.bind(this),this.resizeAnnotation=this.resizeAnnotation.bind(this),this.onItemSelected=this.onItemSelected.bind(this),this.onItemDblClick=this.onItemDblClick.bind(this)}create(){var e,t;this.viewerCanvas&&this.viewerCanvas.addEventListener("itemSelected",this.onItemSelected),this.selectAnnotation=this.selectAnnotation.bind(this),this.deselectAnnotation=this.deselectAnnotation.bind(this),this.deleteAnnotation=this.deleteAnnotation.bind(this),this.createPopup=this.createPopup.bind(this),this.deletePopup=this.deletePopup.bind(this),this.openPopup=this.openPopup.bind(this),this.context=this.createCanvas("pwv-annotation-selection-layers"),this.context.canvas.style.display="none",this.selectionElement=this.createHtmlLayer(),this.selectionElement.style.display="none",this.selectionElement.style.position="absolute",this.selectionElement.classList.add("pwv-annotation-selection"),this.selectionElement.classList.add("pwv-contextbar-top"),this.selectionElement.addEventListener("click",(e=>{e.preventDefault(),e.cancelBubble=!0}),!1),(null===(e=this.viewerCanvas)||void 0===e?void 0:e.licenseFeatures.annotate)&&(this.contextBar=((e,t)=>{const n=({})=>(t,n)=>t.isReadOnly?t.canCopy||t.canHavePopup&&t.hasPopup?i(Et,null,i(h,null,t.canCopy&&i(S,{tooltip:g.getText("contextbar.copyText"),icon:f.copy,onClick:n.copyText}),t.canHavePopup&&t.hasPopup&&i(S,{tooltip:g.getText("contextbar.openPopup"),icon:f.stickyNote,onClick:n.editPopup}))):null:i(Et,null,i(h,null,t.showConfirmDelete?i(m,null,i(S,{onClick:n.delete},g.getText("contextbar.confirmDelete")),i(S,{onClick:n.cancelDelete},g.getText("contextbar.cancelDelete"))):i(m,null,!t.isReadOnly&&t.commands.map((n=>i(S,{icon:n.icon,tooltip:n.tooltip,onClick:()=>{n.onCmd(t.annotation?t.annotation.id:0)},disabled:t.isLocked&&!e.allowEditLockedAnnotations||t.isReadOnly}))),t.canCopy&&i(S,{tooltip:g.getText("contextbar.copyText"),icon:f.copy,onClick:n.copyText}),t.canRotate&&i(S,{tooltip:g.getText("contextbar.rotate"),icon:f.rotate,onClick:n.rotate,disabled:t.isLocked&&!e.allowEditLockedAnnotations||t.isReadOnly}),t.canHavePopup&&!t.isReadOnly&&!(t.isLocked&&!e.allowEditLockedAnnotations)&&!t.hasPopup&&i(S,{tooltip:g.getText("contextbar.addPopup"),icon:f.stickyNoteAdd,onClick:n.addPopup,disabled:t.isLocked&&!e.allowEditLockedAnnotations||t.isReadOnly}),t.canHavePopup&&t.hasPopup&&i(S,{tooltip:g.getText(t.isLocked&&!e.allowEditLockedAnnotations||t.isReadOnly?"contextbar.openPopup":"contextbar.editPopup"),icon:t.isLocked&&!e.allowEditLockedAnnotations||t.isReadOnly?f.stickyNote:f.stickyNoteEdit,onClick:n.editPopup}),t.canDeletePopup&&t.hasPopup&&i(S,{tooltip:g.getText("contextbar.deletePopup"),icon:f.stickyNoteRemove,onClick:n.deletePopup,disabled:t.isLocked&&!e.allowEditLockedAnnotations||t.isReadOnly}),!t.isReadOnly&&e.allowLockAnnotations&&i(S,{tooltip:g.getText(t.isLocked?"contextbar.unlock":"contextbar.lock"),icon:t.isLocked?f.lock:f.unlock,onClick:n.toggleLock,disabled:t.isReadOnly}),t.deletable&&i(S,{tooltip:g.getText("contextbar.delete"),icon:f.delete,onClick:n.startDelete,disabled:t.isLocked&&!e.allowEditLockedAnnotations||t.isReadOnly}))));return o({annotation:null,isReadOnly:!1,hasPopup:!1,canRotate:!1,deletable:!1,canCopy:!1,isLocked:!1,canHavePopup:!1,canDeletePopup:!0,showConfirmDelete:!1,commands:[]},{setAnnotation:t=>n=>{const{annotation:i,commands:o}=t,{behaviors:s}=i,a=i.isReadOnly();return Object.assign(Object.assign({},n),{showConfirmDelete:!1,commands:o,annotation:i,isReadOnly:a,hasPopup:Ke(i),canRotate:s.rotatable,deletable:s.deletable,canCopy:s.text&&e.allowCopyText,isLocked:i.isLocked(),canHavePopup:s.canHavePopup,canDeletePopup:Ke(i)&&i.itemType!==z.TEXT})},startDelete:()=>e=>Object.assign(Object.assign({},e),{showConfirmDelete:!0}),cancelDelete:()=>e=>Object.assign(Object.assign({},e),{showConfirmDelete:!1}),delete:()=>t=>(e.onDeleteAnnotation(t.annotation?t.annotation.id:0),Object.assign({},t)),rotate:()=>t=>(e.onRotateAnnotation(t.annotation?t.annotation.id:0),Object.assign({},t)),copyText:()=>t=>(e.onCopy(t.annotation?t.annotation.id:0),Object.assign({},t)),addPopup:()=>t=>(e.onCreatePopup(t.annotation?t.annotation.id:0),Object.assign(Object.assign({},t),{hasPopup:!0})),editPopup:()=>t=>(e.onOpenPopup(t.annotation?t.annotation.id:0),Object.assign({},t)),deletePopup:()=>t=>(e.onDeletePopup(t.annotation?t.annotation.id:0),Object.assign(Object.assign({},t),{hasPopup:!1})),toggleLock:()=>t=>(e.onToggleLock(t.annotation?t.annotation.id:0),Object.assign(Object.assign({},t),{isLocked:!t.isLocked}))},(()=>i(n,null)),t)})({allowCopyText:this.options.viewer.permissions.allowCopyText,allowLockAnnotations:this.options.viewer.permissions.allowLockAnnotations,allowEditLockedAnnotations:this.options.viewer.permissions.allowEditLockedAnnotations,onDeleteAnnotation:this.deleteAnnotation,onRotateAnnotation:this.rotateAnnotation,onCopy:this.copyAnnotationText,onCreatePopup:this.createPopup,onOpenPopup:this.openPopup,onDeletePopup:this.deletePopup,onToggleLock:this.toggleLock},this.selectionElement)),this.annotationBorder=new xt(this.selectionElement,this.moveAnnotation,this.resizeAnnotation,this.onItemDblClick,this.options,this.store,!(null===(t=this.viewerCanvas)||void 0===t?void 0:t.licenseFeatures.annotate)||!1)}render(e,t){const n=t.viewer.mode;this.selectedAnnotation&&n!==tt.ANNOTATION_SELECTED&&this.deselectAnnotation();const{pageLayoutMode:i}=t.document;if((i===W.SINGLE_PAGE||i===W.TWO_PAGE_LEFT||i===W.TWO_PAGE_RIGHT)&&this.selectedAnnotation&&t.document.firstVisiblePageChanged)return this.deselectAnnotation(),this.store.canvas.setCanvasInvalidated(!0),!1;if(!("click"!==t.pointer.action&&"dblclick"!==t.pointer.action||n!==tt.DEFAULT&&n!==tt.ANNOTATION_SELECTED&&n!==tt.POPUP_SELECTED)){const e=this.pdfViewerApi.getAnnotationsOnPoint({x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels});let n=!1;if(e&&e.length)for(let i=e.length-1;i>=0;i--){const o=e[i];if(o.behaviors.selectable)if("click"===t.pointer.action){if(o.itemType===z.WIDGET){if(this.viewerCanvas&&!o.widget.readOnly){this.viewerCanvas.activateModule("FormFieldModule",{annotationId:o.id,action:"click"}),n=!0;break}}else if(o.id!==t.viewer.selectedAnnotationId&&(t.viewer.selectedAnnotationId&&this.deselectAnnotation(),!o.isHidden())){this.selectAnnotation(o),n=!0;break}}else if("dblclick"===t.pointer.action){this.onItemDblClick(o.id);break}}else t.viewer.selectedAnnotationId&&(this.deselectAnnotation(),n=!0);if(n)return this.store.canvas.setCanvasInvalidated(!0),!1}if(n===tt.ANNOTATION_SELECTED&&t.viewer.selectedAnnotationId){const e=t.annotations.all[t.viewer.selectedAnnotationId];if(null===this.selectedAnnotation&&this.selectAnnotation(e),this.annotationBorder&&t.canvas.canvasInvalidated){const n=t.document.pageRects[e.pdfRect.page];n&&this.annotationBorder.updatePageRect(n)}(t.viewer.selectedAnnotationChanged||t.canvas.canvasInvalidated)&&this.updateSelectionElementPosition(e)}}updateSelectionElementPosition(e){if(this.selectionElement){const t=this.pdfViewerApi.transformPdfPageRectToScreenRect(e.pdfRect),n=t.y/devicePixelRatio,i=t.x/devicePixelRatio,o=t.w/devicePixelRatio,s=t.h/devicePixelRatio,a=n>80;this.selectionElement.style.top=n+"px",this.selectionElement.style.left=i+"px",this.selectionElement.style.width=o+"px",this.selectionElement.style.height=s+"px",this.barAtTop!==a&&(this.barAtTop=a,this.barAtTop?(this.selectionElement.classList.remove("pwv-contextbar-bottom"),this.selectionElement.classList.add("pwv-contextbar-top")):(this.selectionElement.classList.remove("pwv-contextbar-top"),this.selectionElement.classList.add("pwv-contextbar-bottom")));const r=this.selectionElement.lastChild;if(r&&1===r.nodeType){const e=this.store.getState().canvas.width.cssPixels,t=r.offsetWidth,n=t/2,s=4;let a=0;a=t>o?(t-o)/-2:(o-t)/2,i+a+s<0&&(a=-1*i+s,i+o<n&&(a=o-n)),i+a+t+s>e&&(a=e-i-t-s,-1*a>n&&(a=-1*n)),r.style.left=a+"px"}}}selectAnnotation(e,t){var n,i;if(this.selectionElement&&this.context&&this.annotationBorder){this.selectedAnnotation=e;const o=this.store.getState().document.pageRects[e.pdfRect.page];this.annotationBorder.deselectAnnotation(),this.annotationBorder.setAnnotation(e,o);const s=this.store.getState();if((null===(n=this.viewerCanvas)||void 0===n?void 0:n.licenseFeatures.annotate)&&this.contextBar){const t=null!==(i=s.viewer.contextBarItems[e.itemType])&&void 0!==i?i:[];this.contextBar.setAnnotation({annotation:e,commands:t})}this.context.canvas.style.display="none",this.selectionElement.style.display="block",this.barAtTop=!0,this.selectionElement.classList.remove("pwv-contextbar-bottom"),this.selectionElement.classList.add("pwv-contextbar-top"),this.updateSelectionElementPosition(e),this.store.viewer.selectAnnotation(e),this.store.viewer.setCursorStyle(nt.DEFAULT),this.viewerCanvas&&!t&&this.dispatchEvent("itemSelected",e)}}deselectAnnotation(){if(this.context&&this.selectionElement&&this.annotationBorder){const e=this.selectedAnnotation;this.selectedAnnotation=null,this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height),this.annotationBorder.deselectAnnotation(),this.context.canvas.style.display="none",this.selectionElement.style.display="none",this.store.viewer.deselectAnnotation(),this.viewerCanvas&&null!==e&&this.dispatchEvent("itemDeselected",e)}}rotateAnnotation(e){if(this.pdfViewerApi){const t=this.pdfViewerApi.getItem(e);t.rotation=(t.rotation+90)%360,this.pdfViewerApi.updateItem(t).then((e=>{if(this.annotationBorder){const t=e,n=this.store.getState().document.pageRects[t.pdfRect.page];this.annotationBorder.setAnnotation(t,n)}}))}}moveAnnotation(e,t){var n;if(this.pdfViewerApi){const i=this.pdfViewerApi.getItem(e),o=this.pdfViewerApi.transformScreenPointToPdfPoint({x:t.x*window.devicePixelRatio,y:t.y*window.devicePixelRatio},i.page,!0);if(o.pdfPoint.page===i.pdfRect.page)switch(this.pdfViewerApi.getRotation()){case 0:i.pdfRect.pdfX=o.pdfPoint.pdfX,i.pdfRect.pdfY=o.pdfPoint.pdfY;break;case 90:i.pdfRect.pdfX=o.pdfPoint.pdfX-i.pdfRect.pdfW,i.pdfRect.pdfY=o.pdfPoint.pdfY;break;case 180:i.pdfRect.pdfX=o.pdfPoint.pdfX-i.pdfRect.pdfW,i.pdfRect.pdfY=o.pdfPoint.pdfY-i.pdfRect.pdfH;break;case 270:i.pdfRect.pdfX=o.pdfPoint.pdfX,i.pdfRect.pdfY=o.pdfPoint.pdfY-i.pdfRect.pdfH}this.store.annotations.updateAnnotation(i),this.store.canvas.setCanvasInvalidated(!0),(null===(n=this.viewerCanvas)||void 0===n?void 0:n.licenseFeatures.annotate)&&this.pdfViewerApi.updateItem(i)}}resizeAnnotation(e,t){var n;if(this.pdfViewerApi){const i=this.pdfViewerApi.getItem(e),o=this.pdfViewerApi.transformScreenRectToPdfRect({x:t.x*window.devicePixelRatio,y:t.y*window.devicePixelRatio,w:t.w*window.devicePixelRatio,h:t.h*window.devicePixelRatio},i.pdfRect.page);o.page===i.pdfRect.page&&(i.pdfRect=o),this.store.annotations.updateAnnotation(i),this.store.canvas.setCanvasInvalidated(!0),(null===(n=this.viewerCanvas)||void 0===n?void 0:n.licenseFeatures.annotate)&&this.pdfViewerApi.updateItem(i)}}copyAnnotationText(e){if(this.pdfViewerApi){const t=this.pdfViewerApi.getItem(e);if(t.itemType===z.HIGHLIGHT||t.itemType===z.UNDERLINE||t.itemType===z.SQUIGGLY||t.itemType===z.STRIKE_OUT){const e=t,n=e.quadrilaterals[0],i=e.quadrilaterals[e.quadrilaterals.length-1],o={pdfX:n.topLeft.x,pdfY:n.topLeft.y,page:n.pageNumber},s={pdfX:i.bottomRight.x,pdfY:i.bottomRight.y,page:i.pageNumber},a=this.pdfViewerApi.getText(o,s);ot(a||"")}}}toggleLock(e){var t;if((null===(t=this.viewerCanvas)||void 0===t?void 0:t.licenseFeatures.annotate)&&this.pdfViewerApi){const t=this.pdfViewerApi.getItem(e);if(this.options.annotation.trackHistory&&ct(t,t.isLocked()?"unlock":"lock",this.options.viewer.general.user),t.setLock(!t.isLocked()),this.annotationBorder){this.annotationBorder.deselectAnnotation();const e=this.store.getState().document.pageRects[t.pdfRect.page];this.annotationBorder.setAnnotation(t,e)}this.store.annotations.updateAnnotation(t),this.pdfViewerApi.updateItem(t)}}deleteAnnotation(e){var t;if((null===(t=this.viewerCanvas)||void 0===t?void 0:t.licenseFeatures.annotate)&&this.pdfViewerApi){const t=this.pdfViewerApi.getItem(e);this.options.annotation.hideOnDelete?(t.setHidden(!0),t.popup.isOpen=!1,this.options.annotation.trackHistory&&ct(t,"delete",this.options.viewer.general.user),this.store.annotations.updateAnnotation(t),this.pdfViewerApi.updateItem(t),this.deselectAnnotation()):this.pdfViewerApi.deleteItem(t).then((()=>{this.deselectAnnotation()})).catch((e=>{console.error(e)}))}}deletePopup(e){var t;if((null===(t=this.viewerCanvas)||void 0===t?void 0:t.licenseFeatures.annotate)&&this.pdfViewerApi){const t=this.pdfViewerApi.getItem(e);t.content=null,t.popup.isOpen=!1,this.store.annotations.updateAnnotation(t),this.store.canvas.setCanvasInvalidated(!0),this.pdfViewerApi.updateItem(t)}}createPopup(e){var t;if((null===(t=this.viewerCanvas)||void 0===t?void 0:t.licenseFeatures.annotate)&&this.pdfViewerApi){const t=this.pdfViewerApi.getItem(e);t.content="",t.popup.isOpen=!0,t.popup.pdfRect.pdfX=t.pdfRect.pdfX,t.popup.pdfRect.pdfY=t.pdfRect.pdfY-(t.popup.pdfRect.pdfH+10),this.store.annotations.updateAnnotation(t),this.store.canvas.setCanvasInvalidated(!0),this.pdfViewerApi.updateItem(t).then((()=>{this.store.viewer.selectPopup({id:t.id,focus:!0})})),this.deselectAnnotation()}}openPopup(e){var t,n;if(this.pdfViewerApi){const i=this.pdfViewerApi.getItem(e);if(!((null===(t=this.viewerCanvas)||void 0===t?void 0:t.licenseFeatures.annotate)||i.content&&i.content))return;if(!i.popup)return;i.popup.isOpen=!0,this.store.annotations.updateAnnotation(i),this.store.canvas.setCanvasInvalidated(!0),(null===(n=this.viewerCanvas)||void 0===n?void 0:n.licenseFeatures.annotate)?this.pdfViewerApi.updateItem(i).then((()=>{this.store.viewer.selectPopup({id:i.id,focus:!0})})):(this.deselectAnnotation(),this.store.viewer.selectPopup({id:i.id,focus:!0}))}}onItemDblClick(e){if(this.pdfViewerApi){const t=this.pdfViewerApi.getItem(e),{behaviors:n}=t;if(t.isHidden())return;t.itemType!==z.FREE_TEXT||t.isReadOnly()||t.isLocked()?n.canHavePopup&&!t.isHidden()&&this.openPopup(e):this.viewerCanvas&&this.viewerCanvas.activateModule("FreetextAnnotationModule",t.id)}}onItemSelected(e){e.itemCategory===I.ANNOTATION&&this.selectAnnotation(e,!0)}}class Ot{constructor(e){if(this.pR=0,this.pG=0,this.pB=0,this.pA=0,"transparent"===(e=e.replace(/\s+/gi,"")))this.pR=255,this.pG=255,this.pB=255,this.pA=0;else if(0===e.indexOf("#"))if(4===e.length)this.pR=parseInt(e.substring(1,2),16),this.pG=parseInt(e.substring(2,3),16),this.pB=parseInt(e.substring(3,4),16),this.pA=255;else if(5===e.length)this.pR=parseInt(e.substring(1,2),16),this.pG=parseInt(e.substring(2,3),16),this.pB=parseInt(e.substring(3,4),16),this.pA=parseInt(e.substring(4,5),16);else if(7===e.length)this.pR=parseInt(e.substring(1,3),16),this.pG=parseInt(e.substring(3,5),16),this.pB=parseInt(e.substring(5,7),16),this.pA=255;else{if(9!==e.length)throw new Error("invalid color string: "+e);this.pR=parseInt(e.substring(1,3),16),this.pG=parseInt(e.substring(3,5),16),this.pB=parseInt(e.substring(5,7),16),this.pA=parseInt(e.substring(7,9),16)}else{if(0!==e.indexOf("rgb"))throw new Error("invalid color string: "+e);{const t=e.substring(e.indexOf("(")+1,e.indexOf(")")).split(",");if(t.length<3||t.length>4)throw new Error("invalid color string: "+e);this.pR=parseInt(t[0],10),this.pG=parseInt(t[1],10),this.pB=parseInt(t[2],10),4===t.length?this.pA=Math.floor(255*parseFloat(t[3])):this.pA=255}}}isDark(){return.3*this.pR+.59*this.pG+.11*this.pB<127}get r(){return this.pR}set r(e){this.pR=e}get g(){return this.pG}set g(e){this.pG=e}get b(){return this.pB}set b(e){this.pB=e}get a(){return Math.floor(this.pA/255*1e3)/1e3}darken(e){const t=1-Math.abs(e/100),n=Math.floor(this.pR*t),i=Math.floor(this.pG*t),o=Math.floor(this.pB*t);this.pR=n>255?255:n,this.pG=i>255?255:i,this.pB=o>255?255:o}setOpacity(e){this.pA=Math.floor(255*e)}toRgb(){return`rgb(${this.pR},${this.pG},${this.pB})`}toRgba(){return`rgba(${this.pR},${this.pG},${this.pB},${this.a})`}toHexRgb(){return`#${this.toHex(this.pR)}${this.toHex(this.pG)}${this.toHex(this.pB)}`}toHexRgba(){return`#${this.toHex(this.pR)}${this.toHex(this.pG)}${this.toHex(this.pB)}${this.toHex(this.pA)}`}toHex(e){let t=e.toString(16);return 1===t.length&&(t="0"+t),t}}const Mt=({icon:e,tooltip:t,disabled:n,colors:o,color:s,allowRgba:a=!0,mode:r,onChange:l})=>{const d=a?o:o.filter((e=>new Ot(e).a>=1));return"buttons"===r&&window.innerWidth>580?i(Nt,{icon:e,colors:d,color:s,onChange:l}):i(Rt,{icon:e,tooltip:t,disabled:n,colors:d,color:s,onChange:l})},Rt=({icon:e,tooltip:t,disabled:n,colors:o,color:a,onChange:r})=>n?i("div",{class:"pwv-ColorPicker pwv-Dropdown pwv-ToolbarItem pwv-disabled"},i("button",Object.assign({},b.createTooltip(t),{oncreate:y.create,onremove:y.remove}),i(v,{icon:e}),i("div",{class:s("pwv-ColorPicker__selectedColor"),style:{backgroundColor:a}}))):i("div",{class:"pwv-ColorPicker pwv-Dropdown pwv-ToolbarItem"},i("button",Object.assign({},b.createTooltip(t),{oncreate:y.create,onremove:y.remove}),i(v,{icon:e}),i("div",{class:s("pwv-ColorPicker__selectedColor"),style:{backgroundColor:a}})),i("div",{class:s("pwv-DropdownPanel",{"pwv-DropdownPanel-wide":o.length>6})},o.map((e=>i("button",{disabled:e.toLowerCase()===a.toLowerCase(),class:s("pwv-ColorPicker__Button",{"pwv-selected":e.toLowerCase()===a.toLowerCase()}),onclick:t=>{r&&r(e)}},i("div",{style:{backgroundColor:e}})))))),Nt=({icon:e,colors:t,color:n,onChange:o})=>i("div",{class:"pwv-ColorPicker--buttons pwv-ToolbarItem"},t.map((e=>i("button",{disabled:e.toLowerCase()===n.toLowerCase(),class:s("pwv-ColorPicker__Button",{"pwv-selected":e.toLowerCase()===n.toLowerCase()}),onclick:t=>{o&&o(e)}},i("div",{style:{backgroundColor:e}})))));class Vt extends ft{constructor(){super(),this.startPoint=null,this.selecting=!1,this.contextBarElement=null,this.selectionType=null,this.createAnnotation=this.createAnnotation.bind(this),this.copyTextSelection=this.copyTextSelection.bind(this)}create(){}render(e,t){var n;if(t.viewer.mode!==tt.TEXT_SELECTED&&this.contextBarElement&&(this.removeHtmlElements(),this.contextBarElement=null),t.viewer.mode!==tt.MODULE_SELECTED){if("click"===t.pointer.action)this.endSelection();else if("dblclick"===t.pointer.action){const e=this.pdfViewerApi.transformScreenPointToPdfPoint({x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels}),n=this.pdfViewerApi.getWordOnPoint(e.pdfPoint);this.store.viewer.setTextSelection({selection:n,type:"normal"}),this.selectionCreated()}else if(t.viewer.mode!==tt.DEFAULT||this.selecting||("mouse"!==t.pointer.type||"startdrag"!==t.pointer.action)&&"longpress"!==t.pointer.action){if(this.selecting)if(t.pointer.isDown){if(t.pointer.positionChanged){const e=this.pdfViewerApi.getClosestPointOnPdfByScreenPoint({x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels});if(this.startPoint){const t="rectangular"===this.selectionType?this.pdfViewerApi.getRectangularTextSelection(this.startPoint,e):this.pdfViewerApi.getTextSelection(this.startPoint,e);this.store.viewer.setTextSelection({selection:t,type:this.selectionType}),this.store.viewer.setTextSelectionState("selecting")}}}else(null===(n=t.viewer.textSelection)||void 0===n?void 0:n.quadrilaterals.length)?this.selectionCreated():this.endSelection()}else{const e={x:t.startPointer.x.devicePixels,y:t.startPointer.y.devicePixels},n=this.pdfViewerApi.transformScreenPointToPdfPoint(e),i=this.pdfViewerApi.getTextFragmentOnPoint(e);"automatic"===this.options.viewer.general.rectangularTextSelection?(this.selectionType=i?"normal":"rectangular",this.startSelection(n.pdfPoint)):i&&this.startSelection(n.pdfPoint)}if(this.selecting&&t.pointer.y.devicePixels>-1){const e=30,n=20;t.pointer.y.devicePixels>t.canvas.height.devicePixels-e?this.pdfViewerApi.setScrollPosition({x:t.scroll.left.devicePixels,y:t.scroll.top.devicePixels+n}):t.pointer.y.devicePixels<e?this.pdfViewerApi.setScrollPosition({x:t.scroll.left.devicePixels,y:t.scroll.top.devicePixels-n}):t.pointer.x.devicePixels>t.canvas.width.devicePixels-e?this.pdfViewerApi.setScrollPosition({x:t.scroll.left.devicePixels+n,y:t.scroll.top.devicePixels}):t.pointer.x.devicePixels<e&&this.pdfViewerApi.setScrollPosition({x:t.scroll.left.devicePixels-n,y:t.scroll.top.devicePixels})}if(this.contextBarElement&&t.viewer.textSelectionRects){let e=25,n=0,i=!1,o=!1,s=null;const{firstVisiblePage:a,lastVisiblePage:r}=t.document;if(Object.keys(t.viewer.textSelectionRects).forEach((e=>{const n=parseInt(e);if(n>=a&&n<=r&&t.viewer.textSelectionRects){const n=this.pdfViewerApi.transformPdfPageRectToScreenRect(t.viewer.textSelectionRects[e]);n&&(s={x1:n.x/devicePixelRatio,y1:n.y/devicePixelRatio,x2:n.x/devicePixelRatio+n.w/devicePixelRatio,y2:n.y/devicePixelRatio+n.h/devicePixelRatio})}})),s){const{x1:a,y1:r,x2:l,y2:d}=s;r>90?(e=r-65,i=!0):t.canvas.height.cssPixels/2>d&&(e=d+15,o=!0),n=a+(l-a-this.contextBarElement.clientWidth)/2,n<0&&(n=0)}else e=-90;this.contextBarElement.style.top=e+"px",this.contextBarElement.style.left=n+"px",i?this.contextBarElement.classList.add("pwv-contextbar-top"):this.contextBarElement.classList.remove("pwv-contextbar-top"),o?this.contextBarElement.classList.add("pwv-contextbar-bottom"):this.contextBarElement.classList.remove("pwv-contextbar-bottom")}}}clearSelection(){this.endSelection()}clearHtmlDocumentSelection(){const e=document.getSelection();e&&e.empty()}startSelection(e){this.clearHtmlDocumentSelection(),this.removeHtmlElements(),this.contextBarElement=null,this.selecting=!0,null===this.startPoint&&(this.startPoint=e),this.store.viewer.setCursorStyle(nt.TEXT)}endSelection(){this.removeHtmlElements(),this.contextBarElement=null,this.selecting=!1,this.startPoint=null,this.clearHtmlDocumentSelection(),window.setTimeout((()=>{this.selectionType=null,this.store.viewer.setTextSelection({selection:null,type:null}),this.store.viewer.setTextSelectionState(null)}),50)}selectionCreated(){var e;this.selecting=!1,this.contextBarElement&&this.removeHtmlElements(),this.store.viewer.setCursorStyle(nt.DEFAULT),this.store.viewer.setTextSelectionState("textSelected");const t=!(null===(e=this.viewerCanvas)||void 0===e?void 0:e.licenseFeatures.annotate),n=this.options.viewer.permissions.allowCopyText;t&&!n||(this.contextBarElement=this.createHtmlLayer(),this.contextBarElement.classList.add("pwv-textselection-contextbar"),this.contextBarElement.classList.add("pwv-contextbar-top"),((e,t)=>{const n={highlightColors:e.highlightColors},s=({})=>t=>i(Et,null,i(h,null,e.isViewOnly?i(m,null,i(S,{tooltip:g.getText("contextbar.copyText"),icon:f.copy,onClick:e.onCopyText})):i(m,null,e.allowCopyText&&i(S,{tooltip:g.getText("contextbar.copyText"),icon:f.copy,onClick:e.onCopyText}),i(Mt,{tooltip:g.getText("contextbar.highlightText"),colors:t.highlightColors,icon:f.highlighter,color:"#000000ff",onChange:t=>{e.onCreateAnnotation(z.HIGHLIGHT,t)}}),i(Mt,{tooltip:g.getText("contextbar.underlineText"),colors:t.highlightColors,icon:f.underline,color:"#000000ff",onChange:t=>{e.onCreateAnnotation(z.UNDERLINE,t)}}),i(Mt,{tooltip:g.getText("contextbar.squigglyText"),colors:t.highlightColors,icon:f.squiggly,color:"#000000ff",onChange:t=>{e.onCreateAnnotation(z.SQUIGGLY,t)}}),i(Mt,{tooltip:g.getText("contextbar.strikeOutText"),colors:t.highlightColors,icon:f.strikethrough,color:"#000000ff",onChange:t=>{e.onCreateAnnotation(z.STRIKE_OUT,t)}}))));o(n,{},(()=>i(s,null)),t)})({highlightColors:this.options.annotation.colors.highlightColors,onCreateAnnotation:this.createAnnotation,onCopyText:this.copyTextSelection,isViewOnly:t,allowCopyText:n},this.contextBarElement),this.viewerCanvas.onTextSelected())}createAnnotation(e,t){if(this.pdfViewerApi&&this.store){const n=this.store.getState().viewer.textSelection;if(n){const i=[];for(let e=0;e<n.quadrilaterals.length;e++){const t=n.quadrilaterals[e];i[t.pageNumber]||(i[t.pageNumber]=[]),i[t.pageNumber].push(t)}if(e===z.HIGHLIGHT){const e=new Ot(t);e.setOpacity(this.options.annotation.highlightOpacity),t=e.toRgba()}for(let n=0;n<i.length;n++)if(i[n]){const o=i[n],s={itemType:e,page:n,pdfRect:{pdfX:0,pdfY:0,pdfW:0,pdfH:0,page:n},color:t,author:this.options.viewer.general.user,quadrilaterals:o};this.pdfViewerApi.createItem(s).then((e=>{this.options.annotation.trackHistory&&(ct(e,"create",this.options.viewer.general.user),this.pdfViewerApi.updateItem(e))})),this.endSelection()}}}}copyTextSelection(){var e;const t=null===(e=this.viewerCanvas)||void 0===e?void 0:e.getSelectedText();ot(t||"")}}const Dt=({value:e,noneStrokeText:t})=>0===e?i("div",{class:"pwv-stroke-width-picker-item"},i("span",null,t)):i("div",{class:"pwv-stroke-width-picker-item"},i("span",null,e,"pt"),i("span",{class:"pwv-stroke-width",style:{height:`${e}px`}})),kt=({disabled:e,noneStrokeText:t,strokeWidths:n,value:o,tooltip:s,onChange:a})=>{const r=n.map((e=>({value:e,renderItem:e=>i(Dt,{value:e.value,noneStrokeText:t})})));return i(P,{className:"pwv-stroke-width-picker",align:"right",tooltip:s,disabled:e,items:r,value:o,renderButton:e=>i(Dt,{value:e,noneStrokeText:t}),onChange:a})};const It="AddFreetextAnnotation";class Ft extends ut{constructor(){super(...arguments),this.context=null,this.colors=[],this.selectedColor="",this.borderWidths=[],this.pointerDown=!1,this.startPoint=null,this.page=0}onCreate(){this.setColor=this.setColor.bind(this),this.setBorderWidth=this.setBorderWidth.bind(this),this.close=this.close.bind(this),this.context=this.createCanvas(),this.colors=this.options.annotation.colors.backgroundColors,this.selectedColor=this.options.annotation.colors.freetextBackgroundColor||this.options.annotation.colors.defaultBackgroundColor,this.borderWidths=[0,1,2,3,4];const e=this.module.toolbarElement;((e,t)=>{const n={colors:e.colors,selectedColor:e.selectedColor,borderWidths:e.borderWidths,selectedBorderWidth:e.selectedBorderWidth},s=({})=>(t,n)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(Mt,{colors:t.colors,color:t.selectedColor,icon:f.fillColor,mode:"buttons",onChange:n.setColor}),i(kt,{tooltip:g.getText("annotFreeText.borderWidth"),noneStrokeText:g.getText("border.none"),strokeWidths:t.borderWidths,value:t.selectedBorderWidth,onChange:n.setBorderWith})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onClose})));o(n,{setColor:t=>n=>(e.onColorChanged(t),Object.assign(Object.assign({},n),{selectedColor:t})),setBorderWith:t=>n=>(e.onBorderWidthChanged(t),Object.assign(Object.assign({},n),{selectedBorderWidth:t}))},(()=>i(s,null)),t)})({colors:this.colors,selectedColor:this.selectedColor,borderWidths:this.borderWidths,selectedBorderWidth:this.options.annotation.freetextBorderWidth||this.options.annotation.defaultBorderWidth,onColorChanged:this.setColor,onBorderWidthChanged:this.setBorderWidth,onClose:this.close},e),this.store.viewer.beginModule(It)}onSave(){return new Promise(((e,t)=>{e()}))}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.setCursorStyle(nt.DEFAULT),this.store.viewer.endModule(It)}render(e,t){if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==It)this.remove();else if(this.context&&(t.viewer.modeChanged||t.pointer.positionChanged||t.pointer.action||t.document.zoomChanged)){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const n={x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels},i=this.pdfApi.transformScreenPointToPdfPoint(n);if(i.isOnPage?this.store.viewer.setCursorStyle(nt.CROSSHAIR):this.store.viewer.setCursorStyle(nt.NOT_ALLOWED),t.pointer.isDown){if(this.pointerDown||(this.startPoint=n,this.pointerDown=!0,0===this.page&&i.isOnPage&&(this.page=i.pdfPoint.page)),this.startPoint){const i=Ye(t.document,{x:this.startPoint.x,y:this.startPoint.y},{x:n.x,y:n.y},this.page);if(i){const t=2*devicePixelRatio;e.save(),e.strokeStyle=this.options.viewer.general.textSelectionColor,e.fillStyle=this.options.viewer.general.textSelectionColor,e.lineWidth=t,e.setLineDash([t,t]),e.strokeRect(i.x,i.y,i.w,i.h),e.globalAlpha=.33,e.fillRect(i.x,i.y,i.w,i.h),e.restore()}}}else if(this.pointerDown&&this.startPoint){const e=Ye(t.document,{x:this.startPoint.x,y:this.startPoint.y},{x:n.x,y:n.y},this.page);e&&(this.createFreeTextAnnotation(e),this.pointerDown=!1,this.startPoint=null,this.remove())}}}setColor(e){this.selectedColor=e,this.options.annotation.colors.freetextBackgroundColor=e}setBorderWidth(e){this.options.annotation.freetextBorderWidth=e}close(){this.remove()}createFreeTextAnnotation(e){return t=this,n=void 0,o=function*(){const t=this.pdfApi.transformScreenRectToPdfRect(e,this.page),{pdfY:n,pdfH:i,pdfW:o,pdfX:s,page:a}=t,r=yield this.pdfApi.getPagePdfSize(a),l=this.pdfApi.getRotation()%180!=0;t.pdfW=l?Math.max(18,o):Math.max(20,o),t.pdfH=l?Math.max(20,i):Math.max(18,i),t.pdfX=Math.min(s,r.width-t.pdfW),t.pdfY=Math.min(n,r.height-t.pdfH);const d={itemType:z.FREE_TEXT,color:"transparent"===this.selectedColor?"#00000000":this.selectedColor,author:this.options.viewer.general.user,page:t.page,pdfRect:t,border:{width:this.options.annotation.freetextBorderWidth||this.options.annotation.defaultBorderWidth,style:F.SOLID},richtext:`<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:19.12.0" xfa:spec="2.0.2" style="color:${this.options.annotation.colors.freetextFontColor};"></body>`,fontName:"Arial",fontColor:this.options.annotation.fonts.freetextFontColor,fontSize:this.options.annotation.fonts.freetextFontSize};this.pdfApi.createItem(d).then((e=>{this.onAnnotationCreated(e).then((e=>{this.module.onEdit(e.id)}))}))},new((i=void 0)||(i=Promise))((function(e,s){function a(e){try{l(o.next(e))}catch(e){s(e)}}function r(e){try{l(o.throw(e))}catch(e){s(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,r)}l((o=o.apply(t,n||[])).next())}));var t,n,i,o}}class Bt{constructor(e,t){this.hasRangeSelection=!1,this.executeCommand=this.executeCommand.bind(this),this.handleOnPaste=this.handleOnPaste.bind(this),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.content=t,this.element=e,this.element.style.background="white",this.element.classList.add("pwv-freetexteditor"),this.editorElement=document.createElement("iframe"),this.editorElement.width="100%",this.editorElement.height="100%",this.editorElement.frameBorder="0",this.editorElement.style.transformOrigin="0 0",this.element.appendChild(this.editorElement),this.editorDocument=this.editorElement.contentDocument,this.editorDocument.open(),this.editorDocument.close();let n=t.richText;n=n.replace(/\&#(10|13|x0A|x0D);/gi,"<br>"),n=n.replace(/<p\s*([^>]*)>/gi,"<div $1>"),n=n.replace(/<\/p>\s*<br\/*>/gi,"</div>"),n=n.replace(/<br\/*>\s*<\/p>\s*/gi,"</div>"),n=n.replace(/<\/p>/gi,"</div>"),n=n.replace(/\r?\n|\r/g,"");const i=/.*(<body.*<\/body>).*/gi.exec(n);this.editorDocument.body.outerHTML=i&&i.length>1?i[1]:'<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:19.12.0" xfa:spec="2.0.2"><p></p></body>',0===this.editorDocument.body.children.length?1===this.editorDocument.body.childNodes.length&&this.editorDocument.body.childNodes[0].nodeType===Node.TEXT_NODE?this.editorDocument.body.innerHTML=`<p>${this.editorDocument.body.childNodes[0].textContent}</p>`:this.editorDocument.body.innerHTML="<div><br/></div>":this.editorDocument.body.childNodes.forEach((e=>{if("DIV"===e.nodeName&&0===e.childNodes.length){const t=document.createElement("br");e.appendChild(t)}})),this.editorDocument.body.addEventListener("input",(e=>{""!==this.editorDocument.body.innerHTML&&"<br>"!==this.editorDocument.body.innerHTML||(this.editorDocument.body.innerHTML="<div><br/></div>")})),this.editorDocument.body.addEventListener("keydown",(e=>{"Tab"===e.key?e.preventDefault():"Enter"===e.key&&this.editorDocument.execCommand("formatBlock",!1,"div")})),this.editorDocument.head.insertAdjacentHTML("beforeend","<style>\n body {\n padding: 1px;\n line-height: 1.2;\n margin: 0;\n height: 100%;\n box-sizing: border-box;\n white-space: pre-wrap:\n overflow: hidden;\n } \n p {\n margin: 0;\n }\n </style>"),this.editorDocument.body.style.fontFamily=t.fontName,this.editorDocument.body.style.color=t.fontColor,this.editorDocument.body.style.fontSize=t.fontSizeCSS,this.editorDocument.body.style.backgroundColor=t.backgroundColor,this.editorDocument.body.style.borderColor="#000000",this.editorDocument.body.style.borderStyle="solid",this.editorDocument.body.style.borderWidth=`${t.borderWidth}px`,this.editorDocument.designMode="on",this.editorDocument.addEventListener("paste",this.handleOnPaste,!1),this.editorDocument.addEventListener("selectionchange",this.handleSelectionChange,!1),this.editorDocument.addEventListener("mousewheel",(e=>{e.preventDefault(),e.cancelBubble=!0}),{passive:!1}),this.editorDocument.body.setAttribute("tabindex","1"),window.setTimeout((()=>{var e;let t=this.editorDocument.createRange();t.setStart(this.editorDocument.body,0),t.setEnd(this.editorDocument.body,this.editorDocument.body.children.length),t.collapse(),null===(e=this.editorDocument.getSelection())||void 0===e||e.addRange(t),this.editorDocument.body.focus()}),1)}setZoom(e){this.editorElement.style.transform=`scale(${e})`,this.editorElement.width=this.element.clientWidth/e+"px",this.editorElement.height=this.element.clientHeight/e+"px"}getEditorValues(){const e='<?xml version="1.0"?>'+this.cleanupRichText(this.editorDocument.body.outerHTML),t=this.getContent(e);return Object.assign(Object.assign({},this.content),{content:t||"",backgroundColor:this.editorDocument.body.style.backgroundColor,fontColor:this.editorDocument.body.style.color,fontName:this.editorDocument.body.style.fontFamily,fontSizeCSS:this.editorDocument.body.style.fontSize,richText:e})}executeCommand(e){switch(e.cmd){case"setFont":this.content.fontName=e.args,this.editorDocument.body.style.fontFamily=e.args;break;case"setFontColor":this.content.fontColor=e.args,this.editorDocument.body.style.color=e.args;break;case"setBorderWidth":this.content.borderWidth=e.args,this.editorDocument.body.style.borderWidth=`${e.args}px`;break;case"setFontSize":{const t=ge(e.args);this.content.fontSizeCSS=t,this.editorDocument.body.style.fontSize=t;break}case"setFillColor":this.content.backgroundColor=e.args,this.editorDocument.body.style.backgroundColor=e.args;break;default:this.editorDocument.execCommand(e.cmd,!1,e.args)}}cleanupRichText(e){let t=e;return t=t.replace(/<div><br><\/div>/gi," "),t=t.replace(/<div\s*([^>]*)\>/gi,"<p $1>"),t=t.replace(/<\/div\>/gi,"</p> "),t=t.replace(/<p\s*>/gi,"<p>"),t=t.replace(/\<br\>/gi," "),t=t.replace(/(\n|\r)/gi,""),t=t.replace(/<u>/gi,'<span style="text-decoration:underline;">'),t=t.replace(/<\/u>/gi,"</span>"),t=t.replace(/\ \;/gi," "),t=t.replace(/overflow\:.*?\;/gi,""),t=t.replace(/background-color\:.*?\;/gi,""),t=t.replace(/border\:.*?\;/gi,""),t=t.replace(/border-color\:.*?\;/gi,""),t=t.replace(/border-style\:.*?\;/gi,""),t=t.replace(/border-width\:.*?\;/gi,""),t=t.replace(/font-size\:\s*(\d*\.?\d+)px\s*\;/gi,((e,t)=>"font-size:"+(t=me((t=parseFloat(t))/96*72))+"pt;")),t=t.replace(/rgb\((.+?)\)/gi,(e=>new Ot(e).toHexRgb())),t=t.replace(/style="(.*?)"/gi,(e=>e.replace(/\s*/gi,""))),t}getContent(e){const t=(new DOMParser).parseFromString(e,"text/html").documentElement;let n=t?t.querySelector("*"):null;if(n)for(;n=n.nextSibling,n;)if("body"===n.nodeName.toLocaleLowerCase())return n.innerText;return null}handleOnPaste(e){e.preventDefault();const t=e.clipboardData.getData("text/plain");t&&this.executeCommand({cmd:"insertText",args:t})}handleSelectionChange(e){}}const jt="EditFreetextAnnotation";class zt extends ut{constructor(){super(...arguments),this.freetextAnnotation=null,this.editorElement=null,this.richTextEditor=null,this.toolbarView=null,this.color=this.options.annotation.fonts.freetextFontColor,this.fontSize=`${this.options.annotation.fonts.defaultFontSize}pt`,this.borderWidth=1,this.fontSizeCSS=ge(`${this.options.annotation.fonts.defaultFontSize}`),this.fontName=this.options.annotation.fonts.freetextFontFamily}onCreate(e){this.store.viewer.beginModule(jt),this.freetextAnnotation=this.pdfApi.getItem(e),this.updateFreeTextAnnotation=this.updateFreeTextAnnotation.bind(this),this.close=this.close.bind(this),this.executeCommand=this.executeCommand.bind(this),this.editorElement=this.createHtmlLayer(),this.editorElement.style.position="absolute",this.editorElement.style.zIndex="4";const t=this.options.annotation;if(this.color=t.colors.freetextFontColor,this.borderWidth=this.freetextAnnotation.border.width,this.fontName=t.fonts.freetextFontFamily,this.fontSize=`${t.fonts.freetextFontSize}`,this.fontSizeCSS=ge(`${t.fonts.freetextFontSize}`),this.freetextAnnotation.richText){const e=/.*color:(.*?);/.exec(this.freetextAnnotation.richText),t=/.*font-family:(.*?);/.exec(this.freetextAnnotation.richText),n=/.*font-size:(.*?)[;|\"]/.exec(this.freetextAnnotation.richText);e&&e.length>1&&(this.color=e[1]),t&&t.length>1&&(this.fontName=t[1]),n&&n.length>1&&(this.fontSize=n[1],this.fontSizeCSS=ge(this.fontSize))}else this.color=this.freetextAnnotation.color,this.fontName=this.freetextAnnotation.fontName,this.fontSizeCSS=ge(this.freetextAnnotation.fontSize);this.richTextEditor=new Bt(this.editorElement,{content:this.freetextAnnotation.content,richText:this.freetextAnnotation.richText,backgroundColor:this.freetextAnnotation.color,borderWidth:this.freetextAnnotation.border.width,fontName:this.fontName,fontColor:this.color,fontSizeCSS:this.fontSizeCSS});const n=this.module.toolbarElement;this.toolbarView=((e,t)=>{const n={annotation:e.annotation,updatedSubject:e.annotation.subject,backgroundColors:e.backgroundColors,borderWidths:e.borderWidths,selectedBorderWidth:e.selectedBorderWidth,fontColors:e.fontColors,fontFamilies:e.fontFamilies,fontSizes:e.fontSizes,selectedFont:e.selectedFont,selectedBackgroundColor:e.selectedBackgroundColor,selectedFontColor:e.selectedFontColor,selectedFontSize:e.selectedFontSize,hasRangeSelection:!1},s=({hideAnnotationSubject:t})=>(n,o)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(P,{tooltip:g.getText("annotFreeText.fontFamily"),text:n.selectedFont,value:n.selectedFont,width:150,items:n.fontFamilies.map((e=>({text:e,value:e}))),onChange:o.setFontFamily}),i(P,{tooltip:g.getText("annotFreeText.fontSize"),text:n.selectedFontSize,value:n.selectedFontSize,width:85,align:"right",items:n.fontSizes.map(((e,t)=>({text:`${e}pt`,value:e}))),onChange:o.setFontSize}),i(c,null)),i(m,null,i(Mt,{tooltip:g.getText("annotFreeText.fontColor"),colors:n.fontColors,icon:f.fontColor,color:n.selectedFontColor,onChange:o.setFontColor}),i(Mt,{tooltip:g.getText("annotFreeText.bgColor"),colors:n.backgroundColors,icon:f.fillColor,color:n.selectedBackgroundColor,onChange:o.setBackgroundColor}),i(kt,{tooltip:g.getText("annotFreeText.borderWidth"),noneStrokeText:g.getText("border.none"),strokeWidths:n.borderWidths,value:n.selectedBorderWidth,onChange:o.setBorderWith}),i(c,null)),i(m,null,i(S,{tooltip:g.getText("annotFreeText.alignLeft"),icon:f.alignLeft,onClick:()=>{o.executeCommand({cmd:"justifyLeft"})}}),i(S,{tooltip:g.getText("annotFreeText.alignCenter"),icon:f.alignCenter,onClick:()=>{o.executeCommand({cmd:"justifyCenter"})}}),i(S,{tooltip:g.getText("annotFreeText.alignRight"),icon:f.alignRight,onClick:()=>{o.executeCommand({cmd:"justifyRight"})}}),i(c,null)),i(m,null,i(S,{tooltip:g.getText("annotFreeText.bold"),icon:f.bold,onClick:()=>{o.executeCommand({cmd:"bold"})}}),i(S,{tooltip:g.getText("annotFreeText.italic"),icon:f.italic,onClick:()=>{o.executeCommand({cmd:"italic"})}}),i(S,{tooltip:g.getText("annotFreeText.underline"),icon:f.underline,onClick:()=>{o.executeCommand({cmd:"underline"})}}),i(c,null)),e.allowLockAnnotations&&i(m,null,i(S,{tooltip:g.getText(n.annotation.isLocked()?"annotFreeText.unlock":"annotFreeText.lock"),icon:n.annotation.isLocked()?f.lock:f.unlock,onClick:()=>{n.annotation.setLock(!n.annotation.isLocked()),o.close()}}),i(c,null)),!t&&i(m,null,i("div",{class:"pwv-freetext-subject"},i("input",{id:"pwv-freetext-subject-"+n.annotation.id,placeholder:g.getText("annotFreeText.subjectPlaceholder"),onchange:e=>{o.setSubject(e.currentTarget.value)},value:n.updatedSubject}))),i(m,{pushRight:!0},i(S,{icon:f.ok,onClick:o.close})));return o(n,{getState:()=>e=>e,setBorderWith:t=>n=>(e.onCmd({cmd:"setBorderWidth",args:t}),Object.assign(Object.assign({},n),{selectedBorderWidth:t})),executeCommand:t=>n=>(e.onCmd(t),n),setFontFamily:t=>n=>(e.onCmd({cmd:"setFont",args:t}),Object.assign(Object.assign({},n),{selectedFont:t})),setFontSize:t=>n=>(e.onCmd({cmd:"setFontSize",args:t}),Object.assign(Object.assign({},n),{selectedFontSize:`${t}pt`})),setFontColor:t=>n=>(e.onCmd({cmd:"setFontColor",args:t}),Object.assign(Object.assign({},n),{selectedFontColor:t})),setBackgroundColor:t=>n=>(e.onCmd({cmd:"setFillColor",args:t}),Object.assign(Object.assign({},n),{selectedBackgroundColor:t})),setSubject:e=>t=>Object.assign(Object.assign({},t),{annotation:t.annotation,updatedSubject:e}),hasRangeSelectionChanged:e=>t=>Object.assign(Object.assign({},t),{hasRangeSelection:e}),close:()=>t=>(e.onClose(),t)},(()=>i(s,{hideAnnotationSubject:e.hideAnnotationSubject})),t)})({annotation:this.freetextAnnotation,backgroundColors:[...t.colors.backgroundColors],borderWidths:[0,1,2,3,4],fontColors:[...t.colors.foregroundColors],fontFamilies:t.fonts.fontFamilies,fontSizes:t.fonts.fontSizes,selectedFont:this.fontName,selectedBackgroundColor:this.freetextAnnotation.color,selectedFontColor:this.color,selectedFontSize:this.fontSize,selectedBorderWidth:this.borderWidth,allowLockAnnotations:this.options.viewer.permissions.allowLockAnnotations,hideAnnotationSubject:this.options.annotation.hideAnnotationSubject||!1,onCmd:this.executeCommand,onClose:this.close},n)}onSave(){return new Promise(((e,t)=>{this.updateFreeTextAnnotation().then((()=>{this.remove(),e()}))}))}close(){this.updateFreeTextAnnotation().then((()=>{this.remove()}))}onRemove(){this.removeHtmlElements(),this.editorElement=null,this.freetextAnnotation=null,this.module.toolbarElement.innerHTML="",this.store.viewer.endModule(jt)}render(e,t){if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==jt)this.remove();else{if(this.editorElement&&"click"===t.pointer.action){const e=t.pointer.x.cssPixels>this.editorElement.offsetLeft&&t.pointer.x.cssPixels<this.editorElement.offsetLeft+this.editorElement.offsetWidth,n=t.pointer.y.cssPixels>this.editorElement.offsetTop&&t.pointer.y.cssPixels<this.editorElement.offsetTop+this.editorElement.offsetHeight;if(!e||!n)return this.updateFreeTextAnnotation(),void this.remove()}if(this.editorElement&&this.freetextAnnotation&&this.richTextEditor){if(t.canvas.canvasInvalidated||t.viewer.modeChanged){const e=this.pdfApi.transformPdfPageRectToScreenRect(this.freetextAnnotation.pdfRect);this.editorElement.style.left=e.x/devicePixelRatio+"px",this.editorElement.style.top=e.y/devicePixelRatio+"px";const n=e.w/devicePixelRatio,i=e.h/devicePixelRatio,o=(this.freetextAnnotation.rotation+t.document.rotation)%360;this.editorElement.style.transform=`rotate(${o}deg)`,90==o?(this.editorElement.style.width=`${i}px`,this.editorElement.style.height=`${n}px`,this.editorElement.style.transformOrigin=`${n/2}px ${n/2}px`):180==o?(this.editorElement.style.width=`${n}px`,this.editorElement.style.height=`${i}px`,this.editorElement.style.transformOrigin=`${n/2}px ${i/2}px`):270==o?(this.editorElement.style.width=`${i}px`,this.editorElement.style.height=`${n}px`,this.editorElement.style.transformOrigin=`${i/2}px ${i/2}px`):(this.editorElement.style.width=`${n}px`,this.editorElement.style.height=`${i}px`)}(t.document.zoomChanged||t.viewer.modeChanged)&&this.richTextEditor.setZoom(t.document.zoom)}}}executeCommand(e){var t;switch(e.cmd){case"setFont":this.options.annotation.fonts.freetextFontFamily=e.args;break;case"setFontSize":this.options.annotation.fonts.freetextFontSize=e.args}null===(t=this.richTextEditor)||void 0===t||t.executeCommand(e)}updateFreeTextAnnotation(){return new Promise(((e,t)=>{if(this.richTextEditor&&this.freetextAnnotation){const n=this.richTextEditor.getEditorValues(),i=this.toolbarView?this.toolbarView.getState().updatedSubject:this.freetextAnnotation.subject;this.options.annotation.trackHistory&&ct(this.freetextAnnotation,"edit",this.options.viewer.general.user,n.content,i);const o=new Ot(n.fontColor),s=""===n.backgroundColor?null:new Ot(n.backgroundColor);this.freetextAnnotation.content=n.content,this.freetextAnnotation.subject=i,this.freetextAnnotation.richText=n.richText,this.freetextAnnotation.fontColor=o.toHexRgb(),this.freetextAnnotation.fontName=null!==n.fontName?n.fontName:"Helvetica",this.freetextAnnotation.fontSize=n.fontSizeCSS?function(e){const t=/(\d*\.?\d+)/.exec(e);return me((t&&t.length>1?parseFloat(t[1]):12)/96*72)+"pt"}(n.fontSizeCSS):this.freetextAnnotation.fontSize,this.freetextAnnotation.color=null!==s?s.toRgba():null,this.freetextAnnotation.border.width=n.borderWidth,this.pdfApi.updateItem(this.freetextAnnotation).then((t=>{this.store.annotations.updateAnnotation(t),e()})).catch((e=>{console.error(e),t()}))}}))}}class Ht extends ht{constructor(){super(),this.annotationbarElement=null,this.toolbarElement=null,this.name=Ht.moduleInfo.name,this.onEdit=this.onEdit.bind(this)}onRegister(){return this.toolbarElement=document.createElement("div"),{toolbar:this.toolbarElement,contextbar:{itemTypes:[z.FREE_TEXT],icon:f.edit,tooltip:g.getText("annotFreeText.edit"),onCmd:e=>{this.onEdit(e)}}}}activate(e){e?this.onEdit(e):this.canvasLayers.add?this.removeCanvasLayer("add"):(this.store&&this.store.viewer.deselectAnnotation(),this.createCanvasLayer("add",Ft))}onEdit(e){this.createCanvasLayer("edit",zt,e)}}var Gt;Ht.moduleInfo={name:"FreetextAnnotationModule",moduleType:dt.Tool,requiredFeatures:{annotate:!0,fillFormFields:!1},translationKey:"annotFreeText.add",icon:"freeText"},function(e){e[e.HIGHLIGHT=0]="HIGHLIGHT",e[e.RECTANGULAR_HIGHLIGHT=1]="RECTANGULAR_HIGHLIGHT",e[e.UNDERLINE=2]="UNDERLINE",e[e.SQUIGGLY=3]="SQUIGGLY",e[e.STRIKE_OUT=4]="STRIKE_OUT"}(Gt||(Gt={}));const Wt="AddHighlightAnnotation";class _t extends ut{constructor(){super(...arguments),this.colors=[],this.selectedColor="",this.selectedTool=Gt.HIGHLIGHT,this.pdfStartPoint=null,this.screenStartPoint=null,this.pointerDown=!1,this.page=0,this.selecting=!1,this.selection=null}onCreate(){this.setColor=this.setColor.bind(this),this.close=this.close.bind(this),this.setTool=this.setTool.bind(this),this.context=this.createCanvas();const e=this.options.annotation;this.colors=e.colors.highlightColors,this.selectedColor=e.colors.highlightAnnotationColor;const t=this.module.toolbarElement;((e,t)=>{const n={colors:e.colors,selectedTool:e.selectedTool,selectedColor:e.selectedColor},s=({})=>(t,n)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(Mt,{colors:t.colors,color:t.selectedColor,icon:f.fillColor,mode:"buttons",onChange:n.setColor}),i(c,null)),i(m,null,i(S,{tooltip:g.getText("annotHighlight.highlight"),icon:f.highlighter,active:t.selectedTool===Gt.HIGHLIGHT,onClick:()=>{n.setTool(Gt.HIGHLIGHT)}}),i(S,{tooltip:g.getText("annotHighlight.underline"),icon:f.underline,active:t.selectedTool===Gt.UNDERLINE,onClick:()=>{n.setTool(Gt.UNDERLINE)}}),i(S,{tooltip:g.getText("annotHighlight.squiggly"),icon:f.squiggly,active:t.selectedTool===Gt.SQUIGGLY,onClick:()=>{n.setTool(Gt.SQUIGGLY)}}),i(S,{tooltip:g.getText("annotHighlight.strikeOut"),icon:f.strikethrough,active:t.selectedTool===Gt.STRIKE_OUT,onClick:()=>{n.setTool(Gt.STRIKE_OUT)}}),i(S,{tooltip:g.getText("annotHighlight.rectangularHighlight"),icon:f.rectangularHighlighter,active:t.selectedTool===Gt.RECTANGULAR_HIGHLIGHT,onClick:()=>{n.setTool(Gt.RECTANGULAR_HIGHLIGHT)}})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onClose})));o(n,{setColor:t=>n=>(e.onColorChanged(t),Object.assign(Object.assign({},n),{selectedColor:t})),setTool:t=>n=>(e.onToolChanged(t),Object.assign(Object.assign({},n),{selectedTool:t}))},(()=>i(s,null)),t)})({colors:this.colors,selectedColor:this.selectedColor,selectedTool:this.selectedTool,onColorChanged:this.setColor,onToolChanged:this.setTool,onClose:this.close},t),this.store.viewer.beginModule(Wt)}onSave(){return new Promise(((e,t)=>{e()}))}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.endModule(Wt)}render(e,t){if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==Wt)this.remove();else if(this.context)if(this.selectedTool===Gt.RECTANGULAR_HIGHLIGHT){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const n={x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels},i=this.pdfApi.transformScreenPointToPdfPoint(n);if(i.isOnPage?this.store.viewer.setCursorStyle(nt.CROSSHAIR):this.store.viewer.setCursorStyle(nt.NOT_ALLOWED),t.pointer.isDown){if(this.pointerDown||(this.screenStartPoint=n,this.pointerDown=!0,0===this.page&&i.isOnPage&&(this.page=i.pdfPoint.page)),this.screenStartPoint){const i=Ye(t.document,{x:this.screenStartPoint.x,y:this.screenStartPoint.y},{x:n.x,y:n.y},this.page);if(i){const t=2*devicePixelRatio;e.save(),e.strokeStyle=this.options.viewer.general.textSelectionColor,e.fillStyle=this.options.viewer.general.textSelectionColor,e.lineWidth=t,e.setLineDash([t,t]),e.strokeRect(i.x,i.y,i.w,i.h),e.globalAlpha=.33,e.fillRect(i.x,i.y,i.w,i.h),e.restore()}}}else if(this.pointerDown&&this.screenStartPoint){const e=Ye(t.document,{x:this.screenStartPoint.x,y:this.screenStartPoint.y},{x:n.x,y:n.y},this.page);e&&(this.createRectangularHighlightAnnotation(e),this.pointerDown=!1,this.screenStartPoint=null,this.page=0)}}else{let e=t.canvas.canvasInvalidated;if(t.pointer.positionChanged){const n={x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels},i=this.pdfApi.transformScreenPointToPdfPoint(n);let o=null;if(i.isOnPage?(o=this.pdfApi.getTextFragmentOnPoint(n),o?this.store.viewer.setCursorStyle(nt.TEXT):this.store.viewer.setCursorStyle(nt.DEFAULT)):this.store.viewer.setCursorStyle(nt.DEFAULT),t.pointer.stateChanged)if(t.pointer.isDown){if(i.isOnPage&&o){const t=i;this.selecting=!0,this.selection=null,this.pdfStartPoint=t.pdfPoint,e=!0}}else if(this.selecting){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height),this.createHighlightAnnotation(),this.selecting=!1}if(this.selecting&&this.pdfStartPoint&&this.pdfStartPoint!==i.pdfPoint){const e=this.pdfApi.getClosestPointOnPdfByScreenPoint(n);this.selection=this.pdfApi.getTextSelection(this.pdfStartPoint,e)}e=!0}if(e&&this.selection){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const n=[];for(let e=0;e<this.selection.quadrilaterals.length;e++){const t=this.pdfApi.transformQuadrilateralToViewport(this.selection.quadrilaterals[e]);n.push(t)}vt(e,(devicePixelRatio,t.document.zoom),this.options.viewer.general.textSelectionColor,n)}}}setColor(e){this.selectedColor=e,this.options.annotation.colors.highlightAnnotationColor=e}setTool(e){this.selectedTool=e}close(){this.remove()}getPdfItemTypeForTool(){switch(this.selectedTool){case Gt.HIGHLIGHT:case Gt.RECTANGULAR_HIGHLIGHT:return z.HIGHLIGHT;case Gt.UNDERLINE:return z.UNDERLINE;case Gt.SQUIGGLY:return z.SQUIGGLY;case Gt.STRIKE_OUT:return z.STRIKE_OUT;default:throw new Error("unknown Highlight tool")}}createRectangularHighlightAnnotation(e){const t=this.pdfApi.transformScreenRectToPdfRect(e,this.page),n=new Ot(this.selectedColor);n.setOpacity(this.options.annotation.highlightOpacity);const i=n.toRgba(),o=[];o.push({pageNumber:this.page,bottomLeft:{x:t.pdfX,y:t.pdfY},bottomRight:{x:t.pdfX+t.pdfW,y:t.pdfY},topLeft:{x:t.pdfX,y:t.pdfY+t.pdfH},topRight:{x:t.pdfX+t.pdfW,y:t.pdfY+t.pdfH}});const s={itemType:z.HIGHLIGHT,page:this.page,pdfRect:t,color:i,author:this.options.viewer.general.user,quadrilaterals:o};this.pdfApi.createItem(s).then((e=>{this.onAnnotationCreated(e)}))}createHighlightAnnotation(){if(this.pdfApi&&this.store){const e=this.getPdfItemTypeForTool(),t=this.selection;if(this.selection=null,t){const n=[];for(let e=0;e<t.quadrilaterals.length;e++){const i=t.quadrilaterals[e];n[i.pageNumber]||(n[i.pageNumber]=[]),n[i.pageNumber].push(i)}let i=this.selectedColor;if(e===z.HIGHLIGHT){const e=new Ot(i);e.setOpacity(this.options.annotation.highlightOpacity),i=e.toRgba()}for(let t=0;t<n.length;t++)if(n[t]){const o=n[t],s={itemType:e,page:t,pdfRect:{pdfX:0,pdfY:0,pdfW:0,pdfH:0,page:t},color:i,author:this.options.viewer.general.user,quadrilaterals:o};this.pdfApi.createItem(s).then((e=>{this.onAnnotationCreated(e)}))}}}}}const Ut="EditHighlightAnnotation";class Xt extends ut{constructor(){super(...arguments),this.highlightAnnotation=null,this.colors=[],this.selectedColor=""}onCreate(e){this.highlightAnnotation=this.pdfApi.getItem(e),this.setColor=this.setColor.bind(this),this.close=this.close.bind(this),this.context=this.createCanvas();const t=this.options.annotation;this.colors=t.colors.highlightColors,this.selectedColor=t.colors.highlightAnnotationColor;const n=this.module.toolbarElement;((e,t)=>{const n={colors:e.colors,selectedColor:e.selectedColor},s=({})=>(t,n)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(Mt,{colors:t.colors,color:t.selectedColor,icon:f.fillColor,mode:"buttons",onChange:n.setColor})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onClose})));o(n,{setColor:t=>n=>(e.onColorChanged(t),Object.assign(Object.assign({},n),{selectedColor:t}))},(()=>i(s,null)),t)})({colors:this.colors,selectedColor:this.selectedColor,onColorChanged:this.setColor,onClose:this.close},n),this.store.viewer.beginModule(Ut)}onSave(){return new Promise(((e,t)=>{e()}))}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.endModule(Ut)}render(e,t){var n;if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==Ut)this.close();else{if(("click"===t.pointer.action||"dblclick"===t.pointer.action)&&!(null===(n=this.pdfApi.getAnnotationsOnPoint({x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels}))||void 0===n?void 0:n.find((e=>this.highlightAnnotation&&e.id===this.highlightAnnotation.id))))return void this.close();if(this.context&&this.highlightAnnotation){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const t=this.pdfApi.transformPdfPageRectToScreenRect(this.highlightAnnotation.pdfRect),n=2*devicePixelRatio;e.save(),e.strokeStyle=this.options.viewer.general.textSelectionColor,e.lineWidth=n,e.setLineDash([n,n]),e.strokeRect(t.x-n,t.y-n,t.w+2*n,t.h+2*n),e.restore()}}}setColor(e){if(this.highlightAnnotation&&this.highlightAnnotation.color){const t=new Ot(e),n=new Ot(this.highlightAnnotation.color);t.setOpacity(n.a),this.highlightAnnotation.color=t.toRgba(),this.updateHighlightAnnotation()}}close(){this.remove()}updateHighlightAnnotation(){return new Promise(((e,t)=>{this.pdfApi&&this.highlightAnnotation?this.pdfApi.updateItem(this.highlightAnnotation).then((t=>{e()})).catch((e=>{console.warn(e)})):t()}))}}class Yt extends ht{constructor(){super(),this.toolbarElement=null,this.name=Yt.moduleInfo.name,this.activate=this.activate.bind(this)}onRegister(){return this.toolbarElement=document.createElement("div"),{toolbar:this.toolbarElement,contextbar:{itemTypes:[z.HIGHLIGHT,z.UNDERLINE,z.SQUIGGLY,z.STRIKE_OUT],icon:f.edit,tooltip:g.getText("annotHighlight.edit"),onCmd:e=>{this.onEdit(e)}}}}activate(){this.canvasLayers.add?this.removeCanvasLayer("add"):this.createCanvasLayer("add",_t)}onEdit(e){this.createCanvasLayer("edit",Xt,e)}}Yt.moduleInfo={name:"HighlightAnnotationModule",moduleType:dt.Tool,requiredFeatures:{annotate:!0,fillFormFields:!1},translationKey:"annotHighlight.add",icon:"highlighter"};const Kt=({min:e,max:t,value:n,icon:o,className:a,text:r,tooltip:l,label:d,disabled:h,onChange:c})=>h?i("div",Object.assign({},b.createTooltip(l),{class:s("pwv-RangeSlider","pwv-ToolbarItem","pwv-Dropdown","pwv-disabled",a)}),d||o&&i("span",{class:"pwv-Dropdown-label"},d,o&&i(v,{icon:o})),i("span",{class:"pwv-Dropdown-text"},r),i("span",{class:"pwv-Dropdown-caret"},i(v,{icon:f.dropdownCaret}))):i("div",{class:s("pwv-RangeSlider","pwv-commandbar-item","pwv-Dropdown",a)},i("button",Object.assign({},b.createTooltip(l),{oncreate:y.create,onremove:y.remove}),d||o&&i("span",{class:"pwv-Dropdown-label"},d,o&&i(v,{icon:o})),i("span",{class:"pwv-Dropdown-text"},r),i("span",{class:"pwv-Dropdown-caret"},i(v,{icon:f.dropdownCaret}))),i("div",{class:"pwv-DropdownPanel"},i("input",{type:"range",min:e,max:t,value:n,oninput:e=>{const t=e.currentTarget,n=parseInt(t.value,void 0);c(n)},onchange:e=>{e.preventDefault(),e.currentTarget,window.dispatchEvent(new Event("click"))}})));var Zt=function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function a(e){try{l(i.next(e))}catch(e){s(e)}}function r(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,r)}l((i=i.apply(e,t||[])).next())}))};const qt="AddInkAnnotation";class $t extends ut{constructor(){super(...arguments),this.context=null,this.drawing=!1,this.lines=[],this.page=null,this.zoom=null,this.inkWidth=1,this.penColors=[],this.penWidths=[],this.penColor="",this.penOpacity=1,this.boundingBox=null,this.toolbar=null,this.currentAnnotation=null,this.isUpdatingAnnotation=!1,this.pendingUpdate=!1,this.handlePointerMove=e=>{if(!e.isPrimary)return void this.handlePointerUp(e);const t=e.offsetX*devicePixelRatio,n=e.offsetY*devicePixelRatio,i=this.pdfApi.getClosestPointOnPdfByScreenPoint({x:t,y:n},this.page);if(this.lines[this.lines.length-1].push(i),this.context){const e=this.pdfApi.transformPdfPointToScreenPoint(i);this.context.lineTo(e.x,e.y),this.context.stroke()}},this.handlePointerUp=e=>{if(this.context){const{canvas:e}=this.context;e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerup",this.handlePointerUp),e.removeEventListener("pointercancel",this.handlePointerUp)}this.endLine()}}onCreate(){this.setPenColor=this.setPenColor.bind(this),this.setPenSize=this.setPenSize.bind(this),this.setPenOpacity=this.setPenOpacity.bind(this),this.add=this.add.bind(this),this.undo=this.undo.bind(this),this.save=this.save.bind(this);const e=this.options.annotation;this.context=this.createCanvas(),this.penColors=e.colors.foregroundColors,this.penWidths=e.strokeWidths,this.inkWidth=e.inkWidth,this.setPenColor(e.colors.inkColor),this.setPenOpacity(e.colors.inkOpacity),this.currentAnnotation=null,this.store.viewer.beginModule(qt);const t=this.module.toolbarElement;this.toolbar=((e,t)=>{const n={penColors:e.penColors,penWidths:e.penWidths,selectedPenColor:e.selectedPenColor,selectedPenSize:e.selectedPenSize,penOpacity:e.penOpacity,lineCount:0},s=({})=>(t,n)=>{const o=t.penWidths.filter((e=>e>0));return i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(Mt,{colors:t.penColors,color:t.selectedPenColor,icon:f.fillColor,allowRgba:!1,mode:"buttons",onChange:n.setPenColor})),i(m,null,i(Kt,{tooltip:g.getText("annotFreeDrawing.opacity"),min:10,max:100,step:1,value:t.penOpacity,text:`${t.penOpacity}%`,icon:f.drop,onChange:n.setPenOpacity,className:"pwv-opacityslider"}),i(kt,{tooltip:g.getText("annotFreeDrawing.strokeWidth"),noneStrokeText:"",strokeWidths:o,value:t.selectedPenSize,onChange:n.setPenSize})),i(m,null,i(c,null),i(S,{tooltip:g.getText("annotFreeDrawing.undo"),icon:f.eraser,onClick:e.onUndo,disabled:t.lineCount<1}),i(S,{tooltip:g.getText("annotFreeDrawing.addNew"),icon:f.addLayer,onClick:e.onAdd,disabled:t.lineCount<1})),i(m,{pushRight:!0},i(c,null),t.lineCount<1?i(S,{icon:f.close,onClick:e.onCancel}):i(S,{icon:f.ok,onClick:e.onSave})))};return o(n,{setPenColor:t=>n=>(e.onPenColorChanged(t),Object.assign(Object.assign({},n),{selectedPenColor:t})),setPenSize:t=>n=>(e.onPenSizeChanged(t),Object.assign(Object.assign({},n),{selectedPenSize:t})),setPenOpacity:t=>n=>(e.onPenOpacityChanged(t),Object.assign(Object.assign({},n),{penOpacity:t})),setLineCount:e=>t=>Object.assign(Object.assign({},t),{lineCount:e})},(()=>i(s,null)),t)})({penColors:this.penColors,penWidths:this.penWidths,selectedPenColor:e.colors.inkColor,selectedPenSize:e.inkWidth,penOpacity:e.colors.inkOpacity,onPenColorChanged:this.setPenColor,onPenSizeChanged:this.setPenSize,onPenOpacityChanged:this.setPenOpacity,onSave:this.save,onUndo:this.undo,onAdd:this.add,onCancel:this.remove},t)}onSave(){return new Promise((e=>{this.remove(),e()}))}onRemove(){this.reset(),this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.endModule(qt)}render(e,t){if(this.drawing)return;if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==qt)return void this.remove();(null===this.zoom||t.document.zoomChanged)&&(this.zoom=t.document.zoom,this.drawLines()),(t.scroll.leftPositionChanged||t.scroll.topPositionChanged)&&this.drawLines();const n={x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels},i=this.pdfApi.transformScreenPointToPdfPoint(n);if(t.pointer.stateChanged&&t.pointer.isDown){const e=i.isOnPage?i.pdfPoint.page:null;if(null===this.page&&e&&(this.page=e),"number"==typeof this.page&&this.page===e){const e=this.pdfApi.getClosestPointOnPdfByScreenPoint(n,this.page);e&&this.startLine(n,e)}}t.pointer.positionChanged&&(!i.isOnPage||null!==this.page&&i.pdfPoint.page!==this.page?this.store.viewer.setCursorStyle(nt.NOT_ALLOWED):this.store.viewer.setCursorStyle(nt.CROSSHAIR))}startLine(e,t){var n;if(this.lines.push([t]),this.pdfViewerCanvas.suspendCanvasEvents(),this.drawing=!0,this.context){const{canvas:t}=this.context;t.addEventListener("pointermove",this.handlePointerMove),t.addEventListener("pointerup",this.handlePointerUp),t.addEventListener("pointercancel",this.handlePointerUp),this.drawLines();const i=this.context;i.save(),i.strokeStyle=this.penColor,i.lineWidth=this.inkWidth*devicePixelRatio*(null!==(n=this.zoom)&&void 0!==n?n:1),i.lineCap="round",i.lineJoin="round",i.moveTo(e.x,e.y)}}endLine(){var e,t;return Zt(this,void 0,void 0,(function*(){this.drawing=!1,this.pdfViewerCanvas.resumeCanvasEvents(),null===(e=this.context)||void 0===e||e.restore(),this.drawBoundingBox(),null===(t=this.toolbar)||void 0===t||t.setLineCount(this.lines.length);try{yield this.debouncedRecreateInkAnnotation()}catch(e){console.warn(e)}}))}drawLines(){if(this.context){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height),this.options.annotation,e.save(),e.strokeStyle=this.penColor,e.lineWidth=this.inkWidth*devicePixelRatio*this.zoom,e.lineCap="round",e.lineJoin="round",this.lines.forEach((t=>{e.beginPath();const n=this.pdfApi.transformPdfPointToScreenPoint(t[0]);e.moveTo(n.x,n.y);for(let n=0;n<t.length;n++){const i=this.pdfApi.transformPdfPointToScreenPoint(t[n]);e.lineTo(i.x,i.y)}e.stroke()})),e.restore()}}drawBoundingBox(){if(this.context&&this.lines&&this.lines.length>0){const e={pdfX:0,pdfY:0,pdfW:0,pdfH:0,page:this.page?this.page:0};let t=1e9,n=0,i=1e9,o=0;this.lines.forEach((e=>{for(let s=0;s<e.length;s++){const a=e[s];a.pdfX<t&&(t=a.pdfX),a.pdfX>n&&(n=a.pdfX),a.pdfY<i&&(i=a.pdfY),a.pdfY>o&&(o=a.pdfY)}})),e.pdfX=t,e.pdfY=i,e.pdfW=n-t,e.pdfH=o-i;const s=this.pdfApi.transformPdfPageRectToScreenRect(e),a=this.context;a.save(),a.strokeStyle=this.options.viewer.general.textSelectionColor,a.lineWidth=1*devicePixelRatio,a.setLineDash([2*devicePixelRatio,3*devicePixelRatio]);const r=this.inkWidth*devicePixelRatio,l=2*r;a.strokeRect(s.x-r,s.y-r,s.w+l,s.h+l),a.restore()}}setPenColor(e){return Zt(this,void 0,void 0,(function*(){this.options.annotation.colors.inkColor=e,this.penColor=e,this.drawLines(),this.drawBoundingBox(),this.lines.length>0&&(yield this.debouncedRecreateInkAnnotation())}))}setPenOpacity(e){return Zt(this,void 0,void 0,(function*(){this.options.annotation.colors.inkOpacity=e,this.penOpacity=e,this.context&&(this.context.canvas.style.opacity=""+e/100),this.drawLines(),this.drawBoundingBox(),this.lines.length>0&&(yield this.debouncedRecreateInkAnnotation())}))}setPenSize(e){return Zt(this,void 0,void 0,(function*(){this.inkWidth=e,this.options.annotation.inkWidth=e,this.drawLines(),this.drawBoundingBox(),this.lines.length>0&&(yield this.debouncedRecreateInkAnnotation())}))}debouncedRecreateInkAnnotation(){return Zt(this,void 0,void 0,(function*(){if(this.isUpdatingAnnotation)this.pendingUpdate=!0;else{this.isUpdatingAnnotation=!0,this.pendingUpdate=!1;try{yield this.recreateInkAnnotation(),this.pendingUpdate&&(this.pendingUpdate=!1,yield this.recreateInkAnnotation())}catch(e){console.warn(e)}finally{this.isUpdatingAnnotation=!1}}}))}reset(){this.lines=[],this.page=null,this.currentAnnotation=null,this.boundingBox=null,this.isUpdatingAnnotation=!1,this.pendingUpdate=!1,this.toolbar&&this.toolbar.setLineCount(0)}save(){this.reset(),this.remove()}add(){this.reset(),this.drawLines()}undo(){return Zt(this,void 0,void 0,(function*(){if(this.lines&&this.lines.length>0){if(this.lines.pop(),0===this.lines.length){if(this.currentAnnotation)try{yield this.pdfApi.deleteItem(this.currentAnnotation),this.currentAnnotation=null}catch(e){console.warn(e)}this.page=null,this.boundingBox=null}else{this.boundingBox=this.getBoundingBox();try{yield this.recreateInkAnnotation()}catch(e){console.warn(e)}}this.toolbar&&this.toolbar.setLineCount(this.lines.length),this.store.canvas.setCanvasInvalidated(!0),this.drawLines(),this.drawBoundingBox()}}))}recreateInkAnnotation(){return new Promise(((e,t)=>{if(this.pdfApi&&this.page&&this.lines&&this.lines.length>0){const n=this.currentAnnotation;this.createNewInkAnnotation().then((()=>{n?this.pdfApi.deleteItem(n).then((()=>{e()})).catch((t=>{e()})):e()})).catch(t)}else e()}))}createNewInkAnnotation(){return new Promise(((e,t)=>{if(this.pdfApi&&this.page&&this.lines&&this.lines.length>0){const n=[];let i=1e9,o=0,s=1e9,a=0;this.lines.forEach((e=>{const t=[];for(let n=0;n<e.length;n++){const r=e[n];r.pdfX<i&&(i=r.pdfX),r.pdfX>o&&(o=r.pdfX),r.pdfY<s&&(s=r.pdfY),r.pdfY>a&&(a=r.pdfY),t.push(r.pdfX),t.push(r.pdfY)}n.push(t)}));const r=new Ot(this.options.annotation.colors.inkColor);r.setOpacity(this.options.annotation.colors.inkOpacity/100);const l={itemType:z.INK,page:this.page,pdfRect:{pdfX:i,pdfY:s,pdfW:o-i,pdfH:a-s,page:this.page},color:r.toRgba(),author:this.options.viewer.general.user,border:{style:F.SOLID,width:this.options.annotation.inkWidth},inkList:n};this.pdfApi.createItem(l).then((t=>{this.currentAnnotation=t,this.onAnnotationCreated(this.currentAnnotation),e()})).catch((e=>{console.warn(e),t(e)}))}else e()}))}getBoundingBox(){const e={pdfX:0,pdfY:0,pdfW:0,pdfH:0,page:this.page?this.page:0};if(this.lines&&this.lines.length>0){let t=1e9,n=0,i=1e9,o=0;this.lines.forEach((e=>{for(let s=0;s<e.length;s++){const a=e[s];a.pdfX<t&&(t=a.pdfX),a.pdfX>n&&(n=a.pdfX),a.pdfY<i&&(i=a.pdfY),a.pdfY>o&&(o=a.pdfY)}})),e.pdfX=t,e.pdfY=i,e.pdfW=n-t,e.pdfH=o-i}return e}}const Qt="EditInkAnnotation";class Jt extends ut{constructor(){super(...arguments),this.inkAnnotation=null,this.context=null,this.penColors=[],this.penWidths=[],this.toolbar=null,this.updatePending=!1,this.unsavedChanges=!1}onCreate(e){var t;this.inkAnnotation=this.pdfApi.getItem(e),this.setPenColor=this.setPenColor.bind(this),this.setPenSize=this.setPenSize.bind(this),this.setPenOpacity=this.setPenOpacity.bind(this),this.close=this.close.bind(this);const n=this.options.annotation;this.penColors=n.colors.foregroundColors,this.penWidths=n.strokeWidths,this.context=this.createCanvas();const s=new Ot(this.inkAnnotation.color||n.colors.inkColor),a=(null===(t=this.inkAnnotation)||void 0===t?void 0:t.border.width)||n.inkWidth,r=this.module.toolbarElement;this.toolbar=((e,t)=>{const n={penColors:e.penColors,penWidths:e.penWidths,selectedPenColor:e.selectedPenColor,selectedPenSize:e.selectedPenSize,penOpacity:e.penOpacity},s=({})=>(t,n)=>{const o=t.penWidths.filter((e=>e>0));return i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(Mt,{colors:t.penColors,color:t.selectedPenColor,icon:f.fillColor,allowRgba:!1,mode:"buttons",onChange:n.setPenColor})),i(m,null,i(Kt,{tooltip:g.getText("annotFreeDrawing.opacity"),min:10,max:100,step:1,value:t.penOpacity,text:`${Math.round(t.penOpacity)}%`,icon:f.drop,onChange:n.setPenOpacity,className:"pwv-opacityslider"}),i(kt,{tooltip:g.getText("annotFreeDrawing.strokeWidth"),noneStrokeText:"",strokeWidths:o,value:t.selectedPenSize,onChange:n.setPenSize})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onCancel})))};return o(n,{setPenColor:t=>n=>(e.onPenColorChanged(t),Object.assign(Object.assign({},n),{selectedPenColor:t})),setPenSize:t=>n=>(e.onPenSizeChanged(t),Object.assign(Object.assign({},n),{selectedPenSize:t})),setPenOpacity:t=>n=>(e.onPenOpacityChanged(t),Object.assign(Object.assign({},n),{penOpacity:t}))},(()=>i(s,null)),t)})({penColors:this.penColors,penWidths:this.penWidths,selectedPenColor:s.toHexRgb(),selectedPenSize:a,penOpacity:100*s.a,onPenColorChanged:this.setPenColor,onPenSizeChanged:this.setPenSize,onPenOpacityChanged:this.setPenOpacity,onCancel:this.remove},r),this.store.viewer.beginModule(Qt)}onSave(){return new Promise((e=>e))}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.endModule(Qt)}render(e,t){var n;if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==Qt)this.remove();else{if(("click"===t.pointer.action||"dblclick"===t.pointer.action)&&!(null===(n=this.pdfApi.getAnnotationsOnPoint({x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels}))||void 0===n?void 0:n.find((e=>this.inkAnnotation&&e.id===this.inkAnnotation.id))))return void this.close();if(this.context&&this.inkAnnotation){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const t=this.pdfApi.transformPdfPageRectToScreenRect(this.inkAnnotation.pdfRect),n=2*devicePixelRatio;e.save(),e.strokeStyle=this.options.viewer.general.textSelectionColor,e.lineWidth=n,e.setLineDash([n,n]),e.strokeRect(t.x-n,t.y-n,t.w+2*n,t.h+2*n),e.restore()}}}close(){this.remove()}setPenColor(e){if(this.inkAnnotation&&this.inkAnnotation.color){const t=new Ot(e),n=new Ot(this.inkAnnotation.color);t.setOpacity(n.a),this.inkAnnotation.color=t.toHexRgba(),this.updateInkAnnotation()}}setPenSize(e){this.inkAnnotation&&(this.inkAnnotation.border={style:F.SOLID,width:e},this.updateInkAnnotation())}setPenOpacity(e){if(this.inkAnnotation&&this.inkAnnotation.color){const t=new Ot(this.inkAnnotation.color);t.setOpacity(e/100),this.inkAnnotation.color=t.toHexRgba(),this.updateInkAnnotation()}}updateInkAnnotation(){this.pdfApi&&this.inkAnnotation&&(this.updatePending?this.unsavedChanges=!0:(this.updatePending=!0,this.pdfApi.updateItem(this.inkAnnotation).then((e=>{this.updatePending=!1,this.unsavedChanges&&(this.unsavedChanges=!1,this.updateInkAnnotation())})).catch((e=>{console.warn(e)}))))}}class en extends ht{constructor(){super(),this.toolbarElement=null,this.name=en.moduleInfo.name,this.activate=this.activate.bind(this),this.onEdit=this.onEdit.bind(this)}onRegister(){return this.toolbarElement=document.createElement("div"),{toolbar:this.toolbarElement,contextbar:{itemTypes:[z.INK],icon:f.edit,tooltip:g.getText("annotInk.edit"),onCmd:e=>{this.onEdit(e)}}}}activate(){this.canvasLayers.add?this.removeCanvasLayer("add"):this.createCanvasLayer("add",$t)}onEdit(e){this.createCanvasLayer("edit",Jt,e)}}en.moduleInfo={name:"InkAnnotationModule",moduleType:dt.Tool,requiredFeatures:{annotate:!0,fillFormFields:!1},translationKey:"annotFreeDrawing.add",icon:"pencil"};const tn=({popup:e,colorPalette:t,hideSubject:n,allowLockAnnotations:o,allowEditLockedAnnotations:a,updateColor:r,close:l,select:d,remove:c,toggleLock:u,updatePosition:p,updateSize:v})=>(w,b)=>{const P={backgroundColor:e.color,width:e.cssWidth<w.minPopupWidth?w.minPopupWidth+"px":e.cssWidth+"px",height:e.cssHeight<w.minPopupHeight?w.minPopupHeight+"px":e.cssHeight+"px"};let y;if(null!=e.color){const t=new Ot(e.color);P.backgroundColor=t.toRgb(),y=t.isDark()?"rgba(255, 255, 255, 0.9)":"rgba(0, 0, 0, 0.9)"}const C={color:y};e.positionCalculated||(P.display="none");const A=e.isReadOnly();return i("div",{class:s("pwv-popup",{"pwv-popup-view-only":A,"pwv-popup-selected":e.selected}),key:e.id,style:P,"data-id":e.id},i("div",{onclick:t=>{t.openDropdown||window.dispatchEvent(new Event("click",t)),e.selected||d(e.id)},onchange:e=>{b.stateChanged(!0)}},i("div",{class:"pwv-popup-header"},i("div",{class:"pwv-popup-header-info",style:C},i("div",{class:"pwv-popup-header-author"},e.author),i("div",{class:"pwv-popup-header-modified"},e.modificationDate)),A?i(h,null,i(m,{pushRight:!0},i(S,{onClick:t=>{t.stopPropagation(),e.selected||d(e.id),l()},icon:f.close}))):i(h,null,i(m,null,i(S,{tooltip:g.getText("annotPopup.delete"),icon:f.delete,onClick:()=>{c(e.id)},disabled:e.isLocked&&!a}),o&&i(S,{tooltip:g.getText(e.isLocked?"annotPopup.unlock":"annotPopup.lock"),onClick:t=>{t.stopPropagation(),e.selected||d(e.id),u(e.id)},icon:e.isLocked?f.lock:f.unlock}),e.itemType!==z.STAMP&&i(Mt,{tooltip:g.getText("annotPopup.color"),colors:t,icon:f.fillColor,color:e.color||"transparent",onChange:t=>{r({id:e.id,color:t})},disabled:e.isLocked&&!a})),i(m,{pushRight:!0},i(S,{onClick:t=>{t.stopPropagation(),e.selected||d(e.id),e.isLocked&&!a||b.updateSubjectAndContent(e.id),l()},icon:f.close})))),A?i("div",{class:"pwv-popup-view-only-content"},!n&&e.subject&&i("h4",null,e.subject),i("div",null,e.content)):i("div",null,n?i("input",{id:"pwv-popup-subject-"+e.id,type:"hidden",value:w.selectedPopup===e.id&&w.activeSubject?w.activeSubject:e.subject}):i("div",{class:"pwv-popup-subject"},!e.isLocked||a?i("input",{id:"pwv-popup-subject-"+e.id,placeholder:g.getText("annotPopup.subjectPlaceholder"),onchange:()=>{b.updateSubjectAndContent(e.id)},value:w.selectedPopup===e.id&&w.activeSubject?w.activeSubject:e.subject}):i("div",{id:"pwv-popup-subject-"+e.id},e.subject)),i("div",{class:s("pwv-popup-content",{"pwv-popup-content-no-subject":n})},!e.isLocked||a?i("textarea",{placeholder:g.getText("annotPopup.contentPlaceholder"),id:"pwv-popup-content-"+e.id,onchange:()=>{b.updateSubjectAndContent(e.id)},oninput:()=>{b.updateSubjectAndContent(e.id)}},w.selectedPopup===e.id&&w.activeContent?w.activeContent:e.content):i("div",{id:"pwv-popup-content-"+e.id},e.content)))),i("div",null,i("div",{class:"pwv-popup-draghandle"}),i("div",{class:"pwv-popup-resizer",oncreate:t=>{nn.create(e.id,t,w.minPopupWidth,w.minPopupHeight,w.maxPopupWidth,w.maxPopupHeight,p,v,d)},onremove:(e,t)=>{nn.remove(e),t()}})))};class nn{constructor(e,t,n,i,o,s,a,r,l){this.cancelContentEvents=!0,this.dragOffsetX=0,this.dragOffsetY=0,this.containerOffsetX=0,this.containerOffsetY=0,this.id=e,this.resizeHandle=t;const d=t.parentElement;this.dragHandle=d.children.item(0),this.element=d.parentElement,this.minPopupWidth=260,this.minPopupHeight=200,this.maxPopupWidth=o>this.minPopupWidth?o:this.minPopupWidth,this.maxPopupHeight=s>this.minPopupHeight?s:this.minPopupHeight,this.updatePosition=a,this.updateSize=r,this.select=l,this.cancelEvent=this.cancelEvent.bind(this),this.startMove=this.startMove.bind(this),this.moving=this.moving.bind(this),this.endMove=this.endMove.bind(this),this.onSelect=this.onSelect.bind(this),this.startResize=this.startResize.bind(this),this.resizing=this.resizing.bind(this),this.endResize=this.endResize.bind(this),this.handleMouseWheel=this.handleMouseWheel.bind(this),new Pt(this.dragHandle,this.startMove,this.moving,this.endMove,this.onSelect),new Pt(this.resizeHandle,this.startResize,this.resizing,this.endResize),this.element.addEventListener("mousewheel",this.handleMouseWheel,{passive:!0});const h=this.element.firstChild;h.addEventListener("onclick",this.cancelEvent,!1),h.addEventListener("keydown",this.cancelEvent,!1),h.addEventListener("mousedown",this.cancelEvent,!1),h.addEventListener("mousemove",this.cancelEvent,!1),h.addEventListener("mouseup",this.cancelEvent,!1),h.addEventListener("touchstart",this.cancelEvent,{passive:!0}),h.addEventListener("touchmove",this.cancelEvent,{passive:!0}),h.addEventListener("touchend",this.cancelEvent,{passive:!0})}static create(e,t,n,i,o,s,a,r,l){t.parentElement.popup=new nn(e,t,n,i,o,s,a,r,l)}static remove(e){e.parentElement.popup.unmount()(e.parentElement).popup=null}unmount(){this.element.removeEventListener("mousewheel",this.handleMouseWheel)}cancelEvent(e){this.cancelContentEvents&&("mousemove"===e.type&&0===e.buttons||(e.cancelBubble=!0,e.stopPropagation()))}onSelect(){this.select(this.id)}startResize(e){this.cancelContentEvents=!1,this.element.classList.add("pwv-popup-resizing"),this.onSelect()}resizing(e){const t=this.element.getBoundingClientRect();let n=e.clientX-t.left,i=e.clientY-t.top;n=n<this.minPopupWidth?this.minPopupWidth:n>this.maxPopupWidth?this.maxPopupWidth:n,i=i<this.minPopupHeight?this.minPopupHeight:i>this.maxPopupHeight?this.maxPopupHeight:i,this.element.style.width=n+"px",this.element.style.height=i+"px";const o={x:parseInt(this.element.style.left,void 0),y:parseInt(this.element.style.top,void 0),w:n,h:i},s={annotationId:this.id,popupRect:o,color:this.element.style.backgroundColor};window.dispatchEvent(new CustomEvent("pdfwebviewer.PopupMoved",{detail:s}))}endResize(e){e.moved&&this.updateSize({id:this.id,w:this.element.clientWidth,h:this.element.clientHeight}),this.cancelContentEvents=!0,this.element.classList.remove("pwv-popup-resizing")}startMove(e){const t=this.element.getBoundingClientRect(),n=this.element.offsetParent.getBoundingClientRect();this.dragOffsetX=e.clientX-t.left,this.dragOffsetY=e.clientY-t.top,this.containerOffsetX=n.left,this.containerOffsetY=n.top,this.cancelContentEvents=!1,this.element.classList.add("pwv-popup-moving"),this.onSelect()}moving(e){const t={x:e.clientX-this.containerOffsetX-this.dragOffsetX,y:e.clientY-this.containerOffsetY-this.dragOffsetY,w:parseInt(this.element.style.width,void 0),h:parseInt(this.element.style.height,void 0)};this.element.style.top=t.y+"px",this.element.style.left=t.x+"px";const n={annotationId:this.id,popupRect:t,color:this.element.style.backgroundColor};window.dispatchEvent(new CustomEvent("pdfwebviewer.PopupMoved",{detail:n}))}endMove(e){e.moved&&this.updatePosition({id:this.id,x:this.element.offsetLeft,y:this.element.offsetTop}),this.cancelContentEvents=!0,this.element.classList.remove("pwv-popup-moving")}handleMouseWheel(e){this.element.classList.contains("pwv-popup-selected")&&e.stopPropagation()}}class on extends ut{constructor(){super(...arguments),this.popupView=null,this.context=null,this.maxPopupWidth=window.screen.availWidth<570?280:480,this.maxPopupHeight=320,this.minPopupWidth=260,this.minPopupHeight=200,this.zoom=0,this.screenToPdfScale=0}onCreate(){this.drawPopupRelation=this.drawPopupRelation.bind(this),this.popupMoved=this.popupMoved.bind(this),this.selectPopup=this.selectPopup.bind(this),this.deselectPopup=this.deselectPopup.bind(this),this.openPopup=this.openPopup.bind(this),this.closePopup=this.closePopup.bind(this),this.deletePopup=this.deletePopup.bind(this),this.toggleAnnotationLock=this.toggleAnnotationLock.bind(this),this.updateSelectedPopupContent=this.updateSelectedPopupContent.bind(this),this.updatePopupPosition=this.updatePopupPosition.bind(this),this.updatePopupSize=this.updatePopupSize.bind(this),this.updatePopupColor=this.updatePopupColor.bind(this),this.context=this.createCanvas(),this.createPopupView(),window.addEventListener("pdfwebviewer.PopupMoved",this.popupMoved,!1)}onRemove(){}onSave(){return new Promise(((e,t)=>{this.popupView&&(this.popupView.getState().stateChanged?this.updateSelectedPopupContent(!0).then((()=>{e()})):e())}))}render(e,t){if(this.pdfApi&&this.popupView&&this.popupViewElement){if(t.document.zoomChanged&&t.document.zoom!==this.zoom&&(this.zoom=t.document.zoom,this.screenToPdfScale=this.pdfApi.transformPdfLengthToScreenLength(100)/100/this.zoom),(t.annotations.openPopupChanged||t.document.firstVisiblePageChanged||t.document.lastVisiblePageChanged||t.viewer.modeChanged)&&this.updateOpenPopupList(t),t.viewer.popupFocus&&this.popupView.setFocus(t.viewer.popupFocus),this.popupView.getState().clearFocus&&this.store.viewer.clearPopupFocus(),t.viewer.selectedPopupChanged){const e=this.popupView.getState().selectedPopup;t.viewer.selectedPopupId&&e!==t.viewer.selectedPopupId&&this.popupView.selectPopup(t.viewer.selectedPopupId)}const e=t.viewer.mode;e===tt.POPUP_SELECTED&&this.store.viewer.setCursorStyle(nt.DEFAULT);const{openPopups:n,selectedPopup:i}=this.popupView.getState(),o=e===tt.DEFAULT||e===tt.POPUP_SELECTED;if(t.viewer.modeChanged)if(o)this.popupViewElement.style.display="block";else{this.popupViewElement.style.display="none";const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height),i&&"click"!==t.pointer.action&&this.updateSelectedPopupContent(!0)}e===tt.POPUP_SELECTED&&"click"===t.pointer.action&&this.deselectPopup();const s=t.canvas.canvasInvalidated||n.find((e=>!e.positionCalculated));if(n.length>0&&s){const e=this.popupViewElement.querySelectorAll(".pwv-popup"),i=t.canvas.width.cssPixels,o=t.canvas.height.cssPixels;t.document.zoom;for(let t=0;t<e.length;t++){const s=e[t];if(!s.classList.contains("pwv-popup-moving")){const e=s.dataset.id,t=n.find((t=>t.id.toString()===e));if(t){const e=this.pdfApi.transformPdfPageRectToScreenRect(t.pdfRect);let n=e.x/devicePixelRatio,a=e.y/devicePixelRatio;const r=parseInt(s.style.width,void 0),l=parseInt(s.style.height,void 0),d=8;n<d?n=d:n+r+2*d>i&&(n=i-(r+2*d)),a<d?a=d:a+l+2*d>o&&(a=o-(l+2*d)),s.style.top=`${a}px`,s.style.left=`${n}px`,t.positionCalculated||this.popupView.setPositionCalculated(t.id)}}}}if((t.viewer.mode===tt.POPUP_SELECTED||t.viewer.mode===tt.DEFAULT)&&(t.viewer.selectedPopupChanged||t.canvas.canvasInvalidated||t.pointer.positionChanged||t.annotations.openPopupChanged)){const i=this.context;i.clearRect(0,0,i.canvas.width,i.canvas.height);const o=t.canvas.pixelRatio*t.document.zoom;if(e!==tt.POPUP_SELECTED){const e=((e,t,n)=>{let i=[];for(let o=t;o<=n;o++)e.popupsByPage[o]&&(i=i.concat(e.popupsByPage[o].map((t=>e.all[t]))).filter((e=>!e.isHidden())));return i})(t.annotations,t.document.firstVisiblePage,t.document.lastVisiblePage);if(null===e)return;for(let n=0;n<e.length;n++){const s=e[n];if(s.itemType!==z.TEXT){let e;e=this.pdfApi.transformPdfPageRectToScreenRect(s.pdfRect),i.lineWidth=1,i.beginPath();const n=12*o,a=e.x+n/2,r=e.y-n;i.arc(a,r,n,0,2*Math.PI),i.isPointInPath(t.pointer.x.devicePixels,t.pointer.y.devicePixels)&&(this.store.viewer.setCursorStyle(nt.POINTER),i.globalAlpha=.15,i.fillStyle=this.options.viewer.general.textSelectionColor,i.fill(),i.globalAlpha=1,"click"===t.pointer.action&&this.openPopup(s.id)),wt(i,o,s.color||this.options.annotation.colors.defaultHighlightColor,{x:a,y:r})}}}if(n.length>0){const e=this.popupViewElement.querySelectorAll(".pwv-popup:hover, .pwv-popup.pwv-popup-selected");for(let n=0;n<e.length;n++){const o=e[n],s=o.dataset.id?parseInt(o.dataset.id,void 0):-1;this.drawPopupRelation(i,s,{x:o.offsetLeft,y:o.offsetTop,w:o.offsetWidth,h:o.offsetHeight},o.style.backgroundColor,s===t.viewer.selectedPopupId)}}}}}updateOpenPopupList(e){if(this.popupView){const t=((e,t,n)=>{let i=[];for(let o=t;o<=n;o++)e.openPopupsByPage[o]&&(i=i.concat(e.openPopupsByPage[o].map((t=>e.all[t]))));return i})(e.annotations,e.document.firstVisiblePage,e.document.lastVisiblePage),n=e.document.zoom,i=t.map((e=>{const t=this.pdfApi.transformPdfLengthToScreenLength(e.popup.pdfRect.pdfW)/n,i=this.pdfApi.transformPdfLengthToScreenLength(e.popup.pdfRect.pdfH)/n;return{id:e.id,colorPalette:(o=e.itemType,s=this.options,o===z.INK?s.annotation.colors.foregroundColors:s.annotation.colors.highlightColors),content:e.content,subject:e.subject?e.subject:null,modificationDate:e.modificationDate,author:e.author,color:e.color,itemType:e.itemType,isLocked:e.isLocked(),selected:!1,positionCalculated:!1,pdfRect:e.popup.pdfRect,cssWidth:t<this.maxPopupWidth?t:this.maxPopupWidth,cssHeight:i<this.maxPopupHeight?i:this.maxPopupHeight,behaviors:e.behaviors,isReadOnly:e.isReadOnly};var o,s}));this.popupView.updateOpenPopups(i)}}drawPopupRelation(e,t,n,i,o){const s=this.pdfApi.getItem(t);if(s){const t=this.pdfApi.transformPdfPageRectToScreenRect(s.pdfRect),a=n.x*devicePixelRatio,r=a+n.w*devicePixelRatio,l=a+n.w/2*devicePixelRatio,d=n.y*devicePixelRatio,h=d+n.h*devicePixelRatio,c=d+n.h/2*devicePixelRatio,u=t.x,p=u+t.w,g=t.y,m=g+t.h;let f=a,v=d,w=u,b=g;if(r<=u&&(f=r,w=u),a>=p&&(f=a,w=p),h<=g&&(v=h,b=g),d>=m&&(v=d,b=m),r>=u&&a<=p){const e=l<u?u:l>p?p:l;f=e,w=e}if(h>=g&&d<=m){const e=c<g?g:c>m?m:c;v=e,b=e}if(e.save(),0!==f||0!==v){if(i){const t=new Ot(i);t.darken(20),o||t.setOpacity(.8),e.strokeStyle=t.toRgba(),e.fillStyle=t.toRgba()}e.lineWidth=2*window.devicePixelRatio,o||e.setLineDash([e.lineWidth]),e.beginPath(),e.moveTo(w,b),e.lineTo(f,v),e.stroke(),e.strokeRect(u,g,t.w,t.h),e.restore()}}e.restore()}popupMoved(e){null!==this.context&&e.detail&&(this.context.clearRect(0,0,this.context.canvas.width,this.context.canvas.height),this.drawPopupRelation(this.context,e.detail.annotationId,e.detail.popupRect,e.detail.color,!0))}createPopupView(){this.containerElement&&(this.popupViewElement=this.createHtmlLayer(),this.popupView=((e,t)=>{const n={selectedPopup:null,openPopups:[],maxPopupWidth:e.maxPopupWidth,maxPopupHeight:e.maxPopupHeight,minPopupWidth:260,minPopupHeight:200,currentUser:e.currentUser,hideSubject:e.hideSubject,activeContent:null,activeSubject:null,stateChanged:!1,clearFocus:!1},s=({})=>(t,n)=>i("div",null,t.openPopups.map((n=>i(tn,{popup:Object.assign(Object.assign({},n),{selected:n.id===t.selectedPopup}),colorPalette:n.colorPalette,hideSubject:e.hideSubject,allowLockAnnotations:e.allowLockAnnotations,allowEditLockedAnnotations:e.allowEditLockedAnnotations,close:e.onClose,remove:e.onDelete,select:e.onSelect,toggleLock:e.onLock,updatePosition:t=>{e.onUpdatePosition(t.id,t.x,t.y)},updateSize:t=>{e.onUpdateSize(t.id,t.w,t.h)},updateColor:t=>{e.onUpdateColor(t.id,t.color)}}))));return o(n,{getState:()=>e=>e,updateOpenPopups:e=>t=>(e.forEach((e=>{const n=t.openPopups.find((t=>t.id===e.id));n&&(e.selected=n.selected,e.positionCalculated=n.positionCalculated)})),Object.assign(Object.assign({},t),{openPopups:e})),stateChanged:e=>t=>Object.assign(Object.assign({},t),{stateChanged:e}),setPositionCalculated:e=>t=>{const n=t.openPopups.find((t=>t.id===e));return n&&(n.positionCalculated=!0),Object.assign({},t)},selectPopup:e=>t=>{const n=t.openPopups.map((t=>Object.assign(Object.assign({},t),{selected:t.id===e})));return Object.assign(Object.assign({},t),{openPopups:n,activeContent:e===t.selectedPopup?t.activeContent:null,activeSubject:e===t.selectedPopup?t.activeSubject:null,selectedPopup:e})},updateSubjectAndContent:e=>t=>{const n=document.getElementById("pwv-popup-subject-"+e).value,i=document.getElementById("pwv-popup-content-"+e).value;return Object.assign(Object.assign({},t),{activeContent:i,activeSubject:n})},setFocus:e=>t=>{const n=document.getElementById("pwv-popup-content-"+e);return n&&n.focus(),Object.assign(Object.assign({},t),{clearFocus:document.activeElement===n})},deselectPopup:()=>e=>Object.assign(Object.assign({},e),{selectedPopup:null})},(()=>i(s,null)),t)})({maxPopupWidth:this.maxPopupWidth,maxPopupHeight:this.maxPopupHeight,minPopupWidth:this.minPopupWidth,minPopupHeight:this.minPopupHeight,currentUser:this.options.viewer.general.user?this.options.viewer.general.user:"",hideSubject:this.options.annotation.hideAnnotationSubject||!1,allowLockAnnotations:this.options.viewer.permissions.allowLockAnnotations,allowEditLockedAnnotations:this.options.viewer.permissions.allowEditLockedAnnotations,onSelect:this.selectPopup,onClose:this.closePopup,onDelete:this.deletePopup,onUpdatePosition:this.updatePopupPosition,onUpdateSize:this.updatePopupSize,onUpdateColor:this.updatePopupColor,onLock:this.toggleAnnotationLock},this.popupViewElement))}selectPopup(e){this.popupView&&(null!==this.popupView.getState().selectedPopup&&this.updateSelectedPopupContent(!0),this.popupView.selectPopup(e),this.store.viewer.selectPopup({id:e,focus:!1}))}deselectPopup(){this.popupView&&(this.updateSelectedPopupContent(!0),this.popupView.deselectPopup(),this.store.viewer.selectPopup({id:null,focus:!1}))}openPopup(e){if(this.pdfApi){const t=this.pdfApi.getItem(e);t&&(t.popup.isOpen=!0,this.store.annotations.updateAnnotation(t),this.pdfViewerCanvas.licenseFeatures.annotate?this.pdfApi.updateItem(t).then((()=>{this.selectPopup(t.id)})):this.selectPopup(t.id))}}closePopup(){this.updateSelectedPopupContent(!1).then((e=>{this.store.viewer.deselectPopup(),this.pdfApi&&e&&(e.popup.isOpen=!1,this.store.annotations.updateAnnotation(e),this.pdfViewerCanvas.licenseFeatures.annotate&&this.pdfApi.updateItem(e))}))}deletePopup(e){if(this.pdfApi){this.popupView&&this.popupView.deselectPopup(),this.store.viewer.selectPopup({id:null,focus:!1});const t=this.pdfApi.getItem(e);t&&(t.content="",t.subject="",t.popup.isOpen=!1,this.store.annotations.updateAnnotation(t),this.pdfViewerCanvas.licenseFeatures.annotate&&this.pdfApi.updateItem(t))}}toggleAnnotationLock(e){this.pdfApi&&this.updateSelectedPopupContent(!1).then((e=>{e&&(this.options.annotation.trackHistory&&ct(e,"lock",this.options.viewer.general.user),e.setLock(!e.isLocked()),this.store.annotations.updateAnnotation(e),this.pdfViewerCanvas.licenseFeatures.annotate&&this.pdfApi.updateItem(e))}))}updateSelectedPopupContent(e,t){const n=new Promise(((n,i)=>{var o;if(this.pdfApi&&this.popupView){const s=this.popupView.getState(),a=s.selectedPopup;if(a){t||(t=this.pdfApi.getItem(a));const r=s.activeContent,l=s.activeSubject;this.options.annotation.trackHistory&&ct(t,"edit",this.options.viewer.general.user,r,l),t.content=null!==r?r:t.content,t.subject=null!==l?l:t.subject,(null===(o=this.pdfViewerCanvas)||void 0===o?void 0:o.licenseFeatures.annotate)&&e?this.pdfApi.updateItem(t).then((()=>{this.popupView&&this.popupView.stateChanged(!1),n()})).catch((()=>{i()})):n(t)}}n(null)}));return n}updatePopupPosition(e,t,n){if(this.pdfApi){const i=this.pdfApi.getItem(e);if(i){const e=this.pdfApi.transformScreenPointToPdfPoint({x:t*window.devicePixelRatio,y:n*window.devicePixelRatio},i.pdfRect.page).pdfPoint;i.popup.pdfRect.pdfX===e.pdfX&&i.popup.pdfRect.pdfY===e.pdfY||(i.popup.pdfRect.pdfX=e.pdfX,i.popup.pdfRect.pdfY=e.pdfY-i.popup.pdfRect.pdfH,this.store.annotations.updateAnnotation(i),this.updateSelectedPopupContent(!0,i))}}}updatePopupSize(e,t,n){if(this.pdfApi){const i=this.pdfApi.getItem(e);if(i){const e=t/this.screenToPdfScale,o=n/this.screenToPdfScale;i.popup.pdfRect.pdfW===e&&i.popup.pdfRect.pdfH===o||(i.popup.pdfRect.pdfW=e,i.popup.pdfRect.pdfH=o,this.store.annotations.updateAnnotation(i),this.updateSelectedPopupContent(!0,i))}}}updatePopupColor(e,t){if(this.pdfApi){const n=this.pdfApi.getItem(e);if(n){if(n.itemType===z.TEXT||n.itemType===z.HIGHLIGHT||n.itemType===z.SQUIGGLY||n.itemType===z.UNDERLINE||n.itemType===z.STRIKE_OUT)n.color=t;else if(n.itemType===z.INK||n.itemType===z.SQUARE||n.itemType===z.CIRCLE){const e=new Ot(t),i=new Ot(n.color);e.setOpacity(i.a),n.color=e.toRgba()}n.popup.color=t,this.store.annotations.updateAnnotation(n),this.updateSelectedPopupContent(!0,n)}}}}class sn extends ht{constructor(){super(),this.name=sn.moduleInfo.name}onRegister(){return this.createCanvasLayer("popup",on),{}}activate(){}}sn.moduleInfo={name:"PopupModule",moduleType:dt.Layer,requiredFeatures:{annotate:!1,fillFormFields:!1},translationKey:"a",icon:"a"};const an="AddTextAnnotation";class rn extends ut{constructor(){super(...arguments),this.colors=[],this.selectedColor=""}onCreate(){this.setColor=this.setColor.bind(this),this.close=this.close.bind(this),this.context=this.createCanvas(),this.colors=this.options.annotation.colors.highlightColors,this.selectedColor=this.options.annotation.colors.stickyNoteColor;const e=this.module.toolbarElement;((e,t)=>{const n={colors:e.colors,selectedColor:e.selectedColor},s=({})=>(t,n)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(Mt,{colors:t.colors,color:t.selectedColor,icon:f.fillColor,mode:"buttons",onChange:n.setColor})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onClose})));o(n,{setColor:t=>n=>(e.onColorChanged(t),Object.assign(Object.assign({},n),{selectedColor:t}))},(()=>i(s,null)),t)})({colors:this.colors,selectedColor:this.selectedColor,onColorChanged:this.setColor,onClose:this.close},e),this.store.viewer.beginModule(an)}onSave(){return new Promise(((e,t)=>{e()}))}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.endModule(an)}render(e,t){if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==an)this.remove();else if(this.context&&(t.viewer.modeChanged||t.pointer.positionChanged||t.pointer.action||t.canvas.canvasInvalidated)){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const n=t.canvas.pixelRatio*t.document.zoom,i=6*n,o=22*n,s={w:26*n,h:o,x:t.pointer.x.devicePixels-i,y:t.pointer.y.devicePixels-o};let a=!1;for(const e in t.document.pageRects)if(t.document.pageRects[e]){const n=t.document.pageRects[e],i=n.x+n.w,o=s.x+s.w,r=n.y+n.h,l=s.y+s.h;if(s.x>=n.x&&o<=i&&s.y>=n.y&&l<=r){a=!0;break}}if(a){if("mouse"===t.pointer.type&&(((e,t,n,i,o)=>{const s=n.w,a=.8*n.h,r=n.h,l=n.w/6,d=n.w/10,h=n.x,c=n.y,u=h+l,p=c+l,g=h+s,m=c+a,f=g-l,v=m-l,w=u+l,b=w+l,P=u+d,y=c+r;e.beginPath(),e.moveTo(u,c),e.lineTo(f,c),e.arcTo(g,c,g,p,l),e.lineTo(g,v),e.arcTo(g,m,f,m,l),e.lineTo(b,m),e.lineTo(P,y),e.lineTo(w,m),e.lineTo(u,m),e.arcTo(h,m,h,v,l),e.lineTo(h,p),e.arcTo(h,c,u,c,l),e.closePath(),e.lineWidth=.75*t,e.fillStyle=i,e.strokeStyle="#000000",e.fill(),e.stroke();const C=u+1*t,A=f-1*t,E=f-l,L=p+1*t,S=v-1*t,x=L+(S-L)/2;e.beginPath(),e.moveTo(C,L),e.lineTo(A,L),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(C,x),e.lineTo(A,x),e.closePath(),e.stroke(),e.beginPath(),e.moveTo(C,S),e.lineTo(E,S),e.closePath(),e.stroke()})(e,n,s,this.selectedColor),this.store.viewer.setCursorStyle(nt.DEFAULT)),"click"===t.pointer.action)return s.y=s.y,this.createTextAnnotation(s,this.selectedColor),void this.remove()}else this.store.viewer.setCursorStyle(nt.NOT_ALLOWED)}}setColor(e){this.selectedColor=e,this.options.annotation.colors.stickyNoteColor=e}close(){this.remove()}createTextAnnotation(e,t){const n=this.pdfApi.transformScreenPointToPdfPoint({x:e.x,y:e.y}).pdfPoint,i={itemType:z.TEXT,color:t,author:this.options.viewer.general.user,page:n.page,isOpen:!0,pdfRect:{pdfX:n.pdfX,pdfY:n.pdfY,pdfW:0,pdfH:0,page:n.page}};this.pdfApi.createItem(i).then((e=>{const t=e,n=this.pdfApi.getItem(t.id);n&&(n.popup.isOpen=!0,this.store.annotations.updateAnnotation(n),this.store.viewer.selectPopup({id:t.id,focus:!0})),this.onAnnotationCreated(t)}))}}class ln extends ht{constructor(){super(),this.toolbarElement=null,this.name=ln.moduleInfo.name,this.activate=this.activate.bind(this)}onRegister(){return this.toolbarElement=document.createElement("div"),{toolbar:this.toolbarElement}}activate(){this.canvasLayers.add?this.removeCanvasLayer("add"):this.createCanvasLayer("add",rn)}}ln.moduleInfo={name:"TextAnnotationModule",moduleType:dt.Tool,requiredFeatures:{annotate:!0,fillFormFields:!1},translationKey:"annotText.add",icon:"stickyNote"};class dn extends ht{constructor(){super(),this.toolbarElement=null,this.fileInput=null,this.name=dn.moduleInfo.name,this.createImage=this.createImage.bind(this),this.onFileSelected=this.onFileSelected.bind(this),this.createImageStampAnnotation=this.createImageStampAnnotation.bind(this)}onRegister(){return this.toolbarElement=document.createElement("div"),this.fileInput=document.createElement("input"),this.fileInput.setAttribute("type","file"),this.fileInput.setAttribute("accept",".jpg, .jpeg, .jpe, .jif, .jfif, .jfi, .jp2, .j2k, .jpf, .jpm, .jpg2, .j2c, .jpc, .jpx, .mj2 .tif, tiff, .png, .gif, .bmp"),this.fileInput.style.position="absolute",this.fileInput.style.left="-5000px",this.fileInput.onchange=e=>{if(e.currentTarget.files&&e.currentTarget.files.length){const t=e.currentTarget.files[0];this.onFileSelected(t),e.currentTarget.value=""}},this.toolbarElement.append(this.fileInput),{toolbar:this.toolbarElement}}activate(e){e?this.onFileSelected(e):this.fileInput&&this.fileInput.click()}createImage(e){const t=new Image;t.onload=()=>{const e=t.width<St||t.width<St;let n=t.width,i=t.height;e&&n<=i?(i=St*i/n,n=St):e&&i<n&&(n=St*n/i,i=St);const o={width:n,height:i,stampImage:be(t.src)};this.createImageStampAnnotation(o)},t.src=e}onFileSelected(e){return t=this,n=void 0,o=function*(){const t=new FileReader,n=this;t.onload=function(e){n.createImage(e.target.result)},t.readAsDataURL(e)},new((i=void 0)||(i=Promise))((function(e,s){function a(e){try{l(o.next(e))}catch(e){s(e)}}function r(e){try{l(o.throw(e))}catch(e){s(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,r)}l((o=o.apply(t,n||[])).next())}));var t,n,i,o}createImageStampAnnotation(e){if(null!==this.pdfApi&&null!==this.store&&null!==this.options){this.store.getState().document;const t=this.getCanvasSize();t.width,t.height;let n=this.pdfApi.getPageNumber();const i={x:0,y:0,w:t.width,h:t.height},o=this.pdfApi.getPageScreenRect(n),s=Math.max(i.x,o.x),a=Math.max(i.y,o.y),r={x:s,y:a,w:Math.min(i.w,o.x+o.w)-s,h:Math.min(i.h,o.y+o.h)-a},l=this.pdfApi.transformScreenRectToPdfRect(r,n),d={pdfX:0,pdfY:0,pdfW:.24*e.width,pdfH:.24*e.height,page:n};if(d.pdfW>l.pdfW){const e=l.pdfW/d.pdfW*.97;d.pdfW=d.pdfW*e,d.pdfH=d.pdfH*e}if(d.pdfH>l.pdfH){const e=l.pdfH/d.pdfH*.97;d.pdfW=d.pdfW*e,d.pdfH=d.pdfH*e}d.pdfX=(l.pdfW-d.pdfW)/2+l.pdfX,d.pdfY=(l.pdfH-d.pdfH)/2+l.pdfY,this.pdfApi.registerStampImage(e.stampImage).then((e=>{if(null!==this.pdfApi&&null!==this.options){const t={itemType:z.STAMP,imageId:e,page:n,color:this.options.annotation.colors.defaultHighlightColor,pdfRect:d,author:this.options.viewer.general.user};this.pdfApi.createItem(t).then((e=>{this.pdfViewerCanvas.dispatchEvent("itemSelected",e)})).catch((e=>{console.error(e)}))}}))}}}dn.moduleInfo={name:"ImageAnnotationModule",moduleType:dt.Tool,requiredFeatures:{annotate:!0,fillFormFields:!1},translationKey:"annotImage.add",icon:"image"};const hn=({value:e})=>i("div",{class:"pwv-stroke-style-picker-item pwv-stroke-style-"+(e===F.DASHED?"dashed":"solid")},i("span",null)),cn=({value:e})=>i("div",{class:"pwv-stroke-style-picker-button pwv-stroke-style-"+(e===F.DASHED?"dashed":"solid")},i("span",null)),un=({disabled:e,value:t,tooltip:n,shapeType:o,onChange:s})=>{const a=[F.SOLID,F.DASHED].map((e=>({value:e,renderItem:t=>i(hn,{value:e})})));return i(P,{className:`pwv-stroke-style-picker pwv-stroke-style-picker-${o}`,align:"right",disabled:e,tooltip:n,items:a,value:t,renderButton:e=>i(cn,{value:e}),onChange:s})},pn="AddShapeAnnotation";class gn extends ut{constructor(){super(...arguments),this.context=null,this.toolbar=null,this.page=0,this.pointerDown=!1,this.startPoint=null,this.itemType=null,this.strokeColors=[],this.fillColors=[]}onCreate(e){this.setStrokeColor=this.setStrokeColor.bind(this),this.setStrokeWidth=this.setStrokeWidth.bind(this),this.setStrokeStyle=this.setStrokeStyle.bind(this),this.setFillColor=this.setFillColor.bind(this),this.setShape=this.setShape.bind(this),this.cancel=this.cancel.bind(this),this.context=this.createCanvas(),this.itemType=e;const t=this.options.annotation;this.strokeColors=t.colors.foregroundColors,this.fillColors=t.colors.backgroundColors,this.store.viewer.beginModule(pn);const n=this.module.toolbarElement;this.toolbar=((e,t)=>{const n={strokeColors:e.strokeColors,strokeWidths:e.strokeWidths,fillColors:e.fillColors,selectedShape:e.selectedShape,selectedStrokeColor:e.selectedStrokeColor,selectedStrokeWidth:e.selectedStrokeWidth,selectedStrokeStyle:e.selectedStrokeStyle,selectedFillColor:e.selectedFillColor},s=({})=>(t,n)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(S,{tooltip:g.getText("annotShape.addRectangle"),icon:f.rectangle,active:t.selectedShape===z.SQUARE,onClick:()=>{n.setShape(z.SQUARE)}}),i(S,{tooltip:g.getText("annotShape.addEllipse"),icon:f.circle,active:t.selectedShape===z.CIRCLE,onClick:()=>{n.setShape(z.CIRCLE)}}),i(c,null)),i(m,null,i(kt,{tooltip:g.getText("annotShape.strokeWidth"),noneStrokeText:g.getText("border.none"),strokeWidths:t.strokeWidths,value:t.selectedStrokeWidth,onChange:n.setStrokeWidth}),i(un,{tooltip:g.getText("annotShape.strokeStyle"),value:t.selectedStrokeStyle,disabled:0===t.selectedStrokeWidth,onChange:n.setStrokeStyle,shapeType:t.selectedShape===z.CIRCLE?"circle":"rectangle"}),i(Mt,{tooltip:g.getText("annotShape.strokeColor"),colors:t.strokeColors,color:t.selectedStrokeColor,disabled:0===t.selectedStrokeWidth,icon:f.pencil,onChange:n.setStrokeColor})),i(m,null,i(c,null),i(Mt,{tooltip:g.getText("annotShape.bgColor"),colors:t.fillColors,color:t.selectedFillColor,icon:f.fillColor,onChange:n.setFillColor})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onCancel})));return o(n,{setShape:t=>n=>(e.onShapeChanged(t),Object.assign(Object.assign({},n),{selectedShape:t})),setStrokeColor:t=>n=>(e.onStrokeColorChanged(t),Object.assign(Object.assign({},n),{selectedStrokeColor:t})),setStrokeWidth:t=>n=>(e.onStrokeWidthChanged(t),Object.assign(Object.assign({},n),{selectedStrokeWidth:t})),setStrokeStyle:t=>n=>(e.onStrokeStyleChanged(t),Object.assign(Object.assign({},n),{selectedStrokeStyle:t})),setFillColor:t=>n=>(e.onFillColorChanged(t),Object.assign(Object.assign({},n),{selectedFillColor:t})),setCancel:()=>e=>Object.assign({},e)},(()=>i(s,null)),t)})({strokeColors:this.strokeColors,strokeWidths:t.strokeWidths,fillColors:this.fillColors,selectedStrokeColor:t.colors.shapeColor,selectedStrokeWidth:t.shapeStrokeWidth,selectedStrokeStyle:t.shapeStrokeStyle,selectedFillColor:t.colors.shapeFillColor,selectedShape:this.itemType,onStrokeColorChanged:this.setStrokeColor,onStrokeWidthChanged:this.setStrokeWidth,onStrokeStyleChanged:this.setStrokeStyle,onFillColorChanged:this.setFillColor,onShapeChanged:this.setShape,onCancel:this.cancel},n)}cancel(){this.remove()}onSave(){return new Promise(((e,t)=>{e()}))}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.setCursorStyle(nt.DEFAULT),this.store.viewer.endModule(pn)}render(e,t){if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==pn)this.remove();else if(this.context&&(t.viewer.modeChanged||t.pointer.positionChanged||t.pointer.action||t.document.zoomChanged)){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const n={x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels},i=this.pdfApi.transformScreenPointToPdfPoint(n);if(i.isOnPage?this.store.viewer.setCursorStyle(nt.CROSSHAIR):this.store.viewer.setCursorStyle(nt.NOT_ALLOWED),t.pointer.isDown){if(this.pointerDown||(this.startPoint=n,this.pointerDown=!0,0===this.page&&i.isOnPage&&(this.page=i.pdfPoint.page)),this.startPoint){const i=Ye(t.document,{x:this.startPoint.x,y:this.startPoint.y},{x:n.x,y:n.y},this.page),o=this.options.annotation;if(i){e.save();const n=new Ot(o.colors.shapeColor);e.strokeStyle=n.toRgb();const s=new Ot(o.colors.shapeFillColor);e.fillStyle=s.toRgb();const a=o.shapeStrokeWidth*devicePixelRatio*t.document.zoom;if(e.lineWidth=a,e.globalAlpha=a?n.a:s.a,this.options.annotation.shapeStrokeStyle===F.DASHED&&e.setLineDash([e.lineWidth]),this.itemType===z.CIRCLE){const t=i.x+i.w/2,n=i.y+i.h/2;e.beginPath(),e.ellipse(t,n,Math.max(i.w/2-e.lineWidth/2,0),Math.max(i.h/2-e.lineWidth/2,0),0,0,2*Math.PI),s.a&&e.fill(),o.shapeStrokeWidth&&e.stroke()}else s.a&&e.fillRect(i.x,i.y,i.w,i.h),o.shapeStrokeWidth&&e.strokeRect(i.x+e.lineWidth/2,i.y+e.lineWidth/2,i.w-e.lineWidth,i.h-e.lineWidth);e.restore()}}}else if(this.pointerDown&&this.startPoint){const e=Ye(t.document,{x:this.startPoint.x,y:this.startPoint.y},{x:n.x,y:n.y},this.page);e&&(this.pointerDown=!1,this.startPoint=null,this.createRectangleAnnotation(e))}}}setStrokeColor(e){this.options.annotation.colors.shapeColor=e}setShape(e){this.itemType=e}setStrokeWidth(e){this.options.annotation.shapeStrokeWidth=e}setStrokeStyle(e){this.options.annotation.shapeStrokeStyle=e}setFillColor(e){this.options.annotation.colors.shapeFillColor=e}createRectangleAnnotation(e){const t=this.pdfApi.transformScreenRectToPdfRect(e,this.page),n=this.options.annotation,i={itemType:this.itemType,color:n.colors.shapeColor,pdfRect:t,page:this.page,author:this.options.viewer.general.user,fillColor:"transparent"===n.colors.shapeFillColor?null:n.colors.shapeFillColor,border:{width:n.shapeStrokeWidth,style:this.options.annotation.shapeStrokeStyle}};this.pdfApi.createItem(i).then((()=>{this.remove()})).catch((e=>{console.error(e)}))}}const mn="EditShapeAnnotation";class fn extends ut{constructor(){super(...arguments),this.shapeAnnotation=null,this.context=null,this.toolbar=null,this.strokeColors=[],this.fillColors=[]}onCreate(e){this.shapeAnnotation=this.pdfApi.getItem(e),this.setStrokeColor=this.setStrokeColor.bind(this),this.setStrokeWidth=this.setStrokeWidth.bind(this),this.setStrokeStyle=this.setStrokeStyle.bind(this),this.setFillColor=this.setFillColor.bind(this),this.close=this.close.bind(this);const t=this.options.annotation;this.strokeColors=t.colors.foregroundColors,this.fillColors=t.colors.backgroundColors,this.context=this.createCanvas();const n=this.module.toolbarElement;this.toolbar=((e,t)=>{const n={strokeColors:e.strokeColors,strokeWidths:e.strokeWidths,fillColors:e.fillColors,selectedStrokeColor:e.selectedStrokeColor,selectedStrokeWidth:e.selectedStrokeWidth,selectedStrokeStyle:e.selectedStrokeStyle,selectedFillColor:e.selectedFillColor,itemType:e.itemType},s=({})=>(t,n)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(kt,{tooltip:g.getText("annotShape.strokeWidth"),noneStrokeText:g.getText("border.none"),strokeWidths:t.strokeWidths,value:t.selectedStrokeWidth,onChange:n.setStrokeWidth}),i(un,{tooltip:g.getText("annotShape.strokeStyle"),value:t.selectedStrokeStyle,disabled:0===t.selectedStrokeWidth,onChange:n.setStrokeStyle,shapeType:t.itemType===z.CIRCLE?"circle":"rectangle"}),i(Mt,{tooltip:g.getText("annotShape.strokeColor"),colors:t.strokeColors,color:t.selectedStrokeColor,disabled:0===t.selectedStrokeWidth,icon:f.pencil,onChange:n.setStrokeColor})),i(m,null,i(c,null),i(Mt,{tooltip:g.getText("annotShape.bgColor"),colors:t.fillColors,color:t.selectedFillColor,icon:f.fillColor,onChange:n.setFillColor})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onCancel})));return o(n,{setStrokeColor:t=>n=>(e.onStrokeColorChanged(t),Object.assign(Object.assign({},n),{selectedStrokeColor:t})),setStrokeWidth:t=>n=>(e.onStrokeWidthChanged(t),Object.assign(Object.assign({},n),{selectedStrokeWidth:t})),setStrokeStyle:t=>n=>(e.onStrokeStyleChanged(t),Object.assign(Object.assign({},n),{selectedStrokeStyle:t})),setFillColor:t=>n=>(e.onFillColorChanged(t),Object.assign(Object.assign({},n),{selectedFillColor:t})),setCancel:()=>e=>Object.assign({},e)},(()=>i(s,null)),t)})({strokeColors:this.strokeColors,strokeWidths:t.strokeWidths,fillColors:this.fillColors,selectedStrokeColor:this.shapeAnnotation.color?this.shapeAnnotation.color:t.colors.shapeColor,selectedStrokeWidth:this.shapeAnnotation.border.width,selectedStrokeStyle:this.shapeAnnotation.border.style,selectedFillColor:this.shapeAnnotation.fillColor?this.shapeAnnotation.fillColor:t.colors.shapeFillColor,itemType:this.shapeAnnotation.itemType,onStrokeColorChanged:this.setStrokeColor,onStrokeWidthChanged:this.setStrokeWidth,onStrokeStyleChanged:this.setStrokeStyle,onFillColorChanged:this.setFillColor,onCancel:this.close},n),this.store.viewer.beginModule(mn)}close(){this.remove()}onSave(){return new Promise(((e,t)=>{e()}))}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.setCursorStyle(nt.DEFAULT),this.store.viewer.endModule(mn)}render(e,t){var n;if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==mn)this.remove();else{if(("click"===t.pointer.action||"dblclick"===t.pointer.action)&&!(null===(n=this.pdfApi.getAnnotationsOnPoint({x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels}))||void 0===n?void 0:n.find((e=>this.shapeAnnotation&&e.id===this.shapeAnnotation.id))))return void this.close();if(this.context&&this.shapeAnnotation){const e=this.context;e.clearRect(0,0,e.canvas.width,e.canvas.height);const t=this.pdfApi.transformPdfPageRectToScreenRect(this.shapeAnnotation.pdfRect),n=2*devicePixelRatio;e.save(),e.strokeStyle=this.options.viewer.general.textSelectionColor,e.lineWidth=n,e.setLineDash([n,n]),e.strokeRect(t.x-n,t.y-n,t.w+2*n,t.h+2*n),e.restore()}}}setStrokeColor(e){if(this.shapeAnnotation&&this.shapeAnnotation.color){const t=new Ot(e),n=new Ot(this.shapeAnnotation.color);t.setOpacity(n.a),this.shapeAnnotation.color=t.toRgba(),this.updateShapeAnnotation()}}setStrokeWidth(e){this.shapeAnnotation&&(this.shapeAnnotation.border={style:this.shapeAnnotation.border.style,width:e},this.updateShapeAnnotation())}setStrokeStyle(e){this.shapeAnnotation&&(this.shapeAnnotation.border={style:e,width:this.shapeAnnotation.border.width},this.updateShapeAnnotation())}setFillColor(e){if(this.shapeAnnotation){const t=new Ot(e);this.shapeAnnotation.fillColor=t.toRgba(),this.updateShapeAnnotation()}}updateShapeAnnotation(){return new Promise(((e,t)=>{this.pdfApi&&this.shapeAnnotation?this.pdfApi.updateItem(this.shapeAnnotation).then((t=>{e()})).catch((e=>{console.warn(e)})):t()}))}}class vn extends ht{constructor(){super(),this.annotationbarElement=null,this.toolbarElement=null,this.name=vn.moduleInfo.name,this.onEdit=this.onEdit.bind(this)}onRegister(){return this.toolbarElement=document.createElement("div"),{toolbar:this.toolbarElement,contextbar:{itemTypes:[z.SQUARE,z.CIRCLE],icon:f.edit,tooltip:g.getText("annotShape.edit"),onCmd:e=>{this.onEdit(e)}}}}activate(){this.canvasLayers.add?this.removeCanvasLayer("add"):this.createCanvasLayer("add",gn,z.SQUARE)}onEdit(e){this.createCanvasLayer("edit",fn,e)}}vn.moduleInfo={name:"ShapeAnnotationModule",moduleType:dt.Tool,requiredFeatures:{annotate:!0,fillFormFields:!1},translationKey:"annotShape.add",icon:"shapes"};const wn="EraserTool";class bn extends ut{constructor(){super(...arguments),this.context=null,this.eraserRadius=this.options.annotation.eraserRadius}onCreate(e){this.setEraserRadius=this.setEraserRadius.bind(this),this.remove=this.remove.bind(this),this.context=this.createCanvas();const t=this.module.toolbarElement;((e,t)=>{const n={radius:e.radius},s=({})=>(t,n)=>i(h,{allowWrap:!0,alignCenter:!0},i(m,null,i(Kt,{tooltip:g.getText("eraser.eraserWidth"),min:2,max:50,step:1,value:t.radius,text:`${t.radius}px`,icon:f.circleDashed,onChange:n.setRadius,className:"pwv-opacityslider"})),i(m,{pushRight:!0},i(c,null),i(S,{icon:f.close,onClick:e.onCancel})));o(n,{setRadius:t=>n=>(e.onRadiusChanged(t),Object.assign(Object.assign({},n),{radius:t})),setCancel:()=>e=>Object.assign({},e)},(()=>i(s,null)),t)})({radius:this.eraserRadius,onRadiusChanged:this.setEraserRadius,onCancel:this.remove},t),this.store.viewer.beginModule(wn)}onRemove(){this.removeCanvasElements(),this.context=null,this.module.toolbarElement.innerHTML="",this.store.viewer.endModule(wn)}onSave(){return new Promise((e=>e()))}render(e,t){var n;if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==wn)return void this.remove();const i={x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels},o=this.pdfApi.transformScreenPointToPdfPoint(i),s=o.isOnPage?nt.NONE:nt.NOT_ALLOWED;this.store.viewer.setCursorStyle(s);const a=this.context;if(a&&(a.clearRect(0,0,a.canvas.width,a.canvas.height),o.isOnPage&&(a.save(),a.lineWidth=1,this.eraserRadius>=8&&a.setLineDash([4*devicePixelRatio,4*devicePixelRatio]),a.beginPath(),a.arc(i.x,i.y,this.eraserRadius*devicePixelRatio/2,0,2*Math.PI),a.stroke(),a.restore())),!o.isOnPage||"click"!==t.pointer.action)return;const r=null===(n=this.pdfApi.getAnnotationsOnPoint(i))||void 0===n?void 0:n.filter((e=>e.itemType===z.INK));if(!r)return;const l=this.deleteFirstInkLineCloseToPoint(r,o.pdfPoint);l&&this.updateInkAnnotation(l)}setEraserRadius(e){this.options.annotation.eraserRadius=e,this.eraserRadius=e}deleteFirstInkLineCloseToPoint(e,t){if(!this.context)return null;const n=this.context;n.save();for(let i of e){n.lineWidth=Math.max(i.border.width,this.eraserRadius*devicePixelRatio),n.lineCap="round";for(let e of i.inkList){const o=new Path2D;let s=!0;for(let t of e)s?(o.moveTo(t.x,t.y),s=!1):o.lineTo(t.x,t.y);if(n.isPointInStroke(o,t.pdfX,t.pdfY))return i.inkList.splice(i.inkList.indexOf(e),1),i}}return n.restore(),null}updateInkAnnotation(e){return new Promise(((t,n)=>{e.inkList.length?this.pdfApi.updateItem(e).then((e=>{this.store.annotations.updateAnnotation(e),t()})).catch((e=>{console.error(e),n()})):(e.id,this.pdfApi.deleteItem(e).then((()=>{t()})).catch((e=>{console.error(e),n()})))}))}}class Pn extends ht{constructor(){super(),this.toolbarElement=null,this.name=Pn.moduleInfo.name,this.activate=this.activate.bind(this)}onRegister(){return this.toolbarElement=document.createElement("div"),{toolbar:this.toolbarElement}}activate(){this.canvasLayers.add?this.removeCanvasLayer("add"):this.createCanvasLayer("add",bn)}}var yn;Pn.moduleInfo={name:"EraserModule",moduleType:dt.Tool,requiredFeatures:{annotate:!0,fillFormFields:!1},translationKey:"eraser.begin",icon:"eraser"},function(e){e[e.A4=0]="A4",e[e.LETTER=1]="LETTER"}(yn||(yn={}));const Cn="PrintServiceLayer";class An extends ut{constructor(){super(...arguments),this.printDialog=null,this.printElement=null,this.printIFrame=null,this.pageStyle=null,this.printPending=!1}onCreate(){this.startPrint=this.startPrint.bind(this),this.cancelPrint=this.cancelPrint.bind(this),this.validateRange=this.validateRange.bind(this),this.parseRange=this.parseRange.bind(this),this.stopTouchEventPropagation=this.stopTouchEventPropagation.bind(this),this.printElement=this.createHtmlLayer(),this.printElement.className="pwv-print-dialog",this.printDialog=((e,t)=>{const n={pages:[],selectedFormat:yn.A4,radio_selection:"all",printPending:!1,includeAnnotations:!0},s=({print:t,cancel:o,parseRange:s,validateRange:a})=>(r,l)=>i("div",{class:"pwv-print-body",id:"pwv-print-body"},i("div",{class:"pwv-print-title"},i(v,{className:"pwv-print-icon",icon:f.print,fill:"#008BD2"}),g.getText("print.title")),r.printPending?i("div",null,i(Fe,null),i("div",{class:"pwv-print-bottom pwv-print-bottom-center"},i("button",{class:"pwv-print-button-cancel",onclick:()=>{o()}},g.getText("print.cancel")))):i("div",null,i("div",{class:"pwv-print-pages"},i("div",{class:"pwv-print-option"},i("label",null,i("input",{type:"radio",id:"all",checked:"all"===r.radio_selection,onclick:()=>{l.setRadioSelection("all")}}),i("span",{class:"pwv-print-radio"}),g.getText("print.all"))),i("div",{class:"pwv-print-option"},i("label",null,i("input",{type:"radio",id:"current_page",checked:"current_page"===r.radio_selection,onclick:()=>{l.setRadioSelection("current_page")}}),i("span",{class:"pwv-print-radio"}),g.getText("print.current"))),i("div",{class:"pwv-print-option"},i("label",null,i("input",{type:"radio",id:"range",checked:"range"===r.radio_selection,onclick:()=>{l.setRadioSelection("range")}}),i("span",{class:"pwv-print-radio"}),g.getText("print.range")),i("input",{class:"pwv-print-page-range",id:"pwv-print-input-range",type:"text",placeholder:"e.g. 1,3-5",onkeydown:e=>{e.stopPropagation()},onkeyup:t=>{"range"!==n.radio_selection&&l.setRadioSelection("range");const i=document.getElementById("pwv-print-input-range"),o=document.getElementById("pwv-print-invalid-range-text");let r=!1;a(i.value)&&(r=!s(i.value).some((t=>t>e.pageCount||t<1))),r?(i.classList.remove("pwv-print-invalid-input"),o.style.display="none"):(i.classList.add("pwv-print-invalid-input"),o.style.display="block")}})),i("div",{class:"pwv-print-invalid-range-text-container"},i("div",{class:"pwv-print-invalid-range-text",id:"pwv-print-invalid-range-text"},g.getText("print.invalid"))),i("div",{class:"pwv-print-option"},i("div",{class:"pwv-checkbox-btn pwv-print-include-annotations",onclick:e=>{l.toggleIncludeAnnotations()}},r.includeAnnotations?i(v,{icon:f.checkboxChecked}):i(v,{icon:f.checkbox}),g.getText("print.includeAnnotations")))),i("div",{class:"pwv-print-bottom"},i("button",{class:"pwv-print-button-cancel",onclick:()=>{o()}},g.getText("print.cancel")),i("button",{class:"pwv-print-button-print",onclick:()=>{if("all"===r.radio_selection){const n=Array.from({length:e.pageCount},((e,t)=>t+1));t({pages:n,format:r.selectedFormat,includeAnnotations:r.includeAnnotations})}if("current_page"===r.radio_selection&&t({pages:[e.currentPage],format:r.selectedFormat,includeAnnotations:r.includeAnnotations}),"range"===r.radio_selection){const e=document.getElementById("pwv-print-input-range").value,n=s(e);t({pages:n,format:r.selectedFormat,includeAnnotations:r.includeAnnotations})}}},g.getText("print.print")))));return o(n,{setFormat:e=>t=>{let n=t.selectedFormat;return 0===e?n=yn.A4:1===e&&(n=yn.LETTER),Object.assign(Object.assign({},t),{selectedFormat:n})},setRadioSelection:e=>t=>Object.assign(Object.assign({},t),{radio_selection:e}),setPrintPending:e=>t=>Object.assign(Object.assign({},t),{printPending:e}),toggleIncludeAnnotations:()=>e=>Object.assign(Object.assign({},e),{includeAnnotations:!e.includeAnnotations})},(()=>i(s,{print:e.print,cancel:e.cancel,pageCount:e.pageCount,currentPage:e.currentPage,parseRange:e.parseRange,validateRange:e.validateRange})),t)})({pageCount:this.pdfApi.getPageCount(),currentPage:this.store.getState().document.firstVisiblePage,print:this.startPrint,cancel:this.cancelPrint,validateRange:this.validateRange,parseRange:this.parseRange},this.printElement),this.store.viewer.beginModule(Cn),this.printElement.addEventListener("touchstart",this.stopTouchEventPropagation),this.printElement.addEventListener("touchend",this.stopTouchEventPropagation)}startPrint({pages:e,format:t,includeAnnotations:n}){var i;if(this.printPending=!0,this.printDialog&&this.printDialog.setPrintPending(!0),!this.printIFrame){this.printIFrame=document.createElement("iframe"),this.printIFrame.style.display="none",document.body.appendChild(this.printIFrame);const e=this.printIFrame.contentDocument;if(e.open(),e.close(),e.head){const t=e.createElement("style");t.textContent="\n @media print {\n @page {size:A4;margin:0;padding:0}\n body {margin:0;padding:0;background-color:white;height:100%;}\n .page {\n width: 210mm;\n height: 297mm;\n overflow: hidden;\n page-break-after: always;\n break-after: always;\n -webkit-region-break-after: always;\n -webkit-column-break-after: always;\n -webkit-page-break-after: always;\n }\n .page:last-child {\n page-break-after: auto;\n break-after: auto;\n -webkit-page-break-after: auto;\n }\n .page img {\n width: 100%;\n height: auto;\n display: block;\n page-break-inside: avoid;\n break-inside: avoid;\n -webkit-region-break-inside: avoid;\n -webkit-column-break-inside: avoid;\n -webkit-page-break-inside: avoid;\n }\n body.is-safari .page {\n width: 100% !important;\n height: 100% !important;\n }\n }\n ",e.head.append(t)}/Safari\//.test(navigator.userAgent)&&!/Chrome\//.test(navigator.userAgent)&&e.body.classList.add("is-safari"),null===(i=this.printIFrame.contentWindow)||void 0===i||i.addEventListener("afterprint",(()=>{this.close()}))}const o=this.printIFrame.contentDocument;o.body.innerHTML="";const s=o.createElement("div");o.body.append(s);const a=this.pdfApi,r=150,l={width:595/72*r,height:842/72*r},d=o.createElement("canvas");d.width=l.width,d.height=l.height;const h=d.getContext("2d"),c=()=>{return t=this,i=void 0,p=function*(){if(!this.printPending)return;const t=e.shift();if(t){const e=yield a.getPagePdfSize(t);let i=e.width/72*r,u=e.height/72*r;const p=i>u;let g=1;g=p?Math.min(l.height/i,l.width/u):Math.min(l.width/i,l.height/u),g<1&&(i*=g,u*=g);let m=n?void 0:()=>!1;const f=yield a.renderPage(t,i,u,m);if(h){if(h.clearRect(0,0,l.width,l.height),h.save(),p){const e=o.createElement("canvas");e.width=f.imageData.width,e.height=f.imageData.height;const t=e.getContext("2d");t&&t.putImageData(f.imageData,0,0);const n=(l.height-f.imageData.width)/2,i=(l.width-f.imageData.height)/2;h.translate(d.width,0),h.rotate(90*Math.PI/180),h.drawImage(e,n,i)}else{const e=(l.width-i)/2,t=(l.height-u)/2;h.putImageData(f.imageData,e,t)}h.restore();const e=o.createElement("div");e.classList.add("page"),s.append(e);const t=d.toDataURL("image/png"),n=o.createElement("img");n.src=t,e.append(n)}c()}else window.setTimeout((()=>{this.printPending=!1,this.printDialog&&this.printDialog.setPrintPending(!1),this.printIFrame&&this.printIFrame.contentWindow&&this.printIFrame.contentWindow.print()}),100)},new((u=void 0)||(u=Promise))((function(e,n){function o(e){try{a(p.next(e))}catch(e){n(e)}}function s(e){try{a(p.throw(e))}catch(e){n(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof u?n:new u((function(e){e(n)}))).then(o,s)}a((p=p.apply(t,i||[])).next())}));var t,i,u,p};c()}cancelPrint(){this.printPending=!1,this.remove()}stopTouchEventPropagation(e){e.stopImmediatePropagation()}validateRange(e){let t=e.match(/^[\d\,\-]*$/g);return!(!t||t&&0===t.length||(t=e.match(/-{2,}|,{2,}/g),t&&t.length>0))}parseRange(e){let t=[];return this.validateRange(e)?(e.split(",").forEach((e=>{const n=(e.match(/-/g)||[]).length;if(0===n&&t.push(parseInt(e,10)),1===n){const n=e.split("-");let i=parseInt(n[0],10),o=parseInt(n[1],10);if(o<i){const e=i;i=o,o=e}const s=Array.from({length:o-i+1},((e,t)=>t+i));t=t.concat(s)}})),t):[]}close(){this.remove()}onRemove(){var e,t;null===(e=this.printElement)||void 0===e||e.removeEventListener("touchstart",this.stopTouchEventPropagation),null===(t=this.printElement)||void 0===t||t.removeEventListener("touchend",this.stopTouchEventPropagation),this.removeHtmlElements(),this.printPending=!1,this.printElement=null,this.pageStyle&&this.pageStyle.remove(),this.printIFrame&&document.body.removeChild(this.printIFrame),this.store.viewer.endModule(Cn)}render(e,t){if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==Cn)this.remove();else if(this.printElement&&"click"===t.pointer.action){const e=t.pointer.x.cssPixels>this.printElement.offsetLeft&&t.pointer.x.cssPixels<this.printElement.offsetLeft+this.printElement.offsetWidth,n=t.pointer.y.cssPixels>this.printElement.offsetTop&&t.pointer.y.cssPixels<this.printElement.offsetTop+this.printElement.offsetHeight;if(!e||!n)return void this.remove()}}onSave(){return new Promise(((e,t)=>{}))}}class En extends ht{constructor(){super(),this.annotationbarElement=null,this.toolbarElement=null,this.name=En.moduleInfo.name,this.activate=this.activate.bind(this)}onRegister(){return{}}activate(){this.canvasLayers.add||this.createCanvasLayer("add",An)}}En.moduleInfo={name:"PrintServiceModule",moduleType:dt.Layer,requiredFeatures:{annotate:!1,fillFormFields:!1},translationKey:"a",icon:"a"};class Ln{constructor(e,t){this.element=e,this.widgetType=t.widgetType,this.widget=t.widget,this.pdfDocument=t.pdfDocument,this.onTab=t.onTab,this.onBlur=t.onBlur,this.editorElement=this.createFormField(),this.editorElement.classList.add("pwv-formField__Element"),this.element.appendChild(this.editorElement),window.setTimeout((()=>{this.setFocus()}),1)}saveWidget(){this.pdfDocument.editAnnotation(this.widget).then((()=>{})).catch((e=>{console.warn(e)}))}setZoom(e){this.editorElement.style.transform=`scale(${e})`,this.editorElement.style.width=this.element.clientWidth/e+"px",this.editorElement.style.height=this.element.clientHeight/e+"px"}}class Sn extends Ln{createFormField(){const e=document.createElement("label");e.classList.add("pwv-formField__CheckBox"),e.style.overflow="hidden";const t=document.createElement("input");return t.type="checkbox",t.checked=this.widget.selected,t.style.position="absolute",t.style.top="-20px",t.style.left="-20px",e.appendChild(t),this.handleOnChange=this.handleOnChange.bind(this),this.handleOnKeyDown=this.handleOnKeyDown.bind(this),this.handleOnBlur=this.handleOnBlur.bind(this),e.addEventListener("change",this.handleOnChange),e.addEventListener("keydown",this.handleOnKeyDown),e.addEventListener("blur",this.handleOnBlur),e}onRemove(){this.editorElement.removeEventListener("change",this.handleOnChange),this.editorElement.removeEventListener("keydown",this.handleOnKeyDown),this.editorElement.removeEventListener("blur",this.handleOnBlur)}setFocus(){this.editorElement.focus()}handleOnKeyDown(e){"Tab"===e.code?this.onTab(e.shiftKey):"Escape"===e.code&&this.onBlur()}handleOnBlur(e){this.onBlur()}handleOnChange(e){this.widget.push(),this.saveWidget()}}class xn extends Ln{constructor(){super(...arguments),this.btnClearPressed=!1,this.hasPendingChanges=!1,this.saveThrottlingTimer=void 0}createFormField(){this.inputOnFocus=this.inputOnFocus.bind(this),this.inputOnBlur=this.inputOnBlur.bind(this),this.inputOnInput=this.inputOnInput.bind(this),this.inputOnChange=this.inputOnChange.bind(this),this.inputOnKeyDown=this.inputOnKeyDown.bind(this),this.btnOnClick=this.btnOnClick.bind(this),this.btnOnMouseDown=this.btnOnMouseDown.bind(this),this.btnOnMouseUp=this.btnOnMouseUp.bind(this);const e=document.createElement("div");e.classList.add("pwv-formField__ComboBox"),this.dataList=document.createElement("datalist"),this.dataList.id=Math.random().toString(36).substring(2,8);for(let e=0;e<this.widget.options.size;e++){const t=this.widget.options.get(e),n=document.createElement("option");n.value=t,n.textContent=t,this.dataList.appendChild(n)}this.input=document.createElement("input"),this.input.setAttribute("list",this.dataList.id),this.input.style.border="none",this.input.style.boxSizing="border-box",this.input.style.width="100%",this.input.style.maxWidth="100%",this.input.value=null!==this.widget.chosen?this.widget.options.get(this.widget.chosen):this.widget.customEntry,this.input.addEventListener("focus",this.inputOnFocus),this.input.addEventListener("blur",this.inputOnBlur),this.input.addEventListener("input",this.inputOnInput),this.input.addEventListener("change",this.inputOnChange),this.input.addEventListener("keydown",this.inputOnKeyDown),this.btnClear=document.createElement("button"),this.btnClear.tabIndex=-1;const t=document.createElement("span");t.classList.add("pwv-icon");const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 320 512");const i=document.createElementNS("http://www.w3.org/2000/svg","path");return i.setAttribute("d","M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"),i.setAttribute("stroke-width","1px"),i.setAttribute("shape-rendering","optimizeQuality"),n.appendChild(i),t.appendChild(n),this.btnClear.appendChild(t),this.btnClear.addEventListener("mousedown",this.btnOnMouseDown),this.btnClear.addEventListener("mouseup",this.btnOnMouseUp),this.btnClear.addEventListener("mouseleave",this.btnOnMouseUp),this.btnClear.addEventListener("click",this.btnOnClick),e.appendChild(this.input),e.appendChild(this.dataList),e.appendChild(this.btnClear),e}onRemove(){this.saveThrottlingTimer&&window.clearTimeout(this.saveThrottlingTimer),this.hasPendingChanges&&this.saveWidget(),this.input.removeEventListener("focus",this.inputOnFocus),this.input.removeEventListener("blur",this.inputOnBlur),this.input.removeEventListener("input",this.inputOnInput),this.input.removeEventListener("change",this.inputOnChange),this.input.removeEventListener("keydown",this.inputOnKeyDown),this.btnClear.removeEventListener("mousedown",this.btnOnMouseDown),this.btnClear.removeEventListener("mouseup",this.btnOnMouseUp),this.btnClear.removeEventListener("mouseleave",this.btnOnMouseUp),this.btnClear.removeEventListener("click",this.btnOnClick)}setFocus(){this.input.focus()}updateBtnVisibility(){this.btnClear&&(this.btnClear.style.display=""===this.input.value?"none":"flex")}updateWidget(){const{value:e,list:t}=this.input,n=[...t.options].findIndex((t=>t.value===e));n>=0?this.widget.chosen=n:this.widget.customEntry=e,this.saveThrottlingTimer&&window.clearTimeout(this.saveThrottlingTimer),this.saveThrottlingTimer=window.setTimeout((()=>{this.saveWidget(),this.hasPendingChanges=!1}),500)}inputOnFocus(e){this.updateBtnVisibility()}inputOnBlur(e){this.btnClearPressed||(this.saveWidget(),this.hasPendingChanges=!1,this.onBlur())}inputOnInput(e){this.updateBtnVisibility(),this.updateWidget()}inputOnChange(e){this.updateBtnVisibility()}inputOnKeyDown(e){"Tab"===e.code?this.onTab(e.shiftKey):"Escape"===e.code&&this.input.blur()}btnOnClick(e){this.input.value="",this.updateWidget(),this.updateBtnVisibility(),this.input.focus()}btnOnMouseDown(e){this.btnClearPressed=!0}btnOnMouseUp(e){this.input.focus(),this.btnClearPressed=!1}}class Tn extends Ln{createFormField(){const e=document.createElement("select");e.classList.add("pwv-formField__SelectList");for(let t=0;t<this.widget.options.size;t++){const n=this.widget.options.get(t),i=document.createElement("option");i.value=t.toString(),i.textContent=n,e.appendChild(i)}return e.value=this.widget.chosen,this.handleOnChange=this.handleOnChange.bind(this),this.handleOnKeyDown=this.handleOnKeyDown.bind(this),this.handleOnBlur=this.handleOnBlur.bind(this),e.addEventListener("change",this.handleOnChange),e.addEventListener("keydown",this.handleOnKeyDown),e.addEventListener("blur",this.handleOnBlur),e}onRemove(){}setFocus(){this.editorElement.focus()}handleOnKeyDown(e){"Tab"===e.code?this.onTab(e.shiftKey):"Escape"===e.code&&this.onBlur()}handleOnBlur(e){this.onBlur()}handleOnChange(e){this.widget.chosen=parseInt(e.target.value),this.saveWidget()}}class On extends Ln{createFormField(){const e=document.createElement("select");e.setAttribute("required","true"),this.widget.multiSelectAllowed?e.setAttribute("multiple","true"):e.setAttribute("size",`${this.widget.options.size}`),e.classList.add("pwv-formField__ListBox");const t=Array.from(this.widget.chosen.values());for(let n=0;n<this.widget.options.size;n++){const i=this.widget.options.get(n),o=document.createElement("option");o.value=n.toString(),o.textContent=i,e.appendChild(o),o.selected=t.includes(n)}return this.handleOnChange=this.handleOnChange.bind(this),this.handleOnKeyDown=this.handleOnKeyDown.bind(this),this.handleOnBlur=this.handleOnBlur.bind(this),e.addEventListener("change",this.handleOnChange),e.addEventListener("keydown",this.handleOnKeyDown),e.addEventListener("blur",this.handleOnBlur),e.addEventListener("wheel",(e=>{e.stopPropagation()})),e}onRemove(){this.editorElement.removeEventListener("change",this.handleOnChange),this.editorElement.removeEventListener("keydown",this.handleOnKeyDown),this.editorElement.removeEventListener("blur",this.handleOnBlur)}setFocus(){this.editorElement.focus()}handleOnKeyDown(e){"Tab"===e.code?this.onTab(e.shiftKey):"Escape"===e.code&&this.onBlur()}handleOnBlur(e){this.onBlur()}handleOnChange(e){let t=[];if(e.target.value){if(t=[...e.target.options].filter((e=>e.selected)).map((e=>parseInt(e.value))),!this.widget.multiSelectAllowed){const n=t[0];t=[n],e.target.value=n}}else{const n=Array.from(this.widget.chosen.values()).shift();t=[n],e.target.value=n}this.widget.chosen.clear(),t.forEach((e=>this.widget.chosen.add(e))),this.saveWidget()}}class Mn extends Ln{createFormField(){const e=document.createElement("label");e.classList.add("pwv-formField__RadioButton"),e.style.overflow="hidden";const t=document.createElement("input");return t.type="radio",t.checked=this.widget.selected,t.style.position="absolute",t.style.top="-20px",t.style.left="-20px",e.appendChild(t),this.handleOnChange=this.handleOnChange.bind(this),this.handleOnKeyDown=this.handleOnKeyDown.bind(this),this.handleOnBlur=this.handleOnBlur.bind(this),e.addEventListener("change",this.handleOnChange),e.addEventListener("keydown",this.handleOnKeyDown),e.addEventListener("blur",this.handleOnBlur),e}onRemove(){this.editorElement.removeEventListener("change",this.handleOnChange),this.editorElement.removeEventListener("keydown",this.handleOnKeyDown),this.editorElement.removeEventListener("blur",this.handleOnBlur)}setFocus(){this.editorElement.focus()}handleOnKeyDown(e){"Tab"===e.code?this.onTab(e.shiftKey):"Escape"===e.code&&this.onBlur()}handleOnBlur(e){this.onBlur()}handleOnChange(e){this.widget.push(),this.saveWidget()}}class Rn extends Ln{createFormField(){const e=this.widget.multilineAllowed?document.createElement("textarea"):document.createElement("input");return e.classList.add("pwv-formField__TextBox"),this.widget.text&&(e.value=this.widget.text),this.widget.maxLength&&this.widget.maxLength>=0&&(e.maxLength=this.widget.maxLength),this.widget.comb&&(e.style.letterSpacing="1em"),this.handleOnChange=this.handleOnChange.bind(this),this.handleOnKeyDown=this.handleOnKeyDown.bind(this),this.handleOnBlur=this.handleOnBlur.bind(this),e.addEventListener("input",this.handleOnChange),e.addEventListener("keydown",this.handleOnKeyDown),e.addEventListener("blur",this.handleOnBlur),e}onRemove(){}setFocus(){this.editorElement.focus()}handleOnKeyDown(e){"Tab"===e.code?this.onTab(e.shiftKey):"Escape"===e.code&&this.onBlur()}handleOnBlur(e){this.onBlur()}handleOnChange(e){try{this.widget.text=e.target.value}catch(e){console.warn(e)}this.saveWidget()}}const Nn="EditFormField",Vn=e=>{e.stopPropagation()};class Dn extends ut{constructor(){super(...arguments),this.widgetAnnotation=null,this.formFieldElement=null,this.hasFocus=!1,this.widgetEditor=null}onCreate(e){const{annotationId:t,action:n}=e;this.store.viewer.beginModule(Nn),this.widgetAnnotation=this.pdfApi.getItem(t),this.selectNextFormField=this.selectNextFormField.bind(this),this.blur=this.blur.bind(this),this.formFieldElement=this.createHtmlLayer(),this.formFieldElement.classList.add("pwv-formField"),this.formFieldElement.addEventListener("mousedown",Vn,!1),this.formFieldElement.addEventListener("mousemove",Vn,!1),this.formFieldElement.addEventListener("mouseup",Vn,!1),this.formFieldElement.addEventListener("touchstart",Vn,{passive:!1}),this.formFieldElement.addEventListener("touchmove",Vn,{passive:!0}),this.formFieldElement.addEventListener("touchend",Vn,{passive:!0}),this.updateFormFieldElementPosition();const i=this.widgetAnnotation.widget,o=this.widgetAnnotation.widgetType;"click"!==n||o!==j.CHECK_BOX&&o!==j.RADIO_BUTTON||(i.push(),this.widgetAnnotation.pdfDocument.editAnnotation(i));const s=i.boundingBox;this.pdfApi.goToRectangle({page:s.pageNumber,pdfX:s.x-4,pdfY:s.y-6,pdfW:s.width+8,pdfH:s.height+12});const a={widget:i,widgetType:o,pdfDocument:this.widgetAnnotation.pdfDocument,onTab:e=>{this.selectNextFormField(e)},onBlur:()=>{this.hasFocus&&this.blur()}};switch(a.widgetType){case j.CHECK_BOX:this.widgetEditor=new Sn(this.formFieldElement,a);break;case j.RADIO_BUTTON:this.widgetEditor=new Mn(this.formFieldElement,a);break;case j.TEXT_BOX:this.widgetEditor=new Rn(this.formFieldElement,a);break;case j.COMBO_BOX:i.customEntryAllowed?this.widgetEditor=new xn(this.formFieldElement,a):this.widgetEditor=new Tn(this.formFieldElement,a);break;case j.LIST_BOX:this.widgetEditor=new On(this.formFieldElement,a)}this.hasFocus=!0}cancel(){this.remove()}onSave(){return new Promise(((e,t)=>{e()}))}close(){this.remove()}onRemove(){var e;this.hasFocus=!1,null===(e=this.widgetEditor)||void 0===e||e.onRemove(),this.removeHtmlElements(),this.formFieldElement=null,this.store.viewer.endModule(Nn)}render(e,t){var n;if(t.viewer.modeChanged&&t.viewer.selectedModuleName!==Nn)this.remove();else{if(this.formFieldElement&&((t.canvas.canvasInvalidated||t.viewer.modeChanged)&&this.updateFormFieldElementPosition(),"click"===t.pointer.action)){const e={x:t.pointer.x.cssPixels,y:t.pointer.y.cssPixels},n=e.x>this.formFieldElement.offsetLeft&&e.x<this.formFieldElement.offsetLeft+this.formFieldElement.offsetWidth,i=e.y>this.formFieldElement.offsetTop&&e.y<this.formFieldElement.offsetTop+this.formFieldElement.offsetHeight;if(!n||!i){this.blur();const e=this.pdfApi.getAnnotationsOnPoint({x:t.pointer.x.devicePixels,y:t.pointer.y.devicePixels});if(e&&e.length)for(let t=0;t<e.length;t++){const n=e[t];n.itemType!==z.WIDGET||n.widget.readOnly||this.pdfViewerCanvas.activateModule("FormFieldModule",{annotationId:n.id,action:"click"})}return}}(t.document.zoomChanged||t.viewer.modeChanged)&&(null===(n=this.widgetEditor)||void 0===n||n.setZoom(t.document.zoom))}}updateFormFieldElementPosition(){if(this.widgetAnnotation&&this.formFieldElement){const e=this.pdfApi.transformPdfPageRectToScreenRect(this.widgetAnnotation.pdfRect);this.formFieldElement.style.left=e.x/devicePixelRatio-2+"px",this.formFieldElement.style.top=e.y/devicePixelRatio-2+"px",this.formFieldElement.style.width=e.w/devicePixelRatio+1+"px",this.formFieldElement.style.height=e.h/devicePixelRatio+1+"px"}}selectNextFormField(e){if(this.widgetAnnotation){const{annotations:t,document:n}=this.store.getState(),i=this.pdfApi.getPageCount(),o=(e,n)=>{const s=t.byPage[e];for(let e=n;e<s.length;e++){const n=s[e],i=t.all[n];if(i.itemType===z.WIDGET&&!i.widget.readOnly)return i}return 1===i&&0===n?null:o(i>e?e+1:1,0)},s=(e,n)=>{const i=t.byPage[e];for(let e=n<0?i.length-1:n;e>=0;e--){const n=i[e],o=t.all[n];if(o.itemType===z.WIDGET&&!o.widget.readOnly)return o}return 1===e?null:s(e-1,-1)},a=t.byPage[this.widgetAnnotation.page].findIndex((e=>{var t;return e===(null===(t=this.widgetAnnotation)||void 0===t?void 0:t.id)}));let r=this.widgetAnnotation.page,l=null;l=e?0===a?1===r?this.widgetAnnotation:s(this.widgetAnnotation.page-1,-1):s(this.widgetAnnotation.page,a-1):o(this.widgetAnnotation.page,a+1),l&&(this.blur(),this.pdfViewerCanvas.activateModule("FormFieldModule",{annotationId:l.id,action:"select"}))}}blur(){this.hasFocus&&(this.hasFocus=!1,this.remove())}}class kn extends ht{constructor(){super(),this.name=kn.moduleInfo.name}onRegister(){return{}}activate(e){this.canvasLayers.edit||this.onEdit(e)}onEdit(e){this.createCanvasLayer("edit",Dn,e)}}kn.moduleInfo={name:"FormFieldModule",moduleType:dt.Layer,requiredFeatures:{annotate:!1,fillFormFields:!0}};class In{constructor(e,t,n){var i;if(this.eventListeners=new Map,this.documentLoaded=!1,this.renderLoopRunning=!1,!e)throw{error:"PdfViewerCanvas container element is null"};this.options=n,this.annotTimer=0,this.onResize=this.onResize.bind(this),this.startRenderLoop=this.startRenderLoop.bind(this),this.updateViewLayerContext=this.updateViewLayerContext.bind(this),this.onKeyboardShortcuts=this.onKeyboardShortcuts.bind(this),this.dispatchEvent=this.dispatchEvent.bind(this),this.onCanvasPointerDown=this.onCanvasPointerDown.bind(this),this.onCanvasPointerMove=this.onCanvasPointerMove.bind(this),this.onCanvasPointerUp=this.onCanvasPointerUp.bind(this),this.onCanvasPointerClick=this.onCanvasPointerClick.bind(this),this.onCanvasPointerDblClick=this.onCanvasPointerDblClick.bind(this),this.onCanvasPointerLongPress=this.onCanvasPointerLongPress.bind(this),this.onCanvasPointerStartDrag=this.onCanvasPointerStartDrag.bind(this),this.onCanvasPointerEndDrag=this.onCanvasPointerEndDrag.bind(this),this.onCanvasPointerPinch=this.onCanvasPointerPinch.bind(this),this.onMouseWheel=this.onMouseWheel.bind(this),this.onDocumentOpened=this.onDocumentOpened.bind(this),this.onDocumentClosed=this.onDocumentClosed.bind(this),this.onCanvasInvalidated=this.onCanvasInvalidated.bind(this),this.onFirstVisiblePageChanged=this.onFirstVisiblePageChanged.bind(this),this.onLastVisiblePageChanged=this.onLastVisiblePageChanged.bind(this),this.onPageNumberChanged=this.onPageNumberChanged.bind(this),this.onZoomChanged=this.onZoomChanged.bind(this),this.onFitModeChanged=this.onFitModeChanged.bind(this),this.onPageLayoutModeChanged=this.onPageLayoutModeChanged.bind(this),this.onBusyStateChanged=this.onBusyStateChanged.bind(this),this.onRotationChanged=this.onRotationChanged.bind(this),this.onItemCreated=this.onItemCreated.bind(this),this.onItemUpdated=this.onItemUpdated.bind(this),this.onItemDeleted=this.onItemDeleted.bind(this),this.onPageChanged=this.onPageChanged.bind(this),this.onTextSelected=this.onTextSelected.bind(this),this.onHtmlDocumentSelectionChanged=this.onHtmlDocumentSelectionChanged.bind(this),this.onApiError=this.onApiError.bind(this),this.beforeUnloadCallback=this.beforeUnloadCallback.bind(this),this.getAnnotations=this.getAnnotations.bind(this),this.openRoutine=this.openRoutine.bind(this),this.print=this.print.bind(this),this.close=this.close.bind(this),this.searchIterator=null,this.store=((e,t)=>{const n=(e,t)=>{const n={};for(const t of Object.keys(e))n[t]=e[t];if(t)for(const e of Object.keys(t))n[e]=t[e];return n},i=(e,t)=>{let n=0;for(;n<e.length;)t=t[e[n++]];return t};function o(e,t,i){const s={};return e.length?(s[e[0]]=e.length>1?o(e.slice(1),t,i[e[0]]):t,n(i,s)):t}const s=(e,t,r)=>{for(const l of Object.keys(r))"function"==typeof r[l]?((s,l)=>{r[s]=s=>{let d=l(s);return"function"==typeof d&&(d=d(i(e,a),r)),d&&d!==(t=i(e,a))&&!d.then&&(a=o(e,n(t,d),a)),d}})(l,r[l]):s(e.concat(l),t[l]=n(t[l]),r[l]=n(r[l]));return r};let a=n(e);return s([],a,n(t))})(at(st),rt);const o={onlyAuthorCanEdit:null!==(i=n.annotation.onlyAuthorCanEdit)&&void 0!==i&&i,viewOnly:n.viewer.general.viewOnly,user:n.viewer.general.user,allowPopups:n.modules.includes(sn),annotationPermissionCallback:n.annotation.annotationPermissionCallback};if(this.pdfViewerApi=new ie(o),!this.pdfViewerApi.setLicenseKey(t))throw new Error("Invalid License");this.element=e,this.element.classList.add("pwv-ViewerCanvas");const s=document.createElement("div");s.classList.add("pwv-canvas-container"),this.element.appendChild(s),this.toolbarElement=document.createElement("div"),this.licenseFeatures.annotate&&(this.toolbarElement.classList.add("pwv-canvas-toolbar"),s.appendChild(this.toolbarElement));const a=document.createElement("div");a.classList.add("pwv-canvas-layers"),s.appendChild(a),this.viewLayersElement=document.createElement("div"),a.appendChild(this.viewLayersElement),s.appendChild(a),this.viewLayers=[],this.modules=[],this.resizeObserver=new ResizeObserver(this.onResize),this.resizeObserver.observe(a),this.pdfViewerApi.addEventListener("firstVisiblePage",this.onFirstVisiblePageChanged),this.pdfViewerApi.addEventListener("lastVisiblePage",this.onLastVisiblePageChanged),this.pdfViewerApi.addEventListener("pageNumber",this.onPageNumberChanged),this.pdfViewerApi.addEventListener("zoom",this.onZoomChanged),this.pdfViewerApi.addEventListener("fitMode",this.onFitModeChanged),this.pdfViewerApi.addEventListener("pageLayoutMode",this.onPageLayoutModeChanged),this.pdfViewerApi.addEventListener("busyState",this.onBusyStateChanged),this.pdfViewerApi.addEventListener("canvasInvalidated",this.onCanvasInvalidated),this.pdfViewerApi.addEventListener("itemCreated",this.onItemCreated),this.pdfViewerApi.addEventListener("itemUpdated",this.onItemUpdated),this.pdfViewerApi.addEventListener("itemDeleted",this.onItemDeleted),this.pdfViewerApi.addEventListener("pageChanged",this.onPageChanged),this.pdfViewerApi.addEventListener("rotation",this.onRotationChanged),this.pdfViewerApi.addEventListener("error",this.onApiError),this.options.viewer.general.promptOnUnsavedChange&&window.addEventListener("beforeunload",this.beforeUnloadCallback),document.addEventListener("selectionchange",this.onHtmlDocumentSelectionChanged),this.canvasEvents=new lt(a),this.canvasEvents.suspend(),this.canvasEvents.addEventListener("pointerdown",this.onCanvasPointerDown),this.canvasEvents.addEventListener("pointermove",this.onCanvasPointerMove),this.canvasEvents.addEventListener("pointerup",this.onCanvasPointerUp),this.canvasEvents.addEventListener("pointerclick",this.onCanvasPointerClick),this.canvasEvents.addEventListener("pointerdblclick",this.onCanvasPointerDblClick),this.canvasEvents.addEventListener("pointerlongpress",this.onCanvasPointerLongPress),this.canvasEvents.addEventListener("pointerstartdrag",this.onCanvasPointerStartDrag),this.canvasEvents.addEventListener("pointerenddrag",this.onCanvasPointerEndDrag),this.canvasEvents.addEventListener("pinch",this.onCanvasPointerPinch),this.viewLayersElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),document.addEventListener("keydown",this.onKeyboardShortcuts,{passive:!1}),g.loadTranslations(this.options.viewer.general.language||"en"),b.setType(this.options.viewer.general.tooltips||"title"),this.options.modules&&this.licenseFeatures.annotate&&this.options.modules.find((e=>e===mt))&&this.options.annotation.options.pdfStampFiles&&this.registerPdfStamps(this.options.annotation.options.pdfStampFiles),requestAnimationFrame((()=>{this.dispatchEvent("appLoaded",!0)}))}get licenseFeatures(){const t=this.pdfViewerApi.getSupportedFeatures();return{annotate:!this.options.viewer.general.viewOnly&&e.LicenseFeature.Annotate===(t&e.LicenseFeature.Annotate),fillFormFields:!this.options.viewer.general.viewOnly&&e.LicenseFeature.FillFormFields===(t&e.LicenseFeature.FillFormFields),pageRotation:!this.options.viewer.general.viewOnly&&e.LicenseFeature.PageRotation===(t&e.LicenseFeature.PageRotation)}}open(e,t,n,i,o){const s=i||{},a=this.viewLayersElement.getBoundingClientRect(),r={width:a.width,height:a.height};return this.openRoutine(this.pdfViewerApi.open,e,t,n,s,o,r)}save(e){const t=new Array;for(let e=0;e<this.modules.length;e++)t.push(this.modules[e].onSave());return new Promise(((n,i)=>{Promise.all(t).then((()=>this.pdfViewerApi.save(e).then((e=>{n(e)})).catch((e=>{i(e)}))))}))}openFDF(e,t,n){return this.open({data:e},[{data:t}],n)}openUri(e,t,n){return this.open({uri:e},[],t)}openFDFUri(e,t,n,i,o){return this.open({uri:e},[{uri:e}],n)}openBlob(e,t){return this.open({data:e},[],t)}openFDFBlob(e,t,n){return this.open({data:e},[{data:t}],n)}saveFile(e){return new Promise(((t,n)=>{const i={};e&&(i.fileType=k.Fdf),this.save(i).then((e=>{e.arrayBuffer().then((e=>{t(new Uint8Array(e))}))}))}))}close(){return this.unRegisterModules(),this.onDocumentClosed(),this.searchIterator&&(this.searchIterator.close(),this.searchIterator=null),this.pdfViewerApi.close()}destroy(){for(this.stopRenderLoop(),this.searchIterator&&this.searchIterator.close(),this.resizeObserver.disconnect(),this.annotTimer&&window.clearTimeout(this.annotTimer),this.eventListeners.clear(),document.removeEventListener("keydown",this.onKeyboardShortcuts),window.removeEventListener("beforeunload",this.beforeUnloadCallback),this.pdfViewerApi.removeEventListener("firstVisiblePage",this.onFirstVisiblePageChanged),this.pdfViewerApi.removeEventListener("lastVisiblePage",this.onLastVisiblePageChanged),this.pdfViewerApi.removeEventListener("pageNumber",this.onPageNumberChanged),this.pdfViewerApi.removeEventListener("zoom",this.onZoomChanged),this.pdfViewerApi.removeEventListener("fitMode",this.onFitModeChanged),this.pdfViewerApi.removeEventListener("pageLayoutMode",this.onPageLayoutModeChanged),this.pdfViewerApi.removeEventListener("busyState",this.onBusyStateChanged),this.pdfViewerApi.removeEventListener("canvasInvalidated",this.onCanvasInvalidated),this.pdfViewerApi.removeEventListener("itemCreated",this.onItemCreated),this.pdfViewerApi.removeEventListener("itemUpdated",this.onItemUpdated),this.pdfViewerApi.removeEventListener("itemDeleted",this.onItemDeleted),this.pdfViewerApi.removeEventListener("pageChanged",this.onPageChanged),this.pdfViewerApi.removeEventListener("rotation",this.onRotationChanged),this.pdfViewerApi.removeEventListener("error",this.onApiError),this.canvasEvents.suspend(),this.canvasEvents.removeEventListener("pointerdown",this.onCanvasPointerDown),this.canvasEvents.removeEventListener("pointermove",this.onCanvasPointerMove),this.canvasEvents.removeEventListener("pointerup",this.onCanvasPointerUp),this.canvasEvents.removeEventListener("pointerclick",this.onCanvasPointerClick),this.canvasEvents.removeEventListener("pointerdblclick",this.onCanvasPointerDblClick),this.canvasEvents.removeEventListener("pointerlongpress",this.onCanvasPointerLongPress),this.canvasEvents.removeEventListener("pointerstartdrag",this.onCanvasPointerStartDrag),this.canvasEvents.removeEventListener("pointerenddrag",this.onCanvasPointerEndDrag),this.canvasEvents.removeEventListener("pinch",this.onCanvasPointerPinch),this.viewLayersElement.removeEventListener("wheel",this.onMouseWheel),this.pdfViewerApi.destroy(),this.viewLayers=[],this.modules=[];this.element.firstChild;)this.element.removeChild(this.element.firstChild)}hasChanges(){return this.pdfViewerApi.hasChanges()}getProductVersion(){return e.Sdk.version}getZoom(){return this.pdfViewerApi.getZoom()}setZoom(e,t){this.pdfViewerApi.setZoom(e,t)}zoomIn(e){const t=this.pdfViewerApi.getZoom();this.pdfViewerApi.setZoom(this.getNextZoomInLevel(t),e)}zoomOut(e){const t=this.pdfViewerApi.getZoom();this.pdfViewerApi.setZoom(this.getNextZoomOutLevel(t),e)}getPageCount(){return this.pdfViewerApi.getPageCount()}getPageNumber(){return this.pdfViewerApi.getPageNumber()}rotatePage(e,t){const{textSelection:n,selectedAnnotationId:i,selectedModuleName:o}=this.store.getState().viewer;if(n){const e=this.viewLayers.find((e=>e instanceof Vt));e&&e.clearSelection()}return i&&this.store.viewer.deselectAnnotation(),o&&this.store.viewer.endModule(o),this.pdfViewerApi.rotatePage(e,t)}setPageNumber(e){if(e<1)e=1;else{const t=this.pdfViewerApi.getPageCount();e>t&&(e=t)}this.pdfViewerApi.setPageNumber(e)}scrollDown(e=100){if(0===e)return;const t=this.pdfViewerApi.getScrollPosition();t.y+=e*window.devicePixelRatio,this.pdfViewerApi.setScrollPosition(t)}scrollUp(e=100){if(0===e)return;const t=this.pdfViewerApi.getScrollPosition();t.y-=e*window.devicePixelRatio,this.pdfViewerApi.setScrollPosition(t)}scrollLeft(e=100){if(0===e)return;const t=this.pdfViewerApi.getScrollPosition();t.x-=e*window.devicePixelRatio,this.pdfViewerApi.setScrollPosition(t)}scrollRight(e=100){if(0===e)return;const t=this.pdfViewerApi.getScrollPosition();t.x+=e*window.devicePixelRatio,this.pdfViewerApi.setScrollPosition(t)}scrollMove(e=0,t=0){if(0===e&&0===t)return;const n=this.pdfViewerApi.getScrollPosition();n.y+=e*window.devicePixelRatio,n.x+=t*window.devicePixelRatio,this.pdfViewerApi.setScrollPosition(n)}nextPage(){const e=this.pdfViewerApi.getPageNumber();e<this.pdfViewerApi.getPageCount()&&this.pdfViewerApi.setPageNumber(e+1)}previousPage(){const e=this.pdfViewerApi.getPageNumber();e>1&&this.pdfViewerApi.setPageNumber(e-1)}getFitMode(){return this.pdfViewerApi.getFitMode()}setFitMode(e){this.pdfViewerApi.setFitMode(e)}getPageLayoutMode(){return this.pdfViewerApi.getPageLayoutMode()}setPageLayoutMode(e){this.pdfViewerApi.setPageLayoutMode(e)}getRotation(){return this.pdfViewerApi.getRotation()}setRotation(e){this.pdfViewerApi.setRotation(e)}renderPage(e,t,n){return this.pdfViewerApi.renderPage(e,t,n)}getDocumentOutline(){return this.getOutlines(null)}goTo(e){this.pdfViewerApi.goTo(e)}updateCanvasSearchState(e){this.store.search.start({caseSensitive:e.caseSensitive,searchString:e.searchString,reverse:!1,useRegex:e.useRegex,wrapSearch:e.wrapSearch})}doSearch(){if(this.store.getState().search,this.searchIterator&&this.searchIterator.match instanceof e.Pdf.Content.TextSelection){const e=this.searchIterator.match.textArea;let t=1;const n=[];for(let i=0;i<e.size;i++){const o=e.get(i);o.pageNumber>t&&(t=o.pageNumber),n.push(o)}this.store.search.updateMatch({match:n,page:t});const i=e.get(0),{bottomLeft:o,bottomRight:s,topRight:a,topLeft:r,pageNumber:l}=i,d=Math.min(o.x,s.x,a.x,r.x),h=Math.min(o.y,s.y,a.y,r.y),c=10,u={pdfX:d-c,pdfY:h-c,pdfW:Math.max(o.x,s.x,a.x,r.x)-d+2*c,pdfH:Math.max(o.y,s.y,a.y,r.y)-h+2*c,page:l};this.pdfViewerApi.goToRectangle(u)}}startSearch(e,t,n,i,o){this.searchIterator&&this.endSearch(),this.searchIterator=this.pdfViewerApi.getSearchIterator(e,t,n,i,o),this.searchIterator&&this.searchIterator.getNext().then((e=>{e?this.doSearch():this.endSearch()}))}nextSearchMatch(){this.searchIterator&&this.searchIterator.getNext().then((e=>{e&&this.doSearch()}))}previousSearchMatch(){if(this.searchIterator)return this.searchIterator.getPrevious().then((e=>{e&&this.doSearch()}))}endSearch(){this.searchIterator&&(this.searchIterator.close(),this.searchIterator=null,this.store.search.clear())}resetViewerMode(){this.store.viewer.setDefaultMode()}getAnnotationsFromPage(e){return new Promise(((t,n)=>{this.pdfViewerApi.getItemsFromPage(e,I.ANNOTATION).then((e=>{this.store.annotations.setPageAnnotations(e),t(e)})).catch((e=>{n(e)}))}))}goToAnnotation(e,t){this.pdfViewerApi.goToRectangle(e.pdfRect),"select"===t&&this.dispatchEvent("itemSelected",e)}print(){this.activateModule("PrintServiceModule",null)}getModules(){return this.modules}activateModule(e,t){const n=this.modules.find((t=>t.name==e));n&&(n.activate(t),this.dispatchEvent("moduleActivated",e))}deactivateModule(e){this.dispatchEvent("moduleActivated",e);const t=this.modules.find((t=>t.name==e));t&&t.deactivate()}getSelectedText(){const{textSelection:e,textSelectionType:t}=this.store.getState().viewer;let n;if(e){const{startPoint:i,endPoint:o}=e;n="rectangular"===t?this.pdfViewerApi.getTextForRectangularSelection(i,o):this.pdfViewerApi.getText(i,o)}return n}addEventListener(e,t){this.eventListeners.has(e)?this.eventListeners.get(e).push(t):this.eventListeners.set(e,[t])}removeEventListener(e,t){if(this.eventListeners.has(e)){let n=this.eventListeners.get(e);n=n.filter((e=>e!==t)),0!==n.length?this.eventListeners.set(e,n):this.eventListeners.delete(e)}}suspendCanvasEvents(){this.canvasEvents.suspend()}resumeCanvasEvents(){this.canvasEvents.resume()}dispatchEvent(e,t){this.eventListeners.has(e)&&this.eventListeners.get(e).forEach((e=>e(t)))}getOutlines(e){return t=this,n=void 0,o=function*(){const t=yield this.pdfViewerApi.getOutlines(e);for(const e of t)if(e.hasDescendants){const t=yield this.getOutlines(e);e.descendants=t}return t},new((i=void 0)||(i=Promise))((function(e,s){function a(e){try{l(o.next(e))}catch(e){s(e)}}function r(e){try{l(o.throw(e))}catch(e){s(e)}}function l(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(a,r)}l((o=o.apply(t,n||[])).next())}));var t,n,i,o}openRoutine(e,...t){return new Promise(((n,i)=>{this.pdfViewerApi.isOpen()&&this.close(),requestAnimationFrame((()=>{e(...t).then((()=>{this.onDocumentOpened(),n({})})).catch((e=>{"The authentication failed due to a wrong password."===e.message?i(new Error("password required")):i(new Error("unsupported file"))}))}))}))}onDocumentOpened(){this.registerModules(),this.documentLoaded=!0,this.element.classList.add("pwv-ViewerCanvas--documentLoaded"),this.dispatchEvent("pageLayoutMode",this.pdfViewerApi.getPageLayoutMode()),this.dispatchEvent("firstVisiblePage",this.pdfViewerApi.getFirstVisiblePage()),this.dispatchEvent("lastVisiblePage",this.pdfViewerApi.getLastVisiblePage()),this.dispatchEvent("pageNumber",this.pdfViewerApi.getPageNumber()),this.dispatchEvent("zoom",this.pdfViewerApi.getZoom());const e=this.viewLayersElement.getBoundingClientRect();this.store.canvas.resize({cssWidth:e.width,cssHeight:e.height}),this.startRenderLoop(),this.store.getState().document,window.setTimeout((()=>{this.canvasEvents.resume(),this.element.classList.add("pwv-ViewerCanvas--documentLoaded")}),100)}onDocumentClosed(){this.canvasEvents.suspend(),this.documentLoaded=!1,this.element.classList.remove("pwv-ViewerCanvas--documentLoaded"),this.stopRenderLoop(),this.store.loadDefaultState()}startRenderLoop(){const e=this.viewLayers,t=this.modules,n=i=>{const o=this.store.getState();if(this.renderLoopRunning){this.store.resetChangedState(),o.viewer.cursorStyleChanged&&(this.viewLayersElement.style.cursor=o.viewer.cursorStyle);for(let t=0;t<e.length&&!1!==e[t].render(i,o);t++);for(let e=0;e<t.length;e++)t[e].render(i,o);requestAnimationFrame(n)}};this.renderLoopRunning=!0,requestAnimationFrame(n)}stopRenderLoop(){this.renderLoopRunning=!1}registerPdfStamps(e){const t=this.options.annotation.options.stamps.filter((e=>e.pdfStampFileName)).reduce((function(e,t){let n=t.pdfStampFileName;return e[n]||(e[n]=0),++e[n],e}),{}),n=e=>{if(t.hasOwnProperty(e.pdfStampFileName)){const t=this.options.annotation.options.stamps.find((t=>t.pdfStampFileName===e.pdfStampFileName&&t.pageNumber===e.pageNumber));t&&(t.thumbnail=e.thumbnail,t.aspectRatio=e.aspectRatio)}else this.options.annotation.options.stamps.push(e)};e.forEach((e=>{const t=be(e.data),i=e.pdfStampFileName?e.pdfStampFileName:"";this.pdfViewerApi.registerPdfStampFile(i,t,n)}))}registerModules(){[bt,Ct,Tt,Vt,yt].forEach((e=>{const t=new e;t.register(this,this.dispatchEvent),this.viewLayers.push(t)}));const e=this.options.modules.filter((({moduleInfo:e})=>(!e.requiredFeatures.annotate||e.requiredFeatures.annotate&&this.licenseFeatures.annotate)&&(!e.requiredFeatures.fillFormFields||e.requiredFeatures.fillFormFields&&this.licenseFeatures.fillFormFields)));e&&e.forEach((e=>{const t=new e;this.modules.push(t);const n=t.register(this.viewLayersElement,this.store,this.pdfViewerApi,this,this.options);n.toolbar&&this.toolbarElement&&this.toolbarElement.appendChild(n.toolbar),n.contextbar&&this.store.viewer.addContextBarItem(n.contextbar)})),this.updateCanvasSize()}unRegisterModules(){this.viewLayers=[],this.store.viewer.clearContextBarItems(),this.toolbarElement.innerHTML="",this.viewLayersElement.innerHTML="",this.modules.splice(0,this.modules.length)}updateViewLayerContext(){const e=window.devicePixelRatio;this.store.canvas.setPixelRatio(e);const t=this.viewLayersElement.getBoundingClientRect(),n=this.pdfViewerApi.getScrollMaxPosition(),i=this.pdfViewerApi.getScrollPosition(),o=t.width*e+(n.x>0?n.x:2*i.x),s=t.height*e+(n.y>0?n.y:2*i.y),a=this.pdfViewerApi.getZoom();this.store.document.resize({zoom:a,devicePixelsHeight:s,devicePixelsWidth:o}),this.store.scroll.scrollChanged({cssLeft:i.x,cssTop:i.y}),this.store.getState();const r={};for(let e=this.pdfViewerApi.getFirstVisiblePage();e<=this.pdfViewerApi.getLastVisiblePage();e++)r[e]=this.pdfViewerApi.getPageScreenRect(e);this.store.document.updatePageRects(r)}onMouseWheel(e){if(0!==e.deltaY)if(e.ctrlKey){e.preventDefault(),e.cancelBubble=!0;const t=this.viewLayersElement.getBoundingClientRect(),n=e.clientX-t.left,i=e.clientY-t.top;e.deltaY<0?this.zoomIn({x:n,y:i}):this.zoomOut({x:n,y:i})}else if(e.shiftKey){e.preventDefault(),e.cancelBubble=!0;const t=e.deltaY>0?100:-100;this.scrollRight(t)}else{e.preventDefault(),e.cancelBubble=!0;const t=e.deltaY>0?100:-100;this.scrollDown(t)}else e.deltaX>0?this.scrollRight():e.deltaX<0?this.scrollLeft():e.deltaZ<0?this.zoomIn():e.deltaZ>0&&this.zoomOut()}transformPointer(e){const t=this.viewLayersElement.getBoundingClientRect();return{cssX:e.clientX-t.left,cssY:e.clientY-t.top,isDown:1===e.buttons,type:e.type}}onCanvasPointerClick(e){const t=this.transformPointer(e);this.store.pointer.update(t),this.store.pointer.setAction("click")}onCanvasPointerDblClick(e){const t=this.transformPointer(e);this.store.pointer.update(t),this.store.pointer.setAction("dblclick")}onCanvasPointerLongPress(e){const t=this.transformPointer(e);this.store.pointer.update(t),this.store.pointer.setAction("longpress")}onCanvasPointerStartDrag(e){this.store.pointer.setAction("startdrag")}onCanvasPointerEndDrag(e){this.store.pointer.setAction("enddrag")}onCanvasPointerPinch(e){const t=this.viewLayersElement.getBoundingClientRect(),n=(e.clientX-t.left)*devicePixelRatio,i=(e.clientY-t.top)*devicePixelRatio,o=this.pdfViewerApi.getZoom();let s=o+e.movementDistance/200*o;const a=this.options.viewer.general.defaultZoomLevels[0],r=this.options.viewer.general.defaultZoomLevels[this.options.viewer.general.defaultZoomLevels.length-1];s<a?s=a:s>r&&(s=r),this.setZoom(s,{x:n,y:i})}onCanvasPointerDown(e){const t=this.transformPointer(e);this.store.pointer.update(t),this.store.startPointer.update(t)}onCanvasPointerUp(e){const t=this.transformPointer(e);this.store.pointer.update(t)}onCanvasPointerMove(e){if(e.buttons<2){const t=this.transformPointer(e);this.store.pointer.update(t)}else 4===e.buttons&&(this.scrollMove(-1*e.movementY,-1*e.movementX),this.store.viewer.setCursorStyle(nt.GRABBING))}onKeyboardShortcuts(e){const t=this.element.getBoundingClientRect();if(t.width+t.height===0)return;let n=!1;e.metaKey&&(n=!0);const{shortcuts:i}=this.options;if(Object.keys(i).length>0){const t=N(e,i);if(!t.length)return;for(const i of t)if(!i[1]||n)switch(i[0]){case"zoomIn":e.preventDefault(),this.zoomIn();break;case"zoomOut":e.preventDefault(),this.zoomOut();break;case"nextPage":e.preventDefault(),this.nextPage();break;case"previousPage":e.preventDefault(),this.previousPage();break;case"scrollDown":e.preventDefault(),this.scrollDown();break;case"scrollUp":e.preventDefault(),this.scrollUp();break;case"scrollLeft":e.preventDefault(),this.scrollLeft();break;case"scrollRight":e.preventDefault(),this.scrollRight();break;case"firstPage":e.preventDefault(),this.setPageNumber(1);break;case"lastPage":e.preventDefault(),this.setPageNumber(this.getPageCount());break;case"releaseSelection":const t=this.store.getState().viewer.mode;if(t===tt.TEXT_SELECTED){e.preventDefault(),e.cancelBubble=!0,this.store.viewer.setTextSelection({selection:null,type:null}),this.store.viewer.setTextSelectionState(null);break}if(t===tt.ANNOTATION_SELECTED){e.preventDefault(),e.cancelBubble=!0,this.store.viewer.deselectAnnotation();break}break;case"copy":if(this.options.viewer.permissions.allowCopyText){const t=document.getSelection();if((null==t?void 0:t.type)&&["Caret","Range"].includes(null==t?void 0:t.type))return;e.preventDefault(),e.cancelBubble=!0,ot(this.getSelectedText()||"")}break;case"copyMac":if(this.options.viewer.permissions.allowCopyText){const t=document.getSelection();if((null==t?void 0:t.type)&&["Caret","Range"].includes(null==t?void 0:t.type))return;e.preventDefault(),e.cancelBubble=!0,ot(this.getSelectedText()||"")}break;case"resetZoom":e.preventDefault(),this.setZoom(1);break;case"fitToPage":e.preventDefault(),this.setFitMode(G.FIT_PAGE);break;case"fitToWidth":e.preventDefault(),this.setFitMode(G.FIT_WIDTH);break;case"rotateView":if(this.options.viewer.permissions.allowRotateView){e.preventDefault();const t=this.getRotation(),n=t>=270?0:t+90;this.setRotation(n)}break;case"cancelEditAnnotation":const{selectedModuleName:n}=this.store.getState().viewer;if(n){this.store.viewer.endModule(n),e.preventDefault();break}}}else if("Escape"===e.key){const{selectedModuleName:e,mode:t}=this.store.getState().viewer;e&&this.store.viewer.endModule(e);const n=t;n===tt.TEXT_SELECTED&&(this.store.viewer.setTextSelection({selection:null,type:null}),this.store.viewer.setTextSelectionState(null)),n===tt.ANNOTATION_SELECTED&&this.store.viewer.deselectAnnotation()}}onResize(e,t){const n=this.viewLayersElement.getBoundingClientRect();0!==n.width&&0!==n.height&&this.updateCanvasSize()}onHtmlDocumentSelectionChanged(){document.getSelection()&&this.store.getState().viewer.mode===tt.TEXT_SELECTED&&(this.store.viewer.setTextSelection({selection:null,type:null}),this.store.viewer.setTextSelectionState(null))}updateCanvasSize(){const e=this.viewLayersElement.getBoundingClientRect(),t=window.devicePixelRatio;this.viewLayers.forEach((n=>{n.resize(e.width,e.height,t)})),this.modules.forEach((t=>{t.resize(e.width,e.height)})),this.store.canvas.resize({cssWidth:e.width,cssHeight:e.height}),this.store.canvas.setCanvasInvalidated(!0)}onCanvasInvalidated(){this.store.canvas.setCanvasInvalidated(!0),this.updateViewLayerContext()}onFirstVisiblePageChanged(e){this.store.document.fistVisiblePageChanged(e),this.maybeGetAnnotations(this.store.getState().document.firstVisiblePage,this.store.getState().document.lastVisiblePage),this.dispatchEvent("firstVisiblePage",e)}onPageNumberChanged(e){this.dispatchEvent("pageNumber",e)}onTextSelected(){var e;this.dispatchEvent("textSelected",null!==(e=this.getSelectedText())&&void 0!==e?e:"")}maybeGetAnnotations(e,t){this.annotTimer&&window.clearTimeout(this.annotTimer),this.annotTimer=window.setTimeout((()=>{this.getAnnotations(e,t)}),100)}getAnnotations(e,t){for(let n=e;n<=t;n++)void 0===this.store.getState().annotations.byPage[n]&&this.pdfViewerApi.getItemsFromPage(n,I.ANNOTATION).then((e=>{this.store.annotations.setPageAnnotations(e)})).catch((e=>{console.warn(e)}))}onLastVisiblePageChanged(e){this.store.document.lastVisiblePageChanged(e),this.maybeGetAnnotations(this.store.getState().document.firstVisiblePage,this.store.getState().document.lastVisiblePage),this.dispatchEvent("lastVisiblePage",e)}onZoomChanged(e){this.dispatchEvent("zoom",e)}onFitModeChanged(e){this.store.document.fitModeChanged(e),this.dispatchEvent("fitMode",e)}onPageLayoutModeChanged(e){this.store.document.pageLayoutModeChanged(e),this.dispatchEvent("pageLayoutMode",e)}onBusyStateChanged(e){this.store.document.busyStateChanged(e),e?this.element.classList.remove("pwv-ViewerCanvas--documentIdle"):this.element.classList.add("pwv-ViewerCanvas--documentIdle"),this.dispatchEvent("busyState",e)}onRotationChanged(e){this.store.document.rotationChanged(e),this.dispatchEvent("rotation",e)}onItemCreated(e){e.itemCategory===I.ANNOTATION&&this.store.annotations.addAnnotation(e),this.dispatchEvent("itemCreated",e)}onItemUpdated(e){e.itemCategory===I.ANNOTATION&&this.store.annotations.updateAnnotation(e),this.dispatchEvent("itemUpdated",e)}onItemDeleted(e){e.categoryType===I.ANNOTATION&&this.store.annotations.deleteAnnotation(e.id),this.dispatchEvent("itemDeleted",e)}onPageChanged(e){this.pdfViewerApi.getItemsFromPage(e,I.ANNOTATION).then((t=>{t.items.forEach((e=>{this.store.annotations.updateAnnotation(e)})),this.dispatchEvent("pageChanged",e)}))}onApiError(e){console.error("//// PdfViewerApi Error: ",e),this.dispatchEvent("error",e)}beforeUnloadCallback(e){const t=this.pdfViewerApi.hasChanges();null!==t&&t!==Y.NONE&&(e.preventDefault(),e.returnValue="")}getNextZoomOutLevel(e){for(var t=this.options.viewer.general.defaultZoomLevels.length-1;t>=0;t--)if(e>this.options.viewer.general.defaultZoomLevels[t])return this.options.viewer.general.defaultZoomLevels[t];return this.options.viewer.general.defaultZoomLevels[0]}getNextZoomInLevel(e){for(var t=0;t<this.options.viewer.general.defaultZoomLevels.length;t++)if(e<this.options.viewer.general.defaultZoomLevels[t])return this.options.viewer.general.defaultZoomLevels[t];return this.options.viewer.general.defaultZoomLevels[this.options.viewer.general.defaultZoomLevels.length-1]}}const Fn={clear:()=>e=>({password:"",passwordRequiredError:!1,invalidPasswordError:!1}),updatePassword:e=>t=>Object.assign(Object.assign({},t),{password:e}),validateForm:()=>e=>Object.assign(Object.assign({},e),{invalidPasswordError:!1,passwordRequiredError:""===e.password}),setInvalidPasswordError:()=>e=>Object.assign(Object.assign({},e),{invalidPasswordError:!0})},Bn={clear:()=>e=>Object.assign(Object.assign({},e),{outlineItemsLoaded:!1,pages:[],outlines:[],annotations:[]}),setThumbnailPlaceholders:e=>t=>{const n=[];for(let t=0;t<e;t++)n.push({thumbnail:null,loading:null,pageNumber:t+1});return Object.assign(Object.assign({},t),{pages:n})},updateThumbnail:e=>t=>Object.assign(Object.assign({},t),{pages:t.pages.map((t=>t.pageNumber===e.pageNumber?e:t))}),setOutlines:e=>t=>Object.assign(Object.assign({},t),{outlineItemsLoaded:!0,outlines:e}),toggleNavigationPanel:()=>e=>Object.assign(Object.assign({},e),{showNavigation:!e.showNavigation}),showNavigationPanel:()=>e=>Object.assign(Object.assign({},e),{showNavigation:!0}),hideNavigationPanel:()=>e=>Object.assign(Object.assign({},e),{showNavigation:!1}),selectNavigation:e=>t=>Object.assign(Object.assign({},t),{showNavigation:!0,selectedNavigation:e}),toggleOutlineItem:e=>t=>{const n=Object.assign({},t);let i={descendants:n.outlines,open:!1};return e.forEach((e=>{const t=i.descendants.find((t=>t.id.toString()===e));t&&(i=t)})),i.open=!i.open,n},clearAnnotations:()=>e=>Object.assign(Object.assign({},e),{annotations:{},selectedAnnotation:void 0,annotationsLoaded:!1}),setAnnotationLoaded:()=>e=>Object.assign(Object.assign({},e),{annotationsLoaded:!0}),initAnnotations:e=>t=>{const n={};for(let t=1;t<=e;t++)n[t]={};return Object.assign(Object.assign({},t),{annotations:n})},setPageAnnotations:e=>t=>{const n={};return e.items.forEach((e=>{const t=e;n[t.id]=t})),Object.assign(Object.assign({},t),{annotations:Object.assign(Object.assign({},t.annotations),{[e.page]:n})})},updateAnnotation:e=>t=>{const n=e.pdfRect.page,i=e.id,o=t.annotations[n]?Object.assign({},t.annotations[n]):{};return o[i]=e,Object.assign(Object.assign({},t),{annotations:Object.assign(Object.assign({},t.annotations),{[n]:o})})},deleteAnnotation:e=>t=>{const n=e.page,i=e.id,o=t.annotations[n];return o?(delete o[i],Object.assign(Object.assign({},t),{annotations:Object.assign(Object.assign({},t.annotations),{[n]:o})})):Object.assign({},t)},selectAnnotation:e=>t=>Object.assign(Object.assign({},t),{selectedAnnotation:{page:e.pdfRect.page,annotationId:e.id}}),deselectAnnotation:()=>e=>Object.assign(Object.assign({},e),{selectedAnnotation:void 0})},jn={filename:"",mimetype:"",hasChanges:!1,zoom:100,fitMode:G.NONE,pageLayoutMode:W.ONE_COLUMN,firstVisiblePage:0,lastVisiblePage:0,pageNumber:0,pageCount:0},zn={setZoom:e=>t=>Object.assign(Object.assign({},t),{zoom:e}),setFitMode:e=>t=>Object.assign(Object.assign({},t),{fitMode:e}),setPageLayoutMode:e=>t=>Object.assign(Object.assign({},t),{pageLayoutMode:e}),setHasChanges:e=>t=>Object.assign(Object.assign({},t),{hasChanges:e}),setFirstVisiblePage:e=>t=>{const n=e<=1?1:e<t.pageCount?e:t.pageCount;return Object.assign(Object.assign({},t),{firstVisiblePage:n})},setLastVisiblePage:e=>t=>{const n=e<=1?1:e<t.pageCount?e:t.pageCount;return Object.assign(Object.assign({},t),{lastVisiblePage:n})},setPageNumber:e=>t=>{let n;return n=0===t.pageCount?e:e=e<=1?1:e<t.pageCount?e:t.pageCount,Object.assign(Object.assign({},t),{pageNumber:n})},setPageCount:e=>t=>Object.assign(Object.assign({},t),{pageCount:e}),setFileInfo:e=>t=>Object.assign(Object.assign({},t),{filename:e.sourceTag,mimetype:"application/pdf"})},Hn={updateToSearch:e=>t=>Object.assign(Object.assign({},t),{searchString:e}),openSearch:()=>e=>Object.assign(Object.assign({},e),{showSearch:!0}),closeSearch:()=>e=>Object.assign(Object.assign({},e),{searchString:"",showSearch:!1}),toggleCaseSensitive:()=>e=>Object.assign(Object.assign({},e),{caseSensitive:!e.caseSensitive}),toggleWrappingSearch:()=>e=>Object.assign(Object.assign({},e),{wrapSearch:!e.wrapSearch}),toggleRegex:()=>e=>Object.assign(Object.assign({},e),{useRegex:!e.useRegex}),setCaseSensitive:e=>t=>Object.assign(Object.assign({},t),{caseSensitive:e}),setWrappingSearch:e=>t=>Object.assign(Object.assign({},t),{wrapSearch:e}),setRegex:e=>t=>Object.assign(Object.assign({},t),{useRegex:e})};class Gn{constructor(){this.localStorageAccessible=!1;let e=null;try{e=localStorage.getItem("PDFToolsAG.ViewerSettings"),this.localStorageAccessible=!0}catch(e){console.warn("local storage not accessible")}try{this.toolSettings=e?JSON.parse(e):{}}catch(e){this.toolSettings={}}this.save=this.save.bind(this),this.getItem=this.getItem.bind(this),this.setItem=this.setItem.bind(this)}save(){if(this.localStorageAccessible){const e=JSON.stringify(this.toolSettings);localStorage.setItem("PDFToolsAG.ViewerSettings",e)}}getItem(e,t){return this.localStorageAccessible&&this.toolSettings.hasOwnProperty(e)?this.toolSettings[e]:t}setItem(e,t){this.localStorageAccessible&&(this.toolSettings[e]=t,this.save())}}const Wn={highlightColors:["#2ADB1A","#FFEA02","#FF7F1F","#FF2882","#008AD1"],foregroundColors:["#323232","#FFFFFF","#FFEA02","#2ADB1A","#0066CC","#D82F32"],backgroundColors:["#FFFFFF","#FCF5E2","#323232","#FFEA02","#D82F32","#0066CC"],defaultHighlightColor:"#FFEA02",defaultBackgroundColor:"#FCF5E2",defaultForegroundColor:"#323232"},_n={fontFamilies:["Helvetica","Times","Courier","Symbol","ZapfDingbats"],fontSizes:[9,10,12,14,16,18,20,24],defaultFontFamily:"Helvetica",defaultFontSize:12},Un=[{translation_key:"stamptext.approved",color:B.GREEN},{translation_key:"stamptext.notApproved",color:B.RED},{translation_key:"stamptext.draft",color:B.BLUE},{translation_key:"stamptext.final",color:B.GREEN},{translation_key:"stamptext.completed",color:B.GREEN},{translation_key:"stamptext.confidential",color:B.BLUE},{translation_key:"stamptext.forPublic",color:B.BLUE},{translation_key:"stamptext.notForPublic",color:B.BLUE},{translation_key:"stamptext.void",color:B.RED},{translation_key:"stamptext.forComment",color:B.BLUE},{translation_key:"stamptext.preliminaryResults",color:B.BLUE},{translation_key:"stamptext.informationOnly",color:B.BLUE}],Xn={colors:Wn,stamps:Un,fonts:_n,highlightOpacity:.5,strokeWidths:[0,1,2,3,5,8,13,21],defaultStampWidth:120,defaultBorderWidth:1,eraserRadius:5,hideAnnotationSubject:!1,trackHistory:!1,onlyAuthorCanEdit:!1,hideOnDelete:!1,selectedStamp:0},Yn={user:"",language:"en",annotationBarPosition:"left",promptOnUnsavedChange:!0,searchMatchColor:"#3ABCFF",textSelectionColor:"#006395",rectangularTextSelection:"none",pageShadow:{shadowBlur:4,shadowColor:"rgba(90,90,90,0.2)",shadowOffsetX:0,shadowOffsetY:0},pageLayoutModes:[W.ONE_COLUMN,W.SINGLE_PAGE,W.TWO_COLUMN_LEFT,W.TWO_COLUMN_RIGHT,W.TWO_PAGE_LEFT,W.TWO_PAGE_RIGHT],defaultZoomLevels:[.1,.15,.2,.25,.35,.4,.5,.65,.8,1,1.25,1.5,2,2.5,3,4],tooltips:"title",viewOnly:!1,disableMainToolbar:!1,disableAnnotationToolbar:!1,hidePasswordFormCancelButton:!1},Kn={zoomIn:{key:"+"},zoomOut:{key:"-"},nextPage:{key:"PageDown"},previousPage:{key:"PageUp"},firstPage:{key:"Home"},lastPage:{key:"End"},scrollUp:{key:"ArrowUp"},scrollDown:{key:"ArrowDown"},scrollLeft:{key:"ArrowLeft"},scrollRight:{key:"ArrowRight"},releaseSelection:{key:"Escape"},copy:{key:"c",ctrlKey:!0},copyMac:{key:"c",superKey:!0},print:{key:"p",ctrlKey:!0},cancelPrint:{key:"Escape"},resetZoom:{key:"z",altKey:!0},fitToPage:{key:"p",altKey:!0},fitToWidth:{key:"w",altKey:!0},rotateView:{key:"r",altKey:!0},save:{key:"s",ctrlKey:!0},search:{key:"f",ctrlKey:!0},searchNext:{key:"F3"},searchPrevious:{key:"F3",shiftKey:!0},closeSearch:{key:"Escape"},toggleSidePane:{key:"s",altKey:!0},showAnnotations:{key:"a",altKey:!0},showOutline:{key:"o",altKey:!0},showThumbnails:{key:"t",altKey:!0},cancelEditAnnotation:{key:"Escape"}},Zn={annotationNavigation:!0,thumbnailNavigation:!0,outlineNavigation:!0},qn={enabled:!0},$n={allowOpenFile:!0,allowCloseFile:!1,allowFileDrop:!0,allowPrinting:!1,allowSaveFile:!0,allowCopyText:!0,allowRotateView:!0,allowLockAnnotations:!0,allowEditLockedAnnotations:!1,allowRotatePages:!0,allowExternalLinks:!0,enablePageLayoutMode:!0,enableSearch:!0},Qn={general:Yn,sidebar:Zn,permissions:$n,callbacks:{},customButtons:{annotationbar:[],documentbar:[],informationbar:[]}},Jn=[sn,ln,en,Pn,Ht,Yt,mt,vn,dn],ei={viewer:Qn,modules:Jn,annotation:Xn,forms:qn,shortcuts:Kn},ti={defaultHighlightAnnotationColor:"highlightColors",defaultFreetextBgColor:"backgroundColors",defaultFreetextFontColor:"foregroundColors",defaultFreetextFontFamily:"fontFamilies",defaultFreetextFontSize:"fontSizes",defaultInkColor:"foregroundColors",defaultStickyNoteColor:"highlightColors",defaultBackgroundColor:"backgroundColors",defaultForegroundColor:"foregroundColors",defaultHighlightColor:"highlightColors",defaultFontSize:"fontSizes"},ni={highlightColors:"defaultHighlightColor",backgroundColors:"defaultBackgroundColor",foregroundColors:"defaultForegroundColor"};class ii{constructor(){this.internalStorage=new Gn}get storage(){return this.internalStorage}}class oi extends ii{constructor(e){super(),this.options=Object.assign(Object.assign({},Yn),e)}get user(){return this.options.user}get language(){return this.options.language}get annotationBarPosition(){return this.options.annotationBarPosition}set annotationBarPosition(e){this.storage.setItem("annotationBarPosition",e)}get promptOnUnsavedChange(){return this.options.promptOnUnsavedChange}get textSelectionColor(){return this.options.textSelectionColor}get rectangularTextSelection(){return this.options.rectangularTextSelection}get searchMatchColor(){return this.options.searchMatchColor}get pageLayoutModes(){return this.options.pageLayoutModes}get defaultZoomLevels(){return this.options.defaultZoomLevels}get pageShadow(){return this.options.pageShadow}get currentPageShadow(){return this.options.currentPageShadow}get viewOnly(){return this.options.viewOnly}get tooltips(){return this.options.tooltips}get disableMainToolbar(){return this.options.disableMainToolbar}get disableAnnotationToolbar(){return this.options.disableAnnotationToolbar}get hidePasswordFormCancelButton(){return this.options.hidePasswordFormCancelButton}}class si{constructor(e){this.options=Object.assign(Object.assign({},Zn),e)}get thumbnailNavigation(){return this.options.thumbnailNavigation}get outlineNavigation(){return this.options.outlineNavigation}get annotationNavigation(){return this.options.annotationNavigation}}class ai{constructor(e){this.options=Object.assign(Object.assign({},qn),e)}get enabled(){return this.options.enabled}}class ri{constructor(e){var t,n,i,o,s,a;this.options={general:Object.assign(Object.assign({},Qn.general),null==e?void 0:e.general),sidebar:Object.assign(Object.assign({},Qn.sidebar),null==e?void 0:e.sidebar),permissions:Object.assign(Object.assign({},Qn.permissions),null==e?void 0:e.permissions),callbacks:Object.assign(Object.assign({},Qn.callbacks),null==e?void 0:e.callbacks),customButtons:{annotationbar:(null===(t=null==e?void 0:e.customButtons)||void 0===t?void 0:t.annotationbar)?null===(n=null==e?void 0:e.customButtons)||void 0===n?void 0:n.annotationbar:[],documentbar:(null===(i=null==e?void 0:e.customButtons)||void 0===i?void 0:i.documentbar)?null===(o=null==e?void 0:e.customButtons)||void 0===o?void 0:o.documentbar:[],informationbar:(null===(s=null==e?void 0:e.customButtons)||void 0===s?void 0:s.informationbar)?null===(a=null==e?void 0:e.customButtons)||void 0===a?void 0:a.informationbar:[]}},this.generalOptions=new oi(null==e?void 0:e.general)}get general(){return this.generalOptions}get sidebar(){return this.options.sidebar}get permissions(){return this.options.permissions}get callbacks(){return this.options.callbacks}get customButtons(){return this.options.customButtons}}class li extends ii{constructor(e){super(),this.options=Object.assign(Object.assign({},Wn),e)}get highlightColors(){return this.options.highlightColors}get foregroundColors(){return this.options.foregroundColors}get backgroundColors(){return this.options.backgroundColors}get defaultHighlightColor(){return this.options.defaultHighlightColor}get defaultForegroundColor(){return this.options.defaultForegroundColor}get defaultBackgroundColor(){return this.options.defaultBackgroundColor}get highlightAnnotationColor(){return this.storage.getItem("highlightAnnotationColor",this.defaultHighlightColor)}set highlightAnnotationColor(e){this.storage.setItem("highlightAnnotationColor",e)}get stickyNoteColor(){return this.storage.getItem("stickyNoteColor",this.options.defaultHighlightColor)}set stickyNoteColor(e){this.storage.setItem("stickyNoteColor",e)}get freetextBackgroundColor(){return this.storage.getItem("freetextBackgroundColor",this.defaultBackgroundColor)}set freetextBackgroundColor(e){this.storage.setItem("freetextBackgroundColor",e)}set freetextFontColor(e){this.storage.setItem("freetextFontColor",e)}get freetextFontColor(){return this.storage.getItem("freetextFontColor",this.options.defaultForegroundColor)}get inkColor(){return this.storage.getItem("inkColor",this.options.defaultForegroundColor)}set inkColor(e){this.storage.setItem("inkColor",e)}get inkOpacity(){return this.storage.getItem("inkOpacity",100)}set inkOpacity(e){this.storage.setItem("inkOpacity",e)}set shapeColor(e){this.storage.setItem("shapeAnnotationColor",e)}get shapeColor(){return this.storage.getItem("shapeAnnotationColor",this.options.defaultForegroundColor)}set shapeFillColor(e){this.storage.setItem("shapeFillColor",e)}get shapeFillColor(){return this.storage.getItem("shapeFillColor",this.defaultHighlightColor)}}class di extends ii{constructor(e){super(),this.options=Object.assign(Object.assign({},_n),e)}get fontFamilies(){return this.options.fontFamilies}get fontSizes(){return this.options.fontSizes}get defaultFontFamily(){return this.options.defaultFontFamily}get defaultFontSize(){return this.options.defaultFontSize}get freetextFontSize(){return this.storage.getItem("freetextFontSize",this.defaultFontSize)}set freetextFontSize(e){this.storage.setItem("freetextFontSize",e)}get freetextFontFamily(){return this.storage.getItem("freetextFontFamily",this.defaultFontFamily)}set freetextFontFamily(e){this.storage.setItem("freetextFontFamily",e)}}class hi extends ii{constructor(e){super(),this.options=Object.assign(Object.assign({},Xn),e),this.colorOptions=new li(null==e?void 0:e.colors),this.fontOptions=new di(null==e?void 0:e.fonts)}get stamps(){return this.options.stamps}get colors(){return this.colorOptions}get fonts(){return this.fontOptions}get highlightOpacity(){return this.options.highlightOpacity}get strokeWidths(){return this.options.strokeWidths}set shapeStrokeWidth(e){this.storage.setItem("shapeStrokeWidth",e)}get shapeStrokeWidth(){return this.storage.getItem("shapeStrokeWidth",this.options.defaultBorderWidth)}set shapeStrokeStyle(e){this.storage.setItem("shapeStrokeStyle",e)}get shapeStrokeStyle(){return this.storage.getItem("shapeStrokeStyle",0)}set inkWidth(e){this.storage.setItem("inkWidth",e)}get inkWidth(){return this.storage.getItem("inkWidth",this.options.defaultBorderWidth)}set freetextBorderWidth(e){this.storage.setItem("freetextBorderWidth",e)}get freetextBorderWidth(){return this.storage.getItem("freetextBorderWidth",this.options.defaultBorderWidth)}get defaultBorderWidth(){return this.options.defaultBorderWidth}get defaultStampWidth(){return this.options.defaultStampWidth}get hideOnDelete(){return this.options.hideOnDelete}get trackHistory(){return this.options.trackHistory}get hideAnnotationSubject(){return this.options.hideAnnotationSubject}get onlyAuthorCanEdit(){return this.options.onlyAuthorCanEdit}get annotationPermissionCallback(){return this.options.annotationPermissionCallback}get selectedStamp(){return this.storage.getItem("selectedStamp",0)}set selectedStamp(e){this.storage.setItem("selectedStamp",e)}set eraserRadius(e){this.storage.setItem("eraserRadius",e)}get eraserRadius(){return this.storage.getItem("eraserRadius",5)}}class ci{constructor(e){var t,n,i;const o=Object.assign(Object.assign({},ei),e);o.modules.find((e=>e===En))||null===(t=o.modules)||void 0===t||t.push(En),(null===(n=o.forms)||void 0===n?void 0:n.enabled)&&!o.modules.find((e=>e===kn))&&(null===(i=o.modules)||void 0===i||i.push(kn)),null===(null==e?void 0:e.shortcuts)?o.shortcuts={}:o.shortcuts=Object.assign(Object.assign({},ei.shortcuts),null==e?void 0:e.shortcuts),this.options=o,this.viewerOptions=new ri(o?o.viewer:o),this.annotationOptions=new hi(o?o.annotation:o),this.formsOptions=new ai(o?o.forms:o)}get viewer(){return this.viewerOptions}get annotation(){return this.annotationOptions}get forms(){return this.formsOptions}get modules(){return this.options.modules}set modules(e){this.options.modules=e}get shortcuts(){return this.options.shortcuts}}const ui={licenseFeatures:{annotate:!1,fillFormFields:!1,pageRotation:!1},scriptsLoaded:!1,appInitialized:!1,fileDropEnabled:!1,hasDocument:!1,showPasswordForm:!1,passwordDialogTempPdfFile:null,passwordDialogTempFdfFile:null,showOpenFileErrorDialog:!1,showUnsavedChangesDialog:!1,fileOpenArgs:null,unsavedChangesDialogDontSave:!1,showLoadingIndicator:!1,showSaveIndicator:!1,hasError:!1,errorMessage:"",layout:l,passwordForm:{password:"",passwordRequiredError:!1,invalidPasswordError:!1},navigationPanel:{showNavigation:!1,selectedNavigation:"thumbnail",outlineItemsLoaded:!1,annotationsLoaded:!1,pages:[],outlines:[],annotations:{}},pdfDocument:jn,search:{showSearch:!1,searchString:"",caseSensitive:!1,wrapSearch:!1,useRegex:!1,page:1,match:null,painted:!1},options:ei,canvasModules:[],closeCallback:void 0},pi={layout:d,passwordForm:Fn,navigationPanel:Bn,pdfDocument:zn,search:Hn,loadScriptsCompleted:()=>e=>Object.assign(Object.assign({},e),{scriptsLoaded:!0}),initializeAppFulfilled:e=>t=>Object.assign(Object.assign({},t),{licenseFeatures:e.licenseFeatures,appInitialized:!0,fileDropEnabled:!0}),initializeAppRejected:e=>t=>Object.assign(Object.assign({},t),{hasError:!0,errorMessage:e,appInitialized:!0}),setCanvasModules:e=>t=>Object.assign(Object.assign({},t),{canvasModules:e}),loadDocumentBegin:()=>e=>Object.assign(Object.assign({},e),{fileDropEnabled:!1,showLoadingIndicator:!0,unsavedChangesDialogDontSave:!1}),loadDocumentFulfilled:()=>e=>Object.assign(Object.assign({},e),{hasDocument:!0,fileDropEnabled:!0,showPasswordForm:!1,passwordDialogTempPdfFile:null,showLoadingIndicator:!1}),loadDocumentCancel:()=>e=>Object.assign(Object.assign({},e),{hasDocument:!1,fileDropEnabled:!0,showPasswordForm:!1,passwordDialogTempPdfFile:null,showLoadingIndicator:!1}),loadDocumentRejected:e=>e=>Object.assign(Object.assign({},e),{fileDropEnabled:!1,passwordDialogTempPdfFile:null,showPasswordForm:!1,showLoadingIndicator:!1,showOpenFileErrorDialog:!0}),loadDocumentConfirmRejected:()=>e=>Object.assign(Object.assign({},e),{fileDropEnabled:!0,showOpenFileErrorDialog:!1}),loadDocumentPasswordForm:e=>t=>(t.passwordForm.invalidPasswordError=!!e.password&&e.password.length>0,Object.assign(Object.assign({},t),{fileOpenArgs:e,showPasswordForm:!0,showLoadingIndicator:!1})),closeDocument:()=>e=>Object.assign(Object.assign({},JSON.parse(JSON.stringify(ui))),{appInitialized:!0,scriptsLoaded:!0,fileDropEnabled:!0,options:e.options,licenseFeatures:e.licenseFeatures}),showConfirmUnsavedChangesDialog:(e,t)=>n=>Object.assign(Object.assign({},n),{fileOpenArgs:e,closeCallback:t,showUnsavedChangesDialog:!0}),unsavedChangesDialogCancel:()=>e=>Object.assign(Object.assign({},e),{showUnsavedChangesDialog:!1,showLoadingIndicator:!1,hasDocument:!0,closeCallback:void 0}),unsavedChangesDialogFileSaved:()=>e=>Object.assign(Object.assign({},e),{unsavedChangesDialogTempPdfFile:null,unsavedChangesDialogTempFdfFile:null,showUnsavedChangesDialog:!1,closeCallback:void 0}),unsavedChangesDialogDontSave:()=>e=>Object.assign(Object.assign({},e),{unsavedChangesDialogDontSave:!1,showUnsavedChangesDialog:!1,hasDocument:!1}),saveDocumentBegin:e=>e=>Object.assign(Object.assign({},e),{showSaveIndicator:!0}),saveDocumentFulfilled:e=>e=>Object.assign(Object.assign({},e),{showSaveIndicator:!1}),saveDocumentRejected:e=>t=>Object.assign(Object.assign({},t),{hasError:!0,errorMessage:e,appInitialized:!0,showSaveIndicator:!1}),setError:e=>t=>Object.assign(Object.assign({},t),{hasError:!0,errorMessage:e}),getState:()=>e=>Object.assign({},e),open:e=>e=>Object.assign({},e)};class gi{constructor(e,t,n){if(this.visiblePageRange={firstPage:0,lastPage:0},this.eventListeners=new Map,this.loadThumbnailsQueue=[],this.loadPageThumbnailsTimer=null,this.metadata={version:"4.3.6",type:"stable"},!e)throw{error:"PdfWebViewer container element is null"};this.licenseKey=t,this.element=e,this.options=new ci(n),n&&this.verifyOptions(n,this.options),this.handleKeyboardShortcuts=this.handleKeyboardShortcuts.bind(this),this.createView=this.createView.bind(this),this.loadPageThumbnails=this.loadPageThumbnails.bind(this),this.loadDocumentOutlines=this.loadDocumentOutlines.bind(this),this.handleAppLoaded=this.handleAppLoaded.bind(this),this.handleResize=this.handleResize.bind(this),this.getScreenSize=this.getScreenSize.bind(this),this.handleDocumentOpened=this.handleDocumentOpened.bind(this),this.handleDocumentClosed=this.handleDocumentClosed.bind(this),this.handleFirstVisiblePageChanged=this.handleFirstVisiblePageChanged.bind(this),this.handleLastVisiblePageChanged=this.handleLastVisiblePageChanged.bind(this),this.handlePageNumberChanged=this.handlePageNumberChanged.bind(this),this.handleZoomChanged=this.handleZoomChanged.bind(this),this.handleRotationChanged=this.handleRotationChanged.bind(this),this.handleFitModeChanged=this.handleFitModeChanged.bind(this),this.handlePageLayoutModeChanged=this.handlePageLayoutModeChanged.bind(this),this.handleBusyStateChanged=this.handleBusyStateChanged.bind(this),this.handlePageChanged=this.handlePageChanged.bind(this),this.handleTextSelected=this.handleTextSelected.bind(this),this.handleError=this.handleError.bind(this),this.addPagesToThumbnailsQueue=this.addPagesToThumbnailsQueue.bind(this),this.handleAnnotationCreated=this.handleAnnotationCreated.bind(this),this.handleAnnotationUpdated=this.handleAnnotationUpdated.bind(this),this.handleAnnotationDeleted=this.handleAnnotationDeleted.bind(this),this.handleAnnotationSelected=this.handleAnnotationSelected.bind(this),this.handleAnnotationDeselected=this.handleAnnotationDeselected.bind(this),this.showUnconfirmedChangesDialog=this.showUnconfirmedChangesDialog.bind(this),document.addEventListener("keydown",this.handleKeyboardShortcuts,!1),new ResizeObserver(this.handleResize).observe(this.element),b.setType(this.options.viewer.general.tooltips||"title");const i=(e=>{const t=Object.assign(Object.assign({},JSON.parse(JSON.stringify(ui))),{options:e}),{sidebar:n}=e.viewer;return n.selectedNavigation?(t.navigationPanel.selectedNavigation=n.selectedNavigation,t.navigationPanel.showNavigation=!0):n.thumbnailNavigation||(t.navigationPanel.selectedNavigation=n.outlineNavigation?"outline":"annotation"),t})(this.options);i.layout.deviceType=/iPhone|iPad|iPod|Android|mobile/i.test(navigator.userAgent)?a.Mobile:a.Desktop,i.layout.screenSize=this.getScreenSize(),this.view=this.createView(o)(i,pi,We,this.element)}open(e,t,n,i,o){var s;null===(s=this.view)||void 0===s||s.api.open({pdfFile:e,fdfFiles:t,password:n,viewOptions:i,renderOptions:o})}openFile(e,t,n){let i;"string"==typeof e?(i={uri:e},n&&(i.httpOptions={headers:{Authorization:n}})):i={data:e},this.open(i,null,t)}openFDF(e,t,n,i,o){let s;"string"==typeof e?(s={uri:e},i&&(s.httpOptions={headers:{Authorization:i}})):s={data:e};const a="string"==typeof t?{uri:t}:{data:t};this.open(s,[a],n)}save(e){return this.viewerCanvas?this.viewerCanvas.save(e):null}saveFile(e){return new Promise(((t,n)=>{var i;const o=e?k.Fdf:k.Pdf;null===(i=this.save({fileType:o}))||void 0===i||i.then((e=>{t(e.arrayBuffer())}))}))}downloadFile(e){if(this.view)return this.view.api.downloadFile(e)}close(){if(this.view)return this.view.api.close()}destroy(){var e;for(document.removeEventListener("keydown",this.handleKeyboardShortcuts,!1),this.eventListeners.clear(),this.viewerCanvas&&(this.viewerCanvas.removeEventListener("appLoaded",this.handleAppLoaded),this.viewerCanvas.removeEventListener("firstVisiblePage",this.handleFirstVisiblePageChanged),this.viewerCanvas.removeEventListener("lastVisiblePage",this.handleLastVisiblePageChanged),this.viewerCanvas.removeEventListener("pageNumber",this.handlePageNumberChanged),this.viewerCanvas.removeEventListener("zoom",this.handleZoomChanged),this.viewerCanvas.removeEventListener("fitMode",this.handleFitModeChanged),this.viewerCanvas.removeEventListener("pageLayoutMode",this.handlePageLayoutModeChanged),this.viewerCanvas.removeEventListener("busyState",this.handleBusyStateChanged),this.viewerCanvas.removeEventListener("rotation",this.handleRotationChanged),this.viewerCanvas.removeEventListener("pageChanged",this.handlePageChanged),this.viewerCanvas.removeEventListener("error",this.handleError),this.viewerCanvas.removeEventListener("itemCreated",this.handleAnnotationCreated),this.viewerCanvas.removeEventListener("itemUpdated",this.handleAnnotationUpdated),this.viewerCanvas.removeEventListener("itemDeleted",this.handleAnnotationDeleted),this.viewerCanvas.removeEventListener("itemSelected",this.handleAnnotationSelected),this.viewerCanvas.removeEventListener("itemDeselected",this.handleAnnotationDeselected)),null===(e=this.viewerCanvas)||void 0===e||e.destroy(),this.viewerCanvas=void 0,this.view=void 0,this.loadThumbnailsQueue=[],this.loadPageThumbnailsTimer&&clearTimeout(this.loadPageThumbnailsTimer);this.element.firstChild;)this.element.removeChild(this.element.firstChild)}getPageCount(){return this.viewerCanvas?this.viewerCanvas.getPageCount():null}getPageNumber(){return this.viewerCanvas?this.viewerCanvas.getPageNumber():null}setPageNumber(e){this.viewerCanvas&&this.viewerCanvas.setPageNumber(e)}rotatePage(e,t){this.viewerCanvas&&this.viewerCanvas.rotatePage(e,t)}nextPage(){this.viewerCanvas&&this.viewerCanvas.nextPage()}previousPage(){this.viewerCanvas&&this.viewerCanvas.previousPage()}getZoom(){return this.viewerCanvas?this.viewerCanvas.getZoom():null}setZoom(e){this.viewerCanvas&&this.viewerCanvas.setZoom(e)}zoomIn(){var e;null===(e=this.viewerCanvas)||void 0===e||e.zoomIn()}zoomOut(){var e;null===(e=this.viewerCanvas)||void 0===e||e.zoomOut()}getFitMode(){return this.viewerCanvas?this.viewerCanvas.getFitMode():null}setFitMode(e){this.viewerCanvas&&this.viewerCanvas.setFitMode(e)}getPageLayoutMode(){return this.viewerCanvas?this.viewerCanvas.getPageLayoutMode():null}setPageLayoutMode(e){this.viewerCanvas&&this.viewerCanvas.setPageLayoutMode(e)}getRotation(){return this.viewerCanvas?this.viewerCanvas.getRotation():null}setRotation(e){this.viewerCanvas&&this.viewerCanvas.setRotation(e)}getProductVersion(){return e.Sdk.version}getMetadata(){return this.metadata}hasChanges(){return this.view?this.view.api.hasChanges():null}showInformationPane(e){this.view&&(e?this.view.navigationPanel.selectNavigation(e):this.view.navigationPanel.showNavigationPanel())}hideInformationPane(){this.view&&this.view.navigationPanel.hideNavigationPanel()}toggleInformationPane(){this.view&&this.view.navigationPanel.toggleNavigationPanel()}startSearch(e,t){if(this.view&&this.viewerCanvas){const{startPage:n,isCaseSensitive:i,isWrappingEnabled:o,isRegex:s,hideToolbar:a}=t||{},r=Boolean(i),l=Boolean(o),d=Boolean(s);a||(this.view.search.openSearch(),this.view.search.updateToSearch(e),this.view.search.setCaseSensitive(r),this.view.search.setWrappingSearch(l),this.view.search.setRegex(d)),this.viewerCanvas.startSearch(e,n||1,r,l,d)}}nextSearchMatch(){this.viewerCanvas&&this.viewerCanvas.nextSearchMatch()}previousSearchMatch(){this.viewerCanvas&&this.viewerCanvas.previousSearchMatch()}endSearch(){this.view&&(this.view.api.endSearch(),this.view.search.closeSearch())}print(){var e;null===(e=this.viewerCanvas)||void 0===e||e.print()}getSelectedText(){var e,t;return null!==(t=null===(e=this.viewerCanvas)||void 0===e?void 0:e.getSelectedText())&&void 0!==t?t:""}addEventListener(e,t){this.eventListeners.has(e)?this.eventListeners.get(e).push(t):this.eventListeners.set(e,[t])}removeEventListener(e,t){if(this.eventListeners.has(e)){let n=this.eventListeners.get(e);n=n.filter((e=>e!==t)),0!==n.length?this.eventListeners.set(e,n):this.eventListeners.delete(e)}}dispatchEvent(e,t){this.eventListeners.has(e)&&this.eventListeners.get(e).forEach((e=>e(t)))}createView(e){return(t,n,i,o)=>(n.initialize=()=>{const e=g.loadTranslations(this.options.viewer.general.language||"en");Promise.all([window.PdfToolsPromise,e]).then((()=>{var e;null===(e=this.view)||void 0===e||e.loadScriptsCompleted()})).catch((e=>{this.handleError(e)}))},n.createCanvasView=e=>{try{this.viewerCanvas=new In(e,this.licenseKey,this.options)}catch(e){return void this.handleError(e)}this.viewerCanvas.addEventListener("appLoaded",this.handleAppLoaded),this.viewerCanvas.addEventListener("firstVisiblePage",this.handleFirstVisiblePageChanged),this.viewerCanvas.addEventListener("lastVisiblePage",this.handleLastVisiblePageChanged),this.viewerCanvas.addEventListener("pageNumber",this.handlePageNumberChanged),this.viewerCanvas.addEventListener("zoom",this.handleZoomChanged),this.viewerCanvas.addEventListener("fitMode",this.handleFitModeChanged),this.viewerCanvas.addEventListener("rotation",this.handleRotationChanged),this.viewerCanvas.addEventListener("pageLayoutMode",this.handlePageLayoutModeChanged),this.viewerCanvas.addEventListener("busyState",this.handleBusyStateChanged),this.viewerCanvas.addEventListener("pageChanged",this.handlePageChanged),this.viewerCanvas.addEventListener("textSelected",this.handleTextSelected),this.viewerCanvas.addEventListener("error",this.handleError),this.viewerCanvas.addEventListener("itemCreated",this.handleAnnotationCreated),this.viewerCanvas.addEventListener("itemUpdated",this.handleAnnotationUpdated),this.viewerCanvas.addEventListener("itemDeleted",this.handleAnnotationDeleted),this.viewerCanvas.addEventListener("itemSelected",this.handleAnnotationSelected),this.viewerCanvas.addEventListener("itemDeselected",this.handleAnnotationDeselected);const t=new URLSearchParams(location.search);if(t){const e=t.get("url");e&&this.open({uri:e,sourceTag:""})}},n.removeCanvasView=e=>{this.viewerCanvas&&(this.viewerCanvas.removeEventListener("firstVisiblePage",this.handleFirstVisiblePageChanged),this.viewerCanvas.removeEventListener("lastVisiblePage",this.handleLastVisiblePageChanged),this.viewerCanvas.removeEventListener("pageNumber",this.handlePageNumberChanged),this.viewerCanvas.removeEventListener("zoom",this.handleZoomChanged),this.viewerCanvas.removeEventListener("fitMode",this.handleFitModeChanged),this.viewerCanvas.removeEventListener("pageLayoutMode",this.handlePageLayoutModeChanged),this.viewerCanvas.removeEventListener("busyState",this.handleBusyStateChanged),this.viewerCanvas.removeEventListener("error",this.handleError),this.viewerCanvas=void 0)},n.api={open:e=>{if(this.view&&(this.view.loadDocumentBegin(),this.viewerCanvas)){if(!this.beforeOpen(e))return;this.viewerCanvas&&this.viewerCanvas.open(e.pdfFile,e.fdfFiles,e.password,e.viewOptions,e.renderOptions).then((()=>{this.openResolve(e)})).catch((t=>{this.openReject(e,t)}))}},close:()=>{if(this.view&&this.viewerCanvas){if(this.showUnconfirmedChangesDialog())return void this.view.showConfirmUnsavedChangesDialog(null,this.handleDocumentClosed);this.handleDocumentClosed()}},downloadFile:e=>new Promise(((t,n)=>{if(this.view&&this.viewerCanvas){this.view.saveDocumentBegin();const n=this.view.getState(),i=n.pdfDocument.filename,o=n.pdfDocument.mimetype;this.viewerCanvas.save(e).then((e=>{const n=new Blob([e],{type:o}),s=window.URL.createObjectURL(n),a=document.createElement("a");a.style.position="absolute",a.style.left="-1000px",a.href=s,a.download=i||"download.pdf",this.element.appendChild(a),a.click(),setTimeout((()=>{var e;this.element.removeChild(a),window.URL.revokeObjectURL(s),null===(e=this.view)||void 0===e||e.saveDocumentFulfilled()}),100),t()})).catch((e=>{var t;console.error(e),null===(t=this.view)||void 0===t||t.saveDocumentRejected(e)}))}})),hasChanges:()=>this.viewerCanvas?this.viewerCanvas.hasChanges():null,setZoom:e=>{this.viewerCanvas&&this.viewerCanvas.setZoom(e/100)},getZoom:()=>this.viewerCanvas?this.viewerCanvas.getZoom():null,zoomIn:()=>{this.viewerCanvas&&this.viewerCanvas.zoomIn()},zoomOut:()=>{this.viewerCanvas&&this.viewerCanvas.zoomOut()},setPageNumber:e=>{this.viewerCanvas&&this.viewerCanvas.setPageNumber(e)},getPageNumber:()=>this.viewerCanvas?this.viewerCanvas.getPageNumber():null,getPageCount:()=>this.viewerCanvas?this.viewerCanvas.getPageCount():null,nextPage:()=>{this.viewerCanvas&&this.viewerCanvas.nextPage()},previousPage:()=>{this.viewerCanvas&&this.viewerCanvas.previousPage()},setFitMode:e=>{this.viewerCanvas&&this.viewerCanvas.setFitMode(e)},getFitMode:()=>this.viewerCanvas?this.viewerCanvas.getFitMode():null,setPageLayoutMode:e=>{this.viewerCanvas&&this.viewerCanvas.setPageLayoutMode(e)},getPageLayoutMode:()=>this.viewerCanvas?this.viewerCanvas.getPageLayoutMode():null,rotatePage:e=>{if(this.viewerCanvas)return this.viewerCanvas.rotatePage(e.page,e.direction)},rotate:()=>{if(this.viewerCanvas){const e=this.viewerCanvas.getRotation(),t=e>=270?0:e+90;this.viewerCanvas.setRotation(t)}},setRotation:e=>{this.viewerCanvas&&this.viewerCanvas.setRotation(e)},getRotation:()=>this.viewerCanvas?this.viewerCanvas.getRotation():null,startSearch:()=>{if(this.view&&this.viewerCanvas){const e=this.view.getState().search;this.viewerCanvas.startSearch(e.searchString,1,e.caseSensitive,e.wrapSearch,e.useRegex)}},nextSearchMatch:()=>{this.viewerCanvas&&this.viewerCanvas.nextSearchMatch()},previousSearchMatch:()=>{this.viewerCanvas&&this.viewerCanvas.previousSearchMatch()},endSearch:()=>{this.viewerCanvas&&this.viewerCanvas.endSearch()},updateCanvasSearchState:e=>{this.viewerCanvas&&this.viewerCanvas.updateCanvasSearchState(e)},goTo:e=>{this.viewerCanvas&&this.viewerCanvas.goTo(e)},goToAnnotation:e=>{if(this.viewerCanvas)if(e.annotation.isHidden())this.handleAnnotationSelected(e.annotation);else try{this.viewerCanvas.goToAnnotation(e.annotation,e.action)}catch(e){console.error(e)}},resetViewerMode:e=>{this.viewerCanvas&&this.viewerCanvas.resetViewerMode()},loadNavigationItems:()=>{this.view&&(this.loadPageThumbnails(),this.loadAnnotations(),this.view.getState().navigationPanel.outlineItemsLoaded||this.loadDocumentOutlines())},addPageRangeToThumbnailsQueue:e=>{this.addPagesToThumbnailsQueue(e.from,e.to)},print:()=>{this.viewerCanvas&&this.viewerCanvas.print()},activateModule:(e,t)=>{this.viewerCanvas&&this.viewerCanvas.activateModule(e,t)},deactivateModule:e=>{this.viewerCanvas&&this.viewerCanvas.deactivateModule(e)}},n.initialize(),e(t,n,i,o))}getScreenSize(){var e;const t=e=>e<=r.Small?r.Small:e<=r.Medium?r.Medium:r.Large,n=this.element.firstChild;return this.view&&n?n.offsetWidth&&n.offsetHeight&&n.getClientRects().length?t(n.getBoundingClientRect().width):null===(e=this.view)||void 0===e?void 0:e.getState().layout.screenSize:t(this.element.getBoundingClientRect().width)}handleResize(){if(this.view){const e=this.getScreenSize();this.view.getState().layout.screenSize!==e&&this.view.layout.setScreenSize(e)}}handleKeyboardShortcuts(e){var t,n,i;const o=this.element.getBoundingClientRect();if(o.width+o.height===0)return;const{shortcuts:s}=this.options;if(Object.keys(s).length>0){const t=N(e,s);if(!t.length)return;t.forEach((t=>{var n,i,o,s,a,r,l,d,h,c,u,p,g;switch(t[0]){case"save":{const{allowSaveFile:t}=this.options.viewer.permissions;t&&(e.preventDefault(),this.options.viewer.callbacks.onSaveFileButtonClicked?this.options.viewer.onSaveFileButtonClicked():this.downloadFile());break}case"print":{const{allowPrinting:t}=this.options.viewer.permissions;t&&(e.preventDefault(),null===(n=this.viewerCanvas)||void 0===n||n.print());break}case"cancelPrint":{const{allowPrinting:e}=this.options.viewer.permissions;e&&(null===(i=this.viewerCanvas)||void 0===i||i.deactivateModule("PrintServiceModule"));break}case"search":{const{enableSearch:t}=this.options.viewer.permissions;t&&(e.preventDefault(),null===(o=this.view)||void 0===o||o.search.openSearch());break}case"searchNext":{const{enableSearch:t}=this.options.viewer.permissions;if(t){const t=null===(s=this.view)||void 0===s?void 0:s.getState();t&&t.search&&t.search.showSearch&&t.search.searchString&&(null===(a=this.viewerCanvas)||void 0===a||a.nextSearchMatch()),e.preventDefault()}break}case"searchPrevious":{const{enableSearch:t}=this.options.viewer.permissions;if(t){const t=null===(r=this.view)||void 0===r?void 0:r.getState();t&&t.search&&t.search.showSearch&&t.search.searchString&&(null===(l=this.viewerCanvas)||void 0===l||l.previousSearchMatch()),e.preventDefault()}break}case"closeSearch":{const{enableSearch:t}=this.options.viewer.permissions;t&&(e.preventDefault(),null===(d=this.viewerCanvas)||void 0===d||d.endSearch(),null===(h=this.view)||void 0===h||h.search.closeSearch());break}case"toggleSidePane":{const{sidebar:t}=this.options.viewer;(t.annotationNavigation||t.outlineNavigation||t.annotationNavigation)&&(e.preventDefault(),null===(c=this.view)||void 0===c||c.navigationPanel.toggleNavigationPanel());break}case"showAnnotations":{const{sidebar:t}=this.options.viewer;t.annotationNavigation&&(e.preventDefault(),null===(u=this.view)||void 0===u||u.navigationPanel.selectNavigation("annotation"));break}case"showOutline":{const{sidebar:t}=this.options.viewer;t.outlineNavigation&&(e.preventDefault(),null===(p=this.view)||void 0===p||p.navigationPanel.selectNavigation("outline"));break}case"showThumbnails":{const{sidebar:t}=this.options.viewer;t.thumbnailNavigation&&(e.preventDefault(),null===(g=this.view)||void 0===g||g.navigationPanel.selectNavigation("thumbnail"));break}}}))}else"Escape"===e.key&&(null===(t=this.viewerCanvas)||void 0===t||t.deactivateModule("PrintServiceModule"),null===(n=this.viewerCanvas)||void 0===n||n.endSearch(),null===(i=this.view)||void 0===i||i.search.closeSearch())}showUnconfirmedChangesDialog(){if(this.view&&this.viewerCanvas){const e=this.view.getState(),t=this.viewerCanvas.hasChanges();return!e.unsavedChangesDialogDontSave&&e.hasDocument&&t&&this.options.viewer.general.promptOnUnsavedChange&&this.options.viewer.permissions.allowSaveFile}}beforeOpen(e){if(this.view&&this.viewerCanvas)return this.showUnconfirmedChangesDialog()?(this.view.showConfirmUnsavedChangesDialog(e),!1):(this.view.navigationPanel.clear(),this.view.loadDocumentBegin(),!0)}openResolve(e){if(this.view&&this.viewerCanvas){this.view.pdfDocument.setFileInfo(e.pdfFile),this.view.pdfDocument.setHasChanges(!1);const t=this.viewerCanvas.getPageCount();this.view.pdfDocument.setPageCount(t),this.handleDocumentOpened(),this.view.loadDocumentFulfilled(),this.view.api.loadNavigationItems();const n=e.pdfFile,i=n.uri?n.uri:new File([],n.sourceTag,{type:"application/pdf"});this.dispatchEvent("documentLoaded",i)}}openReject(e,t){this.view&&("password required"===t.message?this.view.loadDocumentPasswordForm(e):this.view.loadDocumentRejected(t.message))}handleDocumentOpened(){if(this.view&&this.viewerCanvas){const e=this.viewerCanvas.getPageCount();this.view.navigationPanel.setThumbnailPlaceholders(e);const t=this.view.getState();this.view.navigationPanel.clearAnnotations(),t.navigationPanel.showNavigation&&("thumbnail"===t.navigationPanel.selectedNavigation?this.loadPageThumbnails():"outline"===t.navigationPanel.selectedNavigation?this.loadDocumentOutlines():this.loadAnnotations())}}loadDocumentOutlines(){this.viewerCanvas&&this.viewerCanvas.getDocumentOutline().then((e=>{this.view&&this.view.navigationPanel.setOutlines(e)}))}loadPageThumbnails(){if(this.view&&this.viewerCanvas){const e=this.view.getState(),t=e.pdfDocument.firstVisiblePage-5,n=e.pdfDocument.lastVisiblePage+5;this.addPagesToThumbnailsQueue(t,n)}}addPagesToThumbnailsQueue(e,t){if(this.view&&this.viewerCanvas){const n=this.view.getState();e<1&&(e=1),t<e&&(t=n.pdfDocument.firstVisiblePage+5),t>n.pdfDocument.pageCount&&(t=n.pdfDocument.pageCount),n.navigationPanel.pages.filter((n=>n.pageNumber>=e&&n.pageNumber<=t&&null===n.thumbnail&&null===n.loading)).map((e=>e.pageNumber)).forEach((e=>{var t;this.loadThumbnailsQueue.indexOf(e)<0&&(null===(t=this.view)||void 0===t||t.navigationPanel.updateThumbnail({pageNumber:e,thumbnail:null,loading:!0}),this.loadThumbnailsQueue.push(e))}));const i=e=>{this.updatePageThumbnail(e).then((()=>{const e=this.loadThumbnailsQueue.shift();e&&i(e)})).catch((()=>{}))},o=this.loadThumbnailsQueue.shift();o&&i(o)}}updatePageThumbnail(e){return new Promise(((t,n)=>{this.view&&this.viewerCanvas?this.viewerCanvas.renderPage(e,200,200).then((e=>{var n;const i=document.createElement("canvas");i.width=e.imageData.width,i.height=e.imageData.height;const o=i.getContext("2d");o&&o.putImageData(e.imageData,0,0);const s=i.toDataURL("image/png");null===(n=this.view)||void 0===n||n.navigationPanel.updateThumbnail({pageNumber:e.page,thumbnail:s,loading:!1}),t()})).catch((e=>n(e))):n()}))}loadAnnotations(){if(this.options.viewer.sidebar.annotationNavigation&&this.view){const e=this.view.getState();if(e.navigationPanel.annotationsLoaded)return;this.view.navigationPanel.initAnnotations(e.pdfDocument.pageCount);const t=e=>{if(this.viewerCanvas){const n=e.shift();"number"==typeof n&&this.viewerCanvas.getAnnotationsFromPage(n).then((n=>{var i,o;const s=n.items.filter((e=>{var t;return null===(t=e.behaviors)||void 0===t?void 0:t.selectable}));s.length&&(null===(i=this.view)||void 0===i||i.navigationPanel.setPageAnnotations({page:n.page,itemCategory:I.ANNOTATION,items:s})),e.length>0?t(e):null===(o=this.view)||void 0===o||o.navigationPanel.setAnnotationLoaded()}))}},n=this.getPageCount()||0,i=[];for(let e=1;e<=n;e++)i.push(e);t(i)}}handleDocumentClosed(){var e,t;null===(e=this.view)||void 0===e||e.closeDocument(),null===(t=this.viewerCanvas)||void 0===t||t.close(),this.handleResize(),this.dispatchEvent("documentClosed",void 0)}handleAppLoaded(e){if(this.view&&this.viewerCanvas){this.view.initializeAppFulfilled({licenseFeatures:this.viewerCanvas.licenseFeatures});const t=this.viewerCanvas.getModules();this.view.setCanvasModules(t),this.dispatchEvent("appLoaded",e)}}handleFirstVisiblePageChanged(e){this.view&&(this.visiblePageRange.firstPage=e,this.updateVisiblePageRange(),this.view.pdfDocument.setFirstVisiblePage(e))}handleLastVisiblePageChanged(e){this.view&&(this.visiblePageRange.lastPage=e,this.updateVisiblePageRange(),this.view.pdfDocument.setLastVisiblePage(e))}handlePageNumberChanged(e){if(this.view){this.view.pdfDocument.setPageNumber(e);const{navigationPanel:t}=this.view.getState();if(t.showNavigation&&"thumbnail"===t.selectedNavigation){const t=this.element.querySelector(`#pwv-thumbnail-navigation-page_${e}`),n=this.element.querySelector(".pwv-NavigationPanel__Content");if(t&&n){const e=n.getBoundingClientRect(),i=t.getBoundingClientRect();(i.top<e.top||i.bottom>e.bottom)&&t.scrollIntoView({behavior:"smooth",block:"nearest"})}}this.dispatchEvent("pageNumberChanged",e)}}updateVisiblePageRange(){if(this.view){const e=this.view.getState();e.navigationPanel.showNavigation&&"thumbnail"===e.navigationPanel.selectedNavigation&&(this.loadPageThumbnailsTimer&&window.clearTimeout(this.loadPageThumbnailsTimer),this.loadPageThumbnailsTimer=window.setTimeout((()=>{this.loadPageThumbnailsTimer=null,this.loadPageThumbnails()}),100))}}handleZoomChanged(e){this.view&&(this.view.pdfDocument.setZoom(100*e),this.dispatchEvent("zoomChanged",e))}handleFitModeChanged(e){this.view&&this.view.pdfDocument.setFitMode(e),this.dispatchEvent("fitModeChanged",e)}handlePageLayoutModeChanged(e){this.view&&this.view.pdfDocument.setPageLayoutMode(e),this.dispatchEvent("pageLayoutModeChanged",e)}handleRotationChanged(e){this.dispatchEvent("rotationChanged",e)}handleBusyStateChanged(e){this.dispatchEvent("busyState",e)}handleAnnotationSelected(e){if(this.view){const t=e;this.view.navigationPanel.selectAnnotation(t);const{navigationPanel:n}=this.view.getState();if(n.showNavigation&&"annotation"===n.selectedNavigation){const e=this.element.querySelector(`#pwv-annotation-navigation-item-${t.id}`);e&&e.scrollIntoView({behavior:"smooth"})}}}handleAnnotationDeselected(e){this.view&&this.view.navigationPanel.deselectAnnotation()}handleAnnotationCreated(e){if(this.view){const t=e;this.view.navigationPanel.updateAnnotation(t);const{navigationPanel:n}=this.view.getState();n.showNavigation&&"annotation"===n.selectedNavigation&&window.setTimeout((()=>{const e=this.element.querySelector(`#pwv-annotation-navigation-item-${t.id}`);e&&e.scrollIntoView({behavior:"smooth"})}),10)}}handleAnnotationUpdated(e){if(this.view){const t=e;this.view.navigationPanel.updateAnnotation(t)}}handleAnnotationDeleted(e){this.view&&this.view.navigationPanel.deleteAnnotation(e)}handlePageChanged(e){if(this.view){const t=this.view.getState().navigationPanel.pages[e-1];t&&null!==t.thumbnail&&this.updatePageThumbnail(e),this.dispatchEvent("documentChanged",void 0)}}handleTextSelected(e){this.dispatchEvent("textSelected",e)}verifyOptions(e,t){e.annotation&&e.annotation.colors&&(Object.keys(ti).forEach((n=>{if(e.annotation&&e.annotation.colors[n]&&!this.isContainedInArray(e.annotation.colors[n],t.annotation.colors[ti[n]]))throw new Error(`Invalid ${n}: ${t.annotation.colors[n]} has not been found in ${ti[n]}.\nValid values are: ${t.annotation.colors[ti[n]]}`)})),Object.keys(ni).forEach((t=>{if(e.annotation&&e.annotation.colors[t]&&!e.annotation.colors[ni[t]])throw new Error(`Cannot set ${t} without setting ${ni[t]}. Preset ${ni[t]} might not be in ${t}`)})))}isContainedInArray(e,t){return!!t.find((t=>t===e))}handleError(e){this.view&&this.view.setError(e.message),this.dispatchEvent("error",e)}}return n})()));
|