ngx-extended-pdf-viewer
Version:
Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.
24 lines • 325 kB
JavaScript
window.ngxZone.runOutsideAngular(() => {
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2022 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/(()=>{"use strict";var e=[,(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.compatibilityParams=t.OptionKind=t.AppOptions=void 0;const i=Object.create(null);t.compatibilityParams=i;{const e=navigator.userAgent||"",t=navigator.platform||"",n=navigator.maxTouchPoints||1,s=/Android/.test(e),r=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&n>1;!function checkCanvasSizeLimitation(){(r||s)&&(i.maxCanvasPixels=5242880)}();!function checkResizeObserver(){"undefined"==typeof ResizeObserver&&(i.annotationEditorMode=-1)}()}const n={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=n;const s={annotationEditorMode:{value:-1,kind:n.VIEWER+n.PREFERENCE},annotationMode:{value:2,kind:n.VIEWER+n.PREFERENCE},cursorToolOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},defaultZoomValue:{value:"",kind:n.VIEWER+n.PREFERENCE},disableHistory:{value:!1,kind:n.VIEWER},disablePageLabels:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePermissions:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:n.VIEWER+n.PREFERENCE},enableScripting:{value:!0,kind:n.VIEWER+n.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:n.VIEWER},externalLinkTarget:{value:0,kind:n.VIEWER+n.PREFERENCE},historyUpdateUrl:{value:!1,kind:n.VIEWER+n.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:n.VIEWER+n.PREFERENCE},imageResourcesPath:{value:"./images/",kind:n.VIEWER},maxCanvasPixels:{value:16777216,kind:n.VIEWER},forcePageColors:{value:!1,kind:n.VIEWER+n.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:n.VIEWER+n.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:n.VIEWER+n.PREFERENCE},pdfBugEnabled:{value:!1,kind:n.VIEWER+n.PREFERENCE},printResolution:{value:150,kind:n.VIEWER},removePageBorders:{value:!1,kind:n.VIEWER+n.PREFERENCE},sidebarViewOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},scrollModeOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},spreadModeOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},textLayerMode:{value:1,kind:n.VIEWER+n.PREFERENCE},useOnlyCssZoom:{value:!1,kind:n.VIEWER+n.PREFERENCE},viewerCssTheme:{value:0,kind:n.VIEWER+n.PREFERENCE},viewOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},cMapPacked:{value:!0,kind:n.API},cMapUrl:{value:"../web/cmaps/",kind:n.API},disableAutoFetch:{value:!1,kind:n.API+n.PREFERENCE},disableFontFace:{value:!1,kind:n.API+n.PREFERENCE},disableRange:{value:!1,kind:n.API+n.PREFERENCE},disableStream:{value:!1,kind:n.API+n.PREFERENCE},docBaseUrl:{value:"",kind:n.API},enableXfa:{value:!0,kind:n.API+n.PREFERENCE},fontExtraProperties:{value:!1,kind:n.API},isEvalSupported:{value:!0,kind:n.API},maxImageSize:{value:-1,kind:n.API},pdfBug:{value:!1,kind:n.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:n.API},verbosity:{value:1,kind:n.API},workerPort:{value:null,kind:n.WORKER},workerSrc:{value:"./assets/pdf.worker.js",kind:n.WORKER}};s.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:n.VIEWER};s.disablePreferences={value:!1,kind:n.VIEWER};s.locale={value:navigator.language||"en-US",kind:n.VIEWER};s.renderer={value:"canvas",kind:n.VIEWER+n.PREFERENCE};s.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:n.VIEWER};const r=Object.create(null);if(globalThis.pdfDefaultOptions)for(const e in globalThis.pdfDefaultOptions)r[e]=globalThis.pdfDefaultOptions[e];t.AppOptions=class AppOptions{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=r[e];if(void 0!==t)return t;const n=s[e];return void 0!==n?i[e]??n.value:void 0}static getAll(e=null){const t=Object.create(null);for(const o in s){const a=s[o];if(e){if(0==(e&a.kind))continue;if(e===n.PREFERENCE){const e=a.value,i=typeof e;if("boolean"===i||"string"===i||"number"===i&&Number.isInteger(e)){t[o]=e;continue}throw new Error(`Invalid type for preference: ${o}`)}}const l=r[o];t[o]=void 0!==l?l:i[o]??a.value}return t}static set(e,t){r[e]=t}static setAll(e){for(const t in e)r[t]=e[t]}static remove(e){delete r[e]}static _hasUserOptions(){return Object.keys(r).length>0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFViewerApplication=t.PDFPrintServiceFactory=t.DefaultExternalServices=void 0;var n=i(3),s=i(4),r=i(1),o=i(5),a=i(6),l=i(8),h=i(9),d=i(10),c=i(11),u=i(12),g=i(14),p=i(15),f=i(16),m=i(20),w=i(21),v=i(22),b=i(23),_=i(24),P=i(25),y=i(26),S=i(27),E=i(28),C=i(30),T=i(44),x=i(45),L=i(46);const I=-1,M=1,A={AUTOMATIC:0,LIGHT:1,DARK:2},D=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","2.0","2.1","2.2","2.3"],B=["acrobat distiller","acrobat pdfwriter","adobe livecycle","adobe pdf library","adobe photoshop","ghostscript","tcpdf","cairo","dvipdfm","dvips","pdftex","pdfkit","itext","prince","quarkxpress","mac os x","microsoft","openoffice","oracle","luradocument","pdf-xchange","antenna house","aspose.cells","fpdf"];class DefaultExternalServices{constructor(){throw new Error("Cannot initialize DefaultExternalServices.")}static updateFindControlState(e){}static updateFindMatchesCount(e){}static initPassiveLoading(e){}static reportTelemetry(e){}static createDownloadManager(e){throw new Error("Not implemented: createDownloadManager")}static createPreferences(){throw new Error("Not implemented: createPreferences")}static createL10n(e){throw new Error("Not implemented: createL10n")}static createScripting(e){throw new Error("Not implemented: createScripting")}static get supportsIntegratedFind(){return(0,s.shadow)(this,"supportsIntegratedFind",!1)}static get supportsDocumentFonts(){return(0,s.shadow)(this,"supportsDocumentFonts",!0)}static get supportedMouseWheelZoomModifierKeys(){return(0,s.shadow)(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:!0,metaKey:!0})}static get isInAutomation(){return(0,s.shadow)(this,"isInAutomation",!1)}static updateEditorStates(e){throw new Error("Not implemented: updateEditorStates")}}t.DefaultExternalServices=DefaultExternalServices;const N={initialBookmark:document.location.hash.substring(1),_initializedCapability:(0,s.createPromiseCapability)(),appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar:null,pdfSidebarResizer:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,pdfScriptingManager:null,store:null,downloadManager:null,overlayManager:null,preferences:null,toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,annotationEditorParams:null,isInitialViewSet:!1,downloadComplete:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",_downloadUrl:"",externalServices:DefaultExternalServices,_boundEvents:Object.create(null),documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:!1,_docStats:null,_wheelUnusedTicks:0,_idleCallbacks:new Set,_PDFBug:null,_printAnnotationStoragePromise:null,async initialize(e){this.preferences=this.externalServices.createPreferences();this.appConfig=e;await this._readPreferences();await this._parseHashParameters();this._forceCssTheme();await this._initializeL10n();this.isViewerEmbedded&&r.AppOptions.get("externalLinkTarget")===l.LinkTarget.NONE&&r.AppOptions.set("externalLinkTarget",l.LinkTarget.TOP);await this._initializeViewerComponents();this.bindEvents();this.bindWindowEvents();const t=e.appContainer||document.documentElement;this.l10n.translate(t).then((()=>{this.eventBus.dispatch("localized",{source:this})}));this._initializedCapability.resolve();this.initializeLoadingBar()},async _readPreferences(){if(!r.AppOptions.get("disablePreferences")){r.AppOptions._hasUserOptions()&&Window.ngxConsole.warn('_readPreferences: The Preferences may override manually set AppOptions; please use the "disablePreferences"-option in order to prevent that.');try{r.AppOptions.setAll(await this.preferences.getAll())}catch(e){Window.ngxConsole.error(`_readPreferences: "${e?.message}".`)}}},async _parseHashParameters(){if(!r.AppOptions.get("pdfBugEnabled"))return;const e=document.location.hash.substring(1);if(!e)return;const{mainContainer:t,viewerContainer:i}=this.appConfig,o=(0,n.parseQueryString)(e);if("true"===o.get("disableworker"))try{await async function loadFakeWorker(){s.GlobalWorkerOptions.workerSrc||=r.AppOptions.get("workerSrc");"Function"===s.GlobalWorkerOptions.workerSrc.constructor.name&&(s.GlobalWorkerOptions.workerSrc=s.GlobalWorkerOptions.workerSrc());await(0,s.loadScript)(s.PDFWorker.workerSrc)}()}catch(e){console.error(`_parseHashParameters: "${e.message}".`)}o.has("disablerange")&&r.AppOptions.set("disableRange","true"===o.get("disablerange"));o.has("disablestream")&&r.AppOptions.set("disableStream","true"===o.get("disablestream"));o.has("disableautofetch")&&r.AppOptions.set("disableAutoFetch","true"===o.get("disableautofetch"));o.has("disablefontface")&&r.AppOptions.set("disableFontFace","true"===o.get("disablefontface"));o.has("disablehistory")&&r.AppOptions.set("disableHistory","true"===o.get("disablehistory"));o.has("verbosity")&&r.AppOptions.set("verbosity",0|o.get("verbosity"));if(o.has("textlayer"))switch(o.get("textlayer")){case"off":r.AppOptions.set("textLayerMode",n.TextLayerMode.DISABLE);break;case"visible":case"shadow":case"hover":i.classList.add(`textLayer-${o.get("textlayer")}`);try{await loadPDFBug(this);this._PDFBug.loadCSS()}catch(e){console.error(`_parseHashParameters: "${e.message}".`)}}if(o.has("pdfbug")){r.AppOptions.set("pdfBug",!0);r.AppOptions.set("fontExtraProperties",!0);const e=o.get("pdfbug").split(",");try{await loadPDFBug(this);this._PDFBug.init({OPS:s.OPS},t,e)}catch(e){console.error(`_parseHashParameters: "${e.message}".`)}}o.has("locale")&&r.AppOptions.set("locale",o.get("locale"))},async _initializeL10n(){this.l10n=this.externalServices.createL10n({locale:r.AppOptions.get("locale")});const e=await this.l10n.getDirection();document.getElementsByTagName("html")[0].dir=e},_forceCssTheme(){const e=r.AppOptions.get("viewerCssTheme");if(e!==A.AUTOMATIC&&Object.values(A).includes(e))try{const t=document.styleSheets[0],i=t?.cssRules||[];for(let n=0,s=i.length;n<s;n++){const s=i[n];if(s instanceof CSSMediaRule&&"(prefers-color-scheme: dark)"===s.media?.[0]){if(e===A.LIGHT){t.deleteRule(n);return}const i=/^@media \(prefers-color-scheme: dark\) {\n\s*([\w\s-.,:;/\\{}()]+)\n}$/.exec(s.cssText);if(i?.[1]){t.deleteRule(n);t.insertRule(i[1],n)}return}}}catch(e){Window.ngxConsole.error(`_forceCssTheme: "${e?.message}".`)}},async _initializeViewerComponents(){const{appConfig:e,externalServices:t}=this,i=t.isInAutomation?new o.AutomationEventBus:new o.EventBus;this.eventBus=i;this.overlayManager=new d.OverlayManager;const n=new _.PDFRenderingQueue;n.onIdle=this._cleanup.bind(this);this.pdfRenderingQueue=n;const L=new l.PDFLinkService({eventBus:i,externalLinkTarget:r.AppOptions.get("externalLinkTarget"),externalLinkRel:r.AppOptions.get("externalLinkRel"),ignoreDestinationZoom:r.AppOptions.get("ignoreDestinationZoom")});this.pdfLinkService=L;const I=t.createDownloadManager();this.downloadManager=I;const M=new f.PDFFindController({linkService:L,eventBus:i,pageViewMode:r.AppOptions.get("pageViewMode")});this.findController=M;const A=new P.PDFScriptingManager({eventBus:i,sandboxBundleSrc:r.AppOptions.get("sandboxBundleSrc"),scriptingFactory:t,docPropertiesLookup:this._scriptingDocProperties.bind(this)});this.pdfScriptingManager=A;const D=e.mainContainer,B=e.viewerContainer,N=r.AppOptions.get("annotationEditorMode"),O=r.AppOptions.get("forcePageColors")||window.matchMedia("(forced-colors: active)").matches?{background:r.AppOptions.get("pageColorsBackground"),foreground:r.AppOptions.get("pageColorsForeground")}:null;this.pdfViewer=new C.PDFViewer({container:D,viewer:B,eventBus:i,renderingQueue:n,linkService:L,downloadManager:I,findController:M,scriptingManager:r.AppOptions.get("enableScripting")&&A,renderer:r.AppOptions.get("renderer"),l10n:this.l10n,textLayerMode:r.AppOptions.get("textLayerMode"),annotationMode:r.AppOptions.get("annotationMode"),annotationEditorMode:N,imageResourcesPath:r.AppOptions.get("imageResourcesPath"),removePageBorders:r.AppOptions.get("removePageBorders"),enablePrintAutoRotate:r.AppOptions.get("enablePrintAutoRotate"),useOnlyCssZoom:r.AppOptions.get("useOnlyCssZoom"),maxCanvasPixels:r.AppOptions.get("maxCanvasPixels"),pageViewMode:r.AppOptions.get("pageViewMode"),enablePermissions:r.AppOptions.get("enablePermissions"),pageColors:O});n.setViewer(this.pdfViewer);L.setViewer(this.pdfViewer);A.setViewer(this.pdfViewer);this.pdfThumbnailViewer=new E.PDFThumbnailViewer({container:e.sidebar.thumbnailView,eventBus:i,renderingQueue:n,linkService:L,l10n:this.l10n,pageColors:O});n.setThumbnailViewer(this.pdfThumbnailViewer);if(!this.isViewerEmbedded&&!r.AppOptions.get("disableHistory")){this.pdfHistory=new m.PDFHistory({linkService:L,eventBus:i});L.setHistory(this.pdfHistory)}this.supportsIntegratedFind||(this.findBar=new p.PDFFindBar(e.findBar,i,this.l10n));if(N!==s.AnnotationEditorType.DISABLE){this.annotationEditorParams=new h.AnnotationEditorParams(e.annotationEditorParams,i);for(const e of[document.getElementById("editorModeButtons"),document.getElementById("editorModeSeparator")])e.classList.remove("hidden")}this.pdfDocumentProperties=new g.PDFDocumentProperties(e.documentProperties,this.overlayManager,i,this.l10n,(()=>this._docFilename));this.pdfCursorTools=new a.PDFCursorTools({container:D,eventBus:i,cursorToolOnLoad:r.AppOptions.get("cursorToolOnLoad")});this.toolbar=new x.Toolbar(e.toolbar,i,this.l10n);this.secondaryToolbar=new T.SecondaryToolbar(e.secondaryToolbar,i);this.supportsFullscreen&&(this.pdfPresentationMode=new b.PDFPresentationMode({container:D,pdfViewer:this.pdfViewer,eventBus:i}));let V=r.AppOptions.get("passwordPrompt");V||(V=new c.PasswordPrompt(e.passwordOverlay,this.overlayManager,this.l10n,this.isViewerEmbedded));this.passwordPrompt=V;this.pdfOutlineViewer=new v.PDFOutlineViewer({container:e.sidebar.outlineView,eventBus:i,linkService:L});this.pdfAttachmentViewer=new u.PDFAttachmentViewer({container:e.sidebar.attachmentsView,eventBus:i,downloadManager:I});this.pdfLayerViewer=new w.PDFLayerViewer({container:e.sidebar.layersView,eventBus:i,l10n:this.l10n});this.pdfSidebar=new y.PDFSidebar({elements:e.sidebar,pdfViewer:this.pdfViewer,pdfThumbnailViewer:this.pdfThumbnailViewer,eventBus:i,l10n:this.l10n});this.pdfSidebar.onToggled=this.forceRendering.bind(this);this.pdfSidebarResizer=new S.PDFSidebarResizer(e.sidebarResizer,i,this.l10n)},run(e){this.initialize(e).then(webViewerInitialized)},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},zoomIn(e){this.pdfViewer.isInPresentationMode||this.pdfViewer.increaseScale(e)},zoomOut(e){this.pdfViewer.isInPresentationMode||this.pdfViewer.decreaseScale(e)},zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=n.DEFAULT_SCALE_VALUE)},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(e){this.pdfViewer.currentPageNumber=e},get supportsPrinting(){return R.instance.supportsPrinting},get supportsFullscreen(){return(0,s.shadow)(this,"supportsFullscreen",document.fullscreenEnabled)},get supportsIntegratedFind(){return this.externalServices.supportsIntegratedFind},get supportsDocumentFonts(){return this.externalServices.supportsDocumentFonts},initializeLoadingBar(){const e=new n.ProgressBar("loadingBar");e.hide();return(0,s.shadow)(this,"loadingBar",e)},get supportedMouseWheelZoomModifierKeys(){return this.externalServices.supportedMouseWheelZoomModifierKeys},initPassiveLoading(){throw new Error("Not implemented: initPassiveLoading")},setTitleUsingUrl(e="",t=null){this.url=e;this.baseUrl=e.split("#")[0];t&&(this._downloadUrl=t===e?this.baseUrl:t.split("#")[0]);let i=(0,s.getPdfFilenameFromUrl)(e,"");if(!i)try{i=decodeURIComponent((0,s.getFilenameFromUrl)(e))||e}catch(t){i=e}this.setTitle(i)},setTitle(e){this.isViewerEmbedded||(document.title=e)},get _docFilename(){return this._contentDispositionFilename||(0,s.getPdfFilenameFromUrl)(this.url)},_hideViewBookmark(){const{toolbar:e,secondaryToolbar:t}=this.appConfig;e.viewBookmark.hidden=!0;t.viewBookmarkButton.hidden=!0},_cancelIdleCallbacks(){if(this._idleCallbacks.size){for(const e of this._idleCallbacks)window.cancelIdleCallback(e);this._idleCallbacks.clear()}},async close(){this._unblockDocumentLoadEvent();this._hideViewBookmark();const{container:e}=this.appConfig.errorWrapper;e.hidden=!0;if(!this.pdfLoadingTask)return;if(this.pdfDocument?.annotationStorage.size>0&&this._annotationStorageModified)try{await this.save()}catch(e){}const t=[];t.push(this.pdfLoadingTask.destroy());this.pdfLoadingTask=null;if(this.pdfDocument){this.pdfDocument=null;this.pdfThumbnailViewer.setDocument(null);this.pdfViewer.setDocument(null);this.pdfLinkService.setDocument(null);this.pdfDocumentProperties.setDocument(null)}this.pdfLinkService.externalLinkEnabled=!0;this.store=null;this.isInitialViewSet=!1;this.downloadComplete=!1;this.url="";this.baseUrl="";this._downloadUrl="";this.documentInfo=null;this.metadata=null;this._contentDispositionFilename=null;this._contentLength=null;this._saveInProgress=!1;this._docStats=null;this._cancelIdleCallbacks();t.push(this.pdfScriptingManager.destroyPromise);this.pdfSidebar.reset();this.pdfOutlineViewer.reset();this.pdfAttachmentViewer.reset();this.pdfLayerViewer.reset();this.pdfHistory?.reset();this.findBar?.reset();this.toolbar.reset();this.secondaryToolbar.reset();this._PDFBug?.cleanup();await Promise.all(t)},async open(e,t){window.adjacentPagesLoader=void 0;window.ngxZone.runOutsideAngular((async()=>{this.pdfLoadingTask&&await this.close();const i=r.AppOptions.getAll(r.OptionKind.WORKER);for(const e in i)s.GlobalWorkerOptions[e]=i[e];const n=Object.create(null);if("string"==typeof e){this.setTitleUsingUrl(e,e);n.url=e}else if(e&&"byteLength"in e)n.data=e;else if(e.url&&e.originalUrl){this.setTitleUsingUrl(e.originalUrl,e.url);n.url=e.url}const o=r.AppOptions.getAll(r.OptionKind.API);for(const e in o){let t=o[e];n[e]=t}if(t)for(const e in t)n[e]=t[e];const a=(0,s.getDocument)(n);this.pdfLoadingTask=a;a.onPassword=(e,t)=>{this.pdfLinkService.externalLinkEnabled=!1;this.passwordPrompt.setUpdateCallback(e,t);this.passwordPrompt.open()};a.onProgress=({loaded:e,total:t})=>{this.progress(e/t);this.eventBus.dispatch("progress",{source:this,type:"load",total:t,loaded:e,percent:100*e/t})};a.onUnsupportedFeature=this.fallback.bind(this);this.loadingBar.show();return a.promise.then((e=>{this.load(e)}),(e=>{if(a!==this.pdfLoadingTask)return;let t="loading_error";e instanceof s.InvalidPDFException?t="invalid_file_error":e instanceof s.MissingPDFException?t="missing_file_error":e instanceof s.UnexpectedResponseException&&(t="unexpected_response_error");N.onError&&N.onError(e);return this.l10n.get(t).then((t=>{this._documentError(t,{message:e?.message});throw e}))}))}))},_ensureDownloadComplete(){if(!this.pdfDocument||!this.downloadComplete)throw new Error("PDF document not downloaded.")},async download(){const e=this._downloadUrl,t=this._docFilename;try{this._ensureDownloadComplete();const i=await this.pdfDocument.getData(),n=new Blob([i],{type:"application/pdf"});await this.downloadManager.download(n,e,t)}catch(i){await this.downloadManager.downloadUrl(e,t)}},async save(){if(this._saveInProgress)return;this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();const e=this._downloadUrl,t=this._docFilename;try{this._ensureDownloadComplete();const i=await this.pdfDocument.saveDocument(),n=new Blob([i],{type:"application/pdf"});await this.downloadManager.download(n,e,t)}catch(e){Window.ngxConsole.error(`Error when saving the document: ${e.message}`);await this.download()}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}},downloadOrSave(){this.pdfDocument?.annotationStorage.size>0?this.save():this.download()},fallback(e){this.externalServices.reportTelemetry({type:"unsupportedFeature",featureId:e})},_documentError(e,t=null){this._unblockDocumentLoadEvent();this._otherError(e,t);this.eventBus.dispatch("documenterror",{source:this,message:e,reason:t?.message??null})},_otherError(e,t=null){const i=[this.l10n.get("error_version_info",{version:s.version||"?",build:s.build||"?"})];if(t){i.push(this.l10n.get("error_message",{message:t.message}));if(t.stack)i.push(this.l10n.get("error_stack",{stack:t.stack}));else{t.filename&&i.push(this.l10n.get("error_file",{file:t.filename}));t.lineNumber&&i.push(this.l10n.get("error_line",{line:t.lineNumber}))}}const r=this.appConfig.errorWrapper,o=r.container;o.hidden=!1;r.errorMessage.textContent=e;const a=r.closeButton;a.onclick=function(){o.hidden=!0};const l=r.errorMoreInfo,h=r.moreInfoButton,d=r.lessInfoButton;h.onclick=function(){l.hidden=!1;h.hidden=!0;d.hidden=!1;l.style.height=l.scrollHeight+"px"};d.onclick=function(){l.hidden=!0;h.hidden=!1;d.hidden=!0};h.oncontextmenu=n.noContextMenuHandler;d.oncontextmenu=n.noContextMenuHandler;a.oncontextmenu=n.noContextMenuHandler;h.hidden=!1;d.hidden=!0;Promise.all(i).then((e=>{l.value=e.join("\n")}))},progress(e){if(this.downloadComplete)return;const t=Math.round(100*e);if(t<=this.loadingBar.percent)return;this.loadingBar.percent=t;if((this.pdfDocument?.loadingParams.disableAutoFetch??r.AppOptions.get("disableAutoFetch"))&&!isNaN(t)){if(this.disableAutoFetchLoadingBarTimeout){clearTimeout(this.disableAutoFetchLoadingBarTimeout);this.disableAutoFetchLoadingBarTimeout=null}this.loadingBar.show();this.disableAutoFetchLoadingBarTimeout=setTimeout((()=>{this.loadingBar.hide();this.disableAutoFetchLoadingBarTimeout=null}),5e3)}},load(e){this.pdfDocument=e;e.getDownloadInfo().then((({length:e})=>{this._contentLength=e;this.downloadComplete=!0;this.loadingBar.hide();l.then((()=>{this.eventBus.dispatch("documentloaded",{source:this})}))}));const t=e.getPageLayout().catch((function(){})),i=e.getPageMode().catch((function(){})),s=e.getOpenAction().catch((function(){}));this.toolbar.setPagesCount(e.numPages,!1);this.secondaryToolbar.setPagesCount(e.numPages);let o;o=null;this.pdfLinkService.setDocument(e,null);this.pdfDocumentProperties.setDocument(e);const a=this.pdfViewer;a.setDocument(e);const{firstPagePromise:l,onePageRendered:h,pagesPromise:d}=a;this.pdfThumbnailViewer.setDocument(e);const c=(this.store=new L.ViewHistory(e.fingerprints[0])).getMultiple({page:null,zoom:n.DEFAULT_SCALE_VALUE,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:n.SidebarView.UNKNOWN,scrollMode:n.ScrollMode.UNKNOWN,spreadMode:n.SpreadMode.UNKNOWN}).catch((()=>Object.create(null)));l.then((o=>{this.loadingBar.setWidth(this.appConfig.viewerContainer);this._initializeAnnotationStorageCallbacks(e);Promise.all([n.animationStarted,c,t,i,s]).then((async([t,i,s,o,l])=>{const h=r.AppOptions.get("viewOnLoad");this._initializePdfHistory({fingerprint:e.fingerprints[0],viewOnLoad:h,initialDest:l?.dest});const c=this.initialBookmark,u=r.AppOptions.get("defaultZoomValue");let g=u?`zoom=${u}`:null,p=null,f=r.AppOptions.get("sidebarViewOnLoad"),m=r.AppOptions.get("scrollModeOnLoad"),w=r.AppOptions.get("spreadModeOnLoad");if(i.page&&h!==M){g=`page=${i.page}&zoom=${u||i.zoom},${i.scrollLeft},${i.scrollTop}`;p=parseInt(i.rotation,10);f===n.SidebarView.UNKNOWN&&(f=0|i.sidebarView);m===n.ScrollMode.UNKNOWN&&(m=0|i.scrollMode);w===n.SpreadMode.UNKNOWN&&(w=0|i.spreadMode)}o&&f===n.SidebarView.UNKNOWN&&(f=(0,n.apiPageModeToSidebarView)(o));if(s&&m===n.ScrollMode.UNKNOWN&&w===n.SpreadMode.UNKNOWN){w=(0,n.apiPageLayoutToViewerModes)(s).spreadMode}this.setInitialView(g,{rotation:p,sidebarView:f,scrollMode:m,spreadMode:w});this.eventBus.dispatch("documentinit",{source:this});this.isViewerEmbedded||a.focus();await Promise.race([d,new Promise((e=>{setTimeout(e,10)}))]);if((c||g)&&!a.hasEqualPageSizes){this.initialBookmark=c;a.currentScaleValue=a.currentScaleValue;this.setInitialView(g)}})).catch((()=>{this.setInitialView()})).then((function(){a.update()}))}));d.then((()=>{this._unblockDocumentLoadEvent();this._initializeAutoPrint(e,s)}),(e=>{N.onError&&N.onError(e);this.l10n.get("loading_error").then((t=>{this._documentError(t,{message:e?.message})}))}));h.then((t=>{this.externalServices.reportTelemetry({type:"pageInfo",timestamp:t.timestamp});e.getOutline().then((t=>{e===this.pdfDocument&&this.pdfOutlineViewer.render({outline:t,pdfDocument:e})}));e.getAttachments().then((t=>{e===this.pdfDocument&&this.pdfAttachmentViewer.render({attachments:t})}));a.optionalContentConfigPromise.then((t=>{e===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:t,pdfDocument:e})}));if("requestIdleCallback"in window){const t=window.requestIdleCallback((()=>{this._collectTelemetry(e);this._idleCallbacks.delete(t)}),{timeout:1e3});this._idleCallbacks.add(t)}}));this._initializePageLabels(e);this._initializeMetadata(e)},async _scriptingDocProperties(e){if(!this.documentInfo){await new Promise((e=>{this.eventBus._on("metadataloaded",e,{once:!0})}));if(e!==this.pdfDocument)return null}if(!this._contentLength){await new Promise((e=>{this.eventBus._on("documentloaded",e,{once:!0})}));if(e!==this.pdfDocument)return null}return{...this.documentInfo,baseURL:this.baseUrl,filesize:this._contentLength,filename:this._docFilename,metadata:this.metadata?.getRaw(),authors:this.metadata?.get("dc:creator"),numPages:this.pagesCount,URL:this.url}},async _collectTelemetry(e){const t=await this.pdfDocument.getMarkInfo();if(e!==this.pdfDocument)return;const i=t?.Marked||!1;this.externalServices.reportTelemetry({type:"tagged",tagged:i})},async _initializeAutoPrint(e,t){const[i,r]=await Promise.all([t,this.pdfViewer.enableScripting?null:e.getJavaScript()]);if(e!==this.pdfDocument)return;let o=!1;"Print"===i?.action&&(o=!0);if(r){r.some((e=>{if(!e)return!1;Window.ngxConsole.warn("Warning: JavaScript support is not enabled");this.fallback(s.UNSUPPORTED_FEATURES.javaScript);return!0}));if(!o)for(const e of r)if(e&&n.AutoPrintRegExp.test(e)){o=!0;break}}o&&this.triggerPrinting()},async _initializeMetadata(e){const{info:t,metadata:i,contentDispositionFilename:n,contentLength:r}=await e.getMetadata();if(e!==this.pdfDocument)return;this.documentInfo=t;this.metadata=i;this._contentDispositionFilename??=n;this._contentLength??=r;const o=window.PDFViewerApplicationOptions;if(!o||o.get("verbosity")>0){Window.ngxConsole.log("PDF viewer: ngx-extended-pdf-viewer running on pdf.js "+(window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"].version:" developer version (?)"));Window.ngxConsole.log(`PDF ${e.fingerprints[0]} [${t.PDFFormatVersion} ${(t.Producer||"-").trim()} / ${(t.Creator||"-").trim()}] (PDF.js: ${s.version||"-"}`+(this.pdfViewer.enableWebGL?" [WebGL]":"")+") modified by ngx-extended-pdf-viewer)")}let a=t?.Title;const l=i?.get("dc:title");l&&("Untitled"===l||/[\uFFF0-\uFFFF]/g.test(l)||(a=l));a?this.setTitle(`${a} - ${this._contentDispositionFilename||document.title}`):this._contentDispositionFilename&&this.setTitle(this._contentDispositionFilename);if(!t.IsXFAPresent||t.IsAcroFormPresent||e.isPureXfa){if((t.IsAcroFormPresent||t.IsXFAPresent)&&!this.pdfViewer.renderForms){Window.ngxConsole.warn("Warning: Interactive form support is not enabled");this.fallback(s.UNSUPPORTED_FEATURES.forms)}}else{e.loadingParams.enableXfa?Window.ngxConsole.warn("Warning: XFA Foreground documents are not supported"):Window.ngxConsole.warn("Warning: XFA support is not enabled");this.fallback(s.UNSUPPORTED_FEATURES.forms)}if(t.IsSignaturesPresent){Window.ngxConsole.warn("Warning: Digital signatures validation is not supported");this.fallback(s.UNSUPPORTED_FEATURES.signatures)}let h="other";D.includes(t.PDFFormatVersion)&&(h=`v${t.PDFFormatVersion.replace(".","_")}`);let d="other";if(t.Producer){const e=t.Producer.toLowerCase();B.some((function(t){if(!e.includes(t))return!1;d=t.replace(/[ .-]/g,"_");return!0}))}let c=null;t.IsXFAPresent?c="xfa":t.IsAcroFormPresent&&(c="acroform");this.externalServices.reportTelemetry({type:"documentInfo",version:h,generator:d,formType:c});this.eventBus.dispatch("metadataloaded",{source:this})},async _initializePageLabels(e){const t=await e.getPageLabels();if(e!==this.pdfDocument)return;if(!t||r.AppOptions.get("disablePageLabels"))return;const i=t.length;let n=0,s=0;for(let e=0;e<i;e++){const i=t[e];if(i===(e+1).toString())n++;else{if(""!==i)break;s++}}if(n>=i||s>=i)return;const{pdfViewer:o,pdfThumbnailViewer:a,toolbar:l}=this;o.setPageLabels(t);a.setPageLabels(t);l.setPagesCount(i,!0);l.setPageNumber(o.currentPageNumber,o.currentPageLabel)},_initializePdfHistory({fingerprint:e,viewOnLoad:t,initialDest:i=null}){if(this.pdfHistory){this.pdfHistory.initialize({fingerprint:e,resetHistory:t===M,updateUrl:r.AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(i&&!this.initialBookmark&&t===I){this.initialBookmark=JSON.stringify(i);this.pdfHistory.push({explicitDest:i,pageNumber:null})}}},_initializeAnnotationStorageCallbacks(e){if(e!==this.pdfDocument)return;const{annotationStorage:t}=e;t.onSetModified=()=>{window.addEventListener("beforeunload",beforeUnload);this._annotationStorageModified=!0};t.onResetModified=()=>{window.removeEventListener("beforeunload",beforeUnload);delete this._annotationStorageModified}},setInitialView(e,{rotation:t,sidebarView:i,scrollMode:s,spreadMode:r}={}){const setRotation=e=>{(0,n.isValidRotation)(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0;this.pdfSidebar.setInitialView(i);((e,t)=>{(0,n.isValidScrollMode)(e)&&(this.pdfViewer.scrollMode=e);(0,n.isValidSpreadMode)(t)&&(this.pdfViewer.spreadMode=t)})(s,r);if(this.initialBookmark){setRotation(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(e){setRotation(t);this.pdfLinkService.setHash(e)}this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){const e=PDFViewerApplicationOptions.get("defaultZoomValue");e&&(this.pdfViewer.currentScaleValue=e)}},_cleanup(){if(this.pdfDocument){this.pdfViewer.cleanup();this.pdfThumbnailViewer.cleanup();this.pdfDocument.cleanup(this.pdfViewer.renderer===n.RendererType.SVG)}},forceRendering(){this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar.visibleView===n.SidebarView.THUMBS;this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){this._printAnnotationStoragePromise=this.pdfScriptingManager.dispatchWillPrint().catch((()=>{})).then((()=>this.pdfDocument?.annotationStorage.print));if(this.printService)return;if(!this.supportsPrinting){this.l10n.get("printing_not_supported").then((e=>{this._otherError(e)}));return}if(!this.pdfViewer.pageViewsReady){this.l10n.get("printing_not_ready").then((e=>{window.alert(e)}));return}const e=this.pdfViewer.getPagesOverview(),t=this.appConfig.printContainer,i=r.AppOptions.get("printResolution"),n=this.pdfViewer.optionalContentConfigPromise,s=R.instance.createPrintService(this.pdfDocument,e,t,i,n,this._printAnnotationStoragePromise,this.l10n,this.pdfViewer.eventBus);this.printService=s;this.forceRendering();s.layout();this.externalServices.reportTelemetry({type:"print"})},afterPrint(){if(this._printAnnotationStoragePromise){this._printAnnotationStoragePromise.then((()=>{this.pdfScriptingManager.dispatchDidPrint()}));this._printAnnotationStoragePromise=null}if(this.printService){this.printService.destroy();this.printService=null;this.pdfDocument?.annotationStorage.resetModified()}this.forceRendering()},rotatePages(e){this.pdfViewer.pagesRotation+=e},requestPresentationMode(){this.pdfPresentationMode?.request()},triggerPrinting(){this.supportsPrinting&&window.printPDF()},bindEvents(){const{eventBus:e,_boundEvents:t}=this;t.beforePrint=this.beforePrint.bind(this);t.afterPrint=this.afterPrint.bind(this);e._on("resize",webViewerResize);e._on("hashchange",webViewerHashchange);e._on("beforeprint",t.beforePrint);e._on("afterprint",t.afterPrint);e._on("pagerendered",webViewerPageRendered);e._on("updateviewarea",webViewerUpdateViewarea);e._on("pagechanging",webViewerPageChanging);e._on("scalechanging",webViewerScaleChanging);e._on("rotationchanging",webViewerRotationChanging);e._on("sidebarviewchanged",webViewerSidebarViewChanged);e._on("pagemode",webViewerPageMode);e._on("namedaction",webViewerNamedAction);e._on("presentationmodechanged",webViewerPresentationModeChanged);e._on("presentationmode",webViewerPresentationMode);e._on("switchannotationeditormode",webViewerSwitchAnnotationEditorMode);e._on("switchannotationeditorparams",webViewerSwitchAnnotationEditorParams);e._on("print",webViewerPrint);e._on("download",webViewerDownload);e._on("firstpage",webViewerFirstPage);e._on("lastpage",webViewerLastPage);e._on("nextpage",webViewerNextPage);e._on("previouspage",webViewerPreviousPage);e._on("zoomin",webViewerZoomIn);e._on("zoomout",webViewerZoomOut);e._on("zoomreset",webViewerZoomReset);e._on("pagenumberchanged",webViewerPageNumberChanged);e._on("scalechanged",webViewerScaleChanged);e._on("rotatecw",webViewerRotateCw);e._on("rotateccw",webViewerRotateCcw);e._on("optionalcontentconfig",webViewerOptionalContentConfig);e._on("switchscrollmode",webViewerSwitchScrollMode);e._on("scrollmodechanged",webViewerScrollModeChanged);e._on("switchspreadmode",webViewerSwitchSpreadMode);e._on("spreadmodechanged",webViewerSpreadModeChanged);e._on("documentproperties",webViewerDocumentProperties);e._on("findfromurlhash",webViewerFindFromUrlHash);e._on("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._on("updatefindcontrolstate",webViewerUpdateFindControlState);if(r.AppOptions.get("pdfBug")){t.reportPageStatsPDFBug=reportPageStatsPDFBug;e._on("pagerendered",t.reportPageStatsPDFBug);e._on("pagechanging",t.reportPageStatsPDFBug)}e._on("fileinputchange",webViewerFileInputChange);e._on("openfile",webViewerOpenFile)},bindWindowEvents(){const{eventBus:e,_boundEvents:t}=this;t.windowResize=()=>{e.dispatch("resize",{source:window})};t.windowHashChange=()=>{e.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})};t.windowBeforePrint=()=>{e.dispatch("beforeprint",{source:window})};t.windowAfterPrint=()=>{e.dispatch("afterprint",{source:window})};t.windowUpdateFromSandbox=t=>{e.dispatch("updatefromsandbox",{source:window,detail:t.detail})};window.addEventListener("visibilitychange",webViewerVisibilityChange);window.addEventListener("wheel",webViewerWheel,{passive:!1});window.addEventListener("click",webViewerClick);window.addEventListener("keydown",webViewerKeyDown);window.addEventListener("resize",t.windowResize);window.addEventListener("hashchange",t.windowHashChange);window.addEventListener("beforeprint",t.windowBeforePrint);window.addEventListener("afterprint",t.windowAfterPrint);window.addEventListener("updatefromsandbox",t.windowUpdateFromSandbox)},unbindEvents(){const{eventBus:e,_boundEvents:t}=this;e._off("resize",webViewerResize);e._off("hashchange",webViewerHashchange);e._off("beforeprint",t.beforePrint);e._off("afterprint",t.afterPrint);e._off("pagerendered",webViewerPageRendered);e._off("updateviewarea",webViewerUpdateViewarea);e._off("pagechanging",webViewerPageChanging);e._off("scalechanging",webViewerScaleChanging);e._off("rotationchanging",webViewerRotationChanging);e._off("sidebarviewchanged",webViewerSidebarViewChanged);e._off("pagemode",webViewerPageMode);e._off("namedaction",webViewerNamedAction);e._off("presentationmodechanged",webViewerPresentationModeChanged);e._off("presentationmode",webViewerPresentationMode);e._off("print",webViewerPrint);e._off("download",webViewerDownload);e._off("firstpage",webViewerFirstPage);e._off("lastpage",webViewerLastPage);e._off("nextpage",webViewerNextPage);e._off("previouspage",webViewerPreviousPage);e._off("zoomin",webViewerZoomIn);e._off("zoomout",webViewerZoomOut);e._off("zoomreset",webViewerZoomReset);e._off("pagenumberchanged",webViewerPageNumberChanged);e._off("scalechanged",webViewerScaleChanged);e._off("rotatecw",webViewerRotateCw);e._off("rotateccw",webViewerRotateCcw);e._off("optionalcontentconfig",webViewerOptionalContentConfig);e._off("switchscrollmode",webViewerSwitchScrollMode);e._off("scrollmodechanged",webViewerScrollModeChanged);e._off("switchspreadmode",webViewerSwitchSpreadMode);e._off("spreadmodechanged",webViewerSpreadModeChanged);e._off("documentproperties",webViewerDocumentProperties);e._off("findfromurlhash",webViewerFindFromUrlHash);e._off("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._off("updatefindcontrolstate",webViewerUpdateFindControlState);if(t.reportPageStatsPDFBug){e._off("pagerendered",t.reportPageStatsPDFBug);e._off("pagechanging",t.reportPageStatsPDFBug);t.reportPageStatsPDFBug=null}e._off("fileinputchange",webViewerFileInputChange);e._off("openfile",webViewerOpenFile);t.beforePrint=null;t.afterPrint=null},unbindWindowEvents(){const{_boundEvents:e}=this;window.removeEventListener("visibilitychange",webViewerVisibilityChange);window.removeEventListener("wheel",webViewerWheel,{passive:!1});window.removeEventListener("click",webViewerClick);window.removeEventListener("keydown",webViewerKeyDown);window.removeEventListener("resize",e.windowResize);window.removeEventListener("hashchange",e.windowHashChange);window.removeEventListener("beforeprint",e.windowBeforePrint);window.removeEventListener("afterprint",e.windowAfterPrint);window.removeEventListener("updatefromsandbox",e.windowUpdateFromSandbox);e.windowResize=null;e.windowHashChange=null;e.windowBeforePrint=null;e.windowAfterPrint=null;e.windowUpdateFromSandbox=null},accumulateWheelTicks(e){(this._wheelUnusedTicks>0&&e<0||this._wheelUnusedTicks<0&&e>0)&&(this._wheelUnusedTicks=0);this._wheelUnusedTicks+=e;const t=Math.sign(this._wheelUnusedTicks)*Math.floor(Math.abs(this._wheelUnusedTicks));this._wheelUnusedTicks-=t;return t},_unblockDocumentLoadEvent(){document.blockUnblockOnload?.(!1);this._unblockDocumentLoadEvent=()=>{}},_reportDocumentStatsTelemetry(){const{stats:e}=this.pdfDocument;if(e!==this._docStats){this._docStats=e;this.externalServices.reportTelemetry({type:"documentStats",stats:e})}},get scriptingReady(){return this.pdfScriptingManager.ready}};t.PDFViewerApplication=N;let O;{const e=["null","http://mozilla.github.io","https://mozilla.github.io"];O=function(t){if(t)try{const i=new URL(window.location.href).origin||"null";if(e.includes(i))return;if(new URL(t,window.location.href).origin!==i)throw new Error("file origin does not match viewer's")}catch(e){N.onError&&N.onError(e);N.l10n.get("loading_error").then((t=>{N._documentError(t,{message:e?.message})}));throw e}}}async function loadPDFBug(e){const{debuggerScriptPath:t}=e.appConfig,{PDFBug:i}=await import(t);e._PDFBug=i}function reportPageStatsPDFBug({pageNumber:e}){if(!globalThis.Stats?.enabled)return;const t=N.pdfViewer.getPageView(e-1);globalThis.Stats.add(e,t?.pdfPage?.stats)}function webViewerInitialized(){const{appConfig:e,eventBus:t}=N;let i;const s=document.location.search.substring(1);i=(0,n.parseQueryString)(s).get("file")??r.AppOptions.get("defaultUrl");O(i);const o=e.openFileInput;o.value=null;o.addEventListener("change",(function(e){const{files:i}=e.target;i&&0!==i.length&&t.dispatch("fileinputchange",{source:this,fileInput:e.target})}));e.mainContainer.addEventListener("dragover",(function(e){if(r.AppOptions.get("enableDragAndDrop")){e.preventDefault();e.dataTransfer.dropEffect="copy"===e.dataTransfer.effectAllowed?"copy":"move"}}));e.mainContainer.addEventListener("drop",(function(e){if(r.AppOptions.get("enableDragAndDrop")){e.preventDefault();const{files:t}=e.dataTransfer;if(!t||0===t.length)return;N.eventBus.dispatch("fileinputchange",{source:this,fileInput:e.dataTransfer,dropEvent:e})}}));if(!N.supportsDocumentFonts){r.AppOptions.set("disableFontFace",!0);N.l10n.get("web_fonts_disabled").then((e=>{Window.ngxConsole.warn(e)}))}if(!N.supportsPrinting){e.toolbar.print.classList.add("hidden");e.secondaryToolbar.printButton.classList.add("hidden")}if(!N.supportsFullscreen){e.toolbar.presentationModeButton.classList.add("hidden");e.secondaryToolbar.presentationModeButton.classList.add("hidden")}N.supportsIntegratedFind&&e.toolbar.viewFind.classList.add("hidden");e.mainContainer.addEventListener("transitionend",(function(e){e.target===this&&t.dispatch("resize",{source:this})}),!0);try{i?N.open(i):N._hideViewBookmark()}catch(e){N.onError&&N.onError(e);N.l10n.get("loading_error").then((t=>{N._documentError(t,e)}))}}function webViewerPageRendered({pageNumber:e,error:t}){e===N.page&&N.toolbar.updateLoadingIndicatorState(!1);if(N.pdfSidebar.visibleView===n.SidebarView.THUMBS){const t=N.pdfViewer.getPageView(e-1),i=N.pdfThumbnailViewer.getThumbnail(e-1);t&&i&&i.setImage(t)}t&&N.l10n.get("rendering_error").then((e=>{N._otherError(e,t)}));N._reportDocumentStatsTelemetry()}function webViewerPageMode({mode:e}){let t;switch(e){case"thumbs":t=n.SidebarView.THUMBS;break;case"bookmarks":case"outline":t=n.SidebarView.OUTLINE;break;case"attachments":t=n.SidebarView.ATTACHMENTS;break;case"layers":t=n.SidebarView.LAYERS;break;case"none":t=n.SidebarView.NONE;break;default:Window.ngxConsole.error('Invalid "pagemode" hash parameter: '+e);return}N.pdfSidebar.switchView(t,!0)}function webViewerNamedAction(e){switch(e.action){case"GoToPage":N.appConfig.toolbar.pageNumber.select();break;case"Find":N.supportsIntegratedFind||N.findBar.toggle();break;case"Print":N.triggerPrinting();break;case"SaveAs":N.downloadOrSave()}}function webViewerPresentationModeChanged(e){N.pdfViewer.presentationModeState=e.state}function webViewerSidebarViewChanged({view:e}){N.pdfRenderingQueue.isThumbnailViewEnabled=e===n.SidebarView.THUMBS;N.isInitialViewSet&&N.store?.set("sidebarView",e).catch((()=>{}))}function webViewerUpdateViewarea({location:e}){if(N.isInitialViewSet){const t={};void 0===e.pageNumber&&null===e.pageNumber||(t.page=e.pageNumber);e.scale&&(t.zoom=e.scale);e.left&&(t.scrollLeft=e.left);e.top&&(t.scrollTop=e.top);void 0===e.rotation&&null===e.rotation||(t.rotation=e.rotation);N.store?.setMultiple(t).catch((()=>{}))}const t=N.pdfLinkService.getAnchorUrl(e.pdfOpenParams);N.appConfig.toolbar.viewBookmark.href=t;N.appConfig.secondaryToolbar.viewBookmarkButton.href=t;const i=N.pdfViewer.getPageView(N.page-1)?.renderingState!==n.RenderingStates.FINISHED;N.toolbar.updateLoadingIndicatorState(i)}function webViewerScrollModeChanged(e){N.isInitialViewSet&&N.store?.set("scrollMode",e.mode).catch((()=>{}))}function webViewerSpreadModeChanged(e){N.isInitialViewSet&&N.store?.set("spreadMode",e.mode).catch((()=>{}))}function webViewerResize(){const{pdfDocument:e,pdfViewer:t}=N;t.updateContainerHeightCss();if(!e)return;const i=t.currentScaleValue;"auto"!==i&&"page-fit"!==i&&"page-width"!==i||(t.currentScaleValue=i);t.update()}function webViewerHashchange(e){const t=e.hash;t&&(N.isInitialViewSet?N.pdfHistory?.popStateInProgress||N.pdfLinkService.setHash(t):N.initialBookmark=t)}var webViewerFileInputChange=function(e){if(N.pdfViewer?.isInPresentationMode)return;const t=e.fileInput.files[0];let i=URL.createObjectURL(t);t.name&&(i={url:i,originalUrl:t.name});N.open(i);window.setNgxExtendedPdfViewerSource&&window.setNgxExtendedPdfViewerSource(t.name?t.name:i)},webViewerOpenFile=function(e){N.appConfig.openFileInput.click()};function webViewerPresentationMode(){N.requestPresentationMode()}function webViewerSwitchAnnotationEditorMode(e){N.pdfViewer.annotationEditorMode=e.mode}function webViewerSwitchAnnotationEditorParams(e){N.pdfViewer.annotationEditorParams=e}function webViewerPrint(){N.triggerPrinting()}function webViewerDownload(){N.downloadOrSave()}function webViewerFirstPage(){N.pdfDocument&&(N.page=1)}function webViewerLastPage(){N.pdfDocument&&(N.page=N.pagesCount)}function webViewerNextPage(){N.pdfViewer.nextPage()}function webViewerPreviousPage(){N.pdfViewer.previousPage()}function webViewerZoomIn(){N.zoomIn()}function webViewerZoomOut(){N.zoomOut()}function webViewerZoomReset(){N.zoomReset()}function webViewerPageNumberChanged(e){const t=N.pdfViewer;""!==e.value&&N.pdfLinkService.goToPage(e.value);e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel&&N.toolbar.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function webViewerScaleChanged(e){N.pdfViewer.currentScaleValue=e.value}function webViewerRotateCw(){N.rotatePages(90)}function webViewerRotateCcw(){N.rotatePages(-90)}function webViewerOptionalContentConfig(e){N.pdfViewer.optionalContentConfigPromise=e.promise}function webViewerSwitchScrollMode(e){N.pdfViewer.scrollMode=e.mode}function webViewerSwitchSpreadMode(e){N.pdfViewer.spreadMode=e.mode}function webViewerDocumentProperties(){N.pdfDocumentProperties.open()}function webViewerFindFromUrlHash(e){N.eventBus.dispatch("find",{source:e.source,type:"",query:e.query,phraseSearch:e.phraseSearch,caseSensitive:!1,entireWord:!1,ignoreAccents:!1,fuzzySearch:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})}function webViewerUpdateFindMatchesCount({matchesCount:e}){N.supportsIntegratedFind?N.externalServices.updateFindMatchesCount(e):N.findBar.updateResultsCount(e)}function webViewerUpdateFindControlState({state:e,previous:t,matchesCount:i,rawQuery:n}){N.supportsIntegratedFind?N.externalServices.updateFindControlState({result:e,findPrevious:t,matchesCount:i,rawQuery:n}):N.findBar.updateUIState(e,t,i)}function webViewerScaleChanging(e){N.toolbar.setPageScale(e.presetValue,e.scale);N.pdfViewer.update()}function webViewerRotationChanging(e){N.pdfThumbnailViewer.pagesRotation=e.pagesRotation;N.forceRendering();N.pdfViewer.currentPageNumber=e.pageNumber}function webViewerPageChanging({pageNumber:e,pageLabel:t}){N.toolbar.setPageNumber(e,t);N.secondaryToolbar.setPageNumber(e);N.pdfSidebar.visibleView===n.SidebarView.THUMBS&&N.pdfThumbnailViewer.scrollThumbnailIntoView(e);const i=document.getElementById("pageNumber");if(i){const e=new CustomEvent("page-change");i.dispatchEvent(e)}}function webViewerVisibilityChange(e){"visible"===document.visibilityState&&setZoomDisabledTimeout()}let V=null;function setZoomDisabledTimeout(){V&&clearTimeout(V);V=setTimeout((function(){V=null}),1e3)}function webViewerWheel(e){const t=document.getElementById("viewerContainer");if(t.parentNode.querySelector(":hover")!==t)return;const{pdfViewer:i,supportedMouseWheelZoomModifierKeys:s}=N;if(i.isInPresentationMode)return;const o=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(window.isKeyIgnored&&window.isKeyIgnored(o,"WHEEL"))return;const a=r.AppOptions.get("wheelAction");if(e.ctrlKey&&s.ctrlKey||e.metaKey&&s.metaKey?"zoom"!==a:"zoom"===a){e.preventDefault();if(V||"hidden"===document.visibilityState)return;const t=e.deltaMode,s=(0,n.normalizeWheelEventDirection)(e),r=i.currentScale;let o=0;if(t===WheelEvent.DOM_DELTA_LINE||t===WheelEvent.DOM_DELTA_PAGE)o=Math.abs(s)>=1?Math.sign(s):N.accumulateWheelTicks(s);else{const e=30;o=N.accumulateWheelTicks(s/e)}o<0?N.zoomOut(-o):o>0&&N.zoomIn(o);const a=i.currentScale;if(r!==a){const t=a/r-1,n=i.container.getBoundingClientRect(),s=e.clientX-n.left,o=e.clientY-n.top;i.container.scrollLeft+=s*t;i.container.scrollTop+=o*t}}else setZoomDisabledTimeout()}function webViewerClick(e){if(!N.secondaryToolbar.isOpen)return;const t=N.appConfig;if(N.pdfViewer.containsElement(e.target)||t.toolbar.container.contains(e.target)&&e.target!==t.secondaryToolbar.toggleButton){if(e.target&&e.target.parentElement===t.secondaryToolbar.toggleButton)return;if(e.target&&e.target.parentElement&&e.target.parentElement.parentElement===t.secondaryToolbar.toggleButton)return;N.secondaryToolbar.close()}}function webViewerKeyDown(e){if(N.overlayManager.active)return;const{eventBus:t,pdfViewer:i}=N,s=i.isInPresentationMode;let r=!1,o=!1;const l=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(window.isKeyIgnored&&window.isKeyIgnored(l,e.keyCode))return;if(1===l||8===l||5===l||12===l)switch(e.keyCode){case 70:if(!N.supportsIntegratedFind&&!e.shiftKey){N.findBar.open();r=!0}break;case 71:if(!N.supportsIntegratedFind){const{state:e}=N.findController;if(e){const i=Object.assign(Object.create(null),e,{source:window,type:"again",findPrevious:5===l||12===l});t.dispatch("find",i)}r=!0}break;case 61:case 107:case 187:case 171:s||N.zoomIn();r=!0;break;case 173:case 109:case 189:s||N.zoomOut();r=!0;break;case 48:case 96:if(!s){setTimeout((function(){N.zoomReset()}));r=!1}break;case 38:if(s||N.page>1){N.page=1;r=!0;o=!0}break;case 40:if(s||N.page<N.pagesCount){N.page=N.pagesCount;r=!0;o=!0}}if(1===l||8===l)switch(e.keyCode){case 83:t.dispatch("download",{source:window});r=!0;break;case 79:t.dispatch("openfile",{source:window});r=!0}if(3===l||10===l)switch(e.keyCode){case 80:N.requestPresentationMode();r=!0;break;case 71:N.appConfig.toolbar.pageNumber.select();r=!0}if(r){o&&!s&&i.focus();e.preventDefault();return}const h=(0,n.getActiveOrFocusedElement)(),d=h?.tagName.toUpperCase();if("INPUT"!==d&&"TEXTAREA"!==d&&"SELECT"!==d&&!h?.isContentEditable||27===e.keyCode){if(0===l){let t=0,n=!1;switch(e.keyCode){case 38:case 33:i.isVerticalScrollbarEnabled&&(n=!0);t=-1;break;case 8:s||(n=!0);t=-1;break;case 37:i.isHorizontalScrollbarEnabled&&(n=!0);case 75:case 80:t=-1;break;case 27:if(N.secondaryToolbar.isOpen){N.secondaryToolbar.close();r=!0}if(!N.supportsIntegratedFind&&N.findBar.opened){N.findBar.close();r=!0}break;case 40:case 34:i.isVerticalScrollbarEnabled&&(n=!0);t=1;break;case 13:case 32:s||(n=!0);t=1;break;case 39:i.isHorizontalScrollbarEnabled&&(n=!0);case 74:case 78:t=1;break;case 36:if(s||N.page>1){N.page=1;r=!0;o=!0}break;case 35:if(s||N.page<N.pagesCount){N.page=N.pagesCount;r=!0;o=!0}break;case 83:N.pdfCursorTools.switchTool(a.CursorTool.SELECT);break;case 72:N.pdfCursorTools.switchTool(a.CursorTool.HAND);break;case 82:N.rotatePages(90);break;case 115:N.pdfSidebar.toggle()}if(0!==t&&(!n||"page-fit"===i.currentScaleValue)){t>0?i.nextPage():i.previousPage();r=!0}}if(4===l)switch(e.keyCode){case 13:case 32:if(!s&&"page-fit"!==i.currentScaleValue)break;i.previousPage();r=!0;break;case 82:N.rotatePages(-90)}o&&!i.containsElement(h)&&i.focus();r&&e.preventDefault()}}function beforeUnload(e){e.preventDefault();e.returnValue="";return!1}const R={instance:{supportsPrinting:!1,createPrintService(){throw new Error("Not implemented: createPrintService")}}};t.PDFPrintServiceFactory=R},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.animationStarted=t.VERTICAL_PADDING=t.UNKNOWN_SCALE=t.TextLayerMode=t.SpreadMode=t.SidebarView=t.ScrollMode=t.SCROLLBAR_PADDING=t.RenderingStates=t.RendererType=t.ProgressBar=t.PresentationModeState=t.OutputScale=t.MIN_SCALE=t.MAX_SCALE=t.MAX_AUTO_SCALE=t.DEFAULT_SCALE_VALUE=t.DEFAULT_SCALE_DELTA=t.DEFAULT_SCALE=t.AutoPrintRegExp=void 0;t.apiPageLayoutToViewerModes=function apiPageLayoutToViewerModes(e){let t=r.VERTICAL,i=o.NONE;switch(e){case"SinglePage":t=r.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=r.PAGE;case"TwoColumnLeft":i=o.ODD;break;case"TwoPageRight":t=r.PAGE;case"TwoColumnRight":i=o.EVEN}return{scrollMode:t,spreadMode:i}};t.apiPageModeToSidebarView=function apiPageModeToSidebarView(e){switch(e){case"UseNone":return s.NONE;case"UseThumbs":return s.THUMBS;case"UseOutlines":return s.OUTLINE;case"UseAttachments":return s.ATTACHMENTS;case"UseOC":return s.LAYERS}return s.NONE};t.approximateFraction=function approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,o=1,a=1;for(;;){const e=s+o,t=r+a;if(t>8)break;if(i<=e/t){o=e;a=t}else{s=e;r=t}}n=i-s/r<o/a-i?i===e?[s,r]:[r,s]:i===e?[o,a]:[a,o];return n};t.backtrackBeforeAllVisibleElements=backtrackBeforeAllVisibleElements;t.docStyle=void 0;t.getActiveOrFocusedElement=function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;){e=t.shadowRoot;t=e.activeElement||e.querySelector(":focus")}return t};t.getPageSizeInches=function getPageSizeInches({view:e,userUnit:t,rotate:i}){const[n,s,r,o]=e,a=i%180!=0,l=(r-n)/72*t,h=(o-s)/72*t;return{width:a?h:l,height:a?l:h}};t.getVisibleElements=function getVisibleElements({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:s=!1,rtl:r=!1}){const o=e.scrollTop,a=o+e.clientHeight,l=e.scrollLeft,h=l+e.clientWidth;const d=[],c=new Set,u=t.length;let g=(0,n.binarySearchFirstItem)(t,s?function isElementNextAfterViewHorizontally(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return r?i<h:n>l}:function isElementBottomAfterViewTop(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>o});g>0&&g<u&&!s&&(g=backtrackBeforeAllVisibleElements(g,t,o));let p=s?h:-1;for(let e=g;e<u;e++){const i=t[e],n=i.div,r=n.offsetLeft+n.clientLeft,u=n.offsetTop+n.clientTop,g=n.clientWidth,f=n.clientHeight,m=r+g,w=u+f;if(-1===p)w>=a&&(p=w);else if((s?r:u)>p)break;if(w<=o||u>=a||m<=l||r>=h)continue;const v=Math.max(0,o-u)+Math.max(0,w-a),b=Math.max(0,l-r)+Math.max(0,m-h),_=(g-b)/g,P=(f-v)/f*_*100|0;d.push({id:i.id,x:r,y:u,view:i,percent:P,widthPercent:100*_|0});c.add(i.id)}const f=d[0],m=d.at(-1);i&&d.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id}));return{first:f,last:m,views:d,ids:c}};t.isPortraitOrientation=function isPortraitOrientation(e){return e.width<=e.height};t.isValidRotation=function isValidRotation(e){return Number.isInteger(e)&&e%90==0};t.isValidScrollMode=function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(r).includes(e)&&e!==r.UNKNOWN};t.isValidSpreadMode=function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(o).includes(e)&&e!==o.UNKNOWN};t.noContextMenuHandler=function noContextMenuHandler(e){e.preventDefault()};t.normalizeWheelEventDelta=function normalizeWheelEventDelta(e){let t=normalizeWheelEventDirection(e);0===e.deltaMode?t/=900:1===e.deltaMode&&(t/=30);return t};t.normalizeWheelEventDirection=normalizeWheelEventDirection;t.parseQueryString=function parseQueryString(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t};t.removeNullCharacters=function removeNullCharacters(e,t=!1){if("string"!=typeof e){console.error("The argument must be a string.");return e}t&&(e=e.replace(l," "));return e.replace(a,"")};t.roundToDivide=function roundToDivide(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)};t.scrollIntoView=function scrollIntoView(e,t,i=!1,n=!1){if(e.classList.contains("stf__item")){Window.ngxConsole.log("don't scroll in book mode");return}let s=e.offsetParent;if(!s){Window.ngxConsole.error("offsetParent is not set -- cannot scroll");return}let r=e.offsetTop+e.clientTop,o=e.offsetLeft+e.clientLeft;for(;s.clientHeight===s.scrollHeight&&s.clientWidth===s.scrollWidth||i&&(s.classList.contains("markedContent")||"hidden"===getComputedStyle(s).overflow);){r+=s.offsetTop;o+=s.offsetLeft;s=s.offsetParent;if(!s){if(n&&document.body.clientHeight>r){r-=32;window.scrollTo(window.scrollX,r)}return}}if(t){void 0!==t.top&&(r+=t.top);if(void 0!==t.left){o+=t.left;s.scrollLeft=o}}s.scrollTop=r};t.watchScroll=function watchScroll(e,t){const debounceScroll=function(s){n||(n=window.requestAnimationFrame((function viewAreaElementScrolled(){n=null;const s=e.scrollLeft,r=i.lastX;s!==r&&(i.right=s>r);i.lastX=s;const o=e.scrollTop,a=i.lastY;o!==a&&(i.down=o>a);i.lastY=o;t(i)})))},i={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:debounceScroll};let n=null;e.addEventListener("scroll",debounceScroll,!0);return i};var n=i(4);t.DEFAULT_SCALE_VALUE="auto";t.DEFAULT_SCALE=1;t.DEFAULT_SCALE_DELTA=1.1;t.MIN_SCALE=.1;t.MAX_SCALE=10;t.UNKNOWN_SCALE=0;t.MAX_AUTO_SCALE=1.25;t.SCROLLBAR_PADDING=40;t.VERTICAL_PADDING=5;t.RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};t.PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};const s={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};t.SidebarView=s;t.RendererType={CANVAS:"canvas",SVG:"svg"};t.TextLayerMode={DISABLE:0,ENABLE:1,ENABLE_ENHANCE:2};const r={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3};t.ScrollMode=r;const o={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=o;t.AutoPrintRegExp=/\bprint\s*\(/;t.OutputScale=class OutputScale{constructor(){const e=window.devicePixelRatio||1;this.sx=e;this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const a=/\x00/g,l=/[\x01-\x1F]/g;function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;if(s>=i){n=t[e-1].div;s=n.offsetTop+n.clientTop}for(let i=e-2;i>=0;--i){n=t[i].div;if(n.offsetTop+n.clientTop+n.clientHeight<=s)break;e=i}return e}function normalizeWheelEventDirection(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t);return t}const h=new Promise((function(e){window.ngxZone.runOutsideAngular((()=>{window.requestAnimationFrame(e)}))}));t.animationStarted=h;const d=document.documentElement.style;t.docStyle=d;t.ProgressBar=class ProgressBar{#e=null;#t=0;#i=!0;constructor(e){if(arguments.length>1)throw new Error("ProgressBar no longer accepts any additional options, please use CSS rules to modify its appearance instead.");const t=document.getElementById(e);this.#e=t.classList}get percent(){return this.#t}set percent(e){this.#t=function clamp(e,t,i){return Math.min(Math.max(e,t),i)}(e,0,100);if(isNaN(e))this.#e.add("indeterminate");else{this.#e.remove("indeterminate");d.setProperty("--progressBar-percent",`${this.#t}%`)}}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&d.setProperty("--progressBar-end-offset",`${t}px`)}hide(){if(this.#i){this.#i=!1;this.#e.add("hidden")}}show(){if(!this.#i){this.#i=!0;this.#e.remove("hidden")}}}},e=>{e.exports=window["pdfjs-dist/build/pdf"]},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0;t.waitOnEventOrTimeout=function waitOnEventOrTimeout({target:e,name:t,delay:n=0}){return new Promise((function(s,r){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(n)&&n>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function handler(i){e instanceof EventBus?e._off(t,o):e.removeEventListener(t,o);l&&clearTimeout(l);s(i)}const o=handler.bind(null,i.EVENT);e instanceof EventBus?e._on(t,o):e.addEventListener(t,o);const a=handler.bind(null,i.TIMEOUT),l=setTimeout(a,n)}))};const i={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=i;class EventBus{constructor(){this._listeners=Object.create(null)}on(e,t,i=null){this._on(e,t,{external:!0,once:i?.once})}off(e,t,i=null){this._off(e,t,{external:!0,once:i?.once})}dispatch(e,t){const i=this._listeners[e];if(!i||0===i.length)return;let n;for(const{listener:s,external:r,once:o}of i.slice(0)){o&&this._off(e,s);r?(n||=[]).push(s):s(t)}if(n){for(const e of n)e(t);n=null}}_on(e,t,i=null){(this._listeners[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once})}_off(e,t,i=null){const n=this._listeners[e];if(n)for(let e=0,i=n.length;e<i;e++)if(n[e].listener===t){n.splice(e,1);return}}}t.EventBus=EventBus;t.AutomationEventBus=class AutomationEventBus extends EventBus{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFCursorTools=t.CursorTool=void 0;var n=i(7),s=i(3);const r={SELECT:0,HAND:1,ZOOM:2};t.CursorTool=r;t.PDFCursorTools=class PDFCursorTools{constructor({container:e,eventBus:t,cursorToolOnLoad:i=r.SELECT}){this.container=e;this.eventBus=t;this.active=r.SELECT;this.activeBeforePresentationMode=null;this.handTool=new n.GrabToPan({element:this.container});this.#n();Promise.resolve().then((()=>{this.switchTool(i)}))}get activeTool(){return this.active}switchTool(e){if(null!==this.activeBeforePresentationMode)return;if(e===this.active)return;const disableActiveTool=()=>{switch(this.active){case r.SELECT:break;case r.HAND:this.handTool.deactivate()}};switch(e){case r.SELECT:disableActiveTool();break;case r.HAND:disableActiveTool();this.handTool.activate();break;default:Window.ngxConsole.error(`switchTool: "${e}" is an unsupported value.`);return}this.active=e;this.#s()}#s(){this.eventBus.dispatch("cursortoolchanged",{source:this,tool:this.active})}#n(){this.eventBus._on("switchcursortool",(e=>{this.switchTool(e.tool)}));this.eventBus._on("presentationmodechanged",(e=>{switch(e.state){case s.PresentationModeState.FULLSCREEN:{const e=this.active;this.switchTool(r.SELECT);this.activeBeforePresentationMode=e;break}case s.PresentationModeState.NORMAL:{const e=this.activeBeforePresentationMode;this.activeBeforePresentationMode=null;this.switchTool(e);break}}}))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GrabToPan=void 0;const i="grab-to-pan-grab";t.GrabToPan=class GrabToPan{constructor(e){this.element=e.element;this.document=e.element.ownerDocument;"function"==typeof e.ignoreTarget&&(this.ignoreTarget=e.ignoreTarget);this.onActiveChanged=e.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onMouseDown=this.#r.bind(this);this._onMouseMove=this.#o.bind(this);this._endPan=this.#a.bind(this);(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}activate(){if(!this.active){this.active=!0;this.element.addEventListener("mousedown",this._onMouseDown);this.element.classList.add(i);this.onActiveChanged?.(!0)}}deactivate(){if(this.active){this.active=!1;this.element.removeEventListener("mousedown",this._onMouseDown);this._endPan();this.element.classList.remove(i);this.onActiveChanged?.(!1)}}toggle(){this.active?this.deactivate():this.activate()}ignoreTarget(e){return!!document.querySelector(".stf__item")||e.matches("a[href], a[href] *, input, textarea, button, button *, select, option")}#r(e){if(0!==e.button||this.ignoreTarget(e.target))return;if(e.originalTarget)try{e.originalTarget.tagName}catch(e){return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=e.clientX;this.clientYStart=e.clientY;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-x"))return;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-y"))return;this.document.addEventListener("mousemove",this._onMouseMove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);e.preventDefault();e.stopPropagation();const t=document.activeElement;t&&!t.contains(e.target)&&t.blur()}#o(e){this.element.removeEventListener("scroll",this._endPan,!0);if(!(1&e.buttons)){this._endPan();return}const t=e.clientX-this.clientXStart,i=e.clientY-this.clientYStart,n=this.scrollTopStart-i,s=this.scrollLeftStart-t;if(this.element.scrollTo)this.element.scrollTo({top:n,left:s,behavior:"instant"});else{this.element.scrollTop=n;this.element.scrollLeft=s}this.overlay.parentNode||document.body.append(this.overlay)}#a(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onMouseMove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.remove()}};function isOverPerfectScrollbar(e,t,i){const n=document.getElementsByClassName(i);if(n&&1===n.length){var{top:s,right:r,bottom:o,left:a}=n[0].getBoundingClientRect();if(t>=s&&t<=o&&e<=r&&e>=a)return!0}return!1}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var n=i(3);const s={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};t.LinkTarget=s;function addLinkAttributes(e,{url:t,target:i,rel:r,enabled:o=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const a=(0,n.removeNullCharacters)(t);if(o)e.href=e.title=a;else{e.href="";e.title=`Disabled: ${a}`;e.onclick=()=>!1}let l="";switch(i){case s.NONE:break;case s.SELF:l="_self";break;case s.BLANK:l="_blank";break;case s.PARENT:l="_parent";break;case s.TOP:l="_top"}e.target=l;e.rel="string"==typeof r?r:"noopener noreferrer nofollow"}class PDFLinkService{#l=new Map;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=e;this.externalLinkTarget=t;this.externalLinkRel=i;this.externalLinkEnabled=!0;this._ignoreDestinationZoom=n;this.baseUrl=null;this.pdfDocument=null;this.pdfViewer=null;this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t;this.pdfDocument=e;this.#l.clear()}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfViewer.currentPageNumber}set page(e){this.pdfViewer.currentPageNumber=e}get rotation(){return this.pdfViewer.pagesRotation}set rotation(e){this.pdfViewer.pagesRotation=e}#h(e,t=null,i){const n=i[0];let s;if("object"==typeof n&&null!==n){s=this._cachedPageNumber(n);if(!s){this.pdfDocument.getPageIndex(n).then((s=>{this.cachePageRef(s+1,n);this.#h(e,t,i)})).catch((()=>{Window.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid page reference, for dest="${e}".`)}));return}}else{if(!Number.isInteger(n)){Window.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid destination reference, for dest="${e}".`);return}s=n+1}if(!s||s<1||s>this.pagesCount)Window.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${s}" is not a valid page number, for dest="${e}".`);else{if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:s})}this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom})}}async goToDestination(e){if(!this.pdfDocument)return;let t,i;if("string"==typeof e){t=e;i=await this.pdfDocument.getDestination(e)}else{t=null;i=await e}Array.isArray(i)?this.#h(e,t,i):Window.ngxConsole.error(`PDFLinkService.goToDestination: "${i}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;if(Number.isInteger(t)&&t>0&&t<=this.pagesCount){if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(t)}this.pdfViewer.scrollPageIntoView({pageNumber:t})}else Window.ngxConsole.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,i=!1){addLinkAttributes(e,{url:t,target:i?s.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return(this.baseUrl||"")+e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const s=(0,n.parseQueryString)(e);s.has("search")&&this.eventBus.dispatch("findfromurlhash",{source:this,query:s.get("search").replace(/"/g,""),phraseSearch:"true"===s.get("phrase")});s.has("page")&&(t=0|s.get("page")||1);if(s.has("zoom")){const e=s.get("zoom").split(","),t=e[0],n=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?Window.ngxConsole.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:Window.ngxConsole.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,n?n/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t);s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")});s.has("nameddest")&&this.goToDestination(s.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i);Array.isArray(i)||(i=i.toString())}catch(e){}if("string"==typeof i||PDFLinkService.#d(i)){this.goToDestination(i);return}Window.ngxConsole.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}cachePageRef(e,t){if(!t)return;const i=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;this.#l.set(i,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#l.get(t)||null}isPageVisible(e){return this.pdfViewer.isPageVisible(e)}isPageCached(e){return this.pdfViewer.isPageCached(e)}static#d(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const i=e[0];if(!("object"==typeof i&&Number.isInteger(i.num)&&Number.isInteger(i.gen)||Number.isInteger(i)&&i>=0))return!1;const n=e[1];if("object"!=typeof n||"string"!=typeof n.name)return!1;let s=!0;switch(n.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;s=!1;break;default:return!1}for(let i=2;i<t;i++){const t=e[i];if(!("number"==typeof t||s&&null===t))return!1}return!0}}t.PDFLinkService=PDFLinkService;t.SimpleLinkService=class SimpleLinkService{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,i=!1){addLinkAttributes(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}cachePageRef(e,t){}isPageVisible(e){return!0}isPageCached(e){return!0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditorParams=void 0;var n=i(4);t.AnnotationEditorParams=class AnnotationEditorParams{constructor(e,t){this.eventBus=t;this.#c(e)}#c({editorFreeTextFontSize:e,editorFreeTextColor:t,editorInkColor:i,editorInkThickness:s,editorInkOpacity:r}){e.addEventListener("input",(t=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,value:e.valueAsNumber})}));t.addEventListener("input",(e=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,value:t.value})}));i.addEventListener("input",(e=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.INK_COLOR,value:i.value})}));s.addEventListener("input",(e=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.INK_THICKNESS,value:s.valueAsNumber})}));r.addEventListener("input",(e=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.INK_OPACITY,value:r.valueAsNumber})}));this.eventBus._on("annotationeditorparamschanged",(o=>{for(const[a,l]of o.details)switch(a){case n.AnnotationEditorParamsType.FREETEXT_SIZE:e.value=l;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:t.value=l;break;case n.AnnotationEditorParamsType.INK_COLOR:i.value=l;break;case n.AnnotationEditorParamsType.INK_THICKNESS:s.value=l;break;case n.AnnotationEditorParamsType.INK_OPACITY:r.value=l}}))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OverlayManager=void 0;t.OverlayManager=class OverlayManager{#u=new WeakMap;#g=null;get active(){return this.#g}async register(e,t=!1){if("object"!=typeof e)throw new Error("Not enough parameters.");if(this.#u.has(e))throw new Error("The overlay is already registered.");this.#u.set(e,{canForceClose:t});e.addEventListener("cancel",(e=>{this.#g=null}))}async unregister(e){if(!this.#u.has(e))throw new Error("The overlay does not exist.");if(this.#g===e)throw new Error("The overlay cannot be removed while it is active.");this.#u.delete(e)}async open(e){if(!this.#u.has(e))throw new Error("The overlay does not exist.");if(this.#g){if(this.#g===e)throw new Error("The overlay is already active.");if(!this.#u.get(e).canForceClose)throw new Error("Another overlay is currently active.");await this.close()}this.#g=e;e.showModal();e.classList.remove("hidden")}async close(e=this.#g){if(!this.#u.has(e))throw new Error("The overlay does not exist.");if(!this.#g)throw new Error("The overlay is currently not active.");if(this.#g!==e)throw new Error("Another overlay is currently active.");e.close();this.#g=null}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PasswordPrompt=void 0;var n=i(4);t.PasswordPrompt=class PasswordPrompt{#p=null;#f=null;constructor(e,t,i,n=!1){this.dialog=e.dialog;this.label=e.label;this.input=e.input;this.submitButton=e.submitButton;this.cancelButton=e.cancelButton;this.overlayManager=t;this.l10n=i;this._isViewerEmbedded=n;this.submitButton.addEventListener("click",this.#m.bind(this));this.cancelButton.addEventListener("click",this.#w.bind(this));this.input.addEventListener("keydown",(e=>{13===e.keyCode&&this.#m()}));this.overlayManager.register(this.dialog,!0);this.dialog.addEventListener("close",this.#w.bind(this))}async open(){await this.overlayManager.open(this.dialog);this.input.type="password";this.input.focus();const e=this.#f===n.PasswordResponses.INCORRECT_PASSWORD;this._isViewerEmbedded&&!e||this.input.focus();this.label.textContent=await this.l10n.get("password_"+(e?"invalid":"label"))}async close(){if(this.overlayManager.active===this.dialog){this.overlayManager.close(this.dialog);this.input.value=""}}#m(){const e=this.input.value;e?.length>0&&this.#v(e)}#w(){this.#v(new Error("PasswordPrompt cancelled."))}#v(e){if(this.#p){this.close();this.input.value="";this.#p(e);this.#p=null}}setUpdateCallback(e,t){this.#p=e;this.#f=t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFAttachmentViewer=void 0;var n=i(4),s=i(13),r=i(5);class PDFAttachmentViewer extends s.BaseTreeViewer{constructor(e){super(e);this.downloadManager=e.downloadManager;this.eventBus._on("fileattachmentannotation",this.#b.bind(this))}reset(e=!1){super.reset();this._attachments=null;e||(this._renderedCapability=(0,n.createPromiseCapability)());this._pendingDispatchEvent=!1}async _dispatchEvent(e){this._renderedCapability.resolve();if(0===e&&!this._pendingDispatchEvent){this._pendingDispatchEvent=!0;await(0,r.waitOnEventOrTimeout)({target:this.eventBus,name:"annotationlayerrendered",delay:1e3});if(!this._pendingDispatchEvent)return}this._pendingDispatchEvent=!1;this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:e})}_bindLink(e,{content:t,filename:i}){e.onclick=()=>{this.downloadManager.openOrDownloadData(e,t,i);return!1}}render({attachments:e,keepRenderedCapability:t=!1}){this._attachments&&this.reset(t);this._attachments=e||null;if(!e){this._dispatchEvent(0);return}const i=Object.keys(e).sort((function(e,t){return e.toLowerCase().localeCompare(t.toLowerCase())})),s=document.createDocumentFragment();let r=0;for(const t of i){const i=e[t],o=i.content,a=(0,n.getFilenameFromUrl)(i.filename),l=document.createElement("div");l.className="treeItem";const h=document.createElement("a");this._bindLink(h,{content:o,filename:a});h.textContent=this._normalizeTextContent(a);l.append(h);s.append(l);r++}this._finishRendering(s,r)}#b({filename:e,content:t}){const i=this._renderedCapability.promise;i.then((()=>{if(i!==this._renderedCapability.promise)return;const n=this._attachments||Object.create(null);for(const t in n)if(e===t)return;n[e]={filename:e,content:t};this.render({attachments:n,keepRenderedCapability:!0})}))}}t.PDFAttachmentViewer=PDFAttachmentViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseTreeViewer=void 0;var n=i(3);const s="selected";class BaseTreeViewer{constructor(e){if(this.constructor===BaseTreeViewer)throw new Error("Cannot initialize BaseTreeViewer.");this.container=e.container;this.eventBus=e.eventBus;this.reset()}reset(){this._pdfDocument=null;this._lastToggleIsShow=!0;this._currentTreeItem=null;this.container.textContent="";this.container.classList.remove("treeWithDeepNesting")}_dispatchEvent(e){throw new Error("Not implemented: _dispatchEvent")}_bindLink(e,t){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(e){return(0,n.removeNullCharacters)(e,!0)||"–"}_addToggleButton(e,t=!1){const i=document.createElement("div");i.className="treeItemToggler";t&&i.classList.add("treeItemsHidden");i.onclick=t=>{t.stopPropagation();i.classList.toggle("treeItemsHidden");if(t.shiftKey){const t=!i.classList.contains("treeItemsHidden");this._toggleTreeItem(e,t)}};e.prepend(i)}_toggleTreeItem(e,t=!1){this._lastToggleIsShow=t;for(const i of e.querySelectorAll(".treeItemToggler"))i.classList.toggle("treeItemsHidden",!t)}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(e,t,i=!1){if(i){this.container.classList.add("treeWithDeepNesting");this._lastToggleIsShow=!e.querySelector(".treeItemsHidden")}this.container.append(e);this._dispatchEvent(t)}render(e){throw new Error("Not implemented: render")}_updateCurrentTreeItem(e=null){if(this._currentTreeItem){this._currentTreeItem.classList.remove(s);this._currentTreeItem=null}if(e){e.classList.add(s);this._currentTreeItem=e}}_scrollToCurrentTreeItem(e){if(!e)return;let t=e.parentNode;for(;t&&t!==this.container;){if(t.classList.contains("treeItem")){t.firstElementChild?.classList.remove("treeItemsHidden")}t=t.parentNode}this._updateCurrentTreeItem(e);this.container.scrollTo(e.offsetLeft,e.offsetTop+-100)}}t.BaseTreeViewer=BaseTreeViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFDocumentProperties=void 0;var n=i(4),s=i(3);const r=["en-us","en-lr","my"],o={"8.5x11":"Letter","8.5x14":"Legal"},a={"297x420":"A3","210x297":"A4"};function getPageName(e,t,i){return i[`${t?e.width:e.height}x${t?e.height:e.width}`]}t.PDFDocumentProperties=class PDFDocumentProperties{#_=null;constructor({dialog:e,fields:t,closeButton:i},n,s,o,a){this.dialog=e;this.fields=t;this.overlayManager=n;this.l10n=o;this._fileNameLookup=a;this.#P();i.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.dialog);s._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));s._on("rotationchanging",(e=>{this._pagesRotation=e.pagesRotation}));this._isNonMetricLocale=!0;o.getLanguage().then((e=>{this._isNonMetricLocale=r.includes(e)}))}async open(){await Promise.all([this.overlayManager.open(this.dialog),this._dataAvailableCapability.promise]);const e=this._currentPageNumber,t=this._pagesRotation;if(this.#_&&e===this.#_._currentPageNumber&&t===this.#_._pagesRotation){this.#y();return}const{info:i,contentLength:n}=await this.pdfDocument.getMetadata(),[r,o,a,l,h,d]=await Promise.all([this._fileNameLookup(),this.#S(n),this.#E(i.CreationDate),this.#E(i.ModDate),this.pdfDocument.getPage(e).then((e=>this.#C((0,s.getPageSizeInches)(e),t))),this.#T(i.IsLinearized)]);this.#_=Object.freeze({fileName:r,fileSize:o,title:i.Title,author:i.Author,subject:i.Subject,keywords:i.Keywords,creationDate:a,modificationDate:l,creator:i.Creator,producer:i.Producer,version:i.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:h,linearized:d,_currentPageNumber:e,_pagesRotation:t});this.#y();const{length:c}=await this.pdfDocument.getDownloadInfo();if(n===c)return;const u=Object.assign(Object.create(null),this.#_);u.fileSize=await this.#S(c);this.#_=Object.freeze(u);this.#y()}async close(){this.overlayManager.close(this.dialog)}setDocument(e){if(this.pdfDocument){this.#P();this.#y(!0)}if(e){this.pdfDocument=e;this._dataAvailableCapability.resolve()}}#P(){this.pdfDocument=null;this.#_=null;this._dataAvailableCapability=(0,n.createPromiseCapability)();this._currentPageNumber=1;this._pagesRotation=0}#y(e=!1){if(!e&&this.#_){if(this.overlayManager.active===this.dialog)for(const e in this.fields){const t=this.#_[e];this.fields[e].textContent=t||0===t?t:"-"}}else for(const e in this.fields)this.fields[e].textContent="-"}async#S(e=0){const t=e/1024,i=t/1024;if(t)return this.l10n.get("document_properties_"+(i>=1?"mb":"kb"),{size_mb:i>=1&&(+i.toPrecision(3)).toLocaleString(),size_kb:i<1&&(+t.toPrecision(3)).toLocaleString(),size_b:e.toLocaleString()})}async#C(e,t){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=(0,s.isPortraitOrientation)(e);let n={width:Math.round(100*e.width)/100,height:Math.round(100*e.height)/100},r={width:Math.round(25.4*e.width*10)/10,height:Math.round(25.4*e.height*10)/10},l=getPageName(n,i,o)||getPageName(r,i,a);if(!(l||Number.isInteger(r.width)&&Number.isInteger(r.height))){const t={width:25.4*e.width,height:25.4*e.height},s={width:Math.round(r.width),height:Math.round(r.height)};if(Math.abs(t.width-s.width)<.1&&Math.abs(t.height-s.height)<.1){l=getPageName(s,i,a);if(l){n={width:Math.round(s.width/25.4*100)/100,height:Math.round(s.height/25.4*100)/100};r=s}}}const[{width:h,height:d},c,u,g]=await Promise.all([this._isNonMetricLocale?n:r,this.l10n.get("document_properties_page_size_unit_"+(this._isNonMetricLocale?"inches":"millimeters")),l&&this.l10n.get(`document_properties_page_size_name_${l.toLowerCase()}`),this.l10n.get("document_properties_page_size_orientation_"+(i?"portrait":"landscape"))]);return this.l10n.get(`document_properties_page_size_dimension_${u?"name_":""}string`,{width:h.toLocaleString(),height:d.toLocaleString(),unit:c,name:u,orientation:g})}async#E(e){const t=n.PDFDateString.toDateObject(e);if(t)return this.l10n.get("document_properties_date_string",{date:t.toLocaleDateString(),time:t.toLocaleTimeString()})}#T(e){return this.l10n.get("document_properties_linearized_"+(e?"yes":"no"))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFFindBar=void 0;var n=i(16);t.PDFFindBar=class PDFFindBar{constructor(e,t,i){this.opened=!1;this.bar=e.bar;this.toggleButton=e.toggleButton;this.findField=e.findField;this.highlightAll=e.highlightAllCheckbox;this.currentPage=e.findCurrentPageCheckbox;this.pageRange=e.findPageRangeField;this.caseSensitive=e.caseSensitiveCheckbox;this.matchDiacritics=e.matchDiacriticsCheckbox;this.entireWord=e.entireWordCheckbox;this.findMsg=e.findMsg;this.findResultsCount=e.findResultsCount;this.findPreviousButton=e.findPreviousButton;this.findNextButton=e.findNextButton;this.findFieldMultiline=e.findFieldMultiline||null;this.multipleSearchTexts=e.findMultipleSearchTextsCheckbox||null;this.ignoreAccents=e.ignoreAccentsCheckbox||null;this.fuzzySearch=e.fuzzyCheckbox||null;this.eventBus=t;this.l10n=i;this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.findFieldMultiline.addEventListener("input",(()=>{this.dispatchEvent("")}));this.findField.addEventListener("input",(()=>{this.dispatchEvent("")}));this.bar.addEventListener("keydown",(e=>{switch(e.keyCode){case 13:e.target===this.findField&&this.dispatchEvent("again",e.shiftKey);break;case 27:this.close()}}));this.findPreviousButton.addEventListener("click",(()=>{this.dispatchEvent("again",!0)}));this.findNextButton.addEventListener("click",(()=>{this.dispatchEvent("again",!1)}));this.highlightAll.addEventListener("click",(()=>{this.dispatchEvent("highlightallchange")}));this.caseSensitive.addEventListener("click",(()=>{this.dispatchEvent("casesensitivitychange")}));this.entireWord.addEventListener("click",(()=>{this.dispatchEvent("entirewordchange")}));this.multipleSearchTexts.addEventListener("click",(()=>{this.dispatchEvent("multiplesearchtextschange")}));this.ignoreAccents.addEventListener("click",(()=>{this.dispatchEvent("ignoreAccentsChange")}));this.fuzzySearch.addEventListener("click",(()=>{this.dispatchEvent("fuzzySearchChange")}));this.currentPage.addEventListener("click",(()=>{this.dispatchEvent("currentPageChange")}));this.pageRange.addEventListener("input",(()=>{this.dispatchEvent("pageRangeChange")}));this.matchDiacritics?.addEventListener("click",(()=>{this.dispatchEvent("diacriticmatchingchange")}));this.eventBus._on("resize",this.#x.bind(this))}reset(){this.updateUIState()}dispatchEvent(e,t=!1){this.eventBus.dispatch("find",{source:this,type:e,query:this.findFieldMultiline.classList.contains("hidden")?this.findField.value:this.findFieldMultiline.value,phraseSearch:!this.multipleSearchTexts.checked,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,ignoreAccents:this.ignoreAccents.checked,fuzzySearch:this.fuzzySearch.checked,highlightAll:this.highlightAll.checked,currentPage:this.currentPage.checked,pageRange:this.pageRange.value,findPrevious:t,matchDiacritics:this.matchDiacritics?.checked})}updateUIState(e,t,i){let s=Promise.resolve(""),r="";switch(e){case n.FindState.FOUND:break;case n.FindState.PENDING:r="pending";break;case n.FindState.NOT_FOUND:s=this.l10n.get("find_not_found");r="notFound";break;case n.FindState.WRAPPED:s=this.l10n.get("find_reached_"+(t?"top":"bottom"))}this.findField.setAttribute("data-status",r);this.findFieldMultiline.classList.toggle("notFound","notFound"===r);this.findFieldMultiline.setAttribute("data-status",r);this.findField.setAttribute("aria-invalid",e===n.FindState.NOT_FOUND);s.then((e=>{this.findMsg.textContent=e;this.#x()}));this.updateResultsCount(i)}updateResultsCount({current:e=0,total:t=0}={}){let i=Promise.resolve("");if(t>0)if(t>1e3){let e="find_match_count_limit";i=this.l10n.get(e,{limit:1e3})}else{let n="find_match_count";i=this.l10n.get(n,{current:e,total:t})}i.then((e=>{this.findResultsCount.textContent=e;this.#x()}))}open(){if(!this.opened){this.opened=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.bar.classList.remove("hidden")}this.findField.select();this.findField.focus();this.dispatchEvent("");this.#x()}close(){if(this.opened){this.opened=!1;this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false");this.bar.classList.add("hidden");this.eventBus.dispatch("findbarclose",{source:this})}}toggle(){this.opened?this.close():this.open()}#x(){if(!this.opened)return;this.bar.classList.remove("wrapContainers");this.bar.clientHeight>this.bar.firstElementChild.clientHeight&&this.bar.classList.add("wrapContainers")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFFindController=t.FindState=void 0;var n=i(4),s=i(17),r=i(18),o=i(19),a=i(3);const l={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=l;const h={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4","\n":" "};let d=null;function normalize(e){if(!d){const e=Object.keys(h).join("");d=new RegExp(`[${e}]`,"g")}let t=null;return[e.replace(d,(function(e,i){const n=h[e],s=n.length-e.length;"\n"===e?(t||=[]).push([i-1,1]):0!==s&&(t||=[]).push([i,s]);return n})),t]}function getOriginalIndex(e,t=null){if(!t)return e;let i=0;for(const[n,s]of t){const t=n+i;if(n>=e)break;if(n+s>e){i+=e-t;break}i+=s}return e-i}t.PDFFindController=class PDFFindController{constructor({linkService:e,eventBus:t,pageViewMode:i}){this._linkService=e;this._eventBus=t;this._pageViewMode=i;this._reset();t._on("find",this._onFind.bind(this));t._on("findbarclose",this._onFindBarClose.bind(this));this.executeCommand=(e,t)=>{Window.ngxConsole.error('Deprecated method `PDFFindController.executeCommand` called, please dispatch a "find"-event using the EventBus instead.');const i=Object.assign(Object.create(null),t,{type:e.substring("find".length)});this._onFind(i)}}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesColor(){return this._pageMatchesColor}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(e){this._pdfDocument&&this._reset();if(e){this._pdfDocument=e;this._firstPageCapability.resolve()}}_onFind(e){if(!e)return;const t=this._pdfDocument,{type:i}=e;(null===this._state||this._shouldDirtyMatch(e))&&(this._dirtyMatch=!0);this._state=e;"highlightallchange"!==i&&this._updateUIState(l.PENDING);this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this._extractText();const e=!this._highlightMatches,n=!!this._findTimeout;if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(i)if(this._dirtyMatch)this._nextMatch();else if("again"===i){this._nextMatch();e&&this._state.highlightAll&&this._updateAllPages()}else if("highlightallchange"===i){n?this._nextMatch():this._highlightMatches=!0;this._updateAllPages()}else this._nextMatch();else this._findTimeout=setTimeout((()=>{this._nextMatch();this._findTimeout=null}),250)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:n=-1}){if(!this._scrollMatches||!e)return;if(-1===n||n!==this._selected.matchIdx)return;if(-1===i||i!==this._selected.pageIdx)return;this._scrollMatches=!1;const s={top:-50,left:t+-400};(0,a.scrollIntoView)(e,s,!0,"infinite-scroll"===this._pageViewMode)}_reset(){this._highlightMatches=!1;this._scrollMatches=!1;this._pdfDocument=null;this._pageMatches=[];this._pageMatchesLength=[];this._pageMatchesColor=[];this._state=null;this._selected={pageIdx:-1,matchIdx:-1};this._offset={pageIdx:null,matchIdx:null,wrapped:!1};this._extractTextPromises=[];this._pageContents=[];this._pageDiffs=[];this._matchesCountTotal=0;this._pagesToSearch=null;this._pendingFindMatches=new Set;this._resumePageIdx=null;this._dirtyMatch=!1;clearTimeout(this._findTimeout);this._findTimeout=null;this._firstPageCapability=(0,n.createPromiseCapability)()}get _query(){if(this._state.query!==this._rawQuery){this._rawQuery=this._state.query;[this._normalizedQuery]=normalize(this._state.query)}return this._normalizedQuery}_shouldDirtyMatch(e){if(e.query!==this._state.query)return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!t.isPageVisible(e);case"highlightallchange":return!1}return!0}_prepareMatches(e,t,i,n){function isSubTerm(t){const i=e[t],n=e[t+1];if(t<e.length-1&&i.match===n.match){i.skipped=!0;return!0}for(let n=t-1;n>=0;n--){const t=e[n];if(!t.skipped){if(t.match+t.matchLength<i.match)break;if(t.match+t.matchLength>=i.match+i.matchLength){i.skipped=!0;return!0}}}return!1}e.sort((function(e,t){return e.match===t.match?e.matchLength-t.matchLength:e.match-t.match}));for(let s=0,r=e.length;s<r;s++)if(!isSubTerm(s)){t.push(e[s].match);i.push(e[s].matchLength);n.push(e[s].color)}}_isEntireWord(e,t,i){if(t>0){const i=e.charCodeAt(t),n=e.charCodeAt(t-1);if((0,r.getCharacterType)(i)===(0,r.getCharacterType)(n))return!1}const n=t+i-1;if(n<e.length-1){const t=e.charCodeAt(n),i=e.charCodeAt(n+1);if((0,r.getCharacterType)(t)===(0,r.getCharacterType)(i))return!1}return!0}_calculateFuzzyMatch(e,t,i,n){const s=[],r=[],a=e.length,l=a<5?a:5,h=Math.round(a/5),d=e.substring(0,l),c={useCollator:!0};for(let t=0;t<i.length-a;t++){const u=i.substring(t,t+l);if(o.Levenshtein.distance(d,u,c)<3){const l=i.substring(t,t+a),d=o.Levenshtein.distance(e,l,c);if(d<=h){if(t+1<i.length-a){const n=i.substring(t+1,t+1+a);if(d>=o.Levenshtein.distance(e,n,c))continue}const l=getOriginalIndex(t,n),h=getOriginalIndex(t+a-1,n)-l+1;s.push(l);r.push(h);t+=a-1}}}this._pageMatches[t]=s;this._pageMatchesLength[t]=r}_calculatePhraseMatch(e,t,i,n,r,o){if(o){i=(0,s.deburr)(i);e=(0,s.deburr)(e)}const a=[],l=[],h=e.length;let d=-h;for(;;){d=i.indexOf(e,d+h);if(-1===d)break;if(r&&!this._isEntireWord(i,d,h))continue;const t=getOriginalIndex(d,n),s=getOriginalIndex(d+h-1,n)-t+1;a.push(t);l.push(s)}this._pageMatches[t]=a;this._pageMatchesLength[t]=l}_calculateWordMatch(e,t,i,n,r,o){if(o){i=(0,s.deburr)(i);e=(0,s.deburr)(e)}const a=[],l=e.includes("\n")?e.trim().split(/\n+/g):e.trim().match(/\S+/g);for(let e=0,t=l.length;e<t;e++){const t=l[e],s=t.length;if(0===s)continue;let o=-s;for(;;){o=i.indexOf(t,o+s);if(-1===o)break;if(r&&!this._isEntireWord(i,o,s))continue;const l=getOriginalIndex(o,n),h=getOriginalIndex(o+s-1,n)-l+1;a.push({match:l,matchLength:h,skipped:!1,color:e})}}this._pageMatchesLength[t]=[];this._pageMatchesColor[t]=[];this._pageMatches[t]=[];this._prepareMatches(a,this._pageMatches[t],this._pageMatchesLength[t],this._pageMatchesColor[t])}_isInPageRanges(e=1,t="1,3,6-7"){try{if(!t)return!0;return t.split(",").some((t=>this._isInPageRange(e,t)))}catch(e){return!0}}_isInPageRange(e=1,t="6-7"){try{if(!t)return!0;if(t.includes("-")){const i=t.split("-"),n=i[0].trim();if(n.length>0&&e<Number(n))return!1;const s=i[1].trim();if(s.length>0&&e>Number(s))return!1}else{const i=t.trim();if(i.length>0)return Number(i)===e}return!0}catch(e){return!0}}_calculateMatch(e){if(!this.state)return;let t=this._pageContents[e];const i=this._pageDiffs[e];let n=this._query;const{caseSensitive:s,entireWord:r,ignoreAccents:o,fuzzySearch:a,phraseSearch:l,currentPage:h,pageRange:d}=this._state;let c=!1;if(h&&e!==this._linkService.page-1){c=!0;this._pageMatches[e]=[]}if(!this._isInPageRanges(e+1,d)){c=!0;this._pageMatches[e]=[]}if(0===n.length)return;if(!c){if(!s){t=t.toLowerCase();n=n.toLowerCase()}a?n.length<=2?this._calculatePhraseMatch(n,e,t,i,!1):this._calculateFuzzyMatch(n,e,t,i):l?this._calculatePhraseMatch(n,e,t,i,r,o):this._calculateWordMatch(n,e,t,i,r,o)}this._state.highlightAll&&this._updatePage(e);if(this._resumePageIdx===e){this._resumePageIdx=null;this._nextPageMatch()}const u=this._pageMatches[e].length;if(u>0){this._matchesCountTotal+=u;this._updateUIResultsCount()}else e+1===this._pageContents.length&&0===this._matchesCountTotal&&this._updateUIResultsCount()}_extractText(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();for(let t=0,i=this._linkService.pagesCount;t<i;t++){const i=(0,n.createPromiseCapability)();this._extractTextPromises[t]=i.promise;e=e.then((()=>this._pdfDocument&&this._extractTextPromises.length>0?this._pdfDocument.getPage(t+1).then((e=>e.getTextContent())).then((e=>{const n=e.items,s=[];for(let e=0,t=n.length;e<t;e++){s.push(n[e].str);n[e].hasEOL&&s.push("\n")}[this._pageContents[t],this._pageDiffs[t]]=normalize(s.join(""));i.resolve(t)}),(e=>{Window.ngxConsole.error(`Unable to get text content for page ${t+1}`,e);this._pageContents[t]="";this._pageDiffs[t]=null;i.resolve(t)})):Promise.resolve()))}}_updatePage(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1);this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}_updateAllPages(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}_nextMatch(){const e=this._state.findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;this._highlightMatches=!0;if(this._dirtyMatch){this._dirtyMatch=!1;this._selected.pageIdx=this._selected.matchIdx=-1;this._offset.pageIdx=t;this._offset.matchIdx=null;this._offset.wrapped=!1;this._resumePageIdx=null;this._pageMatches.length=0;this._pageMatchesLength.length=0;this._pageMatchesColor.length=0;this._matchesCountTotal=0;this._updateAllPages();const{currentPage:e}=this.state;let n=0,s=i-1;if(e){n=this._linkService.page-1;s=n}for(let e=n;e<=s;e++)if(!this._pendingFindMatches.has(e)){this._pendingFindMatches.add(e);this._extractTextPromises[e].then((e=>{this._pendingFindMatches.delete(e);this._calculateMatch(e)}))}}if(""===this._query){this._updateUIState(l.FOUND);return}if(this._resumePageIdx)return;const n=this._offset;this._pagesToSearch=i;if(null!==n.matchIdx){const t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+1<t||e&&n.matchIdx>0){n.matchIdx=e?n.matchIdx-1:n.matchIdx+1;this._updateMatch(!0);return}this._advanceOffsetPage(e)}this._nextPageMatch()}_matchesReady(e){const t=this._offset,i=e.length,n=this._state.findPrevious;if(i){t.matchIdx=n?i-1:0;this._updateMatch(!0);return!0}this._advanceOffsetPage(n);if(t.wrapped){t.matchIdx=null;if(this._pagesToSearch<0){this._updateMatch(!1);return!0}}return!1}_nextPageMatch(){null!==this._resumePageIdx&&Window.ngxConsole.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;e=this._pageMatches[t];if(!e){this._resumePageIdx=t;break}}while(!this._matchesReady(e))}_advanceOffsetPage(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1;t.matchIdx=null;this._pagesToSearch--;if(t.pageIdx>=i||t.pageIdx<0){t.pageIdx=e?i-1:0;t.wrapped=!0}}_updateMatch(e=!1){let t=l.NOT_FOUND;const i=this._offset.wrapped;this._offset.wrapped=!1;if(e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx;this._selected.matchIdx=this._offset.matchIdx;t=i?l.WRAPPED:l.FOUND;-1!==e&&e!==this._selected.pageIdx&&this._updatePage(e)}this._updateUIState(t,this._state.findPrevious);if(-1!==this._selected.pageIdx){this._scrollMatches=!0;this._updatePage(this._selected.pageIdx)}}_onFindBarClose(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{if(this._pdfDocument&&(!t||this._pdfDocument===t)){if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(this._resumePageIdx){this._resumePageIdx=null;this._dirtyMatch=!0}this._updateUIState(l.FOUND);this._highlightMatches=!1;this._updateAllPages()}}))}_requestMatchesCount(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}(i<1||i>n)&&(i=n=0);return{current:i,total:n}}_updateUIResultsCount(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this._requestMatchesCount()})}_updateUIState(e,t=!1){this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this._requestMatchesCount(),rawQuery:this._state?.query??null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.deburr=function deburr(e){return(e=function toString(e){return null==e?"":function baseToString(e){if("string"==typeof e)return e;if(function isSymbol(e){return"symbol"==typeof e||function isObjectLike(e){return!!e&&"object"==typeof e}(e)&&h.call(e)==i}(e))return u?u.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(e))&&e.replace(n,l).replace(s,"")};var i="[object Symbol]",n=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,s=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),r="object"==typeof global&&global&&global.Object===Object&&global,o="object"==typeof self&&self&&self.Object===Object&&self,a=r||o||Function("return this")();var l=function basePropertyOf(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"}),h=Object.prototype.toString,d=a.Symbol,c=d?d.prototype:void 0,u=c?c.toString:void 0},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.CharacterType=void 0;t.getCharacterType=function getCharacterType(e){if(function isAlphabeticalScript(e){return e<11904}(e))return function isAscii(e){return 0==(65408&e)}(e)?function isAsciiSpace(e){return 32===e||9===e||13===e||10===e}(e)?i.SPACE:function isAsciiAlpha(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function isAsciiDigit(e){return e>=48&&e<=57}(e)||95===e?i.ALPHA_LETTER:i.PUNCT:function isThai(e){return 3584==(65408&e)}(e)?i.THAI_LETTER:160===e?i.SPACE:i.ALPHA_LETTER;if(function isHan(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e))return i.HAN_LETTER;if(function isKatakana(e){return e>=12448&&e<=12543}(e))return i.KATAKANA_LETTER;if(function isHiragana(e){return e>=12352&&e<=12447}(e))return i.HIRAGANA_LETTER;if(function isHalfwidthKatakana(e){return e>=65376&&e<=65439}(e))return i.HALFWIDTH_KATAKANA_LETTER;return i.ALPHA_LETTER};const i={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};t.CharacterType=i},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Levenshtein=void 0;let i;try{i=Intl.Collator("und",{sensitivity:"base"})}catch(e){try{i=Intl.Collator("generic",{sensitivity:"base"})}catch(e){i=void 0}}const n=[],s=[];t.Levenshtein=class Levenshtein{static distance(e,t,r){const o=r&&i&&r.useCollator,a=e.length,l=t.length;if(0===a)return l;if(0===l)return a;let h,d,c,u,g,p;for(c=0;c<l;++c){n[c]=c;s[c]=t.charCodeAt(c)}n[l]=l;if(o)for(c=0;c<a;++c){d=c+1;for(u=0;u<l;++u){h=d;p=0===i.compare(e.charAt(c),String.fromCharCode(s[u]));d=n[u]+(p?0:1);g=h+1;d>g&&(d=g);g=n[u+1]+1;d>g&&(d=g);n[u]=h}n[u]=d}else for(c=0;c<a;++c){d=c+1;for(u=0;u<l;++u){h=d;p=e.charCodeAt(c)===s[u];d=n[u]+(p?0:1);g=h+1;d>g&&(d=g);g=n[u+1]+1;d>g&&(d=g);n[u]=h}n[u]=d}return d}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFHistory=void 0;t.isDestArraysEqual=isDestArraysEqual;t.isDestHashesEqual=isDestHashesEqual;var n=i(3),s=i(5);function getCurrentHash(){return document.location.hash}t.PDFHistory=class PDFHistory{constructor({linkService:e,eventBus:t}){this.linkService=e;this.eventBus=t;this._initialized=!1;this._fingerprint="";this.reset();this._boundEvents=null;this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1;this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:i=!1}){if(!e||"string"!=typeof e){Window.ngxConsole.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e;this._updateUrl=!0===i;this._initialized=!0;this._bindEvents();const s=window.history.state;this._popStateInProgress=!1;this._blockHashChange=0;this._currentHash=getCurrentHash();this._numPositionUpdates=0;this._uid=this._maxUid=0;this._destination=null;this._position=null;if(!this._isValidState(s,!0)||t){const{hash:e,page:i,rotation:s}=this._parseCurrentHash(!0);if(!e||n||t){this._pushOrReplaceState(null,!0);return}this._pushOrReplaceState({hash:e,page:i,rotation:s},!0);return}const r=s.destination;this._updateInternalState(r,s.uid,!0);void 0!==r.rotation&&(this._initialRotation=r.rotation);if(r.dest){this._initialBookmark=JSON.stringify(r.dest);this._destination.page=null}else r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){if(this._initialized){this._pageHide();this._initialized=!1;this._unbindEvents()}if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._initialBookmark=null;this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:i}){if(!this._initialized)return;if(e&&"string"!=typeof e){Window.ngxConsole.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}if(!Array.isArray(t)){Window.ngxConsole.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}if(!this._isValidPage(i)&&(null!==i||this._destination)){Window.ngxConsole.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);return}const n=e||JSON.stringify(t);if(!n)return;let s=!1;if(this._destination&&(isDestHashesEqual(this._destination.hash,n)||isDestArraysEqual(this._destination.dest,t))){if(this._destination.page)return;s=!0}if(!this._popStateInProgress||s){this._pushOrReplaceState({dest:t,hash:n,page:i,rotation:this.linkService.rotation},s);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}pushPage(e){if(this._initialized)if(this._isValidPage(e)){if(this._destination?.page!==e&&!this._popStateInProgress){this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation});if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}else Window.ngxConsole.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`)}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const i=t||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:e};this._updateInternalState(e,n.uid);let s;if(this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(s=`${t}#${e.hash}`)}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e){t=Object.assign(Object.create(null),this._position);t.temporary=!0}if(!this._destination){this._pushOrReplaceState(t);return}if(this._destination.temporary){this._pushOrReplaceState(t,!0);return}if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this._pushOrReplaceState(t,i)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"==typeof e.destination)}_updateInternalState(e,t,i=!1){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}i&&e?.temporary&&delete e.temporary;this._destination=e;this._uid=t;this._maxUid=Math.max(this._maxUid,t);this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(getCurrentHash()).substring(1),i=(0,n.parseQueryString)(t),s=i.get("nameddest")||"";let r=0|i.get("page");(!this._isValidPage(r)||e&&s.length>0)&&(r=null);return{hash:t,page:r,rotation:this.linkService.rotation}}_updateViewarea({location:e}){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation};if(!this._popStateInProgress){this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++;this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0);this._updateViewareaTimeout=null}),1e3)}}_popState({state:e}){const t=getCurrentHash(),i=this._currentHash!==t;this._currentHash=t;if(!e){this._uid++;const{hash:e,page:t,rotation:i}=this._parseCurrentHash();this._pushOrReplaceState({hash:e,page:t,rotation:i},!0);return}if(!this._isValidState(e))return;this._popStateInProgress=!0;if(i){this._blockHashChange++;(0,s.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--}))}const r=e.destination;this._updateInternalState(r,e.uid,!0);(0,n.isValidRotation)(r.rotation)&&(this.linkService.rotation=r.rotation);r.dest?this.linkService.goToDestination(r.dest):r.hash?this.linkService.setHash(r.hash):r.page&&(this.linkService.page=r.page);Promise.resolve().then((()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){if(!this._boundEvents){this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)};this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea);window.addEventListener("popstate",this._boundEvents.popState);window.addEventListener("pagehide",this._boundEvents.pageHide)}}_unbindEvents(){if(this._boundEvents){this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea);window.removeEventListener("popstate",this._boundEvents.popState);window.removeEventListener("pagehide",this._boundEvents.pageHide);this._boundEvents=null}}};function isDestHashesEqual(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;if(e===t)return!0;return(0,n.parseQueryString)(e).get("nameddest")===t}function isDestArraysEqual(e,t){function isEntryEqual(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!isEntryEqual(e[i],t[i]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(!isEntryEqual(e[i],t[i]))return!1;return!0}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFLayerViewer=void 0;var n=i(13);class PDFLayerViewer extends n.BaseTreeViewer{constructor(e){super(e);this.l10n=e.l10n;this.eventBus._on("resetlayers",this._resetLayers.bind(this));this.eventBus._on("togglelayerstree",this._toggleAllTreeItems.bind(this))}reset(){super.reset();this._optionalContentConfig=null}_dispatchEvent(e){this.eventBus.dispatch("layersloaded",{source:this,layersCount:e})}_bindLink(e,{groupId:t,input:i}){const setVisibility=()=>{this._optionalContentConfig.setVisibility(t,i.checked);this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};e.onclick=t=>{if(t.target===i){setVisibility();return!0}if(t.target!==e)return!0;i.checked=!i.checked;setVisibility();return!1}}async _setNestedName(e,{name:t=null}){if("string"!=typeof t){e.textContent=await this.l10n.get("additional_layers");e.style.fontStyle="italic"}else e.textContent=this._normalizeTextContent(t)}_addToggleButton(e,{name:t=null}){super._addToggleButton(e,null===t)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render({optionalContentConfig:e,pdfDocument:t}){this._optionalContentConfig&&this.reset();this._optionalContentConfig=e||null;this._pdfDocument=t||null;const i=e?.getOrder();if(!i){this._dispatchEvent(0);return}const n=document.createDocumentFragment(),s=[{parent:n,groups:i}];let r=0,o=!1;for(;s.length>0;){const t=s.shift();for(const i of t.groups){const n=document.createElement("div");n.className="treeItem";const a=document.createElement("a");n.append(a);if("object"==typeof i){o=!0;this._addToggleButton(n,i);this._setNestedName(a,i);const e=document.createElement("div");e.className="treeItems";n.append(e);s.push({parent:e,groups:i.order})}else{const t=e.getGroup(i),n=document.createElement("input");this._bindLink(a,{groupId:i,input:n});n.type="checkbox";n.checked=t.visible;const s=document.createElement("label");s.textContent=this._normalizeTextContent(t.name);s.append(n);a.append(s);r++}t.parent.append(n)}}this._finishRendering(n,r,o)}async _resetLayers(){if(!this._optionalContentConfig)return;const e=await this._pdfDocument.getOptionalContentConfig();this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(e)});this.render({optionalContentConfig:e,pdfDocument:this._pdfDocument})}}t.PDFLayerViewer=PDFLayerViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFOutlineViewer=void 0;var n=i(13),s=i(4),r=i(3);class PDFOutlineViewer extends n.BaseTreeViewer{constructor(e){super(e);this.linkService=e.linkService;this.eventBus._on("toggleoutlinetree",this._toggleAllTreeItems.bind(this));this.eventBus._on("currentoutlineitem",this._currentOutlineItem.bind(this));this.eventBus._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded)}));this.eventBus._on("sidebarviewchanged",(e=>{this._sidebarView=e.view}))}reset(){super.reset();this._outline=null;this._pageNumberToDestHashCapability=null;this._currentPageNumber=1;this._isPagesLoaded=null;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(!1);this._currentOutlineItemCapability=null}_dispatchEvent(e){this._currentOutlineItemCapability=(0,s.createPromiseCapability)();0===e||this._pdfDocument?.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):null!==this._isPagesLoaded&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded);this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:e,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}_bindLink(e,{url:t,newWindow:i,dest:n}){const{linkService:s}=this;if(t)s.addLinkAttributes(e,t,i);else{e.href=s.getDestinationHash(n);e.onclick=e=>{this._updateCurrentTreeItem(e.target.parentNode);n&&s.goToDestination(n);return!1}}}_setStyles(e,{bold:t,italic:i}){t&&(e.style.fontWeight="bold");i&&(e.style.fontStyle="italic")}_addToggleButton(e,{count:t,items:i}){let n=!1;if(t<0){let e=i.length;if(e>0){const t=[...i];for(;t.length>0;){const{count:i,items:n}=t.shift();if(i>0&&n.length>0){e+=n.length;t.push(...n)}}}Math.abs(t)===e&&(n=!0)}super._addToggleButton(e,n)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render({outline:e,pdfDocument:t}){this._outline&&this.reset();this._outline=e||null;this._pdfDocument=t||null;if(!e){this._dispatchEvent(0);return}const i=document.createDocumentFragment(),n=[{parent:i,items:e}];let s=0,r=!1;for(;n.length>0;){const e=n.shift();for(const t of e.items){const i=document.createElement("div");i.className="treeItem";const o=document.createElement("a");this._bindLink(o,t);this._setStyles(o,t);o.textContent=this._normalizeTextContent(t.title);i.append(o);if(t.items.length>0){r=!0;this._addToggleButton(i,t);const e=document.createElement("div");e.className="treeItems";i.append(e);n.push({parent:e,items:t.items})}e.parent.append(i);s++}}this._finishRendering(i,s,r)}async _currentOutlineItem(){if(!this._isPagesLoaded)throw new Error("_currentOutlineItem: All pages have not been loaded.");if(!this._outline||!this._pdfDocument)return;const e=await this._getPageNumberToDestHash(this._pdfDocument);if(e){this._updateCurrentTreeItem(null);if(this._sidebarView===r.SidebarView.OUTLINE)for(let t=this._currentPageNumber;t>0;t--){const i=e.get(t);if(!i)continue;const n=this.container.querySelector(`a[href="${i}"]`);if(n){this._scrollToCurrentTreeItem(n.parentNode);break}}}}async _getPageNumberToDestHash(e){if(this._pageNumberToDestHashCapability)return this._pageNumberToDestHashCapability.promise;this._pageNumberToDestHashCapability=(0,s.createPromiseCapability)();const t=new Map,i=new Map,n=[{nesting:0,items:this._outline}];for(;n.length>0;){const s=n.shift(),r=s.nesting;for(const{dest:o,items:a}of s.items){let s,l;if("string"==typeof o){s=await e.getDestination(o);if(e!==this._pdfDocument)return null}else s=o;if(Array.isArray(s)){const[n]=s;if("object"==typeof n&&null!==n){l=this.linkService._cachedPageNumber(n);if(!l)try{l=await e.getPageIndex(n)+1;if(e!==this._pdfDocument)return null;this.linkService.cachePageRef(l,n)}catch(e){}}else Number.isInteger(n)&&(l=n+1);if(Number.isInteger(l)&&(!t.has(l)||r>i.get(l))){const e=this.linkService.getDestinationHash(o);t.set(l,e);i.set(l,r)}}a.length>0&&n.push({nesting:r+1,items:a})}}this._pageNumberToDestHashCapability.resolve(t.size>0?t:null);return this._pageNumberToDestHashCapability.promise}}t.PDFOutlineViewer=PDFOutlineViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPresentationMode=void 0;var n=i(3),s=i(4);const r="pdfPresentationMode",o="pdfPresentationModeControls",a=Math.PI/6;t.PDFPresentationMode=class PDFPresentationMode{#L=n.PresentationModeState.UNKNOWN;#I=null;constructor({container:e,pdfViewer:t,eventBus:i}){this.container=e;this.pdfViewer=t;this.eventBus=i;this.contextMenuOpen=!1;this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0;this.touchSwipeState=null}async request(){const{container:e,pdfViewer:t}=this;if(this.active||!t.pagesCount||!e.requestFullscreen)return!1;this.#M();this.#A(n.PresentationModeState.CHANGING);const i=e.requestFullscreen();this.#I={pageNumber:t.currentPageNumber,scaleValue:t.currentScaleValue,scrollMode:t.scrollMode,spreadMode:null,annotationEditorMode:null};if(!(t.spreadMode===n.SpreadMode.NONE||t.pageViewsReady&&t.hasEqualPageSizes)){console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes.");this.#I.spreadMode=t.spreadMode}t.annotationEditorMode!==s.AnnotationEditorType.DISABLE&&(this.#I.annotationEditorMode=t.annotationEditorMode);try{await i;return!0}catch(e){this.#D();this.#A(n.PresentationModeState.NORMAL)}return!1}get active(){return this.#L===n.PresentationModeState.CHANGING||this.#L===n.PresentationModeState.FULLSCREEN}#B(e){if(!this.active)return;e.preventDefault();const t=(0,n.normalizeWheelEventDelta)(e),i=Date.now(),s=this.mouseScrollTimeStamp;if(!(i>s&&i-s<50)){(this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&this.#N();this.mouseScrollDelta+=t;if(Math.abs(this.mouseScrollDelta)>=.1){const e=this.mouseScrollDelta;this.#N();(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}}}#A(e){this.#L=e;this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})}#O(){this.#A(n.PresentationModeState.FULLSCREEN);this.container.classList.add(r);setTimeout((()=>{this.pdfViewer.scrollMode=n.ScrollMode.PAGE;null!==this.#I.spreadMode&&(this.pdfViewer.spreadMode=n.SpreadMode.NONE);this.pdfViewer.currentPageNumber=this.#I.pageNumber;this.pdfViewer.currentScaleValue="page-fit";null!==this.#I.annotationEditorMode&&(this.pdfViewer.annotationEditorMode=s.AnnotationEditorType.NONE)}),0);this.#V();this.#R();this.contextMenuOpen=!1;window.getSelection().removeAllRanges()}#k(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(r);setTimeout((()=>{this.#D();this.#A(n.PresentationModeState.NORMAL);this.pdfViewer.scrollMode=this.#I.scrollMode;null!==this.#I.spreadMode&&(this.pdfViewer.spreadMode=this.#I.spreadMode);this.pdfViewer.currentScaleValue=this.#I.scaleValue;this.pdfViewer.currentPageNumber=e;null!==this.#I.annotationEditorMode&&(this.pdfViewer.annotationEditorMode=this.#I.annotationEditorMode);this.#I=null}),0);this.#F();this.#U();this.#N();this.contextMenuOpen=!1}_prepareFullscreenMode(){const e=document.getElementsByClassName("zoom")[0].parentElement,t=e.parentElement;this.ngxContainer=t;for(let i=0;i<t.childElementCount;i++)t.children.item(i)===e&&(this.ngxContainerIndex=i);t.removeChild(e);document.body.append(e);const i=document.body.children;for(let t=0;t<i.length;t++){const n=i.item(t);n!==e&&n instanceof HTMLElement&&n.classList.add("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.add("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.add("hidden-by-fullscreen")}_tidyUpFullscreenMode(){if(this.ngxContainer){const e=document.getElementsByClassName("zoom")[0].parentElement;document.body.removeChild(e);this.ngxContainerIndex>=this.ngxContainer.childElementCount?this.ngxContainer.append(e):this.ngxContainer.insertBefore(e,this.ngxContainer.children.item(this.ngxContainerIndex));this.ngxContainer=void 0;const t=document.body.children;for(let i=0;i<t.length;i++){const n=t.item(i);n!==e&&n instanceof HTMLElement&&n.classList.contains("hidden-by-fullscreen")&&n.classList.remove("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.remove("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.remove("hidden-by-fullscreen")}}#W(e){if(this.contextMenuOpen){this.contextMenuOpen=!1;e.preventDefault()}else if(0===e.button){if(!(e.target.href&&e.target.classList.contains("internalLink"))){e.preventDefault();e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()}}}#H(){this.contextMenuOpen=!0}#R(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(o);this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(o);delete this.controlsTimeout}),3e3)}#U(){if(this.controlsTimeout){clearTimeout(this.controlsTimeout);this.container.classList.remove(o);delete this.controlsTimeout}}#N(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}#z(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX;this.touchSwipeState.endY=e.touches[0].pageY;e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,n=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(n,i));Math.abs(i)>50&&(s<=a||s>=Math.PI-a)?t=i:Math.abs(n)>50&&Math.abs(s-Math.PI/2)<=a&&(t=n);t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}}#V(){this.showControlsBind=this.#R.bind(this);this.mouseDownBind=this.#W.bind(this);this.mouseWheelBind=this.#B.bind(this);this.resetMouseScrollStateBind=this.#N.bind(this);this.contextMenuBind=this.#H.bind(this);this.touchSwipeBind=this.#z.bind(this);window.addEventListener("mousemove",this.showControlsBind);window.addEventListener("mousedown",this.mouseDownBind);window.addEventListener("wheel",this.mouseWheelBind,{passive:!1});window.addEventListener("keydown",this.resetMouseScrollStateBind);window.addEventListener("contextmenu",this.contextMenuBind);window.addEventListener("touchstart",this.touchSwipeBind);window.addEventListener("touchmove",this.touchSwipeBind);window.addEventListener("touchend",this.touchSwipeBind)}#F(){window.removeEventListener("mousemove",this.showControlsBind);window.removeEventListener("mousedown",this.mouseDownBind);window.removeEventListener("wheel",this.mouseWheelBind,{passive:!1});window.removeEventListener("keydown",this.resetMouseScrollStateBind);window.removeEventListener("contextmenu",this.contextMenuBind);window.removeEventListener("touchstart",this.touchSwipeBind);window.removeEventListener("touchmove",this.touchSwipeBind);window.removeEventListener("touchend",this.touchSwipeBind);delete this.showControlsBind;delete this.mouseDownBind;delete this.mouseWheelBind;delete this.resetMouseScrollStateBind;delete this.contextMenuBind;delete this.touchSwipeBind}#j(){document.fullscreenElement?this.#O():this.#k()}#M(){this.fullscreenChangeBind=this.#j.bind(this);window.addEventListener("fullscreenchange",this.fullscreenChangeBind)}#D(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind);delete this.fullscreenChangeBind}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFRenderingQueue=void 0;var n=i(4),s=i(3);t.PDFRenderingQueue=class PDFRenderingQueue{constructor(){this.pdfViewer=null;this.pdfThumbnailViewer=null;this.onIdle=null;this.highestPriorityPage=null;this.idleTimeout=null;this.printing=!1;this.isThumbnailViewEnabled=!1}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}hasViewer(){return!!this.pdfViewer}renderHighestPriority(e){if(this.idleTimeout){clearTimeout(this.idleTimeout);this.idleTimeout=null}this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const o=e.first.id,a=e.last.id;if(a-o+1>r){const n=e.ids;for(let e=1,s=a-o;e<s;e++){const s=i?o+e:a-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?a:o-2,h=t[l];if(h&&!this.isViewFinished(h))return h;if(n){l+=i?1:-1;h=t[l];if(h&&!this.isViewFinished(h))return h}return null}isViewFinished(e){return e.renderingState===s.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case s.RenderingStates.FINISHED:return!1;case s.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId;e.resume();break;case s.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case s.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId;e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof n.RenderingCancelledException||Window.ngxConsole.error(`renderView: "${e}"`)}))}return!0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFScriptingManager=void 0;var n=i(3),s=i(4);t.PDFScriptingManager=class PDFScriptingManager{constructor({eventBus:e,sandboxBundleSrc:t=null,scriptingFactory:i=null,docPropertiesLookup:n=null}){this._pdfDocument=null;this._pdfViewer=null;this._closeCapability=null;this._destroyCapability=null;this._scripting=null;this._mouseState=Object.create(null);this._ready=!1;this._eventBus=e;this._sandboxBundleSrc=t;this._scriptingFactory=i;this._docPropertiesLookup=n}setViewer(e){this._pdfViewer=e}async setDocument(e){this._pdfDocument&&await this._destroyScripting();this._pdfDocument=e;if(!e)return;const[t,i,n]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(!t&&!n){await this._destroyScripting();return}if(e!==this._pdfDocument)return;try{this._scripting=this._createScripting()}catch(e){Window.ngxConsole.error(`PDFScriptingManager.setDocument: "${e?.message}".`);await this._destroyScripting();return}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this._updateFromSandbox(e.detail)}));this._internalEvents.set("dispatcheventinsandbox",(e=>{this._scripting?.dispatchEventInSandbox(e.detail)}));this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{if(e!==t){this._dispatchPageClose(t);this._dispatchPageOpen(e)}}));this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this._pdfViewer.currentPageNumber&&this._dispatchPageOpen(e)}));this._internalEvents.set("pagesdestroy",(async e=>{await this._dispatchPageClose(this._pdfViewer.currentPageNumber);await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillClose"}));this._closeCapability?.resolve()}));this._domEvents.set("mousedown",(e=>{this._mouseState.isDown=!0}));this._domEvents.set("mouseup",(e=>{this._mouseState.isDown=!1}));for(const[e,t]of this._internalEvents)this._eventBus._on(e,t);const s=document.querySelector(".pdfViewer");for(const[e,t]of this._domEvents)s.addEventListener(e,t,!0);try{const s=await this._getDocProperties();if(e!==this._pdfDocument)return;await this._scripting.createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...s,actions:n}});this._eventBus.dispatch("sandboxcreated",{source:this})}catch(e){Window.ngxConsole.error(`PDFScriptingManager.setDocument: "${e?.message}".`);await this._destroyScripting();return}await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"Open"}));await this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0);Promise.resolve().then((()=>{e===this._pdfDocument&&(this._ready=!0)}))}async dispatchWillSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}async dispatchDidPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get mouseState(){return this._mouseState}get destroyPromise(){return this._destroyCapability?.promise||null}get ready(){return this._ready}get _internalEvents(){return(0,s.shadow)(this,"_internalEvents",new Map)}get _domEvents(){return(0,s.shadow)(this,"_domEvents",new Map)}get _pageOpenPending(){return(0,s.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,s.shadow)(this,"_visitedPages",new Map)}async _updateFromSandbox(e){const t=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:i,siblings:s,command:r,value:o}=e;if(!i){switch(r){case"clear":Window.ngxConsole.clear();break;case"error":Window.ngxConsole.error(o);break;case"layout":if(t)return;const e=(0,n.apiPageLayoutToViewerModes)(o);this._pdfViewer.spreadMode=e.spreadMode;break;case"page-num":this._pdfViewer.currentPageNumber=o+1;break;case"print":await this._pdfViewer.pagesPromise;this._eventBus.dispatch("print",{source:this});break;case"println":Window.ngxConsole.log(o);break;case"zoom":if(t)return;this._pdfViewer.currentScaleValue=o;break;case"SaveAs":this._eventBus.dispatch("download",{source:this});break;case"FirstPage":this._pdfViewer.currentPageNumber=1;break;case"LastPage":this._pdfViewer.currentPageNumber=this._pdfViewer.pagesCount;break;case"NextPage":this._pdfViewer.nextPage();break;case"PrevPage":this._pdfViewer.previousPage();break;case"ZoomViewIn":if(t)return;this._pdfViewer.increaseScale();break;case"ZoomViewOut":if(t)return;this._pdfViewer.decreaseScale()}return}if(t&&e.focus)return;delete e.id;delete e.siblings;const a=s?[i,...s]:[i];for(const t of a){const i=document.querySelector(`[data-element-id="${t}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this._pdfDocument?.annotationStorage.setValue(t,void 0,e)}}async _dispatchPageOpen(e,t=!1){const i=this._pdfDocument,r=this._visitedPages;t&&(this._closeCapability=(0,s.createPromiseCapability)());if(!this._closeCapability)return;const o=this._pdfViewer.getPageView(e-1);if(o?.renderingState!==n.RenderingStates.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const a=(async()=>{const t=await(r.has(e)?null:o.pdfPage?.getJSActions());i===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();r.set(e,a)}async _dispatchPageClose(e){const t=this._pdfDocument,i=this._visitedPages;if(!this._closeCapability)return;if(this._pageOpenPending.has(e))return;const n=i.get(e);if(n){i.set(e,null);await n;t===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e}))}}async _getDocProperties(){if(this._docPropertiesLookup)return this._docPropertiesLookup(this._pdfDocument);throw new Error("_getDocProperties: Unable to lookup properties.")}_createScripting(){this._destroyCapability=(0,s.createPromiseCapability)();if(this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});throw new Error("_createScripting: Cannot create scripting.")}async _destroyScripting(){if(this._scripting){if(this._closeCapability){await Promise.race([this._closeCapability.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((e=>{}));this._closeCapability=null}this._pdfDocument=null;try{await this._scripting.destroySandbox()}catch(e){}for(const[e,t]of this._internalEvents)this._eventBus._off(e,t);this._internalEvents.clear();for(const[e,t]of this._domEvents)window.removeEventListener(e,t,!0);this._domEvents.clear();this._pageOpenPending.clear();this._visitedPages.clear();this._scripting=null;delete this._mouseState.isDown;this._ready=!1;this._destroyCapability?.resolve()}else{this._pdfDocument=null;this._destroyCapability?.resolve()}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebar=void 0;var n=i(3);const s="pdfSidebarNotification";t.PDFSidebar=class PDFSidebar{constructor({elements:e,pdfViewer:t,pdfThumbnailViewer:i,eventBus:s,l10n:r}){this.isOpen=!1;this.active=n.SidebarView.THUMBS;this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.onToggled=null;this.pdfViewer=t;this.pdfThumbnailViewer=i;this.outerContainer=e.outerContainer;this.sidebarContainer=e.sidebarContainer;this.toggleButton=e.toggleButton;this.thumbnailButton=e.thumbnailButton;this.outlineButton=e.outlineButton;this.attachmentsButton=e.attachmentsButton;this.layersButton=e.layersButton;this.thumbnailView=e.thumbnailView;this.outlineView=e.outlineView;this.attachmentsView=e.attachmentsView;this.layersView=e.layersView;this._outlineOptionsContainer=e.outlineOptionsContainer;this._currentOutlineItemButton=e.currentOutlineItemButton;this.eventBus=s;this.l10n=r;this.#n()}reset(){this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.#G(!0);this.switchView(n.SidebarView.THUMBS);this.outlineButton.disabled=!1;this.attachmentsButton.disabled=!1;this.layersButton.disabled=!1;this.outlineButton.hidden=!1;this.attachmentsButton.hidden=!1;this.layersButton.hidden=!1;this._currentOutlineItemButton.disabled=!0}get visibleView(){return this.isOpen?this.active:n.SidebarView.NONE}setInitialView(e=n.SidebarView.NONE){if(!this.isInitialViewSet){this.isInitialViewSet=!0;if(e!==n.SidebarView.NONE&&e!==n.SidebarView.UNKNOWN){this.switchView(e,!0);this.isInitialEventDispatched||this.#s()}else this.#s()}}switchView(e,t=!1){const i=e!==this.active;let s=!1;switch(e){case n.SidebarView.NONE:this.isOpen&&this.close();return;case n.SidebarView.THUMBS:this.isOpen&&i&&(s=!0);break;case n.SidebarView.OUTLINE:if(this.outlineButton.disabled)return;break;case n.SidebarView.ATTACHMENTS:if(this.attachmentsButton.disabled)return;break;case n.SidebarView.LAYERS:if(this.layersButton.disabled)return;break;default:Window.ngxConsole.error(`PDFSidebar.switchView: "${e}" is not a valid view.`);return}this.active=e;const r=e===n.SidebarView.THUMBS,o=e===n.SidebarView.OUTLINE,a=e===n.SidebarView.ATTACHMENTS,l=e===n.SidebarView.LAYERS;this.thumbnailButton.classList.toggle("toggled",r);this.outlineButton.classList.toggle("toggled",o);this.attachmentsButton.classList.toggle("toggled",a);this.layersButton.classList.toggle("toggled",l);this.thumbnailButton.setAttribute("aria-checked",r);this.outlineButton.setAttribute("aria-checked",o);this.attachmentsButton.setAttribute("aria-checked",a);this.layersButton.setAttribute("aria-checked",l);this.thumbnailView.classList.toggle("hidden",!r);this.outlineView.classList.toggle("hidden",!o);this.attachmentsView.classList.toggle("hidden",!a);this.layersView.classList.toggle("hidden",!l);this._outlineOptionsContainer.classList.toggle("hidden",!o);if(!t||this.isOpen){if(s){this.#$();this.#K()}i&&this.#s()}else this.open()}open(){if(!this.isOpen){this.isOpen=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.outerContainer.classList.add("sidebarMoving","sidebarOpen");this.active===n.SidebarView.THUMBS&&this.#$();this.#K();this.#s();this.#G()}}close(){if(this.isOpen){this.isOpen=!1;this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false");this.outerContainer.classList.add("sidebarMoving");this.outerContainer.classList.remove("sidebarOpen");this.#K();this.#s()}}toggle(){this.isOpen?this.close():this.open()}#s(){this.isInitialViewSet&&!this.isInitialEventDispatched&&(this.isInitialEventDispatched=!0);this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}#K(){if(this.onToggled)this.onToggled();else{this.pdfViewer.forceRendering();this.pdfThumbnailViewer.forceRendering()}}#$(){const{pdfViewer:e,pdfThumbnailViewer:t}=this,i=e.pagesCount;for(let s=0;s<i;s++){const i=e.getPageView(s);if(i?.renderingState===n.RenderingStates.FINISHED){t.getThumbnail(s).setImage(i)}}t.scrollThumbnailIntoView(e.currentPageNumber)}#X(){this.l10n.get("toggle_sidebar_notification2.title").then((e=>{this.toggleButton.title=e}));this.isOpen||this.toggleButton.classList.add(s)}#G(e=!1){(this.isOpen||e)&&this.toggleButton.classList.remove(s);e&&this.l10n.get("toggle_sidebar.title").then((e=>{this.toggleButton.title=e}))}#n(){this.sidebarContainer.addEventListener("transitionend",(e=>{e.target===this.sidebarContainer&&this.outerContainer.classList.remove("sidebarMoving")}));this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.thumbnailButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.THUMBS)}));this.outlineButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.OUTLINE)}));this.outlineButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("toggleoutlinetree",{source:this})}));this.attachmentsButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.ATTACHMENTS)}));this.layersButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.LAYERS)}));this.layersButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("resetlayers",{source:this})}));this._currentOutlineItemButton.addEventListener("click",(()=>{this.eventBus.dispatch("currentoutlineitem",{source:this})}));const onTreeLoaded=(e,t,i)=>{t.disabled=!e;t.hidden=!e;e?this.#X():this.active===i&&this.switchView(n.SidebarView.THUMBS)};this.eventBus._on("outlineloaded",(e=>{onTreeLoaded(e.outlineCount,this.outlineButton,n.SidebarView.OUTLINE);e.enableCurrentOutlineItemButton&&e.currentOutlineItemPromise&&e.currentOutlineItemPromise.then((e=>{this.isInitialViewSet&&(this._currentOutlineItemButton.disabled=!e)}))}));this.eventBus._on("attachmentsloaded",(e=>{onTreeLoaded(e.attachmentsCount,this.attachmentsButton,n.SidebarView.ATTACHMENTS)}));this.eventBus._on("layersloaded",(e=>{onTreeLoaded(e.layersCount,this.layersButton,n.SidebarView.LAYERS)}));this.eventBus._on("presentationmodechanged",(e=>{e.state===n.PresentationModeState.NORMAL&&this.visibleView===n.SidebarView.THUMBS&&this.#$()}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebarResizer=void 0;var n=i(3);const s="sidebarResizing";t.PDFSidebarResizer=class PDFSidebarResizer{constructor(e,t,i){this.isRTL=!1;this.sidebarOpen=!1;this._width=null;this._outerContainerWidth=null;this._boundEvents=Object.create(null);this.outerContainer=e.outerContainer;this.resizer=e.resizer;this.eventBus=t;i.getDirection().then((e=>{this.isRTL="rtl"===e}));this._addEventListeners()}get outerContainerWidth(){return this._outerContainerWidth||=this.outerContainer.clientWidth}_updateWidth(e=0){const t=Math.floor(this.outerContainerWidth/2);e>t&&(e=t);e<200&&(e=200);if(e===this._width)return!1;this._width=e;n.docStyle.setProperty("--sidebar-width",`${e}px`);return!0}_mouseMove(e){let t=e.clientX;this.isRTL&&(t=this.outerContainerWidth-t);this._updateWidth(t)}_mouseUp(e){this.outerContainer.classList.remove(s);this.eventBus.dispatch("resize",{source:this});const t=this._boundEvents;window.removeEventListener("mousemove",t.mouseMove);window.removeEventListener("mouseup",t.mouseUp)}_addEventListeners(){const e=this._boundEvents;e.mouseMove=this._mouseMove.bind(this);e.mouseUp=this._mouseUp.bind(this);this.resizer.addEventListener("mousedown",(t=>{if(0===t.button){this.outerContainer.classList.add(s);window.addEventListener("mousemove",e.mouseMove);window.addEventListener("mouseup",e.mouseUp)}}));this.eventBus._on("sidebarviewchanged",(e=>{this.sidebarOpen=!!e?.view}));this.eventBus._on("resize",(e=>{if(e?.source!==window)return;this._outerContainerWidth=null;if(!this._width)return;if(!this.sidebarOpen){this._updateWidth(this._width);return}this.outerContainer.classList.add(s);const t=this._updateWidth(this._width);Promise.resolve().then((()=>{this.outerContainer.classList.remove(s);t&&this.eventBus.dispatch("resize",{source:this})}))}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFThumbnailViewer=void 0;var n=i(3),s=i(29);const r="selected";t.PDFThumbnailViewer=class PDFThumbnailViewer{constructor({container:e,eventBus:t,linkService:i,renderingQueue:s,l10n:r,pageColors:o}){this.container=e;this.linkService=i;this.renderingQueue=s;this.l10n=r;this.pageColors=o||null;if(this.pageColors&&(!CSS.supports("color",this.pageColors.background)||!CSS.supports("color",this.pageColors.foreground))){(this.pageColors.background||this.pageColors.foreground)&&Window.ngxConsole.warn("PDFThumbnailViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used.");this.pageColors=null}this.scroll=(0,n.watchScroll)(this.container,this._scrollUpdated.bind(this));this._resetView()}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(e){return this._thumbnails[e]}_getVisibleThumbs(){return(0,n.getVisibleElements)({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t){Window.ngxConsole.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(r);t.div.classList.add(r)}const{first:i,last:s,views:o}=this._getVisibleThumbs();if(o.length>0){let r=!1;if(e<=i.id||e>=s.id)r=!0;else for(const{id:t,percent:i}of o)if(t===e){r=i<100;break}r&&(0,n.scrollIntoView)(t.div,{top:-19})}this._currentPageNumber=e}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,n.isValidRotation)(e))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument)return;if(this._pagesRotation===e)return;this._pagesRotation=e;const t={rotation:e};for(const e of this._thumbnails)e.update(t)}cleanup(){for(const e of this._thumbnails)e.renderingState!==n.RenderingStates.FINISHED&&e.reset();s.TempImageFactory.destroyCanvas()}_resetView(){this._thumbnails=[];this._currentPageNumber=1;this._pageLabels=null;this._pagesRotation=0;this.container.textContent=""}setDocument(e){this.initialized=!1;if(this.pdfDocument){this._cancelRendering();this._resetView()}this.pdfDocument=e;if(!e)return;if(this.initialized)return;this.initialized=!0;const t=e.getPage(1),i=e.getOptionalContentConfig();t.then((t=>{const n=e.numPages,o=t.getViewport({scale:1});for(let e=1;e<=n;++e){const t=new s.PDFThumbnailView({container:this.container,id:e,defaultViewport:o.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,l10n:this.l10n,pageColors:this.pageColors});this._thumbnails.push(t)}const a=this._thumbnails[0];a&&a.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(r)})).catch((e=>{Window.ngxConsole.error("Unable to initialize thumbnail viewer",e)}))}_cancelRendering(){for(const e of this._thumbnails)e.cancelRendering()}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;Window.ngxConsole.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e].setPageLabel(this._pageLabels?.[e]??null)}}async#q(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);return t}catch(e){Window.ngxConsole.error("Unable to get page for thumb view",e);return null}}#Y(e){return 1===e.first?.id||e.last?.id!==this._thumbnails.length&&this.scroll.down}forceRendering(){const e=this._getVisibleThumbs(),t=this.#Y(e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t);if(i){this.#q(i).then((()=>{this.renderingQueue.renderView(i)}));return!0}return!1}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TempImageFactory=t.PDFThumbnailView=void 0;var n=i(3),s=i(4);class TempImageFactory{static#Z=null;static getCanvas(e,t){const i=this.#Z||=document.createElement("canvas");i.width=e;i.height=t;const n=i.getContext("2d",{alpha:!1});n.save();n.fillStyle="rgb(255, 255, 255)";n.fillRect(0,0,e,t);n.restore();return[i,i.getContext("2d")]}static destroyCanvas(){const e=this.#Z;if(e){e.width=0;e.height=0}this.#Z=null}}t.TempImageFactory=TempImageFactory;t.PDFThumbnailView=class PDFThumbnailView{constructor({container:e,id:t,defaultViewport:i,optionalContentConfigPromise:s,linkService:r,renderingQueue:o,l10n:a,pageColors:l}){this.id=t;this.renderingId="thumbnail"+t;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=s||null;this.pageColors=l||null;this.linkService=r;this.renderingQueue=o;this.renderTask=null;this.renderingState=n.RenderingStates.INITIAL;this.resume=null;const h=this.viewport.width,d=h/this.viewport.height;this.canvasWidth=98;this.canvasHeight=this.canvasWidth/d|0;this.scale=this.canvasWidth/h;this.l10n=a;window.pdfThumbnailGenerator?window.pdfThumbnailGenerator(this,r,t,e,this._thumbPageTitle):this.createThumbnail(this,r,t,e,this._thumbPageTitle)}createThumbnail(e,t,i,n,s){const r=document.createElement("a");r.href=t.getAnchorUrl("#page="+i);s.then((e=>{r.title=e}));r.onclick=function(){t.goToPage(i);return!1};e.anchor=r;const o=document.createElement("div");o.className="thumbnail";o.setAttribute("data-page-number",this.id);e.div=o;const a=document.createElement("div");a.className="thumbnailSelectionRing";a.style.width=this.canvasWidth+2+"px";a.style.height=this.canvasHeight+2+"px";e.ring=a;o.append(a);r.append(o);n.append(r)}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t});this.reset()}reset(){this.cancelRendering();this.renderingState=n.RenderingStates.INITIAL;const e=this.viewport.width,t=e/this.viewport.height;this.canvasHeight=this.canvasWidth/t|0;this.scale=this.canvasWidth/e;this.div.removeAttribute("data-loaded");const i=this.ring;i.textContent="";i.style.width=this.canvasWidth+2+"px";i.style.height=this.canvasHeight+2+"px";if(this.canvas){this.canvas.width=0;this.canvas.height=0;delete this.canvas}if(this.image){this.image.removeAttribute("src");delete this.image}}update({rotation:e=null}){"number"==typeof e&&(this.rotation=e);const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t});this.reset()}cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}_getPageDrawContext(e=1){const t=document.createElement("canvas"),i=t.getContext("2d",{alpha:!1}),s=new n.OutputScale;t.width=e*this.canvasWidth*s.sx|0;t.height=e*this.canvasHeight*s.sy|0;return{ctx:i,canvas:t,transform:s.scaled?[s.sx,0,0,s.sy,0,0]:null}}_convertCanvasToImage(e){if(this.renderingState!==n.RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const t=this._reduceImage(e),i=document.createElement("img");i.className="thumbnailImage";this._thumbPageCanvas.then((e=>{i.setAttribute("aria-label",e)}));i.style.width=this.canvasWidth+"px";i.style.height=this.canvasHeight+"px";i.src=t.toDataURL();this.image=i;this.div.setAttribute("data-loaded",!0);this.ring.append(i);t.width=0;t.height=0}draw(){if(this.renderingState!==n.RenderingStates.INITIAL){Window.ngxConsole.error("Must be in new state before drawing");return Promise.resolve()}const{pdfPage:e}=this;if(!e){this.renderingState=n.RenderingStates.FINISHED;return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=n.RenderingStates.RUNNING;const finishRenderTask=async(e=null)=>{a===this.renderTask&&(this.renderTask=null);if(!(e instanceof s.RenderingCancelledException)){this.renderingState=n.RenderingStates.FINISHED;this._convertCanvasToImage(i);if(e)throw e}},{ctx:t,canvas:i,transform:r}=this._getPageDrawContext(2),o={canvasContext:t,transform:r,viewport:this.viewport.clone({scale:2*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,background:PDFViewerApplicationOptions.get("pdfBackgroundColor"),pageColors:this.pageColors},a=this.renderTask=e.render(o);a.onContinue=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=n.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=n.RenderingStates.RUNNING;e()}}};const l=a.promise.then((function(){return finishRenderTask(null)}),(function(e){return finishRenderTask(e)}));l.finally((()=>{i.width=0;i.height=0;this.linkService.isPageCached(this.id)||this.pdfPage?.cleanup()}));return l}setImage(e){if(this.renderingState!==n.RenderingStates.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i}=e;if(t){this.pdfPage||this.setPdfPage(i);this.renderingState=n.RenderingStates.FINISHED;this._convertCanvasToImage(t)}}_reduceImage(e){const{ctx:t,canvas:i}=this._getPageDrawContext();if(e.width<=2*i.width){t.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height);return i}let n=i.width<<3,s=i.height<<3;const[r,o]=TempImageFactory.getCanvas(n,s);for(;n>e.width||s>e.height;){n>>=1;s>>=1}o.drawImage(e,0,0,e.width,e.height,0,0,n,s);for(;n>2*i.width;){o.drawImage(r,0,0,n,s,0,0,n>>1,s>>1);n>>=1;s>>=1}t.drawImage(r,0,0,n,s,0,0,i.width,i.height);return i}get _thumbPageTitle(){return this.l10n.get("thumb_page_title",{page:this.pageLabel??this.id})}get _thumbPageCanvas(){return this.l10n.get("thumb_page_canvas",{page:this.pageLabel??this.id})}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this._thumbPageTitle.then((e=>{this.anchor.title=e}));this.renderingState===n.RenderingStates.FINISHED&&this._thumbPageCanvas.then((e=>{this.image?.setAttribute("aria-label",e)}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFViewer=t.PDFSinglePageViewer=void 0;var n=i(3),s=i(31);class PDFViewer extends s.BaseViewer{}t.PDFViewer=PDFViewer;class PDFSinglePageViewer extends s.BaseViewer{_resetView(){super._resetView();this._scrollMode=n.ScrollMode.PAGE;this._spreadMode=n.SpreadMode.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}}t.PDFSinglePageViewer=PDFSinglePageViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PagesCountLimit=t.PDFPageViewBuffer=t.BaseViewer=void 0;var n=i(4),s=i(3),r=i(32),o=i(34),a=i(1),l=i(33),h=i(35),d=i(36),c=i(24),u=i(8),g=i(40),p=i(41),f=i(42),m=i(43);const w="enablePermissions",v={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};t.PagesCountLimit=v;const b=a.compatibilityParams.annotationEditorMode??n.AnnotationEditorType.DISABLE;function isValidAnnotationEditorMode(e){return Object.values(n.AnnotationEditorType).includes(e)&&e!==n.AnnotationEditorType.DISABLE}class PDFPageViewBuffer{#Q=new Set;#J=0;constructor(e){this.#J=e}push(e){const t=this.#Q;t.has(e)&&t.delete(e);t.add(e);t.size>this.#J&&this.#ee()}resize(e,t=null){this.#J=e;const i=this.#Q;if(t){const e=i.size;let n=1;for(const s of i){if(t.has(s.id)){i.delete(s);i.add(s)}if(++n>e)break}}for(;i.size>this.#J;)this.#ee()}has(e){return this.#Q.has(e)}[Symbol.iterator](){return this.#Q.keys()}#ee(){const e=this.#Q.keys().next().value;e?.destroy();this.#Q.delete(e)}}t.PDFPageViewBuffer=PDFPageViewBuffer;class BaseViewer{#te=null;#ie=n.AnnotationEditorType.DISABLE;#ne=null;#se=n.AnnotationMode.ENABLE_FORMS;#re=!1;#oe=0;#ae=null;#le=null;constructor(e){if(this.constructor===BaseViewer)throw new Error("Cannot initialize BaseViewer.");const t="2.16.323";if(n.version!==t)throw new Error(`The API version "${n.version}" does not match the Viewer version "2.16.323".`);this.container=e.container;this.viewer=e.viewer||e.container.firstElementChild;this.pageViewMode=e.pageViewMode||"multiple";if("DIV"!==this.container?.tagName.toUpperCase()||"DIV"!==this.viewer?.tagName.toUpperCase())throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.eventBus=e.eventBus;this.linkService=e.linkService||new u.SimpleLinkService;this.downloadManager=e.downloadManager||null;this.findController=e.findController||null;this._scriptingManager=e.scriptingManager||null;this.removePageBorders=e.removePageBorders||!1;this.textLayerMode=e.textLayerMode??s.TextLayerMode.ENABLE;this.#se=e.annotationMode??n.AnnotationMode.ENABLE_FORMS;this.#ie=e.annotationEditorMode??b;this.imageResourcesPath=e.imageResourcesPath||"";this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1;this.renderer=e.renderer||s.RendererType.CANVAS;this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.maxCanvasPixels=e.maxCanvasPixels;this.l10n=e.l10n||l.NullL10n;this.#re=e.enablePermissions||!1;this.pageColors=e.pageColors||null;if(this.pageColors&&(!CSS.supports("color",this.pageColors.background)||!CSS.supports("color",this.pageColors.foreground))){(this.pageColors.background||this.pageColors.foreground)&&console.warn("BaseViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used.");this.pageColors=null}this.defaultRenderingQueue=!e.renderingQueue;if(this.defaultRenderingQueue){this.renderingQueue=new c.PDFRenderingQueue;this.renderingQueue.setViewer(this)}else this.renderingQueue=e.renderingQueue;this.scroll=(0,s.watchScroll)(this.container,this._scrollUpdate.bind(this));this.presentationModeState=s.PresentationModeState.UNKNOWN;this._onBeforeDraw=this._onAfterDraw=null;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");this.updateContainerHeightCss()}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}get pageViewsReady(){return!!this._pagesCapability.settled&&this._pages.every((function(e){return e?.pdfPage}))}get renderForms(){return this.#se===n.AnnotationMode.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");if(!this.pdfDocument)return;const t=Math.abs(this._currentPageNumber-e)<2;this._setCurrentPageNumber(e,!0)||Window.ngxConsole.error(`currentPageNumber: "${e}" is not a valid page.`);if(this.pageFlip)if(t){Window.ngxConsole.log("Flip");this.pageFlip.flip(e-1)}else{Window.ngxConsole.log("turn to page");this.pageFlip.turnToPage(e-1)}}hidePagesDependingOnpageViewMode(){"book"===this.pageViewMode&&(this.pageFlip||setTimeout((()=>{if(!this.pageFlip){const e=this._pages[0].div,t=e.parentElement,i=t.parentElement;i.style.width=2*e.clientWidth+"px";i.style.overflow="hidden";i.style.marginLeft="auto";i.style.marginRight="auto";this.pageFlip=new h.PageFlip(t,{width:e.clientWidth,height:e.clientHeight,showCover:!0,size:"fixed"});this.pageFlip.loadFromHTML(document.querySelectorAll(".page"));this.ensureAdjecentPagesAreLoaded();this.pageFlip.on("flip",(e=>{this._currentPageNumber!==e.data+1&&this._setCurrentPageNumber(e.data+1,!1)}))}}),100))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e){t&&this.#he();return!0}if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;this._currentPageNumber=e;this.hidePagesDependingOnpageViewMode();if("book"===this.pageViewMode||"infinite-scroll"===this.pageViewMode){const e=this._pages[this.currentPageNumber-1];if(e.div.parentElement.classList.contains("spread"))e.div.parentElement.childNodes.forEach((e=>{const t=Number(e.getAttribute("data-page-number")),i=this._pages[t-1];this.#q(i).then((()=>{this.renderingQueue.renderView(i)}));e.style.display="inline-block"}));else{this.#q(e).then((()=>{this.renderingQueue.renderView(e)}));"book"===this.pageViewMode&&this.ensureAdjecentPagesAreLoaded()}}this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i});t&&this.#he();return!0}addPageToRenderQueue(e=0){if(e>=0&&e<=this._pages.length-1){const t=this._pages[e];if(t.div.querySelector(".loadingIcon")){this.#q(t).then((()=>{this.renderingQueue.renderView(t)}));return!0}}return!1}ensureAdjecentPagesAreLoaded(){if(!window.adjacentPagesLoader){window.adjacentPagesLoader=e=>{Window.ngxConsole.log("rendered",e);let t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber)];if(t){let e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the next page");this.#q(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+1)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the next + 1 page");this.#q(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+2)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the next + 2 page");this.#q(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+3)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the next + 3 page");this.#q(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.max(0,this.currentPageNumber-1)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the current page");this.#q(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.max(0,this.currentPageNumber-2)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the previous page");this.#q(t).then((()=>{this.renderingQueue.renderView(t)}))}else Window.ngxConsole.log("Finished preloading the pages")}}}}}}};this.eventBus._on("pagerendered",window.adjacentPagesLoader)}window.adjacentPagesLoader()}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||Window.ngxConsole.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==s.UNKNOWN_SCALE?this._currentScale:s.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(e,!1)}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this._setScale(e,!1)}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,s.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;(e%=360)<0&&(e+=360);if(this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber,i={rotation:e};for(const e of this._pages)e.update(i);this._currentScaleValue&&this._setScale(this._currentScaleValue,!0);this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t});this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}#de(e){const t={annotationEditorMode:this.#ie,annotationMode:this.#se,textLayerMode:this.textLayerMode};if(!e)return t;e.includes(n.PermissionFlag.COPY)||this.viewer.classList.add(w);e.includes(n.PermissionFlag.MODIFY_CONTENTS)||(t.annotationEditorMode=n.AnnotationEditorType.DISABLE);e.includes(n.PermissionFlag.MODIFY_ANNOTATIONS)||e.includes(n.PermissionFlag.FILL_INTERACTIVE_FORMS)||this.#se!==n.AnnotationMode.ENABLE_FORMS||(t.annotationMode=n.AnnotationMode.ENABLE);return t}#ce(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#le=()=>{if("hidden"===document.visibilityState){e();document.removeEventListener("visibilitychange",this.#le);this.#le=null}};document.addEventListener("visibilitychange",this.#le)}));return Promise.race([this._onePageRenderedCapability.promise,e])}setDocument(e){if(this.pdfDocument){this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();this.findController&&this.findController.setDocument(null);this._scriptingManager&&this._scriptingManager.setDocument(null);if(this.#ne){this.#ne.destroy();this.#ne=null}}this.pdfDocument=e;if(!e)return;const t=e.isPureXfa,i=e.numPages,r=e.getPage(1),o=e.getOptionalContentConfig(),a=this.#re?e.getPermissions():Promise.resolve();if(i>v.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=s.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:i})}),(()=>{}));this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#te.push(t)};this.eventBus._on("pagerender",this._onBeforeDraw);this._onAfterDraw=e=>{if(!e.cssTransform&&!this._onePageRenderedCapability.settled){this._onePageRenderedCapability.resolve({timestamp:e.timestamp});this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null;if(this.#le){document.removeEventListener("visibilitychange",this.#le);this.#le=null}}};this.eventBus._on("pagerendered",this._onAfterDraw);Promise.all([r,a]).then((([r,a])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(r);this._optionalContentConfigPromise=o;const{annotationEditorMode:l,annotationMode:h,textLayerMode:c}=this.#de(a);if(l!==n.AnnotationEditorType.DISABLE){const e=l;if(t)console.warn("Warning: XFA-editing is not implemented.");else if(isValidAnnotationEditorMode(e)){this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e});this.#ne=new n.AnnotationEditorUIManager(this.container,this.eventBus);e!==n.AnnotationEditorType.NONE&&this.#ne.updateMode(e)}else console.error(`Invalid AnnotationEditor mode: ${e}`)}const u=this._scrollMode===s.ScrollMode.PAGE?null:this.viewer,g=this.currentScale,p=r.getViewport({scale:g*n.PixelsPerInch.PDF_TO_CSS_UNITS}),f=c===s.TextLayerMode.DISABLE||t?null:this,m=h!==n.AnnotationMode.DISABLE?this:null,w=t?this:null,b=this.#ne?this:null;for(let e=1;e<=i;++e){const t=new d.PDFPageView({container:u,eventBus:this.eventBus,id:e,scale:g,defaultViewport:p.clone(),optionalContentConfigPromise:o,renderingQueue:this.renderingQueue,textLayerFactory:f,textLayerMode:c,annotationLayerFactory:m,annotationMode:h,xfaLayerFactory:w,annotationEditorLayerFactory:b,textHighlighterFactory:this,structTreeLayerFactory:this,imageResourcesPath:this.imageResourcesPath,removePageBorders:this.removePageBorders,renderer:this.renderer,useOnlyCssZoom:this.useOnlyCssZoom,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n});this._pages.push(t)}const _=this._pages[0];if(_){_.setPdfPage(r);this.linkService.cachePageRef(1,r.ref)}this._scrollMode===s.ScrollMode.PAGE?this.#ue():this._spreadMode!==s.SpreadMode.NONE&&this._updateSpreadMode();this.#ce().then((async()=>{this.findController&&this.findController.setDocument(e);this._scriptingManager&&this._scriptingManager.setDocument(e);if(e.loadingParams.disableAutoFetch||i>v.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let t=i-1;if(t<=0)this._pagesCapability.resolve();else for(let n=2;n<=i;++n){const i=e.getPage(n).then((e=>{const i=this._pages[n-1];i.pdfPage||i.setPdfPage(e);this.linkService.cachePageRef(n,e.ref);0==--t&&this._pagesCapability.resolve()}),(e=>{Window.ngxConsole.error(`Unable to get page ${n} to initialize viewer`,e);0==--t&&this._pagesCapability.resolve()}));n%v.PAUSE_EAGER_PAGE_INIT==0&&await i}}));this.hidePagesDependingOnpageViewMode();this.eventBus.dispatch("pagesinit",{source:this});e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(this.viewer.lang=t.Language)}));this.defaultRenderingQueue&&this.update()})).catch((e=>{Window.ngxConsole.error("Unable to initialize viewer",e);this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;Window.ngxConsole.error("setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=s.UNKNOWN_SCALE;this._currentScaleValue=null;this._pageLabels=null;const e=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10;this.#te=new PDFPageViewBuffer(e);this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._firstPageCapability=(0,n.createPromiseCapability)();this._onePageRenderedCapability=(0,n.createPromiseCapability)();this._pagesCapability=(0,n.createPromiseCapability)();this._scrollMode=s.ScrollMode.VERTICAL;this._previousScrollMode=s.ScrollMode.UNKNOWN;this._spreadMode=s.SpreadMode.NONE;this.#ae={previousPageNumber:1,scrollDown:!0,pages:[]};if(this._onBeforeDraw){this.eventBus._off("pagerender",this._onBeforeDraw);this._onBeforeDraw=null}if(this._onAfterDraw){this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null}if(this.#le){document.removeEventListener("visibilitychange",this.#le);this.#le=null}this.viewer.textContent="";this._updateScrollMode();this.viewer.removeAttribute("lang");this.viewer.classList.remove(w)}#ue(){if(this._scrollMode!==s.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#ae,i=this.viewer;i.textContent="";t.pages.length=0;if(this._spreadMode!==s.SpreadMode.NONE||this.isInPresentationMode){const n=new Set,s=this._spreadMode-1;if(-1===s)n.add(e-1);else if(e%2!==s){n.add(e-1);n.add(e)}else{n.add(e-2);n.add(e-1)}const r=document.createElement("div");r.className="spread";if(this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage";r.append(e)}for(const e of n){const i=this._pages[e];if(i){r.append(i.div);t.pages.push(i)}}i.append(r)}else{const n=this._pages[e-1];i.append(n.div);t.pages.push(n)}t.scrollDown=e>=t.previousPageNumber;t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}scrollPagePosIntoView(e,t){const i=this._pages[e-1].div;if(t){const n={...t};if("string"==typeof n.top&&n.top.endsWith("%")){const e=Number(n.top.replace("%","")),t=this.viewer.querySelector(".page")?.clientHeight;let s=i.clientHeight?i.clientHeight:t;const r=this.viewer.parentElement.clientHeight;s=Math.max(0,s-r);n.top=e*s/100}if("string"==typeof n.left&&n.left.endsWith("%")){const e=Number(n.left.replace("%","")),t=this.viewer.querySelector(".page")?.clientWidth,s=i.clientWidth?i.clientWidth:t;n.left=e*s/100}this.#ge({div:i,id:e},n)}else this.#ge({pageDiv:i,pageNumber:e})}#ge(e,t=null){if(!e)return;const{div:i,id:n}=e;if(this._scrollMode===s.ScrollMode.PAGE){this._setCurrentPageNumber(n);this.#ue();this.update()}if(!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,n=e+i.clientWidth,{scrollLeft:r,clientWidth:o}=this.container;(this._scrollMode===s.ScrollMode.HORIZONTAL||e<r||n>r+o)&&(t={left:0,top:0})}(0,s.scrollIntoView)(i,t,!1,"infinite-scroll"===this.pageViewMode)}#pe(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}_setScaleUpdatePages(e,t,i=!1,r=!1){this._currentScaleValue=t.toString();if(this.#pe(e)){r&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t});return}s.docStyle.setProperty("--scale-factor",e*n.PixelsPerInch.PDF_TO_CSS_UNITS);const o={scale:e};for(const e of this._pages)e.update(o);this._currentScale=e;if(!i){let e,t=this._currentPageNumber;if(this._location&&!this.isInPresentationMode&&!this.isChangingPresentationMode){t=this._location.pageNumber;e=[null,{name:"XYZ"},this._location.left,this._location.top,null]}this.scrollPageIntoView({pageNumber:t,destArray:e,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:r?t:void 0});this.defaultRenderingQueue&&this.update();this.updateContainerHeightCss()}get _pageWidthScaleFactor(){return this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL?2:1}_setScale(e,t=!1){e||(e="auto");let i=parseFloat(e);if(this._currentScale!==i)if(i>0)this._setScaleUpdatePages(i,e,t,!1);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let r=s.SCROLLBAR_PADDING,o=s.VERTICAL_PADDING;this.isInPresentationMode?r=o=4:this.removePageBorders?r=o=0:this._scrollMode===s.ScrollMode.HORIZONTAL&&([r,o]=[o,r]);const a=(this.container.clientWidth-r)/n.width*n.scale/this._pageWidthScaleFactor,l=(this.container.clientHeight-o)/n.height*n.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=a;break;case"page-height":i=l;break;case"page-fit":i=Math.min(a,l);break;case"auto":const t=(0,s.isPortraitOrientation)(n)?a:Math.min(l,a);i=Math.min(s.MAX_AUTO_SCALE,t);break;default:Window.ngxConsole.error(`_setScale: "${e}" is an unknown zoom value.`);return}this._setScaleUpdatePages(i,e,t,!0)}}#he(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this._setScale(this._currentScaleValue,!0);this.#ge(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:r=!1}){if(!this.pdfDocument)return;const o=Number.isInteger(e)&&this._pages[e-1];if(!o){Window.ngxConsole.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(e,!0);return}let a,l,h=0,d=0,c=0,u=0;const g=o.rotation%180!=0,p=(g?o.height:o.width)/o.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS,f=(g?o.width:o.height)/o.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":h=t[2];d=t[3];m=t[4];h=null!==h?h:0;d=null!==d?d:f;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":d=t[2];m="page-width";if(null===d&&this._location){h=this._location.left;d=this._location.top}else("number"!=typeof d||d<0)&&(d=f);break;case"FitV":case"FitBV":h=t[2];c=p;u=f;m="page-height";break;case"FitR":h=t[2];d=t[3];c=t[4]-h;u=t[5]-d;const e=this.removePageBorders?0:s.SCROLLBAR_PADDING,i=this.removePageBorders?0:s.VERTICAL_PADDING;a=(this.container.clientWidth-e)/c/n.PixelsPerInch.PDF_TO_CSS_UNITS;l=(this.container.clientHeight-i)/u/n.PixelsPerInch.PDF_TO_CSS_UNITS;m=Math.min(Math.abs(a),Math.abs(l));break;default:Window.ngxConsole.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}r||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===s.UNKNOWN_SCALE&&(this.currentScaleValue=s.DEFAULT_SCALE_VALUE));this.#q(o).then((()=>{this.renderingQueue.renderView(o);"single"===this.pageViewMode&&this.currentPageNumber!==e&&(this.currentPageNumber=e)}));if("page-fit"===m&&!t[4]){this.#ge(o);return}const w=[o.viewport.convertToViewportPoint(h,d),o.viewport.convertToViewportPoint(h+c,d+u)];let v=Math.min(w[0][0],w[1][0]),b=Math.min(w[0][1],w[1][1]);if(!i){v=Math.max(v,0);b=Math.max(b,0)}this.#ge(o,{left:v,top:b})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,r=this._pages[s-1],o=this.container,a=r.getPagePoint(o.scrollLeft-e.x,o.scrollTop-e.y),l=Math.round(a[0]),h=Math.round(a[1]);let d=`#page=${s}`;this.isInPresentationMode||(d+=`&zoom=${n},${l},${h}`);this._location={pageNumber:s,scale:n,top:h,left:l,rotation:this._pagesRotation,pdfOpenParams:d}}update(){this.scrollMode===s.ScrollMode.PAGE?this.viewer.classList.add("singlePageView"):this.viewer.classList.remove("singlePageView");const e=this._getVisiblePages(),t=e.views,i=t.length;if(0===i)return;const n=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10,r=Math.max(n,2*i+1);this.#te.resize(r,e.ids);this.renderingQueue.renderHighestPriority(e);const o=this._spreadMode===s.SpreadMode.NONE&&(this._scrollMode===s.ScrollMode.PAGE||this._scrollMode===s.ScrollMode.VERTICAL),a=this._currentPageNumber;let l=!1;for(const e of t){if(e.percent<100)break;if(e.id===a&&o){l=!0;break}}this._setCurrentPageNumber(l?a:t[0].id);this._updateLocation(e.first);this.eventBus.dispatch("updateviewarea",{source:this,location:this._location});this.hidePagesDependingOnpageViewMode()}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===s.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===s.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===s.ScrollMode.PAGE?this.#ae.pages:this._pages,t=this._scrollMode===s.ScrollMode.HORIZONTAL,i=t&&this._isContainerRtl;return(0,s.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}isPageVisible(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){Window.ngxConsole.error(`isPageVisible: "${e}" is not a valid page.`);return!1}return this._getVisiblePages().ids.has(e)}isPageCached(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){Window.ngxConsole.error(`isPageCached: "${e}" is not a valid page.`);return!1}const t=this._pages[e-1];return this.#te.has(t)}cleanup(){for(const e of this._pages)e.renderingState!==s.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#q(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref);return t}catch(e){Window.ngxConsole.error("Unable to get page for page view",e);return null}}#Y(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case s.ScrollMode.PAGE:return this.#ae.scrollDown;case s.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}#fe(e){for(const t of e){this._pages[t-1]?.toggleLoadingIconSpinner(!0)}for(const t of this.#te)e.has(t.id)||t.toggleLoadingIconSpinner(!1)}forceRendering(e){const t=e||this._getVisiblePages(),i=this.#Y(t),n=this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL,r=this.renderingQueue.getHighestPriority(t,this._pages,i,n);this.#fe(t.ids);if(r){this.#q(r).then((()=>{this.renderingQueue.renderView(r)}));return!0}return!1}createTextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:i,enhanceTextSelection:n=!1,eventBus:s,highlighter:r}){return new f.TextLayerBuilder({textLayerDiv:e,eventBus:s,pageIndex:t,viewport:i,enhanceTextSelection:!this.isInPresentationMode&&n,highlighter:r})}createTextHighlighter({pageIndex:e,eventBus:t}){return new p.TextHighlighter({eventBus:t,pageIndex:e,findController:this.isInPresentationMode?null:this.findController})}createAnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i=this.pdfDocument?.annotationStorage,imageResourcesPath:n="",renderForms:s=!0,l10n:r=l.NullL10n,enableScripting:a=this.enableScripting,hasJSActionsPromise:h=this.pdfDocument?.hasJSActions(),mouseState:d=this._scriptingManager?.mouseState,fieldObjectsPromise:c=this.pdfDocument?.getFieldObjects(),annotationCanvasMap:u=null}){return new o.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i,imageResourcesPath:n,renderForms:s,linkService:this.linkService,downloadManager:this.downloadManager,l10n:r,enableScripting:a,hasJSActionsPromise:h,mouseState:d,fieldObjectsPromise:c,annotationCanvasMap:u})}createAnnotationEditorLayerBuilder({uiManager:e=this.#ne,pageDiv:t,pdfPage:i,l10n:n,annotationStorage:s=this.pdfDocument?.annotationStorage}){return new r.AnnotationEditorLayerBuilder({uiManager:e,pageDiv:t,pdfPage:i,annotationStorage:s,l10n:n})}createXfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i=this.pdfDocument?.annotationStorage}){return new m.XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i,linkService:this.linkService})}createStructTreeLayerBuilder({pdfPage:e}){return new g.StructTreeLayerBuilder({pdfPage:e})}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,i=this._pages.length;t<i;++t){const i=this._pages[t];if(i.width!==e.width||i.height!==e.height)return!1}return!0}getPagesOverview(){return this._pages.map((e=>{const t=e.pdfPage.getViewport({scale:1});return!this.enablePrintAutoRotate||(0,s.isPortraitOrientation)(t)?{width:t.width,height:t.height,rotation:t.rotation}:{width:t.height,height:t.width,rotation:(t.rotation-90)%360}}))}get optionalContentConfigPromise(){if(!this.pdfDocument)return Promise.resolve(null);if(!this._optionalContentConfigPromise){console.error("optionalContentConfigPromise: Not initialized yet.");return this.pdfDocument.getOptionalContentConfig()}return this._optionalContentConfigPromise}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(!this.pdfDocument)return;if(!this._optionalContentConfigPromise)return;this._optionalContentConfigPromise=e;const t={optionalContentConfigPromise:e};for(const e of this._pages)e.update(t);this.update();this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e})}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,s.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);if(!(this.pagesCount>v.FORCE_SCROLL_MODE_PAGE)){this._previousScrollMode=this._scrollMode;this._scrollMode=e;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e});this._updateScrollMode(this._currentPageNumber)}}}_updateScrollMode(e=null){const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===s.ScrollMode.HORIZONTAL);i.classList.toggle("scrollWrapped",t===s.ScrollMode.WRAPPED);if(this.pdfDocument&&e){t===s.ScrollMode.PAGE?this.#ue():this._previousScrollMode===s.ScrollMode.PAGE&&this._updateSpreadMode();this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0);this._setCurrentPageNumber(e,!0);this.update()}}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,s.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e;this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e});this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===s.ScrollMode.PAGE)this.#ue();else{t.textContent="";if(this._spreadMode===s.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let n=null;for(let s=0,r=i.length;s<r;++s){if(null===n){n=document.createElement("div");n.className="spread";t.append(n)}else if(s%2===e){n=n.cloneNode(!1);t.append(n)}n.append(i[s].div)}}}this.hidePagesDependingOnpageViewMode();if(e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0);this._setCurrentPageNumber(e,!0);this.update()}}_getPageAdvance(e,t=!1){switch(this._scrollMode){case s.ScrollMode.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:e,y:t,percent:s,widthPercent:r}of i){if(0===s||r<100)continue;let i=n.get(t);i||n.set(t,i||=[]);i.push(e)}for(const i of n.values()){const n=i.indexOf(e);if(-1===n)continue;const s=i.length;if(1===s)break;if(t)for(let t=n-1,s=0;t>=s;t--){const n=i[t],s=i[t+1]-1;if(n<s)return e-s}else for(let t=n+1,r=s;t<r;t++){const n=i[t],s=i[t-1]+1;if(n>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case s.ScrollMode.HORIZONTAL:break;case s.ScrollMode.PAGE:case s.ScrollMode.VERTICAL:{if(this._spreadMode===s.SpreadMode.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:n}=this._getVisiblePages(),r=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===r){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;this.currentPageNumber=Math.min(e+i,t);return!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;this.currentPageNumber=Math.max(e-t,1);return!0}increaseScale(e=1){let t=this._currentScale,i=Number(PDFViewerApplicationOptions.get("maxZoom"));i||(i=s.MAX_SCALE);do{t=(t*s.DEFAULT_SCALE_DELTA).toFixed(2);t=Math.ceil(10*t)/10;t=Math.min(i,t)}while(--e>0&&t<i);this.currentScaleValue=t}decreaseScale(e=1){let t=this._currentScale,i=Number(PDFViewerApplicationOptions.get("minZoom"));i||(i=s.MIN_SCALE);do{t=(t/s.DEFAULT_SCALE_DELTA).toFixed(2);t=Math.floor(10*t)/10;t=Math.max(i,t)}while(--e>0&&t>i);this.currentScaleValue=t}updateContainerHeightCss(){const e=this.container.clientHeight;if(e!==this.#oe){this.#oe=e;s.docStyle.setProperty("--viewer-container-height",`${e}px`)}}get annotationEditorMode(){return this.#ne?this.#ie:n.AnnotationEditorType.DISABLE}set annotationEditorMode(e){if(!this.#ne)throw new Error("The AnnotationEditor is not enabled.");if(this.#ie!==e){if(!isValidAnnotationEditorMode(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);if(this.pdfDocument){this.#ie=e;this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e});this.#ne.updateMode(e)}}}set annotationEditorParams({type:e,value:t}){if(!this.#ne)throw new Error("The AnnotationEditor is not enabled.");this.#ne.updateParams(e,t)}}t.BaseViewer=BaseViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditorLayerBuilder=void 0;var n=i(4),s=i(33);t.AnnotationEditorLayerBuilder=class AnnotationEditorLayerBuilder{#me;constructor(e){this.pageDiv=e.pageDiv;this.pdfPage=e.pdfPage;this.annotationStorage=e.annotationStorage||null;this.l10n=e.l10n||s.NullL10n;this.annotationEditorLayer=null;this.div=null;this._cancelled=!1;this.#me=e.uiManager}async render(e,t="display"){if("display"!==t)return;if(this._cancelled)return;const i=e.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:i});this.show();return}this.div=document.createElement("div");this.div.className="annotationEditorLayer";this.div.tabIndex=0;this.pageDiv.append(this.div);this.annotationEditorLayer=new n.AnnotationEditorLayer({uiManager:this.#me,div:this.div,annotationStorage:this.annotationStorage,pageIndex:this.pdfPage._pageIndex,l10n:this.l10n,viewport:i});const s={viewport:i,div:this.div,annotations:null,intent:t};this.annotationEditorLayer.render(s)}cancel(){this._cancelled=!0;this.destroy()}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&(this.div.hidden=!1)}destroy(){if(this.div){this.pageDiv=null;this.annotationEditorLayer.destroy();this.div.remove()}}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.NullL10n=void 0;t.fixupLangCode=function fixupLangCode(e){return n[e?.toLowerCase()]||e};t.getL10nFallback=getL10nFallback;const i={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",print_progress_percent:"{{progress}}%","toggle_sidebar.title":"Toggle Sidebar","toggle_sidebar_notification2.title":"Toggle Sidebar (document contains outline/attachments/layers)",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",error_version_info:"PDF.js v{{version}} (build: {{build}})",error_message:"Message: {{message}}",error_stack:"Stack: {{stack}}",error_file:"File: {{file}}",error_line:"Line: {{line}}",rendering_error:"An error occurred while rendering the page.",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading:"Loading…",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts.",free_text_default_content:"Enter text…",editor_free_text_aria_label:"FreeText Editor",editor_ink_aria_label:"Ink Editor",editor_ink_canvas_aria_label:"User-created image"};function getL10nFallback(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return i[e]||""}const n={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"};const s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,i=getL10nFallback(e,t))=>function formatL10nValue(e,t){return t?e.replace(/\{\{\s*(\w+)\s*\}\}/g,((e,i)=>i in t?t[i]:"{{"+i+"}}")):e}(i,t),async translate(e){}};t.NullL10n=s},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationLayerBuilder=void 0;var n=i(4),s=i(33);t.AnnotationLayerBuilder=class AnnotationLayerBuilder{constructor({pageDiv:e,pdfPage:t,linkService:i,downloadManager:n,annotationStorage:r=null,imageResourcesPath:o="",renderForms:a=!0,l10n:l=s.NullL10n,enableScripting:h=!1,hasJSActionsPromise:d=null,fieldObjectsPromise:c=null,mouseState:u=null,annotationCanvasMap:g=null}){this.pageDiv=e;this.pdfPage=t;this.linkService=i;this.downloadManager=n;this.imageResourcesPath=o;this.renderForms=a;this.l10n=l;this.annotationStorage=r;this.enableScripting=h;this._hasJSActionsPromise=d;this._fieldObjectsPromise=c;this._mouseState=u;this._annotationCanvasMap=g;this.div=null;this._cancelled=!1}async render(e,t="display"){const[i,s=!1,r=null]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled||0===i.length)return;const o={viewport:e.clone({dontFlip:!0}),div:this.div,annotations:i,page:this.pdfPage,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:s,fieldObjects:r,mouseState:this._mouseState,annotationCanvasMap:this._annotationCanvasMap};if(this.div)n.AnnotationLayer.update(o);else{this.div=document.createElement("div");this.div.className="annotationLayer";this.pageDiv.append(this.div);o.div=this.div;n.AnnotationLayer.render(o);this.l10n.translate(this.div)}}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PageFlip=void 0;class Page{constructor(e,t){this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0};this.createdDensity=t;this.nowDrawingDensity=this.createdDensity;this.render=e}setDensity(e){this.createdDensity=e;this.nowDrawingDensity=e}setDrawingDensity(e){this.nowDrawingDensity=e}setPosition(e){this.state.position=e}setAngle(e){this.state.angle=e}setArea(e){this.state.area=e}setHardDrawingAngle(e){this.state.hardDrawingAngle=e}setHardAngle(e){this.state.hardAngle=e;this.state.hardDrawingAngle=e}setOrientation(e){this.orientation=e}getDrawingDensity(){return this.nowDrawingDensity}getDensity(){return this.createdDensity}getHardAngle(){return this.state.hardAngle}}class ImagePage extends Page{constructor(e,t,i){super(e,i);this.image=null;this.isLoad=!1;this.loadingAngle=0;this.image=new Image;this.image.src=t}draw(e){const t=this.render.getContext(),i=this.render.convertToGlobal(this.state.position),n=this.render.getRect().pageWidth,s=this.render.getRect().height;t.save();t.translate(i.x,i.y);t.beginPath();for(let e of this.state.area)if(null!==e){e=this.render.convertToGlobal(e);t.lineTo(e.x-i.x,e.y-i.y)}t.rotate(this.state.angle);t.clip();this.isLoad?t.drawImage(this.image,0,0,n,s):this.drawLoader(t,{x:0,y:0},n,s);t.restore()}simpleDraw(e){const t=this.render.getRect(),i=this.render.getContext(),n=t.pageWidth,s=t.height,r=1===e?t.left+t.pageWidth:t.left,o=t.top;this.isLoad?i.drawImage(this.image,r,o,n,s):this.drawLoader(i,{x:r,y:o},n,s)}drawLoader(e,t,i,n){e.beginPath();e.strokeStyle="rgb(200, 200, 200)";e.fillStyle="rgb(255, 255, 255)";e.lineWidth=1;e.rect(t.x+1,t.y+1,i-1,n-1);e.stroke();e.fill();const s={x:t.x+i/2,y:t.y+n/2};e.beginPath();e.lineWidth=10;e.arc(s.x,s.y,20,this.loadingAngle,3*Math.PI/2+this.loadingAngle);e.stroke();e.closePath();this.loadingAngle+=.07;this.loadingAngle>=2*Math.PI&&(this.loadingAngle=0)}load(){this.isLoad||(this.image.onload=()=>{this.isLoad=!0})}newTemporaryCopy(){return this}getTemporaryCopy(){return this}hideTemporaryCopy(){}}class PageCollection{constructor(e,t){this.pages=[];this.currentPageIndex=0;this.currentSpreadIndex=0;this.landscapeSpread=[];this.portraitSpread=[];this.render=t;this.app=e;this.currentPageIndex=0;this.isShowCover=this.app.getSettings().showCover}destroy(){this.pages=[]}createSpread(){this.landscapeSpread=[];this.portraitSpread=[];for(let e=0;e<this.pages.length;e++)this.portraitSpread.push([e]);let e=0;if(this.isShowCover){this.pages[0].setDensity("hard");this.landscapeSpread.push([e]);e++}for(let t=e;t<this.pages.length;t+=2)if(t<this.pages.length-1)this.landscapeSpread.push([t,t+1]);else{this.landscapeSpread.push([t]);this.pages[t].setDensity("hard")}}getSpread(){return"landscape"===this.render.getOrientation()?this.landscapeSpread:this.portraitSpread}getSpreadIndexByPage(e){const t=this.getSpread();for(let i=0;i<t.length;i++)if(e===t[i][0]||e===t[i][1])return i;return null}getPageCount(){return this.pages.length}getPages(){return this.pages}getPage(e){if(e>=0&&e<this.pages.length)return this.pages[e];throw new Error("Invalid page number")}nextBy(e){const t=this.pages.indexOf(e);return t<this.pages.length-1?this.pages[t+1]:null}prevBy(e){const t=this.pages.indexOf(e);return t>0?this.pages[t-1]:null}getFlippingPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t].newTemporaryCopy():this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length||0===e?this.pages[i[0]]:this.pages[i[1]]}}getBottomPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t+1]:this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length?this.pages[i[0]]:0===e?this.pages[i[1]]:this.pages[i[0]]}}showNext(){if(this.currentSpreadIndex<this.getSpread().length){this.currentSpreadIndex++;this.showSpread()}}showPrev(){if(this.currentSpreadIndex>0){this.currentSpreadIndex--;this.showSpread()}}getCurrentPageIndex(){return this.currentPageIndex}show(e=null){null===e&&(e=this.currentPageIndex);if(e<0||e>=this.pages.length)return;const t=this.getSpreadIndexByPage(e);if(null!==t){this.currentSpreadIndex=t;this.showSpread()}}getCurrentSpreadIndex(){return this.currentSpreadIndex}setCurrentSpreadIndex(e){if(!(e>=0&&e<this.getSpread().length))throw new Error("Invalid page");this.currentSpreadIndex=e}showSpread(){const e=this.getSpread()[this.currentSpreadIndex];if(2===e.length){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(this.pages[e[1]])}else if("landscape"===this.render.getOrientation())if(e[0]===this.pages.length-1){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(null)}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}this.currentPageIndex=e[0];this.app.updatePageIndex(this.currentPageIndex)}}class ImagePageCollection extends PageCollection{constructor(e,t,i){super(e,t);this.imagesHref=i}load(){for(const e of this.imagesHref){const t=new ImagePage(this.render,e,"soft");t.load();this.pages.push(t)}this.createSpread()}}class Helper{static GetDistanceBetweenTwoPoint(e,t){return null===e||null===t?1/0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static GetSegmentLength(e){return Helper.GetDistanceBetweenTwoPoint(e[0],e[1])}static GetAngleBetweenTwoLine(e,t){const i=e[0].y-e[1].y,n=t[0].y-t[1].y,s=e[1].x-e[0].x,r=t[1].x-t[0].x;return Math.acos((i*n+s*r)/(Math.sqrt(i*i+s*s)*Math.sqrt(n*n+r*r)))}static PointInRect(e,t){return null===t?null:t.x>=e.left&&t.x<=e.width+e.left&&t.y>=e.top&&t.y<=e.top+e.height?t:null}static GetRotatedPoint(e,t,i){return{x:e.x*Math.cos(i)+e.y*Math.sin(i)+t.x,y:e.y*Math.cos(i)-e.x*Math.sin(i)+t.y}}static LimitPointToCircle(e,t,i){if(Helper.GetDistanceBetweenTwoPoint(e,i)<=t)return i;const n=e.x,s=e.y,r=i.x,o=i.y;let a=Math.sqrt(Math.pow(t,2)*Math.pow(n-r,2)/(Math.pow(n-r,2)+Math.pow(s-o,2)))+n;i.x<0&&(a*=-1);let l=(a-n)*(s-o)/(n-r)+s;n-r+s===0&&(l=t);return{x:a,y:l}}static GetIntersectBetweenTwoSegment(e,t,i){return Helper.PointInRect(e,Helper.GetIntersectBeetwenTwoLine(t,i))}static GetIntersectBeetwenTwoLine(e,t){const i=e[0].y-e[1].y,n=t[0].y-t[1].y,s=e[1].x-e[0].x,r=t[1].x-t[0].x,o=e[0].x*e[1].y-e[1].x*e[0].y,a=t[0].x*t[1].y-t[1].x*t[0].y,l=i*a-n*o,h=s*a-r*o,d=-(o*r-a*s)/(i*r-n*s),c=-(i*a-n*o)/(i*r-n*s);if(isFinite(d)&&isFinite(c))return{x:d,y:c};if(Math.abs(l-h)<.1)throw new Error("Segment included");return null}static GetCordsFromTwoPoint(e,t){const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y),s=Math.max(i,n),r=[e];function getCord(e,t,i,n,s){return t>e?e+s*(i/n):t<e?e-s*(i/n):e}for(let o=1;o<=s;o+=1)r.push({x:getCord(e.x,t.x,i,s,o),y:getCord(e.y,t.y,n,s,o)});return r}}class HTMLPage extends Page{constructor(e,t,i){super(e,i);this.copiedElement=null;this.temporaryCopy=null;this.isLoad=!1;this.element=t;this.element.classList.add("stf__item");this.element.classList.add("--"+i)}newTemporaryCopy(){if("hard"===this.nowDrawingDensity)return this;if(null===this.temporaryCopy){this.copiedElement=this.element.cloneNode(!0);this.element.parentElement.appendChild(this.copiedElement);this.temporaryCopy=new HTMLPage(this.render,this.copiedElement,this.nowDrawingDensity)}return this.getTemporaryCopy()}getTemporaryCopy(){return this.temporaryCopy}hideTemporaryCopy(){if(null!==this.temporaryCopy){this.copiedElement.remove();this.copiedElement=null;this.temporaryCopy=null}}draw(e){const t=e||this.nowDrawingDensity,i=this.render.convertToGlobal(this.state.position),n=this.render.getRect().pageWidth,s=this.render.getRect().height;this.element.classList.remove("--simple");const r=`\n position: absolute;\n display: block;\n z-index: ${this.element.style.zIndex};\n left: 0;\n top: 0;\n width: ${n}px;\n height: ${s}px;\n `;"hard"===t?this.drawHard(r):this.drawSoft(i,r)}drawHard(e=""){const t=this.render.getRect().left+this.render.getRect().width/2,i=this.state.hardDrawingAngle,n=e+"\n backface-visibility: hidden;\n -webkit-backface-visibility: hidden;\n clip-path: none;\n -webkit-clip-path: none;\n "+(0===this.orientation?`transform-origin: ${this.render.getRect().pageWidth}px 0;\n transform: translate3d(0, 0, 0) rotateY(${i}deg);`:`transform-origin: 0 0;\n transform: translate3d(${t}px, 0, 0) rotateY(${i}deg);`);this.element.style.cssText=n}drawSoft(e,t=""){let i="polygon( ";for(const e of this.state.area)if(null!==e){let t=1===this.render.getDirection()?{x:-e.x+this.state.position.x,y:e.y-this.state.position.y}:{x:e.x-this.state.position.x,y:e.y-this.state.position.y};t=Helper.GetRotatedPoint(t,{x:0,y:0},this.state.angle);i+=t.x+"px "+t.y+"px, "}i=i.slice(0,-2);i+=")";const n=t+`transform-origin: 0 0; clip-path: ${i}; -webkit-clip-path: ${i};`+(this.render.isSafari()&&0===this.state.angle?`transform: translate(${e.x}px, ${e.y}px);`:`transform: translate3d(${e.x}px, ${e.y}px, 0) rotate(${this.state.angle}rad);`);this.element.style.cssText=n}simpleDraw(e){const t=this.render.getRect(),i=t.pageWidth,n=t.height,s=1===e?t.left+t.pageWidth:t.left,r=t.top;this.element.classList.add("--simple");this.element.style.cssText=`\n position: absolute;\n display: block;\n height: ${n}px;\n left: ${s}px;\n top: ${r}px;\n width: ${i}px;\n z-index: ${this.render.getSettings().startZIndex+1};`}getElement(){return this.element}load(){this.isLoad=!0}setOrientation(e){super.setOrientation(e);this.element.classList.remove("--left","--right");this.element.classList.add(1===e?"--right":"--left")}setDrawingDensity(e){this.element.classList.remove("--soft","--hard");this.element.classList.add("--"+e);super.setDrawingDensity(e)}}class HTMLPageCollection extends PageCollection{constructor(e,t,i,n){super(e,t);this.element=i;this.pagesElement=n}load(){for(const e of this.pagesElement){const t=new HTMLPage(this.render,e,"hard"===e.dataset.density?"hard":"soft");t.load();this.pages.push(t)}this.createSpread()}}class FlipCalculation{constructor(e,t,i,n){this.direction=e;this.corner=t;this.topIntersectPoint=null;this.sideIntersectPoint=null;this.bottomIntersectPoint=null;this.pageWidth=parseInt(i,10);this.pageHeight=parseInt(n,10)}calc(e){try{this.position=this.calcAngleAndPosition(e);this.calculateIntersectPoint(this.position);return!0}catch(e){return!1}}getFlippingClipArea(){const e=[];let t=!1;e.push(this.rect.topLeft);e.push(this.topIntersectPoint);if(null===this.sideIntersectPoint)t=!0;else{e.push(this.sideIntersectPoint);null===this.bottomIntersectPoint&&(t=!1)}e.push(this.bottomIntersectPoint);(t||"bottom"===this.corner)&&e.push(this.rect.bottomLeft);return e}getBottomClipArea(){const e=[];e.push(this.topIntersectPoint);if("top"===this.corner)e.push({x:this.pageWidth,y:0});else{null!==this.topIntersectPoint&&e.push({x:this.pageWidth,y:0});e.push({x:this.pageWidth,y:this.pageHeight})}null!==this.sideIntersectPoint?Helper.GetDistanceBetweenTwoPoint(this.sideIntersectPoint,this.topIntersectPoint)>=10&&e.push(this.sideIntersectPoint):"top"===this.corner&&e.push({x:this.pageWidth,y:this.pageHeight});e.push(this.bottomIntersectPoint);e.push(this.topIntersectPoint);return e}getAngle(){return 0===this.direction?-this.angle:this.angle}getRect(){return this.rect}getPosition(){return this.position}getActiveCorner(){return 0===this.direction?this.rect.topLeft:this.rect.topRight}getDirection(){return this.direction}getFlippingProgress(){return Math.abs((this.position.x-this.pageWidth)/(2*this.pageWidth)*100)}getCorner(){return this.corner}getBottomPagePosition(){return 1===this.direction?{x:this.pageWidth,y:0}:{x:0,y:0}}getShadowStartPoint(){return"top"===this.corner?this.topIntersectPoint:null!==this.sideIntersectPoint?this.sideIntersectPoint:this.topIntersectPoint}getShadowAngle(){const e=Helper.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(),[{x:0,y:0},{x:this.pageWidth,y:0}]);return 0===this.direction?e:Math.PI-e}calcAngleAndPosition(e){let t=e;this.updateAngleAndGeometry(t);t="top"===this.corner?this.checkPositionAtCenterLine(t,{x:0,y:0},{x:0,y:this.pageHeight}):this.checkPositionAtCenterLine(t,{x:0,y:this.pageHeight},{x:0,y:0});if(Math.abs(t.x-this.pageWidth)<1&&Math.abs(t.y)<1)throw new Error("Point is too small");return t}updateAngleAndGeometry(e){this.angle=this.calculateAngle(e);this.rect=this.getPageRect(e)}calculateAngle(e){const t=this.pageWidth-e.x+1,i="bottom"===this.corner?this.pageHeight-e.y:e.y;let n=2*Math.acos(t/Math.sqrt(i*i+t*t));i<0&&(n=-n);const s=Math.PI-n;if(!isFinite(n)||s>=0&&s<.003)throw new Error("The G point is too small");"bottom"===this.corner&&(n=-n);return n}getPageRect(e){return"top"===this.corner?this.getRectFromBasePoint([{x:0,y:0},{x:this.pageWidth,y:0},{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}],e):this.getRectFromBasePoint([{x:0,y:-this.pageHeight},{x:this.pageWidth,y:-this.pageHeight},{x:0,y:0},{x:this.pageWidth,y:0}],e)}getRectFromBasePoint(e,t){return{topLeft:this.getRotatedPoint(e[0],t),topRight:this.getRotatedPoint(e[1],t),bottomLeft:this.getRotatedPoint(e[2],t),bottomRight:this.getRotatedPoint(e[3],t)}}getRotatedPoint(e,t){return{x:e.x*Math.cos(this.angle)+e.y*Math.sin(this.angle)+t.x,y:e.y*Math.cos(this.angle)-e.x*Math.sin(this.angle)+t.y}}calculateIntersectPoint(e){const t={left:-1,top:-1,width:this.pageWidth+2,height:this.pageHeight+2};if("top"===this.corner){this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.bottomLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}else{this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.topLeft,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}}checkPositionAtCenterLine(e,t,i){let n=e;const s=Helper.LimitPointToCircle(t,this.pageWidth,n);if(n!==s){n=s;this.updateAngleAndGeometry(n)}const r=Math.sqrt(Math.pow(this.pageWidth,2)+Math.pow(this.pageHeight,2));let o=this.rect.bottomRight,a=this.rect.topLeft;if("bottom"===this.corner){o=this.rect.topRight;a=this.rect.bottomLeft}if(o.x<=0){const e=Helper.LimitPointToCircle(i,r,a);if(e!==n){n=e;this.updateAngleAndGeometry(n)}}return n}getSegmentToShadowLine(){const e=this.getShadowStartPoint();return[e,e!==this.sideIntersectPoint&&null!==this.sideIntersectPoint?this.sideIntersectPoint:this.bottomIntersectPoint]}}class Flip{constructor(e,t){this.flippingPage=null;this.bottomPage=null;this.calc=null;this.state="read";this.render=e;this.app=t}fold(e){this.setState("user_fold");null===this.calc&&this.start(e);this.do(this.render.convertToPage(e))}flip(e){if(this.app.getSettings().disableFlipByClick&&!this.isPointOnCorners(e))return;null!==this.calc&&this.render.finishAnimation();if(!this.start(e))return;const t=this.getBoundsRect();this.setState("flipping");const i=t.height/10,n="bottom"===this.calc.getCorner()?t.height-i:i,s="bottom"===this.calc.getCorner()?t.height:0;this.calc.calc({x:t.pageWidth-i,y:n});this.animateFlippingTo({x:t.pageWidth-i,y:n},{x:-t.pageWidth,y:s},!0)}start(e){this.reset();const t=this.render.convertToBook(e),i=this.getBoundsRect(),n=this.getDirectionByPoint(t),s=t.y>=i.height/2?"bottom":"top";if(!this.checkDirection(n))return!1;try{this.flippingPage=this.app.getPageCollection().getFlippingPage(n);this.bottomPage=this.app.getPageCollection().getBottomPage(n);if("landscape"===this.render.getOrientation())if(1===n){const e=this.app.getPageCollection().nextBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}else{const e=this.app.getPageCollection().prevBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}this.render.setDirection(n);this.calc=new FlipCalculation(n,s,i.pageWidth.toString(10),i.height.toString(10));return!0}catch(e){return!1}}do(e){if(null!==this.calc&&this.calc.calc(e)){const e=this.calc.getFlippingProgress();this.bottomPage.setArea(this.calc.getBottomClipArea());this.bottomPage.setPosition(this.calc.getBottomPagePosition());this.bottomPage.setAngle(0);this.bottomPage.setHardAngle(0);this.flippingPage.setArea(this.calc.getFlippingClipArea());this.flippingPage.setPosition(this.calc.getActiveCorner());this.flippingPage.setAngle(this.calc.getAngle());0===this.calc.getDirection()?this.flippingPage.setHardAngle(90*(200-2*e)/100):this.flippingPage.setHardAngle(-90*(200-2*e)/100);this.render.setPageRect(this.calc.getRect());this.render.setBottomPage(this.bottomPage);this.render.setFlippingPage(this.flippingPage);this.render.setShadowData(this.calc.getShadowStartPoint(),this.calc.getShadowAngle(),e,this.calc.getDirection())}}flipToPage(e,t){const i=this.app.getPageCollection().getCurrentSpreadIndex(),n=this.app.getPageCollection().getSpreadIndexByPage(e);try{if(n>i){this.app.getPageCollection().setCurrentSpreadIndex(n-1);this.flipNext(t)}if(n<i){this.app.getPageCollection().setCurrentSpreadIndex(n+1);this.flipPrev(t)}}catch(e){}}flipNext(e){this.flip({x:this.render.getRect().left+2*this.render.getRect().pageWidth-10,y:"top"===e?1:this.render.getRect().height-2})}flipPrev(e){this.flip({x:10,y:"top"===e?1:this.render.getRect().height-2})}stopMove(){if(null===this.calc)return;const e=this.calc.getPosition(),t=this.getBoundsRect(),i="bottom"===this.calc.getCorner()?t.height:0;e.x<=0?this.animateFlippingTo(e,{x:-t.pageWidth,y:i},!0):this.animateFlippingTo(e,{x:t.pageWidth,y:i},!1)}showCorner(e){if(!this.checkState("read","fold_corner"))return;const t=this.getBoundsRect(),i=t.pageWidth;if(this.isPointOnCorners(e))if(null===this.calc){if(!this.start(e))return;this.setState("fold_corner");this.calc.calc({x:i-1,y:1});const n=50,s="bottom"===this.calc.getCorner()?t.height-1:1,r="bottom"===this.calc.getCorner()?t.height-n:n;this.animateFlippingTo({x:i-1,y:s},{x:i-n,y:r},!1,!1)}else this.do(this.render.convertToPage(e));else{this.setState("read");this.render.finishAnimation();this.stopMove()}}animateFlippingTo(e,t,i,n=!0){const s=Helper.GetCordsFromTwoPoint(e,t),r=[];for(const e of s)r.push((()=>this.do(e)));const o=this.getAnimationDuration(s.length);this.render.startAnimation(r,o,(()=>{if(this.calc){i&&(1===this.calc.getDirection()?this.app.turnToPrevPage():this.app.turnToNextPage());if(n){this.render.setBottomPage(null);this.render.setFlippingPage(null);this.render.clearShadow();this.setState("read");this.reset()}}}))}getCalculation(){return this.calc}getState(){return this.state}setState(e){if(this.state!==e){this.app.updateState(e);this.state=e}}getDirectionByPoint(e){const t=this.getBoundsRect();if("portrait"===this.render.getOrientation()){if(e.x-t.pageWidth<=t.width/5)return 1}else if(e.x<t.width/2)return 1;return 0}getAnimationDuration(e){const t=this.app.getSettings().flippingTime;return e>=1e3?t:e/1e3*t}checkDirection(e){return 0===e?this.app.getCurrentPageIndex()<this.app.getPageCount()-1:this.app.getCurrentPageIndex()>=1}reset(){this.calc=null;this.flippingPage=null;this.bottomPage=null}getBoundsRect(){return this.render.getRect()}checkState(...e){for(const t of e)if(this.state===t)return!0;return!1}isPointOnCorners(e){const t=this.getBoundsRect(),i=t.pageWidth,n=Math.sqrt(Math.pow(i,2)+Math.pow(t.height,2))/5,s=this.render.convertToBook(e);return s.x>0&&s.y>0&&s.x<t.width&&s.y<t.height&&(s.x<n||s.x>t.width-n)&&(s.y<n||s.y>t.height-n)}}class Render{constructor(e,t){this.leftPage=null;this.rightPage=null;this.flippingPage=null;this.bottomPage=null;this.direction=null;this.orientation=null;this.shadow=null;this.animation=null;this.pageRect=null;this.boundsRect=null;this.timer=0;this.safari=!1;this.setting=t;this.app=e;const i=new RegExp("Version\\/[\\d\\.]+.*Safari/");this.safari=null!==i.exec(window.navigator.userAgent)}render(e){if(null!==this.animation){const t=Math.round((e-this.animation.startedAt)/this.animation.durationFrame);if(t<this.animation.frames.length)this.animation.frames[t]();else{this.animation.onAnimateEnd();this.animation=null}}this.timer=e;this.drawFrame()}start(){this.update();const loop=e=>{window.ngxZone.runOutsideAngular((()=>{this.render(e);requestAnimationFrame(loop)}))};window.ngxZone.runOutsideAngular((()=>{requestAnimationFrame(loop)}))}startAnimation(e,t,i){this.finishAnimation();this.animation={frames:e,duration:t,durationFrame:t/e.length,onAnimateEnd:i,startedAt:this.timer}}finishAnimation(){if(null!==this.animation){this.animation.frames[this.animation.frames.length-1]();null!==this.animation.onAnimateEnd&&this.animation.onAnimateEnd()}this.animation=null}update(){this.boundsRect=null;const e=this.calculateBoundsRect();if(this.orientation!==e){this.orientation=e;this.app.updateOrientation(e)}}calculateBoundsRect(){let e="landscape";const t=this.getBlockWidth(),i=t/2,n=this.getBlockHeight()/2,s=this.setting.width/this.setting.height;let r=this.setting.width,o=this.setting.height,a=i-r;if("stretch"===this.setting.size){t<2*this.setting.minWidth&&this.app.getSettings().usePortrait&&(e="portrait");r="portrait"===e?this.getBlockWidth():this.getBlockWidth()/2;r>this.setting.maxWidth&&(r=this.setting.maxWidth);o=r/s;if(o>this.getBlockHeight()){o=this.getBlockHeight();r=o*s}a="portrait"===e?i-r/2-r:i-r}else if(t<2*r&&this.app.getSettings().usePortrait){e="portrait";a=i-r/2-r}this.boundsRect={left:a,top:n-o/2,width:2*r,height:o,pageWidth:r};return e}setShadowData(e,t,i,n){if(!this.app.getSettings().drawShadow)return;const s=100*this.getSettings().maxShadowOpacity;this.shadow={pos:e,angle:t,width:3*this.getRect().pageWidth/4*i/100,opacity:(100-i)*s/100/100,direction:n,progress:2*i}}clearShadow(){this.shadow=null}getBlockWidth(){return this.app.getUI().getDistElement().offsetWidth}getBlockHeight(){return this.app.getUI().getDistElement().offsetHeight}getDirection(){return this.direction}getRect(){null===this.boundsRect&&this.calculateBoundsRect();return this.boundsRect}getSettings(){return this.app.getSettings()}getOrientation(){return this.orientation}setPageRect(e){this.pageRect=e}setDirection(e){this.direction=e}setRightPage(e){null!==e&&e.setOrientation(1);this.rightPage=e}setLeftPage(e){null!==e&&e.setOrientation(0);this.leftPage=e}setBottomPage(e){null!==e&&e.setOrientation(1===this.direction?0:1);this.bottomPage=e}setFlippingPage(e){null!==e&&e.setOrientation(0===this.direction&&"portrait"!==this.orientation?0:1);this.flippingPage=e}convertToBook(e){const t=this.getRect();return{x:e.x-t.left,y:e.y-t.top}}isSafari(){return this.safari}convertToPage(e,t){t||(t=this.direction);const i=this.getRect();return{x:0===t?e.x-i.left-i.width/2:i.width/2-e.x+i.left,y:e.y-i.top}}convertToGlobal(e,t){t||(t=this.direction);if(null==e)return null;const i=this.getRect();return{x:0===t?e.x+i.left+i.width/2:i.width/2-e.x+i.left,y:e.y+i.top}}convertRectToGlobal(e,t){t||(t=this.direction);return{topLeft:this.convertToGlobal(e.topLeft,t),topRight:this.convertToGlobal(e.topRight,t),bottomLeft:this.convertToGlobal(e.bottomLeft,t),bottomRight:this.convertToGlobal(e.bottomRight,t)}}}class CanvasRender extends Render{constructor(e,t,i){super(e,t);this.canvas=i;this.ctx=i.getContext("2d")}getContext(){return this.ctx}reload(){}drawFrame(){this.clear();"portrait"!==this.orientation&&null!=this.leftPage&&this.leftPage.simpleDraw(0);null!=this.rightPage&&this.rightPage.simpleDraw(1);null!=this.bottomPage&&this.bottomPage.draw();this.drawBookShadow();null!=this.flippingPage&&this.flippingPage.draw();if(null!=this.shadow){this.drawOuterShadow();this.drawInnerShadow()}const e=this.getRect();if("portrait"===this.orientation){this.ctx.beginPath();this.ctx.rect(e.left+e.pageWidth,e.top,e.width,e.height);this.ctx.clip()}}drawBookShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();const t=e.width/20;this.ctx.rect(e.left,e.top,e.width,e.height);const i={x:e.left+e.width/2-t/2,y:0};this.ctx.translate(i.x,i.y);const n=this.ctx.createLinearGradient(0,0,t,0);n.addColorStop(0,"rgba(0, 0, 0, 0)");n.addColorStop(.4,"rgba(0, 0, 0, 0.2)");n.addColorStop(.49,"rgba(0, 0, 0, 0.1)");n.addColorStop(.5,"rgba(0, 0, 0, 0.5)");n.addColorStop(.51,"rgba(0, 0, 0, 0.4)");n.addColorStop(1,"rgba(0, 0, 0, 0)");this.ctx.clip();this.ctx.fillStyle=n;this.ctx.fillRect(0,0,t,2*e.height);this.ctx.restore()}drawOuterShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();this.ctx.rect(e.left,e.top,e.width,e.height);const t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y});this.ctx.translate(t.x,t.y);this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);const i=this.ctx.createLinearGradient(0,0,this.shadow.width,0);if(0===this.shadow.direction){this.ctx.translate(0,-100);i.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");i.addColorStop(1,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(-this.shadow.width,-100);i.addColorStop(0,"rgba(0, 0, 0, 0)");i.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")")}this.ctx.clip();this.ctx.fillStyle=i;this.ctx.fillRect(0,0,this.shadow.width,2*e.height);this.ctx.restore()}drawInnerShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();const t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),i=this.convertRectToGlobal(this.pageRect);this.ctx.moveTo(i.topLeft.x,i.topLeft.y);this.ctx.lineTo(i.topRight.x,i.topRight.y);this.ctx.lineTo(i.bottomRight.x,i.bottomRight.y);this.ctx.lineTo(i.bottomLeft.x,i.bottomLeft.y);this.ctx.translate(t.x,t.y);this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);const n=3*this.shadow.width/4,s=this.ctx.createLinearGradient(0,0,n,0);if(0===this.shadow.direction){this.ctx.translate(-n,-100);s.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(.9,"rgba(0, 0, 0, 0.05)");s.addColorStop(.7,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(0,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(0,-100);s.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(.1,"rgba(0, 0, 0, 0.05)");s.addColorStop(.3,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(1,"rgba(0, 0, 0, 0)")}this.ctx.clip();this.ctx.fillStyle=s;this.ctx.fillRect(0,0,n,2*e.height);this.ctx.restore()}clear(){this.ctx.fillStyle="white";this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}}class UI{constructor(e,t,i){this.touchPoint=null;this.swipeTimeout=250;this.onResize=()=>{this.update()};this.onMouseDown=e=>{if(this.checkTarget(e.target)){const t=this.getMousePos(e.clientX,e.clientY);this.app.startUserTouch(t);e.preventDefault()}};this.onTouchStart=e=>{if(this.checkTarget(e.target)&&e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);this.touchPoint={point:i,time:Date.now()};setTimeout((()=>{null!==this.touchPoint&&this.app.startUserTouch(i)}),this.swipeTimeout);this.app.getSettings().mobileScrollSupport||e.preventDefault()}};this.onMouseUp=e=>{const t=this.getMousePos(e.clientX,e.clientY);this.app.userStop(t)};this.onMouseMove=e=>{const t=this.getMousePos(e.clientX,e.clientY);this.app.userMove(t,!1)};this.onTouchMove=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);if(this.app.getSettings().mobileScrollSupport){null!==this.touchPoint&&(Math.abs(this.touchPoint.point.x-i.x)>10||"read"!==this.app.getState())&&e.cancelable&&this.app.userMove(i,!0);"read"!==this.app.getState()&&e.preventDefault()}else this.app.userMove(i,!0)}};this.onTouchEnd=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);let n=!1;if(null!==this.touchPoint){const e=i.x-this.touchPoint.point.x,t=Math.abs(i.y-this.touchPoint.point.y);if(Math.abs(e)>this.swipeDistance&&t<2*this.swipeDistance&&Date.now()-this.touchPoint.time<this.swipeTimeout){e>0?this.app.flipPrev(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom"):this.app.flipNext(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom");n=!0}this.touchPoint=null}this.app.userStop(i,n)}};this.parentElement=e;e.classList.add("stf__parent");e.insertAdjacentHTML("afterbegin",'<div class="stf__wrapper"></div>');this.wrapper=e.querySelector(".stf__wrapper");this.app=t;const n=this.app.getSettings().usePortrait?1:2;e.style.minWidth=i.minWidth*n+"px";e.style.minHeight=i.minHeight+"px";if("fixed"===i.size){e.style.minWidth=i.width*n+"px";e.style.minHeight=i.height+"px"}if(i.autoSize){e.style.width="100%";e.style.maxWidth=2*i.maxWidth+"px"}e.style.display="block";window.addEventListener("resize",this.onResize,!1);this.swipeDistance=i.swipeDistance}destroy(){this.app.getSettings().useMouseEvents&&this.removeHandlers();this.distElement.remove();this.wrapper.remove()}getDistElement(){return this.distElement}getWrapper(){return this.wrapper}setOrientationStyle(e){this.wrapper.classList.remove("--portrait","--landscape");if("portrait"===e){this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/this.app.getSettings().width*100+"%");this.wrapper.classList.add("--portrait")}else{this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/(2*this.app.getSettings().width)*100+"%");this.wrapper.classList.add("--landscape")}this.update()}removeHandlers(){window.removeEventListener("resize",this.onResize);this.distElement.removeEventListener("mousedown",this.onMouseDown);this.distElement.removeEventListener("touchstart",this.onTouchStart);window.removeEventListener("mousemove",this.onMouseMove);window.removeEventListener("touchmove",this.onTouchMove);window.removeEventListener("mouseup",this.onMouseUp);window.removeEventListener("touchend",this.onTouchEnd)}setHandlers(){window.addEventListener("resize",this.onResize,!1);if(this.app.getSettings().useMouseEvents){this.distElement.addEventListener("mousedown",this.onMouseDown);this.distElement.addEventListener("touchstart",this.onTouchStart);window.addEventListener("mousemove",this.onMouseMove);window.addEventListener("touchmove",this.onTouchMove,{passive:!this.app.getSettings().mobileScrollSupport});window.addEventListener("mouseup",this.onMouseUp);window.addEventListener("touchend",this.onTouchEnd)}}getMousePos(e,t){const i=this.distElement.getBoundingClientRect();return{x:e-i.left,y:t-i.top}}checkTarget(e){return!this.app.getSettings().clickEventForward||!["a","button"].includes(e.tagName.toLowerCase())}}class HTMLUI extends UI{constructor(e,t,i,n){super(e,t,i);this.wrapper.insertAdjacentHTML("afterbegin",'<div class="stf__block"></div>');this.distElement=e.querySelector(".stf__block");this.items=n;for(const e of n)this.distElement.appendChild(e);this.setHandlers()}clear(){for(const e of this.items)this.parentElement.appendChild(e)}updateItems(e){this.removeHandlers();this.distElement.innerHTML="";for(const t of e)this.distElement.appendChild(t);this.items=e;this.setHandlers()}update(){this.app.getRender().update()}}class CanvasUI extends UI{constructor(e,t,i){super(e,t,i);this.wrapper.innerHTML='<canvas class="stf__canvas"></canvas>';this.canvas=e.querySelectorAll("canvas")[0];this.distElement=this.canvas;this.resizeCanvas();this.setHandlers()}resizeCanvas(){const e=getComputedStyle(this.canvas),t=parseInt(e.getPropertyValue("width"),10),i=parseInt(e.getPropertyValue("height"),10);this.canvas.width=t;this.canvas.height=i}getCanvas(){return this.canvas}update(){this.resizeCanvas();this.app.getRender().update()}}class HTMLRender extends Render{constructor(e,t,i){super(e,t);this.outerShadow=null;this.innerShadow=null;this.hardShadow=null;this.hardInnerShadow=null;this.element=i;this.createShadows()}createShadows(){this.element.insertAdjacentHTML("beforeend",'<div class="stf__outerShadow"></div>\n <div class="stf__innerShadow"></div>\n <div class="stf__hardShadow"></div>\n <div class="stf__hardInnerShadow"></div>');this.outerShadow=this.element.querySelector(".stf__outerShadow");this.innerShadow=this.element.querySelector(".stf__innerShadow");this.hardShadow=this.element.querySelector(".stf__hardShadow");this.hardInnerShadow=this.element.querySelector(".stf__hardInnerShadow")}clearShadow(){super.clearShadow();this.outerShadow.style.cssText="display: none";this.innerShadow.style.cssText="display: none";this.hardShadow.style.cssText="display: none";this.hardInnerShadow.style.cssText="display: none"}reload(){this.element.querySelector(".stf__outerShadow")||this.createShadows()}drawHardInnerShadow(){const e=this.getRect(),t=this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress;let i=(100-t)*(2.5*e.pageWidth)/100+20;i>e.pageWidth&&(i=e.pageWidth);let n=`\n display: block;\n z-index: ${(this.getSettings().startZIndex+5).toString(10)};\n width: ${i}px;\n height: ${e.height}px;\n background: linear-gradient(to right,\n rgba(0, 0, 0, ${this.shadow.opacity*t/100}) 5%,\n rgba(0, 0, 0, 0) 100%);\n left: ${e.left+e.width/2}px;\n transform-origin: 0 0;\n `;n+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0);":"transform: translate3d(0, 0, 0) rotateY(180deg);";this.hardInnerShadow.style.cssText=n}drawHardOuterShadow(){const e=this.getRect();let t=(100-(this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress))*(2.5*e.pageWidth)/100+20;t>e.pageWidth&&(t=e.pageWidth);let i=`\n display: block;\n z-index: ${(this.getSettings().startZIndex+4).toString(10)};\n width: ${t}px;\n height: ${e.height}px;\n background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);\n left: ${e.left+e.width/2}px;\n transform-origin: 0 0;\n `;i+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0) rotateY(180deg);":"transform: translate3d(0, 0, 0);";this.hardShadow.style.cssText=i}drawInnerShadow(){const e=this.getRect(),t=3*this.shadow.width/4,i=0===this.getDirection()?t:0,n=0===this.getDirection()?"to left":"to right",s=this.convertToGlobal(this.shadow.pos),r=this.shadow.angle+3*Math.PI/2,o=[this.pageRect.topLeft,this.pageRect.topRight,this.pageRect.bottomRight,this.pageRect.bottomLeft];let a="polygon( ";for(const e of o){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:i,y:100},r);a+=t.x+"px "+t.y+"px, "}a=a.slice(0,-2);a+=")";const l=`\n display: block;\n z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n width: ${t}px;\n height: ${2*e.height}px;\n background: linear-gradient(${n},\n rgba(0, 0, 0, ${this.shadow.opacity}) 5%,\n rgba(0, 0, 0, 0.05) 15%,\n rgba(0, 0, 0, ${this.shadow.opacity}) 35%,\n rgba(0, 0, 0, 0) 100%);\n transform-origin: ${i}px 100px;\n transform: translate3d(${s.x-i}px, ${s.y-100}px, 0) rotate(${r}rad);\n clip-path: ${a};\n -webkit-clip-path: ${a};\n `;this.innerShadow.style.cssText=l}drawOuterShadow(){const e=this.getRect(),t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),i=this.shadow.angle+3*Math.PI/2,n=1===this.getDirection()?this.shadow.width:0,s=0===this.getDirection()?"to right":"to left",r=[{x:0,y:0},{x:e.pageWidth,y:0},{x:e.pageWidth,y:e.height},{x:0,y:e.height}];let o="polygon( ";for(const e of r)if(null!==e){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:n,y:100},i);o+=t.x+"px "+t.y+"px, "}o=o.slice(0,-2);o+=")";const a=`\n display: block;\n z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n width: ${this.shadow.width}px;\n height: ${2*e.height}px;\n background: linear-gradient(${s}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));\n transform-origin: ${n}px 100px;\n transform: translate3d(${t.x-n}px, ${t.y-100}px, 0) rotate(${i}rad);\n clip-path: ${o};\n -webkit-clip-path: ${o};\n `;this.outerShadow.style.cssText=a}drawLeftPage(){if("portrait"!==this.orientation&&null!==this.leftPage)if(1===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()<-90){this.leftPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.leftPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.leftPage.draw(this.flippingPage.getDrawingDensity())}else this.leftPage.getElement().style.display="none"}else this.leftPage.simpleDraw(0)}drawRightPage(){if(null!==this.rightPage)if(0===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()>90){this.rightPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.rightPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.rightPage.draw(this.flippingPage.getDrawingDensity())}else this.rightPage.getElement().style.display="none"}else this.rightPage.simpleDraw(1)}drawBottomPage(){if(null===this.bottomPage)return;const e=null!=this.flippingPage?this.flippingPage.getDrawingDensity():null;if("portrait"!==this.orientation||1!==this.direction){this.bottomPage.getElement().style.zIndex=(this.getSettings().startZIndex+3).toString(10);this.bottomPage.draw(e)}}drawFrame(){if(null!==this.flippingPage){if(this.flippingPage.getHardAngle()===this.lastAngle)return;this.lastAngle=this.flippingPage.getHardAngle()}else this.lastAngle=-1234;this.clear();this.drawLeftPage();this.drawRightPage();this.drawBottomPage();if(null!=this.flippingPage){if(this.flippingPage.state.hardDrawingAngle<=90){this.flippingPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.flippingPage.draw()}else this.flippingPage.getElement().style.display="none"}if(null!=this.shadow&&null!==this.flippingPage)if("soft"===this.flippingPage.getDrawingDensity()){this.drawOuterShadow();this.drawInnerShadow()}else{this.drawHardOuterShadow();this.drawHardInnerShadow()}}clear(){for(const e of this.app.getPageCollection().getPages()){if(e!==this.leftPage&&e!==this.rightPage&&e!==this.flippingPage&&e!==this.bottomPage){const t=e.getElement().style;"none"!==t.display&&(t.cssText="display: none")}e.getTemporaryCopy()!==this.flippingPage&&e.hideTemporaryCopy()}}update(){super.update();null!==this.rightPage&&this.rightPage.setOrientation(1);null!==this.leftPage&&this.leftPage.setOrientation(0)}}class Settings{constructor(){this._default={startPage:0,size:"fixed",width:0,height:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,drawShadow:!0,flippingTime:1e3,usePortrait:!0,startZIndex:0,autoSize:!0,maxShadowOpacity:1,showCover:!1,mobileScrollSupport:!0,swipeDistance:30,clickEventForward:!0,useMouseEvents:!0,showPageCorners:!0,disableFlipByClick:!1}}getSettings(e){const t=this._default;Object.assign(t,e);if("stretch"!==t.size&&"fixed"!==t.size)throw new Error('Invalid size type. Available only "fixed" and "stretch" value');if(t.width<=0||t.height<=0)throw new Error("Invalid width or height");if(t.flippingTime<=0)throw new Error("Invalid flipping time");if("stretch"===t.size){t.minWidth<=0&&(t.minWidth=100);t.maxWidth<t.minWidth&&(t.maxWidth=2e3);t.minHeight<=0&&(t.minHeight=100);t.maxHeight<t.minHeight&&(t.maxHeight=2e3)}else{t.minWidth=t.width;t.maxWidth=t.width;t.minHeight=t.height;t.maxHeight=t.height}return t}}!function styleInject(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css";"top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s);s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}(".stf__parent {\n position: relative;\n display: block;\n box-sizing: border-box;\n transform: translateZ(0);\n\n -ms-touch-action: pan-y;\n touch-action: pan-y;\n}\n\n.sft__wrapper {\n position: relative;\n width: 100%;\n box-sizing: border-box;\n}\n\n.stf__parent canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n}\n\n.stf__block {\n position: absolute;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n perspective: 2000px;\n}\n\n.stf__item {\n display: none;\n position: absolute;\n transform-style: preserve-3d;\n}\n\n.stf__outerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__innerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__hardShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__hardInnerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}");t.PageFlip=class PageFlip extends class EventObject{constructor(){this.events=new Map}on(e,t){this.events.has(e)?this.events.get(e).push(t):this.events.set(e,[t]);return this}off(e){this.events.delete(e)}trigger(e,t,i=null){if(this.events.has(e))for(const n of this.events.get(e))n({data:i,object:t})}}{constructor(e,t){super();this.isUserTouch=!1;this.isUserMove=!1;this.setting=null;this.pages=null;this.setting=(new Settings).getSettings(t);this.block=e}destroy(){this.ui.destroy();this.block.remove()}update(){this.render.update();this.pages.show()}loadFromImages(e){this.ui=new CanvasUI(this.block,this,this.setting);const t=this.ui.getCanvas();this.render=new CanvasRender(this,this.setting,t);this.flipController=new Flip(this.render,this);this.pages=new ImagePageCollection(this,this.render,e);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((()=>{this.ui.update();this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})}),1)}loadFromHTML(e){this.ui=new HTMLUI(this.block,this,this.setting,e);this.render=new HTMLRender(this,this.setting,this.ui.getDistElement());this.flipController=new Flip(this.render,this);this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((()=>{this.ui.update();this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})}),1)}updateFromImages(e){const t=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new ImagePageCollection(this,this.render,e);this.pages.load();this.pages.show(t);this.trigger("update",this,{page:t,mode:this.render.getOrientation()})}updateFromHtml(e){const t=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.ui.updateItems(e);this.render.reload();this.pages.show(t);this.trigger("update",this,{page:t,mode:this.render.getOrientation()})}clear(){this.pages.destroy();this.ui.clear()}turnToPrevPage(){this.pages.showPrev()}turnToNextPage(){this.pages.showNext()}turnToPage(e){this.pages.show(e)}flipNext(e="top"){this.flipController.flipNext(e)}flipPrev(e="top"){this.flipController.flipPrev(e)}flip(e,t="top"){this.flipController.flipToPage(e,t)}updateState(e){this.trigger("changeState",this,e)}updatePageIndex(e){this.trigger("flip",this,e)}updateOrientation(e){this.ui.setOrientationStyle(e);this.update();this.trigger("changeOrientation",this,e)}getPageCount(){return this.pages.getPageCount()}getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}getPage(e){return this.pages.getPage(e)}getRender(){return this.render}getFlipController(){return this.flipController}getOrientation(){return this.render.getOrientation()}getBoundsRect(){return this.render.getRect()}getSettings(){return this.setting}getUI(){return this.ui}getState(){return this.flipController.getState()}getPageCollection(){return this.pages}startUserTouch(e){this.mousePosition=e;this.isUserTouch=!0;this.isUserMove=!1}userMove(e,t){if(this.isUserTouch||t||!this.setting.showPageCorners){if(this.isUserTouch&&Helper.GetDistanceBetweenTwoPoint(this.mousePosition,e)>5){this.isUserMove=!0;this.flipController.fold(e)}}else this.flipController.showCorner(e)}userStop(e,t=!1){if(this.isUserTouch){this.isUserTouch=!1;t||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(e))}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPageView=void 0;var n=i(4),s=i(3),r=i(1),o=i(33),a=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i(37)),l=i(38);const h=r.compatibilityParams.maxCanvasPixels||16777216;t.PDFPageView=class PDFPageView{#se=n.AnnotationMode.ENABLE_FORMS;#we={initialOptionalContent:!0,regularAnnotations:!0};constructor(e){const t=e.container,i=e.defaultViewport;this.id=e.id;this.renderingId="page"+this.id;this.pdfPage=null;this.pageLabel=null;this.rotation=0;this.scale=e.scale||s.DEFAULT_SCALE;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=e.optionalContentConfigPromise||null;this.hasRestrictedScaling=!1;this.textLayerMode=e.textLayerMode??s.TextLayerMode.ENABLE;this.#se=e.annotationMode??n.AnnotationMode.ENABLE_FORMS;this.imageResourcesPath=e.imageResourcesPath||"";this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.maxCanvasPixels=e.maxCanvasPixels||h;this.pageColors=e.pageColors||null;this.eventBus=e.eventBus;this.renderingQueue=e.renderingQueue;this.textLayerFactory=e.textLayerFactory;this.annotationLayerFactory=e.annotationLayerFactory;this.annotationEditorLayerFactory=e.annotationEditorLayerFactory;this.xfaLayerFactory=e.xfaLayerFactory;this.textHighlighter=e.textHighlighterFactory?.createTextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus});this.structTreeLayerFactory=e.structTreeLayerFactory;this.renderer=e.renderer||s.RendererType.CANVAS;this.l10n=e.l10n||o.NullL10n;this.paintTask=null;this.paintedViewportMap=new WeakMap;this.renderingState=s.RenderingStates.INITIAL;this.resume=null;this._renderError=null;this._isStandalone=!this.renderingQueue?.hasViewer();this._annotationCanvasMap=null;this.annotationLayer=null;this.annotationEditorLayer=null;this.textLayer=null;this.zoomLayer=null;this.xfaLayer=null;this.structTreeLayer=null;const r=document.createElement("div");r.className="page";r.style.width=Math.floor(this.viewport.width)+"px";r.style.height=Math.floor(this.viewport.height)+"px";r.setAttribute("data-page-number",this.id);r.setAttribute("role","region");this.l10n.get("page_landmark",{page:this.id}).then((e=>{r.setAttribute("aria-label",e)}));this.div=r;t?.append(r);if(this._isStandalone){const{optionalContentConfigPromise:t}=e;t&&t.then((e=>{t===this._optionalContentConfigPromise&&(this.#we.initialOptionalContent=e.hasInitialVisibility)}))}}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t});this.reset()}destroy(){this.reset();this.pdfPage&&this.pdfPage.cleanup()}async _renderAnnotationLayer(){let e=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(t){e=t}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:e})}}async _renderAnnotationEditorLayer(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(t){e=t}finally{this.eventBus.dispatch("annotationeditorlayerrendered",{source:this,pageNumber:this.id,error:e})}}async _renderXfaLayer(){let e=null;try{const t=await this.xfaLayer.render(this.viewport,"display");this.textHighlighter&&this._buildXfaTextContentItems(t.textDivs)}catch(t){e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async _buildXfaTextContentItems(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this.textHighlighter.setTextMapping(e,i);this.textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.paintedViewportMap.delete(t);t.width=0;t.height=0;e&&this.zoomLayer.remove();this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:n=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:i,keepXfaLayer:n});this.renderingState=s.RenderingStates.INITIAL;const r=this.div;r.style.width=Math.floor(this.viewport.width)+"px";r.style.height=Math.floor(this.viewport.height)+"px";const o=r.childNodes,a=e&&this.zoomLayer||null,l=t&&this.annotationLayer?.div||null,h=i&&this.annotationEditorLayer?.div||null,d=n&&this.xfaLayer?.div||null;for(let e=o.length-1;e>=0;e--){const t=o[e];switch(t){case a:case l:case h:case d:continue}t.remove()}r.removeAttribute("data-loaded");l&&this.annotationLayer.hide();h?this.annotationEditorLayer.hide():this.annotationEditorLayer?.destroy();d&&this.xfaLayer.hide();if(!a){if(this.canvas){this.paintedViewportMap.delete(this.canvas);this.canvas.width=0;this.canvas.height=0;delete this.canvas}this._resetZoomLayer()}if(this.svg){this.paintedViewportMap.delete(this.svg);delete this.svg}this.loadingIconDiv=document.createElement("div");this.loadingIconDiv.className="loadingIcon notVisible";this._isStandalone&&this.toggleLoadingIconSpinner(!0);this.loadingIconDiv.setAttribute("role","img");this.l10n.get("loading").then((e=>{this.loadingIconDiv?.setAttribute("aria-label",e)}));r.append(this.loadingIconDiv)}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null}){this.scale=e||this.scale;"number"==typeof t&&(this.rotation=t);if(i instanceof Promise){this._optionalContentConfigPromise=i;i.then((e=>{i===this._optionalContentConfigPromise&&(this.#we.initialOptionalContent=e.hasInitialVisibility)}))}const r=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:r});this._isStandalone&&s.docStyle.setProperty("--scale-factor",this.viewport.scale);if(this.svg){this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}let o=!1;if(this.canvas&&this.maxCanvasPixels>0){const e=this.outputScale;(Math.floor(this.viewport.width)*e.sx|0)*(Math.floor(this.viewport.height)*e.sy|0)>this.maxCanvasPixels&&(o=!0)}if(this.canvas){if(this.useOnlyCssZoom||this.hasRestrictedScaling&&o){this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}if(!this.zoomLayer&&!this.canvas.hidden){this.zoomLayer=this.canvas.parentNode;this.zoomLayer.style.position="absolute"}}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild});this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1}={}){if(this.paintTask){this.paintTask.cancel();this.paintTask=null}this.resume=null;if(this.textLayer){this.textLayer.cancel();this.textLayer=null}if(this.annotationLayer&&(!e||!this.annotationLayer.div)){this.annotationLayer.cancel();this.annotationLayer=null;this._annotationCanvasMap=null}if(this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)){this.annotationEditorLayer.cancel();this.annotationEditorLayer=null}if(this.xfaLayer&&(!i||!this.xfaLayer.div)){this.xfaLayer.cancel();this.xfaLayer=null;this.textHighlighter?.disable()}if(this._onTextLayerRendered){this.eventBus._off("textlayerrendered",this._onTextLayerRendered);this._onTextLayerRendered=null}}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:n=!1}){const s=this.viewport.width,r=this.viewport.height,o=this.div;e.style.width=e.parentNode.style.width=o.style.width=Math.floor(s)+"px";e.style.height=e.parentNode.style.height=o.style.height=Math.floor(r)+"px";const a=this.viewport.rotation-this.paintedViewportMap.get(e).rotation,l=Math.abs(a);let h=1,d=1;if(90===l||270===l){h=r/s;d=s/r}e.style.transform=`rotate(${a}deg) scale(${h}, ${d})`;if(this.textLayer){const e=this.textLayer.viewport,t=this.viewport.rotation-e.rotation,i=Math.abs(t);let n=s/e.width;90!==i&&270!==i||(n=s/e.height);const r=this.textLayer.textLayerDiv;let o,a;switch(i){case 0:o=a=0;break;case 90:o=0;a="-"+r.style.height;break;case 180:o="-"+r.style.width;a="-"+r.style.height;break;case 270:o="-"+r.style.width;a=0;break;default:Window.ngxConsole.error("Bad rotation value.")}r.style.transform=`rotate(${i}deg) scale(${n}) translate(${o}, ${a})`;r.style.transformOrigin="0% 0%"}t&&this.annotationLayer&&this._renderAnnotationLayer();i&&this.annotationEditorLayer&&this._renderAnnotationEditorLayer();n&&this.xfaLayer&&this._renderXfaLayer()}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}toggleLoadingIconSpinner(e=!1){this.loadingIconDiv?.classList.toggle("notVisible",!e)}draw(){if(this.renderingState!==s.RenderingStates.INITIAL){Window.ngxConsole.error("Must be in new state before drawing");this.reset()}const{div:e,pdfPage:t}=this;if(!t){this.renderingState=s.RenderingStates.FINISHED;if(this.loadingIconDiv){this.loadingIconDiv.remove();delete this.loadingIconDiv}return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=s.RenderingStates.RUNNING;const i=document.createElement("div");i.style.width=e.style.width;i.style.height=e.style.height;i.classList.add("canvasWrapper");const r=this.annotationLayer?.div||this.annotationEditorLayer?.div;r?r.before(i):e.append(i);let o=null;if(this.textLayerMode!==s.TextLayerMode.DISABLE&&this.textLayerFactory){const t=document.createElement("div");t.className="textLayer";t.style.width=i.style.width;t.style.height=i.style.height;r?r.before(t):e.append(t);o=this.textLayerFactory.createTextLayerBuilder({textLayerDiv:t,pageIndex:this.id-1,viewport:this.viewport,enhanceTextSelection:this.textLayerMode===s.TextLayerMode.ENABLE_ENHANCE,eventBus:this.eventBus,highlighter:this.textHighlighter})}this.textLayer=o;if(this.#se!==n.AnnotationMode.DISABLE&&this.annotationLayerFactory){this._annotationCanvasMap||=new Map;this.annotationLayer||=this.annotationLayerFactory.createAnnotationLayerBuilder({pageDiv:e,pdfPage:t,imageResourcesPath:this.imageResourcesPath,renderForms:this.#se===n.AnnotationMode.ENABLE_FORMS,l10n:this.l10n,annotationCanvasMap:this._annotationCanvasMap})}this.xfaLayer?.div&&e.append(this.xfaLayer.div);let a=null;this.renderingQueue&&(a=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=s.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=s.RenderingStates.RUNNING;e()}}});const finishPaintTask=async(e=null)=>{l===this.paintTask&&(this.paintTask=null);if(e instanceof n.RenderingCancelledException)this._renderError=null;else{this._renderError=e;this.renderingState=s.RenderingStates.FINISHED;if(this.loadingIconDiv){this.loadingIconDiv.remove();delete this.loadingIconDiv}this._resetZoomLayer(!0);this.#we.regularAnnotations=!l.separateAnnots;this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError});if(e)throw e}},l=this.renderer===s.RendererType.SVG?this.paintOnSvg(i):this.paintOnCanvas(i);l.onRenderContinue=a;this.paintTask=l;const h=l.promise.then((()=>finishPaintTask(null).then((()=>{if(o){const e=t.streamTextContent({includeMarkedContent:!0});o.setTextContentStream(e);o.render()}this.annotationLayer&&this._renderAnnotationLayer().then((()=>{if(this.annotationEditorLayerFactory){this.annotationEditorLayer||=this.annotationEditorLayerFactory.createAnnotationEditorLayerBuilder({pageDiv:e,pdfPage:t,l10n:this.l10n});this._renderAnnotationEditorLayer()}}))}))),(function(e){return finishPaintTask(e)}));if(this.xfaLayerFactory){this.xfaLayer||(this.xfaLayer=this.xfaLayerFactory.createXfaLayerBuilder({pageDiv:e,pdfPage:t}));this._renderXfaLayer()}if(this.structTreeLayerFactory&&this.textLayer&&this.canvas){this._onTextLayerRendered=e=>{if(e.pageNumber===this.id){this.eventBus._off("textlayerrendered",this._onTextLayerRendered);this._onTextLayerRendered=null;this.canvas&&this.pdfPage.getStructTree().then((e=>{if(!e)return;if(!this.canvas)return;const t=this.structTreeLayer.render(e);t.classList.add("structTree");this.canvas.append(t)}))}};this.eventBus._on("textlayerrendered",this._onTextLayerRendered);this.structTreeLayer=this.structTreeLayerFactory.createStructTreeLayerBuilder({pdfPage:t})}e.setAttribute("data-loaded",!0);this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id});return h}paintOnCanvas(e){const t=(0,n.createPromiseCapability)(),i={promise:t.promise,onRenderContinue(e){e()},cancel(){P.cancel()},get separateAnnots(){return P.separateAnnots}},r=this.viewport,o=document.createElement("canvas");o.setAttribute("role","presentation");o.hidden=!0;let h=!0;const showCanvas=function(){if(h){o.hidden=!1;h=!1}};e.append(o);this.canvas=o;const d=o.getContext("2d",{alpha:!1}),c=this.outputScale=new s.OutputScale;if(this.useOnlyCssZoom){const e=r.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});c.sx*=e.width/r.width;c.sy*=e.height/r.height}if(this.maxCanvasPixels>0){const e=r.width*r.height,t=Math.sqrt(this.maxCanvasPixels/e);if(c.sx>t||c.sy>t){c.sx=t;c.sy=t;this.hasRestrictedScaling=!0}else this.hasRestrictedScaling=!1}const u=(0,s.approximateFraction)(c.sx),g=(0,s.approximateFraction)(c.sy),p=(0,s.roundToDivide)(r.width*c.sx,u[0]),f=(0,s.roundToDivide)(r.height*c.sy,g[0]);let m=1;if((p>=4096||f>=4096)&&(this.maxWidth||!a.default.test({width:p,height:f}))){const e=this.determineMaxDimensions();m=Math.max(p/e,f/e);if(m>1){const e=Math.floor(100*this.scale/m)/100;m=this.scale/e;r.width/=m;r.height/=m;(0,l.warn)(`Page ${this.id}: Reduced the maximum zoom to ${e} because the browser can't render larger canvases.`)}else m=1}o.width=(0,s.roundToDivide)(r.width*c.sx,u[0]);o.height=(0,s.roundToDivide)(r.height*c.sy,g[0]);o.style.width=(0,s.roundToDivide)(r.width*m,u[1])+"px";o.style.height=(0,s.roundToDivide)(r.height*m,g[1])+"px";this.paintedViewportMap.set(o,r);const w=c.scaled?[c.sx,0,0,c.sy,0,0]:null;let v=PDFViewerApplicationOptions.get("pdfBackgroundColor");if("function"==typeof v){const e=v({pageNumber:this.id,pageLabel:this.pageLabel});e&&(v=e)}let b=v?PDFViewerApplicationOptions.get("pdfBackgroundColorToReplace"):null;if("function"==typeof b){const e=b({pageNumber:this.id,pageLabel:this.pageLabel});e&&(b=e)}const _={canvasContext:d,transform:w,viewport:this.viewport,annotationMode:this.#se,optionalContentConfigPromise:this._optionalContentConfigPromise,background:v,backgroundColorToReplace:b,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors},P=this.pdfPage.render(_);P.onContinue=function(e){showCanvas();i.onRenderContinue?i.onRenderContinue(e):e()};P.promise.then((function(){showCanvas();t.resolve()}),(function(e){showCanvas();t.reject(e)}));return i}paintOnSvg(e){let t=!1;const ensureNotCancelled=()=>{if(t)throw new n.RenderingCancelledException(`Rendering cancelled, page ${this.id}`,"svg")},i=this.pdfPage,r=this.viewport.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});return{promise:i.getOperatorList({annotationMode:this.#se}).then((t=>{ensureNotCancelled();return new n.SVGGraphics(i.commonObjs,i.objs).getSVG(t,r).then((t=>{ensureNotCancelled();this.svg=t;this.paintedViewportMap.set(t,r);t.style.width=e.style.width;t.style.height=e.style.height;this.renderingState=s.RenderingStates.FINISHED;e.append(t)}))})),onRenderContinue(e){e()},cancel(){t=!0},get separateAnnots(){return!1}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}determineMaxDimensions(){if(this.maxWidth)return this.maxWidth;const e=[4096,8192,10836,11180,11402,14188,16384];for(const t of e)if(!a.default.test({width:t+1,height:t+1})){this.maxWidth=t;return this.maxWidth}return 16384}get thumbnailCanvas(){const{initialOptionalContent:e,regularAnnotations:t}=this.#we;return e&&t?this.canvas:null}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=void 0;function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})));i.push.apply(i,n)}return i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach((function(t){_defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _defineProperty(e,t,i){t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i;return e}function _objectWithoutProperties(e,t){if(null==e)return{};var i,n,s=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var i,n,s={},r=Object.keys(e);for(n=0;n<r.length;n++){i=r[n];t.indexOf(i)>=0||(s[i]=e[i])}return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++){i=r[n];t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}}return s}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var n,s,r=[],o=!0,a=!1;try{for(i=i.call(e);!(o=(n=i.next()).done);o=!0){r.push(n.value);if(t&&r.length===t)break}}catch(e){a=!0;s=e}finally{try{o||null==i.return||i.return()}finally{if(a)throw s}}return r}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);return"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function canvasTest(e){var t,i,n=e.sizes.shift(),s=Math.max(Math.ceil(n[0]),1),r=Math.max(Math.ceil(n[1]),1),o=[s-1,r-1,1,1],a=Date.now(),l="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;if(l){t=new OffscreenCanvas(1,1);i=new OffscreenCanvas(s,r)}else{(t=document.createElement("canvas")).width=1;t.height=1;(i=document.createElement("canvas")).width=s;i.height=r}var h=t.getContext("2d"),d=i.getContext("2d");if(d){d.fillRect.apply(d,o);h.drawImage(i,s-1,r-1,1,1,0,0,1,1)}var c=h&&0!==h.getImageData(0,0,1,1).data[3],u=Date.now()-a;if(l){postMessage({width:s,height:r,benchmark:u,isTestPass:c});!c&&e.sizes.length&&canvasTest(e)}else if(c)e.onSuccess(s,r,u);else{e.onError(s,r,u);e.sizes.length&&canvasTest(e)}return c}var i=[16384,14188,11402,11180,10836,8192,4096,1],n=[8388607,65535,32767,16384,8192,4096,1],s=[4194303,65535,32767,16384,8192,4096,1],r=["onError","onSuccess"],o={max:null,min:1,sizes:[],step:1024,usePromise:!1,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},a={};function createSizesArray(e){var t=e.width===e.height,i=1===e.height,n=1===e.width,s=[];if(e.width&&e.height)for(var r=e.min||o.min,a=e.step||o.step,l=Math.max(e.width,e.height);l>=r;){var h=t||i?l:1,d=t||n?l:1;s.push([h,d]);l-=a}else e.sizes.forEach((function(e){var r=t||i?e:1,o=t||n?e:1;s.push([r,o])}));return s}function handleMethod(e){var t=window&&"HTMLCanvasElement"in window,i=window&&"OffscreenCanvas"in window,n=Date.now(),s=e.onError,o=e.onSuccess,l=_objectWithoutProperties(e,r),h=null;if(!t)return!1;if(e.useWorker&&i){var d="\n var canvasTest = ".concat(canvasTest.toString(),";\n onmessage = function(e) {\n canvasTest(e.data);\n };\n "),c=new Blob([d],{type:"application/javascript"}),u=URL.createObjectURL(c);h=new Worker(u);URL.revokeObjectURL(u);h.onmessage=function(e){var t=e.data,i=t.width,s=t.height,r=t.benchmark;if(t.isTestPass){a[n].onSuccess(i,s,r);delete a[n]}else a[n].onError(i,s,r)}}if(e.usePromise)return new Promise((function(t,i){var r=_objectSpread2(_objectSpread2({},e),{},{onError:function onError(t,n,r){var o;if(0===e.sizes.length)o=!0;else{var a=_slicedToArray(e.sizes.slice(-1),1),l=_slicedToArray(a[0],2),h=l[0],d=l[1];o=t===h&&n===d}s(t,n,r);o&&i({width:t,height:n,benchmark:r})},onSuccess:function onSuccess(e,i,n){o(e,i,n);t({width:e,height:i,benchmark:n})}});if(h){var d=r.onError,c=r.onSuccess;a[n]={onError:d,onSuccess:c};h.postMessage(l)}else canvasTest(r)}));if(!h)return canvasTest(e);a[n]={onError:s,onSuccess:o};h.postMessage(l)}var l={maxArea:function maxArea(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(i)}),n=_objectSpread2(_objectSpread2(_objectSpread2({},o),e),{},{sizes:t});return handleMethod(n)},maxHeight:function maxHeight(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:1,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(n)}),i=_objectSpread2(_objectSpread2(_objectSpread2({},o),e),{},{sizes:t});return handleMethod(i)},maxWidth:function maxWidth(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:1,min:e.min,step:e.step,sizes:_toConsumableArray(s)}),i=_objectSpread2(_objectSpread2(_objectSpread2({},o),e),{},{sizes:t});return handleMethod(i)},test:function test(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=_objectSpread2(_objectSpread2({},o),e);t.sizes=_toConsumableArray(t.sizes);t.width&&t.height&&(t.sizes=[[t.width,t.height]]);return handleMethod(t)}};t.default=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.UNSUPPORTED_FEATURES=t.TextRenderingMode=t.StreamType=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FontType=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0;t.arrayByteLength=arrayByteLength;t.arraysToBytes=function arraysToBytes(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let i=0;for(let n=0;n<t;n++)i+=arrayByteLength(e[n]);let n=0;const s=new Uint8Array(i);for(let i=0;i<t;i++){let t=e[i];t instanceof Uint8Array||(t="string"==typeof t?stringToBytes(t):new Uint8Array(t));const r=t.byteLength;s.set(t,n);n+=r}return s};t.assert=function assert(e,t){e||unreachable(t)};t.bytesToString=function bytesToString(e){"object"==typeof e&&null!==e&&void 0!==e.length||unreachable("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),o=e.subarray(s,r);n.push(String.fromCharCode.apply(null,o))}return n.join("")};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(i,n){e.resolve=function(e){t=!0;i(e)};e.reject=function(e){t=!0;n(e)}}));return e};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=stringToUTF8String(e)}catch(e){}}const n=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(n))return n}catch(e){}return null};t.escapeString=function escapeString(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))};t.getModificationDate=function getModificationDate(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")};t.getVerbosityLevel=function getVerbosityLevel(){return s};t.info=function info(e){s>=n.INFOS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Info: ${e}`):Window&&Window.ngxConsole?Window.ngxConsole.log(`Info: ${e}`):console.log(`Info: ${e}`))};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=function isArrayEqual(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0};t.isAscii=function isAscii(e){return/^[\x00-\x7F]*$/.test(e)};t.objectFromMap=function objectFromMap(e){const t=Object.create(null);for(const[i,n]of e)t[i]=n;return t};t.objectSize=function objectSize(e){return Object.keys(e).length};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(s=e)};t.shadow=shadow;t.string32=function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=stringToBytes;t.stringToPDFString=function stringToPDFString(e){if(e[0]>="ï"){let t;"þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8");if(t)try{const i=new TextDecoder(t,{fatal:!0}),n=stringToBytes(e);return i.decode(n)}catch(e){warn(`stringToPDFString: "${e}".`)}}const t=[];for(let i=0,n=e.length;i<n;i++){const n=a[e.charCodeAt(i)];t.push(n?String.fromCharCode(n):e.charAt(i))}return t.join("")};t.stringToUTF16BEString=function stringToUTF16BEString(e){const t=["þÿ"];for(let i=0,n=e.length;i<n;i++){const n=e.charCodeAt(i);t.push(String.fromCharCode(n>>8&255),String.fromCharCode(255&n))}return t.join("")};t.stringToUTF8String=stringToUTF8String;t.unreachable=unreachable;t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;i(39);t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.LINE_FACTOR=1.35;t.LINE_DESCENT_FACTOR=.35;t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};t.AnnotationEditorPrefix="pdfjs_internal_editor_";t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};t.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};t.AnnotationReplyType={GROUP:"Group",REPLY:"R"};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};t.PageActionEventType={O:"PageOpen",C:"PageClose"};t.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};t.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const n={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=n;t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};t.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let s=n.WARNINGS;function warn(e){s>=n.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Warning: ${e}`):Window&&Window.ngxConsole?Window.ngxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}function shadow(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!1});return i}const r=function BaseExceptionClosure(){function BaseException(e,t){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();t.BaseException=r;t.PasswordException=class PasswordException extends r{constructor(e,t){super(e,"PasswordException");this.code=t}};t.UnknownErrorException=class UnknownErrorException extends r{constructor(e,t){super(e,"UnknownErrorException");this.details=t}};t.InvalidPDFException=class InvalidPDFException extends r{constructor(e){super(e,"InvalidPDFException")}};t.MissingPDFException=class MissingPDFException extends r{constructor(e){super(e,"MissingPDFException")}};t.UnexpectedResponseException=class UnexpectedResponseException extends r{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}};t.FormatError=class FormatError extends r{constructor(e){super(e,"FormatError")}};t.AbortException=class AbortException extends r{constructor(e){super(e,"AbortException")}};function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;++n)i[n]=255&e.charCodeAt(n);return i}function arrayByteLength(e){if(void 0!==e.length)return e.length;if(void 0!==e.byteLength)return e.byteLength;unreachable("Invalid argument for arrayByteLength")}t.FeatureTest=class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}};const o=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${o[e]}${o[t]}${o[i]}`}static scaleMinMax(e,t){let i;if(e[0]){if(e[0]<0){i=t[0];t[0]=t[1];t[1]=i}t[0]*=e[0];t[1]*=e[0];if(e[3]<0){i=t[2];t[2]=t[3];t[3]=i}t[2]*=e[3];t[3]*=e[3]}else{i=t[0];t[0]=t[2];t[2]=i;i=t[1];t[1]=t[3];t[3]=i;if(e[1]<0){i=t[2];t[2]=t[3];t[3]=i}t[2]*=e[1];t[3]*=e[1];if(e[2]<0){i=t[0];t[0]=t[1];t[1]=i}t[0]*=e[2];t[1]*=e[2]}t[0]+=e[4];t[1]+=e[4];t[2]+=e[5];t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=Util.applyTransform(e,t),n=Util.applyTransform(e.slice(2,4),t),s=Util.applyTransform([e[0],e[3]],t),r=Util.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static apply3dTransform(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],o=(i+r)/2,a=Math.sqrt((i+r)**2-4*(i*r-s*n))/2,l=o+a||1,h=o-a||1;return[Math.sqrt(l),Math.sqrt(h)]}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>r?null:[i,s,n,r]}static bezierBoundingBox(e,t,i,n,s,r,o,a){const l=[],h=[[],[]];let d,c,u,g,p,f,m,w;for(let h=0;h<2;++h){if(0===h){c=6*e-12*i+6*s;d=-3*e+9*i-9*s+3*o;u=3*i-3*e}else{c=6*t-12*n+6*r;d=-3*t+9*n-9*r+3*a;u=3*n-3*t}if(Math.abs(d)<1e-12){if(Math.abs(c)<1e-12)continue;g=-u/c;0<g&&g<1&&l.push(g)}else{m=c*c-4*u*d;w=Math.sqrt(m);if(!(m<0)){p=(-c+w)/(2*d);0<p&&p<1&&l.push(p);f=(-c-w)/(2*d);0<f&&f<1&&l.push(f)}}}let v,b=l.length;const _=b;for(;b--;){g=l[b];v=1-g;h[0][b]=v*v*v*e+3*v*v*g*i+3*v*g*g*s+g*g*g*o;h[1][b]=v*v*v*t+3*v*v*g*n+3*v*g*g*r+g*g*g*a}h[0][_]=e;h[1][_]=t;h[0][_+1]=o;h[1][_+1]=a;h[0].length=h[1].length=_+2;return[Math.min(...h[0]),Math.min(...h[1]),Math.max(...h[0]),Math.max(...h[1])]}}t.Util=Util;const a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToUTF8String(e){return decodeURIComponent(escape(e))}},()=>{},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.StructTreeLayerBuilder=void 0;const i={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},n=/^H(\d+)$/;t.StructTreeLayerBuilder=class StructTreeLayerBuilder{constructor({pdfPage:e}){this.pdfPage=e}render(e){return this._walk(e)}_setAttributes(e,t){void 0!==e.alt&&t.setAttribute("aria-label",e.alt);void 0!==e.id&&t.setAttribute("aria-owns",e.id);void 0!==e.lang&&t.setAttribute("lang",e.lang)}_walk(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:s}=e,r=s.match(n);if(r){t.setAttribute("role","heading");t.setAttribute("aria-level",r[1])}else i[s]&&t.setAttribute("role",i[s])}this._setAttributes(e,t);if(e.children)if(1===e.children.length&&"id"in e.children[0])this._setAttributes(e.children[0],t);else for(const i of e.children)t.append(this._walk(i));return t}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TextHighlighter=void 0;t.TextHighlighter=class TextHighlighter{constructor({findController:e,eventBus:t,pageIndex:i}){this.findController=e;this.matches=[];this.eventBus=t;this.pageIdx=i;this._onUpdateTextLayerMatches=null;this.textDivs=null;this.textContentItemsStr=null;this.enabled=!1}setTextMapping(e,t){this.textDivs=e;this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0;if(!this._onUpdateTextLayerMatches){this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()};this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)}this._updateMatches()}disable(){if(this.enabled){this.enabled=!1;if(this._onUpdateTextLayerMatches){this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches);this._onUpdateTextLayerMatches=null}}}_convertMatches(e,t,i){if(!e)return[];const{textContentItemsStr:n}=this;let s=0,r=0;const o=n.length-1,a=[];for(let l=0,h=e.length;l<h;l++){let h=e[l];for(;s!==o&&h>=r+n[s].length;){r+=n[s].length;s++}s===n.length&&Window.ngxConsole.error("Could not find a matching mapping");const d={color:i?i[l]:0,begin:{divIdx:s,offset:h-r}};h+=t[l];for(;s!==o&&h>r+n[s].length;){r+=n[s].length;s++}d.end={divIdx:s,offset:h-r};a.push(d)}return a}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,r=i===t.selected.pageIdx,o=t.selected.matchIdx;let a=null;const l={divIdx:-1,offset:void 0};function beginText(e,t){const i=e.divIdx;s[i].textContent="";return appendTextToDiv(i,0,e.offset,t)}function appendTextToDiv(e,t,i,r){let o=s[e];if(o.nodeType===Node.TEXT_NODE){const t=document.createElement("span");o.before(t);t.append(o);s[e]=t;o=t}const a=n[e].substring(t,i),l=document.createTextNode(a);if(r){const e=document.createElement("span");e.className=`${r} appended`;e.append(l);o.append(e);return r.includes("selected")?e.offsetLeft:0}o.append(l);return 0}let h=o,d=h+1;if(t.state.highlightAll){h=0;d=e.length}else if(!r)return;for(let n=h;n<d;n++){const h=e[n],d=h.begin,c=h.end,u=r&&n===o,g=(u?" selected":"")+" color"+h.color;let p=0;if(a&&d.divIdx===a.divIdx)appendTextToDiv(a.divIdx,a.offset,d.offset);else{null!==a&&appendTextToDiv(a.divIdx,a.offset,l.offset);beginText(d)}if(d.divIdx===c.divIdx)p=appendTextToDiv(d.divIdx,d.offset,c.offset,"highlight"+g);else{p=appendTextToDiv(d.divIdx,d.offset,l.offset,"highlight begin"+g);for(let e=d.divIdx+1,t=c.divIdx;e<t;e++)s[e].className="highlight middle"+g;beginText(c,"highlight end"+g)}a=c;u&&t.scrollMatchIntoView({element:s[d.divIdx],selectedLeft:p,pageIndex:i,matchIndex:o})}a&&appendTextToDiv(a.divIdx,a.offset,l.offset)}_updateMatches(){if(!this.enabled)return;const{findController:e,matches:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this;let r=-1;for(let e=0,i=t.length;e<i;e++){const i=t[e];for(let e=Math.max(r,i.begin.divIdx),t=i.end.divIdx;e<=t;e++){const t=s[e];t.textContent=n[e];t.className=""}r=i.end.divIdx+1}if(!e?.highlightMatches)return;const o=e.pageMatches[i]||null,a=e.pageMatchesLength[i]||null,l=e.pageMatchesColor[i]||null;this.matches=this._convertMatches(o,a,l);this._renderMatches(this.matches)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TextLayerBuilder=void 0;var n=i(4);t.TextLayerBuilder=class TextLayerBuilder{constructor({textLayerDiv:e,eventBus:t,pageIndex:i,viewport:n,highlighter:s=null,enhanceTextSelection:r=!1}){this.textLayerDiv=e;this.eventBus=t;this.textContent=null;this.textContentItemsStr=[];this.textContentStream=null;this.renderingDone=!1;this.pageNumber=i+1;this.viewport=n;this.textDivs=[];this.textLayerRenderTask=null;this.highlighter=s;this.enhanceTextSelection=r;this._bindMouse()}_finishRendering(){this.renderingDone=!0;if(!this.enhanceTextSelection){const e=document.createElement("div");e.className="endOfContent";this.textLayerDiv.append(e)}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.pageNumber,numTextDivs:this.textDivs.length})}render(e=0){if(!this.textContent&&!this.textContentStream||this.renderingDone)return;this.cancel();this.textDivs.length=0;this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr);const t=document.createDocumentFragment();this.textLayerRenderTask=(0,n.renderTextLayer)({textContent:this.textContent,textContentStream:this.textContentStream,container:t,viewport:this.viewport,textDivs:this.textDivs,textContentItemsStr:this.textContentItemsStr,timeout:e,enhanceTextSelection:this.enhanceTextSelection});this.textLayerRenderTask.promise.then((()=>{this.textLayerDiv.append(t);this._finishRendering();this.highlighter?.enable()}),(function(e){}))}cancel(){if(this.textLayerRenderTask){this.textLayerRenderTask.cancel();this.textLayerRenderTask=null}this.highlighter?.disable()}setTextContentStream(e){this.cancel();this.textContentStream=e}setTextContent(e){this.cancel();this.textContent=e}_bindMouse(){const e=this.textLayerDiv;let t=null;e.addEventListener("mousedown",(i=>{if(this.enhanceTextSelection&&this.textLayerRenderTask){this.textLayerRenderTask.expandTextDivs(!0);if(t){clearTimeout(t);t=null}return}const n=e.querySelector(".endOfContent");if(!n)return;let s=i.target!==e;s=s&&"none"!==window.getComputedStyle(n).getPropertyValue("-moz-user-select");if(s){const t=e.getBoundingClientRect(),s=Math.max(0,(i.pageY-t.top)/t.height);n.style.top=(100*s).toFixed(2)+"%"}n.classList.add("active")}));e.addEventListener("mouseup",(()=>{if(this.enhanceTextSelection&&this.textLayerRenderTask){t=setTimeout((()=>{this.textLayerRenderTask&&this.textLayerRenderTask.expandTextDivs(!1);t=null}),300);return}const i=e.querySelector(".endOfContent");if(i){i.style.top="";i.classList.remove("active")}}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.XfaLayerBuilder=void 0;var n=i(4);t.XfaLayerBuilder=class XfaLayerBuilder{constructor({pageDiv:e,pdfPage:t,annotationStorage:i=null,linkService:n,xfaHtml:s=null}){this.pageDiv=e;this.pdfPage=t;this.annotationStorage=i;this.linkService=n;this.xfaHtml=s;this.div=null;this._cancelled=!1}render(e,t="display"){if("print"===t){const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t},s=document.createElement("div");this.pageDiv.append(s);i.div=s;const r=n.XfaLayer.render(i);return Promise.resolve(r)}return this.pdfPage.getXfa().then((i=>{if(this._cancelled||!i)return{textDivs:[]};const s={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};if(this.div)return n.XfaLayer.update(s);this.div=document.createElement("div");this.pageDiv.append(this.div);s.div=this.div;return n.XfaLayer.render(s)})).catch((e=>{Window.ngxConsole.error(e)}))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SecondaryToolbar=void 0;var n=i(3),s=i(6),r=i(31);t.SecondaryToolbar=class SecondaryToolbar{constructor(e,t){this.toolbar=e.toolbar;this.toggleButton=e.toggleButton;this.buttons=[{element:e.presentationModeButton,eventName:"presentationmode",close:!0},{element:e.printButton,eventName:"print",close:!0},{element:e.downloadButton,eventName:"download",close:!0},{element:e.viewBookmarkButton,eventName:null,close:!0},{element:e.firstPageButton,eventName:"firstpage",close:!0},{element:e.lastPageButton,eventName:"lastpage",close:!0},{element:e.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:e.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:e.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:s.CursorTool.SELECT},close:!0},{element:e.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:s.CursorTool.HAND},close:!0},{element:e.scrollPageButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.PAGE},close:!0},{element:e.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.VERTICAL},close:!0},{element:e.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.HORIZONTAL},close:!0},{element:e.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.WRAPPED},close:!0},{element:e.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.NONE},close:!0},{element:e.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.ODD},close:!0},{element:e.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.EVEN},close:!0},{element:e.documentPropertiesButton,eventName:"documentproperties",close:!0}];this.buttons.push({element:e.openFileButton,eventName:"openfile",close:!0});this.items={firstPage:e.firstPageButton,lastPage:e.lastPageButton,pageRotateCw:e.pageRotateCwButton,pageRotateCcw:e.pageRotateCcwButton};this.eventBus=t;this.opened=!1;this.reset();this.#ve();this.#be(e);this.#_e(e);this.#Pe(e)}get isOpen(){return this.opened}setPageNumber(e){this.pageNumber=e;this.#ye()}setPagesCount(e){this.pagesCount=e;this.#ye()}reset(){this.pageNumber=0;this.pagesCount=0;this.#ye();this.eventBus.dispatch("secondarytoolbarreset",{source:this})}#ye(){this.items.firstPage.disabled=this.pageNumber<=1;document.getElementById("previousPage")&&(document.getElementById("previousPage").disabled=this.pageNumber<=1);this.items.lastPage.disabled=this.pageNumber>=this.pagesCount;document.getElementById("nextPage")&&(document.getElementById("nextPage").disabled=this.pageNumber>=this.pagesCount);this.items.pageRotateCw.disabled=0===this.pagesCount;this.items.pageRotateCcw.disabled=0===this.pagesCount;this.eventBus.dispatch("updateuistate",{source:this,widget:"SecondaryToolbar",pageNumber:this.pageNumber,pagesCount:this.pagesCount})}#ve(){this.toggleButton.addEventListener("click",this.toggle.bind(this));for(const{element:e,eventName:t,close:i,eventDetails:n}of this.buttons)e.addEventListener("click",(e=>{if(null!==t){const e={source:this};for(const t in n)e[t]=n[t];this.eventBus.dispatch(t,e)}i&&this.close()}))}#be({cursorSelectToolButton:e,cursorHandToolButton:t}){this.eventBus._on("cursortoolchanged",(function({tool:i}){const n=i===s.CursorTool.SELECT,r=i===s.CursorTool.HAND;e.classList.toggle("toggled",n);t.classList.toggle("toggled",r);e.setAttribute("aria-checked",n);t.setAttribute("aria-checked",r)}))}#_e({scrollPageButton:e,scrollVerticalButton:t,scrollHorizontalButton:i,scrollWrappedButton:s,spreadNoneButton:o,spreadOddButton:a,spreadEvenButton:l}){const scrollModeChanged=({mode:h})=>{const d=h===n.ScrollMode.PAGE,c=h===n.ScrollMode.VERTICAL,u=h===n.ScrollMode.HORIZONTAL,g=h===n.ScrollMode.WRAPPED;e.classList.toggle("toggled",d);t.classList.toggle("toggled",c);i.classList.toggle("toggled",u);s.classList.toggle("toggled",g);e.setAttribute("aria-checked",d);t.setAttribute("aria-checked",c);i.setAttribute("aria-checked",u);s.setAttribute("aria-checked",g);const p=this.pagesCount>r.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;e.disabled=p;t.disabled=p;i.disabled=p;s.disabled=p;o.disabled=u;a.disabled=u;l.disabled=u};this.eventBus._on("scrollmodechanged",scrollModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&scrollModeChanged({mode:n.ScrollMode.VERTICAL})}))}#Pe({spreadNoneButton:e,spreadOddButton:t,spreadEvenButton:i}){function spreadModeChanged({mode:s}){const r=s===n.SpreadMode.NONE,o=s===n.SpreadMode.ODD,a=s===n.SpreadMode.EVEN;e.classList.toggle("toggled",r);t.classList.toggle("toggled",o);i.classList.toggle("toggled",a);e.setAttribute("aria-checked",r);t.setAttribute("aria-checked",o);i.setAttribute("aria-checked",a)}this.eventBus._on("spreadmodechanged",spreadModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&spreadModeChanged({mode:n.SpreadMode.NONE})}))}open(){if(!this.opened){this.opened=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.toolbar.classList.remove("hidden")}}close(){if(this.opened){this.opened=!1;this.toolbar.classList.add("hidden");this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false")}}toggle(){this.opened?this.close():this.open()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Toolbar=void 0;var n=i(3),s=i(4);t.Toolbar=class Toolbar{constructor(e,t,i){this.toolbar=e.container;this.eventBus=t;this.l10n=i;this.buttons=[{element:e.previous,eventName:"previouspage"},{element:e.next,eventName:"nextpage"},{element:e.zoomIn,eventName:"zoomin"},{element:e.zoomOut,eventName:"zoomout"},{element:e.print,eventName:"print"},{element:e.presentationModeButton,eventName:"presentationmode"},{element:e.download,eventName:"download"},{element:e.viewBookmark,eventName:null},{element:e.editorNoneButton,eventName:"switchannotationeditormode",eventDetails:{mode:s.AnnotationEditorType.NONE}},{element:e.editorFreeTextButton,eventName:"switchannotationeditormode",eventDetails:{mode:s.AnnotationEditorType.FREETEXT}},{element:e.editorInkButton,eventName:"switchannotationeditormode",eventDetails:{mode:s.AnnotationEditorType.INK}}];this.buttons.push({element:e.openFile,eventName:"openfile"});this.items={numPages:e.numPages,pageNumber:e.pageNumber,scaleSelect:e.scaleSelect,customScaleOption:e.customScaleOption,previous:e.previous,next:e.next,zoomIn:e.zoomIn,zoomOut:e.zoomOut,editorNoneButton:e.editorNoneButton,editorFreeTextButton:e.editorFreeTextButton,editorFreeTextParamsToolbar:e.editorFreeTextParamsToolbar,editorInkButton:e.editorInkButton,editorInkParamsToolbar:e.editorInkParamsToolbar};this._wasLocalized=!1;this.reset();this._bindListeners(e)}setPageNumber(e,t){this.pageNumber=e;this.pageLabel=t;this._updateUIState(!1)}setPagesCount(e,t){this.pagesCount=e;this.hasPageLabels=t;this._updateUIState(!0)}setPageScale(e,t){this.pageScaleValue=(e||t).toString();this.pageScale=t;this._updateUIState(!1)}reset(){this.pageNumber=0;this.pageLabel=null;this.hasPageLabels=!1;this.pagesCount=0;const e=PDFViewerApplicationOptions.get("defaultZoomValue");if(e){this.pageScaleValue=e;Number(e)&&(this.pageScale=Number(e))}else{this.pageScaleValue=n.DEFAULT_SCALE_VALUE;this.pageScale=n.DEFAULT_SCALE}this._updateUIState(!0);this.updateLoadingIndicatorState();this.eventBus.dispatch("toolbarreset",{source:this})}_bindListeners(e){const{pageNumber:t,scaleSelect:i}=this.items,s=this;for(const{element:e,eventName:t,eventDetails:i}of this.buttons)e.addEventListener("click",(e=>{if(null!==t){const e={source:this};if(i)for(const t in i)e[t]=i[t];this.eventBus.dispatch(t,e)}}));t.addEventListener("click",(function(){this.select()}));t.addEventListener("change",(function(){s.eventBus.dispatch("pagenumberchanged",{source:s,value:this.value})}));i.addEventListener("change",(function(){"custom"!==this.value&&s.eventBus.dispatch("scalechanged",{source:s,value:this.value})}));i.addEventListener("click",(function(e){const t=e.target;this.value===s.pageScaleValue&&"OPTION"===t.tagName.toUpperCase()&&this.blur()}));i.oncontextmenu=n.noContextMenuHandler;this.eventBus._on("localized",(()=>{this._wasLocalized=!0;this.#Se();this._updateUIState(!0)}));this.#Ee(e)}#Ee({editorNoneButton:e,editorFreeTextButton:t,editorFreeTextParamsToolbar:i,editorInkButton:n,editorInkParamsToolbar:r}){const editorModeChanged=(o,a=!1)=>{const l=[{mode:s.AnnotationEditorType.NONE,button:e},{mode:s.AnnotationEditorType.FREETEXT,button:t,toolbar:i},{mode:s.AnnotationEditorType.INK,button:n,toolbar:r}];for(const{mode:e,button:t,toolbar:i}of l){const n=e===o.mode;t.classList.toggle("toggled",n);t.setAttribute("aria-checked",n);t.disabled=a;i&&i.classList.toggle("hidden",!n)}};this.eventBus._on("annotationeditormodechanged",editorModeChanged);this.eventBus._on("toolbarreset",(e=>{e.source===this&&editorModeChanged({mode:s.AnnotationEditorType.NONE},!0)}))}_updateUIState(e=!1){if(!this._wasLocalized)return;const{pageNumber:t,pagesCount:i,pageScaleValue:s,pageScale:r,items:o}=this;if(e){if(this.hasPageLabels)o.pageNumber.type="text";else{o.pageNumber.type="number";this.l10n.get("of_pages",{pagesCount:i}).then((e=>{o.numPages.textContent=e}))}o.pageNumber.max=i}if(this.hasPageLabels){o.pageNumber.value=this.pageLabel;this.l10n.get("page_of_pages",{pageNumber:t,pagesCount:i}).then((e=>{o.numPages.textContent=e}))}else o.pageNumber.value=t;o.previous.disabled=t<=1;o.next.disabled=t>=i;o.zoomOut.disabled=r<=n.MIN_SCALE;o.zoomIn.disabled=r>=n.MAX_SCALE;this.l10n.get("page_scale_percent",{scale:Math.round(1e4*r)/100}).then((e=>{let t=!1;if(o.scaleSelect.options)for(const e of o.scaleSelect.options)if(e.value===s){e.selected=!0;t=!0}else e.selected=!1;if(!t){o.customScaleOption.textContent=e;o.customScaleOption.selected=!0}}));this.eventBus.dispatch("updateuistate",{source:this,widget:"Toolbar",pageNumber:t,pagesCount:i,pageScaleValue:s,pageScale:r})}updateLoadingIndicatorState(e=!1){const{pageNumber:t}=this.items;t.classList.toggle("visiblePageIsLoading",e)}async#Se(){const{items:e,l10n:t}=this,i=Promise.all([t.get("page_scale_auto"),t.get("page_scale_actual"),t.get("page_scale_fit"),t.get("page_scale_width")]);await n.animationStarted;const s=getComputedStyle(e.scaleSelect),r=parseInt(s.getPropertyValue("--scale-select-container-width"),10),o=parseInt(s.getPropertyValue("--scale-select-overflow"),10),a=document.createElement("canvas"),l=a.getContext("2d",{alpha:!1});l.font=`${s.fontSize} ${s.fontFamily}`;let h=0;for(const e of await i)try{const{width:t}=l.measureText(e);t>h&&(h=t)}catch(e){}h+=2*o;h>r&&n.docStyle.setProperty("--scale-select-container-width",`${h}px`);a.width=0;a.height=0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ViewHistory=void 0;var n=i(1);t.ViewHistory=class ViewHistory{constructor(e,t=20){this.fingerprint=e;this.cacheSize=t;this._initializedPromise=this._readFromStorage().then((e=>{const t=JSON.parse(e||"{}");let i=-1;if(Array.isArray(t.files)){for(;t.files.length>=this.cacheSize;)t.files.shift();for(let e=0,n=t.files.length;e<n;e++){if(t.files[e].fingerprint===this.fingerprint){i=e;break}}}else t.files=[];-1===i&&(i=t.files.push({fingerprint:this.fingerprint})-1);this.file=t.files[i];this.database=t}))}async _writeToStorage(){if(n.AppOptions.get("disableHistory"))return;const e=JSON.stringify(this.database);try{localStorage.setItem("pdfjs.history",e)}catch(e){}}async _readFromStorage(){if(!n.AppOptions.get("disableHistory"))try{return localStorage.getItem("pdfjs.history")}catch(e){return}}async set(e,t){await this._initializedPromise;this.file[e]=t;return this._writeToStorage()}async setMultiple(e){await this._initializedPromise;for(const t in e)this.file[t]=e[t];return this._writeToStorage()}async get(e,t){await this._initializedPromise;const i=this.file[e];return void 0!==i?i:t}async getMultiple(e){await this._initializedPromise;const t=Object.create(null);for(const i in e){const n=this.file[i];t[i]=void 0!==n?n:e[i]}return t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericCom=void 0;var n=i(2),s=i(48),r=i(49),o=i(50),a=i(52);t.GenericCom={};class GenericPreferences extends s.BasePreferences{async _writeToStorage(e){try{localStorage.setItem("pdfjs.preferences",JSON.stringify(e))}catch(e){}}async _readFromStorage(e){try{return JSON.parse(localStorage.getItem("pdfjs.preferences"))}catch(e){return{}}}}class GenericExternalServices extends n.DefaultExternalServices{static createDownloadManager(e){return new r.DownloadManager}static createPreferences(){return new GenericPreferences}static createL10n({locale:e="en-US"}){return new o.GenericL10n(e)}static createScripting({sandboxBundleSrc:e}){return new a.GenericScripting(e)}}n.PDFViewerApplication.externalServices=GenericExternalServices},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BasePreferences=void 0;i(1);class BasePreferences{#Ce=Object.freeze({annotationEditorMode:-1,annotationMode:2,cursorToolOnLoad:0,defaultZoomValue:"",disablePageLabels:!1,enablePermissions:!1,enablePrintAutoRotate:!0,enableScripting:!0,externalLinkTarget:0,historyUpdateUrl:!1,ignoreDestinationZoom:!1,forcePageColors:!1,pageColorsBackground:"Canvas",pageColorsForeground:"CanvasText",pdfBugEnabled:!1,removePageBorders:!1,sidebarViewOnLoad:-1,scrollModeOnLoad:-1,spreadModeOnLoad:-1,textLayerMode:1,useOnlyCssZoom:!1,viewerCssTheme:0,viewOnLoad:0,disableAutoFetch:!1,disableFontFace:!1,disableRange:!1,disableStream:!1,enableXfa:!0,renderer:"canvas"});#Te=Object.create(null);#xe=null;constructor(){if(this.constructor===BasePreferences)throw new Error("Cannot initialize BasePreferences.");this.#xe=this._readFromStorage(this.#Ce).then((e=>{for(const t in this.#Ce){const i=e?.[t];typeof i==typeof this.#Ce[t]&&(this.#Te[t]=i)}}))}async _writeToStorage(e){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(e){throw new Error("Not implemented: _readFromStorage")}async reset(){await this.#xe;const e=this.#Te;this.#Te=Object.create(null);return this._writeToStorage(this.#Ce).catch((t=>{this.#Te=e;throw t}))}async set(e,t){await this.#xe;const i=this.#Ce[e],n=this.#Te;if(void 0===i)throw new Error(`Set preference: "${e}" is undefined.`);if(void 0===t)throw new Error("Set preference: no value is specified.");const s=typeof t,r=typeof i;if(s!==r){if("number"!==s||"string"!==r)throw new Error(`Set preference: "${t}" is a ${s}, expected a ${r}.`);t=t.toString()}else if("number"===s&&!Number.isInteger(t))throw new Error(`Set preference: "${t}" must be an integer.`);this.#Te[e]=t;return this._writeToStorage(this.#Te).catch((e=>{this.#Te=n;throw e}))}async get(e){await this.#xe;const t=this.#Ce[e];if(void 0===t)throw new Error(`Get preference: "${e}" is undefined.`);return this.#Te[e]??t}async getAll(){await this.#xe;const e=Object.create(null);for(const t in this.#Ce)e[t]=this.#Te[t]??this.#Ce[t];return e}}t.BasePreferences=BasePreferences},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.DownloadManager=void 0;var n=i(4);function download(e,t){const i=document.createElement("a");if(!i.click)throw new Error('DownloadManager: "a.click()" is not supported.');i.href=e;i.target="_parent";"download"in i&&(i.download=t);(document.body||document.documentElement).append(i);i.click();i.remove()}t.DownloadManager=class DownloadManager{constructor(){this._openBlobUrls=new WeakMap}downloadUrl(e,t){(0,n.createValidAbsoluteUrl)(e,"http://example.com")?download(e+"#pdfjs.action=download",t):Window.ngxConsole.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,i){download(URL.createObjectURL(new Blob([e],{type:i})),t)}openOrDownloadData(e,t,i){const s=(0,n.isPdfFile)(i),r=s?"application/pdf":"";if(s){let n,s=this._openBlobUrls.get(e);if(!s){s=URL.createObjectURL(new Blob([t],{type:r}));this._openBlobUrls.set(e,s)}n="?file="+encodeURIComponent(s+"#"+i);try{window.open(n);return!0}catch(t){Window.ngxConsole.error(`openOrDownloadData: ${t}`);URL.revokeObjectURL(s);this._openBlobUrls.delete(e)}}this.downloadData(t,i,r);return!1}download(e,t,i){download(URL.createObjectURL(e),i)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericL10n=void 0;i(51);var n=i(33);const s=document.webL10n;t.GenericL10n=class GenericL10n{constructor(e){this._lang=e;this._ready=new Promise(((t,i)=>{s.setLanguage((0,n.fixupLangCode)(e),(()=>{t(s)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e,t=null,i=(0,n.getL10nFallback)(e,t)){return(await this._ready).get(e,t,i)}async translate(e){return(await this._ready).translate(e)}}},()=>{document.webL10n=function(e,t,i){var n={},s="",r="textContent",o="",a={},l="loading";function fireL10nReadyEvent(e){var i=t.createEvent("Event");i.initEvent("localized",!0,!1);i.language=e;t.dispatchEvent(i)}function xhrLoadText(e,t,i){t=t||function _onSuccess(e){};i=i||function _onFailure(){};var n=new XMLHttpRequest;n.open("GET",e,true);n.overrideMimeType&&n.overrideMimeType("text/plain; charset=utf-8");n.onreadystatechange=function(){4==n.readyState&&(200==n.status||0===n.status?t(n.responseText):i())};n.onerror=i;n.ontimeout=i;try{n.send(null)}catch(e){i()}}function parseResource(t,i,o,a){var l=t.replace(/[^\/]*$/,"")||"./";function evalString(e){return e.lastIndexOf("\\")<0?e:e.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}xhrLoadText(t,(function(t){s+=t;!function parseProperties(t,n){var s={},r=/^\s*|\s*$/,o=/^\s*#|^\s*$/,a=/^\s*\[(.*)\]\s*$/,h=/^\s*@import\s+url\((.*)\)\s*$/i,d=/^([^=\s]*)\s*=\s*(.+)$/;function parseRawLines(e,t,n){var c=e.replace(r,"").split(/[\r\n]+/),u="*",g=i.split("-",1)[0],p=!1,f="",m=!1;!function nextEntry(){for(var e=void 0;;){if(!c.length&&e){m?nextEntry():loadImport(e,nextEntry);return}if(!c.length){n();return}var r=c.shift();if(!o.test(r)){if(t){if(f=a.exec(r)){u=f[1].toLowerCase();p="*"!==u&&u!==i&&u!==g;continue}if(p)continue;if(f=h.exec(r)){if("*"===u||u===i){loadImport(l+f[1],nextEntry);m=!0;return}e=l+f[1]}}var w=r.match(d);w&&3==w.length&&(s[w[1]]=evalString(w[2]))}}}()}function loadImport(t,i){xhrLoadText(t,(function(e){parseRawLines(e,!1,i)}),(function(){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&Window.ngxConsole.warn(t+" not found.");i()}))}parseRawLines(t,!0,(function(){n(s)}))}(t,(function(e){for(var t in e){var i,s,a=t.lastIndexOf(".");if(a>0){i=t.substring(0,a);s=t.substring(a+1)}else{i=t;s=r}n[i]||(n[i]={});n[i][s]=e[t]}o&&o()}))}),a)}function loadLocale(i,r){let a=i;i&&(i=i.toLowerCase());r=r||function _callback(){};!function clear(){n={};s="";o=""}();o=i;var h=function getL10nResourceLinks(){return t.querySelectorAll('link[type="application/l10n"]')}(),d=h.length;if(0!==d){var c,u=0;c=function(){if(++u>=d){r();fireL10nReadyEvent(i);l="complete"}};for(var g=0;g<d;g++){new L10nResourceLink(h[g]).load(i,c)}}else{var p=function getL10nDictionary(){var e=t.querySelector('script[type="application/l10n"]');return e?JSON.parse(e.innerHTML):null}();if(p&&p.locales&&p.default_locale){Window.ngxConsole.log("The PDF viewer uses the pre-compiled language bundle stored in the HTML page.");if(!(n=p.locales[a])){var f=p.default_locale.toLowerCase();for(var m in p.locales){a=m;if((m=m.toLowerCase())===i){n=p.locales[a];break}m===f&&(n=p.locales[a])}}r()}else Window.ngxConsole.log("Could not load the translation files for the PDF viewer. Check the flag useBrowserLocale, check the locales subfolder of the assets folder, or add the locale definition to the index.html");fireL10nReadyEvent(i);l="complete"}function L10nResourceLink(t){var i=t.href;this.load=function(t,n){parseResource(i,t,n,(function(){const s=e.PDFViewerApplicationOptions;if(!s||s.get("verbosity")>0){Window.ngxConsole.warn(i+" not found.");Window.ngxConsole.warn('"'+t+'" resource not found')}o="";n()}))}}}a.plural=function(t,i,s,l){var h=parseFloat(i);if(isNaN(h))return t;if(l!=r)return t;a._pluralRules||(a._pluralRules=function getPluralRules(t){function isIn(e,t){return-1!==t.indexOf(e)}function isBetween(e,t,i){return t<=e&&e<=i}var i={0:function(e){return"other"},1:function(e){return isBetween(e%100,3,10)?"few":0===e?"zero":isBetween(e%100,11,99)?"many":2==e?"two":1==e?"one":"other"},2:function(e){return 0!==e&&e%10==0?"many":2==e?"two":1==e?"one":"other"},3:function(e){return 1==e?"one":"other"},4:function(e){return isBetween(e,0,1)?"one":"other"},5:function(e){return isBetween(e,0,2)&&2!=e?"one":"other"},6:function(e){return 0===e?"zero":e%10==1&&e%100!=11?"one":"other"},7:function(e){return 2==e?"two":1==e?"one":"other"},8:function(e){return isBetween(e,3,6)?"few":isBetween(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&isBetween(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return isBetween(e%10,2,9)&&!isBetween(e%100,11,19)?"few":e%10!=1||isBetween(e%100,11,19)?"other":"one"},11:function(e){return isBetween(e%10,2,4)&&!isBetween(e%100,12,14)?"few":e%10==0||isBetween(e%10,5,9)||isBetween(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return isBetween(e,2,4)?"few":1==e?"one":"other"},13:function(e){return isBetween(e%10,2,4)&&!isBetween(e%100,12,14)?"few":1!=e&&isBetween(e%10,0,1)||isBetween(e%10,5,9)||isBetween(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return isBetween(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||isBetween(e%100,2,10)?"few":isBetween(e%100,11,19)?"many":1==e?"one":"other"},16:function(e){return e%10==1&&11!=e?"one":"other"},17:function(e){return 3==e?"few":0===e?"zero":6==e?"many":2==e?"two":1==e?"one":"other"},18:function(e){return 0===e?"zero":isBetween(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return isBetween(e,2,10)?"few":isBetween(e,0,1)?"one":"other"},20:function(e){return!isBetween(e%10,3,4)&&e%10!=9||isBetween(e%100,10,19)||isBetween(e%100,70,79)||isBetween(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||isIn(e%100,[12,72,92])?e%10!=1||isIn(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return isBetween(e,0,1)||isBetween(e,11,99)?"one":"other"},23:function(e){return isBetween(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return isBetween(e,3,10)||isBetween(e,13,19)?"few":isIn(e,[2,12])?"two":isIn(e,[1,11])?"one":"other"}},n={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[t.replace(/-.*$/,"")];if(!(n in i)){const i=e.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&Window.ngxConsole.warn("plural form unknown for ["+t+"]");return function(){return"other"}}return i[n]}(o));var d="["+a._pluralRules(h)+"]";0===h&&s+"[zero]"in n?t=n[s+"[zero]"][l]:1==h&&s+"[one]"in n?t=n[s+"[one]"][l]:2==h&&s+"[two]"in n?t=n[s+"[two]"][l]:s+d in n?t=n[s+d][l]:s+"[other]"in n&&(t=n[s+"[other]"][l]);return t};function getL10nData(t,i,s){var r=n[t];if(!r){const i=e.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&Window.ngxConsole.warn("Translation for the key #"+t+" is missing.");if(!s)return null;r=s}var o={};for(var a in r){var l=r[a];l=substArguments(l=substIndexes(l,i,t,a),i,t);o[a]=l}return o}function substIndexes(e,t,i,s){var r=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!r||!r.length)return e;var o,l=r[1],h=r[2];t&&h in t?o=t[h]:h in n&&(o=n[h]);if(l in a){e=(0,a[l])(e,o,i,s)}return e}function substArguments(e,t,i){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,s){if(t&&s in t)return t[s];if(s in n)return n[s];Window.ngxConsole.log("argument {{"+s+"}} for #"+i+" is undefined.");return e}))}function translateElement(i){var n=function getL10nAttributes(t){if(!t)return{};var i=t.getAttribute("data-l10n-id"),n=t.getAttribute("data-l10n-args"),s={};if(n)try{s=JSON.parse(n)}catch(t){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&Window.ngxConsole.warn("could not parse arguments for #"+i)}return{id:i,args:s}}(i);if(n.id){var s=getL10nData(n.id,n.args);if(s){if(s[r]){if(0===function getChildElementCount(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,i=0;i<e.childNodes.length;i++)t+=1===e.nodeType?1:0;return t}(i))i[r]=s[r];else{for(var o=i.childNodes,a=!1,l=0,h=o.length;l<h;l++)if(3===o[l].nodeType&&/\S/.test(o[l].nodeValue))if(a)o[l].nodeValue="";else{o[l].nodeValue=s[r];a=!0}if(!a){var d=t.createTextNode(s[r]);i.prepend(d)}}delete s[r]}for(var c in s)i[c]=s[c]}else{const t=e.PDFViewerApplicationOptions;(!t||t.get("verbosity")>0)&&Window.ngxConsole.warn("#"+n.id+" is undefined.")}}}return{get:function(e,t,i){var n,s=e.lastIndexOf("."),o=r;if(s>0){o=e.substring(s+1);e=e.substring(0,s)}i&&((n={})[o]=i);var a=getL10nData(e,t,n);return a&&o in a?a[o]:"{{"+e+"}}"},getData:function(){return n},getText:function(){return s},getLanguage:function(){return o},setLanguage:function(e,t){loadLocale(e,(function(){t&&t()}))},getDirection:function(){var e=o.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function translateFragment(e){for(var i=function getTranslatableChildren(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),n=i.length,s=0;s<n;s++)translateElement(i[s]);translateElement(e)},getReadyState:function(){return l},ready:function(i){i&&("complete"==l||"interactive"==l?e.setTimeout((function(){i()})):t.addEventListener&&t.addEventListener("localized",(function once(){t.removeEventListener("localized",once);i()})))}}}(window,document)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericScripting=void 0;t.docPropertiesLookup=async function docPropertiesLookup(e){const t="".split("#")[0];let{info:i,metadata:s,contentDispositionFilename:r,contentLength:o}=await e.getMetadata();if(!o){const{length:t}=await e.getDownloadInfo();o=t}return{...i,baseURL:t,filesize:o,filename:r||(0,n.getPdfFilenameFromUrl)(""),metadata:s?.getRaw(),authors:s?.get("dc:creator"),numPages:e.numPages,URL:""}};var n=i(4);t.GenericScripting=class GenericScripting{constructor(e){this._ready=(0,n.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout((()=>t.dispatchEvent(e)),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPrintService=PDFPrintService;var n=i(4),s=i(2),r=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i(37)),o=i(54);let a=null,l=null,h=null;function renderPage(e,t,i,s,o,l,h){const d=a.scratchCanvas;let c=o/n.PixelsPerInch.PDF,u=1;const g=Math.floor(s.width*c),p=Math.floor(s.height*c);if(g>=4096||p>=4096){if(!r.default.test({width:g,height:p})){const e=function determineMaxDimensions(){const e=[4096,8192,10836,11180,11402,14188,16384];for(let t of e)if(!r.default.test({width:t+1,height:t+1}))return t;return 16384}();u=.95*Math.min(e/g,e/p)}warn("Page "+i+": Reduced the [printResolution] to "+Math.floor(o*u)+" because the browser can't render larger canvases. If you see blank page in the print preview, reduce [printResolution] manually to a lower value.")}c*=u;d.width=Math.floor(s.width*c);d.height=Math.floor(s.height*c);const f=d.getContext("2d");f.save();f.fillStyle="rgb(255, 255, 255)";f.fillRect(0,0,d.width,d.height);f.restore();return Promise.all([t.getPage(i),h]).then((function([e,t]){const i={canvasContext:f,transform:[c,0,0,c,0,0],viewport:e.getViewport({scale:1,rotation:s.rotation}),intent:"print",annotationMode:n.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:l,background:PDFViewerApplicationOptions.get("pdfBackgroundColor"),printAnnotationStorage:t};return e.render(i).promise}))}function PDFPrintService(e,t,i,n,s=null,r=null,o,a){this.pdfDocument=e;this.pagesOverview=t;this.printContainer=i;this._printResolution=n||150;this._optionalContentConfigPromise=s||e.getOptionalContentConfig();this._printAnnotationStoragePromise=r||Promise.resolve();this.l10n=o;this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=a}PDFPrintService.prototype={layout(){this.throwIfInactive();const e=document.querySelector("body");e.setAttribute("data-pdfjsprinting",!0);document.querySelector("html").setAttribute("data-pdfjsprinting",!0);this.pagesOverview.every((function(e){return e.width===this.pagesOverview[0].width&&e.height===this.pagesOverview[0].height}),this)||Window.ngxConsole.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");const t=this.pagesOverview[0];this.pageStyleSheet.textContent="@page { size: "+t.width+"pt "+t.height+"pt;}";e.append(this.pageStyleSheet)},destroy(){if(a!==this)return;this.printContainer.textContent="";document.querySelector("body").removeAttribute("data-pdfjsprinting");document.querySelector("html").removeAttribute("data-pdfjsprinting");if(this.pageStyleSheet){this.pageStyleSheet.remove();this.pageStyleSheet=null}this.scratchCanvas.width=this.scratchCanvas.height=0;this.scratchCanvas=null;a=null;ensureOverlay().then((function(){if(h.active===l){h.close(l);h.unregister(l)}}));c=void 0},renderPages(){if(this.pdfDocument.isPureXfa){(0,o.getXfaHtmlForPrinting)(this.printContainer,this.pdfDocument);return Promise.resolve()}const e=this.pagesOverview.length,renderNextPage=(t,i)=>{this.throwIfInactive();for(;;){++this.currentPage;if(this.currentPage>=e)break;if(!window.isInPDFPrintRange||window.isInPDFPrintRange(this.currentPage))break}if(this.currentPage>=e){renderProgress(window.filteredPageCount|e,window.filteredPageCount|e,this.l10n,this.eventBus);t();return}const n=this.currentPage;renderProgress(n,window.filteredPageCount|e,this.l10n,this.eventBus);renderPage(0,this.pdfDocument,n+1,this.pagesOverview[n],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then((function(){renderNextPage(t,i)}),i)};return new Promise(renderNextPage)},useRenderedPage(){this.throwIfInactive();const e=document.createElement("img"),t=this.scratchCanvas;"toBlob"in t?t.toBlob((function(t){e.src=URL.createObjectURL(t)})):e.src=t.toDataURL();const i=document.createElement("div");i.className="printedPage";i.append(e);this.printContainer.append(i);return new Promise((function(t,i){e.onload=t;e.onerror=i}))},performPrint(){this.throwIfInactive();return new Promise((e=>{setTimeout((()=>{if(!this.active){e();return}d.call(window);const t=navigator.platform&&["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document;setTimeout(e,t?1500:20)}),0)}))},get active(){return this===a},throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}};const d=window.print;window.printPDF=function(){if(s.PDFViewerApplication.enablePrint)if(a)Window.ngxConsole.warn("Ignored window.printPDF() because of a pending print job.");else{ensureOverlay().then((function(){a&&h.open(l)}));try{dispatchEvent("beforeprint")}finally{if(!a){Window.ngxConsole.error("Expected print service to be initialized.");ensureOverlay().then((function(){h.active===l&&h.close(l)}));return}const e=a;a.renderPages().then((function(){const t=document.getElementById("printServiceDialog");t&&t.classList.add("hidden");return e.performPrint()})).catch((function(){})).then((function(){e.active&&abort()}))}}};function dispatchEvent(e){const t=document.createEvent("CustomEvent");t.initCustomEvent(e,!1,!1,"custom");window.dispatchEvent(t)}function abort(){if(a){a.destroy();dispatchEvent("afterprint")}}function renderProgress(e,t,i,n){l=document.getElementById("printServiceDialog");const s=Math.round(100*e/t),r=l.querySelector("progress"),o=l.querySelector(".relative-progress");r.value=s;i.get("print_progress_percent",{progress:s}).then((e=>{o.textContent=e}));n.dispatch("progress",{source:this,type:"print",total:t,page:e,percent:100*e/t})}window.addEventListener("keydown",(function(e){if(80===e.keyCode&&(e.ctrlKey||e.metaKey)&&!e.altKey&&(!e.shiftKey||window.chrome||window.opera)){window.print();e.preventDefault();e.stopImmediatePropagation?e.stopImmediatePropagation():e.stopPropagation()}}),!0);if("onbeforeprint"in window){const stopPropagationIfNeeded=function(e){"custom"!==e.detail&&e.stopImmediatePropagation&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",stopPropagationIfNeeded);window.addEventListener("afterprint",stopPropagationIfNeeded)}let c;function ensureOverlay(){if(!c){h=s.PDFViewerApplication.overlayManager;if(!h)throw new Error("The overlay manager has not yet been initialized.");l=document.getElementById("printServiceDialog");c=h.register(l,!0);document.getElementById("printCancel").onclick=abort;l.addEventListener("close",abort)}return c}s.PDFPrintServiceFactory.instance={supportsPrinting:!0,createPrintService(e,t,i,n,s,r,o,l){if(a)throw new Error("The print service is created and active.");a=new PDFPrintService(e,t,i,n,s,r,o,l);return a}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getXfaHtmlForPrinting=function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,o=new s.SimpleLinkService,a=Math.round(100*n.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const s of i.children){const i=document.createElement("div");i.className="xfaPrintedPage";e.append(i);const l=new r.XfaLayerBuilder({pageDiv:i,pdfPage:null,annotationStorage:t.annotationStorage,linkService:o,xfaHtml:s}),h=(0,n.getXfaPageViewport)(s,{scale:a});l.render(h,"print")}};var n=i(4),s=i(8),r=i(43)}],t={};function __webpack_require__(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};e[i](s,s.exports,__webpack_require__);return s.exports}var i={};(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0});Object.defineProperty(e,"PDFViewerApplication",{enumerable:!0,get:function(){return n.PDFViewerApplication}});Object.defineProperty(e,"PDFViewerApplicationOptions",{enumerable:!0,get:function(){return t.AppOptions}});var t=__webpack_require__(1),n=__webpack_require__(2);window.PDFViewerApplication=n.PDFViewerApplication;window.PDFViewerApplicationOptions=t.AppOptions;HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);"function"!=typeof window.CustomEvent&&(window.CustomEvent=function CustomEvent(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};const i=document.createEvent("CustomEvent");i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail);return i});__webpack_require__(47);__webpack_require__(53);document.blockUnblockOnload?.(!0);window.webViewerLoad=function webViewerLoad(){const e=function getViewerConfiguration(){let e=null;e={container:document.getElementById("errorWrapper"),errorMessage:document.getElementById("errorMessage"),closeButton:document.getElementById("errorClose"),errorMoreInfo:document.getElementById("errorMoreInfo"),moreInfoButton:document.getElementById("errorShowMore"),lessInfoButton:document.getElementById("errorShowLess")};return{appContainer:document.body,mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),toolbar:{container:document.getElementById("toolbarViewer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("zoomIn"),zoomOut:document.getElementById("zoomOut"),viewFind:document.getElementById("viewFind"),openFile:document.getElementById("openFile"),print:document.getElementById("print"),editorNoneButton:document.getElementById("editorNone"),editorFreeTextButton:document.getElementById("editorFreeText"),editorFreeTextParamsToolbar:document.getElementById("editorFreeTextParamsToolbar"),editorInkButton:document.getElementById("editorInk"),editorInkParamsToolbar:document.getElementById("editorInkParamsToolbar"),presentationModeButton:document.getElementById("presentationMode"),download:document.getElementById("download"),viewBookmark:document.getElementById("viewBookmark")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrint"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("secondaryViewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollPageButton:document.getElementById("scrollPage"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),documentPropertiesButton:document.getElementById("documentProperties")},sidebar:{outerContainer:document.getElementById("outerContainer"),sidebarContainer:document.getElementById("sidebarContainer"),toggleButton:document.getElementById("sidebarToggle"),thumbnailButton:document.getElementById("viewThumbnail"),outlineButton:document.getElementById("viewOutline"),attachmentsButton:document.getElementById("viewAttachments"),layersButton:document.getElementById("viewLayers"),thumbnailView:document.getElementById("thumbnailView"),outlineView:document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView"),outlineOptionsContainer:document.getElementById("outlineOptionsContainer"),currentOutlineItemButton:document.getElementById("currentOutlineItem")},sidebarResizer:{outerContainer:document.getElementById("outerContainer"),resizer:document.getElementById("sidebarResizer")},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"),findField:document.getElementById("findInput"),findFieldMultiline:document.getElementById("findInputMultiline"),highlightAllCheckbox:document.getElementById("findHighlightAll"),findCurrentPageCheckbox:document.getElementById("findCurrentPage"),findPageRangeField:document.getElementById("findRange"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),matchDiacriticsCheckbox:document.getElementById("findMatchDiacritics"),entireWordCheckbox:document.getElementById("findEntireWord"),findMultipleSearchTextsCheckbox:document.getElementById("findMultipleSearchTexts"),ignoreAccentsCheckbox:document.getElementById("findIgnoreAccents"),fuzzyCheckbox:document.getElementById("findFuzzy"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext")},passwordOverlay:{dialog:document.getElementById("passwordDialog"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{dialog:document.getElementById("documentPropertiesDialog"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},annotationEditorParams:{editorFreeTextFontSize:document.getElementById("editorFreeTextFontSize"),editorFreeTextColor:document.getElementById("editorFreeTextColor"),editorInkColor:document.getElementById("editorInkColor"),editorInkThickness:document.getElementById("editorInkThickness"),editorInkOpacity:document.getElementById("editorInkOpacity")},errorWrapper:e,printContainer:document.getElementById("printContainer"),openFileInput:document.getElementById("fileInput"),debuggerScriptPath:"./debugger.js"}}(),t=document.createEvent("CustomEvent");t.initCustomEvent("webviewerloaded",!0,!0,{source:window});try{parent.document.eventListeners&&parent.document.eventListeners("webviewerloaded").length?parent.document.dispatchEvent(t):document.dispatchEvent(t)}catch(e){Window.ngxConsole.error(`webviewerloaded: ${e}`);document.dispatchEvent(t)}n.PDFViewerApplication.run(e)}})()})();
});