IM/web-v2-res/static/js/pdf_viewer.min.js
2025-02-07 12:39:15 +08:00

1 line
119 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/web/pdf_viewer",[],t):"object"==typeof exports?exports["pdfjs-dist/web/pdf_viewer"]=t():e["pdfjs-dist/web/pdf_viewer"]=e.pdfjsViewer=t()}(globalThis,()=>(()=>{"use strict";var i=[,(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var o=i(2);const a={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};function n(e,{url:t,target:i,rel:n,enabled:r=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');t=(0,o.removeNullCharacters)(t);r?e.href=e.title=t:(e.href="",e.title="Disabled: "+t,e.onclick=()=>!1);let s="";switch(i){case a.NONE:break;case a.SELF:s="_self";break;case a.BLANK:s="_blank";break;case a.PARENT:s="_parent";break;case a.TOP:s="_top"}e.target=s,e.rel="string"==typeof n?n:"noopener noreferrer nofollow"}t.LinkTarget=a;class l{#pagesRefCache=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.#pagesRefCache.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}get isInPresentationMode(){return this.pdfViewer.isInPresentationMode}#goToDestinationHelper(t,i=null,n){const r=n[0];let e;if("object"==typeof r&&null!==r){if(!(e=this._cachedPageNumber(r)))return void this.pdfDocument.getPageIndex(r).then(e=>{this.cachePageRef(e+1,r),this.#goToDestinationHelper(t,i,n)}).catch(()=>{console.error(`PDFLinkService.#goToDestinationHelper: "${r}" is not `+`a valid page reference, for dest="${t}".`)})}else{if(!Number.isInteger(r))return void console.error(`PDFLinkService.#goToDestinationHelper: "${r}" is not `+`a valid destination reference, for dest="${t}".`);e=r+1}!e||e<1||e>this.pagesCount?console.error(`PDFLinkService.#goToDestinationHelper: "${e}" is not `+`a valid page number, for dest="${t}".`):(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:i,explicitDest:n,pageNumber:e})),this.pdfViewer.scrollPageIntoView({pageNumber:e,destArray:n,ignoreDestinationZoom:this._ignoreDestinationZoom}))}async goToDestination(i){if(this.pdfDocument){let e,t;t="string"==typeof i?(e=i,await this.pdfDocument.getDestination(i)):(e=null,await i),Array.isArray(t)?this.#goToDestinationHelper(i,e,t):console.error(`PDFLinkService.goToDestination: "${t}" is not `+`a valid destination array, for dest="${i}".`)}}goToPage(e){var t;this.pdfDocument&&(t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e,Number.isInteger(t)&&0<t&&t<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})):console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`))}addLinkAttributes(e,t,i=!1){n(e,{url:t,target:i?a.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(0<e.length)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){e=JSON.stringify(e);if(0<e.length)return this.getAnchorUrl("#"+escape(e))}return this.getAnchorUrl("")}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(i){if(this.pdfDocument){let e,t;if(i.includes("=")){const s=(0,o.parseQueryString)(i);if(s.has("search")&&this.eventBus.dispatch("findfromurlhash",{source:this,query:s.get("search").replaceAll('"',""),phraseSearch:"true"===s.get("phrase")}),s.has("page")&&(e=0|s.get("page")||1),s.has("zoom")){var n=s.get("zoom").split(",");const a=n[0];var r=parseFloat(a);a.includes("Fit")?"Fit"===a||"FitB"===a?t=[null,{name:a}]:"FitH"===a||"FitBH"===a||"FitV"===a||"FitBV"===a?t=[null,{name:a},1<n.length?0|n[1]:null]:"FitR"===a?5!==n.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):t=[null,{name:a},0|n[1],0|n[2],0|n[3],0|n[4]]:console.error(`PDFLinkService.setHash: "${a}" is not a valid zoom value.`):t=[null,{name:"XYZ"},1<n.length?0|n[1]:null,2<n.length?0|n[2]:null,r?r/100:a]}t?this.pdfViewer.scrollPageIntoView({pageNumber:e||this.page,destArray:t,allowNegativeOffset:!0}):e&&(this.page=e),s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")}),s.has("nameddest")&&this.goToDestination(s.get("nameddest"))}else{t=unescape(i);try{t=JSON.parse(t),Array.isArray(t)||(t=t.toString())}catch(e){}"string"==typeof t||l.#isValidExplicitDestination(t)?this.goToDestination(t):console.error(`PDFLinkService.setHash: "${unescape(i)}" 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})}async executeSetOCGState(t){var e=this.pdfDocument;const i=await this.pdfViewer.optionalContentConfigPromise;if(e===this.pdfDocument){let e;for(const r of t.state){switch(r){case"ON":case"OFF":case"Toggle":e=r;continue}switch(e){case"ON":i.setVisibility(r,!0);break;case"OFF":i.setVisibility(r,!1);break;case"Toggle":var n=i.getGroup(r);n&&i.setVisibility(r,!n.visible)}}this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i)}}cachePageRef(e,t){t&&(t=0===t.gen?t.num+"R":t.num+"R"+t.gen,this.#pagesRefCache.set(t,e))}_cachedPageNumber(e){if(!e)return null;e=0===e.gen?e.num+"R":e.num+"R"+e.gen;return this.#pagesRefCache.get(e)||null}isPageVisible(e){return this.pdfViewer.isPageVisible(e)}isPageCached(e){return this.pdfViewer.isPageCached(e)}static#isValidExplicitDestination(t){if(!Array.isArray(t))return!1;var i=t.length;if(i<2)return!1;var e=t[0];if(!("object"==typeof e&&Number.isInteger(e.num)&&Number.isInteger(e.gen)||Number.isInteger(e)&&0<=e))return!1;e=t[1];if("object"!=typeof e||"string"!=typeof e.name)return!1;let n=!0;switch(e.name){case"XYZ":if(5!==i)return!1;break;case"Fit":case"FitB":return 2===i;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==i)return!1;break;case"FitR":if(6!==i)return!1;n=!1;break;default:return!1}for(let e=2;e<i;e++){var r=t[e];if(!("number"==typeof r||n&&null===r))return!1}return!0}}t.PDFLinkService=l;t.SimpleLinkService=class{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}get isInPresentationMode(){return!1}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,i=0){n(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}executeSetOCGState(e){}cachePageRef(e,t){}isPageVisible(e){return!0}isPageCached(e){return!0}}},(e,t)=>{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.CursorTool=t.AutoPrintRegExp=void 0,t.apiPageLayoutToViewerModes=function(e){let t=n.VERTICAL,i=r.NONE;switch(e){case"SinglePage":t=n.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=n.PAGE;case"TwoColumnLeft":i=r.ODD;break;case"TwoPageRight":t=n.PAGE;case"TwoColumnRight":i=r.EVEN}return{scrollMode:t,spreadMode:i}},t.apiPageModeToSidebarView=function(e){switch(e){case"UseNone":return i.NONE;case"UseThumbs":return i.THUMBS;case"UseOutlines":return i.OUTLINE;case"UseAttachments":return i.ATTACHMENTS;case"UseOC":return i.LAYERS}return i.NONE},t.approximateFraction=function(e){if(Math.floor(e)===e)return[e,1];var t=1/e;{if(8<t)return[1,8];if(Math.floor(t)===t)return[1,t]}var i=1<e?t:e;let n=0,r=1,s=1,a=1;for(;;){var o=n+s,l=r+a;if(8<l)break;i<=o/l?(s=o,a=l):(n=o,r=l)}let h;h=i-n/r<s/a-i?i===e?[n,r]:[r,n]:i===e?[s,a]:[a,s];return h},t.backtrackBeforeAllVisibleElements=w,t.binarySearchFirstItem=E,t.docStyle=void 0,t.getActiveOrFocusedElement=function(){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({view:e,userUnit:t,rotate:i}){var[e,n,r,s]=e,i=i%180!=0,r=(r-e)/72*t,e=(s-n)/72*t;return{width:i?e:r,height:i?r:e}},t.getVisibleElements=function({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:r=!1}){const s=e.scrollTop,a=s+e.clientHeight,o=e.scrollLeft,l=o+e.clientWidth;const h=[],d=new Set,c=t.length;let u=E(t,n?function(e){var t=(e=e.div).offsetLeft+e.clientLeft,e=t+e.clientWidth;return r?t<l:e>o}:function(e){return(e=e.div).offsetTop+e.clientTop+e.clientHeight>s});0<u&&u<c&&!n&&(u=w(u,t,s));let p=n?l:-1;for(let e=u;e<c;e++){var g=t[e],f=g.div,_=f.offsetLeft+f.clientLeft,v=f.offsetTop+f.clientTop,m=f.clientWidth,f=f.clientHeight,P=_+m,y=v+f;if(-1===p)a<=y&&(p=y);else if((n?_:v)>p)break;y<=s||a<=v||P<=o||_>=l||(y=Math.max(0,s-v)+Math.max(0,y-a),P=Math.max(0,o-_)+Math.max(0,P-l),f=(f-y)/f*(y=(m-P)/m)*100|0,h.push({id:g.id,x:_,y:v,view:g,percent:f,widthPercent:100*y|0}),d.add(g.id))}var e=h[0],b=h.at(-1);i&&h.sort(function(e,t){var i=e.percent-t.percent;return.001<Math.abs(i)?-i:e.id-t.id});return{first:e,last:b,views:h,ids:d}},t.isPortraitOrientation=function(e){return e.width<=e.height},t.isValidRotation=function(e){return Number.isInteger(e)&&e%90==0},t.isValidScrollMode=function(e){return Number.isInteger(e)&&Object.values(n).includes(e)&&e!==n.UNKNOWN},t.isValidSpreadMode=function(e){return Number.isInteger(e)&&Object.values(r).includes(e)&&e!==r.UNKNOWN},t.noContextMenuHandler=function(e){e.preventDefault()},t.normalizeWheelEventDelta=function(e){var t=e.deltaMode;let i=a(e);t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30);return i},t.normalizeWheelEventDirection=a,t.parseQueryString=function(e){const t=new Map;for(var[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t},t.removeNullCharacters=function(e,t=!1){if("string"!=typeof e)return console.error("The argument must be a string."),e;t&&(e=e.replaceAll(s," "));return e.replaceAll("\0","")},t.roundToDivide=function(e,t){var i=e%t;return 0==i?e:Math.round(e-i+t)},t.scrollIntoView=function(i,n,r=!1){let s=i.offsetParent;if(s){let e=i.offsetTop+i.clientTop,t=i.offsetLeft+i.clientLeft;for(;s.clientHeight===s.scrollHeight&&s.clientWidth===s.scrollWidth||r&&(s.classList.contains("markedContent")||"hidden"===getComputedStyle(s).overflow);)if(e+=s.offsetTop,t+=s.offsetLeft,!(s=s.offsetParent))return;n&&(void 0!==n.top&&(e+=n.top),void 0!==n.left&&(t+=n.left,s.scrollLeft=t)),s.scrollTop=e}else console.error("offsetParent is not set -- cannot scroll")},t.watchScroll=function(i,n){function e(e){s=s||window.requestAnimationFrame(function(){s=null;var e=i.scrollLeft,t=r.lastX,t=(e!==t&&(r.right=t<e),r.lastX=e,i.scrollTop),e=r.lastY;t!==e&&(r.down=e<t),r.lastY=t,n(r)})}const r={right:!0,down:!0,lastX:i.scrollLeft,lastY:i.scrollTop,_eventHandler:e};let s=null;return i.addEventListener("scroll",e,!0),r};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 i={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};t.SidebarView=i;t.RendererType={CANVAS:"canvas",SVG:"svg"};t.TextLayerMode={DISABLE:0,ENABLE:1};const n={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},r=(t.ScrollMode=n,{UNKNOWN:-1,NONE:0,ODD:1,EVEN:2});t.SpreadMode=r;t.CursorTool={SELECT:0,HAND:1,ZOOM:2};t.AutoPrintRegExp=/\bprint\s*\(/;t.OutputScale=class{constructor(){var e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const s=/[\x01-\x1F]/g;function E(e,t,i=0){let n=i,r=e.length-1;if(r<0||!t(e[r]))return e.length;if(t(e[n]))return n;for(;n<r;){var s=n+r>>1;t(e[s])?r=s:n=1+s}return n}function w(t,i,e){if(t<2)return t;let n=i[t].div,r=n.offsetTop+n.clientTop;r>=e&&(n=i[t-1].div,r=n.offsetTop+n.clientTop);for(let e=t-2;0<=e&&!((n=i[e].div).offsetTop+n.clientTop+n.clientHeight<=r);--e)t=e;return t}function a(e){let t=Math.hypot(e.deltaX,e.deltaY);e=Math.atan2(e.deltaY,e.deltaX);return t=-.25*Math.PI<e&&e<.75*Math.PI?-t:t}var o=new Promise(function(e){window.requestAnimationFrame(e)}),o=(t.animationStarted=o,document.documentElement.style);t.docStyle=o;t.ProgressBar=class{#classList=null;#disableAutoFetchTimeout=null;#percent=0;#style=null;#visible=!0;constructor(e){this.#classList=e.classList,this.#style=e.style}get percent(){return this.#percent}set percent(e){var t,i;this.#percent=(t=0,i=100,Math.min(Math.max(e,t),i)),isNaN(e)?this.#classList.add("indeterminate"):(this.#classList.remove("indeterminate"),this.#style.setProperty("--progressBar-percent",this.#percent+"%"))}setWidth(e){!e||0<(e=e.parentNode.offsetWidth-e.offsetWidth)&&this.#style.setProperty("--progressBar-end-offset",e+"px")}setDisableAutoFetch(e=5e3){isNaN(this.#percent)||(this.#disableAutoFetchTimeout&&clearTimeout(this.#disableAutoFetchTimeout),this.show(),this.#disableAutoFetchTimeout=setTimeout(()=>{this.#disableAutoFetchTimeout=null,this.hide()},e))}hide(){this.#visible&&(this.#visible=!1,this.#classList.add("hidden"))}show(){this.#visible||(this.#visible=!0,this.#classList.remove("hidden"))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayerBuilder=void 0;var r=i(4),p=i(5),s=i(2);t.AnnotationLayerBuilder=class{#numAnnotations=0;#onPresentationModeChanged=null;constructor({pageDiv:e,pdfPage:t,linkService:i,downloadManager:n,annotationStorage:r=null,imageResourcesPath:s="",renderForms:a=!0,l10n:o=p.NullL10n,enableScripting:l=!1,hasJSActionsPromise:h=null,fieldObjectsPromise:d=null,annotationCanvasMap:c=null,accessibilityManager:u=null}){this.pageDiv=e,this.pdfPage=t,this.linkService=i,this.downloadManager=n,this.imageResourcesPath=s,this.renderForms=a,this.l10n=o,this.annotationStorage=r,this.enableScripting=l,this._hasJSActionsPromise=h||Promise.resolve(!1),this._fieldObjectsPromise=d||Promise.resolve(null),this._annotationCanvasMap=c,this._accessibilityManager=u,this.div=null,this._cancelled=!1,this._eventBus=i.eventBus}async render(e,t="display"){if(this.div)return this._cancelled||0===this.#numAnnotations?void 0:void r.AnnotationLayer.update({viewport:e.clone({dontFlip:!0}),div:this.div,annotationCanvasMap:this._annotationCanvasMap});var[t,i,n]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);this._cancelled||(this.#numAnnotations=t.length,this.div=document.createElement("div"),this.div.className="annotationLayer",this.pageDiv.append(this.div),0===this.#numAnnotations?this.hide():(r.AnnotationLayer.render({viewport:e.clone({dontFlip:!0}),div:this.div,annotations:t,page:this.pdfPage,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:i,fieldObjects:n,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager}),this.l10n.translate(this.div),this.linkService.isInPresentationMode&&this.#updatePresentationModeState(s.PresentationModeState.FULLSCREEN),this.#onPresentationModeChanged||(this.#onPresentationModeChanged=e=>{this.#updatePresentationModeState(e.state)},this._eventBus?._on("presentationmodechanged",this.#onPresentationModeChanged))))}cancel(){this._cancelled=!0,this.#onPresentationModeChanged&&(this._eventBus?._off("presentationmodechanged",this.#onPresentationModeChanged),this.#onPresentationModeChanged=null)}hide(){this.div&&(this.div.hidden=!0)}#updatePresentationModeState(t){if(this.div){let e=!1;switch(t){case s.PresentationModeState.FULLSCREEN:e=!0;break;case s.PresentationModeState.NORMAL:break;default:return}for(const i of this.div.childNodes)i.hasAttribute("data-internal-link")||(i.inert=e)}}}},e=>{let t;t="undefined"!=typeof window&&window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"]:require("../build/pdf.js"),e.exports=t},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.fixupLangCode=function(e){return n[e?.toLowerCase()]||e},t.getL10nFallback=r;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",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",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_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.",rendering_error:"An error occurred while rendering the page.",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_text2_default_content:"Start typing…",editor_free_text2_aria_label:"Text Editor",editor_ink2_aria_label:"Draw Editor",editor_ink_canvas_aria_label:"User-created image"};function r(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]||""}i.print_progress_percent="{{progress}}%";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"};t.NullL10n={async getLanguage(){return"en-us"},async getDirection(){return"ltr"},async get(e,t=null,i=r(e,t)){return i=i,(n=t)?i.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,(e,t)=>t in n?n[t]:"{{"+t+"}}"):i;var n},async translate(e){}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DownloadManager=void 0;var r=i(4);function n(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{#openBlobUrls=new WeakMap;downloadUrl(e,t){(0,r.createValidAbsoluteUrl)(e,"http://example.com")?n(e+"#pdfjs.action=download",t):console.error("downloadUrl - not a valid URL: "+e)}downloadData(e,t,i){n(URL.createObjectURL(new Blob([e],{type:i})),t)}openOrDownloadData(e,t,i){var n=(0,r.isPdfFile)(i);return this.downloadData(t,i,n?"application/pdf":""),!1}download(e,t,i){n(URL.createObjectURL(e),i)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0,t.waitOnEventOrTimeout=function({target:a,name:o,delay:l=0}){return new Promise(function(t,e){if("object"!=typeof a||!o||"string"!=typeof o||!(Number.isInteger(l)&&0<=l))throw new Error("waitOnEventOrTimeout - invalid parameters.");function i(e){a instanceof d?a._off(o,n):a.removeEventListener(o,n),s&&clearTimeout(s),t(e)}const n=i.bind(null,h.EVENT);a instanceof d?a._on(o,n):a.addEventListener(o,n);var r=i.bind(null,h.TIMEOUT);const s=setTimeout(r,l)})};const h={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=h;class d{#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(t,i){const n=this.#listeners[t];if(n&&0!==n.length){let e;for(var{listener:r,external:s,once:a}of n.slice(0))a&&this._off(t,r),s?(e||=[]).push(r):r(i);if(e){for(const o of e)o(i);e=null}}}_on(e,t,i=null){const n=this.#listeners[e]||=[];n.push({listener:t,external:!0===i?.external,once:!0===i?.once})}_off(e,i,t=0){const n=this.#listeners[e];if(n)for(let e=0,t=n.length;e<t;e++)if(n[e].listener===i)return void n.splice(e,1)}}class i extends(t.EventBus=d){dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}t.AutomationEventBus=i},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericL10n=void 0,i(9);var r=i(5);const n=document.webL10n;t.GenericL10n=class{constructor(i){this._lang=i,this._ready=new Promise((e,t)=>{n.setLanguage((0,r.fixupLangCode)(i),()=>{e(n)})})}async getLanguage(){const e=await this._ready;return e.getLanguage()}async getDirection(){const e=await this._ready;return e.getDirection()}async get(e,t=null,i=(0,r.getL10nFallback)(e,t)){const n=await this._ready;return n.get(e,t,i)}async translate(e){const t=await this._ready;return t.translate(e)}}},()=>{function P(e,t,i){t=t||function(e){},i=i||function(){};var n=new XMLHttpRequest;n.open("GET",e,r),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 u(e,v,r,t){var m=e.replace(/[^\/]*$/,"")||"./";function i(e,t){var c={},i=/^\s*|\s*$/,u=/^\s*#|^\s*$/,p=/^\s*\[(.*)\]\s*$/,g=/^\s*@import\s+url\((.*)\)\s*$/i,f=/^([^=\s]*)\s*=\s*(.+)$/;function _(e,r,s){var a=e.replace(i,"").split(/[\r\n]+/),o="*",l=v.split("-",1)[0],h=!1,d="";!function e(){for(;;){if(!a.length)return void s();var t,i,n=a.shift();if(!u.test(n)){if(r){if(d=p.exec(n)){o=d[1].toLowerCase(),h="*"!==o&&o!==v&&o!==l;continue}if(h)continue;if(d=g.exec(n))return t=m+d[1],i=e,void P(t,function(e){_(e,!1,i)},function(){console.warn(t+" not found."),i()})}(n=n.match(f))&&3==n.length&&(c[n[1]]=(n=n[2]).lastIndexOf("\\")<0?n:n.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,"'"))}}}()}_(e,!0,function(){t(c)})}P(e,function(e){f+=e,i(e,function(e){for(var t in e){var i,n=t.lastIndexOf("."),n=0<n?(i=t.substring(0,n),t.substring(n+1)):(i=t,d);g[i]||(g[i]={}),g[i][n]=e[t]}r&&r()})},t)}function i(e,t){e=e&&e.toLowerCase(),t=t||function(){},g={},_=f="",_=e;var i=p.querySelectorAll('link[type="application/l10n"]'),n=i.length;if(0===n){var r=(o=p.querySelector('script[type="application/l10n"]'))?JSON.parse(o.innerHTML):null;if(r&&r.locales&&r.default_locale){if(console.log("using the embedded JSON directory, early way out"),!(g=r.locales[e])){var s,a=r.default_locale.toLowerCase();for(s in r.locales){if((s=s.toLowerCase())===e){g=r.locales[e];break}s===a&&(g=r.locales[a])}}t()}else console.log("no resource to load, early way out");v="complete"}else for(var o,l=0,h=function(){n<=++l&&(t(),v="complete")},d=0;d<n;d++)new c(i[d]).load(e,h);function c(e){var i=e.href;this.load=function(e,t){u(i,e,t,function(){console.warn(i+" not found."),console.warn('"'+e+'" resource not found'),_="",t()})}}}function h(e,t,i){var n=g[e];if(!n){if(console.warn("#"+e+" is undefined."),!i)return null;n=i}var r,s,a={};for(r in n)s=function(e,i,n){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,function(e,t){return i&&t in i?i[t]:t in g?g[t]:(console.log("argument {{"+t+"}} for #"+n+" is undefined."),e)})}(function(e,t,i,n){var r=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!r||!r.length)return e;var s,a=r[1],r=r[2];t&&r in t?s=t[r]:r in g&&(s=g[r]);a in c&&(t=c[a],e=t(e,s,i,n));return e}(n[r],t,e,r),t,e),a[r]=s;return a}function s(e){var t=function(e){if(!e)return{};var t=e.getAttribute("data-l10n-id"),e=e.getAttribute("data-l10n-args"),i={};if(e)try{i=JSON.parse(e)}catch(e){console.warn("could not parse arguments for #"+t)}return{id:t,args:i}}(e);if(t.id){var i=h(t.id,t.args);if(i){if(i[d]){if(0===function(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}(e))e[d]=i[d];else{for(var n,r=e.childNodes,s=!1,a=0,o=r.length;a<o;a++)3===r[a].nodeType&&/\S/.test(r[a].nodeValue)&&(s?r[a].nodeValue="":(r[a].nodeValue=i[d],s=!0));s||(n=p.createTextNode(i[d]),e.prepend(n))}delete i[d]}for(var l in i)e[l]=i[l]}else console.warn("#"+t.id+" is undefined.")}}var e,p,g,f,d,_,c,v,r;document.webL10n=(e=window,p=document,g={},d="textContent",v="loading",r=!(_=f=""),(c={}).plural=function(e,t,i,n){var r,s,t=parseFloat(t);if(isNaN(t))return e;if(n!=d)return e;function a(e,t){return-1!==t.indexOf(e)}function o(e,t,i){return t<=e&&e<=i}c._pluralRules||(c._pluralRules=(l={0:function(e){return"other"},1:function(e){return o(e%100,3,10)?"few":0===e?"zero":o(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 o(e,0,1)?"one":"other"},5:function(e){return o(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 o(e,3,6)?"few":o(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&o(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return o(e%10,2,9)&&!o(e%100,11,19)?"few":e%10!=1||o(e%100,11,19)?"other":"one"},11:function(e){return o(e%10,2,4)&&!o(e%100,12,14)?"few":e%10==0||o(e%10,5,9)||o(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return o(e,2,4)?"few":1==e?"one":"other"},13:function(e){return o(e%10,2,4)&&!o(e%100,12,14)?"few":1!=e&&o(e%10,0,1)||o(e%10,5,9)||o(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return o(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||o(e%100,2,10)?"few":o(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":o(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return o(e,2,10)?"few":o(e,0,1)?"one":"other"},20:function(e){return!o(e%10,3,4)&&e%10!=9||o(e%100,10,19)||o(e%100,70,79)||o(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||a(e%100,[12,72,92])?e%10!=1||a(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return o(e,0,1)||o(e,11,99)?"one":"other"},23:function(e){return o(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return o(e,3,10)||o(e,13,19)?"few":a(e,[2,12])?"two":a(e,[1,11])?"one":"other"}},(s={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}[(r=_).replace(/-.*$/,"")])in l?l[s]:(console.warn("plural form unknown for ["+r+"]"),function(){return"other"})));var l="["+c._pluralRules(t)+"]";return 0===t&&i+"[zero]"in g?e=g[i+"[zero]"][n]:1==t&&i+"[one]"in g?e=g[i+"[one]"][n]:2==t&&i+"[two]"in g?e=g[i+"[two]"][n]:i+l in g?e=g[i+l][n]:i+"[other]"in g&&(e=g[i+"[other]"][n]),e},{get:function(e,t,i){var n,r=e.lastIndexOf("."),s=d,r=(0<r&&(s=e.substring(r+1),e=e.substring(0,r)),i&&((n={})[s]=i),h(e,t,n));return r&&s in r?r[s]:"{{"+e+"}}"},getData:function(){return g},getText:function(){return f},getLanguage:function(){return _},setLanguage:function(e,t){i(e,function(){t&&t()})},getDirection:function(){var e=_.split("-",1)[0];return 0<=["ar","he","fa","ps","ur"].indexOf(e)?"rtl":"ltr"},translate:function(e){e=e||p.documentElement;for(var t,i=(t=e)?t.querySelectorAll("*[data-l10n-id]"):[],n=i.length,r=0;r<n;r++)s(i[r]);s(e)},getReadyState:function(){return v},ready:function(t){t&&("complete"==v||"interactive"==v?e.setTimeout(function(){t()}):p.addEventListener&&p.addEventListener("localized",function e(){p.removeEventListener("localized",e),t()}))}})},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFindController=t.FindState=void 0;var h=i(2),s=i(4),a=i(11);const r={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},E=(t.FindState=r,{"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"}),d=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let n;const o=/\p{M}+/gu,c=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,l=/([^\p{M}])\p{M}*$/u,u=/^\p{M}*([^\p{M}])/u,w=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,S=new Map,L=new Map;let M=null,C=null;function p(e){const p=[];let i;for(;null!==(i=w.exec(e));){let t=i["index"];for(const s of i[0]){let e=S.get(s);e||(e=s.normalize("NFD").length,S.set(s,e)),p.push([e,t++])}}let t;var n;t=0===p.length&&M?M:0<p.length&&C?C:(n=`([${Object.keys(E).join("")}])|([①-⑳Ⓐ-⓿㉄-㊿㋐-㋾＀-￯])|((?:゙|゚)\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|((?:\\p{Ideographic}|[぀-ヿ])\\n)|(\\n)`,0===p.length?M=new RegExp(n+"|(\\u0000)","gum"):C=new RegExp(n+"|([\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f])","gum"));const g=[];for(;null!==(i=o.exec(e));)g.push([i[0].length,i.index]);let r=e.normalize("NFD");const f=[[0,0]];let _=0,v=0,m=0,P=0,y=0,b=!1;return r=r.replace(t,(e,i,n,t,r,s,a,o,l,h)=>{if(h-=P,i){var i=E[i],d=i.length;for(let e=1;e<d;e++)f.push([h-m+e,m-e]);return m-=d-1,i}if(n){let e=L.get(n);e||(e=n.normalize("NFKC"),L.set(n,e));var c=e.length;for(let e=1;e<c;e++)f.push([h-m+e,m-e]);return m-=c-1,e}if(t)return b=!0,h+y===g[_]?.[1]?++_:(f.push([h-1-m+1,m-1]),--m,P+=1),f.push([h-m+1,m]),P+=1,y+=1,t.charAt(0);if(r){i=r.endsWith("\n"),n=i?r.length-2:r.length;b=!0;let t=n;h+y===g[_]?.[1]&&(t-=g[_][0],++_);for(let e=1;e<=t;e++)f.push([h-1-m+e,m-e]);return m-=t,P+=t,i?(h+=n-1,f.push([h-m+1,1+m]),m+=1,P+=1,y+=1,r.slice(0,n)):r}if(s)return t=s.length-2,f.push([h-m+t,1+m]),m+=1,P+=1,y+=1,s.slice(0,-2);if(a)return i=a.length-1,f.push([h-m+i,m]),P+=1,y+=1,a.slice(0,-1);if(o)return f.push([h-m+1,m-1]),--m,P+=1,y+=1," ";if(h+y===p[v]?.[1]){var u=p[v][0]-1;++v;for(let e=1;e<=u;e++)f.push([h-(m-e),m-e]);m-=u,P+=u}return l}),f.push([r.length,m]),[r,f,b]}t.PDFFindController=class{#updateMatchesCountOnProgress=!0;#visitedPagesCount=0;constructor({linkService:e,eventBus:t,updateMatchesCountOnProgress:i=!0}){this._linkService=e,this._eventBus=t,this.#updateMatchesCountOnProgress=i,this.#reset(),t._on("find",this.#onFind.bind(this)),t._on("findbarclose",this.#onFindBarClose.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(e){this._pdfDocument&&this.#reset(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#onFind(e){if(e){const i=this._pdfDocument,n=e["type"];null!==this._state&&!this.#shouldDirtyMatch(e)||(this._dirtyMatch=!0),this._state=e,"highlightallchange"!==n&&this.#updateUIState(r.PENDING),this._firstPageCapability.promise.then(()=>{var e,t;!this._pdfDocument||i&&this._pdfDocument!==i||(this.#extractText(),e=!this._highlightMatches,t=!!this._findTimeout,this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),n?this._dirtyMatch?this.#nextMatch():"again"===n?(this.#nextMatch(),e&&this._state.highlightAll&&this.#updateAllPages()):"highlightallchange"===n?(t?this.#nextMatch():this._highlightMatches=!0,this.#updateAllPages()):this.#nextMatch():this._findTimeout=setTimeout(()=>{this.#nextMatch(),this._findTimeout=null},250))})}}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:n=-1}){this._scrollMatches&&e&&-1!==n&&n===this._selected.matchIdx&&-1!==i&&i===this._selected.pageIdx&&(this._scrollMatches=!1,h.scrollIntoView)(e,{top:-50,left:t+-400},!0)}#reset(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#visitedPagesCount=0,this._state=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],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,s.createPromiseCapability)()}get#query(){return this._state.query!==this._rawQuery&&(this._rawQuery=this._state.query,[this._normalizedQuery]=p(this._state.query)),this._normalizedQuery}#shouldDirtyMatch(e){if(e.query!==this._state.query)return!0;switch(e.type){case"again":var t=this._selected.pageIdx+1;const i=this._linkService;return 1<=t&&t<=i.pagesCount&&t!==i.page&&!i.isPageVisible(t)?!0:!1;case"highlightallchange":return!1}return!0}#isEntireWord(e,t,i){let n=e.slice(0,t).match(l);if(n){var r=e.charCodeAt(t),s=n[1].charCodeAt(0);if((0,a.getCharacterType)(r)===(0,a.getCharacterType)(s))return!1}if(n=e.slice(t+i).match(u)){r=e.charCodeAt(t+i-1),s=n[1].charCodeAt(0);if((0,a.getCharacterType)(r)===(0,a.getCharacterType)(s))return!1}return!0}#calculateRegExpMatch(e,t,i,n){const r=this._pageMatches[i]=[],s=this._pageMatchesLength[i]=[];if(e)for(var a,o,l=this._pageDiffs[i];null!==(a=e.exec(n));)t&&!this.#isEntireWord(n,a.index,a[0].length)||([a,o]=function(e,t,i){if(!e)return[t,i];const n=t,r=t+i;let s=(0,h.binarySearchFirstItem)(e,e=>e[0]>=n),a=(e[s][0]>n&&--s,(0,h.binarySearchFirstItem)(e,e=>e[0]>=r,s));return e[a][0]>r&&--a,[n+e[s][1],i+e[a][1]-e[s][1]]}(l,a.index,a[0].length),o&&(r.push(a),s.push(o)))}#convertToRegExpString(e,a){const o=this._state["matchDiacritics"];let l=!1;return(e=e.replaceAll(c,(e,t,i,n,r,s)=>t?`[ ]*\\${t}[ ]*`:i?`[ ]*${i}[ ]*`:n?"[ ]+":o?r||s:r?d.has(r.charCodeAt(0))?r:"":a?(l=!0,s+"\\p{M}*"):s)).endsWith("[ ]*")&&(e=e.slice(0,e.length-"[ ]*".length)),o&&a&&(n||=String.fromCharCode(...d),l=!0,e=`${e}(?=[${n}]|[^\\p{M}]|$)`),[l,e]}#calculateMatch(e){let t=this.#query;if(t){var{caseSensitive:n,entireWord:r,phraseSearch:s}=this._state,a=this._pageContents[e];const o=this._hasDiacritics[e];let i=!1;if(s)[i,t]=this.#convertToRegExpString(t,o);else{const l=t.match(/\S+/g);l&&(t=l.sort().reverse().map(e=>{var[e,t]=this.#convertToRegExpString(e,o);return i||=e,`(${t})`}).join("|"))}s="g"+(i?"u":"")+(n?"":"i"),n=(t=t?new RegExp(t,s):null,this.#calculateRegExpMatch(t,r,e,a),this._state.highlightAll&&this.#updatePage(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#nextPageMatch()),this._pageMatches[e].length);this._matchesCountTotal+=n,this.#updateMatchesCountOnProgress?0<n&&this.#updateUIResultsCount():++this.#visitedPagesCount===this._linkService.pagesCount&&this.#updateUIResultsCount()}}#extractText(){if(!(0<this._extractTextPromises.length)){let t=Promise.resolve();for(let n=0,e=this._linkService.pagesCount;n<e;n++){const r=(0,s.createPromiseCapability)();this._extractTextPromises[n]=r.promise,t=t.then(()=>this._pdfDocument.getPage(n+1).then(e=>e.getTextContent()).then(e=>{const t=[];for(const i of e.items)t.push(i.str),i.hasEOL&&t.push("\n");[this._pageContents[n],this._pageDiffs[n],this._hasDiacritics[n]]=p(t.join("")),r.resolve()},e=>{console.error("Unable to get text content for page "+(n+1),e),this._pageContents[n]="",this._pageDiffs[n]=null,this._hasDiacritics[n]=!1,r.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(){var e=this._state.findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,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.#visitedPagesCount=0,this._matchesCountTotal=0,this.#updateAllPages();for(let e=0;e<i;e++)this._pendingFindMatches.has(e)||(this._pendingFindMatches.add(e),this._extractTextPromises[e].then(()=>{this._pendingFindMatches.delete(e),this.#calculateMatch(e)}))}if(this.#query){if(!this._resumePageIdx){const n=this._offset;if(this._pagesToSearch=i,null!==n.matchIdx){t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+1<t||e&&0<n.matchIdx)return n.matchIdx=e?n.matchIdx-1:n.matchIdx+1,void this.#updateMatch(!0);this.#advanceOffsetPage(e)}this.#nextPageMatch()}}else this.#updateUIState(r.FOUND)}#matchesReady(e){const t=this._offset;var e=e.length,i=this._state.findPrevious;return e?(t.matchIdx=i?e-1:0,this.#updateMatch(!0),!0):(this.#advanceOffsetPage(i),!!(t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0))&&(this.#updateMatch(!1),!0))}#nextPageMatch(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{var t=this._offset.pageIdx;if(!(e=this._pageMatches[t])){this._resumePageIdx=t;break}}while(!this.#matchesReady(e))}#advanceOffsetPage(e){const t=this._offset;var i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=i||t.pageIdx<0)&&(t.pageIdx=e?i-1:0,t.wrapped=!0)}#updateMatch(e=!1){let t=r.NOT_FOUND;var i=this._offset.wrapped;this._offset.wrapped=!1,e&&(e=this._selected.pageIdx,this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=i?r.WRAPPED:r.FOUND,-1!==e&&e!==this._selected.pageIdx&&this.#updatePage(e)),this.#updateUIState(t,this._state.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#updatePage(this._selected.pageIdx))}#onFindBarClose(e){const t=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#updateUIState(r.FOUND),this._highlightMatches=!1,this.#updateAllPages())})}#requestMatchesCount(){var{pageIdx:t,matchIdx:e}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==e){for(let e=0;e<t;e++)i+=this._pageMatches[e]?.length||0;i+=e+1}return{current:i=i<1||i>n?n=0:i,total:n}}#updateUIResultsCount(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#requestMatchesCount()})}#updateUIState(e,t=!1){(this.#updateMatchesCountOnProgress||this.#visitedPagesCount===this._linkService.pagesCount&&e!==r.PENDING)&&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.CharacterType=void 0,t.getCharacterType=function(e){if(e<11904)return 0==(65408&e)?function(e){return 32===e||9===e||13===e||10===e}(e)?i.SPACE:function(e){return 97<=e&&e<=122||65<=e&&e<=90}(e)||function(e){return 48<=e&&e<=57}(e)||95===e?i.ALPHA_LETTER:i.PUNCT:3584==(65408&e)?i.THAI_LETTER:160===e?i.SPACE:i.ALPHA_LETTER;{if(function(e){return 13312<=e&&e<=40959||63744<=e&&e<=64255}(e))return i.HAN_LETTER;if(function(e){return 12448<=e&&e<=12543}(e))return i.KATAKANA_LETTER;if(function(e){return 12352<=e&&e<=12447}(e))return i.HIRAGANA_LETTER;if(function(e){return 65376<=e&&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,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFHistory=void 0,t.isDestArraysEqual=l,t.isDestHashesEqual=r;var s=i(2),a=i(7);function o(){return document.location.hash}function r(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||(0,s.parseQueryString)(e).get("nameddest")===t)}function l(i,n){if(!Array.isArray(i)||!Array.isArray(n))return!1;if(i.length!==n.length)return!1;for(let e=0,t=i.length;e<t;e++)if(!function e(t,i){if(typeof t==typeof i&&!Array.isArray(t)&&!Array.isArray(i)){if(null===t||"object"!=typeof t||null===i)return t===i||Number.isNaN(t)&&Number.isNaN(i);if(Object.keys(t).length===Object.keys(i).length){for(const n in t)if(!e(t[n],i[n]))return;return 1}}}(i[e],n[e]))return!1;return!0}t.PDFHistory=class{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){this._initialized&&this.reset();var n,r,s=""!==this._fingerprint&&this._fingerprint!==e,e=(this._fingerprint=e,this._updateUrl=!0===i,this._initialized=!0,this._bindEvents(),window.history.state);if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=o(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this._isValidState(e,!0)||t)return{hash:i,page:n,rotation:r}=this._parseCurrentHash(!0),!i||s||t?void this._pushOrReplaceState(null,!0):void this._pushOrReplaceState({hash:i,page:n,rotation:r},!0);s=e.destination;this._updateInternalState(s,e.uid,!0),void 0!==s.rotation&&(this._initialRotation=s.rotation),s.dest?(this._initialBookmark=JSON.stringify(s.dest),this._destination.page=null):s.hash?this._initialBookmark=s.hash:s.page&&(this._initialBookmark="page="+s.page)}else console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.')}reset(){this._initialized&&(this._pageHide(),this._initialized=!1,this._unbindEvents()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:t=null,explicitDest:i,pageNumber:n}){if(this._initialized)if(t&&"string"!=typeof t)console.error("PDFHistory.push: "+`"${t}" is not a valid namedDest parameter.`);else if(Array.isArray(i))if(this._isValidPage(n)||null===n&&!this._destination){t=t||JSON.stringify(i);if(t){let e=!1;if(this._destination&&(r(this._destination.hash,t)||l(this._destination.dest,i))){if(this._destination.page)return;e=!0}this._popStateInProgress&&!e||(this._pushOrReplaceState({dest:i,hash:t,page:n,rotation:this.linkService.rotation},e),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}}else console.error("PDFHistory.push: "+`"${n}" is not a valid pageNumber parameter.`);else console.error("PDFHistory.push: "+`"${i}" is not a valid explicitDest parameter.`)}pushPage(e){this._initialized&&(this._isValidPage(e)?this._destination?.page===e||this._popStateInProgress||(this._pushOrReplaceState({dest:null,hash:"page="+e,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))):console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){var e;this._initialized&&!this._popStateInProgress&&(e=window.history.state,this._isValidState(e)&&0<e.uid&&window.history.back())}forward(){var e;this._initialized&&!this._popStateInProgress&&(e=window.history.state,this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward())}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||0<this._blockHashChange)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){var t=t||!this._destination,i={fingerprint:this._fingerprint,uid:t?this._uid:this._uid+1,destination:e};this._updateInternalState(e,i.uid);let n;if(this._updateUrl&&e?.hash){const r=document.location.href.split("#")[0];r.startsWith("file://")||(n=r+"#"+e.hash)}t?window.history.replaceState(i,"",n):window.history.pushState(i,"",n)}_tryPushCurrentPosition(e=!1){if(this._position){let t=this._position;if(e&&((t=Object.assign(Object.create(null),this._position)).temporary=!0),this._destination){if(this._destination.temporary)this._pushOrReplaceState(t,!0);else if(this._destination.hash!==t.hash&&(this._destination.page||!(this._numPositionUpdates<=50))){let e=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;e=!0}this._pushOrReplaceState(t,e)}}else this._pushOrReplaceState(t)}}_isValidPage(e){return Number.isInteger(e)&&0<e&&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;var[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){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){var t=unescape(o()).substring(1);const i=(0,s.parseQueryString)(t);var n=i.get("nameddest")||"";let r=0|i.get("page");return{hash:t,page:r=!this._isValidPage(r)||e&&0<n.length?null:r,rotation:this.linkService.rotation}}_updateViewarea({location:e}){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},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}){var t,i,n=o(),r=this._currentHash!==n;if(this._currentHash=n,!e)return this._uid++,{hash:n,page:t,rotation:i}=this._parseCurrentHash(),void this._pushOrReplaceState({hash:n,page:t,rotation:i},!0);this._isValidState(e)&&(this._popStateInProgress=!0,r&&(this._blockHashChange++,(0,a.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then(()=>{this._blockHashChange--})),n=e.destination,this._updateInternalState(n,e.uid,!0),(0,s.isValidRotation)(n.rotation)&&(this.linkService.rotation=n.rotation),n.dest?this.linkService.goToDestination(n.dest):n.hash?this.linkService.setHash(n.hash):n.page&&(this.linkService.page=n.page),Promise.resolve().then(()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){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(){this._boundEvents&&(this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea),window.removeEventListener("popstate",this._boundEvents.popState),window.removeEventListener("pagehide",this._boundEvents.pageHide),this._boundEvents=null)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPageView=void 0;var g=i(4),f=i(2),u=i(14),p=i(3),n=i(15),s=i(5),r=i(1),a=i(16),_=i(17),o=i(18),v=i(19),m=i(20);const l=n.compatibilityParams.maxCanvasPixels||16777216,h=()=>({annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new r.SimpleLinkService}});t.PDFPageView=class{#annotationMode=g.AnnotationMode.ENABLE_FORMS;#layerProperties=null;#loadingId=null;#previousRotation=null;#renderingState=f.RenderingStates.INITIAL;#useThumbnailCanvas={initialOptionalContent:!0,regularAnnotations:!0};constructor(e){const t=e.container;var i=e.defaultViewport;this.id=e.id,this.renderingId="page"+this.id,this.#layerProperties=e.layerProperties||h,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||f.DEFAULT_SCALE,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,this.hasRestrictedScaling=!1,this.textLayerMode=e.textLayerMode??f.TextLayerMode.ENABLE,this.#annotationMode=e.annotationMode??g.AnnotationMode.ENABLE_FORMS,this.imageResourcesPath=e.imageResourcesPath||"",this.useOnlyCssZoom=e.useOnlyCssZoom||!1,this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0,this.maxCanvasPixels=e.maxCanvasPixels||l,this.pageColors=e.pageColors||null,this.eventBus=e.eventBus,this.renderingQueue=e.renderingQueue,this.renderer=e.renderer||f.RendererType.CANVAS,this.l10n=e.l10n||s.NullL10n,this.paintTask=null,this.paintedViewportMap=new WeakMap,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 n=document.createElement("div");if(n.className="page",n.setAttribute("data-page-number",this.id),n.setAttribute("role","region"),this.l10n.get("page_landmark",{page:this.id}).then(e=>{n.setAttribute("aria-label",e)}),this.div=n,this.#setDimensions(),t?.append(n),this._isStandalone){t?.style.setProperty("--scale-factor",this.scale*g.PixelsPerInch.PDF_TO_CSS_UNITS);const r=e["optionalContentConfigPromise"];r&&r.then(e=>{r===this._optionalContentConfigPromise&&(this.#useThumbnailCanvas.initialOptionalContent=e.hasInitialVisibility)})}}get renderingState(){return this.#renderingState}set renderingState(e){if(e!==this.#renderingState)switch(this.#renderingState=e,this.#loadingId&&(clearTimeout(this.#loadingId),this.#loadingId=null),e){case f.RenderingStates.PAUSED:this.div.classList.remove("loading");break;case f.RenderingStates.RUNNING:this.div.classList.add("loadingIcon"),this.#loadingId=setTimeout(()=>{this.div.classList.add("loading"),this.#loadingId=null},0);break;case f.RenderingStates.INITIAL:case f.RenderingStates.FINISHED:this.div.classList.remove("loadingIcon","loading")}}#setDimensions(){var e=this["viewport"];if(this.pdfPage){if(this.#previousRotation===e.rotation)return;this.#previousRotation=e.rotation}(0,g.setLayerDimensions)(this.div,e,!0,!1)}setPdfPage(e){this.pdfPage=e,this.pdfPageRotate=e.rotate;var t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*g.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t}),this.#setDimensions(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}get _textHighlighter(){return(0,g.shadow)(this,"_textHighlighter",new o.TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#layerProperties().findController}))}async#renderAnnotationLayer(){let t=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(e){console.error(`#renderAnnotationLayer: "${e}".`),t=e}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:t})}}async#renderAnnotationEditorLayer(){let t=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(e){console.error(`#renderAnnotationEditorLayer: "${e}".`),t=e}finally{this.eventBus.dispatch("annotationeditorlayerrendered",{source:this,pageNumber:this.id,error:t})}}async#renderXfaLayer(){let t=null;try{var e=await this.xfaLayer.render(this.viewport,"display");e?.textDivs&&this._textHighlighter&&this.#buildXfaTextContentItems(e.textDivs)}catch(e){console.error(`#renderXfaLayer: "${e}".`),t=e}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:t})}}async#renderTextLayer(){const{pdfPage:e,textLayer:i,viewport:n}=this;if(i){let t=null;try{var r;i.renderingDone||(r=e.streamTextContent({includeMarkedContent:!0}),i.setTextContentSource(r)),await i.render(n)}catch(e){if(e instanceof g.AbortException)return;console.error(`#renderTextLayer: "${e}".`),t=e}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.id,numTextDivs:i.numTextDivs,error:t}),this.#renderStructTreeLayer()}}async#renderStructTreeLayer(){var e;this.textLayer&&(this.structTreeLayer||=new a.StructTreeLayerBuilder,e=await(this.structTreeLayer.renderingDone?null:this.pdfPage.getStructTree()),(e=this.structTreeLayer?.render(e))&&this.canvas?.append(e),this.structTreeLayer?.show())}async#buildXfaTextContentItems(e){const t=[];for(const i of(await this.pdfPage.getTextContent()).items)t.push(i.str);this._textHighlighter.setTextMapping(e,t),this._textHighlighter.enable()}_resetZoomLayer(e=!1){if(this.zoomLayer){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,keepTextLayer:r=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:i,keepXfaLayer:n,keepTextLayer:r}),this.renderingState=f.RenderingStates.INITIAL;const s=this.div;var a=s.childNodes,o=e&&this.zoomLayer||null,l=t&&this.annotationLayer?.div||null,h=i&&this.annotationEditorLayer?.div||null,d=n&&this.xfaLayer?.div||null,c=r&&this.textLayer?.div||null;for(let e=a.length-1;0<=e;e--){const u=a[e];switch(u){case o:case l:case h:case d:case c:continue}u.remove()}s.removeAttribute("data-loaded"),l&&this.annotationLayer.hide(),h&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),c&&this.textLayer.hide(),this.structTreeLayer?.hide(),o||(this.canvas&&(this.paintedViewportMap.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer()),this.svg&&(this.paintedViewportMap.delete(this.svg),delete this.svg)}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null,drawingDelay:n=-1}){this.scale=e||this.scale,"number"==typeof t&&(this.rotation=t),i instanceof Promise&&(this._optionalContentConfigPromise=i).then(e=>{i===this._optionalContentConfigPromise&&(this.#useThumbnailCanvas.initialOptionalContent=e.hasInitialVisibility)});e=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*g.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:e}),this.#setDimensions(),this._isStandalone&&this.div.parentNode?.style.setProperty("--scale-factor",this.viewport.scale),this.svg)return this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!0}),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});let r=!1;this.canvas&&0<this.maxCanvasPixels&&(t=this.outputScale,(Math.floor(this.viewport.width)*t.sx|0)*(Math.floor(this.viewport.height)*t.sy|0)>this.maxCanvasPixels&&(r=!0));e=this.useOnlyCssZoom||this.hasRestrictedScaling&&r,t=!e&&0<=n&&n<1e3;if(this.canvas){if(t||e)return t&&this.renderingState!==f.RenderingStates.FINISHED&&(this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n}),this.renderingState=f.RenderingStates.FINISHED),this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t}),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});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,keepTextLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:r=0}={}){this.paintTask&&(this.paintTask.cancel(r),this.paintTask=null),this.resume=null,!this.textLayer||n&&this.textLayer.div||(this.textLayer.cancel(),this.textLayer=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),!this.annotationLayer||e&&this.annotationLayer.div||(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),!this.annotationEditorLayer||t&&this.annotationEditorLayer.div||(this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),!this.xfaLayer||i&&this.xfaLayer.div||(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({target:i,redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:t=!1,redrawXfaLayer:n=!1,redrawTextLayer:r=!1,hideTextLayer:s=!1}){if(i instanceof HTMLCanvasElement){if(!i.hasAttribute("zooming")){i.setAttribute("zooming",!0);const h=i["style"];h.width=h.height=""}}else{const d=this.div;var{width:a,height:o}=this.viewport;i.style.width=i.parentNode.style.width=d.style.width=Math.floor(a)+"px",i.style.height=i.parentNode.style.height=d.style.height=Math.floor(o)+"px"}a=this.paintedViewportMap.get(i);if(this.viewport!==a){var l,o=this.viewport.rotation-a.rotation,a=Math.abs(o);let e=1,t=1;90!==a&&270!==a||({width:a,height:l}=this.viewport,e=l/a,t=a/l),i.style.transform=`rotate(${o}deg) scale(${e}, ${t})`}e&&this.annotationLayer&&this.#renderAnnotationLayer(),t&&this.annotationEditorLayer&&this.#renderAnnotationEditorLayer(),n&&this.xfaLayer&&this.#renderXfaLayer(),this.textLayer&&(s?(this.textLayer.hide(),this.structTreeLayer?.hide()):r&&this.#renderTextLayer())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}draw(){this.renderingState!==f.RenderingStates.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:t,pdfPage:i}=this;if(!i)return this.renderingState=f.RenderingStates.FINISHED,Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=f.RenderingStates.RUNNING;const e=document.createElement("div");var n,r,s;e.classList.add("canvasWrapper"),t.append(e),this.textLayer||this.textLayerMode===f.TextLayerMode.DISABLE||i.isPureXfa||(this._accessibilityManager||=new _.TextAccessibilityManager,this.textLayer=new v.TextLayerBuilder({highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported}),t.append(this.textLayer.div)),this.annotationLayer||this.#annotationMode===g.AnnotationMode.DISABLE||({annotationStorage:c,downloadManager:d,enableScripting:n,fieldObjectsPromise:r,hasJSActionsPromise:s,linkService:h}=this.#layerProperties(),this._annotationCanvasMap||=new Map,this.annotationLayer=new p.AnnotationLayerBuilder({pageDiv:t,pdfPage:i,annotationStorage:c,imageResourcesPath:this.imageResourcesPath,renderForms:this.#annotationMode===g.AnnotationMode.ENABLE_FORMS,linkService:h,downloadManager:d,l10n:this.l10n,enableScripting:n,hasJSActionsPromise:s,fieldObjectsPromise:r,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager}));let a=null;this.renderingQueue&&(a=e=>{if(!this.renderingQueue.isHighestPriority(this))return this.renderingState=f.RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=f.RenderingStates.RUNNING,e()});e()});const o=async(e=null)=>{if(l===this.paintTask&&(this.paintTask=null),e instanceof g.RenderingCancelledException)this._renderError=null;else if(this._renderError=e,this.renderingState=f.RenderingStates.FINISHED,this._resetZoomLayer(!0),this.#useThumbnailCanvas.regularAnnotations=!l.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError}),e)throw e},l=this.renderer===f.RendererType.SVG?this.paintOnSvg(e):this.paintOnCanvas(e);l.onRenderContinue=a;var h,d,c=(this.paintTask=l).promise.then(()=>o(null).then(async()=>{if(this.#renderTextLayer(),this.annotationLayer&&await this.#renderAnnotationLayer(),!this.annotationEditorLayer){var e=this.#layerProperties()["annotationEditorUIManager"];if(!e)return;this.annotationEditorLayer=new u.AnnotationEditorLayerBuilder({uiManager:e,pageDiv:t,pdfPage:i,l10n:this.l10n,accessibilityManager:this._accessibilityManager})}this.#renderAnnotationEditorLayer()}),function(e){return o(e)});return i.isPureXfa&&(this.xfaLayer?this.xfaLayer.div&&t.append(this.xfaLayer.div):({annotationStorage:h,linkService:d}=this.#layerProperties(),this.xfaLayer=new m.XfaLayerBuilder({pageDiv:t,pdfPage:i,annotationStorage:h,linkService:d})),this.#renderXfaLayer()),t.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),c}paintOnCanvas(e){const t=(0,g.createPromiseCapability)(),i={promise:t.promise,onRenderContinue(e){e()},cancel(e=0){p.cancel(e)},get separateAnnots(){return p.separateAnnots}},n=this.viewport;var{width:r,height:s}=n;const a=document.createElement("canvas");a.setAttribute("role","presentation");let o=a.hidden=!0;function l(e){!o||h&&!e||(a.hidden=!1,o=!1)}const h=!(!this.pageColors?.background||!this.pageColors?.foreground);e.append(a);e=(this.canvas=a).getContext("2d",{alpha:!1});const d=this.outputScale=new f.OutputScale;this.useOnlyCssZoom&&(u=n.clone({scale:g.PixelsPerInch.PDF_TO_CSS_UNITS}),d.sx*=u.width/r,d.sy*=u.height/s),0<this.maxCanvasPixels&&(u=Math.sqrt(this.maxCanvasPixels/(r*s)),d.sx>u||d.sy>u?(d.sx=u,d.sy=u,this.hasRestrictedScaling=!0):this.hasRestrictedScaling=!1);r=(0,f.approximateFraction)(d.sx),s=(0,f.approximateFraction)(d.sy);a.width=(0,f.roundToDivide)(n.width*d.sx,r[0]),a.height=(0,f.roundToDivide)(n.height*d.sy,s[0]);const c=a["style"];c.width=(0,f.roundToDivide)(n.width,r[1])+"px",c.height=(0,f.roundToDivide)(n.height,s[1])+"px",this.paintedViewportMap.set(a,n);var u={canvasContext:e,transform:d.scaled?[d.sx,0,0,d.sy,0,0]:null,viewport:n,annotationMode:this.#annotationMode,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors};const p=this.pdfPage.render(u);return p.onContinue=function(e){l(!1),i.onRenderContinue?i.onRenderContinue(e):e()},p.promise.then(function(){l(!0),t.resolve()},function(e){e instanceof g.RenderingCancelledException||l(!0),t.reject(e)}),i}paintOnSvg(i){let e=!1;const n=()=>{if(e)throw new g.RenderingCancelledException("Rendering cancelled, page "+this.id,"svg")},r=this.pdfPage,s=this.viewport.clone({scale:g.PixelsPerInch.PDF_TO_CSS_UNITS});return{promise:r.getOperatorList({annotationMode:this.#annotationMode}).then(e=>{n();const t=new g.SVGGraphics(r.commonObjs,r.objs);return t.getSVG(e,s).then(e=>{n(),this.svg=e,this.paintedViewportMap.set(e,s),e.style.width=i.style.width,e.style.height=i.style.height,this.renderingState=f.RenderingStates.FINISHED,i.append(e)})}),onRenderContinue(e){e()},cancel(){e=!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")}get thumbnailCanvas(){var{initialOptionalContent:e,regularAnnotations:t}=this.#useThumbnailCanvas;return e&&t?this.canvas:null}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayerBuilder=void 0;var n=i(4),r=i(5);t.AnnotationEditorLayerBuilder=class{#uiManager;constructor(e){this.pageDiv=e.pageDiv,this.pdfPage=e.pdfPage,this.accessibilityManager=e.accessibilityManager,this.l10n=e.l10n||r.NullL10n,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#uiManager=e.uiManager}async render(e,t="display"){if("display"===t&&!this._cancelled){e=e.clone({dontFlip:!0});if(this.div)return this.annotationEditorLayer.update({viewport:e}),void this.show();const i=this.div=document.createElement("div");i.className="annotationEditorLayer",i.tabIndex=0,i.hidden=!0,this.pageDiv.append(i),this.annotationEditorLayer=new n.AnnotationEditorLayer({uiManager:this.#uiManager,div:i,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:e});e={viewport:e,div:i,annotations:null,intent:t};this.annotationEditorLayer.render(e),this.show()}}cancel(){this._cancelled=!0,this.div&&(this.pageDiv=null,this.annotationEditorLayer.destroy(),this.div.remove())}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&!this.annotationEditorLayer.isEmpty&&(this.div.hidden=!1)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compatibilityParams=t.OptionKind=t.AppOptions=void 0;const a=Object.create(null);t.compatibilityParams=a;{var i=navigator.userAgent||"",n=navigator.platform||"",r=navigator.maxTouchPoints||1;const d=/Android/.test(i),c=/\b(iPad|iPhone|iPod)(?=;)/.test(i)||"MacIntel"===n&&1<r;(c||d)&&(a.maxCanvasPixels=5242880)}const o={VIEWER:2,API:4,WORKER:8,PREFERENCE:128},l={annotationEditorMode:{value:0,kind:(t.OptionKind=o).VIEWER+o.PREFERENCE},annotationMode:{value:2,kind:o.VIEWER+o.PREFERENCE},cursorToolOnLoad:{value:0,kind:o.VIEWER+o.PREFERENCE},defaultZoomDelay:{value:400,kind:o.VIEWER+o.PREFERENCE},defaultZoomValue:{value:"",kind:o.VIEWER+o.PREFERENCE},disableHistory:{value:!1,kind:o.VIEWER},disablePageLabels:{value:!1,kind:o.VIEWER+o.PREFERENCE},enablePermissions:{value:!1,kind:o.VIEWER+o.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:o.VIEWER+o.PREFERENCE},enableScripting:{value:!0,kind:o.VIEWER+o.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:o.VIEWER},externalLinkTarget:{value:0,kind:o.VIEWER+o.PREFERENCE},historyUpdateUrl:{value:!1,kind:o.VIEWER+o.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:o.VIEWER+o.PREFERENCE},imageResourcesPath:{value:"./images/",kind:o.VIEWER},maxCanvasPixels:{value:16777216,kind:o.VIEWER},forcePageColors:{value:!1,kind:o.VIEWER+o.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:o.VIEWER+o.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:o.VIEWER+o.PREFERENCE},pdfBugEnabled:{value:!1,kind:o.VIEWER+o.PREFERENCE},printResolution:{value:150,kind:o.VIEWER},sidebarViewOnLoad:{value:-1,kind:o.VIEWER+o.PREFERENCE},scrollModeOnLoad:{value:-1,kind:o.VIEWER+o.PREFERENCE},spreadModeOnLoad:{value:-1,kind:o.VIEWER+o.PREFERENCE},textLayerMode:{value:1,kind:o.VIEWER+o.PREFERENCE},useOnlyCssZoom:{value:!1,kind:o.VIEWER+o.PREFERENCE},viewerCssTheme:{value:0,kind:o.VIEWER+o.PREFERENCE},viewOnLoad:{value:0,kind:o.VIEWER+o.PREFERENCE},cMapPacked:{value:!0,kind:o.API},cMapUrl:{value:"../web/cmaps/",kind:o.API},disableAutoFetch:{value:!1,kind:o.API+o.PREFERENCE},disableFontFace:{value:!1,kind:o.API+o.PREFERENCE},disableRange:{value:!1,kind:o.API+o.PREFERENCE},disableStream:{value:!1,kind:o.API+o.PREFERENCE},docBaseUrl:{value:"",kind:o.API},enableXfa:{value:!0,kind:o.API+o.PREFERENCE},fontExtraProperties:{value:!1,kind:o.API},isEvalSupported:{value:!0,kind:o.API},isOffscreenCanvasSupported:{value:!0,kind:o.API},maxImageSize:{value:-1,kind:o.API},pdfBug:{value:!1,kind:o.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:o.API},verbosity:{value:1,kind:o.API},workerPort:{value:null,kind:o.WORKER},workerSrc:{value:"../build/pdf.worker.js",kind:o.WORKER}},h=(l.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:o.VIEWER},l.disablePreferences={value:!1,kind:o.VIEWER},l.locale={value:navigator.language||"en-US",kind:o.VIEWER},l.renderer={value:"canvas",kind:o.VIEWER+o.PREFERENCE},l.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:o.VIEWER},Object.create(null));class s{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){var t=h[e];if(void 0!==t)return t;t=l[e];return void 0!==t?a[e]??t.value:void 0}static getAll(e=null){const t=Object.create(null);for(const s in l){var i=l[s];if(e){if(0==(e&i.kind))continue;if(e===o.PREFERENCE){var n=i.value,r=typeof n;if("boolean"==r||"string"==r||"number"==r&&Number.isInteger(n)){t[s]=n;continue}throw new Error("Invalid type for preference: "+s)}}r=h[s];t[s]=void 0!==r?r:a[s]??i.value}return t}static set(e,t){h[e]=t}static setAll(e){for(const t in e)h[t]=e[t]}static remove(e){delete h[e]}}(t.AppOptions=s)._hasUserOptions=function(){return 0<Object.keys(h).length}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StructTreeLayerBuilder=void 0;const s={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},a=/^H(\d+)$/;t.StructTreeLayerBuilder=class{#treeDom=void 0;get renderingDone(){return void 0!==this.#treeDom}render(e){if(void 0!==this.#treeDom)return this.#treeDom;const t=this.#walk(e);return t?.classList.add("structTree"),this.#treeDom=t}hide(){this.#treeDom&&!this.#treeDom.hidden&&(this.#treeDom.hidden=!0)}show(){this.#treeDom?.hidden&&(this.#treeDom.hidden=!1)}#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 n=e["role"];var i=n.match(a);i?(t.setAttribute("role","heading"),t.setAttribute("aria-level",i[1])):s[n]&&t.setAttribute("role",s[n])}if(this.#setAttributes(e,t),e.children)if(1===e.children.length&&"id"in e.children[0])this.#setAttributes(e.children[0],t);else for(const r of e.children)t.append(this.#walk(r));return t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextAccessibilityManager=void 0;var a=i(2);class o{#enabled=!1;#textChildren=null;#textNodes=new Map;#waitingElements=new Map;setTextMapping(e){this.#textChildren=e}static#compareElementPositions(e,t){e=e.getBoundingClientRect(),t=t.getBoundingClientRect();if(0===e.width&&0===e.height)return 1;if(0===t.width&&0===t.height)return-1;var i=e.y,n=e.y+e.height,r=e.y+e.height/2,s=t.y,a=t.y+t.height,o=t.y+t.height/2;return r<=s&&n<=o?-1:o<=i&&a<=r?1:e.x+e.width/2-(t.x+t.width/2)}enable(){if(this.#enabled)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#textChildren)throw new Error("Text divs and strings have not been set.");if(this.#enabled=!0,this.#textChildren=this.#textChildren.slice(),this.#textChildren.sort(o.#compareElementPositions),0<this.#textNodes.size){var e,t,i=this.#textChildren;for([e,t]of this.#textNodes)document.getElementById(e)?this.#addIdToAriaOwns(e,i[t]):this.#textNodes.delete(e)}for(var[n,r]of this.#waitingElements)this.addPointerInTextLayer(n,r);this.#waitingElements.clear()}disable(){this.#enabled&&(this.#waitingElements.clear(),this.#textChildren=null,this.#enabled=!1)}removePointerInTextLayer(e){if(this.#enabled){var t=this.#textChildren;if(t&&0!==t.length){const n=e["id"];var i=this.#textNodes.get(n);if(void 0!==i){const r=t[i];this.#textNodes.delete(n);let e=r.getAttribute("aria-owns");e?.includes(n)&&((e=e.split(" ").filter(e=>e!==n).join(" "))?r.setAttribute("aria-owns",e):(r.removeAttribute("aria-owns"),r.setAttribute("role","presentation")))}}}else this.#waitingElements.delete(e)}#addIdToAriaOwns(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?i+" "+e:e),t.removeAttribute("role")}addPointerInTextLayer(t,e){var i,n,r=t["id"];r&&(this.#enabled?(e&&this.removePointerInTextLayer(t),(i=this.#textChildren)&&0!==i.length&&(n=(0,a.binarySearchFirstItem)(i,e=>o.#compareElementPositions(t,e)<0),n=Math.max(0,n-1),this.#addIdToAriaOwns(r,i[n]),this.#textNodes.set(r,n))):this.#waitingElements.set(t,e))}moveElementInDOM(e,t,i,n){if(this.addPointerInTextLayer(i,n),e.hasChildNodes()){const r=Array.from(e.childNodes).filter(e=>e!==t);if(0!==r.length){const s=i||t;n=(0,a.binarySearchFirstItem)(r,e=>o.#compareElementPositions(s,e)<0);0===n?r[0].before(t):r[n-1].after(t)}}else e.append(t)}}t.TextAccessibilityManager=o},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextHighlighter=void 0;t.TextHighlighter=class{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,this._onUpdateTextLayerMatches||(this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()},this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this._onUpdateTextLayerMatches&&(this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches),this._onUpdateTextLayerMatches=null),this._updateMatches(!0))}_convertMatches(i,n){if(!i)return[];var r=this["textContentItemsStr"];let s=0,a=0;var o=r.length-1;const l=[];for(let t=0,e=i.length;t<e;t++){let e=i[t];for(;s!==o&&e>=a+r[s].length;)a+=r[s].length,s++;s===r.length&&console.error("Could not find a matching mapping");const h={begin:{divIdx:s,offset:e-a}};for(e+=n[t];s!==o&&e>a+r[s].length;)a+=r[s].length,s++;h.end={divIdx:s,offset:e-a},l.push(h)}return l}_renderMatches(r){if(0!==r.length){const{findController:g,pageIdx:f}=this,{textContentItemsStr:_,textDivs:v}=this;var s=f===g.selected.pageIdx,a=g.selected.matchIdx,t=g.state.highlightAll;let i=null;var o={divIdx:-1,offset:void 0};let e=a,n=e+1;if(t)e=0,n=r.length;else if(!s)return;for(let t=e;t<n;t++){var l=r[t],h=l.begin,l=l.end,d=s&&t===a,c=d?" selected":"";let e=0;if(i&&h.divIdx===i.divIdx?p(i.divIdx,i.offset,h.offset):(null!==i&&p(i.divIdx,i.offset,o.offset),u(h)),h.divIdx===l.divIdx)e=p(h.divIdx,h.offset,l.offset,"highlight"+c);else{e=p(h.divIdx,h.offset,o.offset,"highlight begin"+c);for(let e=h.divIdx+1,t=l.divIdx;e<t;e++)v[e].className="highlight middle"+c;u(l,"highlight end"+c)}i=l,d&&g.scrollMatchIntoView({element:v[h.divIdx],selectedLeft:e,pageIndex:f,matchIndex:a})}function u(e,t){var i=e.divIdx;v[i].textContent="",p(i,0,e.offset,t)}function p(e,t,i,n){let r=v[e];if(r.nodeType===Node.TEXT_NODE){const s=document.createElement("span");r.before(s),s.append(r),v[e]=s,r=s}e=_[e].substring(t,i),t=document.createTextNode(e);if(n){const a=document.createElement("span");return a.className=n+" appended",a.append(t),r.append(a),n.includes("selected")?a.offsetLeft:0}return r.append(t),0}i&&p(i.divIdx,i.offset,o.offset)}}_updateMatches(e=!1){if(this.enabled||e){var{findController:t,matches:n,pageIdx:r}=this,{textContentItemsStr:s,textDivs:a}=this;let i=-1;for(const o of n){for(let e=Math.max(i,o.begin.divIdx),t=o.end.divIdx;e<=t;e++){const l=a[e];l.textContent=s[e],l.className=""}i=o.end.divIdx+1}t?.highlightMatches&&!e&&(n=t.pageMatches[r]||null,e=t.pageMatchesLength[r]||null,this.matches=this._convertMatches(n,e),this._renderMatches(this.matches))}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerBuilder=void 0;var s=i(4);t.TextLayerBuilder=class{#rotation=0;#scale=0;#textContentSource=null;constructor({highlighter:e=null,accessibilityManager:t=null,isOffscreenCanvasSupported:i=!0}){this.textContentItemsStr=[],this.renderingDone=!1,this.textDivs=[],this.textDivProperties=new WeakMap,this.textLayerRenderTask=null,this.highlighter=e,this.accessibilityManager=t,this.isOffscreenCanvasSupported=i,this.div=document.createElement("div"),this.div.className="textLayer",this.hide()}#finishRendering(){this.renderingDone=!0;const e=document.createElement("div");e.className="endOfContent",this.div.append(e),this.#bindMouse()}get numTextDivs(){return this.textDivs.length}async render(e){if(!this.#textContentSource)throw new Error('No "textContentSource" parameter specified.');var t,i,n=e.scale*(globalThis.devicePixelRatio||1),r=e["rotation"];if(this.renderingDone)return t=r!==this.#rotation,i=n!==this.#scale,(t||i)&&(this.hide(),(0,s.updateTextLayer)({container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,mustRescale:i,mustRotate:t}),this.#scale=n,this.#rotation=r),void this.show();this.cancel(),this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr),this.accessibilityManager?.setTextMapping(this.textDivs),this.textLayerRenderTask=(0,s.renderTextLayer)({textContentSource:this.#textContentSource,container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,textContentItemsStr:this.textContentItemsStr,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported}),await this.textLayerRenderTask.promise,this.#finishRendering(),this.#scale=n,this.#rotation=r,this.show(),this.accessibilityManager?.enable()}hide(){this.div.hidden||(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.renderingDone&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null),this.highlighter?.disable(),this.accessibilityManager?.disable(),this.textContentItemsStr.length=0,this.textDivs.length=0,this.textDivProperties=new WeakMap}setTextContentSource(e){this.cancel(),this.#textContentSource=e}#bindMouse(){const n=this["div"];n.addEventListener("mousedown",e=>{const t=n.querySelector(".endOfContent");var i;t&&(i=e.target!==n,(i&&="none"!==getComputedStyle(t).getPropertyValue("-moz-user-select"))&&(i=n.getBoundingClientRect(),e=Math.max(0,(e.pageY-i.top)/i.height),t.style.top=(100*e).toFixed(2)+"%"),t.classList.add("active"))}),n.addEventListener("mouseup",()=>{const e=n.querySelector(".endOfContent");e&&(e.style.top="",e.classList.remove("active"))})}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayerBuilder=void 0;var r=i(4);t.XfaLayerBuilder=class{constructor({pageDiv:e,pdfPage:t,annotationStorage:i=null,linkService:n,xfaHtml:r=null}){this.pageDiv=e,this.pdfPage=t,this.annotationStorage=i,this.linkService=n,this.xfaHtml=r,this.div=null,this._cancelled=!1}async render(e,t="display"){if("print"===t){const n={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};var i=document.createElement("div");return this.pageDiv.append(i),n.div=i,r.XfaLayer.render(n)}i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const n={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div?r.XfaLayer.update(n):(this.div=document.createElement("div"),this.pageDiv.append(this.div),n.div=this.div,r.XfaLayer.render(n))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFScriptingManager=void 0;var h=i(2),s=i(4);t.PDFScriptingManager=class{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._ready=!1,this._eventBus=e,this._sandboxBundleSrc=t,this._scriptingFactory=i,this._docPropertiesLookup=n,this._scriptingFactory||window.addEventListener("updatefromsandbox",e=>{this._eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})})}setViewer(e){this._pdfViewer=e}async setDocument(e){if(this._pdfDocument&&await this._destroyScripting(),this._pdfDocument=e){var[t,i,n]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(t||n){if(e===this._pdfDocument){try{this._scripting=this._createScripting()}catch(e){return console.error(`PDFScriptingManager.setDocument: "${e?.message}".`),void await this._destroyScripting()}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})=>{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()});for(var[r,s]of this._internalEvents)this._eventBus._on(r,s);try{var a=await this._getDocProperties();if(e!==this._pdfDocument)return;await this._scripting.createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...a,actions:n}}),this._eventBus.dispatch("sandboxcreated",{source:this})}catch(e){return console.error(`PDFScriptingManager.setDocument: "${e?.message}".`),void await this._destroyScripting()}await this._scripting?.dispatchEventInSandbox({id:"doc",name:"Open"}),await this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0),Promise.resolve().then(()=>{e===this._pdfDocument&&(this._ready=!0)})}}else await this._destroyScripting()}}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 destroyPromise(){return this._destroyCapability?.promise||null}get ready(){return this._ready}get _internalEvents(){return(0,s.shadow)(this,"_internalEvents",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){var t=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:i,siblings:n,command:r,value:s}=e;if(i){if(!t||!e.focus){delete e.id,delete e.siblings;for(const o of n?[i,...n]:[i]){const l=document.querySelector(`[data-element-id="${o}"]`);l?l.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this._pdfDocument?.annotationStorage.setValue(o,e)}}}else switch(r){case"clear":console.clear();break;case"error":console.error(s);break;case"layout":if(t)return;var a=(0,h.apiPageLayoutToViewerModes)(s);this._pdfViewer.spreadMode=a.spreadMode;break;case"page-num":this._pdfViewer.currentPageNumber=s+1;break;case"print":await this._pdfViewer.pagesPromise,this._eventBus.dispatch("print",{source:this});break;case"println":console.log(s);break;case"zoom":if(t)return;this._pdfViewer.currentScaleValue=s;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()}}async _dispatchPageOpen(t,e=!1){const i=this._pdfDocument,n=this._visitedPages;if(e&&(this._closeCapability=(0,s.createPromiseCapability)()),this._closeCapability){const r=this._pdfViewer.getPageView(t-1);r?.renderingState!==h.RenderingStates.FINISHED?this._pageOpenPending.add(t):(this._pageOpenPending.delete(t),e=(async()=>{var e=await(n.has(t)?null:r.pdfPage?.getJSActions());i===this._pdfDocument&&await this._scripting?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:t,actions:e})})(),n.set(t,e))}}async _dispatchPageClose(e){const t=this._pdfDocument,i=this._visitedPages;var n;this._closeCapability&&!this._pageOpenPending.has(e)&&(n=i.get(e))&&(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);const e=i(22)["docPropertiesLookup"];return e(this._pdfDocument)}_createScripting(){if(this._destroyCapability=(0,s.createPromiseCapability)(),this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});const e=i(22)["GenericScripting"];return new e(this._sandboxBundleSrc)}async _destroyScripting(){if(!this._scripting)return this._pdfDocument=null,void this._destroyCapability?.resolve();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(var[e,t]of this._internalEvents)this._eventBus._off(e,t);this._internalEvents.clear(),this._pageOpenPending.clear(),this._visitedPages.clear(),this._scripting=null,this._ready=!1,this._destroyCapability?.resolve()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericScripting=void 0,t.docPropertiesLookup=async function(e){var t="".split("#")[0];let{info:i,metadata:n,contentDispositionFilename:r,contentLength:s}=await e.getMetadata();{var a;s||(a=(await e.getDownloadInfo())["length"],s=a)}return{...i,baseURL:t,filesize:s,filename:r||(0,o.getPdfFilenameFromUrl)(""),metadata:n?.getRaw(),authors:n?.get("dc:creator"),numPages:e.numPages,URL:""}};var o=i(4);t.GenericScripting=class{constructor(e){this._ready=(0,o.loadScript)(e,!0).then(()=>window.pdfjsSandbox.QuickJSSandbox())}async createSandbox(e){const t=await this._ready;t.create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout(()=>t.dispatchEvent(e),0)}async destroySandbox(){const e=await this._ready;e.nukeSandbox()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFSinglePageViewer=void 0;var n=i(2);class r extends i(24).PDFViewer{_resetView(){super._resetView(),this._scrollMode=n.ScrollMode.PAGE,this._spreadMode=n.SpreadMode.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}}t.PDFSinglePageViewer=r},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PagesCountLimit=t.PDFViewer=t.PDFPageViewBuffer=void 0;var f=i(4),y=i(2),n=i(5),p=i(13),r=i(25),s=i(1);const a="enablePermissions",g={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};function _(e){return Object.values(f.AnnotationEditorType).includes(e)&&e!==f.AnnotationEditorType.DISABLE}t.PagesCountLimit=g;class o{#buf=new Set;#size=0;constructor(e){this.#size=e}push(e){const t=this.#buf;t.has(e)&&t.delete(e),t.add(e),t.size>this.#size&&this.#destroyFirstView()}resize(e,t=null){this.#size=e;const i=this.#buf;if(t){var n=i.size;let e=1;for(const r of i)if(t.has(r.id)&&(i.delete(r),i.add(r)),++e>n)break}for(;i.size>this.#size;)this.#destroyFirstView()}has(e){return this.#buf.has(e)}[Symbol.iterator](){return this.#buf.keys()}#destroyFirstView(){const e=this.#buf.keys().next().value;e?.destroy(),this.#buf.delete(e)}}t.PDFPageViewBuffer=o;t.PDFViewer=class{#buffer=null;#annotationEditorMode=f.AnnotationEditorType.NONE;#annotationEditorUIManager=null;#annotationMode=f.AnnotationMode.ENABLE_FORMS;#containerTopLeft=null;#enablePermissions=!1;#previousContainerHeight=0;#resizeObserver=new ResizeObserver(this.#resizeObserverCallback.bind(this));#scrollModePageState=null;#onVisibilityChange=null;#scaleTimeoutId=null;constructor(e){var t="3.5.141";if(f.version!==t)throw new Error(`The API version "${f.version}" does not match the Viewer version "${t}".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,"DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)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.#resizeObserver.observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new s.SimpleLinkService,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this._scriptingManager=e.scriptingManager||null,this.textLayerMode=e.textLayerMode??y.TextLayerMode.ENABLE,this.#annotationMode=e.annotationMode??f.AnnotationMode.ENABLE_FORMS,this.#annotationEditorMode=e.annotationEditorMode??f.AnnotationEditorType.NONE,this.imageResourcesPath=e.imageResourcesPath||"",this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,this.renderer=e.renderer||y.RendererType.CANVAS,this.useOnlyCssZoom=e.useOnlyCssZoom||!1,this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0,this.maxCanvasPixels=e.maxCanvasPixels,this.l10n=e.l10n||n.NullL10n,this.#enablePermissions=e.enablePermissions||!1,this.pageColors=e.pageColors||null,!this.pageColors||CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground)||((this.pageColors.background||this.pageColors.foreground)&&console.warn("PDFViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new r.PDFRenderingQueue,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue,this.scroll=(0,y.watchScroll)(this.container,this._scrollUpdate.bind(this)),this.presentationModeState=y.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.#annotationMode===f.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.");this.pdfDocument&&!this._setCurrentPageNumber(e,!0)&&console.error(`currentPageNumber: "${e}" is not a valid page.`)}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#resetCurrentPageView(),!0;if(!(0<e&&e<=this.pagesCount))return!1;var i=this._currentPageNumber;return this._currentPageNumber=e,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i}),t&&this.#resetCurrentPageView(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(t){if(this.pdfDocument){let e=0|t;var i;!this._pageLabels||0<=(i=this._pageLabels.indexOf(t))&&(e=i+1),this._setCurrentPageNumber(e,!0)||console.error(`currentPageLabel: "${t}" is not a valid page.`)}}get currentScale(){return this._currentScale!==y.UNKNOWN_SCALE?this._currentScale:y.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#setScale(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#setScale(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,y.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");var t;this.pdfDocument&&((e%=360)<0&&(e+=360),this._pagesRotation!==e&&(this._pagesRotation=e,t=this._currentPageNumber,this.refresh(!0,{rotation:e}),this._currentScaleValue&&this.#setScale(this._currentScaleValue,{noScroll:!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}#layerProperties(){const e=this;return{get annotationEditorUIManager(){return e.#annotationEditorUIManager},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}}}#initializePermissions(e){const t={annotationEditorMode:this.#annotationEditorMode,annotationMode:this.#annotationMode,textLayerMode:this.textLayerMode};return e&&(e.includes(f.PermissionFlag.COPY)||this.viewer.classList.add(a),e.includes(f.PermissionFlag.MODIFY_CONTENTS)||(t.annotationEditorMode=f.AnnotationEditorType.DISABLE),e.includes(f.PermissionFlag.MODIFY_ANNOTATIONS)||e.includes(f.PermissionFlag.FILL_INTERACTIVE_FORMS)||this.#annotationMode!==f.AnnotationMode.ENABLE_FORMS||(t.annotationMode=f.AnnotationMode.ENABLE)),t}#onePageRenderedOrForceFetch(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();var e=new Promise(e=>{this.#onVisibilityChange=()=>{"hidden"===document.visibilityState&&(e(),document.removeEventListener("visibilitychange",this.#onVisibilityChange),this.#onVisibilityChange=null)},document.addEventListener("visibilitychange",this.#onVisibilityChange)});return Promise.race([this._onePageRenderedCapability.promise,e])}setDocument(d){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#annotationEditorUIManager&&(this.#annotationEditorUIManager.destroy(),this.#annotationEditorUIManager=null)),this.pdfDocument=d){const c=d.numPages;var e=d.getPage(1);const u=d.getOptionalContentConfig();var t,i=this.#enablePermissions?d.getPermissions():Promise.resolve();c>g.FORCE_SCROLL_MODE_PAGE&&(console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document."),t=this._scrollMode=y.ScrollMode.PAGE,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t})),this._pagesCapability.promise.then(()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:c})},()=>{}),this._onBeforeDraw=e=>{e=this._pages[e.pageNumber-1];e&&this.#buffer.push(e)},this.eventBus._on("pagerender",this._onBeforeDraw),this._onAfterDraw=e=>{e.cssTransform||this._onePageRenderedCapability.settled||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null,this.#onVisibilityChange&&(document.removeEventListener("visibilitychange",this.#onVisibilityChange),this.#onVisibilityChange=null))},this.eventBus._on("pagerendered",this._onAfterDraw),Promise.all([e,i]).then(([e,t])=>{if(d===this.pdfDocument){this._firstPageCapability.resolve(e),this._optionalContentConfigPromise=u;var{annotationEditorMode:t,annotationMode:i,textLayerMode:n}=this.#initializePermissions(t),r=(t!==f.AnnotationEditorType.DISABLE&&(t=t,d.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):_(t)?(this.#annotationEditorUIManager=new f.AnnotationEditorUIManager(this.container,this.eventBus,d?.annotationStorage),t!==f.AnnotationEditorType.NONE&&this.#annotationEditorUIManager.updateMode(t)):console.error("Invalid AnnotationEditor mode: "+t)),this.#layerProperties.bind(this)),s=this._scrollMode===y.ScrollMode.PAGE?null:this.viewer,a=this.currentScale;const l=e.getViewport({scale:a*f.PixelsPerInch.PDF_TO_CSS_UNITS});this.viewer.style.setProperty("--scale-factor",l.scale);for(let e=1;e<=c;++e){var o=new p.PDFPageView({container:s,eventBus:this.eventBus,id:e,scale:a,defaultViewport:l.clone(),optionalContentConfigPromise:u,renderingQueue:this.renderingQueue,textLayerMode:n,annotationMode:i,imageResourcesPath:this.imageResourcesPath,renderer:this.renderer,useOnlyCssZoom:this.useOnlyCssZoom,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n,layerProperties:r});this._pages.push(o)}const h=this._pages[0];h&&(h.setPdfPage(e),this.linkService.cachePageRef(1,e.ref)),this._scrollMode===y.ScrollMode.PAGE?this.#ensurePageViewVisible():this._spreadMode!==y.SpreadMode.NONE&&this._updateSpreadMode(),this.#onePageRenderedOrForceFetch().then(async()=>{if(this.findController?.setDocument(d),this._scriptingManager?.setDocument(d),this.#annotationEditorUIManager&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#annotationEditorMode}),d.loadingParams.disableAutoFetch||c>g.FORCE_LAZY_PAGE_INIT)this._pagesCapability.resolve();else{let n=c-1;if(n<=0)this._pagesCapability.resolve();else for(let i=2;i<=c;++i){var e=d.getPage(i).then(e=>{const t=this._pages[i-1];t.pdfPage||t.setPdfPage(e),this.linkService.cachePageRef(i,e.ref),0==--n&&this._pagesCapability.resolve()},e=>{console.error(`Unable to get page ${i} to initialize viewer`,e),0==--n&&this._pagesCapability.resolve()});i%g.PAUSE_EAGER_PAGE_INIT==0&&await e}}}),this.eventBus.dispatch("pagesinit",{source:this}),d.getMetadata().then(({info:e})=>{d===this.pdfDocument&&e.Language&&(this.viewer.lang=e.Language)}),this.defaultRenderingQueue&&this.update()}}).catch(e=>{console.error("Unable to initialize viewer",e),this._pagesCapability.reject(e)})}}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):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=y.UNKNOWN_SCALE,this._currentScaleValue=null,this._pageLabels=null,this.#buffer=new o(10),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=(0,f.createPromiseCapability)(),this._onePageRenderedCapability=(0,f.createPromiseCapability)(),this._pagesCapability=(0,f.createPromiseCapability)(),this._scrollMode=y.ScrollMode.VERTICAL,this._previousScrollMode=y.ScrollMode.UNKNOWN,this._spreadMode=y.SpreadMode.NONE,this.#scrollModePageState={previousPageNumber:1,scrollDown:!0,pages:[]},this._onBeforeDraw&&(this.eventBus._off("pagerender",this._onBeforeDraw),this._onBeforeDraw=null),this._onAfterDraw&&(this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null),this.#onVisibilityChange&&(document.removeEventListener("visibilitychange",this.#onVisibilityChange),this.#onVisibilityChange=null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.viewer.classList.remove(a)}#ensurePageViewVisible(){if(this._scrollMode!==y.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#scrollModePageState,i=this.viewer;if(i.textContent="",t.pages.length=0,this._spreadMode!==y.SpreadMode.NONE||this.isInPresentationMode){const s=new Set,a=this._spreadMode-1,o=(-1==a?s.add(e-1):e%2!=a?(s.add(e-1),s.add(e)):(s.add(e-2),s.add(e-1)),document.createElement("div"));if(o.className="spread",this.isInPresentationMode){const l=document.createElement("div");l.className="dummyPage",o.append(l)}for(const h of s){var n=this._pages[h];n&&(o.append(n.div),t.pages.push(n))}i.append(o)}else{var r=this._pages[e-1];i.append(r.div),t.pages.push(r)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}#scrollIntoView(e,t=null){var i,n,r,{div:e,id:s}=e;this._currentPageNumber!==s&&this._setCurrentPageNumber(s),this._scrollMode===y.ScrollMode.PAGE&&(this.#ensurePageViewVisible(),this.update()),t||this.isInPresentationMode||(i=(s=e.offsetLeft+e.clientLeft)+e.clientWidth,{scrollLeft:n,clientWidth:r}=this.container,(this._scrollMode===y.ScrollMode.HORIZONTAL||s<n||n+r<i)&&(t={left:0,top:0})),(0,y.scrollIntoView)(e,t),!this._currentScaleValue&&this._location&&(this._location=null)}#isSameScale(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}#setScaleUpdatePages(e,t,{noScroll:i=!1,preset:n=!1,drawingDelay:r=-1}){if(this._currentScaleValue=t.toString(),this.#isSameScale(e))n&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t});else{this.viewer.style.setProperty("--scale-factor",e*f.PixelsPerInch.PDF_TO_CSS_UNITS);var s=0<=r&&r<1e3;if(this.refresh(!0,{scale:e,drawingDelay:s?r:-1}),s&&(this.#scaleTimeoutId=setTimeout(()=>{this.#scaleTimeoutId=null,this.refresh()},r)),this._currentScale=e,!i){let e=this._currentPageNumber,t;!this._location||this.isInPresentationMode||this.isChangingPresentationMode||(e=this._location.pageNumber,t=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:e,destArray:t,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:n?t:void 0}),this.defaultRenderingQueue&&this.update()}}get#pageWidthScaleFactor(){return this._spreadMode!==y.SpreadMode.NONE&&this._scrollMode!==y.ScrollMode.HORIZONTAL?2:1}#setScale(i,n){let r=parseFloat(i);if(0<r)n.preset=!1,this.#setScaleUpdatePages(r,i,n);else{var s=this._pages[this._currentPageNumber-1];if(s){let e=y.SCROLLBAR_PADDING,t=y.VERTICAL_PADDING;this.isInPresentationMode?(e=t=4,this._spreadMode!==y.SpreadMode.NONE&&(e*=2)):this.removePageBorders?e=t=0:this._scrollMode===y.ScrollMode.HORIZONTAL&&([e,t]=[t,e]);var a=(this.container.clientWidth-e)/s.width*s.scale/this.#pageWidthScaleFactor,o=(this.container.clientHeight-t)/s.height*s.scale;switch(i){case"page-actual":r=1;break;case"page-width":r=a;break;case"page-height":r=o;break;case"page-fit":r=Math.min(a,o);break;case"auto":var l=(0,y.isPortraitOrientation)(s)?a:Math.min(o,a);r=Math.min(y.MAX_AUTO_SCALE,l);break;default:return void console.error(`#setScale: "${i}" is an unknown zoom value.`)}n.preset=!0,this.#setScaleUpdatePages(r,i,n)}}}#resetCurrentPageView(){var e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#setScale(this._currentScaleValue,{noScroll:!0}),this.#scrollIntoView(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;e=this._pageLabels.indexOf(e);return e<0?null:e+1}scrollPageIntoView({pageNumber:e,destArray:h=null,allowNegativeOffset:d=!1,ignoreDestinationZoom:t=!1}){if(this.pdfDocument){const g=Number.isInteger(e)&&this._pages[e-1];if(g)if(this.isInPresentationMode||!h)this._setCurrentPageNumber(e,!0);else{let i=0,n=0,r=0,s=0,a,o;var c=g.rotation%180!=0,u=(c?g.height:g.width)/g.scale/f.PixelsPerInch.PDF_TO_CSS_UNITS,p=(c?g.width:g.height)/g.scale/f.PixelsPerInch.PDF_TO_CSS_UNITS;let l=0;switch(h[1].name){case"XYZ":i=h[2],n=h[3],l=h[4],i=null!==i?i:0,n=null!==n?n:p;break;case"Fit":case"FitB":l="page-fit";break;case"FitH":case"FitBH":n=h[2],l="page-width",null===n&&this._location?(i=this._location.left,n=this._location.top):("number"!=typeof n||n<0)&&(n=p);break;case"FitV":case"FitBV":i=h[2],r=u,s=p,l="page-height";break;case"FitR":i=h[2],n=h[3],r=h[4]-i,s=h[5]-n;let e=y.SCROLLBAR_PADDING,t=y.VERTICAL_PADDING;this.removePageBorders&&(e=t=0),a=(this.container.clientWidth-e)/r/f.PixelsPerInch.PDF_TO_CSS_UNITS,o=(this.container.clientHeight-t)/s/f.PixelsPerInch.PDF_TO_CSS_UNITS,l=Math.min(Math.abs(a),Math.abs(o));break;default:return void console.error(`scrollPageIntoView: "${h[1].name}" is not a valid destination type.`)}if(t||(l&&l!==this._currentScale?this.currentScaleValue=l:this._currentScale===y.UNKNOWN_SCALE&&(this.currentScaleValue=y.DEFAULT_SCALE_VALUE)),"page-fit"!==l||h[4]){c=[g.viewport.convertToViewportPoint(i,n),g.viewport.convertToViewportPoint(i+r,n+s)];let e=Math.min(c[0][0],c[1][0]),t=Math.min(c[0][1],c[1][1]);d||(e=Math.max(e,0),t=Math.max(t,0)),this.#scrollIntoView(g,{left:e,top:t})}else this.#scrollIntoView(g)}else console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`)}}_updateLocation(e){var t=this._currentScale,i=this._currentScaleValue,t=parseFloat(i)===t?Math.round(1e4*t)/100:i,i=e.id;const n=this._pages[i-1];var r=this.container,r=n.getPagePoint(r.scrollLeft-e.x,r.scrollTop-e.y),e=Math.round(r[0]),r=Math.round(r[1]);let s="#page="+i;this.isInPresentationMode||(s+=`&zoom=${t},${e},`+r),this._location={pageNumber:i,scale:t,top:r,left:e,rotation:this._pagesRotation,pdfOpenParams:s}}update(){var t=this._getVisiblePages(),i=t.views,n=i.length;if(0!==n){var n=Math.max(10,2*n+1),r=(this.#buffer.resize(n,t.ids),this.renderingQueue.renderHighestPriority(t),this._spreadMode===y.SpreadMode.NONE&&(this._scrollMode===y.ScrollMode.PAGE||this._scrollMode===y.ScrollMode.VERTICAL)),s=this._currentPageNumber;let e=!1;for(const a of i){if(a.percent<100)break;if(a.id===s&&r){e=!0;break}}this._setCurrentPageNumber(e?s:i[0].id),this._updateLocation(t.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===y.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===y.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(){var e=this._scrollMode===y.ScrollMode.PAGE?this.#scrollModePageState.pages:this._pages,t=this._scrollMode===y.ScrollMode.HORIZONTAL,i=t&&this._isContainerRtl;return(0,y.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}isPageVisible(e){return!!this.pdfDocument&&(Number.isInteger(e)&&0<e&&e<=this.pagesCount?this._getVisiblePages().ids.has(e):(console.error(`isPageVisible: "${e}" is not a valid page.`),!1))}isPageCached(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&0<e&&e<=this.pagesCount))return console.error(`isPageCached: "${e}" is not a valid page.`),!1;e=this._pages[e-1];return this.#buffer.has(e)}cleanup(){for(const e of this._pages)e.renderingState!==y.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#ensurePdfPageLoaded(e){if(e.pdfPage)return e.pdfPage;try{var t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref),t}catch(e){return console.error("Unable to get page for page view",e),null}}#getScrollAhead(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case y.ScrollMode.PAGE:return this.#scrollModePageState.scrollDown;case y.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){var e=e||this._getVisiblePages(),t=this.#getScrollAhead(e),i=this._spreadMode!==y.SpreadMode.NONE&&this._scrollMode!==y.ScrollMode.HORIZONTAL;const n=this.renderingQueue.getHighestPriority(e,this._pages,t,i);return!!n&&(this.#ensurePdfPageLoaded(n).then(()=>{this.renderingQueue.renderView(n)}),!0)}get hasEqualPageSizes(){var i=this._pages[0];for(let e=1,t=this._pages.length;e<t;++e){var n=this._pages[e];if(n.width!==i.width||n.height!==i.height)return!1}return!0}getPagesOverview(){return this._pages.map(e=>{e=e.pdfPage.getViewport({scale:1});return!this.enablePrintAutoRotate||(0,y.isPortraitOrientation)(e)?{width:e.width,height:e.height,rotation:e.rotation}:{width:e.height,height:e.width,rotation:(e.rotation-90)%360}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise||(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig()):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error("Invalid optionalContentConfigPromise: "+e);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,y.isValidScrollMode)(e))throw new Error("Invalid scroll mode: "+e);this.pagesCount>g.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===y.ScrollMode.HORIZONTAL),i.classList.toggle("scrollWrapped",t===y.ScrollMode.WRAPPED),this.pdfDocument&&e&&(t===y.ScrollMode.PAGE?this.#ensurePageViewVisible():this._previousScrollMode===y.ScrollMode.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#setScale(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,y.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){const r=this.viewer,s=this._pages;if(this._scrollMode===y.ScrollMode.PAGE)this.#ensurePageViewVisible();else if(r.textContent="",this._spreadMode===y.SpreadMode.NONE)for(const t of this._pages)r.append(t.div);else{var n=this._spreadMode-1;let i=null;for(let e=0,t=s.length;e<t;++e)null===i?((i=document.createElement("div")).className="spread",r.append(i)):e%2==n&&(i=i.cloneNode(!1),r.append(i)),i.append(s[e].div)}e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#setScale(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}}_getPageAdvance(i,e=!1){switch(this._scrollMode){case y.ScrollMode.WRAPPED:{const v=this._getVisiblePages()["views"],m=new Map;for(var{id:t,y:n,percent:r,widthPercent:s}of v)if(!(0===r||s<100)){let e=m.get(n);e||m.set(n,e||=[]),e.push(t)}for(const P of m.values()){var a=P.indexOf(i);if(-1!==a){var o=P.length;if(1===o)break;if(e)for(let e=a-1;0<=e;e--){var l=P[e],h=P[e+1]-1;if(l<h)return i-h}else for(let e=a+1,t=o;e<t;e++){var d=P[e],c=P[e-1]+1;if(c<d)return c-i}if(e){a=P[0];if(a<i)return i-a+1}else{a=P[o-1];if(i<a)return a-i+1}break}}break}case y.ScrollMode.HORIZONTAL:break;case y.ScrollMode.PAGE:case y.ScrollMode.VERTICAL:if(this._spreadMode===y.SpreadMode.NONE)break;var u=this._spreadMode-1;if(e&&i%2!=u)break;if(!e&&i%2==u)break;var p,g,f,u=this._getVisiblePages()["views"],_=e?i-1:i+1;for({id:p,percent:g,widthPercent:f}of u)if(p===_){if(0<g&&100===f)return 2;break}}return 1}nextPage(){var e=this._currentPageNumber,t=this.pagesCount;if(t<=e)return!1;var i=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+i,t),!0}previousPage(){var e=this._currentPageNumber;if(e<=1)return!1;var t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}increaseScale({drawingDelay:t,scaleFactor:i,steps:n}={}){if(this.pdfDocument){let e=this._currentScale;if(1<i)e=Math.round(e*i*100)/100;else for(n??=1;e=Math.ceil(10*(e*y.DEFAULT_SCALE_DELTA).toFixed(2))/10,0<--n&&e<y.MAX_SCALE;);this.#setScale(Math.min(y.MAX_SCALE,e),{noScroll:!1,drawingDelay:t})}}decreaseScale({drawingDelay:t,scaleFactor:i,steps:n}={}){if(this.pdfDocument){let e=this._currentScale;if(0<i&&i<1)e=Math.round(e*i*100)/100;else for(n??=1;e=Math.floor(10*(e/y.DEFAULT_SCALE_DELTA).toFixed(2))/10,0<--n&&e>y.MIN_SCALE;);this.#setScale(Math.max(y.MIN_SCALE,e),{noScroll:!1,drawingDelay:t})}}#updateContainerHeightCss(e=this.container.clientHeight){e!==this.#previousContainerHeight&&(this.#previousContainerHeight=e,y.docStyle.setProperty("--viewer-container-height",e+"px"))}#resizeObserverCallback(e){for(const t of e)if(t.target===this.container){this.#updateContainerHeightCss(Math.floor(t.borderBoxSize[0].blockSize)),this.#containerTopLeft=null;break}}get containerTopLeft(){return this.#containerTopLeft||=[this.container.offsetTop,this.container.offsetLeft]}get annotationEditorMode(){return this.#annotationEditorUIManager?this.#annotationEditorMode:f.AnnotationEditorType.DISABLE}set annotationEditorMode(e){if(!this.#annotationEditorUIManager)throw new Error("The AnnotationEditor is not enabled.");if(this.#annotationEditorMode!==e){if(!_(e))throw new Error("Invalid AnnotationEditor mode: "+e);this.pdfDocument&&(this.#annotationEditorMode=e,this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e}),this.#annotationEditorUIManager.updateMode(e))}}set annotationEditorParams({type:e,value:t}){if(!this.#annotationEditorUIManager)throw new Error("The AnnotationEditor is not enabled.");this.#annotationEditorUIManager.updateParams(e,t)}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(const i of this._pages)i.update(t);null!==this.#scaleTimeoutId&&(clearTimeout(this.#scaleTimeoutId),this.#scaleTimeoutId=null),e||this.update()}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFRenderingQueue=void 0;var n=i(4),r=i(2);t.PDFRenderingQueue=class{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){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,i,n,t=!1){var r=e.views,s=r.length;if(0===s)return null;for(let e=0;e<s;e++){var a=r[e].view;if(!this.isViewFinished(a))return a}var o=e.first.id,l=e.last.id;if(s<l-o+1){const c=e.ids;for(let e=1,t=l-o;e<t;e++){var h=n?o+e:l-e;if(!c.has(h)){h=i[h-1];if(!this.isViewFinished(h))return h}}}e=n?l:o-2;let d=i[e];return d&&!this.isViewFinished(d)||t&&(e+=n?1:-1,(d=i[e])&&!this.isViewFinished(d))?d:null}isViewFinished(e){return e.renderingState===r.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case r.RenderingStates.FINISHED:return!1;case r.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case r.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case r.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof n.RenderingCancelledException||console.error(`renderView: "${e}"`)})}return!0}}}],n={};function r(e){var t=n[e];if(void 0!==t)return t.exports;t=n[e]={exports:{}};return i[e](t,t.exports,r),t.exports}var e={},t=e,s=(Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AnnotationLayerBuilder",{enumerable:!0,get:function(){return o.AnnotationLayerBuilder}}),t.DefaultXfaLayerFactory=t.DefaultTextLayerFactory=t.DefaultStructTreeLayerFactory=t.DefaultAnnotationLayerFactory=void 0,Object.defineProperty(t,"DownloadManager",{enumerable:!0,get:function(){return l.DownloadManager}}),Object.defineProperty(t,"EventBus",{enumerable:!0,get:function(){return h.EventBus}}),Object.defineProperty(t,"GenericL10n",{enumerable:!0,get:function(){return d.GenericL10n}}),Object.defineProperty(t,"LinkTarget",{enumerable:!0,get:function(){return s.LinkTarget}}),Object.defineProperty(t,"NullL10n",{enumerable:!0,get:function(){return c.NullL10n}}),Object.defineProperty(t,"PDFFindController",{enumerable:!0,get:function(){return u.PDFFindController}}),Object.defineProperty(t,"PDFHistory",{enumerable:!0,get:function(){return p.PDFHistory}}),Object.defineProperty(t,"PDFLinkService",{enumerable:!0,get:function(){return s.PDFLinkService}}),Object.defineProperty(t,"PDFPageView",{enumerable:!0,get:function(){return g.PDFPageView}}),Object.defineProperty(t,"PDFScriptingManager",{enumerable:!0,get:function(){return f.PDFScriptingManager}}),Object.defineProperty(t,"PDFSinglePageViewer",{enumerable:!0,get:function(){return _.PDFSinglePageViewer}}),Object.defineProperty(t,"PDFViewer",{enumerable:!0,get:function(){return v.PDFViewer}}),Object.defineProperty(t,"ProgressBar",{enumerable:!0,get:function(){return a.ProgressBar}}),Object.defineProperty(t,"RenderingStates",{enumerable:!0,get:function(){return a.RenderingStates}}),Object.defineProperty(t,"ScrollMode",{enumerable:!0,get:function(){return a.ScrollMode}}),Object.defineProperty(t,"SimpleLinkService",{enumerable:!0,get:function(){return s.SimpleLinkService}}),Object.defineProperty(t,"SpreadMode",{enumerable:!0,get:function(){return a.SpreadMode}}),Object.defineProperty(t,"StructTreeLayerBuilder",{enumerable:!0,get:function(){return m.StructTreeLayerBuilder}}),Object.defineProperty(t,"TextLayerBuilder",{enumerable:!0,get:function(){return P.TextLayerBuilder}}),Object.defineProperty(t,"XfaLayerBuilder",{enumerable:!0,get:function(){return y.XfaLayerBuilder}}),Object.defineProperty(t,"parseQueryString",{enumerable:!0,get:function(){return a.parseQueryString}}),r(1)),a=r(2),o=r(3),l=r(6),h=r(7),d=r(8),c=r(5),u=r(10),p=r(12),g=r(13),f=r(21),_=r(23),v=r(24),m=r(16),P=r(19),y=r(20);return t.DefaultAnnotationLayerFactory=class{constructor(){throw new Error("The `DefaultAnnotationLayerFactory` has been removed, please use the `annotationMode` option when initializing the `PDFPageView`-instance to control AnnotationLayer rendering.")}},t.DefaultStructTreeLayerFactory=class{constructor(){throw new Error("The `DefaultStructTreeLayerFactory` has been removed, this functionality is automatically enabled when the TextLayer is used.")}},t.DefaultTextLayerFactory=class{constructor(){throw new Error("The `DefaultTextLayerFactory` has been removed, please use the `textLayerMode` option when initializing the `PDFPageView`-instance to control TextLayer rendering.")}},t.DefaultXfaLayerFactory=class{constructor(){throw new Error("The `DefaultXfaLayerFactory` has been removed, please use the `enableXfa` option when calling the `getDocument`-function to control XfaLayer rendering.")}},e})());